mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 13:43:03 -05:00
a079f168df
* metricts-sentry * fixes * refactor * mixpanel integration * improvements * improvements * fixes * changeset * fixes * fixes * Update .changeset/few-scissors-sleep.md Co-authored-by: Jordi Sala Morales <jordism91@gmail.com> * Update manifest.json Co-authored-by: Jordi Sala Morales <jordism91@gmail.com> * Update vite.config.ts Co-authored-by: Jordi Sala Morales <jordism91@gmail.com> * fixes * fixes * fixes * lint --------- Co-authored-by: Jordi Sala Morales <jordism91@gmail.com>
72 lines
1.3 KiB
TypeScript
72 lines
1.3 KiB
TypeScript
import { PenpotDocument } from '@ui/types';
|
|
|
|
import { Steps } from '.';
|
|
|
|
export type MessageData = { pluginMessage?: PluginMessage };
|
|
|
|
type PluginMessage =
|
|
| PenpotDocumentMessage
|
|
| CustomFontsMessage
|
|
| ChangesDetectedMessage
|
|
| ProgressStepMessage
|
|
| ProgressCurrentItemMessage
|
|
| ProgressTotalItemsMessage
|
|
| ProgressProcessedItemsMessage
|
|
| ErrorMessage
|
|
| UserDataMessage;
|
|
|
|
type PenpotDocumentMessage = {
|
|
type: 'PENPOT_DOCUMENT';
|
|
data: PenpotDocument;
|
|
};
|
|
|
|
type CustomFontsMessage = {
|
|
type: 'CUSTOM_FONTS';
|
|
data: string[];
|
|
};
|
|
|
|
type ChangesDetectedMessage = {
|
|
type: 'CHANGES_DETECTED';
|
|
};
|
|
|
|
type ProgressStepMessage = {
|
|
type: 'PROGRESS_STEP';
|
|
data: Steps;
|
|
};
|
|
|
|
type ProgressCurrentItemMessage = {
|
|
type: 'PROGRESS_CURRENT_ITEM';
|
|
data: string;
|
|
};
|
|
|
|
type ProgressTotalItemsMessage = {
|
|
type: 'PROGRESS_TOTAL_ITEMS';
|
|
data: number;
|
|
};
|
|
|
|
type ProgressProcessedItemsMessage = {
|
|
type: 'PROGRESS_PROCESSED_ITEMS';
|
|
data: number;
|
|
};
|
|
|
|
type ErrorMessage = {
|
|
type: 'ERROR';
|
|
data: string;
|
|
};
|
|
|
|
type UserDataMessage = {
|
|
type: 'USER_DATA';
|
|
data: {
|
|
userId: string;
|
|
};
|
|
};
|
|
|
|
export const sendMessage = (pluginMessage: PluginMessage) => {
|
|
window.dispatchEvent(
|
|
new MessageEvent<MessageData>('message', {
|
|
data: {
|
|
pluginMessage
|
|
}
|
|
})
|
|
);
|
|
};
|