0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 21:53:27 -05:00
penpot-exporter-figma-plugin/plugin-src/ComponentLibrary.ts
Alex Sánchez 5d4ace337b
Components Library (#125)
* components library management

* components library management

* fixes

* fixes
2024-05-29 17:33:29 +02:00

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();