mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 21:53:27 -05:00
24 lines
595 B
TypeScript
24 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();
|