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

fix(parser): removed useless IdData type

This commit is contained in:
María Valderrama 2024-03-04 11:05:55 +01:00
parent 3d45bb88f6
commit 1536d78fd6
3 changed files with 12 additions and 17 deletions

View file

@ -18,7 +18,7 @@ import { parse, ParsedFile } from 'plugins-parser';
[...]
const parsedFile: ParsedFile = parse(file);
console.log(parsedFile.data.colors?.[0]?.data?.color);
console.log(parsedFile.data.colors?.[0]?.color);
[...]
```

View file

@ -7,14 +7,14 @@ export interface ParsedData {
export interface Data {
id: string;
version: number;
colors?: IdData<Color>[];
typographies?: IdData<Typhography>[];
colors?: Color[];
typographies?: Typhography[];
pages?: RootTail<unknown, string[]>; // Tail is an array of uuid (string)
pagesIndex?: IdData<PageIndex>[];
components?: IdData<Components>[];
media?: IdData<Media>[];
options?: IdData<Option>[];
objects?: IdData<ObjectI>[];
pagesIndex?: PageIndex[];
components?: Components[];
media?: Media[];
options?: Option[];
objects?: ObjectI[];
name?: string;
}
@ -44,9 +44,9 @@ export interface Typhography {
}
export interface PageIndex {
options: IdData<Option>[];
options: Option[];
name: string;
objects: IdData<ObjectI>[];
objects: ObjectI[];
}
export interface Option {
@ -61,7 +61,7 @@ export interface Components {
id: string;
name: string;
path: string;
objects: IdData<ObjectI>[];
objects: ObjectI[];
}
export interface ObjectI {
@ -123,8 +123,3 @@ export interface RootTail<R, T> {
root: R;
tail: T;
}
export interface IdData<T> {
id: string;
data: T;
}

View file

@ -94,7 +94,7 @@ function arrToArray(arr: unknown[]): unknown[] {
? arrToArray((next as Arr).arr)
: [...(next as Arr).arr];
return [...result, { id: (value as Uuid).uuid, data: parsedArr }];
return [...result, { ...parsedArr }];
}
}
return [...result];