mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 05:33:02 -05:00
draft
This commit is contained in:
parent
308fa93625
commit
6dbee90040
5 changed files with 20 additions and 11 deletions
|
@ -4,5 +4,6 @@
|
|||
"api": "1.0.0",
|
||||
"main": "dist/code.js",
|
||||
"ui": "dist/ui.html",
|
||||
"editorType": ["figma", "figjam"]
|
||||
"editorType": ["figma", "figjam"],
|
||||
"documentAccess": "dynamic-page"
|
||||
}
|
||||
|
|
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -14,11 +14,13 @@
|
|||
"slugify": "^1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@figma/eslint-plugin-figma-plugins": "^0.15",
|
||||
"@figma/plugin-typings": "^1.88",
|
||||
"@figma/eslint-plugin-figma-plugins": "^0.15.0",
|
||||
"@figma/plugin-typings": "^1.90.0",
|
||||
"@trivago/prettier-plugin-sort-imports": "^4.3",
|
||||
"@types/react": "^18.2",
|
||||
"@types/react-dom": "^18.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
||||
"@typescript-eslint/parser": "^7.5.0",
|
||||
"css-loader": "^6.10",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1",
|
||||
|
@ -33,7 +35,7 @@
|
|||
"stylelint": "^16.3",
|
||||
"stylelint-config-standard": "^36.0",
|
||||
"ts-loader": "^9.5",
|
||||
"typescript": "^5.4",
|
||||
"typescript": "^5.4.4",
|
||||
"typescript-eslint": "^7.4",
|
||||
"webpack": "^5.91",
|
||||
"webpack-cli": "^5.1"
|
||||
|
|
|
@ -25,11 +25,13 @@
|
|||
"slugify": "^1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@figma/eslint-plugin-figma-plugins": "^0.15",
|
||||
"@figma/plugin-typings": "^1.88",
|
||||
"@figma/eslint-plugin-figma-plugins": "^0.15.0",
|
||||
"@figma/plugin-typings": "^1.90.0",
|
||||
"@trivago/prettier-plugin-sort-imports": "^4.3",
|
||||
"@types/react": "^18.2",
|
||||
"@types/react-dom": "^18.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
||||
"@typescript-eslint/parser": "^7.5.0",
|
||||
"css-loader": "^6.10",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1",
|
||||
|
@ -44,7 +46,7 @@
|
|||
"stylelint": "^16.3",
|
||||
"stylelint-config-standard": "^36.0",
|
||||
"ts-loader": "^9.5",
|
||||
"typescript": "^5.4",
|
||||
"typescript": "^5.4.4",
|
||||
"typescript-eslint": "^7.4",
|
||||
"webpack": "^5.91",
|
||||
"webpack-cli": "^5.1"
|
||||
|
|
10
src/code.ts
10
src/code.ts
|
@ -19,13 +19,17 @@ function detectMimeType(b64: string) {
|
|||
}
|
||||
}
|
||||
|
||||
function traverse(node: BaseNode): NodeData | TextData {
|
||||
async function traverse(node: BaseNode): Promise<NodeData | TextData> {
|
||||
const children: (NodeData | TextData)[] = [];
|
||||
|
||||
if (node.type === 'PAGE') {
|
||||
await node.loadAsync();
|
||||
}
|
||||
|
||||
if ('children' in node) {
|
||||
if (node.type !== 'INSTANCE') {
|
||||
for (const child of node.children) {
|
||||
children.push(traverse(child));
|
||||
children.push(await traverse(child));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +105,7 @@ function traverse(node: BaseNode): NodeData | TextData {
|
|||
|
||||
figma.showUI(__html__, { themeColors: true, height: 200, width: 300 });
|
||||
|
||||
const root: NodeData | TextData = traverse(figma.root); // start the traversal at the root
|
||||
const root: NodeData | TextData = await traverse(figma.root); // start the traversal at the root
|
||||
figma.ui.postMessage({ type: 'FIGMAFILE', data: root });
|
||||
|
||||
figma.ui.onmessage = msg => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"skipLibCheck": true,
|
||||
"jsx": "react",
|
||||
"lib": ["DOM", "ES6"],
|
||||
"target": "ES6",
|
||||
"target": "es2017",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node10",
|
||||
"strict": true,
|
||||
|
|
Loading…
Reference in a new issue