@open-pencil/scene-graph 0.13.2 → 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/dist/types2.d.ts
CHANGED
|
@@ -1,430 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/types.d.ts
|
|
4
|
-
interface SceneGraphEvents {
|
|
5
|
-
'node:created': (node: SceneNode) => void;
|
|
6
|
-
'node:updated': (id: string, changes: Partial<SceneNode>) => void;
|
|
7
|
-
'node:previewUpdated': (id: string, changes: Partial<SceneNode>) => void;
|
|
8
|
-
'node:deleted': (id: string) => void;
|
|
9
|
-
'node:reparented': (nodeId: string, oldParentId: string | null, newParentId: string) => void;
|
|
10
|
-
'node:reordered': (nodeId: string, parentId: string, index: number) => void;
|
|
11
|
-
}
|
|
12
|
-
type SceneGraphEventHandlers = Partial<{
|
|
13
|
-
created: (node: SceneNode) => void;
|
|
14
|
-
updated: (id: string, changes: Partial<SceneNode>) => void;
|
|
15
|
-
previewUpdated: (id: string, changes: Partial<SceneNode>) => void;
|
|
16
|
-
deleted: (id: string) => void;
|
|
17
|
-
reparented: (nodeId: string, oldParentId: string | null, newParentId: string) => void;
|
|
18
|
-
reordered: (nodeId: string, parentId: string, index: number) => void;
|
|
19
|
-
}>;
|
|
20
|
-
type DocumentColorSpace = 'srgb' | 'display-p3';
|
|
21
|
-
interface FigmaSourcePayload {
|
|
22
|
-
rawSize: Vector | null;
|
|
23
|
-
rawTransform: Matrix | null;
|
|
24
|
-
rawNodeFields: Record<string, unknown>;
|
|
25
|
-
layout: FigmaLayoutMetadata | null;
|
|
26
|
-
symbolOverrides: unknown[];
|
|
27
|
-
componentPropAssignments: unknown[];
|
|
28
|
-
derivedSymbolData: unknown[];
|
|
29
|
-
derivedSymbolDataLayoutVersion: number | null;
|
|
30
|
-
uniformScaleFactor: number | null;
|
|
31
|
-
}
|
|
32
|
-
interface SourceMetadata {
|
|
33
|
-
format: 'fig' | null;
|
|
34
|
-
id: string | null;
|
|
35
|
-
orderKey: string | null;
|
|
36
|
-
editedFields: string[];
|
|
37
|
-
fig: FigmaSourcePayload;
|
|
38
|
-
}
|
|
39
|
-
type HandleMirroring = 'NONE' | 'ANGLE' | 'ANGLE_AND_LENGTH';
|
|
40
|
-
type WindingRule = 'NONZERO' | 'EVENODD';
|
|
41
|
-
interface VectorVertex {
|
|
42
|
-
x: number;
|
|
43
|
-
y: number;
|
|
44
|
-
strokeCap?: string;
|
|
45
|
-
strokeJoin?: string;
|
|
46
|
-
cornerRadius?: number;
|
|
47
|
-
handleMirroring?: HandleMirroring;
|
|
48
|
-
}
|
|
49
|
-
interface VectorSegment {
|
|
50
|
-
start: number;
|
|
51
|
-
end: number;
|
|
52
|
-
tangentStart: Vector;
|
|
53
|
-
tangentEnd: Vector;
|
|
54
|
-
}
|
|
55
|
-
interface VectorRegion {
|
|
56
|
-
windingRule: WindingRule;
|
|
57
|
-
loops: number[][];
|
|
58
|
-
}
|
|
59
|
-
interface VectorNetwork {
|
|
60
|
-
vertices: VectorVertex[];
|
|
61
|
-
segments: VectorSegment[];
|
|
62
|
-
regions: VectorRegion[];
|
|
63
|
-
}
|
|
64
|
-
interface GeometryPath {
|
|
65
|
-
windingRule: WindingRule;
|
|
66
|
-
commandsBlob: Uint8Array;
|
|
67
|
-
/** Resolved paints for geometry using a format-specific style override. */
|
|
68
|
-
fills?: Fill[];
|
|
69
|
-
/** Shared fill style attached to this geometry region, when available. */
|
|
70
|
-
fillStyleId?: string;
|
|
71
|
-
}
|
|
72
|
-
type NodeType = 'CANVAS' | 'FRAME' | 'RECTANGLE' | 'ROUNDED_RECTANGLE' | 'ELLIPSE' | 'TEXT' | 'LINE' | 'STAR' | 'POLYGON' | 'VECTOR' | 'BOOLEAN_OPERATION' | 'GROUP' | 'SECTION' | 'COMPONENT' | 'COMPONENT_SET' | 'INSTANCE' | 'CONNECTOR' | 'SHAPE_WITH_TEXT';
|
|
73
|
-
type FillType = 'SOLID' | 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND' | 'IMAGE' | 'VIDEO' | 'PATTERN' | 'NOISE' | 'CUSTOM';
|
|
74
|
-
type BlendMode = 'NORMAL' | 'DARKEN' | 'MULTIPLY' | 'COLOR_BURN' | 'LIGHTEN' | 'SCREEN' | 'COLOR_DODGE' | 'OVERLAY' | 'SOFT_LIGHT' | 'HARD_LIGHT' | 'DIFFERENCE' | 'EXCLUSION' | 'HUE' | 'SATURATION' | 'COLOR' | 'LUMINOSITY' | 'PASS_THROUGH';
|
|
75
|
-
type ImageScaleMode = 'FILL' | 'FIT' | 'CROP' | 'TILE';
|
|
76
|
-
type NoiseType = 'MULTITONE' | 'MONOTONE' | 'DUOTONE';
|
|
77
|
-
type PatternTileType = 'RECTANGULAR' | 'HORIZONTAL_HEXAGONAL' | 'VERTICAL_HEXAGONAL';
|
|
78
|
-
type PatternAlignment = 'START' | 'CENTER' | 'END';
|
|
79
|
-
interface GradientStop {
|
|
80
|
-
color: Color;
|
|
81
|
-
position: number;
|
|
82
|
-
}
|
|
83
|
-
type GradientTransform = Matrix;
|
|
84
|
-
interface Fill {
|
|
85
|
-
type: FillType;
|
|
86
|
-
color: Color;
|
|
87
|
-
opacity: number;
|
|
88
|
-
visible: boolean;
|
|
89
|
-
blendMode?: BlendMode;
|
|
90
|
-
gradientStops?: GradientStop[];
|
|
91
|
-
gradientTransform?: GradientTransform;
|
|
92
|
-
imageHash?: string;
|
|
93
|
-
imageScaleMode?: ImageScaleMode;
|
|
94
|
-
imageTransform?: GradientTransform;
|
|
95
|
-
sourceNodeId?: string;
|
|
96
|
-
scale?: number;
|
|
97
|
-
spacing?: number;
|
|
98
|
-
patternSpacing?: Vector;
|
|
99
|
-
patternTileType?: PatternTileType;
|
|
100
|
-
verticalAlignment?: PatternAlignment;
|
|
101
|
-
horizontalAlignment?: PatternAlignment;
|
|
102
|
-
noiseType?: NoiseType;
|
|
103
|
-
density?: number;
|
|
104
|
-
noiseSize?: Vector;
|
|
105
|
-
customEffectId?: string;
|
|
106
|
-
}
|
|
107
|
-
type StrokeCap = 'NONE' | 'ROUND' | 'SQUARE' | 'ARROW_LINES' | 'ARROW_EQUILATERAL';
|
|
108
|
-
type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND';
|
|
109
|
-
type SharedStyleType = 'FILL' | 'TEXT' | 'EFFECT' | 'GRID';
|
|
110
|
-
type SharedStyleKind = 'fill' | 'stroke' | 'text' | 'effect' | 'grid';
|
|
111
|
-
type MaskType = 'ALPHA' | 'VECTOR' | 'LUMINANCE';
|
|
112
|
-
interface LayoutGrid {
|
|
113
|
-
visible?: boolean;
|
|
114
|
-
color?: Color;
|
|
115
|
-
pattern?: 'COLUMNS' | 'ROWS' | 'GRID';
|
|
116
|
-
axis?: 'X' | 'Y';
|
|
117
|
-
type?: 'MIN' | 'CENTER' | 'MAX' | 'STRETCH';
|
|
118
|
-
alignment?: 'MIN' | 'CENTER' | 'MAX' | 'STRETCH';
|
|
119
|
-
numSections?: number;
|
|
120
|
-
count?: number;
|
|
121
|
-
offset?: number;
|
|
122
|
-
sectionSize?: number;
|
|
123
|
-
gutterSize?: number;
|
|
124
|
-
}
|
|
125
|
-
interface SharedStyle {
|
|
126
|
-
id: string;
|
|
127
|
-
nodeId: string;
|
|
128
|
-
name: string;
|
|
129
|
-
type: SharedStyleType;
|
|
130
|
-
}
|
|
131
|
-
interface Stroke {
|
|
132
|
-
color: Color;
|
|
133
|
-
weight: number;
|
|
134
|
-
opacity: number;
|
|
135
|
-
visible: boolean;
|
|
136
|
-
align: 'INSIDE' | 'CENTER' | 'OUTSIDE';
|
|
137
|
-
cap?: StrokeCap;
|
|
138
|
-
join?: StrokeJoin;
|
|
139
|
-
dashPattern?: number[];
|
|
140
|
-
}
|
|
141
|
-
interface Effect {
|
|
142
|
-
type: 'DROP_SHADOW' | 'INNER_SHADOW' | 'LAYER_BLUR' | 'BACKGROUND_BLUR' | 'FOREGROUND_BLUR';
|
|
143
|
-
color: Color;
|
|
144
|
-
offset: Vector;
|
|
145
|
-
radius: number;
|
|
146
|
-
spread: number;
|
|
147
|
-
visible: boolean;
|
|
148
|
-
blendMode?: BlendMode;
|
|
149
|
-
showShadowBehindNode?: boolean;
|
|
150
|
-
}
|
|
151
|
-
type ConstraintType = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'SCALE';
|
|
152
|
-
type TextAutoResize = 'NONE' | 'HEIGHT' | 'WIDTH_AND_HEIGHT' | 'TRUNCATE';
|
|
153
|
-
type TextAlignVertical = 'TOP' | 'CENTER' | 'BOTTOM';
|
|
154
|
-
type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE';
|
|
155
|
-
type TextDecoration = 'NONE' | 'UNDERLINE' | 'STRIKETHROUGH';
|
|
156
|
-
type TextDecorationStyle = 'SOLID' | 'DOTTED' | 'WAVY';
|
|
157
|
-
type LeadingTrim = 'NONE' | 'CAP_HEIGHT';
|
|
158
|
-
type TextDirection = 'AUTO' | 'LTR' | 'RTL';
|
|
159
|
-
type LayoutDirection = 'AUTO' | 'LTR' | 'RTL';
|
|
160
|
-
interface FontVariation {
|
|
161
|
-
axis: string;
|
|
162
|
-
value: number;
|
|
163
|
-
}
|
|
164
|
-
interface FontFeature {
|
|
165
|
-
tag: string;
|
|
166
|
-
enabled: boolean;
|
|
167
|
-
}
|
|
168
|
-
interface CharacterStyleOverride {
|
|
169
|
-
fontWeight?: number;
|
|
170
|
-
italic?: boolean;
|
|
171
|
-
textDecoration?: TextDecoration;
|
|
172
|
-
textDecorationStyle?: TextDecorationStyle;
|
|
173
|
-
textDecorationThickness?: number | null;
|
|
174
|
-
textDecorationFills?: Fill[];
|
|
175
|
-
textDecorationSkipInk?: boolean;
|
|
176
|
-
textUnderlineOffset?: number | null;
|
|
177
|
-
fontSize?: number;
|
|
178
|
-
fontFamily?: string;
|
|
179
|
-
letterSpacing?: number;
|
|
180
|
-
lineHeight?: number | null;
|
|
181
|
-
fills?: Fill[];
|
|
182
|
-
fontVariations?: FontVariation[];
|
|
183
|
-
fontFeatures?: FontFeature[];
|
|
184
|
-
textLanguage?: string | null;
|
|
185
|
-
}
|
|
186
|
-
interface StyleRun {
|
|
187
|
-
start: number;
|
|
188
|
-
length: number;
|
|
189
|
-
style: CharacterStyleOverride;
|
|
190
|
-
}
|
|
191
|
-
interface ArcData {
|
|
192
|
-
startingAngle: number;
|
|
193
|
-
endingAngle: number;
|
|
194
|
-
innerRadius: number;
|
|
195
|
-
}
|
|
196
|
-
type LayoutMode = 'NONE' | 'HORIZONTAL' | 'VERTICAL' | 'GRID';
|
|
197
|
-
type LayoutSizing = 'FIXED' | 'HUG' | 'FILL';
|
|
198
|
-
type GridTrackSizing = 'FIXED' | 'FR' | 'AUTO';
|
|
199
|
-
interface GridTrack {
|
|
200
|
-
sizing: GridTrackSizing;
|
|
201
|
-
value: number;
|
|
202
|
-
}
|
|
203
|
-
interface GridPosition {
|
|
204
|
-
column: number;
|
|
205
|
-
row: number;
|
|
206
|
-
columnSpan: number;
|
|
207
|
-
rowSpan: number;
|
|
208
|
-
}
|
|
209
|
-
type LayoutAlign = 'MIN' | 'CENTER' | 'MAX' | 'SPACE_BETWEEN';
|
|
210
|
-
type LayoutCounterAlign = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'BASELINE';
|
|
211
|
-
type LayoutAlignSelf = 'AUTO' | 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'BASELINE';
|
|
212
|
-
type LayoutWrap = 'NO_WRAP' | 'WRAP';
|
|
213
|
-
interface PluginDataEntry {
|
|
214
|
-
pluginId: string;
|
|
215
|
-
key: string;
|
|
216
|
-
value: string;
|
|
217
|
-
}
|
|
218
|
-
type ExportFormatId = 'png' | 'jpg' | 'webp' | 'svg' | 'pdf';
|
|
219
|
-
interface ExportSetting {
|
|
220
|
-
scale: number;
|
|
221
|
-
format: ExportFormatId;
|
|
222
|
-
}
|
|
223
|
-
interface PluginRelaunchDataEntry {
|
|
224
|
-
pluginId: string;
|
|
225
|
-
command: string;
|
|
226
|
-
message: string;
|
|
227
|
-
isDeleted: boolean;
|
|
228
|
-
}
|
|
229
|
-
interface FigmaDerivedTextGlyph {
|
|
230
|
-
commandsBlob: Uint8Array;
|
|
231
|
-
x: number;
|
|
232
|
-
y: number;
|
|
233
|
-
fontSize: number;
|
|
234
|
-
}
|
|
235
|
-
interface SymbolLink {
|
|
236
|
-
uri: string;
|
|
237
|
-
displayName?: string;
|
|
238
|
-
displayText?: string;
|
|
239
|
-
}
|
|
240
|
-
interface VariantPropSpec {
|
|
241
|
-
propDefId: string;
|
|
242
|
-
value: string;
|
|
243
|
-
}
|
|
244
|
-
type FigmaLayoutMetadata = Partial<Record<'stackMode' | 'stackCounterAlign' | 'stackJustify' | 'stackCounterAlignItems' | 'stackPrimaryAlignItems' | 'stackPrimarySizing' | 'stackCounterSizing' | 'stackWrap' | 'stackPositioning' | 'stackChildAlignSelf', string> & Record<'stackSpacing' | 'stackPadding' | 'stackPaddingRight' | 'stackPaddingBottom' | 'stackVerticalPadding' | 'stackHorizontalPadding' | 'stackChildPrimaryGrow' | 'stackCounterSpacing', number> & Record<'bordersTakeSpace' | 'stackReverseZIndex', boolean>>;
|
|
245
|
-
interface SceneNode {
|
|
246
|
-
id: string;
|
|
247
|
-
type: NodeType;
|
|
248
|
-
name: string;
|
|
249
|
-
parentId: string | null;
|
|
250
|
-
childIds: string[];
|
|
251
|
-
x: number;
|
|
252
|
-
y: number;
|
|
253
|
-
width: number;
|
|
254
|
-
height: number;
|
|
255
|
-
rotation: number;
|
|
256
|
-
source: SourceMetadata;
|
|
257
|
-
figmaDerivedLayout: Partial<Rect> | null;
|
|
258
|
-
fills: Fill[];
|
|
259
|
-
strokes: Stroke[];
|
|
260
|
-
effects: Effect[];
|
|
261
|
-
layoutGrids: LayoutGrid[];
|
|
262
|
-
fillStyleId: string | null;
|
|
263
|
-
strokeStyleId: string | null;
|
|
264
|
-
textStyleId: string | null;
|
|
265
|
-
effectStyleId: string | null;
|
|
266
|
-
gridStyleId: string | null;
|
|
267
|
-
sharedStyleType: SharedStyleType | null;
|
|
268
|
-
opacity: number;
|
|
269
|
-
cornerRadius: number;
|
|
270
|
-
topLeftRadius: number;
|
|
271
|
-
topRightRadius: number;
|
|
272
|
-
bottomRightRadius: number;
|
|
273
|
-
bottomLeftRadius: number;
|
|
274
|
-
independentCorners: boolean;
|
|
275
|
-
cornerSmoothing: number;
|
|
276
|
-
visible: boolean;
|
|
277
|
-
locked: boolean;
|
|
278
|
-
clipsContent: boolean;
|
|
279
|
-
blendMode: BlendMode;
|
|
280
|
-
text: string;
|
|
281
|
-
fontSize: number;
|
|
282
|
-
fontFamily: string;
|
|
283
|
-
fontWeight: number;
|
|
284
|
-
italic: boolean;
|
|
285
|
-
textAlignHorizontal: 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED';
|
|
286
|
-
textDirection: TextDirection;
|
|
287
|
-
textLanguage: string | null;
|
|
288
|
-
textAlignVertical: TextAlignVertical;
|
|
289
|
-
textAutoResize: TextAutoResize;
|
|
290
|
-
textCase: TextCase;
|
|
291
|
-
textDecoration: TextDecoration;
|
|
292
|
-
textDecorationStyle: TextDecorationStyle;
|
|
293
|
-
textDecorationThickness: number | null;
|
|
294
|
-
textDecorationFills: Fill[];
|
|
295
|
-
textDecorationSkipInk: boolean;
|
|
296
|
-
textUnderlineOffset: number | null;
|
|
297
|
-
leadingTrim: LeadingTrim;
|
|
298
|
-
lineHeight: number | null;
|
|
299
|
-
letterSpacing: number;
|
|
300
|
-
maxLines: number | null;
|
|
301
|
-
styleRuns: StyleRun[];
|
|
302
|
-
fontVariations: FontVariation[];
|
|
303
|
-
fontFeatures: FontFeature[];
|
|
304
|
-
horizontalConstraint: ConstraintType;
|
|
305
|
-
verticalConstraint: ConstraintType;
|
|
306
|
-
layoutMode: LayoutMode;
|
|
307
|
-
layoutDirection: LayoutDirection;
|
|
308
|
-
layoutWrap: LayoutWrap;
|
|
309
|
-
primaryAxisAlign: LayoutAlign;
|
|
310
|
-
counterAxisAlign: LayoutCounterAlign;
|
|
311
|
-
primaryAxisSizing: LayoutSizing;
|
|
312
|
-
counterAxisSizing: LayoutSizing;
|
|
313
|
-
itemSpacing: number;
|
|
314
|
-
counterAxisSpacing: number;
|
|
315
|
-
paddingTop: number;
|
|
316
|
-
paddingRight: number;
|
|
317
|
-
paddingBottom: number;
|
|
318
|
-
paddingLeft: number;
|
|
319
|
-
layoutPositioning: 'AUTO' | 'ABSOLUTE';
|
|
320
|
-
layoutGrow: number;
|
|
321
|
-
layoutAlignSelf: LayoutAlignSelf;
|
|
322
|
-
vectorNetwork: VectorNetwork | null;
|
|
323
|
-
handleMirroring: HandleMirroring;
|
|
324
|
-
booleanOperation?: 'UNION' | 'SUBTRACT' | 'INTERSECT' | 'EXCLUDE';
|
|
325
|
-
fillGeometry: GeometryPath[];
|
|
326
|
-
strokeGeometry: GeometryPath[];
|
|
327
|
-
arcData: ArcData | null;
|
|
328
|
-
strokeCap: StrokeCap;
|
|
329
|
-
strokeJoin: StrokeJoin;
|
|
330
|
-
dashPattern: number[];
|
|
331
|
-
borderTopWeight: number;
|
|
332
|
-
borderRightWeight: number;
|
|
333
|
-
borderBottomWeight: number;
|
|
334
|
-
borderLeftWeight: number;
|
|
335
|
-
independentStrokeWeights: boolean;
|
|
336
|
-
strokeMiterLimit: number;
|
|
337
|
-
minWidth: number | null;
|
|
338
|
-
maxWidth: number | null;
|
|
339
|
-
minHeight: number | null;
|
|
340
|
-
maxHeight: number | null;
|
|
341
|
-
isMask: boolean;
|
|
342
|
-
maskType: MaskType;
|
|
343
|
-
maskIsOutline: boolean;
|
|
344
|
-
gridTemplateColumns: GridTrack[];
|
|
345
|
-
gridTemplateRows: GridTrack[];
|
|
346
|
-
gridColumnGap: number;
|
|
347
|
-
gridRowGap: number;
|
|
348
|
-
gridPosition: GridPosition | null;
|
|
349
|
-
counterAxisAlignContent: 'AUTO' | 'SPACE_BETWEEN';
|
|
350
|
-
itemReverseZIndex: boolean;
|
|
351
|
-
strokesIncludedInLayout: boolean;
|
|
352
|
-
expanded: boolean;
|
|
353
|
-
textTruncation: 'DISABLED' | 'ENDING';
|
|
354
|
-
autoRename: boolean;
|
|
355
|
-
pointCount: number;
|
|
356
|
-
starInnerRadius: number;
|
|
357
|
-
componentId: string | null;
|
|
358
|
-
overrides: Record<string, unknown>;
|
|
359
|
-
componentPropertyDefinitions: ComponentPropertyDefinition[];
|
|
360
|
-
componentPropertyReferences: ComponentPropertyReference[];
|
|
361
|
-
componentPropertyAssignments: Record<string, string>;
|
|
362
|
-
componentPropertyValues: Record<string, string>;
|
|
363
|
-
componentKey: string | null;
|
|
364
|
-
sourceLibraryKey: string | null;
|
|
365
|
-
publishId: string | null;
|
|
366
|
-
overrideKey: string | null;
|
|
367
|
-
sharedSymbolVersion: string | null;
|
|
368
|
-
publishedVersion: string | null;
|
|
369
|
-
isPublishable: boolean;
|
|
370
|
-
isSymbolPublishable: boolean;
|
|
371
|
-
symbolDescription: string;
|
|
372
|
-
symbolLinks: SymbolLink[];
|
|
373
|
-
variantPropSpecs: VariantPropSpec[];
|
|
374
|
-
boundVariables: Record<string, string>;
|
|
375
|
-
variableModes: VariableModeMap;
|
|
376
|
-
exportSettings: ExportSetting[];
|
|
377
|
-
pluginData: PluginDataEntry[];
|
|
378
|
-
pluginRelaunchData: PluginRelaunchDataEntry[];
|
|
379
|
-
internalOnly: boolean;
|
|
380
|
-
flipX: boolean;
|
|
381
|
-
flipY: boolean;
|
|
382
|
-
textPicture: Uint8Array | null;
|
|
383
|
-
figmaDerivedTextGlyphs: FigmaDerivedTextGlyph[] | null;
|
|
384
|
-
}
|
|
385
|
-
type ComponentPropertyType = 'VARIANT' | 'TEXT' | 'BOOLEAN' | 'INSTANCE_SWAP';
|
|
386
|
-
type ComponentPropertyReferenceField = 'VISIBLE' | 'TEXT' | 'INSTANCE_SWAP';
|
|
387
|
-
interface ComponentPropertyReference {
|
|
388
|
-
propertyId: string;
|
|
389
|
-
field: ComponentPropertyReferenceField;
|
|
390
|
-
}
|
|
391
|
-
interface ComponentPropertyDefinition {
|
|
392
|
-
id: string;
|
|
393
|
-
name: string;
|
|
394
|
-
type: ComponentPropertyType;
|
|
395
|
-
defaultValue: string;
|
|
396
|
-
variantOptions?: string[];
|
|
397
|
-
preferredValues?: string[];
|
|
398
|
-
}
|
|
399
|
-
type VariableType = 'COLOR' | 'FLOAT' | 'STRING' | 'BOOLEAN';
|
|
400
|
-
type VariableValue = Color | number | string | boolean | {
|
|
401
|
-
aliasId: string;
|
|
402
|
-
};
|
|
403
|
-
type VariableModeMap = Record<string, string>;
|
|
404
|
-
interface Variable {
|
|
405
|
-
id: string;
|
|
406
|
-
name: string;
|
|
407
|
-
type: VariableType;
|
|
408
|
-
collectionId: string;
|
|
409
|
-
valuesByMode: Record<string, VariableValue>;
|
|
410
|
-
description: string;
|
|
411
|
-
hiddenFromPublishing: boolean;
|
|
412
|
-
/** Published library key (from NodeChange.key). Used for assetRef resolution in colorVar. */
|
|
413
|
-
key?: string;
|
|
414
|
-
/** Published library version (from NodeChange.version). Used for assetRef resolution in colorVar. */
|
|
415
|
-
version?: string;
|
|
416
|
-
}
|
|
417
|
-
interface VariableCollectionMode {
|
|
418
|
-
modeId: string;
|
|
419
|
-
name: string;
|
|
420
|
-
}
|
|
421
|
-
interface VariableCollection {
|
|
422
|
-
id: string;
|
|
423
|
-
name: string;
|
|
424
|
-
modes: VariableCollectionMode[];
|
|
425
|
-
defaultModeId: string;
|
|
426
|
-
variableIds: string[];
|
|
427
|
-
}
|
|
428
|
-
//#endregion
|
|
429
|
-
export { ArcData, BlendMode, CharacterStyleOverride, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConstraintType, DocumentColorSpace, Effect, ExportFormatId, ExportSetting, FigmaDerivedTextGlyph, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, MaskType, NodeType, NoiseType, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, SharedStyle, SharedStyleKind, SharedStyleType, SourceMetadata, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TextAlignVertical, TextAutoResize, TextCase, TextDecoration, TextDecorationStyle, TextDirection, Variable, VariableCollection, VariableCollectionMode, VariableModeMap, VariableType, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule };
|
|
430
|
-
//# sourceMappingURL=types2.d.ts.map
|
|
1
|
+
import { ArcData, BlendMode, CharacterStyleOverride, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConstraintType, DerivedTextGlyph, DocumentColorSpace, Effect, EnabledLibraryBinding, ExportFormatId, ExportSetting, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MaskType, NodeType, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, SharedStyle, SharedStyleKind, SharedStyleType, SourceMetadata, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TextAlignVertical, TextAutoResize, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextPathData, Variable, VariableCollection, VariableCollectionMode, VariableModeMap, VariableType, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule } from "./types.js";
|
|
2
|
+
export { ArcData, BlendMode, CharacterStyleOverride, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConstraintType, DerivedTextGlyph, DocumentColorSpace, Effect, EnabledLibraryBinding, ExportFormatId, ExportSetting, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MaskType, NodeType, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, SharedStyle, SharedStyleKind, SharedStyleType, SourceMetadata, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TextAlignVertical, TextAutoResize, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextPathData, Variable, VariableCollection, VariableCollectionMode, VariableModeMap, VariableType, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule };
|
package/dist/undo.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UndoManager } from "./
|
|
1
|
+
import { UndoManager } from "./chunks/index.js";
|
|
2
2
|
export { UndoManager };
|
package/dist/undo2.d.ts
CHANGED
|
@@ -7,12 +7,15 @@ interface UndoEntry {
|
|
|
7
7
|
}
|
|
8
8
|
interface UndoManagerOptions {
|
|
9
9
|
limit?: number;
|
|
10
|
+
/** Called after recording, undoing, redoing, or clearing committed history. */
|
|
11
|
+
onChange?: () => void;
|
|
10
12
|
}
|
|
11
13
|
declare class UndoManager {
|
|
12
14
|
private undoStack;
|
|
13
15
|
private redoStack;
|
|
14
16
|
private batches;
|
|
15
17
|
private readonly limit;
|
|
18
|
+
private readonly onChange;
|
|
16
19
|
constructor(options?: UndoManagerOptions);
|
|
17
20
|
apply(entry: UndoEntry): void;
|
|
18
21
|
execute(entry: UndoEntry): void;
|
|
@@ -24,6 +27,8 @@ declare class UndoManager {
|
|
|
24
27
|
commitBatch(): void;
|
|
25
28
|
runBatch<T>(label: string, fn: () => T, coalesceKey?: string): T;
|
|
26
29
|
rollbackBatch(): void;
|
|
30
|
+
/** Abandon provisional history without replaying it or changing committed undo/redo entries. */
|
|
31
|
+
discardBatches(): void;
|
|
27
32
|
clear(): void;
|
|
28
33
|
get isBatching(): boolean;
|
|
29
34
|
get canUndo(): boolean;
|
package/dist/undo2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undo2.d.ts","names":[],"sources":["../src/undo.ts"],"mappings":";UAAiB
|
|
1
|
+
{"version":3,"file":"undo2.d.ts","names":[],"sources":["../src/undo.ts"],"mappings":";UAAiB;EACf;EACA;EACA;EACA;;UAGe;EACf;;EAEA;;cAWW;UACH;UACA;UACA;mBACS;mBACA;EAEL,YAAA,UAAS;EAKrB,MAAM,OAAO;EAIb,QAAQ,OAAO;EAKf,KAAK,OAAO;EAIZ,OAAO,OAAO;EASd;EASA;EASA,WAAW,eAAe;EAI1B;EAUA,SAAS,GAAG,eAAe,UAAU,GAAG,uBAAuB;EAY/D;;EAOA;EAIA;MAOI;MAIA;MAIA;MAIA;MAIA;cAIQ;UAIJ;UASA;UAeA"}
|
package/dist/variables.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Color } from "./primitives2.js";
|
|
2
|
+
import { Variable, VariableCollection, VariableType, VariableValue } from "./types.js";
|
|
2
3
|
import { SceneGraph } from "./coordinate.js";
|
|
3
|
-
import { Variable, VariableCollection, VariableType, VariableValue } from "./types2.js";
|
|
4
|
-
|
|
5
4
|
//#region src/variables.d.ts
|
|
6
5
|
declare function addVariable(graph: SceneGraph, variable: Variable): void;
|
|
7
6
|
declare function removeVariable(graph: SceneGraph, id: string): void;
|
package/dist/variables.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables.d.ts","names":[],"sources":["../src/variables.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"variables.d.ts","names":[],"sources":["../src/variables.ts"],"mappings":";;;;iBAQgB,YAAY,OAAO,YAAY,UAAU;iBAQzC,eAAe,OAAO,YAAY;iBAoBlC,cAAc,OAAO,YAAY,YAAY;iBAe7C,eACd,OAAO,YACP,0BACA,cACA,MAAM,cACN,sBACA,QAAQ,gBACP;iBAsBa,iBACd,OAAO,YACP,0BACA,eACC;iBAca,iBAAiB,OAAO,YAAY;iBAWpC,gBAAgB,OAAO,YAAY;iBAOnC,sBACd,OAAO,YACP,gBACA;iBAWc,cAAc,OAAO,YAAY,sBAAsB;iBAIvD,QACd,OAAO,YACP,sBACA,gBACA,cACA;iBAec,WAAW,OAAO,YAAY,sBAAsB;iBAgBpD,WACd,OAAO,YACP,sBACA,gBACA;iBAQc,eAAe,OAAO,YAAY,sBAAsB;iBAOxD,gBACd,OAAO,YACP,oBACA,iBACA,UAAU,cACT;iBA0Ba,qBAAqB,OAAO,YAAY,qBAAqB;iBAM7D,sBAAsB,OAAO,YAAY;iBAKzC,4BACd,OAAO,YACP,gBACA,qBACC;iBASa,6BACd,OAAO,YACP,gBACA;iBASc,0BAA0B,OAAO,YAAY,uBAAuB;iBAQpE,mBAAmB,OAAO,YAAY,MAAM,eAAe;iBA0C3D,aACd,OAAO,YACP,gBACA,eACA;iBA0Dc,eAAe,OAAO,YAAY,gBAAgB"}
|
package/dist/variables.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { addCollection, addMode, addVariable, bindVariable, createCollection, createVariable, getActiveModeId, getNodeVariableModeId, getVariablesByType, getVariablesForCollection, removeCollection, removeMode, removeVariable, renameMode, resolveColorVariable, resolveColorVariableForNode, resolveNumberVariable, resolveNumberVariableForNode, resolveVariable, setActiveMode, setDefaultMode, unbindVariable } from "./
|
|
1
|
+
import { addCollection, addMode, addVariable, bindVariable, createCollection, createVariable, getActiveModeId, getNodeVariableModeId, getVariablesByType, getVariablesForCollection, removeCollection, removeMode, removeVariable, renameMode, resolveColorVariable, resolveColorVariableForNode, resolveNumberVariable, resolveNumberVariableForNode, resolveVariable, setActiveMode, setDefaultMode, unbindVariable } from "./chunks/index.js";
|
|
2
2
|
export { addCollection, addMode, addVariable, bindVariable, createCollection, createVariable, getActiveModeId, getNodeVariableModeId, getVariablesByType, getVariablesForCollection, removeCollection, removeMode, removeVariable, renameMode, resolveColorVariable, resolveColorVariableForNode, resolveNumberVariable, resolveNumberVariableForNode, resolveVariable, setActiveMode, setDefaultMode, unbindVariable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variant-name.d.ts","names":[],"sources":["../src/variant-name.ts"],"mappings":";iBAAgB,
|
|
1
|
+
{"version":3,"file":"variant-name.d.ts","names":[],"sources":["../src/variant-name.ts"],"mappings":";iBAAgB,iBAAiB,eAAe;iBAUhC,iBAAiB,QAAQ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentPropertyDefinition, SceneNode } from "./types.js";
|
|
2
|
+
//#region src/variant-properties.d.ts
|
|
3
|
+
interface DerivedVariantProperties {
|
|
4
|
+
definitions: ComponentPropertyDefinition[];
|
|
5
|
+
variants: Map<string, Pick<SceneNode, 'componentPropertyValues' | 'name'>>;
|
|
6
|
+
}
|
|
7
|
+
declare function deriveSlashVariantProperties(components: ReadonlyArray<Pick<SceneNode, 'id' | 'name'>>, createPropertyId: () => string): DerivedVariantProperties | null;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { DerivedVariantProperties, deriveSlashVariantProperties };
|
|
10
|
+
//# sourceMappingURL=variant-properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant-properties.d.ts","names":[],"sources":["../src/variant-properties.ts"],"mappings":";;UAEiB;EACf,aAAa;EACb,UAAU,YAAY,KAAK;;iBAGb,6BACd,YAAY,cAAc,KAAK,4BAC/B,iCACC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/variant-properties.ts
|
|
2
|
+
function deriveSlashVariantProperties(components, createPropertyId) {
|
|
3
|
+
const slashCounts = components.map((component) => (component.name.match(/\//g) ?? []).length);
|
|
4
|
+
const slashCount = slashCounts[0] ?? 0;
|
|
5
|
+
if (slashCount === 0 || !slashCounts.every((count) => count === slashCount)) return null;
|
|
6
|
+
const definitions = Array.from({ length: slashCount }, (_, index) => ({
|
|
7
|
+
id: createPropertyId(),
|
|
8
|
+
name: index === 0 ? "Variant" : `Property ${index + 1}`,
|
|
9
|
+
type: "VARIANT",
|
|
10
|
+
defaultValue: ""
|
|
11
|
+
}));
|
|
12
|
+
const options = new Map(definitions.map((definition) => [definition.name, /* @__PURE__ */ new Set()]));
|
|
13
|
+
const variants = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const component of components) {
|
|
15
|
+
const parts = component.name.split("/").slice(1);
|
|
16
|
+
const componentPropertyValues = {};
|
|
17
|
+
for (const [index, definition] of definitions.entries()) {
|
|
18
|
+
const value = parts[index]?.trim() ?? "";
|
|
19
|
+
componentPropertyValues[definition.name] = value;
|
|
20
|
+
options.get(definition.name)?.add(value);
|
|
21
|
+
}
|
|
22
|
+
variants.set(component.id, {
|
|
23
|
+
componentPropertyValues,
|
|
24
|
+
name: Object.values(componentPropertyValues).join(", ")
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
for (const definition of definitions) {
|
|
28
|
+
definition.variantOptions = [...options.get(definition.name) ?? []];
|
|
29
|
+
definition.defaultValue = definition.variantOptions[0] ?? "";
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
definitions,
|
|
33
|
+
variants
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { deriveSlashVariantProperties };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=variant-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant-properties.js","names":[],"sources":["../src/variant-properties.ts"],"sourcesContent":["import type { ComponentPropertyDefinition, SceneNode } from './types'\n\nexport interface DerivedVariantProperties {\n definitions: ComponentPropertyDefinition[]\n variants: Map<string, Pick<SceneNode, 'componentPropertyValues' | 'name'>>\n}\n\nexport function deriveSlashVariantProperties(\n components: ReadonlyArray<Pick<SceneNode, 'id' | 'name'>>,\n createPropertyId: () => string\n): DerivedVariantProperties | null {\n const slashCounts = components.map((component) => (component.name.match(/\\//g) ?? []).length)\n const slashCount = slashCounts[0] ?? 0\n if (slashCount === 0 || !slashCounts.every((count) => count === slashCount)) return null\n\n const definitions: ComponentPropertyDefinition[] = Array.from(\n { length: slashCount },\n (_, index) => ({\n id: createPropertyId(),\n name: index === 0 ? 'Variant' : `Property ${index + 1}`,\n type: 'VARIANT',\n defaultValue: ''\n })\n )\n const options = new Map(definitions.map((definition) => [definition.name, new Set<string>()]))\n const variants = new Map<string, Pick<SceneNode, 'componentPropertyValues' | 'name'>>()\n\n for (const component of components) {\n const parts = component.name.split('/').slice(1)\n const componentPropertyValues: Record<string, string> = {}\n for (const [index, definition] of definitions.entries()) {\n const value = parts[index]?.trim() ?? ''\n componentPropertyValues[definition.name] = value\n options.get(definition.name)?.add(value)\n }\n variants.set(component.id, {\n componentPropertyValues,\n name: Object.values(componentPropertyValues).join(', ')\n })\n }\n\n for (const definition of definitions) {\n definition.variantOptions = [...(options.get(definition.name) ?? [])]\n definition.defaultValue = definition.variantOptions[0] ?? ''\n }\n\n return { definitions, variants }\n}\n"],"mappings":";AAOA,SAAgB,6BACd,YACA,kBACiC;CACjC,MAAM,cAAc,WAAW,KAAK,eAAe,UAAU,KAAK,MAAM,KAAK,KAAK,CAAC,EAAA,CAAG,MAAM;CAC5F,MAAM,aAAa,YAAY,MAAM;CACrC,IAAI,eAAe,KAAK,CAAC,YAAY,OAAO,UAAU,UAAU,UAAU,GAAG,OAAO;CAEpF,MAAM,cAA6C,MAAM,KACvD,EAAE,QAAQ,WAAW,IACpB,GAAG,WAAW;EACb,IAAI,iBAAiB;EACrB,MAAM,UAAU,IAAI,YAAY,YAAY,QAAQ;EACpD,MAAM;EACN,cAAc;CAChB,EACF;CACA,MAAM,UAAU,IAAI,IAAI,YAAY,KAAK,eAAe,CAAC,WAAW,sBAAM,IAAI,IAAY,CAAC,CAAC,CAAC;CAC7F,MAAM,2BAAW,IAAI,IAAiE;CAEtF,KAAK,MAAM,aAAa,YAAY;EAClC,MAAM,QAAQ,UAAU,KAAK,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;EAC/C,MAAM,0BAAkD,CAAC;EACzD,KAAK,MAAM,CAAC,OAAO,eAAe,YAAY,QAAQ,GAAG;GACvD,MAAM,QAAQ,MAAM,MAAM,EAAE,KAAK,KAAK;GACtC,wBAAwB,WAAW,QAAQ;GAC3C,QAAQ,IAAI,WAAW,IAAI,CAAC,EAAE,IAAI,KAAK;EACzC;EACA,SAAS,IAAI,UAAU,IAAI;GACzB;GACA,MAAM,OAAO,OAAO,uBAAuB,CAAC,CAAC,KAAK,IAAI;EACxD,CAAC;CACH;CAEA,KAAK,MAAM,cAAc,aAAa;EACpC,WAAW,iBAAiB,CAAC,GAAI,QAAQ,IAAI,WAAW,IAAI,KAAK,CAAC,CAAE;EACpE,WAAW,eAAe,WAAW,eAAe,MAAM;CAC5D;CAEA,OAAO;EAAE;EAAa;CAAS;AACjC"}
|
package/dist/vector-network.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { cloneVectorNetwork, mergeVectorNetworks, normalizeVectorNetwork, transformVectorNetwork, validateVectorNetwork, vectorNetworksEqual } from "./chunks/
|
|
1
|
+
import { cloneVectorNetwork, mergeVectorNetworks, normalizeVectorNetwork, transformVectorNetwork, validateVectorNetwork, vectorNetworksEqual } from "./chunks/components/properties.js";
|
|
2
2
|
export { cloneVectorNetwork, mergeVectorNetworks, normalizeVectorNetwork, transformVectorNetwork, validateVectorNetwork, vectorNetworksEqual };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import { VectorNetwork } from "./types.js";
|
|
1
2
|
import { Mat3 } from "./matrix2.js";
|
|
2
|
-
import { VectorNetwork } from "./types2.js";
|
|
3
|
-
|
|
4
3
|
//#region src/vector-network.d.ts
|
|
5
4
|
/** Concatenate vector networks while preserving independent geometry. */
|
|
6
5
|
declare function mergeVectorNetworks(networks: readonly VectorNetwork[]): VectorNetwork;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-network2.d.ts","names":[],"sources":["../src/vector-network.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vector-network2.d.ts","names":[],"sources":["../src/vector-network.ts"],"mappings":";;;;iBAOgB,oBAAoB,mBAAmB,kBAAkB;;;;;;iBAuCzD,uBAAuB,GAAG,MAAM,IAAI,gBAAgB;;iBAwBpD,oBAAoB,GAAG,eAAe,GAAG;;iBASzC,mBAAmB,IAAI,gBAAgB;;;;;iBAmBvC,sBAAsB;KA6K1B,4BAA4B,KAAK;EAC3C,UAAU;;;;;;;iBAQI,uBAAuB,IAAI,4BAA4B"}
|