-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtypes.ts
105 lines (88 loc) · 1.97 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import type { AtlasError } from './errors'
export const LOCAL_THEME_ID = '__local__'
// Everything before the first slash
export type DisplayThemeName = string
// Everything after the first slash
export type DisplayStyleName = string
// Name of the map as the user has typed it
export type DisplayMapName = string
// Trimmed and with spaces replaced
export type IdThemeName = string
// Trimmed and with spaces replaced
export type IdStyleName = string
// Trimmed and with spaces replaced
export type IdMapName = string
export enum StyleType {
Fill = 'fill',
Text = 'text',
Stroke = 'stroke',
Effect = 'effect',
}
export interface Message {
type: string
id: number
payload?: any
}
export interface Theme {
displayName: DisplayThemeName
idName: IdThemeName
group?: string
color: string
}
export interface MappedTheme extends Theme {
mapName: DisplayMapName
mapId: IdMapName
local: boolean
}
export interface ThemedNodes {
theme: Theme
mapId: IdMapName
nodes: (ThemedNode | RangedThemedNode)[]
}
export interface ThemedNode {
type: StyleType
idStyleName: IdStyleName
node: SceneNode
}
export interface RangedThemedNode extends ThemedNode {
from: number
to: number
}
export interface BasicFigmaStyle {
id: string
key: string
type: string
}
export interface ThemeStyles {
[key: string]: BasicFigmaStyle
}
export interface ExternalAtlasMap {
mapName: DisplayMapName
lastUpdatedISO: string
themes: Theme[]
arrayMap: [string, ThemeStyles][]
}
export interface AtlasMap {
mapName: DisplayMapName
mapId: IdMapName
lastUpdated: Date
themes: Theme[]
styleMap: Map<IdStyleName, ThemeStyles>
}
export interface Result<Type> {
error?: AtlasError
data?: Type
}
export interface TypedThemeResult {
type: StyleType
themeResult: ThemeSearchResult
}
export interface RangedTypedThemeResult extends TypedThemeResult {
from: number
to: number
}
export interface ThemeSearchResult {
theme: Theme
mapId: IdMapName
idStyleName: IdStyleName
}