mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 05:33:02 -05:00
5d4ace337b
* components library management * components library management * fixes * fixes
23 lines
595 B
TypeScript
23 lines
595 B
TypeScript
import { ComponentShape } from '@ui/lib/types/shapes/componentShape';
|
|
|
|
class ComponentLibrary {
|
|
private components: Record<string, ComponentShape> = {};
|
|
|
|
public register(id: string, component: ComponentShape) {
|
|
this.components[id] = component;
|
|
}
|
|
|
|
public get(id: string): ComponentShape | undefined {
|
|
return this.components[id];
|
|
}
|
|
|
|
public all(): Record<string, ComponentShape> {
|
|
return this.components;
|
|
}
|
|
|
|
public init(components: Record<string, ComponentShape>): void {
|
|
this.components = components;
|
|
}
|
|
}
|
|
|
|
export const componentsLibrary = new ComponentLibrary();
|