0
Fork 0
mirror of https://github.com/penpot/penpot-plugins.git synced 2025-02-01 12:01:14 -05:00

feat: add support for component in libraries

This commit is contained in:
alonso.torres 2024-06-03 11:46:28 +02:00 committed by Alonso Torres
parent 24318395fe
commit 588b565811

View file

@ -413,6 +413,8 @@ export interface PenpotLibraryElement {
export interface PenpotLibraryColor extends PenpotLibraryElement { export interface PenpotLibraryColor extends PenpotLibraryElement {
color?: string; color?: string;
opacity?: number; opacity?: number;
gradient?: PenpotGradient;
image?: PenpotImageData;
asFill(): PenpotFill; asFill(): PenpotFill;
asStroke(): PenpotStroke; asStroke(): PenpotStroke;
@ -433,17 +435,18 @@ export interface PenpotLibraryTypography extends PenpotLibraryElement {
applyToTextRange(shape: PenpotShape): void; applyToTextRange(shape: PenpotShape): void;
} }
export type PenpotLibraryComponent = { export interface PenpotLibraryComponent extends PenpotLibraryElement {
name: string; instance(): PenpotShape;
}; }
export type PenpotLibrary = { export type PenpotLibrary = {
colors: PenpotLibraryColor[]; colors: PenpotLibraryColor[];
typographies: PenpotLibraryTypography[]; typographies: PenpotLibraryTypography[];
components: PenpotLibraryComponent[]; components: PenpotLibraryComponent[];
// createColor(): PenpotLibraryColor; createColor(): PenpotLibraryColor;
// createTypography(): PenpotLibraryTypography; createTypography(): PenpotLibraryTypography;
createComponent(shapes: PenpotShape[]): PenpotLibraryComponent;
}; };
export type PenpotLibraryContext = { export type PenpotLibraryContext = {