From 222dbaa5fc6a567ca352989ac72605527dbb8186 Mon Sep 17 00:00:00 2001 From: Jordi Sala Morales Date: Wed, 10 Apr 2024 10:54:46 +0000 Subject: [PATCH] add rect --- src/ui/converters/createPenpotRectangle.ts | 1 + src/ui/lib/penpot.d.ts | 3 ++- src/ui/lib/types/circle/circleAttributes.d.ts | 3 ++- src/ui/lib/types/rect/rectAttributes.d.ts | 5 +++++ src/ui/lib/types/rect/rectShape.d.ts | 4 ++++ 5 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/ui/lib/types/rect/rectAttributes.d.ts create mode 100644 src/ui/lib/types/rect/rectShape.d.ts diff --git a/src/ui/converters/createPenpotRectangle.ts b/src/ui/converters/createPenpotRectangle.ts index 54b0a38..f7b07bb 100644 --- a/src/ui/converters/createPenpotRectangle.ts +++ b/src/ui/converters/createPenpotRectangle.ts @@ -8,6 +8,7 @@ export const createPenpotRectangle = ( baseY: number ) => { file.penpotFile.createRect({ + type: Symbol.for('rect'), name: node.name, x: node.x + baseX, y: node.y + baseY, diff --git a/src/ui/lib/penpot.d.ts b/src/ui/lib/penpot.d.ts index 2e8cb5c..8ab52a3 100644 --- a/src/ui/lib/penpot.d.ts +++ b/src/ui/lib/penpot.d.ts @@ -1,5 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { CircleShape } from './types/circle/circleShape'; +import { RectShape } from './types/rect/rectShape'; import { TextShape } from './types/text/textShape'; export interface PenpotFile { @@ -11,7 +12,7 @@ export interface PenpotFile { closeArtboard(): void; addGroup(group: any): void; closeGroup(): void; - createRect(rect: any): void; + createRect(rect: RectShape): void; createCircle(circle: CircleShape): void; createText(options: TextShape): void; createImage(image: any): void; diff --git a/src/ui/lib/types/circle/circleAttributes.d.ts b/src/ui/lib/types/circle/circleAttributes.d.ts index dad0c53..631f3f9 100644 --- a/src/ui/lib/types/circle/circleAttributes.d.ts +++ b/src/ui/lib/types/circle/circleAttributes.d.ts @@ -1,4 +1,5 @@ export type CircleAttributes = { - id?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + id?: any; type: symbol; }; diff --git a/src/ui/lib/types/rect/rectAttributes.d.ts b/src/ui/lib/types/rect/rectAttributes.d.ts new file mode 100644 index 0000000..4faf327 --- /dev/null +++ b/src/ui/lib/types/rect/rectAttributes.d.ts @@ -0,0 +1,5 @@ +export type RectAttributes = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + id?: any; + type: symbol; +}; diff --git a/src/ui/lib/types/rect/rectShape.d.ts b/src/ui/lib/types/rect/rectShape.d.ts new file mode 100644 index 0000000..add4eb6 --- /dev/null +++ b/src/ui/lib/types/rect/rectShape.d.ts @@ -0,0 +1,4 @@ +import { Shape } from '../shape'; +import { RectAttributes } from './rectAttributes'; + +export type RectShape = Shape & RectAttributes;