0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-02-01 20:28:47 -05:00

improve types

This commit is contained in:
Jordi Sala Morales 2024-04-15 11:31:32 +00:00
parent 4724c97441
commit 1b29448831
No known key found for this signature in database
GPG key ID: C5127140107F55FD
8 changed files with 9 additions and 20 deletions

View file

@ -5,7 +5,6 @@ import { BoolContent } from './boolContent';
export const BOOL_TYPE: unique symbol = Symbol.for('bool'); export const BOOL_TYPE: unique symbol = Symbol.for('bool');
export type BoolAttributes = { export type BoolAttributes = {
id?: Uuid;
type: 'bool' | typeof BOOL_TYPE; type: 'bool' | typeof BOOL_TYPE;
shapes?: Uuid[]; shapes?: Uuid[];
boolType: string; // @TODO: in Penpot this is of type :keyword. check if it makes sense boolType: string; // @TODO: in Penpot this is of type :keyword. check if it makes sense

View file

@ -1,8 +1,5 @@
import { Uuid } from '@ui/lib/types/utils/uuid';
export const CIRCLE_TYPE: unique symbol = Symbol.for('circle'); export const CIRCLE_TYPE: unique symbol = Symbol.for('circle');
export type CircleAttributes = { export type CircleAttributes = {
type: 'circle' | typeof CIRCLE_TYPE; type: 'circle' | typeof CIRCLE_TYPE;
id?: Uuid;
}; };

View file

@ -4,7 +4,6 @@ export const FRAME_TYPE: unique symbol = Symbol.for('frame');
export type FrameAttributes = { export type FrameAttributes = {
type: 'frame' | typeof FRAME_TYPE; type: 'frame' | typeof FRAME_TYPE;
id?: Uuid;
shapes?: Uuid[]; shapes?: Uuid[];
fileThumbnail?: boolean; fileThumbnail?: boolean;
hideFillOnExport?: boolean; hideFillOnExport?: boolean;

View file

@ -4,6 +4,5 @@ export const GROUP_TYPE: unique symbol = Symbol.for('group');
export type GroupAttributes = { export type GroupAttributes = {
type: 'group' | typeof GROUP_TYPE; type: 'group' | typeof GROUP_TYPE;
id?: Uuid;
shapes?: Uuid[]; shapes?: Uuid[];
}; };

View file

@ -3,7 +3,6 @@ import { Uuid } from '@ui/lib/types/utils/uuid';
export const IMAGE_TYPE: unique symbol = Symbol.for('image'); export const IMAGE_TYPE: unique symbol = Symbol.for('image');
export type ImageAttributes = { export type ImageAttributes = {
id?: Uuid;
type: 'image' | typeof IMAGE_TYPE; type: 'image' | typeof IMAGE_TYPE;
dataUri?: string; dataUri?: string;
metadata: { metadata: {

View file

@ -1,8 +1,5 @@
import { Uuid } from '@ui/lib/types/utils/uuid';
export const RECT_TYPE: unique symbol = Symbol.for('rect'); export const RECT_TYPE: unique symbol = Symbol.for('rect');
export type RectAttributes = { export type RectAttributes = {
type: 'rect' | typeof RECT_TYPE; type: 'rect' | typeof RECT_TYPE;
id?: Uuid;
}; };

View file

@ -3,15 +3,17 @@ import { Point } from '@ui/lib/types/utils/point';
import { Selrect } from '@ui/lib/types/utils/selrect'; import { Selrect } from '@ui/lib/types/utils/selrect';
import { Uuid } from '@ui/lib/types/utils/uuid'; import { Uuid } from '@ui/lib/types/utils/uuid';
export const FRAME_TYPE: unique symbol = Symbol.for('frame'); import { BOOL_TYPE } from '../bool/boolAttributes';
export const GROUP_TYPE: unique symbol = Symbol.for('group'); import { CIRCLE_TYPE } from '../circle/circleAttributes';
export const BOOL_TYPE: unique symbol = Symbol.for('bool'); import { FRAME_TYPE } from '../frame/frameAttributes';
export const RECT_TYPE: unique symbol = Symbol.for('rect'); import { GROUP_TYPE } from '../group/groupAttributes';
import { IMAGE_TYPE } from '../image/imageAttributes';
import { RECT_TYPE } from '../rect/rectAttributes';
import { TEXT_TYPE } from '../text/textAttributes';
// @TODO: Move to its own file once we support all the shapes
export const PATH_TYPE: unique symbol = Symbol.for('path'); export const PATH_TYPE: unique symbol = Symbol.for('path');
export const TEXT_TYPE: unique symbol = Symbol.for('text');
export const CIRCLE_TYPE: unique symbol = Symbol.for('circle');
export const SVG_RAW_TYPE: unique symbol = Symbol.for('svg-raw'); export const SVG_RAW_TYPE: unique symbol = Symbol.for('svg-raw');
export const IMAGE_TYPE: unique symbol = Symbol.for('image');
export type ShapeBaseAttributes = { export type ShapeBaseAttributes = {
id?: Uuid; id?: Uuid;

View file

@ -1,11 +1,8 @@
import { Uuid } from '@ui/lib/types/utils/uuid';
import { TextContent } from './textContent'; import { TextContent } from './textContent';
export const TEXT_TYPE: unique symbol = Symbol.for('text'); export const TEXT_TYPE: unique symbol = Symbol.for('text');
export type TextAttributes = { export type TextAttributes = {
id?: Uuid;
type: 'text' | typeof TEXT_TYPE; type: 'text' | typeof TEXT_TYPE;
content?: TextContent; content?: TextContent;
}; };