mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-01-03 05:10:13 -05:00
7b3192936e
* 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>
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { componentsLibrary } from '@plugin/ComponentLibrary';
|
|
import {
|
|
transformBlend,
|
|
transformChildren,
|
|
transformCornerRadius,
|
|
transformDimensionAndPosition,
|
|
transformEffects,
|
|
transformFigmaIds,
|
|
transformFills,
|
|
transformProportion,
|
|
transformSceneNode,
|
|
transformStrokes
|
|
} from '@plugin/transformers/partials';
|
|
|
|
import { ComponentRoot } from '@ui/types';
|
|
|
|
export const transformComponentNode = async (
|
|
node: ComponentNode,
|
|
baseX: number,
|
|
baseY: number
|
|
): Promise<ComponentRoot> => {
|
|
componentsLibrary.register(node.id, {
|
|
type: 'component',
|
|
name: node.name,
|
|
path: '',
|
|
...transformFigmaIds(node),
|
|
...(await transformFills(node)),
|
|
...transformEffects(node),
|
|
...(await transformStrokes(node)),
|
|
...transformSceneNode(node),
|
|
...transformBlend(node),
|
|
...transformProportion(node),
|
|
...transformCornerRadius(node),
|
|
...(await transformChildren(node, baseX + node.x, baseY + node.y)),
|
|
...transformDimensionAndPosition(node, baseX, baseY)
|
|
});
|
|
|
|
return {
|
|
figmaId: node.id,
|
|
type: 'component'
|
|
};
|
|
};
|