0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 05:33:02 -05:00
penpot-exporter-figma-plugin/plugin-src/RemoteComponentLibrary.ts
2024-06-19 09:38:57 +00:00

28 lines
591 B
TypeScript

import { PenpotNode } from '@ui/types';
class RemoteComponentsLibrary {
private components: PenpotNode[] = [];
private registry: Record<string, null> = {};
public add(component: PenpotNode) {
this.components.push(component);
}
public register(id: string) {
this.registry[id] = null;
}
public has(id: string): boolean {
return this.registry[id] === null;
}
public total(): number {
return this.components.length;
}
public all(): PenpotNode[] {
return this.components;
}
}
export const remoteComponentLibrary = new RemoteComponentsLibrary();