@open-pencil/scene-graph 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arrow-caps.d.ts +44 -0
- package/dist/arrow-caps.d.ts.map +1 -0
- package/dist/arrow-caps.js +131 -0
- package/dist/arrow-caps.js.map +1 -0
- package/dist/chunks/checkpoint.js +78 -0
- package/dist/chunks/checkpoint.js.map +1 -0
- package/dist/chunks/components/properties.js +1571 -0
- package/dist/chunks/components/properties.js.map +1 -0
- package/dist/chunks/coordinate.js +87 -33
- package/dist/chunks/coordinate.js.map +1 -1
- package/dist/chunks/font-style.js +2 -1
- package/dist/chunks/font-style.js.map +1 -1
- package/dist/chunks/index.js +1283 -0
- package/dist/chunks/index.js.map +1 -0
- package/dist/constants.js +1 -18
- package/dist/constants2.d.ts +0 -1
- package/dist/constants2.d.ts.map +1 -1
- package/dist/coordinate.d.ts +107 -11
- package/dist/coordinate.d.ts.map +1 -1
- package/dist/coordinate.js +2 -2
- package/dist/coordinate2.d.ts +2 -2
- package/dist/copy.d.ts +2 -2
- package/dist/copy.js +2 -2
- package/dist/geometry.d.ts +2 -2
- package/dist/geometry.js +2 -431
- package/dist/guides.d.ts +2 -0
- package/dist/guides.js +0 -0
- package/dist/guides2.d.ts +11 -0
- package/dist/guides2.d.ts.map +1 -0
- package/dist/hit-test.d.ts +1 -2
- package/dist/hit-test.d.ts.map +1 -1
- package/dist/hit-test.js +26 -14
- package/dist/hit-test.js.map +1 -1
- package/dist/images.js +0 -1
- package/dist/images.js.map +1 -1
- package/dist/images2.d.ts.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +5 -6
- package/dist/instances.d.ts +2 -2
- package/dist/instances.js +2 -2
- package/dist/layout-guides.d.ts +2 -0
- package/dist/layout-guides.js +2 -0
- package/dist/layout-guides2.d.ts +16 -0
- package/dist/layout-guides2.d.ts.map +1 -0
- package/dist/matrix2.d.ts +0 -1
- package/dist/matrix2.d.ts.map +1 -1
- package/dist/node-defaults.d.ts +1 -2
- package/dist/node-defaults.d.ts.map +1 -1
- package/dist/node-defaults.js +1 -1
- package/dist/parse-path.d.ts +1 -2
- package/dist/parse-path.d.ts.map +1 -1
- package/dist/parse-path.js.map +1 -1
- package/dist/preview.d.ts +2 -12
- package/dist/preview.js +1 -1
- package/dist/preview2.d.ts +12 -0
- package/dist/preview2.d.ts.map +1 -0
- package/dist/primitives2.d.ts.map +1 -1
- package/dist/resize.d.ts +18 -4
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +70 -22
- package/dist/resize.js.map +1 -1
- package/dist/snap.js +1 -1
- package/dist/source-metadata.d.ts +1 -2
- package/dist/source-metadata.d.ts.map +1 -1
- package/dist/source-metadata.js +1 -1
- package/dist/text-picture.d.ts +13 -2
- package/dist/text-picture.d.ts.map +1 -1
- package/dist/text-picture.js +2 -2
- package/dist/types.d.ts +499 -2
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -1296
- package/dist/types2.d.ts +2 -430
- package/dist/undo.js +1 -1
- package/dist/undo2.d.ts +5 -0
- package/dist/undo2.d.ts.map +1 -1
- package/dist/variables.d.ts +1 -2
- package/dist/variables.d.ts.map +1 -1
- package/dist/variables.js +1 -1
- package/dist/variant-name.d.ts.map +1 -1
- package/dist/variant-properties.d.ts +10 -0
- package/dist/variant-properties.d.ts.map +1 -0
- package/dist/variant-properties.js +39 -0
- package/dist/variant-properties.js.map +1 -0
- package/dist/vector-network.js +1 -1
- package/dist/vector-network2.d.ts +1 -2
- package/dist/vector-network2.d.ts.map +1 -1
- package/package.json +40 -15
- package/src/arrow-caps.ts +146 -0
- package/src/bindings.ts +20 -0
- package/src/checkpoint.ts +123 -0
- package/src/components/properties.ts +238 -0
- package/src/constants.ts +6 -0
- package/src/coordinate.ts +226 -0
- package/src/copy.ts +294 -0
- package/src/events.ts +21 -0
- package/src/export-scale.ts +16 -0
- package/src/font-style.ts +77 -0
- package/src/geometry.ts +530 -0
- package/src/guides.ts +8 -0
- package/src/hit-test.ts +205 -0
- package/src/images.ts +34 -0
- package/src/index.ts +686 -0
- package/src/instance-overrides.test.ts +67 -0
- package/src/instance-overrides.ts +152 -0
- package/src/instances.ts +480 -0
- package/src/layout-guides.ts +103 -0
- package/src/matrix.ts +116 -0
- package/src/mutation-impact.ts +70 -0
- package/src/node-defaults.ts +186 -0
- package/src/parse-path.ts +191 -0
- package/src/preview.ts +80 -0
- package/src/primitives.ts +42 -0
- package/src/resize.ts +302 -0
- package/src/shared-styles.ts +73 -0
- package/src/snap.ts +129 -0
- package/src/source-metadata.ts +8 -0
- package/src/text-picture.ts +65 -0
- package/src/types.ts +635 -0
- package/src/undo.ts +171 -0
- package/src/variables.ts +399 -0
- package/src/variant-name.ts +15 -0
- package/src/variant-properties.ts +48 -0
- package/src/vector-network.ts +293 -0
- package/dist/chunks/copy.js +0 -576
- package/dist/chunks/copy.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/geometry.js.map +0 -1
- package/dist/preview.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/types2.d.ts.map +0 -1
package/src/types.ts
ADDED
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
/* eslint-disable max-lines -- scene node contracts are kept together as the public graph type surface */
|
|
2
|
+
|
|
3
|
+
import type { CanvasGuide } from './guides'
|
|
4
|
+
import type { InstanceOverrideState } from './instance-overrides'
|
|
5
|
+
import type { Color, Matrix, Rect, Vector } from './primitives'
|
|
6
|
+
|
|
7
|
+
export interface SceneGraphEvents {
|
|
8
|
+
'node:created': (node: SceneNode) => void
|
|
9
|
+
'node:updated': (id: string, changes: Partial<SceneNode>) => void
|
|
10
|
+
'node:previewUpdated': (id: string, changes: Partial<SceneNode>) => void
|
|
11
|
+
'node:deleted': (id: string, parentId: string | null) => void
|
|
12
|
+
'node:reparented': (nodeId: string, oldParentId: string | null, newParentId: string) => void
|
|
13
|
+
'node:reordered': (
|
|
14
|
+
nodeId: string,
|
|
15
|
+
parentId: string,
|
|
16
|
+
index: number,
|
|
17
|
+
previousParentId: string | null
|
|
18
|
+
) => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type SceneGraphEventHandlers = Partial<{
|
|
22
|
+
created: (node: SceneNode) => void
|
|
23
|
+
updated: (id: string, changes: Partial<SceneNode>) => void
|
|
24
|
+
previewUpdated: (id: string, changes: Partial<SceneNode>) => void
|
|
25
|
+
deleted: (id: string, parentId: string | null) => void
|
|
26
|
+
reparented: (nodeId: string, oldParentId: string | null, newParentId: string) => void
|
|
27
|
+
reordered: (
|
|
28
|
+
nodeId: string,
|
|
29
|
+
parentId: string,
|
|
30
|
+
index: number,
|
|
31
|
+
previousParentId: string | null
|
|
32
|
+
) => void
|
|
33
|
+
}>
|
|
34
|
+
|
|
35
|
+
export type DocumentColorSpace = 'srgb' | 'display-p3'
|
|
36
|
+
|
|
37
|
+
export interface FigmaSourcePayload {
|
|
38
|
+
rawSize: Vector | null
|
|
39
|
+
rawTransform: Matrix | null
|
|
40
|
+
rawNodeFields: Record<string, unknown>
|
|
41
|
+
layout: FigmaLayoutMetadata | null
|
|
42
|
+
symbolOverrides: unknown[]
|
|
43
|
+
componentPropAssignments: unknown[]
|
|
44
|
+
derivedSymbolData: unknown[]
|
|
45
|
+
derivedSymbolDataLayoutVersion: number | null
|
|
46
|
+
uniformScaleFactor: number | null
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface SourceMetadata {
|
|
50
|
+
format: 'fig' | null
|
|
51
|
+
id: string | null
|
|
52
|
+
orderKey: string | null
|
|
53
|
+
editedFields: string[]
|
|
54
|
+
fig: FigmaSourcePayload
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type HandleMirroring = 'NONE' | 'ANGLE' | 'ANGLE_AND_LENGTH'
|
|
58
|
+
export type WindingRule = 'NONZERO' | 'EVENODD'
|
|
59
|
+
|
|
60
|
+
export interface VectorVertex {
|
|
61
|
+
x: number
|
|
62
|
+
y: number
|
|
63
|
+
strokeCap?: string
|
|
64
|
+
strokeJoin?: string
|
|
65
|
+
cornerRadius?: number
|
|
66
|
+
handleMirroring?: HandleMirroring
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface VectorSegment {
|
|
70
|
+
start: number
|
|
71
|
+
end: number
|
|
72
|
+
tangentStart: Vector
|
|
73
|
+
tangentEnd: Vector
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface VectorRegion {
|
|
77
|
+
windingRule: WindingRule
|
|
78
|
+
loops: number[][]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface VectorNetwork {
|
|
82
|
+
vertices: VectorVertex[]
|
|
83
|
+
segments: VectorSegment[]
|
|
84
|
+
regions: VectorRegion[]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface GeometryPath {
|
|
88
|
+
windingRule: WindingRule
|
|
89
|
+
commandsBlob: Uint8Array
|
|
90
|
+
/** Resolved paints for geometry using a format-specific style override. */
|
|
91
|
+
fills?: Fill[]
|
|
92
|
+
/** Shared fill style attached to this geometry region, when available. */
|
|
93
|
+
fillStyleId?: string
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type NodeType =
|
|
97
|
+
| 'CANVAS'
|
|
98
|
+
| 'FRAME'
|
|
99
|
+
| 'RECTANGLE'
|
|
100
|
+
| 'ROUNDED_RECTANGLE'
|
|
101
|
+
| 'ELLIPSE'
|
|
102
|
+
| 'TEXT'
|
|
103
|
+
| 'LINE'
|
|
104
|
+
| 'STAR'
|
|
105
|
+
| 'POLYGON'
|
|
106
|
+
| 'VECTOR'
|
|
107
|
+
| 'BOOLEAN_OPERATION'
|
|
108
|
+
| 'GROUP'
|
|
109
|
+
| 'SECTION'
|
|
110
|
+
| 'COMPONENT'
|
|
111
|
+
| 'COMPONENT_SET'
|
|
112
|
+
| 'INSTANCE'
|
|
113
|
+
| 'CONNECTOR'
|
|
114
|
+
| 'SHAPE_WITH_TEXT'
|
|
115
|
+
|
|
116
|
+
export type FillType =
|
|
117
|
+
| 'SOLID'
|
|
118
|
+
| 'GRADIENT_LINEAR'
|
|
119
|
+
| 'GRADIENT_RADIAL'
|
|
120
|
+
| 'GRADIENT_ANGULAR'
|
|
121
|
+
| 'GRADIENT_DIAMOND'
|
|
122
|
+
| 'IMAGE'
|
|
123
|
+
| 'VIDEO'
|
|
124
|
+
| 'PATTERN'
|
|
125
|
+
| 'NOISE'
|
|
126
|
+
| 'CUSTOM'
|
|
127
|
+
export type BlendMode =
|
|
128
|
+
| 'NORMAL'
|
|
129
|
+
| 'DARKEN'
|
|
130
|
+
| 'MULTIPLY'
|
|
131
|
+
| 'COLOR_BURN'
|
|
132
|
+
| 'LIGHTEN'
|
|
133
|
+
| 'SCREEN'
|
|
134
|
+
| 'COLOR_DODGE'
|
|
135
|
+
| 'OVERLAY'
|
|
136
|
+
| 'SOFT_LIGHT'
|
|
137
|
+
| 'HARD_LIGHT'
|
|
138
|
+
| 'DIFFERENCE'
|
|
139
|
+
| 'EXCLUSION'
|
|
140
|
+
| 'HUE'
|
|
141
|
+
| 'SATURATION'
|
|
142
|
+
| 'COLOR'
|
|
143
|
+
| 'LUMINOSITY'
|
|
144
|
+
| 'PASS_THROUGH'
|
|
145
|
+
export type ImageScaleMode = 'FILL' | 'FIT' | 'CROP' | 'TILE'
|
|
146
|
+
export type NoiseType = 'MULTITONE' | 'MONOTONE' | 'DUOTONE'
|
|
147
|
+
export type PatternTileType = 'RECTANGULAR' | 'HORIZONTAL_HEXAGONAL' | 'VERTICAL_HEXAGONAL'
|
|
148
|
+
export type PatternAlignment = 'START' | 'CENTER' | 'END'
|
|
149
|
+
|
|
150
|
+
export interface GradientStop {
|
|
151
|
+
color: Color
|
|
152
|
+
position: number
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type GradientTransform = Matrix
|
|
156
|
+
|
|
157
|
+
export interface Fill {
|
|
158
|
+
type: FillType
|
|
159
|
+
color: Color
|
|
160
|
+
opacity: number
|
|
161
|
+
visible: boolean
|
|
162
|
+
blendMode?: BlendMode
|
|
163
|
+
gradientStops?: GradientStop[]
|
|
164
|
+
gradientTransform?: GradientTransform
|
|
165
|
+
imageHash?: string
|
|
166
|
+
imageScaleMode?: ImageScaleMode
|
|
167
|
+
imageTransform?: GradientTransform
|
|
168
|
+
sourceNodeId?: string
|
|
169
|
+
scale?: number
|
|
170
|
+
spacing?: number
|
|
171
|
+
patternSpacing?: Vector
|
|
172
|
+
patternTileType?: PatternTileType
|
|
173
|
+
verticalAlignment?: PatternAlignment
|
|
174
|
+
horizontalAlignment?: PatternAlignment
|
|
175
|
+
noiseType?: NoiseType
|
|
176
|
+
density?: number
|
|
177
|
+
noiseSize?: Vector
|
|
178
|
+
customEffectId?: string
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export type StrokeCap = 'NONE' | 'ROUND' | 'SQUARE' | 'ARROW_LINES' | 'ARROW_EQUILATERAL'
|
|
182
|
+
export type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND'
|
|
183
|
+
export type SharedStyleType = 'FILL' | 'TEXT' | 'EFFECT' | 'GRID'
|
|
184
|
+
export type SharedStyleKind = 'fill' | 'stroke' | 'text' | 'effect' | 'grid'
|
|
185
|
+
export type MaskType = 'ALPHA' | 'VECTOR' | 'LUMINANCE'
|
|
186
|
+
|
|
187
|
+
export interface LayoutGrid {
|
|
188
|
+
visible?: boolean
|
|
189
|
+
color?: Color
|
|
190
|
+
pattern?: 'COLUMNS' | 'ROWS' | 'GRID'
|
|
191
|
+
axis?: 'X' | 'Y'
|
|
192
|
+
type?: 'MIN' | 'CENTER' | 'MAX' | 'STRETCH'
|
|
193
|
+
alignment?: 'MIN' | 'CENTER' | 'MAX' | 'STRETCH'
|
|
194
|
+
numSections?: number
|
|
195
|
+
count?: number
|
|
196
|
+
offset?: number
|
|
197
|
+
sectionSize?: number
|
|
198
|
+
gutterSize?: number
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface SharedStyle {
|
|
202
|
+
id: string
|
|
203
|
+
nodeId: string
|
|
204
|
+
name: string
|
|
205
|
+
type: SharedStyleType
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface Stroke {
|
|
209
|
+
color: Color
|
|
210
|
+
weight: number
|
|
211
|
+
opacity: number
|
|
212
|
+
visible: boolean
|
|
213
|
+
align: 'INSIDE' | 'CENTER' | 'OUTSIDE'
|
|
214
|
+
cap?: StrokeCap
|
|
215
|
+
join?: StrokeJoin
|
|
216
|
+
dashPattern?: number[]
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface Effect {
|
|
220
|
+
type: 'DROP_SHADOW' | 'INNER_SHADOW' | 'LAYER_BLUR' | 'BACKGROUND_BLUR' | 'FOREGROUND_BLUR'
|
|
221
|
+
color: Color
|
|
222
|
+
offset: Vector
|
|
223
|
+
radius: number
|
|
224
|
+
spread: number
|
|
225
|
+
visible: boolean
|
|
226
|
+
blendMode?: BlendMode
|
|
227
|
+
showShadowBehindNode?: boolean
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export type ConstraintType = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'SCALE'
|
|
231
|
+
export type TextAutoResize = 'NONE' | 'HEIGHT' | 'WIDTH_AND_HEIGHT' | 'TRUNCATE'
|
|
232
|
+
export type TextAlignVertical = 'TOP' | 'CENTER' | 'BOTTOM'
|
|
233
|
+
export type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE'
|
|
234
|
+
export type TextDecoration = 'NONE' | 'UNDERLINE' | 'STRIKETHROUGH'
|
|
235
|
+
export type TextDecorationStyle = 'SOLID' | 'DOTTED' | 'WAVY'
|
|
236
|
+
export type LeadingTrim = 'NONE' | 'CAP_HEIGHT'
|
|
237
|
+
export type TextDirection = 'AUTO' | 'LTR' | 'RTL'
|
|
238
|
+
export type LayoutDirection = 'AUTO' | 'LTR' | 'RTL'
|
|
239
|
+
|
|
240
|
+
export interface FontVariation {
|
|
241
|
+
axis: string
|
|
242
|
+
value: number
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface FontFeature {
|
|
246
|
+
tag: string
|
|
247
|
+
enabled: boolean
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface CharacterStyleOverride {
|
|
251
|
+
fontWeight?: number
|
|
252
|
+
italic?: boolean
|
|
253
|
+
textDecoration?: TextDecoration
|
|
254
|
+
textDecorationStyle?: TextDecorationStyle
|
|
255
|
+
textDecorationThickness?: number | null
|
|
256
|
+
textDecorationFills?: Fill[]
|
|
257
|
+
textDecorationSkipInk?: boolean
|
|
258
|
+
textUnderlineOffset?: number | null
|
|
259
|
+
fontSize?: number
|
|
260
|
+
fontFamily?: string
|
|
261
|
+
letterSpacing?: number
|
|
262
|
+
lineHeight?: number | null
|
|
263
|
+
fills?: Fill[]
|
|
264
|
+
fontVariations?: FontVariation[]
|
|
265
|
+
fontFeatures?: FontFeature[]
|
|
266
|
+
textLanguage?: string | null
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface StyleRun {
|
|
270
|
+
start: number
|
|
271
|
+
length: number
|
|
272
|
+
style: CharacterStyleOverride
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface ArcData {
|
|
276
|
+
startingAngle: number
|
|
277
|
+
endingAngle: number
|
|
278
|
+
innerRadius: number
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export type LayoutMode = 'NONE' | 'HORIZONTAL' | 'VERTICAL' | 'GRID'
|
|
282
|
+
export type LayoutSizing = 'FIXED' | 'HUG' | 'FILL'
|
|
283
|
+
|
|
284
|
+
export type GridTrackSizing = 'FIXED' | 'FR' | 'AUTO'
|
|
285
|
+
|
|
286
|
+
export interface GridTrack {
|
|
287
|
+
sizing: GridTrackSizing
|
|
288
|
+
value: number
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export interface GridPosition {
|
|
292
|
+
column: number
|
|
293
|
+
row: number
|
|
294
|
+
columnSpan: number
|
|
295
|
+
rowSpan: number
|
|
296
|
+
}
|
|
297
|
+
export type LayoutAlign = 'MIN' | 'CENTER' | 'MAX' | 'SPACE_BETWEEN'
|
|
298
|
+
export type LayoutCounterAlign = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'BASELINE'
|
|
299
|
+
export type LayoutAlignSelf = 'AUTO' | 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'BASELINE'
|
|
300
|
+
export type LayoutWrap = 'NO_WRAP' | 'WRAP'
|
|
301
|
+
|
|
302
|
+
export interface PluginDataEntry {
|
|
303
|
+
pluginId: string
|
|
304
|
+
key: string
|
|
305
|
+
value: string
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export type ExportFormatId = 'png' | 'jpg' | 'webp' | 'svg' | 'pdf'
|
|
309
|
+
|
|
310
|
+
export interface ExportSetting {
|
|
311
|
+
scale: number
|
|
312
|
+
format: ExportFormatId
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export interface PluginRelaunchDataEntry {
|
|
316
|
+
pluginId: string
|
|
317
|
+
command: string
|
|
318
|
+
message: string
|
|
319
|
+
isDeleted: boolean
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* One derived glyph outline for display (path text / missing-font fidelity).
|
|
324
|
+
* Figma import is one producer; OpenPencil editing and reflow can regenerate it.
|
|
325
|
+
* commandsBlob is in font units; paint multiplies by fontSize (and scaleX/Y).
|
|
326
|
+
*/
|
|
327
|
+
export interface TextPathData {
|
|
328
|
+
network: VectorNetwork
|
|
329
|
+
normalizedSize: Vector
|
|
330
|
+
tValue: number
|
|
331
|
+
forward: boolean
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export interface DerivedTextGlyph {
|
|
335
|
+
commandsBlob: Uint8Array
|
|
336
|
+
x: number
|
|
337
|
+
y: number
|
|
338
|
+
fontSize: number
|
|
339
|
+
/** Figma Glyph.rotation — radians, not degrees. Zero for axis-aligned text. */
|
|
340
|
+
rotation?: number
|
|
341
|
+
/**
|
|
342
|
+
* Accumulated non-uniform resize scale (default 1). Paint order is
|
|
343
|
+
* translate → scale(scaleX,Y) → rotate → scale(fontSize,-fontSize) so
|
|
344
|
+
* anisotropic stretch matches scaleGeometryPaths(strokeGeometry).
|
|
345
|
+
* Do not fold this into fontSize or rotated letters desync from outlines.
|
|
346
|
+
*/
|
|
347
|
+
scaleX?: number
|
|
348
|
+
scaleY?: number
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export interface SymbolLink {
|
|
352
|
+
uri: string
|
|
353
|
+
displayName?: string
|
|
354
|
+
displayText?: string
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export interface VariantPropSpec {
|
|
358
|
+
propDefId: string
|
|
359
|
+
value: string
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export type FigmaLayoutMetadata = Partial<
|
|
363
|
+
Record<
|
|
364
|
+
| 'stackMode'
|
|
365
|
+
| 'stackCounterAlign'
|
|
366
|
+
| 'stackJustify'
|
|
367
|
+
| 'stackCounterAlignItems'
|
|
368
|
+
| 'stackPrimaryAlignItems'
|
|
369
|
+
| 'stackPrimarySizing'
|
|
370
|
+
| 'stackCounterSizing'
|
|
371
|
+
| 'stackWrap'
|
|
372
|
+
| 'stackPositioning'
|
|
373
|
+
| 'stackChildAlignSelf',
|
|
374
|
+
string
|
|
375
|
+
> &
|
|
376
|
+
Record<
|
|
377
|
+
| 'stackSpacing'
|
|
378
|
+
| 'stackPadding'
|
|
379
|
+
| 'stackPaddingRight'
|
|
380
|
+
| 'stackPaddingBottom'
|
|
381
|
+
| 'stackVerticalPadding'
|
|
382
|
+
| 'stackHorizontalPadding'
|
|
383
|
+
| 'stackChildPrimaryGrow'
|
|
384
|
+
| 'stackCounterSpacing',
|
|
385
|
+
number
|
|
386
|
+
> &
|
|
387
|
+
Record<'bordersTakeSpace' | 'stackReverseZIndex', boolean>
|
|
388
|
+
>
|
|
389
|
+
|
|
390
|
+
export interface LibraryAssetIdentity {
|
|
391
|
+
libraryId: string
|
|
392
|
+
assetKey: string
|
|
393
|
+
revisionId: string
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export interface LibraryAssetSource {
|
|
397
|
+
identity: LibraryAssetIdentity
|
|
398
|
+
sourceNodeId: string | null
|
|
399
|
+
readOnly: boolean
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export interface EnabledLibraryBinding {
|
|
403
|
+
libraryId: string
|
|
404
|
+
revisionId: string
|
|
405
|
+
enabled: boolean
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export interface SceneNode {
|
|
409
|
+
id: string
|
|
410
|
+
type: NodeType
|
|
411
|
+
name: string
|
|
412
|
+
parentId: string | null
|
|
413
|
+
childIds: string[]
|
|
414
|
+
|
|
415
|
+
x: number
|
|
416
|
+
y: number
|
|
417
|
+
width: number
|
|
418
|
+
height: number
|
|
419
|
+
rotation: number
|
|
420
|
+
source: SourceMetadata
|
|
421
|
+
/** Materialized layout hint imported or generated outside the live Yoga layout pass. */
|
|
422
|
+
derivedLayout: Partial<Rect> | null
|
|
423
|
+
|
|
424
|
+
fills: Fill[]
|
|
425
|
+
strokes: Stroke[]
|
|
426
|
+
effects: Effect[]
|
|
427
|
+
layoutGrids: LayoutGrid[]
|
|
428
|
+
guides: CanvasGuide[]
|
|
429
|
+
fillStyleId: string | null
|
|
430
|
+
strokeStyleId: string | null
|
|
431
|
+
textStyleId: string | null
|
|
432
|
+
effectStyleId: string | null
|
|
433
|
+
gridStyleId: string | null
|
|
434
|
+
sharedStyleType: SharedStyleType | null
|
|
435
|
+
opacity: number
|
|
436
|
+
|
|
437
|
+
cornerRadius: number
|
|
438
|
+
topLeftRadius: number
|
|
439
|
+
topRightRadius: number
|
|
440
|
+
bottomRightRadius: number
|
|
441
|
+
bottomLeftRadius: number
|
|
442
|
+
independentCorners: boolean
|
|
443
|
+
cornerSmoothing: number
|
|
444
|
+
|
|
445
|
+
visible: boolean
|
|
446
|
+
locked: boolean
|
|
447
|
+
clipsContent: boolean
|
|
448
|
+
|
|
449
|
+
blendMode: BlendMode
|
|
450
|
+
|
|
451
|
+
text: string
|
|
452
|
+
fontSize: number
|
|
453
|
+
fontFamily: string
|
|
454
|
+
fontWeight: number
|
|
455
|
+
italic: boolean
|
|
456
|
+
textAlignHorizontal: 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED'
|
|
457
|
+
textDirection: TextDirection
|
|
458
|
+
textLanguage: string | null
|
|
459
|
+
textAlignVertical: TextAlignVertical
|
|
460
|
+
textAutoResize: TextAutoResize
|
|
461
|
+
textCase: TextCase
|
|
462
|
+
textDecoration: TextDecoration
|
|
463
|
+
textDecorationStyle: TextDecorationStyle
|
|
464
|
+
textDecorationThickness: number | null
|
|
465
|
+
textDecorationFills: Fill[]
|
|
466
|
+
textDecorationSkipInk: boolean
|
|
467
|
+
textUnderlineOffset: number | null
|
|
468
|
+
leadingTrim: LeadingTrim
|
|
469
|
+
lineHeight: number | null
|
|
470
|
+
letterSpacing: number
|
|
471
|
+
maxLines: number | null
|
|
472
|
+
|
|
473
|
+
styleRuns: StyleRun[]
|
|
474
|
+
fontVariations: FontVariation[]
|
|
475
|
+
fontFeatures: FontFeature[]
|
|
476
|
+
|
|
477
|
+
horizontalConstraint: ConstraintType
|
|
478
|
+
verticalConstraint: ConstraintType
|
|
479
|
+
|
|
480
|
+
layoutMode: LayoutMode
|
|
481
|
+
layoutDirection: LayoutDirection
|
|
482
|
+
layoutWrap: LayoutWrap
|
|
483
|
+
primaryAxisAlign: LayoutAlign
|
|
484
|
+
counterAxisAlign: LayoutCounterAlign
|
|
485
|
+
primaryAxisSizing: LayoutSizing
|
|
486
|
+
counterAxisSizing: LayoutSizing
|
|
487
|
+
itemSpacing: number
|
|
488
|
+
counterAxisSpacing: number
|
|
489
|
+
paddingTop: number
|
|
490
|
+
paddingRight: number
|
|
491
|
+
paddingBottom: number
|
|
492
|
+
paddingLeft: number
|
|
493
|
+
|
|
494
|
+
layoutPositioning: 'AUTO' | 'ABSOLUTE'
|
|
495
|
+
layoutGrow: number
|
|
496
|
+
layoutAlignSelf: LayoutAlignSelf
|
|
497
|
+
|
|
498
|
+
vectorNetwork: VectorNetwork | null
|
|
499
|
+
handleMirroring: HandleMirroring
|
|
500
|
+
booleanOperation?: 'UNION' | 'SUBTRACT' | 'INTERSECT' | 'EXCLUDE'
|
|
501
|
+
fillGeometry: GeometryPath[]
|
|
502
|
+
strokeGeometry: GeometryPath[]
|
|
503
|
+
|
|
504
|
+
arcData: ArcData | null
|
|
505
|
+
|
|
506
|
+
strokeCap: StrokeCap
|
|
507
|
+
strokeJoin: StrokeJoin
|
|
508
|
+
dashPattern: number[]
|
|
509
|
+
|
|
510
|
+
borderTopWeight: number
|
|
511
|
+
borderRightWeight: number
|
|
512
|
+
borderBottomWeight: number
|
|
513
|
+
borderLeftWeight: number
|
|
514
|
+
independentStrokeWeights: boolean
|
|
515
|
+
|
|
516
|
+
strokeMiterLimit: number
|
|
517
|
+
|
|
518
|
+
minWidth: number | null
|
|
519
|
+
maxWidth: number | null
|
|
520
|
+
minHeight: number | null
|
|
521
|
+
maxHeight: number | null
|
|
522
|
+
|
|
523
|
+
isMask: boolean
|
|
524
|
+
maskType: MaskType
|
|
525
|
+
maskIsOutline: boolean
|
|
526
|
+
|
|
527
|
+
gridTemplateColumns: GridTrack[]
|
|
528
|
+
gridTemplateRows: GridTrack[]
|
|
529
|
+
gridColumnGap: number
|
|
530
|
+
gridRowGap: number
|
|
531
|
+
gridPosition: GridPosition | null
|
|
532
|
+
|
|
533
|
+
counterAxisAlignContent: 'AUTO' | 'SPACE_BETWEEN'
|
|
534
|
+
itemReverseZIndex: boolean
|
|
535
|
+
strokesIncludedInLayout: boolean
|
|
536
|
+
|
|
537
|
+
expanded: boolean
|
|
538
|
+
textTruncation: 'DISABLED' | 'ENDING'
|
|
539
|
+
autoRename: boolean
|
|
540
|
+
|
|
541
|
+
pointCount: number
|
|
542
|
+
starInnerRadius: number
|
|
543
|
+
|
|
544
|
+
componentId: string | null
|
|
545
|
+
instanceOverrides: InstanceOverrideState
|
|
546
|
+
componentPropertyDefinitions: ComponentPropertyDefinition[]
|
|
547
|
+
componentPropertyReferences: ComponentPropertyReference[]
|
|
548
|
+
componentPropertyAssignments: Record<string, string>
|
|
549
|
+
componentPropertyValues: Record<string, string>
|
|
550
|
+
componentKey: string | null
|
|
551
|
+
sourceLibraryKey: string | null
|
|
552
|
+
publishId: string | null
|
|
553
|
+
overrideKey: string | null
|
|
554
|
+
sharedSymbolVersion: string | null
|
|
555
|
+
publishedVersion: string | null
|
|
556
|
+
librarySource: LibraryAssetSource | null
|
|
557
|
+
isPublishable: boolean
|
|
558
|
+
isSymbolPublishable: boolean
|
|
559
|
+
symbolDescription: string
|
|
560
|
+
symbolLinks: SymbolLink[]
|
|
561
|
+
variantPropSpecs: VariantPropSpec[]
|
|
562
|
+
|
|
563
|
+
boundVariables: Record<string, string>
|
|
564
|
+
variableModes: VariableModeMap
|
|
565
|
+
exportSettings: ExportSetting[]
|
|
566
|
+
|
|
567
|
+
pluginData: PluginDataEntry[]
|
|
568
|
+
pluginRelaunchData: PluginRelaunchDataEntry[]
|
|
569
|
+
|
|
570
|
+
internalOnly: boolean
|
|
571
|
+
|
|
572
|
+
flipX: boolean
|
|
573
|
+
flipY: boolean
|
|
574
|
+
|
|
575
|
+
textPicture: Uint8Array | null
|
|
576
|
+
derivedTextGlyphs: DerivedTextGlyph[] | null
|
|
577
|
+
/** Format-neutral layout path for text-on-path nodes. */
|
|
578
|
+
textPathData: TextPathData | null
|
|
579
|
+
/** Node-local box that maps textPathData into the node coordinate space. */
|
|
580
|
+
textPathBox: Rect | null
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export type ComponentPropertyType = 'VARIANT' | 'TEXT' | 'BOOLEAN' | 'INSTANCE_SWAP'
|
|
584
|
+
|
|
585
|
+
export type ComponentPropertyReferenceField = 'VISIBLE' | 'TEXT' | 'INSTANCE_SWAP'
|
|
586
|
+
|
|
587
|
+
export interface ComponentPropertyReference {
|
|
588
|
+
propertyId: string
|
|
589
|
+
field: ComponentPropertyReferenceField
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
export interface ComponentPropertyDefinition {
|
|
593
|
+
id: string
|
|
594
|
+
name: string
|
|
595
|
+
type: ComponentPropertyType
|
|
596
|
+
defaultValue: string
|
|
597
|
+
variantOptions?: string[]
|
|
598
|
+
preferredValues?: string[]
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export type VariableType = 'COLOR' | 'FLOAT' | 'STRING' | 'BOOLEAN'
|
|
602
|
+
export type VariableValue = Color | number | string | boolean | { aliasId: string }
|
|
603
|
+
export type VariableModeMap = Record<string, string>
|
|
604
|
+
|
|
605
|
+
export interface Variable {
|
|
606
|
+
id: string
|
|
607
|
+
name: string
|
|
608
|
+
type: VariableType
|
|
609
|
+
collectionId: string
|
|
610
|
+
valuesByMode: Record<string, VariableValue>
|
|
611
|
+
description: string
|
|
612
|
+
hiddenFromPublishing: boolean
|
|
613
|
+
/** Published library key (from NodeChange.key). Used for assetRef resolution in colorVar. */
|
|
614
|
+
key?: string
|
|
615
|
+
/** Published library version (from NodeChange.version). Used for assetRef resolution in colorVar. */
|
|
616
|
+
version?: string
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/** Scalar numeric node fields accepted by numeric property controls. */
|
|
620
|
+
export type NumericNodeProperty = {
|
|
621
|
+
[K in keyof SceneNode]-?: SceneNode[K] extends number ? K : never
|
|
622
|
+
}[keyof SceneNode]
|
|
623
|
+
|
|
624
|
+
export interface VariableCollectionMode {
|
|
625
|
+
modeId: string
|
|
626
|
+
name: string
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export interface VariableCollection {
|
|
630
|
+
id: string
|
|
631
|
+
name: string
|
|
632
|
+
modes: VariableCollectionMode[]
|
|
633
|
+
defaultModeId: string
|
|
634
|
+
variableIds: string[]
|
|
635
|
+
}
|