0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00

fix frames fills and blendModes (#118)

This commit is contained in:
Alex Sánchez 2024-05-27 13:04:42 +02:00 committed by GitHub
parent 477291758e
commit 35d9d47e2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 7 deletions

View file

@ -0,0 +1,5 @@
---
"penpot-exporter": patch
---
Fix frames fills and blendModes

View file

@ -1,13 +1,18 @@
import { PenpotFile } from '@ui/lib/types/penpotFile'; import { PenpotFile } from '@ui/lib/types/penpotFile';
import { FrameShape } from '@ui/lib/types/shapes/frameShape'; import { FrameShape } from '@ui/lib/types/shapes/frameShape';
import { translateFillGradients, translateUiBlendMode } from '@ui/translators';
import { createPenpotItem } from '.'; import { createPenpotItem } from '.';
export const createPenpotArtboard = ( export const createPenpotArtboard = (
file: PenpotFile, file: PenpotFile,
{ type, children = [], ...rest }: FrameShape { type, fills, blendMode, children = [], ...rest }: FrameShape
) => { ) => {
file.addArtboard(rest); file.addArtboard({
fills: translateFillGradients(fills),
blendMode: translateUiBlendMode(blendMode),
...rest
});
for (const child of children) { for (const child of children) {
createPenpotItem(file, child); createPenpotItem(file, child);

View file

@ -1,11 +1,14 @@
import { LayoutAttributes, LayoutChildAttributes } from '@ui/lib/types/shapes/layout'; import { LayoutAttributes, LayoutChildAttributes } from '@ui/lib/types/shapes/layout';
import { ShapeBaseAttributes, ShapeGeomAttributes } from '@ui/lib/types/shapes/shape'; import {
ShapeAttributes,
ShapeBaseAttributes,
ShapeGeomAttributes
} from '@ui/lib/types/shapes/shape';
import { Children } from '@ui/lib/types/utils/children'; import { Children } from '@ui/lib/types/utils/children';
import { Fill } from '@ui/lib/types/utils/fill';
import { Stroke } from '@ui/lib/types/utils/stroke';
import { Uuid } from '@ui/lib/types/utils/uuid'; import { Uuid } from '@ui/lib/types/utils/uuid';
export type FrameShape = ShapeBaseAttributes & export type FrameShape = ShapeBaseAttributes &
ShapeAttributes &
ShapeGeomAttributes & ShapeGeomAttributes &
FrameAttributes & FrameAttributes &
LayoutAttributes & LayoutAttributes &
@ -18,6 +21,4 @@ type FrameAttributes = {
hideFillOnExport?: boolean; hideFillOnExport?: boolean;
showContent?: boolean; showContent?: boolean;
hideInViewer?: boolean; hideInViewer?: boolean;
fills?: Fill[];
strokes?: Stroke[];
}; };