mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 13:43:03 -05:00
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { componentsLibrary } from '@plugin/ComponentLibrary';
|
|
import {
|
|
transformAutoLayout,
|
|
transformBlend,
|
|
transformChildren,
|
|
transformConstraints,
|
|
transformCornerRadius,
|
|
transformDimension,
|
|
transformEffects,
|
|
transformFigmaIds,
|
|
transformFills,
|
|
transformLayoutAttributes,
|
|
transformProportion,
|
|
transformRotationAndPosition,
|
|
transformSceneNode,
|
|
transformStrokes
|
|
} from '@plugin/transformers/partials';
|
|
|
|
import { ComponentRoot } from '@ui/types';
|
|
|
|
export const transformComponentNode = (node: ComponentNode): ComponentRoot => {
|
|
componentsLibrary.register(node.id, {
|
|
type: 'component',
|
|
name: node.name,
|
|
path: node.parent?.type === 'COMPONENT_SET' ? node.parent.name : '',
|
|
showContent: !node.clipsContent,
|
|
...transformFigmaIds(node),
|
|
...transformFills(node),
|
|
...transformEffects(node),
|
|
...transformStrokes(node),
|
|
...transformSceneNode(node),
|
|
...transformBlend(node),
|
|
...transformProportion(node),
|
|
...transformLayoutAttributes(node, true),
|
|
...transformCornerRadius(node),
|
|
...transformChildren(node),
|
|
...transformDimension(node),
|
|
...transformRotationAndPosition(node),
|
|
...transformConstraints(node),
|
|
...transformAutoLayout(node)
|
|
});
|
|
|
|
return {
|
|
figmaId: node.id,
|
|
type: 'component',
|
|
name: node.name
|
|
};
|
|
};
|