@tamagui/to-tailwind 3.0.0-beta.922.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/transform.cjs +99 -10
- package/dist/cjs/transform.native.cjs +120 -19
- package/dist/cjs/transform.native.js +120 -19
- package/dist/cjs/transform.native.js.map +1 -1
- package/dist/esm/transform.mjs +100 -11
- package/dist/esm/transform.mjs.map +1 -1
- package/dist/esm/transform.native.js +121 -20
- package/dist/esm/transform.native.js.map +1 -1
- package/package.json +5 -4
- package/src/transform.ts +140 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","names":["canonicalShorthands"],"sources":["esm/transform.js"],"sourcesContent":["import { parse } from \"@babel/parser\";\nimport _traverse from \"@babel/traverse\";\nimport _generate from \"@babel/generator\";\nimport * as t from \"@babel/types\";\nimport {\n defaultMediaKeys,\n createModifierRegistry,\n fontWeightNames,\n formatCandidate,\n getTokenCategory,\n propToTailwindPrefix,\n parseValue,\n standaloneValueProps,\n v6RemovedThemeNames,\n v6ThemeNameReplacements\n} from \"@tamagui/style-grammar/tooling\";\nimport { componentToTag } from \"./maps/componentToTag\";\nimport { shorthands as canonicalShorthands } from \"@tamagui/shorthands/v4\";\nconst traverse = _traverse.default ?? _traverse;\nconst generate = _generate.default ?? _generate;\nconst defaultShorthands = canonicalShorthands;\nconst removedV6ThemeNames = new Set(v6RemovedThemeNames);\nfunction getV6ThemeName(name) {\n const opacityIndex = name.indexOf(\"/\");\n const baseName = opacityIndex === -1 ? name : name.slice(0, opacityIndex);\n if (removedV6ThemeNames.has(baseName)) return null;\n const mapped = v6ThemeNameReplacements[baseName] ?? baseName;\n return opacityIndex === -1 ? mapped : `${mapped}${name.slice(opacityIndex)}`;\n}\nfunction namesToSet(names) {\n if (!names) return /* @__PURE__ */ new Set();\n if (Array.isArray(names)) return new Set(names);\n if (names instanceof Set) return new Set(names);\n return new Set(Object.keys(names));\n}\nfunction addConfigNames(target, source) {\n if (!source) return;\n for (const key in source) target.add(key);\n}\nfunction createTransformGrammarConfig(options, mediaKeys, shorthands) {\n if (options.grammarConfig) {\n return { ...options.grammarConfig, shorthands, mediaNames: mediaKeys };\n }\n const tokenNames = {};\n const tokenCategories = [\"space\", \"size\", \"radius\", \"zIndex\", \"color\"];\n const fontCategories = [\n \"fontFamily\",\n \"fontSize\",\n \"fontWeight\",\n \"lineHeight\",\n \"letterSpacing\"\n ];\n const authoritative = [\"tokens\", \"fonts\", \"themes\", \"media\", \"shorthands\"].some(\n (key) => key in options\n );\n if (authoritative) {\n for (const category of [...tokenCategories, ...fontCategories]) {\n tokenNames[category] = /* @__PURE__ */ new Set();\n }\n }\n for (const category of tokenCategories) {\n if (options.tokens?.[category]) {\n const names = tokenNames[category] || /* @__PURE__ */ new Set();\n addConfigNames(names, options.tokens[category]);\n tokenNames[category] = names;\n }\n }\n if (options.fonts) {\n tokenNames.fontFamily ||= /* @__PURE__ */ new Set();\n tokenNames.fontSize ||= /* @__PURE__ */ new Set();\n tokenNames.fontWeight ||= /* @__PURE__ */ new Set();\n tokenNames.lineHeight ||= /* @__PURE__ */ new Set();\n tokenNames.letterSpacing ||= /* @__PURE__ */ new Set();\n for (const familyName in options.fonts) {\n tokenNames.fontFamily.add(familyName);\n const font = options.fonts[familyName];\n addConfigNames(tokenNames.fontSize, font?.size);\n addConfigNames(tokenNames.fontWeight, font?.weight);\n addConfigNames(tokenNames.lineHeight, font?.lineHeight);\n addConfigNames(tokenNames.letterSpacing, font?.letterSpacing);\n }\n }\n const themeNames = /* @__PURE__ */ new Set();\n if (options.themes) {\n tokenNames.color ||= /* @__PURE__ */ new Set();\n for (const themeName in options.themes) {\n themeNames.add(themeName);\n for (const name in options.themes[themeName]) {\n const mapped = getV6ThemeName(name);\n if (mapped) tokenNames.color.add(mapped);\n }\n }\n }\n return {\n shorthands,\n mediaNames: mediaKeys,\n themeNames,\n tokenNames\n };\n}\nfunction findParseError(source) {\n try {\n const ast = parse(source, {\n sourceType: \"module\",\n plugins: [\"jsx\", \"typescript\"],\n errorRecovery: true\n });\n const errs = ast.errors;\n if (errs && errs.length > 0) {\n const e = errs[0];\n const loc = e?.loc ? `${e.loc.line}:${e.loc.column}` : \"?\";\n return `${e?.reasonCode || e?.message || \"parse error\"} at ${loc}`;\n }\n return null;\n } catch (e) {\n return e.message || \"parse error\";\n }\n}\nfunction tamaguiToTailwind(source, options = {}) {\n const { renameComponents = true } = options;\n const mediaKeys = options.grammarConfig?.mediaNames ? namesToSet(options.grammarConfig.mediaNames) : options.media ? new Set(Array.isArray(options.media) ? options.media : Object.keys(options.media)) : new Set(defaultMediaKeys);\n const shorthands = options.grammarConfig?.shorthands ?? options.shorthands ?? defaultShorthands;\n const grammarConfig = createTransformGrammarConfig(options, mediaKeys, shorthands);\n const ctx = {\n mediaKeys,\n componentAllow: new Set(options.components ?? []),\n shorthands,\n grammarConfig,\n modifierRegistry: createModifierRegistry(grammarConfig).registry\n };\n let ast;\n try {\n ast = parse(source, {\n sourceType: \"module\",\n plugins: [\"jsx\", \"typescript\"],\n errorRecovery: true\n });\n } catch {\n return source;\n }\n if (ast.errors && ast.errors.length > 0) {\n return source;\n }\n let didTransform = false;\n traverse(ast, {\n JSXOpeningElement(path) {\n const node = path.node;\n const resolved = resolveTamaguiComponent(path, ctx);\n if (resolved === null) return;\n const { name: componentName, isSimpleKnown, isPlainIdentifier } = resolved;\n if (node.attributes.some((a) => t.isJSXSpreadAttribute(a))) return;\n const hasDynamicClassName = node.attributes.some(\n (attr) => t.isJSXAttribute(attr) && attr.name.name === \"className\" && getStringValue(attr.value) === null\n );\n if (hasDynamicClassName) return;\n const hasClassName = node.attributes.some(\n (attr) => t.isJSXAttribute(attr) && attr.name.name === \"className\"\n );\n const hasNeighboringStyleProp = node.attributes.some((attr) => {\n if (!t.isJSXAttribute(attr) || attr.name.name === \"className\") return false;\n const name = attr.name.name;\n return isConvertibleStyleProp(resolveShorthand(ctx, name));\n });\n if (hasClassName && hasNeighboringStyleProp) return;\n const classes = [];\n const keptAttrs = [];\n let existingClassName = null;\n const blockedLeafKeys = /* @__PURE__ */ new Set();\n for (const a of node.attributes) {\n if (t.isJSXAttribute(a) && a.name.name === \"className\") {\n const v = getStringValue(a.value);\n if (v) {\n for (const tok of v.split(/\\s+/)) {\n if (tok) for (const k of leafKeysOfClassToken(tok)) blockedLeafKeys.add(k);\n }\n }\n }\n }\n const implicitClasses = [];\n if (componentName === \"XStack\") implicitClasses.push(\"flex\", \"flex-row\");\n else if (componentName === \"YStack\") implicitClasses.push(\"flex\", \"flex-col\");\n else if (componentName === \"ZStack\") implicitClasses.push(\"relative\");\n const styleEntries = [];\n for (const attr of node.attributes) {\n if (!t.isJSXAttribute(attr)) {\n keptAttrs.push(attr);\n continue;\n }\n const name = attr.name.name;\n if (name === \"className\") {\n existingClassName = attr;\n continue;\n }\n styleEntries.push({\n attr,\n fullProp: resolveShorthand(ctx, name),\n cls: propValueToClass(ctx, name, attr.value)\n });\n }\n const retainedLeafKeys = new Set(blockedLeafKeys);\n for (const e of styleEntries) {\n if (e.cls === null && isConvertibleStyleProp(e.fullProp)) {\n for (const k of leafKeysOfProp(e.fullProp)) retainedLeafKeys.add(k);\n }\n }\n for (const c of implicitClasses) {\n if (!overlapsSet(leafKeysOfClassToken(c), retainedLeafKeys)) classes.push(c);\n }\n for (const e of styleEntries) {\n if (e.cls !== null && !overlapsSet(leafKeysOfProp(e.fullProp), retainedLeafKeys)) {\n classes.push(e.cls);\n } else {\n keptAttrs.push(e.attr);\n }\n }\n if (classes.length > 0) {\n const classStr = classes.join(\" \");\n if (existingClassName) {\n const existingVal = getStringValue(existingClassName.value);\n if (existingVal !== null) {\n existingClassName.value = t.stringLiteral(\n existingVal ? `${classStr} ${existingVal}` : classStr\n );\n keptAttrs.unshift(existingClassName);\n } else if (t.isJSXExpressionContainer(existingClassName.value) && !t.isJSXEmptyExpression(existingClassName.value.expression)) {\n const expr = existingClassName.value.expression;\n existingClassName.value = t.jsxExpressionContainer(\n t.templateLiteral(\n [\n t.templateElement(\n { raw: `${classStr} `, cooked: `${classStr} ` },\n false\n ),\n t.templateElement({ raw: \"\", cooked: \"\" }, true)\n ],\n [expr]\n )\n );\n keptAttrs.unshift(existingClassName);\n } else {\n keptAttrs.unshift(\n t.jsxAttribute(t.jsxIdentifier(\"className\"), t.stringLiteral(classStr))\n );\n }\n } else {\n keptAttrs.unshift(\n t.jsxAttribute(t.jsxIdentifier(\"className\"), t.stringLiteral(classStr))\n );\n }\n } else if (existingClassName) {\n keptAttrs.unshift(existingClassName);\n }\n node.attributes = keptAttrs;\n if (classes.length > 0) didTransform = true;\n if (renameComponents && isSimpleKnown && isPlainIdentifier) {\n const tag = componentToTag[componentName];\n node.name = t.jsxIdentifier(tag);\n const parent = path.parent;\n if (t.isJSXElement(parent) && parent.closingElement) {\n parent.closingElement.name = t.jsxIdentifier(tag);\n }\n didTransform = true;\n }\n }\n });\n if (!didTransform) return source;\n const output = generate(ast, { retainLines: true, concise: false });\n return output.code;\n}\nconst knownCompoundComponents = /* @__PURE__ */ new Set([\n \"Sheet.Frame\",\n \"Sheet.Overlay\",\n \"Sheet.Handle\",\n \"Sheet.ScrollView\",\n \"Sheet.Container\",\n \"Dialog.Content\",\n \"Dialog.Overlay\",\n \"Popover.Content\",\n \"Tabs.Tab\"\n]);\nfunction isTamaguiSource(source) {\n return source === \"tamagui\" || source.startsWith(\"@tamagui/\");\n}\nfunction resolveTamaguiComponent(path, ctx) {\n const nameNode = path.node.name;\n let baseName;\n let memberChain = [];\n const isPlainIdentifier = t.isJSXIdentifier(nameNode);\n if (t.isJSXIdentifier(nameNode)) {\n baseName = nameNode.name;\n } else if (t.isJSXMemberExpression(nameNode)) {\n const parts = [];\n let cur = nameNode;\n while (t.isJSXMemberExpression(cur)) {\n parts.unshift(cur.property.name);\n cur = cur.object;\n }\n if (!t.isJSXIdentifier(cur)) return null;\n baseName = cur.name;\n memberChain = parts;\n } else {\n return null;\n }\n const binding = path.scope?.getBinding?.(baseName);\n let tamaguiBase;\n if (binding) {\n const bnode = binding.path.node;\n if (t.isImportSpecifier(bnode) || t.isImportDefaultSpecifier(bnode) || t.isImportNamespaceSpecifier(bnode)) {\n const decl = binding.path.parent;\n const source = t.isImportDeclaration(decl) ? String(decl.source.value) : \"\";\n if (!isTamaguiSource(source)) return null;\n if (t.isImportNamespaceSpecifier(bnode)) {\n if (memberChain.length === 0) return null;\n tamaguiBase = memberChain[0];\n memberChain = memberChain.slice(1);\n } else if (t.isImportSpecifier(bnode)) {\n const imported = bnode.imported;\n tamaguiBase = t.isIdentifier(imported) ? imported.name : String(imported.value);\n } else {\n return null;\n }\n } else {\n return null;\n }\n } else {\n tamaguiBase = baseName;\n }\n const name = memberChain.length ? [tamaguiBase, ...memberChain].join(\".\") : tamaguiBase;\n const isSimpleKnown = memberChain.length === 0 && name in componentToTag;\n if (!isSimpleKnown && !knownCompoundComponents.has(name) && !ctx.componentAllow.has(name)) {\n return null;\n }\n return { name, isSimpleKnown, isPlainIdentifier };\n}\nfunction classPrefixOf(token) {\n const noMod = token.slice(token.lastIndexOf(\":\") + 1);\n const core = noMod[0] === \"-\" ? noMod.slice(1) : noMod;\n const dash = core.indexOf(\"-\");\n return dash === -1 ? core : core.slice(0, dash);\n}\nconst leafExpansion = {\n padding: [\"paddingTop\", \"paddingRight\", \"paddingBottom\", \"paddingLeft\"],\n paddingHorizontal: [\"paddingLeft\", \"paddingRight\"],\n paddingVertical: [\"paddingTop\", \"paddingBottom\"],\n margin: [\"marginTop\", \"marginRight\", \"marginBottom\", \"marginLeft\"],\n marginHorizontal: [\"marginLeft\", \"marginRight\"],\n marginVertical: [\"marginTop\", \"marginBottom\"],\n inset: [\"top\", \"right\", \"bottom\", \"left\"],\n gap: [\"gap\", \"rowGap\", \"columnGap\"],\n borderWidth: [\n \"borderTopWidth\",\n \"borderRightWidth\",\n \"borderBottomWidth\",\n \"borderLeftWidth\"\n ],\n borderColor: [\n \"borderTopColor\",\n \"borderRightColor\",\n \"borderBottomColor\",\n \"borderLeftColor\"\n ],\n borderRadius: [\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderBottomRightRadius\"\n ]\n};\nfunction leafKeysOfProp(fullProp) {\n return leafExpansion[fullProp] ?? [fullProp];\n}\nconst prefixToProp = (() => {\n const m = {};\n for (const [prop, prefix] of Object.entries(propToTailwindPrefix)) {\n if (prefix && !(prefix in m)) m[prefix] = prop;\n }\n return m;\n})();\nfunction leafKeysOfClassToken(token) {\n const prefix = classPrefixOf(token);\n return leafKeysOfProp(prefixToProp[prefix] ?? prefix);\n}\nfunction overlapsSet(keys, set) {\n return keys.some((k) => set.has(k));\n}\nfunction isConvertibleStyleProp(fullProp) {\n return propToTailwindPrefix[fullProp] !== void 0 || fullProp in standaloneValueProps;\n}\nfunction propValueToClass(ctx, propName, value) {\n const fullProp = resolveShorthand(ctx, propName);\n if (propToTailwindPrefix[fullProp] === void 0) return null;\n const strVal = getStringValue(value);\n const numVal = getNumericValue(value);\n if (strVal !== null) {\n const parsed = parseValue(strVal, ctx.modifierRegistry);\n if (!parsed.ok) return null;\n const classes = [];\n if (parsed.value.base !== null) {\n const base = payloadToClass(ctx, fullProp, parsed.value.base, []);\n if (base === null) return null;\n classes.push(base);\n }\n for (const clause of parsed.value.clauses) {\n const conditional = payloadToClass(ctx, fullProp, clause.payload, clause.modifiers);\n if (conditional === null) return null;\n classes.push(conditional);\n }\n return classes.length ? classes.join(\" \") : null;\n }\n if (numVal === null) return null;\n const formatted = formatNumericValue(fullProp, numVal);\n if (formatted === null) return null;\n return formatCandidate(\n {\n prop: fullProp,\n value: formatted.value,\n valueKind: formatted.valueKind,\n modifiers: void 0\n },\n ctx.grammarConfig\n );\n}\nfunction payloadToClass(ctx, fullProp, payload, modifiers) {\n let formatted;\n if (standaloneValueProps[fullProp]?.[payload]) {\n formatted = { value: payload, valueKind: \"enum\" };\n } else {\n formatted = formatStringValue(ctx, fullProp, payload);\n if (formatted === null && /^-?\\d+(?:\\.\\d+)?$/.test(payload)) {\n const category = getTokenCategory(fullProp);\n if (!category || ctx.grammarConfig.tokenNames?.[category] !== void 0) {\n formatted = formatNumericValue(fullProp, Number(payload));\n }\n }\n }\n if (formatted === null) return null;\n return formatCandidate(\n {\n prop: fullProp,\n value: formatted.value,\n valueKind: formatted.valueKind,\n modifiers: modifiers.length ? modifiers : void 0\n },\n ctx.grammarConfig\n );\n}\nfunction getStringValue(value) {\n if (!value) return null;\n if (t.isStringLiteral(value)) return value.value;\n if (t.isJSXExpressionContainer(value) && t.isStringLiteral(value.expression)) {\n return value.expression.value;\n }\n if (t.isJSXExpressionContainer(value) && t.isTemplateLiteral(value.expression)) {\n if (value.expression.expressions.length === 0 && value.expression.quasis.length === 1) {\n return value.expression.quasis[0].value.raw;\n }\n }\n return null;\n}\nfunction getNumericValue(value) {\n if (!value) return null;\n if (t.isJSXExpressionContainer(value)) {\n if (t.isNumericLiteral(value.expression)) return value.expression.value;\n if (t.isUnaryExpression(value.expression) && value.expression.operator === \"-\" && t.isNumericLiteral(value.expression.argument)) {\n return -value.expression.argument.value;\n }\n }\n return null;\n}\nfunction resolveShorthand(ctx, name) {\n return ctx.shorthands[name] || name;\n}\nfunction hasConfiguredName(names, value) {\n if (!names) return false;\n if (Array.isArray(names)) return names.includes(value);\n if (names instanceof Set) return names.has(value);\n return value in names;\n}\nfunction formatStringValue(ctx, prop, value) {\n const category = getTokenCategory(prop);\n if (prop !== \"fontWeight\" && category && hasConfiguredName(ctx.grammarConfig.tokenNames?.[category], value)) {\n if (category === \"color\") {\n const mapped = getV6ThemeName(value);\n return mapped ? { value: mapped, valueKind: \"token\" } : null;\n }\n return { value, valueKind: \"token\" };\n }\n if (prop === \"fontWeight\") {\n return fontWeightNames[value] ? { value, valueKind: \"enum\" } : null;\n }\n if (prop === \"zIndex\" && /^\\d+$/.test(value)) {\n return { value, valueKind: \"convenience\" };\n }\n if (/^-?\\d+(\\.\\d+)?$/.test(value)) return null;\n if (value.endsWith(\"%\")) {\n const exact = {\n \"100%\": \"full\",\n \"50%\": \"1/2\",\n \"25%\": \"1/4\",\n \"75%\": \"3/4\"\n };\n if (getTokenCategory(prop) === \"size\" && exact[value]) {\n return { value: exact[value], valueKind: \"convenience\" };\n }\n return { value, valueKind: \"arbitrary\" };\n }\n if (value === \"auto\" && getTokenCategory(prop) === \"size\") {\n return { value, valueKind: \"convenience\" };\n }\n if (prop === \"fontFamily\") return { value, valueKind: \"arbitrary\" };\n if (value.includes(\"(\") || value.includes(\" \") || value.includes(\"_\") || value.startsWith(\"#\") || value.startsWith(\"-\") || /^[\\d.]+[a-z%]/i.test(value)) {\n return { value, valueKind: \"arbitrary\" };\n }\n return { value, valueKind: \"arbitrary\" };\n}\nconst pxLengthProps = /* @__PURE__ */ new Set([\n \"width\",\n \"height\",\n \"minWidth\",\n \"maxWidth\",\n \"minHeight\",\n \"maxHeight\",\n \"flexBasis\",\n \"padding\",\n \"paddingTop\",\n \"paddingRight\",\n \"paddingBottom\",\n \"paddingLeft\",\n \"paddingHorizontal\",\n \"paddingVertical\",\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n \"marginHorizontal\",\n \"marginVertical\",\n \"gap\",\n \"rowGap\",\n \"columnGap\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n \"inset\",\n \"borderRadius\",\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderBottomRightRadius\",\n \"fontSize\",\n \"letterSpacing\",\n \"lineHeight\"\n]);\nfunction formatNumericValue(prop, value) {\n if (prop === \"opacity\") {\n const pct = value * 100;\n return Number.isInteger(pct) ? { value: String(pct), valueKind: \"convenience\" } : { value: String(value), valueKind: \"arbitrary\" };\n }\n if (prop === \"aspectRatio\") return { value: String(value), valueKind: \"arbitrary\" };\n if (prop === \"scale\" || prop === \"scaleX\" || prop === \"scaleY\") {\n if (value === 0) return { value: \"0\", valueKind: \"convenience\" };\n if (value === 1) return { value: \"100\", valueKind: \"convenience\" };\n return { value: String(value), valueKind: \"arbitrary\" };\n }\n if (prop === \"flex\") {\n return value === 1 ? { value: \"1\", valueKind: \"convenience\" } : { value: String(value), valueKind: \"arbitrary\" };\n }\n if (prop === \"flexGrow\" || prop === \"flexShrink\") {\n return { value: String(value), valueKind: \"arbitrary\" };\n }\n if (prop === \"zIndex\") {\n return Number.isInteger(value) && value >= 0 ? { value: String(value), valueKind: \"convenience\" } : { value: String(value), valueKind: \"arbitrary\" };\n }\n if (prop === \"fontWeight\") {\n return fontWeightNames[String(value)] ? { value: String(value), valueKind: \"enum\" } : null;\n }\n if (prop === \"rotate\") return null;\n if (prop === \"x\" || prop === \"y\") {\n return { value: `${value}px`, valueKind: \"arbitrary\" };\n }\n if (prop.includes(\"Width\") && prop.startsWith(\"border\")) {\n return { value: `${value}px`, valueKind: \"arbitrary\" };\n }\n if (pxLengthProps.has(prop)) {\n return { value: `${value}px`, valueKind: \"arbitrary\" };\n }\n return null;\n}\nexport {\n findParseError,\n tamaguiToTailwind\n};\n//# sourceMappingURL=transform.js.map\n"],"mappings":";;;;;;;;;AAkBA,MAAM,WAAW,UAAU,WAAW;AACtC,MAAM,WAAW,UAAU,WAAW;AACtC,MAAM,oBAAoBA;AAC1B,MAAM,sBAAsB,IAAI,IAAI,mBAAmB;AACvD,SAAS,eAAe,MAAM;CAC5B,MAAM,eAAe,KAAK,QAAQ,GAAG;CACrC,MAAM,WAAW,iBAAiB,CAAC,IAAI,OAAO,KAAK,MAAM,GAAG,YAAY;CACxE,IAAI,oBAAoB,IAAI,QAAQ,GAAG,OAAO;CAC9C,MAAM,SAAS,wBAAwB,aAAa;CACpD,OAAO,iBAAiB,CAAC,IAAI,SAAS,GAAG,SAAS,KAAK,MAAM,YAAY;AAC3E;AACA,SAAS,WAAW,OAAO;CACzB,IAAI,CAAC,OAAO,uBAAuB,IAAI,IAAI;CAC3C,IAAI,MAAM,QAAQ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A,IAAI,SAAS,QAAQ;EACnB,OAAO,UAAU,IAAI;GAAE,OAAO;GAAK,WAAW;EAAc,IAAI;GAAE,OAAO,OAAO,KAAK;GAAG,WAAW;EAAY;CACjH;CACA,IAAI,SAAS,cAAc,SAAS,cAAc;EAChD,OAAO;GAAE,OAAO,OAAO,KAAK;GAAG,WAAW;EAAY;CACxD;CACA,IAAI,SAAS,UAAU;EACrB,OAAO,OAAO,UAAU,KAAK,KAAK,SAAS,IAAI;GAAE,OAAO,OAAO,KAAK;GAAG,WAAW;EAAc,IAAI;GAAE,OAAO,OAAO,KAAK;GAAG,WAAW;EAAY;CACrJ;CACA,IAAI,SAAS,cAAc;EACzB,OAAO,gBAAgB,OAAO,KAAK,KAAK;GAAE,OAAO,OAAO,KAAK;GAAG,WAAW;EAAO,IAAI;CACxF;CACA,IAAI,SAAS,UAAU,OAAO;CAC9B,IAAI,SAAS,OAAO,SAAS,KAAK;EAChC,OAAO;GAAE,OAAO,GAAG,MAAM;GAAK,WAAW;EAAY;CACvD;CACA,IAAI,KAAK,SAAS,OAAO,KAAK,KAAK,WAAW,QAAQ,GAAG;EACvD,OAAO;GAAE,OAAO,GAAG,MAAM;GAAK,WAAW;EAAY;CACvD;CACA,IAAI,cAAc,IAAI,IAAI,GAAG;EAC3B,OAAO;GAAE,OAAO,GAAG,MAAM;GAAK,WAAW;EAAY;CACvD;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"transform.js","names":["canonicalShorthands"],"sources":["esm/transform.js"],"sourcesContent":["import { parse } from \"@babel/parser\";\nimport _traverse from \"@babel/traverse\";\nimport _generate from \"@babel/generator\";\nimport * as t from \"@babel/types\";\nimport {\n defaultMediaKeys,\n createModifierRegistry,\n fontWeightNames,\n formatCandidate,\n getTokenCategory,\n propToTailwindPrefix,\n parseValue,\n standaloneValueProps,\n v6RemovedThemeNames,\n v6ThemeNameReplacements,\n propTokenGroupFallbacks\n} from \"@tamagui/style-grammar/tooling\";\nimport { componentToTag } from \"./maps/componentToTag\";\nimport { shorthands as canonicalShorthands } from \"@tamagui/shorthands/v4\";\nconst traverse = _traverse.default ?? _traverse;\nconst generate = _generate.default ?? _generate;\nconst defaultShorthands = canonicalShorthands;\nconst removedV6ThemeNames = new Set(v6RemovedThemeNames);\nfunction getV6ThemeName(name) {\n const opacityIndex = name.indexOf(\"/\");\n const baseName = opacityIndex === -1 ? name : name.slice(0, opacityIndex);\n if (removedV6ThemeNames.has(baseName)) return null;\n const mapped = v6ThemeNameReplacements[baseName] ?? baseName;\n return opacityIndex === -1 ? mapped : `${mapped}${name.slice(opacityIndex)}`;\n}\nfunction namesToSet(names) {\n if (!names) return /* @__PURE__ */ new Set();\n if (Array.isArray(names)) return new Set(names);\n if (names instanceof Set) return new Set(names);\n return new Set(Object.keys(names));\n}\nfunction addConfigNames(target, source) {\n if (!source) return;\n for (const key in source) target.add(key);\n}\nfunction createTransformGrammarConfig(options, mediaKeys, shorthands) {\n if (options.grammarConfig) {\n return { ...options.grammarConfig, shorthands, mediaNames: mediaKeys };\n }\n const tokenNames = {};\n const tokenCategories = [\"space\", \"size\", \"radius\", \"zIndex\", \"color\"];\n const fontCategories = [\n \"fontFamily\",\n \"fontSize\",\n \"fontWeight\",\n \"lineHeight\",\n \"letterSpacing\"\n ];\n const authoritative = [\"tokens\", \"fonts\", \"themes\", \"media\", \"shorthands\"].some(\n (key) => key in options\n );\n if (authoritative) {\n for (const category of [...tokenCategories, ...fontCategories]) {\n tokenNames[category] = /* @__PURE__ */ new Set();\n }\n }\n for (const category of tokenCategories) {\n if (options.tokens?.[category]) {\n const names = tokenNames[category] || /* @__PURE__ */ new Set();\n addConfigNames(names, options.tokens[category]);\n tokenNames[category] = names;\n }\n }\n for (const group in propTokenGroupFallbacks) {\n const own = options.tokens?.[group];\n const names = own ? /* @__PURE__ */ new Set() : tokenNames[propTokenGroupFallbacks[group]];\n if (own) addConfigNames(names, own);\n if (names) tokenNames[group] = names;\n }\n if (options.fonts) {\n tokenNames.fontFamily ||= /* @__PURE__ */ new Set();\n tokenNames.fontSize ||= /* @__PURE__ */ new Set();\n tokenNames.fontWeight ||= /* @__PURE__ */ new Set();\n tokenNames.lineHeight ||= /* @__PURE__ */ new Set();\n tokenNames.letterSpacing ||= /* @__PURE__ */ new Set();\n for (const familyName in options.fonts) {\n tokenNames.fontFamily.add(familyName);\n const font = options.fonts[familyName];\n addConfigNames(tokenNames.fontSize, font?.size);\n addConfigNames(tokenNames.fontWeight, font?.weight);\n addConfigNames(tokenNames.lineHeight, font?.lineHeight);\n addConfigNames(tokenNames.letterSpacing, font?.letterSpacing);\n }\n }\n const themeNames = /* @__PURE__ */ new Set();\n if (options.themes) {\n tokenNames.color ||= /* @__PURE__ */ new Set();\n for (const themeName in options.themes) {\n themeNames.add(themeName);\n for (const name in options.themes[themeName]) {\n const mapped = getV6ThemeName(name);\n if (mapped) tokenNames.color.add(mapped);\n }\n }\n }\n return {\n shorthands,\n mediaNames: mediaKeys,\n themeNames,\n tokenNames\n };\n}\nfunction findParseError(source) {\n try {\n const ast = parse(source, {\n sourceType: \"module\",\n plugins: [\"jsx\", \"typescript\"],\n errorRecovery: true\n });\n const errs = ast.errors;\n if (errs && errs.length > 0) {\n const e = errs[0];\n const loc = e?.loc ? `${e.loc.line}:${e.loc.column}` : \"?\";\n return `${e?.reasonCode || e?.message || \"parse error\"} at ${loc}`;\n }\n return null;\n } catch (e) {\n return e.message || \"parse error\";\n }\n}\nfunction tamaguiToTailwind(source, options = {}) {\n const { renameComponents = true } = options;\n const mediaKeys = options.grammarConfig?.mediaNames ? namesToSet(options.grammarConfig.mediaNames) : options.media ? new Set(Array.isArray(options.media) ? options.media : Object.keys(options.media)) : new Set(defaultMediaKeys);\n const shorthands = options.grammarConfig?.shorthands ?? options.shorthands ?? defaultShorthands;\n const grammarConfig = createTransformGrammarConfig(options, mediaKeys, shorthands);\n const ctx = {\n mediaKeys,\n componentAllow: new Set(options.components ?? []),\n shorthands,\n grammarConfig,\n modifierRegistry: createModifierRegistry(grammarConfig).registry,\n rewriteImports: options.rewriteImports === true\n };\n let ast;\n try {\n ast = parse(source, {\n sourceType: \"module\",\n plugins: [\"jsx\", \"typescript\"],\n errorRecovery: true\n });\n } catch {\n return source;\n }\n if (ast.errors && ast.errors.length > 0) {\n return source;\n }\n let didTransform = false;\n traverse(ast, {\n JSXOpeningElement(path) {\n const node = path.node;\n const resolved = resolveTamaguiComponent(path, ctx);\n if (resolved === null) return;\n const { name: componentName, isSimpleKnown, isPlainIdentifier } = resolved;\n if (node.attributes.some((a) => t.isJSXSpreadAttribute(a))) return;\n const hasDynamicClassName = node.attributes.some(\n (attr) => t.isJSXAttribute(attr) && attr.name.name === \"className\" && getStringValue(attr.value) === null\n );\n if (hasDynamicClassName) return;\n const hasClassName = node.attributes.some(\n (attr) => t.isJSXAttribute(attr) && attr.name.name === \"className\"\n );\n const hasNeighboringStyleProp = node.attributes.some((attr) => {\n if (!t.isJSXAttribute(attr) || attr.name.name === \"className\") return false;\n const name = attr.name.name;\n return isConvertibleStyleProp(resolveShorthand(ctx, name));\n });\n if (hasClassName && hasNeighboringStyleProp) return;\n const classes = [];\n const keptAttrs = [];\n let existingClassName = null;\n const blockedLeafKeys = /* @__PURE__ */ new Set();\n for (const a of node.attributes) {\n if (t.isJSXAttribute(a) && a.name.name === \"className\") {\n const v = getStringValue(a.value);\n if (v) {\n for (const tok of v.split(/\\s+/)) {\n if (tok) for (const k of leafKeysOfClassToken(tok)) blockedLeafKeys.add(k);\n }\n }\n }\n }\n const implicitClasses = [];\n if (componentName === \"XStack\") implicitClasses.push(\"flex\", \"flex-row\");\n else if (componentName === \"YStack\") implicitClasses.push(\"flex\", \"flex-col\");\n else if (componentName === \"ZStack\") implicitClasses.push(\"relative\");\n const styleEntries = [];\n for (const attr of node.attributes) {\n if (!t.isJSXAttribute(attr)) {\n keptAttrs.push(attr);\n continue;\n }\n const name = attr.name.name;\n if (name === \"className\") {\n existingClassName = attr;\n continue;\n }\n styleEntries.push({\n attr,\n fullProp: resolveShorthand(ctx, name),\n cls: propValueToClass(ctx, name, attr.value)\n });\n }\n const retainedLeafKeys = new Set(blockedLeafKeys);\n for (const e of styleEntries) {\n if (e.cls === null && isConvertibleStyleProp(e.fullProp)) {\n for (const k of leafKeysOfProp(e.fullProp)) retainedLeafKeys.add(k);\n }\n }\n for (const c of implicitClasses) {\n if (!overlapsSet(leafKeysOfClassToken(c), retainedLeafKeys)) classes.push(c);\n }\n for (const e of styleEntries) {\n if (e.cls !== null && !overlapsSet(leafKeysOfProp(e.fullProp), retainedLeafKeys)) {\n classes.push(e.cls);\n } else {\n keptAttrs.push(e.attr);\n }\n }\n if (classes.length > 0) {\n const classStr = classes.join(\" \");\n if (existingClassName) {\n const existingVal = getStringValue(existingClassName.value);\n if (existingVal !== null) {\n existingClassName.value = t.stringLiteral(\n existingVal ? `${classStr} ${existingVal}` : classStr\n );\n keptAttrs.unshift(existingClassName);\n } else if (t.isJSXExpressionContainer(existingClassName.value) && !t.isJSXEmptyExpression(existingClassName.value.expression)) {\n const expr = existingClassName.value.expression;\n existingClassName.value = t.jsxExpressionContainer(\n t.templateLiteral(\n [\n t.templateElement(\n { raw: `${classStr} `, cooked: `${classStr} ` },\n false\n ),\n t.templateElement({ raw: \"\", cooked: \"\" }, true)\n ],\n [expr]\n )\n );\n keptAttrs.unshift(existingClassName);\n } else {\n keptAttrs.unshift(\n t.jsxAttribute(t.jsxIdentifier(\"className\"), t.stringLiteral(classStr))\n );\n }\n } else {\n keptAttrs.unshift(\n t.jsxAttribute(t.jsxIdentifier(\"className\"), t.stringLiteral(classStr))\n );\n }\n } else if (existingClassName) {\n keptAttrs.unshift(existingClassName);\n }\n node.attributes = keptAttrs;\n if (classes.length > 0) didTransform = true;\n if (renameComponents && isSimpleKnown && isPlainIdentifier) {\n const tag = componentToTag[componentName];\n node.name = t.jsxIdentifier(tag);\n const parent = path.parent;\n if (t.isJSXElement(parent) && parent.closingElement) {\n parent.closingElement.name = t.jsxIdentifier(tag);\n }\n didTransform = true;\n }\n }\n });\n if (options.rewriteImports && rewriteTailwindFrontendImports(ast)) {\n didTransform = true;\n }\n if (!didTransform) return source;\n const output = generate(ast, {\n retainLines: options.retainLines !== false,\n concise: false\n });\n return output.code;\n}\nconst knownCompoundComponents = /* @__PURE__ */ new Set([\n \"Sheet.Frame\",\n \"Sheet.Overlay\",\n \"Sheet.Handle\",\n \"Sheet.ScrollView\",\n \"Sheet.Container\",\n \"Dialog.Content\",\n \"Dialog.Overlay\",\n \"Popover.Content\",\n \"Tabs.Tab\"\n]);\nconst tailwindFrontendImports = /* @__PURE__ */ new Set([\"html\", \"View\", \"Text\"]);\nfunction isTamaguiSource(source) {\n return source === \"tamagui\" || source.startsWith(\"@tamagui/\");\n}\nfunction resolveTamaguiComponent(path, ctx) {\n const nameNode = path.node.name;\n let baseName;\n let memberChain = [];\n const isPlainIdentifier = t.isJSXIdentifier(nameNode);\n if (t.isJSXIdentifier(nameNode)) {\n baseName = nameNode.name;\n } else if (t.isJSXMemberExpression(nameNode)) {\n const parts = [];\n let cur = nameNode;\n while (t.isJSXMemberExpression(cur)) {\n parts.unshift(cur.property.name);\n cur = cur.object;\n }\n if (!t.isJSXIdentifier(cur)) return null;\n baseName = cur.name;\n memberChain = parts;\n } else {\n return null;\n }\n const binding = path.scope?.getBinding?.(baseName);\n let tamaguiBase;\n if (binding) {\n const bnode = binding.path.node;\n if (t.isImportSpecifier(bnode) || t.isImportDefaultSpecifier(bnode) || t.isImportNamespaceSpecifier(bnode)) {\n const decl = binding.path.parent;\n const source = t.isImportDeclaration(decl) ? String(decl.source.value) : \"\";\n if (!isTamaguiSource(source)) return null;\n if (t.isImportNamespaceSpecifier(bnode)) {\n if (memberChain.length === 0) return null;\n tamaguiBase = memberChain[0];\n memberChain = memberChain.slice(1);\n } else if (t.isImportSpecifier(bnode)) {\n const imported = bnode.imported;\n tamaguiBase = t.isIdentifier(imported) ? imported.name : String(imported.value);\n } else {\n return null;\n }\n if (ctx.rewriteImports && source !== \"@tamagui/tailwind\" && (source !== \"tamagui\" && source !== \"@tamagui/core\" || !tailwindFrontendImports.has(tamaguiBase) || !isTailwindFrontendOnlyBinding(binding, tamaguiBase))) {\n return null;\n }\n } else {\n return null;\n }\n } else {\n tamaguiBase = baseName;\n if (ctx.rewriteImports && !tailwindFrontendImports.has(tamaguiBase)) return null;\n }\n const name = memberChain.length ? [tamaguiBase, ...memberChain].join(\".\") : tamaguiBase;\n const isSimpleKnown = memberChain.length === 0 && name in componentToTag;\n const isHTMLPrimitive = tamaguiBase === \"html\" && memberChain.length === 1;\n if (!isSimpleKnown && !isHTMLPrimitive && !knownCompoundComponents.has(name) && !ctx.componentAllow.has(name)) {\n return null;\n }\n return { name, isSimpleKnown, isPlainIdentifier };\n}\nfunction isTailwindFrontendOnlyBinding(binding, importedName) {\n return binding.referencePaths.every((referencePath) => {\n const parent = referencePath.parent;\n if (importedName === \"html\") {\n return t.isJSXMemberExpression(parent) && parent.object === referencePath.node && (t.isJSXOpeningElement(referencePath.parentPath?.parent) || t.isJSXClosingElement(referencePath.parentPath?.parent));\n }\n return t.isJSXIdentifier(referencePath.node) && (t.isJSXOpeningElement(parent) || t.isJSXClosingElement(parent)) && parent.name === referencePath.node;\n });\n}\nfunction rewriteTailwindFrontendImports(ast) {\n let changed = false;\n traverse(ast, {\n ImportDeclaration(path) {\n const source = String(path.node.source.value);\n if (source !== \"tamagui\" && source !== \"@tamagui/core\") return;\n if (path.node.importKind === \"type\") return;\n const moved = [];\n const retained = [];\n for (const specifier of path.node.specifiers) {\n if (!t.isImportSpecifier(specifier) || specifier.importKind === \"type\") {\n retained.push(specifier);\n continue;\n }\n const importedName = t.isIdentifier(specifier.imported) ? specifier.imported.name : String(specifier.imported.value);\n const binding = path.scope.getBinding(specifier.local.name);\n if (!tailwindFrontendImports.has(importedName) || !binding || !isTailwindFrontendOnlyBinding(binding, importedName)) {\n retained.push(specifier);\n continue;\n }\n moved.push(specifier);\n }\n if (!moved.length) return;\n changed = true;\n if (!retained.length) {\n path.node.source = t.stringLiteral(\"@tamagui/tailwind\");\n return;\n }\n path.node.specifiers = retained;\n path.insertAfter(t.importDeclaration(moved, t.stringLiteral(\"@tamagui/tailwind\")));\n }\n });\n return changed;\n}\nfunction classPrefixOf(token) {\n const noMod = token.slice(token.lastIndexOf(\":\") + 1);\n const core = noMod[0] === \"-\" ? noMod.slice(1) : noMod;\n const dash = core.indexOf(\"-\");\n return dash === -1 ? core : core.slice(0, dash);\n}\nconst leafExpansion = {\n padding: [\"paddingTop\", \"paddingRight\", \"paddingBottom\", \"paddingLeft\"],\n paddingHorizontal: [\"paddingLeft\", \"paddingRight\"],\n paddingVertical: [\"paddingTop\", \"paddingBottom\"],\n margin: [\"marginTop\", \"marginRight\", \"marginBottom\", \"marginLeft\"],\n marginHorizontal: [\"marginLeft\", \"marginRight\"],\n marginVertical: [\"marginTop\", \"marginBottom\"],\n inset: [\"top\", \"right\", \"bottom\", \"left\"],\n gap: [\"gap\", \"rowGap\", \"columnGap\"],\n borderWidth: [\n \"borderTopWidth\",\n \"borderRightWidth\",\n \"borderBottomWidth\",\n \"borderLeftWidth\"\n ],\n borderColor: [\n \"borderTopColor\",\n \"borderRightColor\",\n \"borderBottomColor\",\n \"borderLeftColor\"\n ],\n borderRadius: [\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderBottomRightRadius\"\n ]\n};\nfunction leafKeysOfProp(fullProp) {\n return leafExpansion[fullProp] ?? [fullProp];\n}\nconst prefixToProp = (() => {\n const m = {};\n for (const [prop, prefix] of Object.entries(propToTailwindPrefix)) {\n if (prefix && !(prefix in m)) m[prefix] = prop;\n }\n return m;\n})();\nfunction leafKeysOfClassToken(token) {\n const prefix = classPrefixOf(token);\n return leafKeysOfProp(prefixToProp[prefix] ?? prefix);\n}\nfunction overlapsSet(keys, set) {\n return keys.some((k) => set.has(k));\n}\nfunction isConvertibleStyleProp(fullProp) {\n return propToTailwindPrefix[fullProp] !== void 0 || fullProp in standaloneValueProps;\n}\nfunction propValueToClass(ctx, propName, value) {\n const fullProp = resolveShorthand(ctx, propName);\n if (propToTailwindPrefix[fullProp] === void 0) return null;\n const strVal = getStringValue(value);\n const numVal = getNumericValue(value);\n if (strVal !== null) {\n const parsed = parseValue(strVal, ctx.modifierRegistry);\n if (!parsed.ok) return null;\n const classes = [];\n if (parsed.value.base !== null) {\n const base = payloadToClass(ctx, fullProp, parsed.value.base, []);\n if (base === null) return null;\n classes.push(base);\n }\n for (const clause of parsed.value.clauses) {\n const conditional = payloadToClass(ctx, fullProp, clause.payload, clause.modifiers);\n if (conditional === null) return null;\n classes.push(conditional);\n }\n return classes.length ? classes.join(\" \") : null;\n }\n if (numVal === null) return null;\n const formatted = formatNumericValue(fullProp, numVal);\n if (formatted === null) return null;\n return formatCandidate(\n {\n prop: fullProp,\n value: formatted.value,\n valueKind: formatted.valueKind,\n modifiers: void 0\n },\n ctx.grammarConfig\n );\n}\nfunction payloadToClass(ctx, fullProp, payload, modifiers) {\n let formatted;\n if (standaloneValueProps[fullProp]?.[payload]) {\n formatted = { value: payload, valueKind: \"enum\" };\n } else {\n formatted = formatStringValue(ctx, fullProp, payload);\n if (formatted === null && /^-?\\d+(?:\\.\\d+)?$/.test(payload)) {\n const category = getTokenCategory(fullProp);\n if (!category || ctx.grammarConfig.tokenNames?.[category] !== void 0) {\n formatted = formatNumericValue(fullProp, Number(payload));\n }\n }\n }\n if (formatted === null) return null;\n return formatCandidate(\n {\n prop: fullProp,\n value: formatted.value,\n valueKind: formatted.valueKind,\n modifiers: modifiers.length ? modifiers : void 0\n },\n ctx.grammarConfig\n );\n}\nfunction getStringValue(value) {\n if (!value) return null;\n if (t.isStringLiteral(value)) return value.value;\n if (t.isJSXExpressionContainer(value) && t.isStringLiteral(value.expression)) {\n return value.expression.value;\n }\n if (t.isJSXExpressionContainer(value) && t.isTemplateLiteral(value.expression)) {\n if (value.expression.expressions.length === 0 && value.expression.quasis.length === 1) {\n return value.expression.quasis[0].value.raw;\n }\n }\n return null;\n}\nfunction getNumericValue(value) {\n if (!value) return null;\n if (t.isJSXExpressionContainer(value)) {\n if (t.isNumericLiteral(value.expression)) return value.expression.value;\n if (t.isUnaryExpression(value.expression) && value.expression.operator === \"-\" && t.isNumericLiteral(value.expression.argument)) {\n return -value.expression.argument.value;\n }\n }\n return null;\n}\nfunction resolveShorthand(ctx, name) {\n return ctx.shorthands[name] || name;\n}\nfunction hasConfiguredName(names, value) {\n if (!names) return false;\n if (Array.isArray(names)) return names.includes(value);\n if (names instanceof Set) return names.has(value);\n return value in names;\n}\nfunction formatStringValue(ctx, prop, value) {\n const category = getTokenCategory(prop);\n if (prop !== \"fontWeight\" && category && hasConfiguredName(ctx.grammarConfig.tokenNames?.[category], value)) {\n if (category === \"color\") {\n const mapped = getV6ThemeName(value);\n return mapped ? { value: mapped, valueKind: \"token\" } : null;\n }\n return { value, valueKind: \"token\" };\n }\n if (prop === \"fontWeight\") {\n return fontWeightNames[value] ? { value, valueKind: \"enum\" } : null;\n }\n if (prop === \"zIndex\" && /^\\d+$/.test(value)) {\n return { value, valueKind: \"convenience\" };\n }\n if (/^-?\\d+(\\.\\d+)?$/.test(value)) {\n return prop === \"lineHeight\" ? { value, valueKind: \"arbitrary\" } : null;\n }\n if (value.endsWith(\"%\")) {\n const exact = {\n \"100%\": \"full\",\n \"50%\": \"1/2\",\n \"25%\": \"1/4\",\n \"75%\": \"3/4\"\n };\n if (getTokenCategory(prop) === \"size\" && exact[value]) {\n return { value: exact[value], valueKind: \"convenience\" };\n }\n return { value, valueKind: \"arbitrary\" };\n }\n if (value === \"auto\" && getTokenCategory(prop) === \"size\") {\n return { value, valueKind: \"convenience\" };\n }\n if (prop === \"fontFamily\") return { value, valueKind: \"arbitrary\" };\n if (value.includes(\"(\") || value.includes(\" \") || value.includes(\"_\") || value.startsWith(\"#\") || value.startsWith(\"-\") || /^[\\d.]+[a-z%]/i.test(value)) {\n return { value, valueKind: \"arbitrary\" };\n }\n return { value, valueKind: \"arbitrary\" };\n}\nconst pxLengthProps = /* @__PURE__ */ new Set([\n \"width\",\n \"height\",\n \"minWidth\",\n \"maxWidth\",\n \"minHeight\",\n \"maxHeight\",\n \"flexBasis\",\n \"padding\",\n \"paddingTop\",\n \"paddingRight\",\n \"paddingBottom\",\n \"paddingLeft\",\n \"paddingStart\",\n \"paddingEnd\",\n \"paddingInlineStart\",\n \"paddingInlineEnd\",\n \"paddingBlockStart\",\n \"paddingBlockEnd\",\n \"paddingHorizontal\",\n \"paddingVertical\",\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n \"marginStart\",\n \"marginEnd\",\n \"marginInlineStart\",\n \"marginInlineEnd\",\n \"marginBlockStart\",\n \"marginBlockEnd\",\n \"marginHorizontal\",\n \"marginVertical\",\n \"gap\",\n \"rowGap\",\n \"columnGap\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n \"inset\",\n \"insetInlineStart\",\n \"insetInlineEnd\",\n \"borderRadius\",\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderBottomRightRadius\",\n \"borderTopStartRadius\",\n \"borderTopEndRadius\",\n \"borderBottomStartRadius\",\n \"borderBottomEndRadius\",\n \"borderStartStartRadius\",\n \"borderStartEndRadius\",\n \"borderEndStartRadius\",\n \"borderEndEndRadius\",\n \"fontSize\",\n \"letterSpacing\"\n]);\nfunction formatNumericValue(prop, value) {\n if (prop === \"opacity\") {\n const pct = value * 100;\n return Number.isInteger(pct) ? { value: String(pct), valueKind: \"convenience\" } : { value: String(value), valueKind: \"arbitrary\" };\n }\n if (prop === \"aspectRatio\" || prop === \"lineHeight\") {\n return { value: String(value), valueKind: \"arbitrary\" };\n }\n if (prop === \"scale\" || prop === \"scaleX\" || prop === \"scaleY\") {\n if (value === 0) return { value: \"0\", valueKind: \"convenience\" };\n if (value === 1) return { value: \"100\", valueKind: \"convenience\" };\n return { value: String(value), valueKind: \"arbitrary\" };\n }\n if (prop === \"flex\") {\n return value === 1 ? { value: \"1\", valueKind: \"convenience\" } : { value: String(value), valueKind: \"arbitrary\" };\n }\n if (prop === \"flexGrow\" || prop === \"flexShrink\") {\n return { value: String(value), valueKind: \"arbitrary\" };\n }\n if (prop === \"zIndex\") {\n return Number.isInteger(value) && value >= 0 ? { value: String(value), valueKind: \"convenience\" } : { value: String(value), valueKind: \"arbitrary\" };\n }\n if (prop === \"fontWeight\") {\n return fontWeightNames[String(value)] ? { value: String(value), valueKind: \"enum\" } : null;\n }\n if (prop === \"rotate\") return null;\n if (prop === \"x\" || prop === \"y\") {\n return { value: `${value}px`, valueKind: \"arbitrary\" };\n }\n if (prop.includes(\"Width\") && prop.startsWith(\"border\")) {\n return { value: `${value}px`, valueKind: \"arbitrary\" };\n }\n if (pxLengthProps.has(prop)) {\n return { value: `${value}px`, valueKind: \"arbitrary\" };\n }\n return null;\n}\nexport {\n findParseError,\n tamaguiToTailwind\n};\n//# sourceMappingURL=transform.js.map\n"],"mappings":";;;;;;;;;AAmBA,MAAM,WAAW,UAAU,WAAW;AACtC,MAAM,WAAW,UAAU,WAAW;AACtC,MAAM,oBAAoBA;AAC1B,MAAM,sBAAsB,IAAI,IAAI,mBAAmB;AACvD,SAAS,eAAe,MAAM;CAC5B,MAAM,eAAe,KAAK,QAAQ,GAAG;CACrC,MAAM,WAAW,iBAAiB,CAAC,IAAI,OAAO,KAAK,MAAM,GAAG,YAAY;CACxE,IAAI,oBAAoB,IAAI,QAAQ,GAAG,OAAO;CAC9C,MAAM,SAAS,wBAAwB,aAAa;CACpD,OAAO,iBAAiB,CAAC,IAAI,SAAS,GAAG,SAAS,KAAK,MAAM,YAAY;AAC3E;AACA,SAAS,WAAW,OAAO;CACzB,IAAI,CAAC,OAAO,uBAAuB,IAAI,IAAI;CAC3C,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,IAAI,IAAI,KAAK;CAC9C,IAAI,iBAAiB,KAAK,OAAO,IAAI,IAAI,K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AAW;EAAY;CACrJ;CACA,IAAI,SAAS,cAAc;EACzB,OAAO,gBAAgB,OAAO,KAAK,KAAK;GAAE,OAAO,OAAO,KAAK;GAAG,WAAW;EAAO,IAAI;CACxF;CACA,IAAI,SAAS,UAAU,OAAO;CAC9B,IAAI,SAAS,OAAO,SAAS,KAAK;EAChC,OAAO;GAAE,OAAO,GAAG,MAAM;GAAK,WAAW;EAAY;CACvD;CACA,IAAI,KAAK,SAAS,OAAO,KAAK,KAAK,WAAW,QAAQ,GAAG;EACvD,OAAO;GAAE,OAAO,GAAG,MAAM;GAAK,WAAW;EAAY;CACvD;CACA,IAAI,cAAc,IAAI,IAAI,GAAG;EAC3B,OAAO;GAAE,OAAO,GAAG,MAAM;GAAK,WAAW;EAAY;CACvD;CACA,OAAO;AACT"}
|
|
@@ -2,17 +2,10 @@ import { parse } from "@babel/parser";
|
|
|
2
2
|
import _traverse from "@babel/traverse";
|
|
3
3
|
import _generate from "@babel/generator";
|
|
4
4
|
import * as t from "@babel/types";
|
|
5
|
-
import { createModifierRegistry, defaultMediaKeys, fontWeightNames, formatCandidate, getTokenCategory, parseValue, propToTailwindPrefix, standaloneValueProps, v6RemovedThemeNames, v6ThemeNameReplacements } from "@tamagui/style-grammar/tooling";
|
|
5
|
+
import { createModifierRegistry, defaultMediaKeys, fontWeightNames, formatCandidate, getTokenCategory, parseValue, propToTailwindPrefix, propTokenGroupFallbacks, standaloneValueProps, v6RemovedThemeNames, v6ThemeNameReplacements } from "@tamagui/style-grammar/tooling";
|
|
6
6
|
import { componentToTag } from "./maps/componentToTag.native.js";
|
|
7
7
|
import { shorthands } from "@tamagui/shorthands/v4";
|
|
8
8
|
|
|
9
|
-
function _instanceof(left, right) {
|
|
10
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
11
|
-
return !!right[Symbol.hasInstance](left);
|
|
12
|
-
} else {
|
|
13
|
-
return left instanceof right;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
9
|
var _traverse_default;
|
|
17
10
|
var traverse = (_traverse_default = _traverse.default) !== null && _traverse_default !== void 0 ? _traverse_default : _traverse;
|
|
18
11
|
var _generate_default;
|
|
@@ -30,7 +23,7 @@ function getV6ThemeName(name) {
|
|
|
30
23
|
function namesToSet(names) {
|
|
31
24
|
if (!names) return /* @__PURE__ */ new Set();
|
|
32
25
|
if (Array.isArray(names)) return new Set(names);
|
|
33
|
-
if (
|
|
26
|
+
if (names instanceof Set) return new Set(names);
|
|
34
27
|
return new Set(Object.keys(names));
|
|
35
28
|
}
|
|
36
29
|
function addConfigNames(target, source) {
|
|
@@ -100,6 +93,13 @@ function createTransformGrammarConfig(options, mediaKeys, shorthands) {
|
|
|
100
93
|
}
|
|
101
94
|
}
|
|
102
95
|
}
|
|
96
|
+
for (var group in propTokenGroupFallbacks) {
|
|
97
|
+
var _options_tokens1;
|
|
98
|
+
var own = (_options_tokens1 = options.tokens) === null || _options_tokens1 === void 0 ? void 0 : _options_tokens1[group];
|
|
99
|
+
var names1 = own ? /* @__PURE__ */ new Set() : tokenNames[propTokenGroupFallbacks[group]];
|
|
100
|
+
if (own) addConfigNames(names1, own);
|
|
101
|
+
if (names1) tokenNames[group] = names1;
|
|
102
|
+
}
|
|
103
103
|
if (options.fonts) {
|
|
104
104
|
var _tokenNames, _tokenNames1, _tokenNames2, _tokenNames3, _tokenNames4;
|
|
105
105
|
(_tokenNames = tokenNames).fontFamily || (_tokenNames.fontFamily = /* @__PURE__ */ new Set());
|
|
@@ -167,7 +167,8 @@ function tamaguiToTailwind(source) {
|
|
|
167
167
|
componentAllow: new Set((_options_components = options.components) !== null && _options_components !== void 0 ? _options_components : []),
|
|
168
168
|
shorthands,
|
|
169
169
|
grammarConfig,
|
|
170
|
-
modifierRegistry: createModifierRegistry(grammarConfig).registry
|
|
170
|
+
modifierRegistry: createModifierRegistry(grammarConfig).registry,
|
|
171
|
+
rewriteImports: options.rewriteImports === true
|
|
171
172
|
};
|
|
172
173
|
var ast;
|
|
173
174
|
try {
|
|
@@ -433,9 +434,12 @@ function tamaguiToTailwind(source) {
|
|
|
433
434
|
didTransform = true;
|
|
434
435
|
}
|
|
435
436
|
} });
|
|
437
|
+
if (options.rewriteImports && rewriteTailwindFrontendImports(ast)) {
|
|
438
|
+
didTransform = true;
|
|
439
|
+
}
|
|
436
440
|
if (!didTransform) return source;
|
|
437
441
|
var output = generate(ast, {
|
|
438
|
-
retainLines:
|
|
442
|
+
retainLines: options.retainLines !== false,
|
|
439
443
|
concise: false
|
|
440
444
|
});
|
|
441
445
|
return output.code;
|
|
@@ -451,6 +455,11 @@ var knownCompoundComponents = /* @__PURE__ */ new Set([
|
|
|
451
455
|
"Popover.Content",
|
|
452
456
|
"Tabs.Tab"
|
|
453
457
|
]);
|
|
458
|
+
var tailwindFrontendImports = /* @__PURE__ */ new Set([
|
|
459
|
+
"html",
|
|
460
|
+
"View",
|
|
461
|
+
"Text"
|
|
462
|
+
]);
|
|
454
463
|
function isTamaguiSource(source) {
|
|
455
464
|
return source === "tamagui" || source.startsWith("@tamagui/");
|
|
456
465
|
}
|
|
@@ -493,15 +502,20 @@ function resolveTamaguiComponent(path, ctx) {
|
|
|
493
502
|
} else {
|
|
494
503
|
return null;
|
|
495
504
|
}
|
|
505
|
+
if (ctx.rewriteImports && source !== "@tamagui/tailwind" && (source !== "tamagui" && source !== "@tamagui/core" || !tailwindFrontendImports.has(tamaguiBase) || !isTailwindFrontendOnlyBinding(binding, tamaguiBase))) {
|
|
506
|
+
return null;
|
|
507
|
+
}
|
|
496
508
|
} else {
|
|
497
509
|
return null;
|
|
498
510
|
}
|
|
499
511
|
} else {
|
|
500
512
|
tamaguiBase = baseName;
|
|
513
|
+
if (ctx.rewriteImports && !tailwindFrontendImports.has(tamaguiBase)) return null;
|
|
501
514
|
}
|
|
502
515
|
var name = memberChain.length ? [tamaguiBase, ...memberChain].join(".") : tamaguiBase;
|
|
503
516
|
var isSimpleKnown = memberChain.length === 0 && name in componentToTag;
|
|
504
|
-
|
|
517
|
+
var isHTMLPrimitive = tamaguiBase === "html" && memberChain.length === 1;
|
|
518
|
+
if (!isSimpleKnown && !isHTMLPrimitive && !knownCompoundComponents.has(name) && !ctx.componentAllow.has(name)) {
|
|
505
519
|
return null;
|
|
506
520
|
}
|
|
507
521
|
return {
|
|
@@ -510,6 +524,65 @@ function resolveTamaguiComponent(path, ctx) {
|
|
|
510
524
|
isPlainIdentifier
|
|
511
525
|
};
|
|
512
526
|
}
|
|
527
|
+
function isTailwindFrontendOnlyBinding(binding, importedName) {
|
|
528
|
+
return binding.referencePaths.every(function(referencePath) {
|
|
529
|
+
var parent = referencePath.parent;
|
|
530
|
+
if (importedName === "html") {
|
|
531
|
+
var _referencePath_parentPath, _referencePath_parentPath1;
|
|
532
|
+
return t.isJSXMemberExpression(parent) && parent.object === referencePath.node && (t.isJSXOpeningElement((_referencePath_parentPath = referencePath.parentPath) === null || _referencePath_parentPath === void 0 ? void 0 : _referencePath_parentPath.parent) || t.isJSXClosingElement((_referencePath_parentPath1 = referencePath.parentPath) === null || _referencePath_parentPath1 === void 0 ? void 0 : _referencePath_parentPath1.parent));
|
|
533
|
+
}
|
|
534
|
+
return t.isJSXIdentifier(referencePath.node) && (t.isJSXOpeningElement(parent) || t.isJSXClosingElement(parent)) && parent.name === referencePath.node;
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
function rewriteTailwindFrontendImports(ast) {
|
|
538
|
+
var changed = false;
|
|
539
|
+
traverse(ast, { ImportDeclaration(path) {
|
|
540
|
+
var source = String(path.node.source.value);
|
|
541
|
+
if (source !== "tamagui" && source !== "@tamagui/core") return;
|
|
542
|
+
if (path.node.importKind === "type") return;
|
|
543
|
+
var moved = [];
|
|
544
|
+
var retained = [];
|
|
545
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
546
|
+
try {
|
|
547
|
+
for (var _iterator = path.node.specifiers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
548
|
+
var specifier = _step.value;
|
|
549
|
+
if (!t.isImportSpecifier(specifier) || specifier.importKind === "type") {
|
|
550
|
+
retained.push(specifier);
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
var importedName = t.isIdentifier(specifier.imported) ? specifier.imported.name : String(specifier.imported.value);
|
|
554
|
+
var binding = path.scope.getBinding(specifier.local.name);
|
|
555
|
+
if (!tailwindFrontendImports.has(importedName) || !binding || !isTailwindFrontendOnlyBinding(binding, importedName)) {
|
|
556
|
+
retained.push(specifier);
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
moved.push(specifier);
|
|
560
|
+
}
|
|
561
|
+
} catch (err) {
|
|
562
|
+
_didIteratorError = true;
|
|
563
|
+
_iteratorError = err;
|
|
564
|
+
} finally {
|
|
565
|
+
try {
|
|
566
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
567
|
+
_iterator.return();
|
|
568
|
+
}
|
|
569
|
+
} finally {
|
|
570
|
+
if (_didIteratorError) {
|
|
571
|
+
throw _iteratorError;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (!moved.length) return;
|
|
576
|
+
changed = true;
|
|
577
|
+
if (!retained.length) {
|
|
578
|
+
path.node.source = t.stringLiteral("@tamagui/tailwind");
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
path.node.specifiers = retained;
|
|
582
|
+
path.insertAfter(t.importDeclaration(moved, t.stringLiteral("@tamagui/tailwind")));
|
|
583
|
+
} });
|
|
584
|
+
return changed;
|
|
585
|
+
}
|
|
513
586
|
function classPrefixOf(token) {
|
|
514
587
|
var noMod = token.slice(token.lastIndexOf(":") + 1);
|
|
515
588
|
var core = noMod[0] === "-" ? noMod.slice(1) : noMod;
|
|
@@ -707,7 +780,7 @@ function resolveShorthand(ctx, name) {
|
|
|
707
780
|
function hasConfiguredName(names, value) {
|
|
708
781
|
if (!names) return false;
|
|
709
782
|
if (Array.isArray(names)) return names.includes(value);
|
|
710
|
-
if (
|
|
783
|
+
if (names instanceof Set) return names.has(value);
|
|
711
784
|
return value in names;
|
|
712
785
|
}
|
|
713
786
|
function formatStringValue(ctx, prop, value) {
|
|
@@ -738,7 +811,12 @@ function formatStringValue(ctx, prop, value) {
|
|
|
738
811
|
valueKind: "convenience"
|
|
739
812
|
};
|
|
740
813
|
}
|
|
741
|
-
if (/^-?\d+(\.\d+)?$/.test(value))
|
|
814
|
+
if (/^-?\d+(\.\d+)?$/.test(value)) {
|
|
815
|
+
return prop === "lineHeight" ? {
|
|
816
|
+
value,
|
|
817
|
+
valueKind: "arbitrary"
|
|
818
|
+
} : null;
|
|
819
|
+
}
|
|
742
820
|
if (value.endsWith("%")) {
|
|
743
821
|
var exact = {
|
|
744
822
|
"100%": "full",
|
|
@@ -791,6 +869,12 @@ var pxLengthProps = /* @__PURE__ */ new Set([
|
|
|
791
869
|
"paddingRight",
|
|
792
870
|
"paddingBottom",
|
|
793
871
|
"paddingLeft",
|
|
872
|
+
"paddingStart",
|
|
873
|
+
"paddingEnd",
|
|
874
|
+
"paddingInlineStart",
|
|
875
|
+
"paddingInlineEnd",
|
|
876
|
+
"paddingBlockStart",
|
|
877
|
+
"paddingBlockEnd",
|
|
794
878
|
"paddingHorizontal",
|
|
795
879
|
"paddingVertical",
|
|
796
880
|
"margin",
|
|
@@ -798,6 +882,12 @@ var pxLengthProps = /* @__PURE__ */ new Set([
|
|
|
798
882
|
"marginRight",
|
|
799
883
|
"marginBottom",
|
|
800
884
|
"marginLeft",
|
|
885
|
+
"marginStart",
|
|
886
|
+
"marginEnd",
|
|
887
|
+
"marginInlineStart",
|
|
888
|
+
"marginInlineEnd",
|
|
889
|
+
"marginBlockStart",
|
|
890
|
+
"marginBlockEnd",
|
|
801
891
|
"marginHorizontal",
|
|
802
892
|
"marginVertical",
|
|
803
893
|
"gap",
|
|
@@ -808,14 +898,23 @@ var pxLengthProps = /* @__PURE__ */ new Set([
|
|
|
808
898
|
"bottom",
|
|
809
899
|
"left",
|
|
810
900
|
"inset",
|
|
901
|
+
"insetInlineStart",
|
|
902
|
+
"insetInlineEnd",
|
|
811
903
|
"borderRadius",
|
|
812
904
|
"borderTopLeftRadius",
|
|
813
905
|
"borderTopRightRadius",
|
|
814
906
|
"borderBottomLeftRadius",
|
|
815
907
|
"borderBottomRightRadius",
|
|
908
|
+
"borderTopStartRadius",
|
|
909
|
+
"borderTopEndRadius",
|
|
910
|
+
"borderBottomStartRadius",
|
|
911
|
+
"borderBottomEndRadius",
|
|
912
|
+
"borderStartStartRadius",
|
|
913
|
+
"borderStartEndRadius",
|
|
914
|
+
"borderEndStartRadius",
|
|
915
|
+
"borderEndEndRadius",
|
|
816
916
|
"fontSize",
|
|
817
|
-
"letterSpacing"
|
|
818
|
-
"lineHeight"
|
|
917
|
+
"letterSpacing"
|
|
819
918
|
]);
|
|
820
919
|
function formatNumericValue(prop, value) {
|
|
821
920
|
if (prop === "opacity") {
|
|
@@ -828,10 +927,12 @@ function formatNumericValue(prop, value) {
|
|
|
828
927
|
valueKind: "arbitrary"
|
|
829
928
|
};
|
|
830
929
|
}
|
|
831
|
-
if (prop === "aspectRatio")
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
930
|
+
if (prop === "aspectRatio" || prop === "lineHeight") {
|
|
931
|
+
return {
|
|
932
|
+
value: String(value),
|
|
933
|
+
valueKind: "arbitrary"
|
|
934
|
+
};
|
|
935
|
+
}
|
|
835
936
|
if (prop === "scale" || prop === "scaleX" || prop === "scaleY") {
|
|
836
937
|
if (value === 0) return {
|
|
837
938
|
value: "0",
|