diff --git a/tools/figma-inspector/backend/utils/export-variables.ts b/tools/figma-inspector/backend/utils/export-variables.ts index 9d40be74259..0dc869acdf7 100644 --- a/tools/figma-inspector/backend/utils/export-variables.ts +++ b/tools/figma-inspector/backend/utils/export-variables.ts @@ -40,6 +40,7 @@ export function formatStructName(name: string): string { .replace(/,\s*/g, "-") // Replace commas (and following spaces) with hyphens .replace(/\+/g, "-") // Replace + with hyphens (add this line) .replace(/\:/g, "-") // Replace : with "" + .replace(/—/g, "-") // Replace em dash hyphens .replace(/([a-z])([A-Z])/g, "$1-$2") // Add hyphens between camelCase .replace(/\s+/g, "-") // Convert spaces to hyphens .replace(/--+/g, "-") // Normalize multiple consecutive hyphens to single @@ -65,6 +66,7 @@ export function sanitizePropertyName(name: string): string { .replace(/&/g, "and") // Replace & .replace(/\(/g, "_") // Replace ( with _ .replace(/\)/g, "_") // Replace ) with _ + .replace(/—/g, "_") // Replace em dash with underscore .replace(/[^a-zA-Z0-9_]/g, "_") // Replace other invalid chars (including -, +, :, etc.) with _ .replace(/__+/g, "_"); // Collapse multiple underscores diff --git a/tools/figma-inspector/src/main.tsx b/tools/figma-inspector/src/main.tsx index 889acc4f72d..742026a7e04 100644 --- a/tools/figma-inspector/src/main.tsx +++ b/tools/figma-inspector/src/main.tsx @@ -6,7 +6,7 @@ import { getColorTheme, subscribeColorTheme } from "./utils/bolt-utils"; import CodeSnippet from "./components/snippet/CodeSnippet"; import { ExportType, useInspectorStore } from "./utils/store"; import DialogFrame from "./components/DialogFrame.js"; -import { Button, Checkbox, DropdownMenu, Text } from "figma-kit"; +import { Text, Button, Checkbox, DropdownMenu } from "figma-kit"; import "./main.css"; export const App = () => { @@ -102,40 +102,63 @@ export const App = () => { /> -
- - Welcome to Figma - -
+ + setUseVariables(e.target.checked)} + /> + Use Figma Variables + + - + - + exportFiles(ExportType.SeparateFiles) } > - Separate Files… + Separate Files Per Collection… exportFiles(ExportType.SingleFile) } > - Single File… + Singl Design-Tokens File… - - - setUseVariables(e.target.checked)} - /> - Use Figma Variables - + + {useVariables ? ( + exportsAreCurrent ? ( + Exports are current + ) : ( + "Either variables have changed or no export found" + ) + ) : ( + "" + )} +