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

add block concept

This commit is contained in:
Jordi Sala Morales 2024-04-15 16:30:51 +00:00
parent b8058dc0ee
commit 01a4fa5622
No known key found for this signature in database
GPG key ID: C5127140107F55FD
7 changed files with 41 additions and 11 deletions

View file

@ -1,3 +1,4 @@
export * from './transformBlend';
export * from './transformChildren';
export * from './transformDimensionAndPosition';
export * from './transformSceneNode';

View file

@ -0,0 +1,8 @@
import { ShapeAttributes } from '@ui/lib/types/shape/shapeAttributes';
export const transformSceneNode = (node: SceneNodeMixin): Partial<ShapeAttributes> => {
return {
blocked: node.locked,
hidden: false // @TODO: check this. it won't export if we hide it
};
};

View file

@ -1,4 +1,8 @@
import { transformBlend, transformDimensionAndPosition } from '@plugin/transformers/partials';
import {
transformBlend,
transformDimensionAndPosition,
transformSceneNode
} from '@plugin/transformers/partials';
import { translateFills } from '@plugin/translators';
import { CircleShape } from '@ui/lib/types/circle/circleShape';
@ -13,6 +17,7 @@ export const transformEllipseNode = (
name: node.name,
fills: translateFills(node.fills, node.width, node.height),
...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node),
...transformBlend(node)
};
};

View file

@ -1,4 +1,4 @@
import { transformDimensionAndPosition } from '@plugin/transformers/partials';
import { transformDimensionAndPosition, transformSceneNode } from '@plugin/transformers/partials';
import { transformChildren } from '@plugin/transformers/partials';
import { translateFills } from '@plugin/translators';
@ -14,6 +14,7 @@ export const transformFrameNode = async (
name: node.name,
fills: translateFills(node.fills, node.width, node.height),
...(await transformChildren(node, baseX, baseY)),
...transformDimensionAndPosition(node, baseX, baseY)
...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node)
};
};

View file

@ -1,4 +1,8 @@
import { transformBlend, transformDimensionAndPosition } from '@plugin/transformers/partials';
import {
transformBlend,
transformDimensionAndPosition,
transformSceneNode
} from '@plugin/transformers/partials';
import { transformChildren } from '@plugin/transformers/partials';
import { GroupShape } from '@ui/lib/types/group/groupShape';
@ -11,8 +15,9 @@ export const transformGroupNode = async (
return {
type: 'group',
name: node.name,
...transformDimensionAndPosition(node, baseX, baseY),
...(await transformChildren(node, baseX, baseY)),
...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node),
...transformBlend(node)
};
};

View file

@ -1,4 +1,8 @@
import { transformBlend, transformDimensionAndPosition } from '@plugin/transformers/partials';
import {
transformBlend,
transformDimensionAndPosition,
transformSceneNode
} from '@plugin/transformers/partials';
import { translateFills } from '@plugin/translators';
import { RectShape } from '@ui/lib/types/rect/rectShape';
@ -12,7 +16,8 @@ export const transformRectangleNode = (
type: 'rect',
name: node.name,
fills: translateFills(node.fills, node.width, node.height),
...transformBlend(node),
...transformDimensionAndPosition(node, baseX, baseY)
...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node),
...transformBlend(node)
};
};

View file

@ -1,4 +1,8 @@
import { transformBlend, transformDimensionAndPosition } from '@plugin/transformers/partials';
import {
transformBlend,
transformDimensionAndPosition,
transformSceneNode
} from '@plugin/transformers/partials';
import {
translateFills,
translateTextDecoration,
@ -59,7 +63,8 @@ export const transformTextNode = (node: TextNode, baseX: number, baseY: number):
}
]
},
...transformBlend(node),
...transformDimensionAndPosition(node, baseX, baseY)
...transformDimensionAndPosition(node, baseX, baseY),
...transformSceneNode(node),
...transformBlend(node)
};
};