0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-03 05:10:13 -05:00
penpot-exporter-figma-plugin/ui-src/parser/parse.ts
Alex Sánchez 7b3192936e
Component Instances (#124)
* wip

* wip

* wipo

* more structure

* wip

* id library wip

* wip

* main instance working

* improvements

* fix node order

* refactor

* remove not used method

* refactor

* fix component set translation

* refactor

* add changelog

* penpot lib update

---------

Co-authored-by: Jordi Sala Morales <jordism91@gmail.com>
2024-05-30 17:54:37 +02:00

24 lines
638 B
TypeScript

import { componentsLibrary } from '@plugin/ComponentLibrary';
import { createFile } from '@ui/lib/penpot';
import { createComponentLibrary, createPage } from '@ui/parser/creators';
import { uiComponents } from '@ui/parser/libraries/UiComponents';
import { PenpotDocument } from '@ui/types';
import { idLibrary } from '.';
export const parse = ({ name, children = [], components }: PenpotDocument) => {
componentsLibrary.init(components);
uiComponents.init();
idLibrary.init();
const file = createFile(name);
for (const page of children) {
createPage(file, page);
}
createComponentLibrary(file);
return file;
};