0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00
penpot-exporter-figma-plugin/plugin-src/transformers/transformGroupNode.ts
Alex Sánchez 4591369e3c
Instances Overrides (#166)
* wip

* added support for overrides

* fixes
2024-06-17 09:58:23 +02:00

39 lines
1,014 B
TypeScript

import {
transformBlend,
transformDimension,
transformEffects,
transformFigmaIds,
transformOverrides,
transformRotationAndPosition,
transformSceneNode
} from '@plugin/transformers/partials';
import { transformChildren } from '@plugin/transformers/partials';
import { GroupShape } from '@ui/lib/types/shapes/groupShape';
export const transformGroupNode = async (
node: GroupNode,
baseRotation: number
): Promise<GroupShape> => {
return {
...transformFigmaIds(node),
...transformGroupNodeLike(node, baseRotation),
...transformEffects(node),
...transformBlend(node),
...(await transformChildren(node, baseRotation)),
...transformOverrides(node)
};
};
export const transformGroupNodeLike = (
node: BaseNodeMixin & LayoutMixin & SceneNodeMixin,
baseRotation: number
): GroupShape => {
return {
type: 'group',
name: node.name,
...transformDimension(node),
...transformRotationAndPosition(node, baseRotation),
...transformSceneNode(node)
};
};