2024-06-26 01:11:57 -05:00
|
|
|
import { toObject } from '@common/map';
|
|
|
|
|
2024-06-28 05:17:56 -05:00
|
|
|
import { componentProperties, components } from '@plugin/libraries';
|
2024-06-25 10:12:20 -05:00
|
|
|
import {
|
|
|
|
processImages,
|
|
|
|
processPages,
|
|
|
|
processPaintStyles,
|
|
|
|
processTextStyles,
|
|
|
|
registerPaintStyles,
|
|
|
|
registerTextStyles
|
|
|
|
} from '@plugin/processors';
|
2024-05-29 10:33:29 -05:00
|
|
|
|
|
|
|
import { PenpotDocument } from '@ui/types';
|
2024-04-12 09:52:36 -05:00
|
|
|
|
2024-06-06 10:24:59 -05:00
|
|
|
export const transformDocumentNode = async (node: DocumentNode): Promise<PenpotDocument> => {
|
2024-06-25 10:12:20 -05:00
|
|
|
await registerPaintStyles();
|
|
|
|
await registerTextStyles();
|
2024-06-25 09:08:59 -05:00
|
|
|
|
2024-06-06 10:24:59 -05:00
|
|
|
const children = await processPages(node);
|
2024-06-25 10:12:20 -05:00
|
|
|
const paintStyles = await processPaintStyles();
|
|
|
|
const images = await processImages();
|
|
|
|
const textStyles = await processTextStyles();
|
2024-06-25 09:08:59 -05:00
|
|
|
|
2024-04-12 06:55:42 -05:00
|
|
|
return {
|
|
|
|
name: node.name,
|
2024-05-31 04:25:32 -05:00
|
|
|
children,
|
2024-06-26 01:11:57 -05:00
|
|
|
components: toObject(components),
|
2024-06-25 07:12:37 -05:00
|
|
|
images,
|
2024-06-25 10:12:20 -05:00
|
|
|
paintStyles,
|
2024-06-28 05:17:56 -05:00
|
|
|
textStyles,
|
|
|
|
componentProperties: toObject(componentProperties)
|
2024-04-12 06:55:42 -05:00
|
|
|
};
|
|
|
|
};
|