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 = { export type FrameAttributes = {
id?: Uuid; id?: Uuid;
type: symbol; type: symbol;
// eslint-disable-next-line @typescript-eslint/no-explicit-any shapes?: Uuid[];
shapes?: any[];
fileThumbnail?: boolean; fileThumbnail?: boolean;
hideFillOnExport?: boolean; hideFillOnExport?: boolean;
showContent?: boolean; showContent?: boolean;

View file

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

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 { Point } from './utils/point';
import { Selrect } from './utils/selrect'; import { Selrect } from './utils/selrect';
import { Stroke } from './utils/stroke';
export type Shape = { export type Shape = {
name?: string; name?: string;
@ -14,8 +19,7 @@ export type Shape = {
locked?: boolean; locked?: boolean;
hidden?: boolean; hidden?: boolean;
maskedGroup?: boolean; maskedGroup?: boolean;
// eslint-disable-next-line @typescript-eslint/no-explicit-any fills?: Fill[];
fills?: any;
hideFillOnExport?: boolean; hideFillOnExport?: boolean;
proportion?: number; proportion?: number;
proportionLock?: boolean; proportionLock?: boolean;
@ -33,16 +37,11 @@ export type Shape = {
width?: number; width?: number;
height?: number; height?: number;
opacity?: number; opacity?: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any grids?: Grid[];
grids?: any; exports?: Export[];
// eslint-disable-next-line @typescript-eslint/no-explicit-any strokes?: Stroke[];
exports?: any; transform?: Matrix;
// eslint-disable-next-line @typescript-eslint/no-explicit-any transformInverse?: Matrix;
strokes?: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
transform?: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
transformInverse?: any;
blendMode?: string; blendMode?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
interactions?: 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 { Gradient } from './gradient';
import { Uuid } from './uuid';
type Fill = { type Fill = {
fillColor?: string; fillColor?: string;
fillOpacity?: number; fillOpacity?: number;
fillColorGradient?: Gradient; fillColorGradient?: Gradient;
// eslint-disable-next-line @typescript-eslint/no-explicit-any fillColorRefFile?: Uuid;
fillColorRefFile?: any; fillColorRefId?: Uuid;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
fillColorRefId?: any;
}; };

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;