@pairdraw/pen 0.0.0-stage → 0.16.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Danila Poyarkov and OpenPencil contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,11 @@
1
- # Temporary Holding Version
1
+ # @pairdraw/pen
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Pencil.dev `.pen` document parser and SceneGraph adapter.
4
+
5
+ This package owns the `.pen` document model and import policy. It depends on `@pairdraw/scene-graph` for the shared editable design model and does not depend on `@pairdraw/core`.
6
+
7
+ pen.dev fields a layer has no field for (`context`, `metadata`, `placeholder`, `slot`, and what a `prompt` or `context` node was, with its `model`) are kept as shared plugin data under the `pen` namespace (`PEN_PLUGIN_DATA_NAMESPACE`), one JSON value per field, so agents can read them and a writer can write them back. Notes, prompts, and context nodes become sticky notes; `slot` frames inside components become slot properties suggesting the listed components.
8
+
9
+ `script` and `browser` nodes, which this reader does not run, become placeholder frames that keep their `scriptUri` and `inputs`, or their `url`, `deviceId`, `zoom`, and scroll, as plugin data, labelled with a text layer whose `generated` plugin data marks it as the reader's. A `ref` to a component that cannot be found becomes such a placeholder too, keeping the ID it names as `ref`.
10
+
11
+ Imports (`imports: { alias: path }`) are resolved by the host: `importedDocument` names a library's contents as the importing document does (`alias:id`, `$alias:variable`), and `buildPenGraph` takes the libraries as `imports`. The library components a document uses, and the ones they use, go on the hidden library definitions page as read-only library components (`librarySource` with library `pen:<alias>`), so instances of them are library instances; `withUsedImports` lists what they draw for `penAssets`. Core's `penFormat` opens imports through `ReadDocumentInput.openImport` and reports the ones it could not open as warnings.
@@ -0,0 +1,510 @@
1
+ import { generateId } from "@pairdraw/scene-graph";
2
+ import { parseColor } from "@pairdraw/scene-graph/color";
3
+ import { BLACK } from "@pairdraw/scene-graph/constants";
4
+ import { recordInstanceOverride } from "@pairdraw/scene-graph/instances";
5
+ import { fillSizingFields, parseAutoLayoutDirection } from "@pairdraw/scene-graph/layout";
6
+ import { DEFAULT_STICKY_COLOR, STICKY_COLORS, STICKY_SIZE, STICKY_WIDE_WIDTH, createSticky, stickyScale, stickySublayers, stickyWidth } from "@pairdraw/scene-graph/generated";
7
+ //#region src/variables.ts
8
+ function isVarRef(val) {
9
+ return typeof val === "string" && val.startsWith("$") && val.length > 1;
10
+ }
11
+ function varName(ref) {
12
+ return ref.slice(1);
13
+ }
14
+ function bindIfVar(node, field, val, ctx) {
15
+ if (!isVarRef(val)) return;
16
+ const variable = ctx.byName.get(varName(val));
17
+ if (variable) node.boundVariables[field] = variable.id;
18
+ }
19
+ /** A number, or the value of the number variable it references. */
20
+ function resolveNumber(value, ctx, fallback = 0) {
21
+ if (value === void 0) return fallback;
22
+ if (typeof value === "number") return value;
23
+ if (isVarRef(value)) return ctx.resolveNumber(value);
24
+ const parsed = Number(value);
25
+ return Number.isFinite(parsed) ? parsed : fallback;
26
+ }
27
+ /** A number, or the value of the number variable it references; nothing where there is none. */
28
+ function resolveOptionalNumber(value, ctx) {
29
+ if (value === void 0) return void 0;
30
+ if (typeof value === "number") return value;
31
+ if (isVarRef(value)) return ctx.numberValue(value);
32
+ const parsed = Number(value);
33
+ return Number.isFinite(parsed) ? parsed : void 0;
34
+ }
35
+ /** A boolean, or the value of the variable it references. */
36
+ function resolveBoolean(value, ctx, fallback = true) {
37
+ if (value === void 0) return fallback;
38
+ if (typeof value === "boolean") return value;
39
+ return isVarRef(value) ? ctx.resolveBoolean(value) : value !== "false";
40
+ }
41
+ /** A string, or the value of the string variable it references. */
42
+ function resolveString(value, ctx) {
43
+ return value !== void 0 && isVarRef(value) ? ctx.resolveString(value) : value;
44
+ }
45
+ /**
46
+ * Every value a field can take: the value itself, or the value its variable has in each theme,
47
+ * through aliases, with the empty value where a theme has none, as reading resolves it. For
48
+ * loading what a document may draw before it is read in a theme.
49
+ */
50
+ function possibleValues(value, doc) {
51
+ const themes = combinations(themeAxes(doc));
52
+ const found = /* @__PURE__ */ new Set();
53
+ const seen = /* @__PURE__ */ new Set();
54
+ const visit = (raw) => {
55
+ if (raw === void 0) return;
56
+ if (!isVarRef(raw)) {
57
+ found.add(String(raw));
58
+ return;
59
+ }
60
+ const name = varName(raw);
61
+ const definition = doc.variables?.[name];
62
+ if (!definition || seen.has(name)) return;
63
+ seen.add(name);
64
+ const empty = emptyValue(sceneType(definition.type));
65
+ for (const theme of themes) {
66
+ const themed = rawValue(definition, theme);
67
+ if (themed !== void 0) visit(themed);
68
+ else if (typeof empty !== "object") found.add(String(empty));
69
+ }
70
+ };
71
+ visit(value);
72
+ return [...found];
73
+ }
74
+ /** A colour, or the value of the colour variable it references. */
75
+ function resolveColor(value, ctx) {
76
+ return isVarRef(value) ? ctx.resolveColor(value) : parseColor(value);
77
+ }
78
+ function sceneType(type) {
79
+ if (type === "color") return "COLOR";
80
+ if (type === "number") return "FLOAT";
81
+ if (type === "boolean") return "BOOLEAN";
82
+ return "STRING";
83
+ }
84
+ /** pen.dev leaves a variable without a value in a theme no entry matches: black, zero, or empty. */
85
+ function emptyValue(type) {
86
+ if (type === "COLOR") return { ...BLACK };
87
+ if (type === "FLOAT") return 0;
88
+ if (type === "BOOLEAN") return false;
89
+ return "";
90
+ }
91
+ /** The document's theme axes that have values. */
92
+ function themeAxes(doc) {
93
+ return Object.entries(doc.themes ?? {}).filter(([, values]) => values.length > 0);
94
+ }
95
+ /** Every combination of one value per axis, the first values first. */
96
+ function combinations(axes) {
97
+ return axes.reduce((themes, [axis, values]) => themes.flatMap((theme) => values.map((value) => ({
98
+ ...theme,
99
+ [axis]: value
100
+ }))), [{}]);
101
+ }
102
+ /**
103
+ * A variable's raw value in a full theme. An entry applies when each of its axes has its value in
104
+ * the theme, and a later one replaces an earlier one, as pen.dev 2.21 resolves them.
105
+ */
106
+ function rawValue(definition, theme) {
107
+ if (!Array.isArray(definition.value)) return definition.value;
108
+ let found;
109
+ for (const entry of definition.value) if (Object.entries(entry.theme ?? {}).every(([axis, value]) => theme[axis] === value)) found = entry.value;
110
+ return found;
111
+ }
112
+ function sceneValue(raw, type, ids) {
113
+ if (raw === void 0) return emptyValue(type);
114
+ if (isVarRef(raw)) {
115
+ const aliasId = ids.get(varName(raw));
116
+ return aliasId ? { aliasId } : emptyValue(type);
117
+ }
118
+ if (type === "COLOR") return typeof raw === "string" ? parseColor(raw) : emptyValue(type);
119
+ if (type === "FLOAT") return typeof raw === "number" ? raw : Number(raw) || 0;
120
+ if (type === "BOOLEAN") return typeof raw === "boolean" ? raw : raw === "true";
121
+ return String(raw);
122
+ }
123
+ function themeKey(theme, axes) {
124
+ return axes.map(([axis]) => theme[axis]).join("\0");
125
+ }
126
+ function buildVarContext(graph, doc) {
127
+ const axes = themeAxes(doc);
128
+ const themes = combinations(axes);
129
+ const modes = themes.map((theme) => ({
130
+ modeId: generateId(),
131
+ name: axes.length === 0 ? "Default" : axes.map(([axis]) => theme[axis]).join(" / ")
132
+ }));
133
+ const modeByTheme = new Map(themes.map((theme, index) => [themeKey(theme, axes), modes[index]]));
134
+ const definitions = Object.entries(doc.variables ?? {});
135
+ const collectionId = generateId();
136
+ const hasCollection = definitions.length > 0 || axes.length > 0;
137
+ if (hasCollection) graph.addCollection({
138
+ id: collectionId,
139
+ name: axes.length === 1 ? axes[0][0] : "Theme",
140
+ modes,
141
+ defaultModeId: modes[0].modeId,
142
+ variableIds: []
143
+ });
144
+ const ids = new Map(definitions.map(([name]) => [name, generateId()]));
145
+ const byName = /* @__PURE__ */ new Map();
146
+ const byId = /* @__PURE__ */ new Map();
147
+ for (const [name, definition] of definitions) {
148
+ const type = sceneType(definition.type);
149
+ const variable = {
150
+ id: ids.get(name) ?? generateId(),
151
+ name,
152
+ type,
153
+ collectionId,
154
+ valuesByMode: Object.fromEntries(themes.map((theme, index) => [modes[index].modeId, sceneValue(rawValue(definition, theme), type, ids)])),
155
+ description: "",
156
+ hiddenFromPublishing: false
157
+ };
158
+ graph.addVariable(variable);
159
+ byName.set(name, variable);
160
+ byId.set(variable.id, variable);
161
+ }
162
+ let current = themes[0];
163
+ const modeId = () => modeByTheme.get(themeKey(current, axes))?.modeId ?? modes[0].modeId;
164
+ /** A variable's value in the current theme, following aliases. */
165
+ function resolve(ref) {
166
+ let variable = byName.get(varName(ref));
167
+ for (let hops = 0; variable && hops <= byName.size; hops++) {
168
+ const value = variable.valuesByMode[modeId()];
169
+ if (typeof value !== "object" || !("aliasId" in value)) return value;
170
+ variable = byId.get(value.aliasId);
171
+ }
172
+ }
173
+ return {
174
+ collectionId: hasCollection ? collectionId : null,
175
+ byName,
176
+ resolveColor(ref) {
177
+ const value = resolve(ref);
178
+ return typeof value === "object" && "r" in value ? value : { ...BLACK };
179
+ },
180
+ resolveNumber(ref) {
181
+ return this.numberValue(ref) ?? 0;
182
+ },
183
+ numberValue(ref) {
184
+ const value = resolve(ref);
185
+ return typeof value === "number" ? value : void 0;
186
+ },
187
+ resolveString(ref) {
188
+ const value = resolve(ref);
189
+ return typeof value === "string" ? value : "";
190
+ },
191
+ resolveBoolean(ref) {
192
+ const value = resolve(ref);
193
+ return typeof value === "boolean" ? value : value !== void 0 && value !== "false";
194
+ },
195
+ enterTheme(theme) {
196
+ const outer = current;
197
+ const known = Object.entries(theme).filter(([axis, value]) => axes.some(([name, values]) => name === axis && values.includes(value)));
198
+ current = {
199
+ ...outer,
200
+ ...Object.fromEntries(known)
201
+ };
202
+ return () => {
203
+ current = outer;
204
+ };
205
+ },
206
+ modeId
207
+ };
208
+ }
209
+ //#endregion
210
+ //#region src/plugin-data.ts
211
+ /**
212
+ * The shared plugin data namespace that keeps the pen.dev fields a layer has no field for, so
213
+ * agents can read them with `getSharedPluginData('pen', key)` and a `.pen` writer can write them
214
+ * back. Each value is its field's JSON.
215
+ */
216
+ const PEN_PLUGIN_DATA_NAMESPACE = "pen";
217
+ /**
218
+ * The pen.dev fields kept as plugin data: notes for agents (`context`, `metadata`), the frame an
219
+ * agent is working on (`placeholder`), the components suggested for a slot (`slot`), and what a
220
+ * `prompt` or `context` node was, with the model a prompt asks. A `script` or `browser` node, which
221
+ * reads as a placeholder frame, keeps its file and inputs or its page and view; a `ref` whose
222
+ * component could not be found keeps the ID it names; and a label a placeholder was given says so.
223
+ */
224
+ const PEN_PLUGIN_DATA_KEYS = [
225
+ "type",
226
+ "ref",
227
+ "context",
228
+ "metadata",
229
+ "placeholder",
230
+ "slot",
231
+ "model",
232
+ "scriptUri",
233
+ "inputs",
234
+ "url",
235
+ "deviceId",
236
+ "zoom",
237
+ "scrollX",
238
+ "scrollY",
239
+ "generated"
240
+ ];
241
+ /** Node types kept as plugin data on the layer they become. */
242
+ const KEPT_TYPES = /* @__PURE__ */ new Set([
243
+ "prompt",
244
+ "context",
245
+ "script",
246
+ "browser"
247
+ ]);
248
+ /**
249
+ * The field a `ref` whose component is missing reads with, holding the ID it names: the layer is a
250
+ * placeholder frame, and keeps being a `ref` as plugin data.
251
+ */
252
+ const UNRESOLVED_REF = "unresolvedRef";
253
+ /** The ID a placeholder for a missing component names, or undefined for any other layer. */
254
+ function unresolvedRef(pen) {
255
+ const ref = pen[UNRESOLVED_REF];
256
+ return typeof ref === "string" ? ref : void 0;
257
+ }
258
+ /** As `setSharedPluginData` stores an entry, so the Figma API reads and replaces it. */
259
+ function entry(key, value) {
260
+ return {
261
+ pluginId: "pen",
262
+ key: `pen/${key}`,
263
+ value: JSON.stringify(value)
264
+ };
265
+ }
266
+ function penEntries(pen) {
267
+ const missing = unresolvedRef(pen);
268
+ return PEN_PLUGIN_DATA_KEYS.flatMap((key) => {
269
+ if (key === "type") {
270
+ if (missing !== void 0) return [entry(key, "ref")];
271
+ return KEPT_TYPES.has(pen.type) ? [entry(key, pen.type)] : [];
272
+ }
273
+ if (key === "ref") return missing === void 0 ? [] : [entry(key, missing)];
274
+ const value = pen[key];
275
+ return value === void 0 ? [] : [entry(key, value)];
276
+ });
277
+ }
278
+ /**
279
+ * Replaces the layer's pen.dev plugin data with the fields `pen` carries, keeping every other
280
+ * entry, so applying a layer's fields again with an override's merged in leaves one of each.
281
+ */
282
+ function applyPenPluginData(node, pen) {
283
+ const others = node.pluginData.filter((item) => item.pluginId !== "pen");
284
+ const own = penEntries(pen);
285
+ if (own.length === 0 && others.length === node.pluginData.length) return;
286
+ node.pluginData = [...others, ...own];
287
+ }
288
+ //#endregion
289
+ //#region src/layout.ts
290
+ const CORNERS = [
291
+ "topLeftRadius",
292
+ "topRightRadius",
293
+ "bottomRightRadius",
294
+ "bottomLeftRadius"
295
+ ];
296
+ const PADDING = [
297
+ "paddingTop",
298
+ "paddingRight",
299
+ "paddingBottom",
300
+ "paddingLeft"
301
+ ];
302
+ function applyCornerRadius(node, radius, ctx) {
303
+ if (radius === void 0) return;
304
+ if (Array.isArray(radius)) {
305
+ node.independentCorners = true;
306
+ for (const [index, field] of CORNERS.entries()) {
307
+ node[field] = resolveNumber(radius[index], ctx);
308
+ bindIfVar(node, field, radius[index], ctx);
309
+ }
310
+ return;
311
+ }
312
+ node.cornerRadius = resolveNumber(radius, ctx);
313
+ bindIfVar(node, "cornerRadius", radius, ctx);
314
+ }
315
+ /** pen.dev padding: one value, vertical and horizontal, or top, right, bottom, and left. */
316
+ function paddingSides(padding) {
317
+ if (!Array.isArray(padding)) return [
318
+ padding,
319
+ padding,
320
+ padding,
321
+ padding
322
+ ];
323
+ if (padding.length === 2) return [
324
+ padding[0],
325
+ padding[1],
326
+ padding[0],
327
+ padding[1]
328
+ ];
329
+ return padding;
330
+ }
331
+ function applyPadding(node, padding, ctx) {
332
+ if (padding === void 0) return;
333
+ const sides = paddingSides(padding);
334
+ for (const [index, field] of PADDING.entries()) {
335
+ node[field] = resolveNumber(sides[index], ctx);
336
+ bindIfVar(node, field, sides[index], ctx);
337
+ }
338
+ }
339
+ function parseParameterizedFallback(value, behavior) {
340
+ const prefix = `${behavior}(`;
341
+ if (!value.startsWith(prefix) || !value.endsWith(")")) return void 0;
342
+ const rawFallback = value.slice(prefix.length, -1).trim();
343
+ if (rawFallback === "") return void 0;
344
+ const parsedFallback = Number(rawFallback);
345
+ return Number.isFinite(parsedFallback) ? parsedFallback : void 0;
346
+ }
347
+ function parseSizingBehavior(value, fallback) {
348
+ if (value === "fill_container") return {
349
+ value: fallback,
350
+ sizing: "FILL"
351
+ };
352
+ if (value === "fit_content") return {
353
+ value: fallback,
354
+ sizing: "HUG"
355
+ };
356
+ if (value === "hug_content") return {
357
+ value: fallback,
358
+ sizing: "HUG"
359
+ };
360
+ const fillFallback = parseParameterizedFallback(value, "fill_container");
361
+ if (fillFallback !== void 0) return {
362
+ value: fillFallback,
363
+ sizing: "FILL"
364
+ };
365
+ const fitFallback = parseParameterizedFallback(value, "fit_content") ?? parseParameterizedFallback(value, "hug_content");
366
+ if (fitFallback !== void 0) return {
367
+ value: fitFallback,
368
+ sizing: "HUG",
369
+ fitContentFallback: fitFallback
370
+ };
371
+ }
372
+ function parseSize(value, fallback, ctx) {
373
+ if (value === void 0) return {
374
+ value: fallback,
375
+ sizing: "FIXED"
376
+ };
377
+ if (typeof value === "number") return {
378
+ value,
379
+ sizing: "FIXED"
380
+ };
381
+ const behavior = parseSizingBehavior(value, fallback);
382
+ if (behavior) return behavior;
383
+ if (isVarRef(value) && ctx) return {
384
+ value: ctx.resolveNumber(value),
385
+ sizing: "FIXED"
386
+ };
387
+ const parsed = Number(value);
388
+ return {
389
+ value: Number.isFinite(parsed) ? parsed : fallback,
390
+ sizing: "FIXED"
391
+ };
392
+ }
393
+ function mapLayoutMode(pen) {
394
+ const direction = parseAutoLayoutDirection(pen.layout);
395
+ if (direction) return direction;
396
+ return pen.type === "frame" && pen.layout === void 0 ? "HORIZONTAL" : "NONE";
397
+ }
398
+ /** pen.dev's main axis alignments. */
399
+ const JUSTIFY_CONTENT = {
400
+ start: "MIN",
401
+ center: "CENTER",
402
+ end: "MAX",
403
+ space_between: "SPACE_BETWEEN",
404
+ space_around: "SPACE_AROUND"
405
+ };
406
+ const ALIGN_ITEMS = {
407
+ start: "MIN",
408
+ center: "CENTER",
409
+ end: "MAX"
410
+ };
411
+ function mapJustifyContent(value) {
412
+ return JUSTIFY_CONTENT[value ?? "start"] ?? "MIN";
413
+ }
414
+ function mapAlignItems(value) {
415
+ return ALIGN_ITEMS[value ?? "start"] ?? "MIN";
416
+ }
417
+ //#endregion
418
+ //#region src/annotations.ts
419
+ /**
420
+ * pen.dev's text annotations: a `note`, a `prompt` for an agent, and a `context` note about the
421
+ * layers around it. Each becomes a sticky note holding its text, in the colour nearest the one
422
+ * pen.dev draws its card in; a prompt and a context note keep what they were as plugin data.
423
+ */
424
+ const ANNOTATION_COLORS = {
425
+ note: STICKY_COLORS.yellow,
426
+ prompt: STICKY_COLORS.blue,
427
+ context: STICKY_COLORS.gray
428
+ };
429
+ function isAnnotation(pen) {
430
+ return Object.hasOwn(ANNOTATION_COLORS, pen.type);
431
+ }
432
+ /** pen.dev cards smaller or larger than this stay readable as sticky notes at its bounds. */
433
+ const MIN_SCALE = .25;
434
+ const MAX_SCALE = 4;
435
+ /**
436
+ * The note's shape and scale: wide when the card is nearer FigJam's wide width than its square
437
+ * one, and its text scaled to the card's width. The card's box itself comes from `applyAnnotation`.
438
+ */
439
+ function stickyShape(pen, build) {
440
+ const { value, sizing } = parseSize(pen.width, STICKY_SIZE, build.ctx);
441
+ const width = sizing === "FIXED" && value > 0 ? value : STICKY_SIZE;
442
+ const wide = width > (STICKY_SIZE + STICKY_WIDE_WIDTH) / 2;
443
+ return {
444
+ wide,
445
+ scale: Math.min(MAX_SCALE, Math.max(MIN_SCALE, width / stickyWidth(1, wide)))
446
+ };
447
+ }
448
+ /**
449
+ * The sticky's size fields, so it takes the room in a layout pen.dev's card does: a fixed width
450
+ * and height keep the card's box, filling follows its parent's flow, and a card with no height or
451
+ * one that fits its content grows to its text as a sticky does.
452
+ */
453
+ function annotationSizeFields(node, pen, build, flowLayout) {
454
+ const width = parseSize(pen.width, node.width, build.ctx);
455
+ const height = parseSize(pen.height, node.height, build.ctx);
456
+ const fixedHeight = pen.height !== void 0 && height.sizing !== "HUG";
457
+ const fields = {
458
+ width: width.sizing === "HUG" ? node.width : width.value,
459
+ height: fixedHeight ? height.value : node.height,
460
+ primaryAxisSizing: fixedHeight ? "FIXED" : "HUG",
461
+ minHeight: fixedHeight ? null : height.fitContentFallback ?? STICKY_SIZE * stickyScale(stickySublayers(build.graph, node)?.author),
462
+ layoutGrow: 0,
463
+ layoutAlignSelf: "AUTO"
464
+ };
465
+ if (flowLayout === "NONE") return fields;
466
+ if (width.sizing === "FILL") Object.assign(fields, fillSizingFields(flowLayout, "HORIZONTAL"));
467
+ if (height.sizing === "FILL") Object.assign(fields, fillSizingFields(flowLayout, "VERTICAL"));
468
+ return fields;
469
+ }
470
+ /** A sticky note for an annotation, with its sublayers; its fields come from `applyAnnotation`. */
471
+ function createAnnotation(pen, parentId, build) {
472
+ return createSticky(build.graph, parentId, {
473
+ authorVisible: false,
474
+ color: ANNOTATION_COLORS[pen.type] ?? DEFAULT_STICKY_COLOR,
475
+ ...stickyShape(pen, build)
476
+ }, { id: pen.id });
477
+ }
478
+ /**
479
+ * Sets the fields a sticky note takes from an annotation: where it is, its box, whether it shows,
480
+ * and its text. A sticky note keeps its own style and upright placement, as FigJam draws one.
481
+ */
482
+ function applyAnnotation(node, pen, build) {
483
+ const { graph, ctx } = build;
484
+ const parentLayout = node.parentId && graph.getNode(node.parentId)?.layoutMode || "NONE";
485
+ const absolute = pen.layoutPosition === "absolute" && parentLayout !== "NONE";
486
+ Object.assign(node, {
487
+ name: pen.name ?? pen.type,
488
+ x: pen.x ?? 0,
489
+ y: pen.y ?? 0,
490
+ visible: resolveBoolean(pen.enabled, ctx),
491
+ opacity: resolveNumber(pen.opacity, ctx, 1),
492
+ layoutPositioning: absolute ? "ABSOLUTE" : "AUTO",
493
+ ...annotationSizeFields(node, pen, build, absolute ? "NONE" : parentLayout)
494
+ });
495
+ bindIfVar(node, "width", pen.width, ctx);
496
+ bindIfVar(node, "height", pen.height, ctx);
497
+ build.placements.delete(node.id);
498
+ const body = stickySublayers(graph, node)?.body;
499
+ const text = pen.content ?? "";
500
+ if (body && body.text !== text) {
501
+ body.text = text;
502
+ recordInstanceOverride(graph, body.id, ["text"]);
503
+ }
504
+ applyPenPluginData(node, pen);
505
+ build.effective.set(node.id, pen);
506
+ }
507
+ //#endregion
508
+ export { PEN_PLUGIN_DATA_NAMESPACE, UNRESOLVED_REF, applyAnnotation, applyCornerRadius, applyPadding, applyPenPluginData, bindIfVar, buildVarContext, createAnnotation, isAnnotation, isVarRef, mapAlignItems, mapJustifyContent, mapLayoutMode, parseSize, possibleValues, resolveBoolean, resolveColor, resolveNumber, resolveOptionalNumber, resolveString, unresolvedRef };
509
+
510
+ //# sourceMappingURL=annotations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotations.js","names":[],"sources":["../../src/variables.ts","../../src/plugin-data.ts","../../src/layout.ts","../../src/annotations.ts"],"sourcesContent":["import {\n generateId,\n type SceneGraph,\n type SceneNode,\n type Variable,\n type VariableCollectionMode,\n type VariableType,\n type VariableValue\n} from '@pairdraw/scene-graph'\nimport { parseColor } from '@pairdraw/scene-graph/color'\nimport { BLACK } from '@pairdraw/scene-graph/constants'\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport type { PenDocument, PenNumber, PenVariable, PenVariableScalar } from './schema'\n\ntype Theme = Record<string, string>\n\n/**\n * A document's variables, resolved in the theme of the layer being read. pen.dev themes are axes,\n * such as `mode` and `density`, each with its values; every combination of one value per axis is\n * one mode of a single collection, since a variable can depend on several axes at once.\n */\nexport interface VarContext {\n /** The collection the document's variables and themes make, or `null` when it has neither. */\n collectionId: string | null\n byName: Map<string, Variable>\n resolveColor(ref: string): Color\n resolveNumber(ref: string): number\n /** The number the variable holds, or nothing when it holds none. */\n numberValue(ref: string): number | undefined\n resolveString(ref: string): string\n resolveBoolean(ref: string): boolean\n /** Merges a layer's theme over its parent's until the returned function is called. */\n enterTheme(theme: Theme): () => void\n /** The mode of the theme being read. */\n modeId(): string\n}\n\nexport function isVarRef(val: unknown): val is `$${string}` {\n return typeof val === 'string' && val.startsWith('$') && val.length > 1\n}\n\nfunction varName(ref: string): string {\n return ref.slice(1)\n}\n\nexport function bindIfVar(node: SceneNode, field: string, val: unknown, ctx: VarContext): void {\n if (!isVarRef(val)) return\n const variable = ctx.byName.get(varName(val))\n if (variable) node.boundVariables[field] = variable.id\n}\n\n/** A number, or the value of the number variable it references. */\nexport function resolveNumber(value: PenNumber | undefined, ctx: VarContext, fallback = 0): number {\n if (value === undefined) return fallback\n if (typeof value === 'number') return value\n if (isVarRef(value)) return ctx.resolveNumber(value)\n const parsed = Number(value)\n return Number.isFinite(parsed) ? parsed : fallback\n}\n\n/** A number, or the value of the number variable it references; nothing where there is none. */\nexport function resolveOptionalNumber(\n value: PenNumber | undefined,\n ctx: VarContext\n): number | undefined {\n if (value === undefined) return undefined\n if (typeof value === 'number') return value\n if (isVarRef(value)) return ctx.numberValue(value)\n const parsed = Number(value)\n return Number.isFinite(parsed) ? parsed : undefined\n}\n\n/** A boolean, or the value of the variable it references. */\nexport function resolveBoolean(\n value: boolean | string | undefined,\n ctx: VarContext,\n fallback = true\n): boolean {\n if (value === undefined) return fallback\n if (typeof value === 'boolean') return value\n return isVarRef(value) ? ctx.resolveBoolean(value) : value !== 'false'\n}\n\n/** A string, or the value of the string variable it references. */\nexport function resolveString(value: string | undefined, ctx: VarContext): string | undefined {\n return value !== undefined && isVarRef(value) ? ctx.resolveString(value) : value\n}\n\n/**\n * Every value a field can take: the value itself, or the value its variable has in each theme,\n * through aliases, with the empty value where a theme has none, as reading resolves it. For\n * loading what a document may draw before it is read in a theme.\n */\nexport function possibleValues(value: string | undefined, doc: PenDocument): string[] {\n const themes = combinations(themeAxes(doc))\n const found = new Set<string>()\n const seen = new Set<string>()\n const visit = (raw: PenVariableScalar | undefined) => {\n if (raw === undefined) return\n if (!isVarRef(raw)) {\n found.add(String(raw))\n return\n }\n const name = varName(raw)\n const definition = doc.variables?.[name]\n if (!definition || seen.has(name)) return\n seen.add(name)\n const empty = emptyValue(sceneType(definition.type))\n for (const theme of themes) {\n const themed = rawValue(definition, theme)\n if (themed !== undefined) visit(themed)\n else if (typeof empty !== 'object') found.add(String(empty))\n }\n }\n visit(value)\n return [...found]\n}\n\n/** A colour, or the value of the colour variable it references. */\nexport function resolveColor(value: string, ctx: VarContext): Color {\n return isVarRef(value) ? ctx.resolveColor(value) : parseColor(value)\n}\n\nfunction sceneType(type: string): VariableType {\n if (type === 'color') return 'COLOR'\n if (type === 'number') return 'FLOAT'\n if (type === 'boolean') return 'BOOLEAN'\n return 'STRING'\n}\n\n/** pen.dev leaves a variable without a value in a theme no entry matches: black, zero, or empty. */\nfunction emptyValue(type: VariableType): VariableValue {\n if (type === 'COLOR') return { ...BLACK }\n if (type === 'FLOAT') return 0\n if (type === 'BOOLEAN') return false\n return ''\n}\n\ntype Axis = [name: string, values: string[]]\n\n/** The document's theme axes that have values. */\nfunction themeAxes(doc: PenDocument): Axis[] {\n return Object.entries(doc.themes ?? {}).filter(([, values]) => values.length > 0)\n}\n\n/** Every combination of one value per axis, the first values first. */\nfunction combinations(axes: Axis[]): Theme[] {\n return axes.reduce<Theme[]>(\n (themes, [axis, values]) =>\n themes.flatMap((theme) => values.map((value) => ({ ...theme, [axis]: value }))),\n [{}]\n )\n}\n\n/**\n * A variable's raw value in a full theme. An entry applies when each of its axes has its value in\n * the theme, and a later one replaces an earlier one, as pen.dev 2.21 resolves them.\n */\nfunction rawValue(definition: PenVariable, theme: Theme): PenVariableScalar | undefined {\n if (!Array.isArray(definition.value)) return definition.value\n let found: PenVariableScalar | undefined\n for (const entry of definition.value) {\n const entryTheme = Object.entries(entry.theme ?? {})\n if (entryTheme.every(([axis, value]) => theme[axis] === value)) found = entry.value\n }\n return found\n}\n\nfunction sceneValue(\n raw: PenVariableScalar | undefined,\n type: VariableType,\n ids: ReadonlyMap<string, string>\n): VariableValue {\n if (raw === undefined) return emptyValue(type)\n if (isVarRef(raw)) {\n const aliasId = ids.get(varName(raw))\n return aliasId ? { aliasId } : emptyValue(type)\n }\n if (type === 'COLOR') return typeof raw === 'string' ? parseColor(raw) : emptyValue(type)\n if (type === 'FLOAT') return typeof raw === 'number' ? raw : Number(raw) || 0\n if (type === 'BOOLEAN') return typeof raw === 'boolean' ? raw : raw === 'true'\n return String(raw)\n}\n\nfunction themeKey(theme: Theme, axes: Axis[]): string {\n return axes.map(([axis]) => theme[axis]).join('\\u0000')\n}\n\nexport function buildVarContext(graph: SceneGraph, doc: PenDocument): VarContext {\n const axes = themeAxes(doc)\n const themes = combinations(axes)\n const modes: VariableCollectionMode[] = themes.map((theme) => ({\n modeId: generateId(),\n name: axes.length === 0 ? 'Default' : axes.map(([axis]) => theme[axis]).join(' / ')\n }))\n const modeByTheme = new Map(themes.map((theme, index) => [themeKey(theme, axes), modes[index]]))\n const definitions = Object.entries(doc.variables ?? {})\n const collectionId = generateId()\n // A document with neither variables nor themes, such as a new one, gets no empty collection.\n const hasCollection = definitions.length > 0 || axes.length > 0\n if (hasCollection) {\n graph.addCollection({\n id: collectionId,\n name: axes.length === 1 ? axes[0][0] : 'Theme',\n modes,\n defaultModeId: modes[0].modeId,\n variableIds: []\n })\n }\n\n const ids = new Map(definitions.map(([name]) => [name, generateId()]))\n const byName = new Map<string, Variable>()\n const byId = new Map<string, Variable>()\n for (const [name, definition] of definitions) {\n const type = sceneType(definition.type)\n const variable: Variable = {\n id: ids.get(name) ?? generateId(),\n name,\n type,\n collectionId,\n valuesByMode: Object.fromEntries(\n themes.map((theme, index) => [\n modes[index].modeId,\n sceneValue(rawValue(definition, theme), type, ids)\n ])\n ),\n description: '',\n hiddenFromPublishing: false\n }\n graph.addVariable(variable)\n byName.set(name, variable)\n byId.set(variable.id, variable)\n }\n\n let current: Theme = themes[0]\n const modeId = () => modeByTheme.get(themeKey(current, axes))?.modeId ?? modes[0].modeId\n\n /** A variable's value in the current theme, following aliases. */\n function resolve(ref: string): VariableValue | undefined {\n let variable = byName.get(varName(ref))\n for (let hops = 0; variable && hops <= byName.size; hops++) {\n const value = variable.valuesByMode[modeId()]\n if (typeof value !== 'object' || !('aliasId' in value)) return value\n variable = byId.get(value.aliasId)\n }\n return undefined\n }\n\n return {\n collectionId: hasCollection ? collectionId : null,\n byName,\n resolveColor(ref) {\n const value = resolve(ref)\n return typeof value === 'object' && 'r' in value ? value : { ...BLACK }\n },\n resolveNumber(ref) {\n return this.numberValue(ref) ?? 0\n },\n numberValue(ref) {\n const value = resolve(ref)\n return typeof value === 'number' ? value : undefined\n },\n resolveString(ref) {\n const value = resolve(ref)\n return typeof value === 'string' ? value : ''\n },\n resolveBoolean(ref) {\n const value = resolve(ref)\n return typeof value === 'boolean' ? value : value !== undefined && value !== 'false'\n },\n enterTheme(theme) {\n const outer = current\n const known = Object.entries(theme).filter(([axis, value]) =>\n axes.some(([name, values]) => name === axis && values.includes(value))\n )\n current = { ...outer, ...Object.fromEntries(known) }\n return () => {\n current = outer\n }\n },\n modeId\n }\n}\n","import type { PluginDataEntry, SceneNode } from '@pairdraw/scene-graph'\n\nimport type { PenNode, PenOverride } from './schema'\n\n/**\n * The shared plugin data namespace that keeps the pen.dev fields a layer has no field for, so\n * agents can read them with `getSharedPluginData('pen', key)` and a `.pen` writer can write them\n * back. Each value is its field's JSON.\n */\nexport const PEN_PLUGIN_DATA_NAMESPACE = 'pen'\n\n/**\n * The pen.dev fields kept as plugin data: notes for agents (`context`, `metadata`), the frame an\n * agent is working on (`placeholder`), the components suggested for a slot (`slot`), and what a\n * `prompt` or `context` node was, with the model a prompt asks. A `script` or `browser` node, which\n * reads as a placeholder frame, keeps its file and inputs or its page and view; a `ref` whose\n * component could not be found keeps the ID it names; and a label a placeholder was given says so.\n */\nconst PEN_PLUGIN_DATA_KEYS = [\n 'type',\n 'ref',\n 'context',\n 'metadata',\n 'placeholder',\n 'slot',\n 'model',\n 'scriptUri',\n 'inputs',\n 'url',\n 'deviceId',\n 'zoom',\n 'scrollX',\n 'scrollY',\n 'generated'\n] as const\n\ntype PenPluginDataKey = (typeof PEN_PLUGIN_DATA_KEYS)[number]\n\n/** Node types kept as plugin data on the layer they become. */\nconst KEPT_TYPES: ReadonlySet<string> = new Set(['prompt', 'context', 'script', 'browser'])\n\n/**\n * The field a `ref` whose component is missing reads with, holding the ID it names: the layer is a\n * placeholder frame, and keeps being a `ref` as plugin data.\n */\nexport const UNRESOLVED_REF = 'unresolvedRef'\n\n/** The ID a placeholder for a missing component names, or undefined for any other layer. */\nexport function unresolvedRef(pen: PenOverride): string | undefined {\n const ref = pen[UNRESOLVED_REF]\n return typeof ref === 'string' ? ref : undefined\n}\n\n/** As `setSharedPluginData` stores an entry, so the Figma API reads and replaces it. */\nfunction entry(key: PenPluginDataKey, value: unknown): PluginDataEntry {\n return {\n pluginId: PEN_PLUGIN_DATA_NAMESPACE,\n key: `${PEN_PLUGIN_DATA_NAMESPACE}/${key}`,\n value: JSON.stringify(value)\n }\n}\n\nfunction penEntries(pen: PenNode): PluginDataEntry[] {\n const missing = unresolvedRef(pen)\n return PEN_PLUGIN_DATA_KEYS.flatMap((key) => {\n if (key === 'type') {\n if (missing !== undefined) return [entry(key, 'ref')]\n return KEPT_TYPES.has(pen.type) ? [entry(key, pen.type)] : []\n }\n // A resolved `ref` is an instance, which says what it shows itself.\n if (key === 'ref') return missing === undefined ? [] : [entry(key, missing)]\n const value = pen[key]\n return value === undefined ? [] : [entry(key, value)]\n })\n}\n\n/**\n * Replaces the layer's pen.dev plugin data with the fields `pen` carries, keeping every other\n * entry, so applying a layer's fields again with an override's merged in leaves one of each.\n */\nexport function applyPenPluginData(node: SceneNode, pen: PenNode): void {\n const others = node.pluginData.filter((item) => item.pluginId !== PEN_PLUGIN_DATA_NAMESPACE)\n const own = penEntries(pen)\n if (own.length === 0 && others.length === node.pluginData.length) return\n node.pluginData = [...others, ...own]\n}\n","import type {\n LayoutAlign,\n LayoutCounterAlign,\n LayoutMode,\n LayoutSizing,\n SceneNode\n} from '@pairdraw/scene-graph'\nimport { parseAutoLayoutDirection } from '@pairdraw/scene-graph/layout'\n\nimport type { PenNode, PenNumber } from './schema'\nimport { bindIfVar, isVarRef, resolveNumber, type VarContext } from './variables'\n\nconst CORNERS = [\n 'topLeftRadius',\n 'topRightRadius',\n 'bottomRightRadius',\n 'bottomLeftRadius'\n] as const\nconst PADDING = ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'] as const\n\nexport function applyCornerRadius(\n node: SceneNode,\n radius: PenNode['cornerRadius'],\n ctx: VarContext\n): void {\n if (radius === undefined) return\n if (Array.isArray(radius)) {\n node.independentCorners = true\n for (const [index, field] of CORNERS.entries()) {\n node[field] = resolveNumber(radius[index], ctx)\n bindIfVar(node, field, radius[index], ctx)\n }\n return\n }\n node.cornerRadius = resolveNumber(radius, ctx)\n bindIfVar(node, 'cornerRadius', radius, ctx)\n}\n\n/** pen.dev padding: one value, vertical and horizontal, or top, right, bottom, and left. */\nfunction paddingSides(padding: NonNullable<PenNode['padding']>): PenNumber[] {\n if (!Array.isArray(padding)) return [padding, padding, padding, padding]\n if (padding.length === 2) return [padding[0], padding[1], padding[0], padding[1]]\n return padding\n}\n\nexport function applyPadding(node: SceneNode, padding: PenNode['padding'], ctx: VarContext): void {\n if (padding === undefined) return\n const sides = paddingSides(padding)\n for (const [index, field] of PADDING.entries()) {\n node[field] = resolveNumber(sides[index], ctx)\n bindIfVar(node, field, sides[index], ctx)\n }\n}\n\ninterface ParsedSize {\n value: number\n sizing: LayoutSizing\n /** Fallback used only when fit_content(N) has no children. */\n fitContentFallback?: number\n}\n\nfunction parseParameterizedFallback(value: string, behavior: string): number | undefined {\n const prefix = `${behavior}(`\n if (!value.startsWith(prefix) || !value.endsWith(')')) return undefined\n\n const rawFallback = value.slice(prefix.length, -1).trim()\n if (rawFallback === '') return undefined\n\n const parsedFallback = Number(rawFallback)\n return Number.isFinite(parsedFallback) ? parsedFallback : undefined\n}\n\nfunction parseSizingBehavior(value: string, fallback: number): ParsedSize | undefined {\n if (value === 'fill_container') return { value: fallback, sizing: 'FILL' }\n if (value === 'fit_content') return { value: fallback, sizing: 'HUG' }\n\n // Older generated .pen files used hug_content as an alias for fit_content.\n if (value === 'hug_content') return { value: fallback, sizing: 'HUG' }\n\n const fillFallback = parseParameterizedFallback(value, 'fill_container')\n if (fillFallback !== undefined) return { value: fillFallback, sizing: 'FILL' }\n\n const fitFallback =\n parseParameterizedFallback(value, 'fit_content') ??\n parseParameterizedFallback(value, 'hug_content')\n if (fitFallback !== undefined) {\n return { value: fitFallback, sizing: 'HUG', fitContentFallback: fitFallback }\n }\n return undefined\n}\n\nexport function parseSize(\n value: number | string | undefined,\n fallback: number,\n ctx?: VarContext\n): ParsedSize {\n if (value === undefined) return { value: fallback, sizing: 'FIXED' }\n if (typeof value === 'number') return { value, sizing: 'FIXED' }\n\n const behavior = parseSizingBehavior(value, fallback)\n if (behavior) return behavior\n\n if (isVarRef(value) && ctx) return { value: ctx.resolveNumber(value), sizing: 'FIXED' }\n const parsed = Number(value)\n return { value: Number.isFinite(parsed) ? parsed : fallback, sizing: 'FIXED' }\n}\n\nexport function mapLayoutMode(pen: PenNode): LayoutMode {\n const direction = parseAutoLayoutDirection(pen.layout)\n if (direction) return direction\n return pen.type === 'frame' && pen.layout === undefined ? 'HORIZONTAL' : 'NONE'\n}\n\n/** pen.dev's main axis alignments. */\nconst JUSTIFY_CONTENT: Partial<Record<string, LayoutAlign>> = {\n start: 'MIN',\n center: 'CENTER',\n end: 'MAX',\n space_between: 'SPACE_BETWEEN',\n space_around: 'SPACE_AROUND'\n}\n\nconst ALIGN_ITEMS: Partial<Record<string, LayoutCounterAlign>> = {\n start: 'MIN',\n center: 'CENTER',\n end: 'MAX'\n}\n\nexport function mapJustifyContent(value: string | undefined): LayoutAlign {\n return JUSTIFY_CONTENT[value ?? 'start'] ?? 'MIN'\n}\n\nexport function mapAlignItems(value: string | undefined): LayoutCounterAlign {\n return ALIGN_ITEMS[value ?? 'start'] ?? 'MIN'\n}\n","import type { SceneNode } from '@pairdraw/scene-graph'\nimport {\n createSticky,\n DEFAULT_STICKY_COLOR,\n STICKY_COLORS,\n STICKY_SIZE,\n STICKY_WIDE_WIDTH,\n stickyScale,\n stickySublayers,\n stickyWidth\n} from '@pairdraw/scene-graph/generated'\nimport { recordInstanceOverride } from '@pairdraw/scene-graph/instances'\nimport { fillSizingFields } from '@pairdraw/scene-graph/layout'\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport { parseSize } from './layout'\nimport type { Build } from './nodes'\nimport { applyPenPluginData } from './plugin-data'\nimport type { PenNode } from './schema'\nimport { bindIfVar, resolveBoolean, resolveNumber } from './variables'\n\n/**\n * pen.dev's text annotations: a `note`, a `prompt` for an agent, and a `context` note about the\n * layers around it. Each becomes a sticky note holding its text, in the colour nearest the one\n * pen.dev draws its card in; a prompt and a context note keep what they were as plugin data.\n */\nconst ANNOTATION_COLORS: Readonly<Record<string, Color>> = {\n note: STICKY_COLORS.yellow,\n prompt: STICKY_COLORS.blue,\n context: STICKY_COLORS.gray\n}\n\nexport function isAnnotation(pen: Pick<PenNode, 'type'>): boolean {\n return Object.hasOwn(ANNOTATION_COLORS, pen.type)\n}\n\n/** pen.dev cards smaller or larger than this stay readable as sticky notes at its bounds. */\nconst MIN_SCALE = 0.25\nconst MAX_SCALE = 4\n\n/**\n * The note's shape and scale: wide when the card is nearer FigJam's wide width than its square\n * one, and its text scaled to the card's width. The card's box itself comes from `applyAnnotation`.\n */\nfunction stickyShape(pen: PenNode, build: Build): { wide: boolean; scale: number } {\n const { value, sizing } = parseSize(pen.width, STICKY_SIZE, build.ctx)\n const width = sizing === 'FIXED' && value > 0 ? value : STICKY_SIZE\n const wide = width > (STICKY_SIZE + STICKY_WIDE_WIDTH) / 2\n const scale = Math.min(MAX_SCALE, Math.max(MIN_SCALE, width / stickyWidth(1, wide)))\n return { wide, scale }\n}\n\n/**\n * The sticky's size fields, so it takes the room in a layout pen.dev's card does: a fixed width\n * and height keep the card's box, filling follows its parent's flow, and a card with no height or\n * one that fits its content grows to its text as a sticky does.\n */\nfunction annotationSizeFields(\n node: SceneNode,\n pen: PenNode,\n build: Build,\n flowLayout: SceneNode['layoutMode']\n): Partial<SceneNode> {\n const width = parseSize(pen.width, node.width, build.ctx)\n const height = parseSize(pen.height, node.height, build.ctx)\n const fixedHeight = pen.height !== undefined && height.sizing !== 'HUG'\n const fields: Partial<SceneNode> = {\n width: width.sizing === 'HUG' ? node.width : width.value,\n height: fixedHeight ? height.value : node.height,\n primaryAxisSizing: fixedHeight ? 'FIXED' : 'HUG',\n minHeight: fixedHeight\n ? null\n : (height.fitContentFallback ??\n STICKY_SIZE * stickyScale(stickySublayers(build.graph, node)?.author)),\n layoutGrow: 0,\n layoutAlignSelf: 'AUTO'\n }\n if (flowLayout === 'NONE') return fields\n if (width.sizing === 'FILL') Object.assign(fields, fillSizingFields(flowLayout, 'HORIZONTAL'))\n if (height.sizing === 'FILL') Object.assign(fields, fillSizingFields(flowLayout, 'VERTICAL'))\n return fields\n}\n\n/** A sticky note for an annotation, with its sublayers; its fields come from `applyAnnotation`. */\nexport function createAnnotation(pen: PenNode, parentId: string, build: Build): SceneNode {\n return createSticky(\n build.graph,\n parentId,\n {\n authorVisible: false,\n color: ANNOTATION_COLORS[pen.type] ?? DEFAULT_STICKY_COLOR,\n ...stickyShape(pen, build)\n },\n { id: pen.id }\n )\n}\n\n/**\n * Sets the fields a sticky note takes from an annotation: where it is, its box, whether it shows,\n * and its text. A sticky note keeps its own style and upright placement, as FigJam draws one.\n */\nexport function applyAnnotation(node: SceneNode, pen: PenNode, build: Build): void {\n const { graph, ctx } = build\n const parentLayout = (node.parentId && graph.getNode(node.parentId)?.layoutMode) || 'NONE'\n const absolute = pen.layoutPosition === 'absolute' && parentLayout !== 'NONE'\n Object.assign(node, {\n name: pen.name ?? pen.type,\n x: pen.x ?? 0,\n y: pen.y ?? 0,\n visible: resolveBoolean(pen.enabled, ctx),\n opacity: resolveNumber(pen.opacity, ctx, 1),\n layoutPositioning: absolute ? 'ABSOLUTE' : 'AUTO',\n ...annotationSizeFields(node, pen, build, absolute ? 'NONE' : parentLayout)\n } satisfies Partial<SceneNode>)\n bindIfVar(node, 'width', pen.width, ctx)\n bindIfVar(node, 'height', pen.height, ctx)\n build.placements.delete(node.id)\n\n const body = stickySublayers(graph, node)?.body\n const text = pen.content ?? ''\n if (body && body.text !== text) {\n body.text = text\n // A note inside an instance keeps the text an override gave it through the next sync.\n recordInstanceOverride(graph, body.id, ['text'])\n }\n applyPenPluginData(node, pen)\n build.effective.set(node.id, pen)\n}\n"],"mappings":";;;;;;;AAsCA,SAAgB,SAAS,KAAmC;CAC1D,OAAO,OAAO,QAAQ,YAAY,IAAI,WAAW,GAAG,KAAK,IAAI,SAAS;AACxE;AAEA,SAAS,QAAQ,KAAqB;CACpC,OAAO,IAAI,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