diff --git a/.changeset/fifty-timers-develop.md b/.changeset/fifty-timers-develop.md new file mode 100644 index 0000000..f1133ff --- /dev/null +++ b/.changeset/fifty-timers-develop.md @@ -0,0 +1,7 @@ +--- +"@icona/generator": minor +"@icona/types": minor +--- + +- Add `metadata` system +- Add custom template with `IconaIconData` in React Config diff --git a/.yarn/cache/@babel-code-frame-npm-7.25.7-40a9f53f43-f235cdf9c5.zip b/.yarn/cache/@babel-code-frame-npm-7.25.7-40a9f53f43-f235cdf9c5.zip new file mode 100644 index 0000000..2d48b17 Binary files /dev/null and b/.yarn/cache/@babel-code-frame-npm-7.25.7-40a9f53f43-f235cdf9c5.zip differ diff --git a/.yarn/cache/@babel-compat-data-npm-7.25.8-a7237f1519-7ac648b110.zip b/.yarn/cache/@babel-compat-data-npm-7.25.8-a7237f1519-7ac648b110.zip new file mode 100644 index 0000000..7290264 Binary files /dev/null and b/.yarn/cache/@babel-compat-data-npm-7.25.8-a7237f1519-7ac648b110.zip differ diff --git a/.yarn/cache/@babel-core-npm-7.25.8-e5a00584a2-77ddf693fa.zip b/.yarn/cache/@babel-core-npm-7.25.8-e5a00584a2-77ddf693fa.zip new file mode 100644 index 0000000..1f31aec Binary files /dev/null and b/.yarn/cache/@babel-core-npm-7.25.8-e5a00584a2-77ddf693fa.zip differ diff --git a/.yarn/cache/@babel-generator-npm-7.25.7-68dd72ad91-f81cf9dc01.zip b/.yarn/cache/@babel-generator-npm-7.25.7-68dd72ad91-f81cf9dc01.zip new file mode 100644 index 0000000..3788305 Binary files /dev/null and b/.yarn/cache/@babel-generator-npm-7.25.7-68dd72ad91-f81cf9dc01.zip differ diff --git a/.yarn/cache/@babel-helper-compilation-targets-npm-7.25.7-912ef98d47-5b57e7d4b9.zip b/.yarn/cache/@babel-helper-compilation-targets-npm-7.25.7-912ef98d47-5b57e7d4b9.zip new file mode 100644 index 0000000..f35ac82 Binary files /dev/null and b/.yarn/cache/@babel-helper-compilation-targets-npm-7.25.7-912ef98d47-5b57e7d4b9.zip differ diff --git a/.yarn/cache/@babel-helper-module-imports-npm-7.25.7-f7b3a083a0-a7255755e9.zip b/.yarn/cache/@babel-helper-module-imports-npm-7.25.7-f7b3a083a0-a7255755e9.zip new file mode 100644 index 0000000..1fe88d1 Binary files /dev/null and b/.yarn/cache/@babel-helper-module-imports-npm-7.25.7-f7b3a083a0-a7255755e9.zip differ diff --git a/.yarn/cache/@babel-helper-module-transforms-npm-7.25.7-01310522f0-b1daeded78.zip b/.yarn/cache/@babel-helper-module-transforms-npm-7.25.7-01310522f0-b1daeded78.zip new file mode 100644 index 0000000..4fd6670 Binary files /dev/null and b/.yarn/cache/@babel-helper-module-transforms-npm-7.25.7-01310522f0-b1daeded78.zip differ diff --git a/.yarn/cache/@babel-helper-simple-access-npm-7.25.7-3a9e5cd6e8-684d0b0330.zip b/.yarn/cache/@babel-helper-simple-access-npm-7.25.7-3a9e5cd6e8-684d0b0330.zip new file mode 100644 index 0000000..ae82b7e Binary files /dev/null and b/.yarn/cache/@babel-helper-simple-access-npm-7.25.7-3a9e5cd6e8-684d0b0330.zip differ diff --git a/.yarn/cache/@babel-helper-string-parser-npm-7.25.7-352069de58-0835fda5ef.zip b/.yarn/cache/@babel-helper-string-parser-npm-7.25.7-352069de58-0835fda5ef.zip new file mode 100644 index 0000000..cb09b59 Binary files /dev/null and b/.yarn/cache/@babel-helper-string-parser-npm-7.25.7-352069de58-0835fda5ef.zip differ diff --git a/.yarn/cache/@babel-helper-validator-identifier-npm-7.25.7-1c758f0472-062f55208d.zip b/.yarn/cache/@babel-helper-validator-identifier-npm-7.25.7-1c758f0472-062f55208d.zip new file mode 100644 index 0000000..3e7f631 Binary files /dev/null and b/.yarn/cache/@babel-helper-validator-identifier-npm-7.25.7-1c758f0472-062f55208d.zip differ diff --git a/.yarn/cache/@babel-helper-validator-option-npm-7.25.7-8c969bf588-87b801fe7d.zip b/.yarn/cache/@babel-helper-validator-option-npm-7.25.7-8c969bf588-87b801fe7d.zip new file mode 100644 index 0000000..8b3ef94 Binary files /dev/null and b/.yarn/cache/@babel-helper-validator-option-npm-7.25.7-8c969bf588-87b801fe7d.zip differ diff --git a/.yarn/cache/@babel-helpers-npm-7.25.7-267b4cec46-a732428509.zip b/.yarn/cache/@babel-helpers-npm-7.25.7-267b4cec46-a732428509.zip new file mode 100644 index 0000000..4811e74 Binary files /dev/null and b/.yarn/cache/@babel-helpers-npm-7.25.7-267b4cec46-a732428509.zip differ diff --git a/.yarn/cache/@babel-highlight-npm-7.25.7-308b20da71-b6aa45c5bf.zip b/.yarn/cache/@babel-highlight-npm-7.25.7-308b20da71-b6aa45c5bf.zip new file mode 100644 index 0000000..e162847 Binary files /dev/null and b/.yarn/cache/@babel-highlight-npm-7.25.7-308b20da71-b6aa45c5bf.zip differ diff --git a/.yarn/cache/@babel-parser-npm-7.25.8-fda12195b5-c33f6d2654.zip b/.yarn/cache/@babel-parser-npm-7.25.8-fda12195b5-c33f6d2654.zip new file mode 100644 index 0000000..65159d8 Binary files /dev/null and b/.yarn/cache/@babel-parser-npm-7.25.8-fda12195b5-c33f6d2654.zip differ diff --git a/.yarn/cache/@babel-template-npm-7.25.7-4db3590fa2-83f025a4a7.zip b/.yarn/cache/@babel-template-npm-7.25.7-4db3590fa2-83f025a4a7.zip new file mode 100644 index 0000000..ed2b5bc Binary files /dev/null and b/.yarn/cache/@babel-template-npm-7.25.7-4db3590fa2-83f025a4a7.zip differ diff --git a/.yarn/cache/@babel-traverse-npm-7.25.7-0ca7b771fb-4d329b6e7a.zip b/.yarn/cache/@babel-traverse-npm-7.25.7-0ca7b771fb-4d329b6e7a.zip new file mode 100644 index 0000000..9db1d43 Binary files /dev/null and b/.yarn/cache/@babel-traverse-npm-7.25.7-0ca7b771fb-4d329b6e7a.zip differ diff --git a/.yarn/cache/@babel-types-npm-7.25.8-44acfff5f6-93d84858e8.zip b/.yarn/cache/@babel-types-npm-7.25.8-44acfff5f6-93d84858e8.zip new file mode 100644 index 0000000..04bedcb Binary files /dev/null and b/.yarn/cache/@babel-types-npm-7.25.8-44acfff5f6-93d84858e8.zip differ diff --git a/.yarn/cache/@jridgewell-gen-mapping-npm-0.3.5-d8b85ebeaf-ff7a1764eb.zip b/.yarn/cache/@jridgewell-gen-mapping-npm-0.3.5-d8b85ebeaf-ff7a1764eb.zip new file mode 100644 index 0000000..ab69f33 Binary files /dev/null and b/.yarn/cache/@jridgewell-gen-mapping-npm-0.3.5-d8b85ebeaf-ff7a1764eb.zip differ diff --git a/.yarn/cache/@jridgewell-set-array-npm-1.2.1-2312928209-832e513a85.zip b/.yarn/cache/@jridgewell-set-array-npm-1.2.1-2312928209-832e513a85.zip new file mode 100644 index 0000000..8a72fc7 Binary files /dev/null and b/.yarn/cache/@jridgewell-set-array-npm-1.2.1-2312928209-832e513a85.zip differ diff --git a/.yarn/cache/@jridgewell-sourcemap-codec-npm-1.5.0-dfd9126d71-05df4f2538.zip b/.yarn/cache/@jridgewell-sourcemap-codec-npm-1.5.0-dfd9126d71-05df4f2538.zip new file mode 100644 index 0000000..59f5a96 Binary files /dev/null and b/.yarn/cache/@jridgewell-sourcemap-codec-npm-1.5.0-dfd9126d71-05df4f2538.zip differ diff --git a/.yarn/cache/@jridgewell-trace-mapping-npm-0.3.25-c076fd2279-9d3c40d225.zip b/.yarn/cache/@jridgewell-trace-mapping-npm-0.3.25-c076fd2279-9d3c40d225.zip new file mode 100644 index 0000000..fc42ef5 Binary files /dev/null and b/.yarn/cache/@jridgewell-trace-mapping-npm-0.3.25-c076fd2279-9d3c40d225.zip differ diff --git a/.yarn/cache/browserslist-npm-4.24.0-6b67324c87-de200d3eb8.zip b/.yarn/cache/browserslist-npm-4.24.0-6b67324c87-de200d3eb8.zip new file mode 100644 index 0000000..265e158 Binary files /dev/null and b/.yarn/cache/browserslist-npm-4.24.0-6b67324c87-de200d3eb8.zip differ diff --git a/.yarn/cache/caniuse-lite-npm-1.0.30001669-1160fd58ad-8ed0c69d0c.zip b/.yarn/cache/caniuse-lite-npm-1.0.30001669-1160fd58ad-8ed0c69d0c.zip new file mode 100644 index 0000000..e2bc23c Binary files /dev/null and b/.yarn/cache/caniuse-lite-npm-1.0.30001669-1160fd58ad-8ed0c69d0c.zip differ diff --git a/.yarn/cache/convert-source-map-npm-2.0.0-7ab664dc4e-63ae9933be.zip b/.yarn/cache/convert-source-map-npm-2.0.0-7ab664dc4e-63ae9933be.zip new file mode 100644 index 0000000..705ec45 Binary files /dev/null and b/.yarn/cache/convert-source-map-npm-2.0.0-7ab664dc4e-63ae9933be.zip differ diff --git a/.yarn/cache/debug-npm-4.3.7-385645adf9-822d74e209.zip b/.yarn/cache/debug-npm-4.3.7-385645adf9-822d74e209.zip new file mode 100644 index 0000000..f3a0c54 Binary files /dev/null and b/.yarn/cache/debug-npm-4.3.7-385645adf9-822d74e209.zip differ diff --git a/.yarn/cache/electron-to-chromium-npm-1.5.41-169e35b0ae-942cc53bea.zip b/.yarn/cache/electron-to-chromium-npm-1.5.41-169e35b0ae-942cc53bea.zip new file mode 100644 index 0000000..8f5d0f5 Binary files /dev/null and b/.yarn/cache/electron-to-chromium-npm-1.5.41-169e35b0ae-942cc53bea.zip differ diff --git a/.yarn/cache/escalade-npm-3.2.0-19b50dd48f-47b029c83d.zip b/.yarn/cache/escalade-npm-3.2.0-19b50dd48f-47b029c83d.zip new file mode 100644 index 0000000..8212e54 Binary files /dev/null and b/.yarn/cache/escalade-npm-3.2.0-19b50dd48f-47b029c83d.zip differ diff --git a/.yarn/cache/jsesc-npm-3.0.2-3b3b74ec0d-a36d3ca405.zip b/.yarn/cache/jsesc-npm-3.0.2-3b3b74ec0d-a36d3ca405.zip new file mode 100644 index 0000000..ac72feb Binary files /dev/null and b/.yarn/cache/jsesc-npm-3.0.2-3b3b74ec0d-a36d3ca405.zip differ diff --git a/.yarn/cache/node-releases-npm-2.0.18-51abc46668-ef55a3d853.zip b/.yarn/cache/node-releases-npm-2.0.18-51abc46668-ef55a3d853.zip new file mode 100644 index 0000000..b125493 Binary files /dev/null and b/.yarn/cache/node-releases-npm-2.0.18-51abc46668-ef55a3d853.zip differ diff --git a/.yarn/cache/picocolors-npm-1.1.1-4fede47cf1-e1cf46bf84.zip b/.yarn/cache/picocolors-npm-1.1.1-4fede47cf1-e1cf46bf84.zip new file mode 100644 index 0000000..44976ad Binary files /dev/null and b/.yarn/cache/picocolors-npm-1.1.1-4fede47cf1-e1cf46bf84.zip differ diff --git a/.yarn/cache/semver-npm-6.3.1-bcba31fdbe-ae47d06de2.zip b/.yarn/cache/semver-npm-6.3.1-bcba31fdbe-ae47d06de2.zip new file mode 100644 index 0000000..91f42cf Binary files /dev/null and b/.yarn/cache/semver-npm-6.3.1-bcba31fdbe-ae47d06de2.zip differ diff --git a/.yarn/cache/update-browserslist-db-npm-1.1.1-16e34017b1-2ea11bd256.zip b/.yarn/cache/update-browserslist-db-npm-1.1.1-16e34017b1-2ea11bd256.zip new file mode 100644 index 0000000..e5c9e10 Binary files /dev/null and b/.yarn/cache/update-browserslist-db-npm-1.1.1-16e34017b1-2ea11bd256.zip differ diff --git a/figma-plugin/plugin-src/service.ts b/figma-plugin/plugin-src/service.ts index 1f3c135..45bc58c 100644 --- a/figma-plugin/plugin-src/service.ts +++ b/figma-plugin/plugin-src/service.ts @@ -14,6 +14,7 @@ type TargetNode = type ExtractedNode = { id: string; name: string; + description?: string; }; const makeComponentName = ({ @@ -43,6 +44,7 @@ const makeComponentName = ({ const findComponentInNode = ( node: TargetNode, setName?: string, + description?: string, ): ExtractedNode | ExtractedNode[] => { switch (node.type) { case "FRAME": @@ -57,13 +59,13 @@ const findComponentInNode = ( separator: "_", }); - return { id: node.id, name: svgName }; + return { id: node.id, name: svgName, description }; } case "COMPONENT_SET": { - return node.children.flatMap((child: any) => - findComponentInNode(child, node.name), - ); + return node.children.flatMap((child: any) => { + return findComponentInNode(child, node.name, node.description); + }); } default: { @@ -90,10 +92,38 @@ export function getAssetFramesInFrame(targetFrame: FrameNode): ExtractedNode[] { return targetNodes.filter((component) => component); } +function createRegexWithDelimiters( + startDelimiter: string, + endDelimiter: string, +): RegExp { + // 특수 문자 이스케이프 처리 + const escapeRegExp = (string: string) => + string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); + + const start = escapeRegExp(startDelimiter); + const end = escapeRegExp(endDelimiter); + + return new RegExp(`${start}(.*?)${end}`); +} + export async function getSvgFromExtractedNodes(nodes: ExtractedNode[]) { const datas = await Promise.allSettled( nodes.map(async (component) => { const node = figma.getNodeById(component.id) as ComponentNode; + const description = component.description; + const regex = createRegexWithDelimiters("[", "]"); + const metadatasRegexResult = regex.exec(description || ""); + + if (metadatasRegexResult && metadatasRegexResult.length === 2) { + return { + name: component.name, + svg: await node.exportAsync({ + format: "SVG_STRING", + svgIdAttribute: true, + }), + metadatas: metadatasRegexResult[1].split(","), + }; + } return { name: component.name, @@ -101,6 +131,7 @@ export async function getSvgFromExtractedNodes(nodes: ExtractedNode[]) { format: "SVG_STRING", svgIdAttribute: true, }), + metadatas: [], }; }), ); diff --git a/figma-plugin/ui-src/pages/Deploy.tsx b/figma-plugin/ui-src/pages/Deploy.tsx index 52a88d5..39d659a 100644 --- a/figma-plugin/ui-src/pages/Deploy.tsx +++ b/figma-plugin/ui-src/pages/Deploy.tsx @@ -5,6 +5,7 @@ import { Flex, Spinner, Text, + Textarea, Tooltip, } from "@chakra-ui/react"; import { useJune } from "june-so-sandbox-react"; @@ -215,6 +216,17 @@ const Deploy = () => { ); })} + + + Datas + + + +