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