2024-05-13 10:12:58 +02:00
|
|
|
import { PenpotFile } from '@ui/lib/types/penpotFile';
|
2024-05-06 08:06:14 +02:00
|
|
|
import { GroupShape } from '@ui/lib/types/shapes/groupShape';
|
2024-05-30 17:54:37 +02:00
|
|
|
import { parseFigmaId } from '@ui/parser';
|
2024-06-28 12:17:56 +02:00
|
|
|
import { symbolTouched } from '@ui/parser/creators/symbols';
|
2024-04-12 16:52:36 +02:00
|
|
|
|
2024-05-29 12:52:21 +02:00
|
|
|
import { createItems } from '.';
|
2024-04-08 17:50:01 +02:00
|
|
|
|
2024-05-29 12:52:21 +02:00
|
|
|
export const createGroup = (
|
2024-04-12 13:55:42 +02:00
|
|
|
file: PenpotFile,
|
2024-06-18 11:20:51 +02:00
|
|
|
{ type, children = [], figmaId, figmaRelatedId, ...shape }: GroupShape
|
2024-04-08 17:50:01 +02:00
|
|
|
) => {
|
2024-06-18 11:20:51 +02:00
|
|
|
shape.id = parseFigmaId(file, figmaId);
|
|
|
|
shape.shapeRef = parseFigmaId(file, figmaRelatedId, true);
|
2024-06-28 12:17:56 +02:00
|
|
|
shape.touched = symbolTouched(
|
|
|
|
!shape.hidden,
|
|
|
|
undefined,
|
|
|
|
shape.touched,
|
|
|
|
shape.componentPropertyReferences
|
|
|
|
);
|
2024-06-18 11:20:51 +02:00
|
|
|
|
|
|
|
file.addGroup(shape);
|
2024-04-10 11:14:12 +00:00
|
|
|
|
2024-05-29 12:52:21 +02:00
|
|
|
createItems(file, children);
|
2024-04-10 11:14:12 +00:00
|
|
|
|
2024-04-12 13:55:42 +02:00
|
|
|
file.closeGroup();
|
2024-04-08 17:50:01 +02:00
|
|
|
};
|