mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-01-09 00:20:05 -05:00
32aafbcf9d
* Implement components
* fix
* revert
* wip
* wip
* wip
* 🎉 Finish create component operation
* minor fixes
* not needed, refactor
* refactor not needed
* refactor not needed
* remove deps
* add changelog
* fixes
* fixes
* fixes
* fix lint
* refactor ui-src
* further refactor
* refactor
* refactor
* more refactor
* refactor
* refactor
* penpot lib update
---------
Co-authored-by: Alex Sánchez <sion333@gmail.com>
Co-authored-by: Andrés Moya <andres.moya@kaleidos.net>
38 lines
889 B
TypeScript
38 lines
889 B
TypeScript
import {
|
|
Command,
|
|
PathContent,
|
|
Segment,
|
|
VECTOR_CLOSE_PATH,
|
|
VECTOR_CURVE_TO,
|
|
VECTOR_LINE_TO,
|
|
VECTOR_MOVE_TO
|
|
} from '@ui/lib/types/shapes/pathShape';
|
|
|
|
export const symbolPathContent = (content: PathContent): PathContent =>
|
|
content
|
|
.map(({ command: stringCommand, ...rest }) => {
|
|
const command = symbolPathCommand(stringCommand);
|
|
|
|
if (!command) return;
|
|
|
|
return {
|
|
command,
|
|
...rest
|
|
} as Segment;
|
|
})
|
|
.filter((command): command is Segment => !!command);
|
|
|
|
const symbolPathCommand = (command: Command): Command | undefined => {
|
|
switch (command) {
|
|
case 'line-to':
|
|
return VECTOR_LINE_TO;
|
|
case 'close-path':
|
|
return VECTOR_CLOSE_PATH;
|
|
case 'move-to':
|
|
return VECTOR_MOVE_TO;
|
|
case 'curve-to':
|
|
return VECTOR_CURVE_TO;
|
|
}
|
|
|
|
console.error(`Unsupported svg command type: ${String(command)}`);
|
|
};
|