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:
parent
b8058dc0ee
commit
01a4fa5622
7 changed files with 41 additions and 11 deletions
|
@ -1,3 +1,4 @@
|
|||
export * from './transformBlend';
|
||||
export * from './transformChildren';
|
||||
export * from './transformDimensionAndPosition';
|
||||
export * from './transformSceneNode';
|
||||
|
|
8
plugin-src/transformers/partials/transformSceneNode.ts
Normal file
8
plugin-src/transformers/partials/transformSceneNode.ts
Normal 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
|
||||
};
|
||||
};
|
|
@ -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)
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue