0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-03 05:10:13 -05:00

keep adding types

This commit is contained in:
Jordi Sala Morales 2024-04-10 15:47:42 +00:00
parent 9c00a03f7d
commit 4b438e3c9b
No known key found for this signature in database
GPG key ID: C5127140107F55FD
8 changed files with 96 additions and 20 deletions

View file

@ -3,8 +3,7 @@ import { Uuid } from '../utils/uuid';
export type FrameAttributes = {
id?: Uuid;
type: symbol;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
shapes?: any[];
shapes?: Uuid[];
fileThumbnail?: boolean;
hideFillOnExport?: boolean;
showContent?: boolean;

View file

@ -3,6 +3,5 @@ import { Uuid } from '../utils/uuid';
export type GroupAttributes = {
id?: Uuid;
type: symbol;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
shapes?: any[];
shapes?: Uuid[];
};

View file

@ -1,5 +1,10 @@
import { Export } from './utils/export';
import { Fill } from './utils/fill';
import { Grid } from './utils/grid';
import { Matrix } from './utils/matrix';
import { Point } from './utils/point';
import { Selrect } from './utils/selrect';
import { Stroke } from './utils/stroke';
export type Shape = {
name?: string;
@ -14,8 +19,7 @@ export type Shape = {
locked?: boolean;
hidden?: boolean;
maskedGroup?: boolean;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
fills?: any;
fills?: Fill[];
hideFillOnExport?: boolean;
proportion?: number;
proportionLock?: boolean;
@ -33,16 +37,11 @@ export type Shape = {
width?: number;
height?: number;
opacity?: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
grids?: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
exports?: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
strokes?: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
transform?: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
transformInverse?: any;
grids?: Grid[];
exports?: Export[];
strokes?: Stroke[];
transform?: Matrix;
transformInverse?: Matrix;
blendMode?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
interactions?: any;

7
src/ui/lib/types/utils/export.d.ts vendored Normal file
View file

@ -0,0 +1,7 @@
export type Export = {
// @TODO: in Penpot this is of type :keyword
// check if it makes sense
type: string;
scale: number;
suffix: string;
};

View file

@ -1,11 +1,10 @@
import { Gradient } from './gradient';
import { Uuid } from './uuid';
type Fill = {
fillColor?: string;
fillOpacity?: number;
fillColorGradient?: Gradient;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
fillColorRefFile?: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
fillColorRefId?: any;
fillColorRefFile?: Uuid;
fillColorRefId?: Uuid;
};

39
src/ui/lib/types/utils/grid.d.ts vendored Normal file
View file

@ -0,0 +1,39 @@
export type Grid = ColumnGrid | RowGrid | SquareGrid;
type ColumnGrid = {
type: 'column';
display: boolean;
params: ColumnParams;
};
type RowGrid = {
type: 'column';
display: boolean;
params: ColumnParams;
};
type SquareGrid = {
type: 'square';
display: boolean;
params: SquareParams;
};
type ColumnParams = {
color: GridColor;
type?: 'stretch' | 'left' | 'center' | 'right';
size?: number;
margin?: number;
itemLength?: number;
gutter?: number;
};
type SquareParams = {
size: number;
color: GridColor;
};
type GridColor = {
// @TODO: Maybe we need a proper type here
color: number;
opacity: number;
};

8
src/ui/lib/types/utils/matrix.d.ts vendored Normal file
View file

@ -0,0 +1,8 @@
export type Matrix = {
a: number;
b: number;
c: number;
d: number;
e: number;
f: number;
};

26
src/ui/lib/types/utils/stroke.d.ts vendored Normal file
View file

@ -0,0 +1,26 @@
import { Gradient } from './gradient';
import { Uuid } from './uuid';
export type Stroke = {
strokeColor?: string;
strokeColorRefFile?: Uuid;
strokeColorRefId?: Uuid;
strokeOpacity?: number;
strokeStyle?: 'solid' | 'dotted' | 'dashed' | 'mixed' | 'none' | 'svg';
strokeWidth?: number;
strokeAlignment?: 'center' | 'inner' | 'outer';
strokeCapStart?: 'butt' | 'round' | 'square';
strokeCapStart: StrokeCaps;
strokeCapEnd?: StrokeCaps;
strokeColorGradient: Gradient;
};
type StrokeCapLine = 'round' | 'square';
type StrokeCapMarker =
| 'line-arrow'
| 'triangle-arrow'
| 'square-marker'
| 'circle-marker'
| 'diamond-marker';
type StrokeCaps = StrokeCapLine | StrokeCapMarker;