2024-04-12 09:52:36 -05:00
|
|
|
import { PenpotFile } from '@ui/lib/penpot';
|
|
|
|
import { GROUP_TYPE } from '@ui/lib/types/group/groupAttributes';
|
|
|
|
import { GroupShape } from '@ui/lib/types/group/groupShape';
|
2024-04-16 04:24:53 -05:00
|
|
|
import { translateUiBlendMode } from '@ui/translators';
|
2024-04-12 09:52:36 -05:00
|
|
|
|
|
|
|
import { createPenpotItem } from '.';
|
2024-04-08 10:50:01 -05:00
|
|
|
|
|
|
|
export const createPenpotGroup = (
|
2024-04-12 06:55:42 -05:00
|
|
|
file: PenpotFile,
|
2024-04-16 04:24:53 -05:00
|
|
|
{ type, blendMode, children = [], ...rest }: GroupShape
|
2024-04-08 10:50:01 -05:00
|
|
|
) => {
|
2024-04-12 06:55:42 -05:00
|
|
|
file.addGroup({
|
|
|
|
type: GROUP_TYPE,
|
2024-04-16 04:24:53 -05:00
|
|
|
blendMode: translateUiBlendMode(blendMode),
|
2024-04-12 06:55:42 -05:00
|
|
|
...rest
|
2024-04-10 06:14:12 -05:00
|
|
|
});
|
|
|
|
|
2024-04-12 06:55:42 -05:00
|
|
|
for (const child of children) {
|
|
|
|
createPenpotItem(file, child);
|
2024-04-08 10:50:01 -05:00
|
|
|
}
|
2024-04-10 06:14:12 -05:00
|
|
|
|
2024-04-12 06:55:42 -05:00
|
|
|
file.closeGroup();
|
2024-04-08 10:50:01 -05:00
|
|
|
};
|