0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-08 16:10:07 -05:00
penpot-exporter-figma-plugin/ui-src/parser/libraries/Components.ts
Alex Sánchez e8270cfd54
Refactor (#188)
* refactor

* fixes

* rename libraries

* refactor libraries

* fixes
2024-06-25 17:12:20 +02:00

30 lines
640 B
TypeScript

import { Uuid } from '@ui/lib/types/utils/uuid';
export type UiComponent = {
componentId: Uuid;
mainInstancePage?: Uuid;
mainInstanceId: Uuid;
componentFigmaId: string;
};
class Components {
private components: Map<string, UiComponent> = new Map();
public register(id: string, component: UiComponent) {
this.components.set(id, component);
}
public get(id: string): UiComponent | undefined {
return this.components.get(id);
}
public all(): UiComponent[] {
return Array.from(this.components.values());
}
public init() {
this.components.clear();
}
}
export const components = new Components();