0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00
penpot-exporter-figma-plugin/plugin-src/StyleLibrary.ts
Alex Sánchez a58f9e913d
Color libraries (#183)
* wip

* color library

* fixes

* fixes

* fixes

* fixes

* changeset

* fixes

* fixes

* fixes

* fixes
2024-06-25 14:12:37 +02:00

21 lines
519 B
TypeScript

class StyleLibrary {
private styles: Map<string, PaintStyle | undefined> = new Map();
public register(id: string, styles?: PaintStyle | undefined) {
this.styles.set(id, styles);
}
public get(id: string): PaintStyle | undefined {
return this.styles.get(id);
}
public has(id: string): boolean {
return this.styles.has(id);
}
public all(): Record<string, PaintStyle | undefined> {
return Object.fromEntries(this.styles.entries());
}
}
export const styleLibrary = new StyleLibrary();