0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 21:53:27 -05:00
penpot-exporter-figma-plugin/plugin-src/processors/processPages.ts
Alex Sánchez c5dd5d011e
Reworked remote components (#197)
* reworked remote components

* changeset
2024-06-28 11:40:33 +02:00

30 lines
649 B
TypeScript

import { sleep } from '@common/sleep';
import { transformPageNode } from '@plugin/transformers';
import { PenpotPage } from '@ui/lib/types/penpotPage';
export const processPages = async (node: DocumentNode): Promise<PenpotPage[]> => {
const children = [];
let currentPage = 1;
figma.ui.postMessage({
type: 'PROGRESS_TOTAL_ITEMS',
data: node.children.length
});
for (const page of node.children) {
await page.loadAsync();
children.push(await transformPageNode(page));
figma.ui.postMessage({
type: 'PROGRESS_PROCESSED_ITEMS',
data: currentPage++
});
await sleep(0);
}
return children;
};