0
Fork 0
mirror of https://github.com/penpot/penpot-plugins.git synced 2025-01-22 22:58:43 -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); 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 { export interface Data {
id: string; id: string;
version: number; version: number;
colors?: IdData<Color>[]; colors?: Color[];
typographies?: IdData<Typhography>[]; typographies?: Typhography[];
pages?: RootTail<unknown, string[]>; // Tail is an array of uuid (string) pages?: RootTail<unknown, string[]>; // Tail is an array of uuid (string)
pagesIndex?: IdData<PageIndex>[]; pagesIndex?: PageIndex[];
components?: IdData<Components>[]; components?: Components[];
media?: IdData<Media>[]; media?: Media[];
options?: IdData<Option>[]; options?: Option[];
objects?: IdData<ObjectI>[]; objects?: ObjectI[];
name?: string; name?: string;
} }
@ -44,9 +44,9 @@ export interface Typhography {
} }
export interface PageIndex { export interface PageIndex {
options: IdData<Option>[]; options: Option[];
name: string; name: string;
objects: IdData<ObjectI>[]; objects: ObjectI[];
} }
export interface Option { export interface Option {
@ -61,7 +61,7 @@ export interface Components {
id: string; id: string;
name: string; name: string;
path: string; path: string;
objects: IdData<ObjectI>[]; objects: ObjectI[];
} }
export interface ObjectI { export interface ObjectI {
@ -123,8 +123,3 @@ export interface RootTail<R, T> {
root: R; root: R;
tail: T; 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) ? arrToArray((next as Arr).arr)
: [...(next as Arr).arr]; : [...(next as Arr).arr];
return [...result, { id: (value as Uuid).uuid, data: parsedArr }]; return [...result, { ...parsedArr }];
} }
} }
return [...result]; return [...result];