-
Notifications
You must be signed in to change notification settings - Fork 476
Expand file tree
/
Copy pathaltMixins.ts
More file actions
187 lines (156 loc) · 4.67 KB
/
altMixins.ts
File metadata and controls
187 lines (156 loc) · 4.67 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
// ALTSCENENODE
export type AltSceneNode =
| AltFrameNode
| AltGroupNode
| AltRectangleNode
| AltEllipseNode
| AltTextNode;
export interface AltGeometryMixin {
fills: ReadonlyArray<Paint> | PluginAPI["mixed"];
strokes: ReadonlyArray<Paint>;
strokeWeight: number;
strokeMiterLimit: number;
strokeAlign: "CENTER" | "INSIDE" | "OUTSIDE";
strokeCap: StrokeCap | PluginAPI["mixed"];
strokeJoin: StrokeJoin | PluginAPI["mixed"];
dashPattern?: ReadonlyArray<number>;
fillStyleId: string | PluginAPI["mixed"];
strokeStyleId: string;
}
export interface AltCornerMixin {
cornerRadius: number | PluginAPI["mixed"];
cornerSmoothing: number;
}
export interface AltRectangleCornerMixin {
topLeftRadius: number;
topRightRadius: number;
bottomLeftRadius: number;
bottomRightRadius: number;
}
export interface AltBlendMixin {
opacity: number;
blendMode: "PASS_THROUGH" | BlendMode;
isMask: boolean;
effects: ReadonlyArray<Effect>;
effectStyleId: string;
visible: boolean;
}
export interface AltLayoutMixin {
x: number;
y: number;
rotation: number; // In degrees
width: number;
height: number;
layoutAlign: "MIN" | "CENTER" | "MAX" | "STRETCH" | "INHERIT"; // applicable only inside auto-layout frames
layoutGrow: number;
}
export interface AltFrameMixin {
layoutMode: "NONE" | "HORIZONTAL" | "VERTICAL";
primaryAxisSizingMode: "FIXED" | "AUTO"; // applicable only if layoutMode != "NONE"
counterAxisSizingMode: "FIXED" | "AUTO"; // applicable only if layoutMode != "NONE"
primaryAxisAlignItems: "MIN" | "MAX" | "CENTER" | "SPACE_BETWEEN"; // applicable only if layoutMode != "NONE"
counterAxisAlignItems: "MIN" | "MAX" | "CENTER"; // applicable only if layoutMode != "NONE"
paddingLeft: number; // applicable only if layoutMode != "NONE"
paddingRight: number; // applicable only if layoutMode != "NONE"
paddingTop: number; // applicable only if layoutMode != "NONE"
paddingBottom: number; // applicable only if layoutMode != "NONE"
itemSpacing: number; // applicable only if layoutMode != "NONE"
layoutGrids: ReadonlyArray<LayoutGrid>;
gridStyleId: string;
clipsContent: boolean;
guides: ReadonlyArray<Guide>;
}
export class AltRectangleNode {
readonly type = "RECTANGLE";
}
export class AltEllipseNode {
readonly type = "ELLIPSE";
}
export class AltFrameNode {
readonly type = "FRAME";
}
export class AltGroupNode {
readonly type = "GROUP";
}
export class AltTextNode {
readonly type = "TEXT";
}
export interface AltDefaultShapeMixin
extends AltBaseNodeMixin,
AltBlendMixin,
AltGeometryMixin,
AltRectangleCornerMixin,
AltCornerMixin,
AltLayoutMixin {}
export interface AltRectangleNode
extends AltDefaultShapeMixin,
AltCornerMixin,
AltRectangleCornerMixin {}
export interface AltEllipseNode extends AltDefaultShapeMixin, AltCornerMixin {}
export interface AltFrameNode
extends AltFrameMixin,
AltBaseNodeMixin,
AltChildrenMixin,
AltGeometryMixin,
AltCornerMixin,
AltRectangleCornerMixin,
AltBlendMixin,
AltLayoutMixin {}
export interface AltGroupNode
extends AltBaseNodeMixin,
AltChildrenMixin,
AltBlendMixin,
AltLayoutMixin {}
// DOCUMENT
interface AltDocumentNode extends AltBaseNodeMixin, AltChildrenMixin {}
// PAGE
interface AltPageNode extends AltBaseNodeMixin, AltChildrenMixin {}
interface AltTextMixin {
characters: string;
textAutoResize: "NONE" | "WIDTH_AND_HEIGHT" | "HEIGHT";
textAlignHorizontal: "LEFT" | "CENTER" | "RIGHT" | "JUSTIFIED";
textAlignVertical: "TOP" | "CENTER" | "BOTTOM";
paragraphIndent: number;
paragraphSpacing: number;
fontSize: number | PluginAPI["mixed"];
fontName: FontName | PluginAPI["mixed"];
textCase: TextCase | PluginAPI["mixed"];
textDecoration: TextDecoration | PluginAPI["mixed"];
letterSpacing: LetterSpacing | PluginAPI["mixed"];
lineHeight: LineHeight | PluginAPI["mixed"];
}
export interface AltTextNode
extends AltTextMixin,
AltDefaultShapeMixin,
AltBaseNodeMixin,
AltLayoutMixin {}
export interface AltBaseNodeMixin {
id: string;
parent: (AltSceneNode & AltChildrenMixin) | null;
name: string;
pluginData: { [key: string]: string };
// setPluginData(key: string, value: string): void;
// getPluginData(key: string): string;
// remove(): void;
}
export interface AltChildrenMixin {
children: Array<AltSceneNode>;
isRelative?: boolean;
}
// // DOCUMENT
// class AltDocumentNode {
// type = "DOCUMENT";
// children = [];
// }
// // PAGE
// class AltPageNode {
// type = "PAGE";
// children = [];
// _selection: Array<SceneNode> = [];
// get selection() {
// return this._selection || [];
// }
// set selection(value) {
// this._selection = value;
// }
// }