AI-native design editor. Open-source Figma alternative.
feat: open, paste, and save FigJam sticky notes (#1223)
Danila Poyarkov276dbc860947
diff --git a/changes/1223/added.md b/changes/1223/added.mdnew file mode 100644index 000000000..6e617b392--- /dev/null+++ b/changes/1223/added.md@@ -0,0 +1 @@+- FigJam sticky notes open from `.fig` files and paste from FigJam with their colour, text, author line, wide shape, and scale, and save back so Figma shows them as sticky notes (#1118).diff --git a/packages/core/src/clipboard/openpencil.ts b/packages/core/src/clipboard/openpencil.tsindex ad40fe721..9beaedc6b 100644--- a/packages/core/src/clipboard/openpencil.ts+++ b/packages/core/src/clipboard/openpencil.ts@@ -36,7 +36,8 @@ const NODE_TYPES: Record<NodeType, true> = {COMPONENT_SET: true,INSTANCE: true,CONNECTOR: true,- SHAPE_WITH_TEXT: true+ SHAPE_WITH_TEXT: true,+ STICKY: true}interface SerializedGeometryPath {diff --git a/packages/core/src/editor/components/slots/index.ts b/packages/core/src/editor/components/slots/index.tsindex 80b3680f2..4a52d82c3 100644--- a/packages/core/src/editor/components/slots/index.ts+++ b/packages/core/src/editor/components/slots/index.ts@@ -37,13 +37,13 @@ export function acceptsChildren(ctx: Pick<EditorContext, 'graph'>, parentId: strreturn slotScope(ctx.graph, parentId).kind !== 'locked'}-/** The parent itself, or the nearest one outside the locked part of an instance. */+/** The parent itself, or the nearest one outside the locked part of an instance or generated frame. */export function acceptingParent(ctx: Pick<EditorContext, 'graph'>, parentId: string): string {let id = parentIdfor (;;) {const scope = slotScope(ctx.graph, id)- if (scope.kind !== 'locked' || !scope.instance.parentId) return id- id = scope.instance.parentId+ if (scope.kind !== 'locked' || !scope.owner.parentId) return id+ id = scope.owner.parentId}}diff --git a/packages/core/src/editor/selection/navigation.ts b/packages/core/src/editor/selection/navigation.tsindex b76b0e812..a7b8e4b36 100644--- a/packages/core/src/editor/selection/navigation.ts+++ b/packages/core/src/editor/selection/navigation.ts@@ -1,3 +1,5 @@+import { generatedFrameOwner, isGeneratedFrame } from '@open-pencil/scene-graph'+import type { EditorContext } from '#core/editor/types'type Select = (ids: string[]) => void@@ -11,9 +13,14 @@ export function createSelectionNavigationActions(ctx: EditorContext, select: Sel})}- /** Selects the children of every selected layer that has any; a selection without any stays. */+ /**+ * Selects the children of every selected layer that has any; a selection without any stays.+ * A generated frame, such as a sticky note, has none to offer: its template owns its layers.+ */function selectChildren() {- const children = selectedNodes().flatMap((node) => node.childIds)+ const children = selectedNodes().flatMap((node) =>+ isGeneratedFrame(node) ? [] : node.childIds+ )if (children.length > 0) select(children)}@@ -36,6 +43,7 @@ export function createSelectionNavigationActions(ctx: EditorContext, select: Selif (nodes.length === 0) returnselect(nodes.map((node) => {+ if (generatedFrameOwner(ctx.graph, node)) return node.idconst siblings = node.parentId ? (ctx.graph.getNode(node.parentId)?.childIds ?? []) : []const index = siblings.indexOf(node.id)if (index === -1) return node.iddiff --git a/packages/core/src/io/formats/fig/export/patch/index.ts b/packages/core/src/io/formats/fig/export/patch/index.tsindex 14fdbe376..a1357cf98 100644--- a/packages/core/src/io/formats/fig/export/patch/index.ts+++ b/packages/core/src/io/formats/fig/export/patch/index.ts@@ -8,6 +8,7 @@ import { stringToGuid } from '@open-pencil/kiwi/fig/guid'import {computeImageHash,layersUsingVariables,+ isGeneratedFrame,ownsSlotContent,type SceneGraph,type SceneNode@@ -41,8 +42,8 @@ class UnpatchableChangeError extends Error {}/**- * The layer whose record holds a layer: itself, or the outermost instance it sits in, since an- * instance writes its contents as overrides and derived data on its own record.+ * The layer whose record holds a layer: itself, or the outermost instance or generated frame it+ * sits in, since both write their contents as overrides and derived data on their own record.*/function recordOwner(graph: SceneGraph, id: string): string | null {const start = graph.getNode(id)@@ -50,7 +51,7 @@ function recordOwner(graph: SceneGraph, id: string): string | null {let owner: SceneNode = startfor (let node: SceneNode | undefined = start; node;) {if (ownsSlotContent(graph, node)) throw new UnpatchableChangeError()- if (node.type === 'INSTANCE') owner = node+ if (node.type === 'INSTANCE' || isGeneratedFrame(node)) owner = nodeif (node.type === 'CANVAS') return owner.idnode = node.parentId ? graph.getNode(node.parentId) : undefined}diff --git a/packages/core/src/layout.ts b/packages/core/src/layout.tsindex 40adc24ad..7bab5b7c3 100644--- a/packages/core/src/layout.ts+++ b/packages/core/src/layout.ts@@ -35,6 +35,7 @@ export {type TextMeasurer} from './layout/text-measurement'import {+ isGeneratedFrame,layoutSizing,type LayoutSizing,type SceneGraph,@@ -208,7 +209,10 @@ function configureFlexContainer(yogaNode.setPadding(Edge.Bottom, node.paddingBottom)yogaNode.setPadding(Edge.Left, node.paddingLeft)- const primaryGap = node.primaryAxisAlign === 'SPACE_BETWEEN' ? 0 : node.itemSpacing+ // Space between takes the place of the gap in Figma's auto layout. A generated frame keeps it+ // as the least space between its sublayers, as a sticky note keeps its author clear of a long body.+ const primaryGap =+ node.primaryAxisAlign === 'SPACE_BETWEEN' && !isGeneratedFrame(node) ? 0 : node.itemSpacingyogaNode.setGap(Gutter.Column,node.layoutMode === 'HORIZONTAL' ? primaryGap : node.counterAxisSpacingdiff --git a/packages/core/tests/editor/clipboard/import-nodes/filtering.test.ts b/packages/core/tests/editor/clipboard/import-nodes/filtering.test.tsindex 5194bee56..19a0ffc2b 100644--- a/packages/core/tests/editor/clipboard/import-nodes/filtering.test.ts+++ b/packages/core/tests/editor/clipboard/import-nodes/filtering.test.ts@@ -89,7 +89,6 @@ describe('importClipboardNodes: filtering', () => {const nonVisualTypes = ['WIDGET','STAMP',- 'STICKY','CONNECTOR','CODE_BLOCK','SHAPE_WITH_TEXT',diff --git a/packages/core/tests/helpers/fig/fixtures.ts b/packages/core/tests/helpers/fig/fixtures.tsindex ebf72f089..dfcdb6853 100644--- a/packages/core/tests/helpers/fig/fixtures.ts+++ b/packages/core/tests/helpers/fig/fixtures.ts@@ -34,7 +34,8 @@ export const VALID_NODE_TYPES = new Set<string>(['INSTANCE','BOOLEAN_OPERATION','CONNECTOR',- 'SHAPE_WITH_TEXT'+ 'SHAPE_WITH_TEXT',+ 'STICKY'])/** Read a shared JSON fixture and validate it; a module import would escape the package root. */diff --git a/packages/core/tests/layout/generated/sticky.test.ts b/packages/core/tests/layout/generated/sticky.test.tsnew file mode 100644index 000000000..af375a66b--- /dev/null+++ b/packages/core/tests/layout/generated/sticky.test.ts@@ -0,0 +1,68 @@+import { afterEach, beforeEach, describe, expect, test } from 'bun:test'++import { computeAllLayouts, SceneGraph, setTextMeasurer } from '@open-pencil/core'+import { createSticky, stickySublayers } from '@open-pencil/scene-graph'++import { expectDefined } from '#core-tests/helpers/assert'++/** One line per line break, each as tall as the text's line height. */+function measureLines(): void {+ setTextMeasurer((node, maxWidth) => ({+ width: maxWidth ?? node.width,+ height: node.text.split('\n').length * (node.lineHeight ?? node.fontSize)+ }))+}++function lines(count: number): string {+ return Array.from({ length: count }, (_, index) => `line ${index + 1}`).join('\n')+}++beforeEach(measureLines)+afterEach(() => setTextMeasurer(null))++// Sizes measured in FigJam: a note keeps its width and grows to its text, author at the bottom.+describe('sticky note layout', () => {+ test('a short note keeps its square and pins the author to the bottom', () => {+ const graph = new SceneGraph()+ const note = createSticky(graph, graph.getPages()[0].id, { text: 'Hello', author: 'Ada' })+ computeAllLayouts(graph)+ const { body, author } = expectDefined(stickySublayers(graph, note))+ expect([note.width, note.height]).toEqual([240, 240])+ expect([body.x, body.y, body.width, body.height]).toEqual([20, 20, 200, 24])+ expect([author.x, author.y, author.height]).toEqual([20, 204, 16])+ })++ test('long text grows the note downwards', () => {+ const graph = new SceneGraph()+ const note = createSticky(graph, graph.getPages()[0].id, { text: lines(16), author: 'Ada' })+ computeAllLayouts(graph)+ const { author } = expectDefined(stickySublayers(graph, note))+ expect([note.width, note.height]).toEqual([240, 456])+ expect(author.y).toBe(420)+ })++ test('a hidden author gives its space back to the text', () => {+ const graph = new SceneGraph()+ const note = createSticky(graph, graph.getPages()[0].id, {+ text: lines(16),+ author: 'Ada',+ authorVisible: false+ })+ computeAllLayouts(graph)+ expect(note.height).toBe(424)+ })++ test('a wide or rescaled note scales its padding and minimum', () => {+ const graph = new SceneGraph()+ const page = graph.getPages()[0].id+ const wide = createSticky(graph, page, { text: 'Wide', author: 'Ada', wide: true })+ const scaled = createSticky(graph, page, { text: 'Scaled', author: 'Ada', scale: 1.5 })+ computeAllLayouts(graph)+ expect([wide.width, wide.height]).toEqual([416, 240])+ expect(expectDefined(stickySublayers(graph, wide)).body.width).toBe(376)+ expect([scaled.width, scaled.height]).toEqual([360, 360])+ const { body, author } = expectDefined(stickySublayers(graph, scaled))+ expect([body.x, body.y, body.width, body.height]).toEqual([30, 30, 300, 36])+ expect([author.y, author.fontSize]).toEqual([306, 18])+ })+})diff --git a/packages/fig/src/document/materialize.ts b/packages/fig/src/document/materialize.tsindex 4f033c9bd..2408f59c3 100644--- a/packages/fig/src/document/materialize.ts+++ b/packages/fig/src/document/materialize.ts@@ -22,6 +22,7 @@ import {type MaterializedComponentOccurrence} from '../instance-overrides/source-children'import { nodeChangeToProps } from '../node-change'+import { materializeStickyContent } from '../node-change/generated/import'import { figArchiveRecordInfo, type FigArchiveRecordInfo } from '../record-patch'import { applyDocumentLayoutBindings } from './bindings/layout'import { applyDocumentPaintBindings } from './bindings/paint'@@ -329,6 +330,7 @@ function materializeReaderInto(const node = graph.createNode(nodeType, parentId, props)sources.set(occurrence.sourceId, node.id)if (node.type === 'COMPONENT') componentIds.set(occurrence.sourceId, node.id)+ if (node.type === 'STICKY') materializeStickyContent(graph, node, occurrence.properties, blobs)for (const child of occurrence.children) createShells(child, node.id)}for (const page of pages) createShells(page, graph.rootId)diff --git a/packages/fig/src/node-change/basics.ts b/packages/fig/src/node-change/basics.tsindex 407eacab1..b53f8d723 100644--- a/packages/fig/src/node-change/basics.ts+++ b/packages/fig/src/node-change/basics.ts@@ -37,6 +37,8 @@ export function mapToFigmaType(type: SceneNode['type']): string {return 'CONNECTOR'case 'SHAPE_WITH_TEXT':return 'SHAPE_WITH_TEXT'+ case 'STICKY':+ return 'STICKY'default:return 'RECTANGLE'}diff --git a/packages/fig/src/node-change/convert.ts b/packages/fig/src/node-change/convert.tsindex b64e30610..e7cf55574 100644--- a/packages/fig/src/node-change/convert.ts+++ b/packages/fig/src/node-change/convert.ts@@ -126,6 +126,7 @@ const NODE_TYPE_MAP: Record<string, NodeType | 'DOCUMENT' | 'VARIABLE'> = {SYMBOL: 'COMPONENT',CONNECTOR: 'CONNECTOR',SHAPE_WITH_TEXT: 'SHAPE_WITH_TEXT',+ STICKY: 'STICKY',// Map to TEXT while retaining a format-neutral text path for rendering/editing.TEXT_PATH: 'TEXT'}diff --git a/packages/fig/src/node-change/export/generated.ts b/packages/fig/src/node-change/export/generated.tsnew file mode 100644index 000000000..58d122e88--- /dev/null+++ b/packages/fig/src/node-change/export/generated.ts@@ -0,0 +1,113 @@+import { pick } from 'es-toolkit'++import { stickySublayers } from '@open-pencil/scene-graph'+import type { SceneNode } from '@open-pencil/scene-graph'++import { generatedSlotPath, STICKY_SLOTS } from '../generated/records'+import type { GeneratedEntry } from '../generated/records'+import { createFillPaints } from './context'+import type { KiwiNodeChange, SceneNodeToKiwiContext } from './context'+import { serializeText } from './text'++/**+ * The fields a STICKY's own record keeps, as Figma writes it. Its colour, text and layout live in+ * its sublayers' entries, so the fields the note carries here as an auto layout frame stay out.+ */+const STICKY_RECORD_FIELDS = [+ 'guid',+ 'parentIndex',+ 'phase',+ 'type',+ 'name',+ 'visible',+ 'opacity',+ 'blendMode',+ 'locked',+ 'size',+ 'transform',+ 'effects',+ 'autoRename',+ 'frameMaskDisabled',+ 'exportSettings',+ 'pluginData',+ 'pluginRelaunchData'+] as const++function placement(node: SceneNode): Pick<GeneratedEntry, 'size' | 'transform'> {+ return {+ size: { x: node.width, y: node.height },+ transform: { m00: 1, m01: 0, m02: node.x, m10: 0, m11: 1, m12: node.y }+ }+}++/** A text sublayer's entry, and its placement and glyphs as Figma would derive them. */+function textSublayer(+ context: SceneNodeToKiwiContext,+ slot: number,+ node: SceneNode+): { entry: GeneratedEntry; derived: GeneratedEntry } {+ const fields: KiwiNodeChange = {}+ serializeText(context, node, fields)+ const { derivedTextData, ...text } = fields+ const entry: GeneratedEntry = {+ ...text,+ guidPath: generatedSlotPath(slot),+ visible: node.visible,+ fillPaints: createFillPaints(context, node)+ }+ const derived: GeneratedEntry = { guidPath: generatedSlotPath(slot), ...placement(node) }+ if (derivedTextData) derived.derivedTextData = derivedTextData+ return { entry, derived }+}++/** Whether a sublayer's derived text can stand in for Figma's: shaped, unless it has no text. */+function shaped(node: SceneNode, derived: GeneratedEntry): boolean {+ return node.text === '' || (derived.derivedTextData?.glyphs?.length ?? 0) > 0+}++/**+ * Whether a layer is written as a generated frame: a note whose sublayers are the template's.+ * One that lost them is written as a plain frame with its children, so nothing it shows is lost.+ */+export function writesGeneratedFrame(context: SceneNodeToKiwiContext, node: SceneNode): boolean {+ return node.type === 'STICKY' && stickySublayers(context.graph, node) !== null+}++/**+ * A generated frame's record, with its sublayers written on it as Figma stores a sticky note: what+ * each sublayer shows under `nodeGenerationData`, and the layout derived from it under+ * `derivedImmutableFrameData`. Figma draws a note from its derived data as saved and lays it out+ * afresh only without it, so the export writes that data only when it has shaped every text.+ */+export function generatedFrameRecord(+ context: SceneNodeToKiwiContext,+ node: SceneNode,+ nc: KiwiNodeChange+): KiwiNodeChange | null {+ const sublayers = node.type === 'STICKY' ? stickySublayers(context.graph, node) : null+ if (!sublayers) return null+ const record: KiwiNodeChange = pick(nc, STICKY_RECORD_FIELDS)+ const fillPaints = createFillPaints(context, node)+ const background: GeneratedEntry = {+ guidPath: generatedSlotPath(STICKY_SLOTS.background),+ fillPaints,+ cornerRadius: 0+ }+ const overrides: GeneratedEntry[] = [background]+ const derived: GeneratedEntry[] = [+ { guidPath: generatedSlotPath(STICKY_SLOTS.background), ...placement({ ...node, x: 0, y: 0 }) }+ ]+ let complete = true+ for (const [slot, layer] of [+ [STICKY_SLOTS.body, sublayers.body],+ [STICKY_SLOTS.author, sublayers.author]+ ] as const) {+ const text = textSublayer(context, slot, layer)+ overrides.push(text.entry)+ derived.push(text.derived)+ complete &&= shaped(layer, text.derived)+ }+ record.nodeGenerationData = { overrides, useFineGrainedSyncing: false, diffOnlyRemovals: [] }+ if (complete) record.derivedImmutableFrameData = { overrides: derived, version: 1 }+ return record+}diff --git a/packages/fig/src/node-change/export/node.ts b/packages/fig/src/node-change/export/node.tsindex f76b20a73..a68de997a 100644--- a/packages/fig/src/node-change/export/node.ts+++ b/packages/fig/src/node-change/export/node.ts@@ -13,6 +13,7 @@ import type {import {DEFAULT_STROKE_MITER_LIMIT,DEFAULT_STROKE_WEIGHT,+ isGeneratedFrame,OPEN_PENCIL_PLUGIN_DATA,withPluginData} from '@open-pencil/scene-graph'@@ -31,7 +32,6 @@ import {mergePluginData,serializePluginRelaunchData} from '../plugin-data'-import { applyTextRunReferences } from '../text/run-references'import {applyColorVariableBinding,createFillPaints,@@ -46,9 +46,11 @@ import {type KiwiSymbolOverridePayload,type SceneNodeToKiwiContext} from './context'+import { generatedFrameRecord, writesGeneratedFrame } from './generated'import { mergeOverrides, serializeRuntimePropertyOverrides } from './override-claims'import { exportedNode } from './resolved-bindings'import { slotContentAssignment, slotDefinitionFields } from './slots'+import { serializeText } from './text'export type { KiwiNodeChange, SceneNodeToKiwiContext } from './context'@@ -843,19 +845,6 @@ function applySharedStyleProps(if (node.guides.length > 0) nc.guides = exportCanvasGuides(node.guides)}-/** A text's props, and what its ranges refer to, which needs the document's identities. */-function serializeText(context: SceneNodeToKiwiContext, node: SceneNode, nc: KiwiNodeChange): void {- context.serializeTextProps(- node,- nc,- context.graph,- context.fontDigestMap,- context.blobs,- context.glyphBlobMap- )- if (nc.textData) applyTextRunReferences(context, node, nc.textData)-}-function applyNodeVisualProps(context: SceneNodeToKiwiContext,node: SceneNode,@@ -922,7 +911,10 @@ function applyNodeVisualProps(function exportKiwiNodeType(node: SceneNode, context: SceneNodeToKiwiContext): string {const isPathText =node.textPathData !== null && node.type === 'TEXT' && (node.derivedTextGlyphs?.length ?? 0) > 0- return isPathText ? 'TEXT_PATH' : context.mapToFigmaType(node.type)+ if (isPathText) return 'TEXT_PATH'+ // A generated frame that lost its template's layers is kept as a frame; see `writesGeneratedFrame`.+ if (isGeneratedFrame(node) && !writesGeneratedFrame(context, node)) return 'FRAME'+ return context.mapToFigmaType(node.type)}/**@@ -938,9 +930,18 @@ function nodeToSerialize(context: SceneNodeToKiwiContext, source: SceneNode): Sc}}-/** An instance writes its contents on its own record; a caller may write a record alone. */+/**+ * An instance writes its contents on its own record, as a generated frame writes its sublayers;+ * a caller may write a record alone.+ */function exportedChildren(node: SceneNode, context: SceneNodeToKiwiContext): SceneNode[] {- if (node.type === 'INSTANCE' || context.writeChildren === false) return []+ if (+ node.type === 'INSTANCE' ||+ writesGeneratedFrame(context, node) ||+ context.writeChildren === false+ ) {+ return []+ }return context.graph.getChildren(node.id).filter((child) => !child.internalOnly && child.sharedStyleType === null)@@ -1052,7 +1053,7 @@ export function sceneNodeToKiwiWithContext(nc.pluginRelaunchData = serializePluginRelaunchData(node.pluginRelaunchData)}- const result: KiwiNodeChange[] = [nc]+ const result: KiwiNodeChange[] = [generatedFrameRecord(context, node, nc) ?? nc]const children = exportedChildren(node, context)for (let i = 0; i < children.length; i++) {result.push(...context.sceneNodeToKiwi(children[i], guid, i, localIdCounter, context))diff --git a/packages/fig/src/node-change/export/text.ts b/packages/fig/src/node-change/export/text.tsnew file mode 100644index 000000000..b0bd8ac05--- /dev/null+++ b/packages/fig/src/node-change/export/text.ts@@ -0,0 +1,21 @@+import type { SceneNode } from '@open-pencil/scene-graph'++import { applyTextRunReferences } from '../text/run-references'+import type { KiwiNodeChange, SceneNodeToKiwiContext } from './context'++/** A text's props, and what its ranges refer to, which needs the document's identities. */+export function serializeText(+ context: SceneNodeToKiwiContext,+ node: SceneNode,+ nc: KiwiNodeChange+): void {+ context.serializeTextProps(+ node,+ nc,+ context.graph,+ context.fontDigestMap,+ context.blobs,+ context.glyphBlobMap+ )+ if (nc.textData) applyTextRunReferences(context, node, nc.textData)+}diff --git a/packages/fig/src/node-change/generated/import.ts b/packages/fig/src/node-change/generated/import.tsnew file mode 100644index 000000000..6a0701884--- /dev/null+++ b/packages/fig/src/node-change/generated/import.ts@@ -0,0 +1,61 @@+import type { NodeChange } from '@open-pencil/kiwi/fig/codec'+import {+ buildStickySublayers,+ STICKY_SUBLAYER_LAYOUT,+ stickyFrameFields,+ stickyScale+} from '@open-pencil/scene-graph'+import type { SceneGraph, SceneNode } from '@open-pencil/scene-graph'++import { cloneRecord } from '../clone'+import { nodeChangeToProps } from '../convert'+import { convertFills } from '../paint'+import { derivedFrameEntriesOf, generationOverridesOf, STICKY_SLOTS } from './records'+import type { GeneratedEntry } from './records'++/** A sublayer as a whole TEXT record: what the user set, placed and shaped as Figma derived it. */+function sublayerRecord(entry: GeneratedEntry | undefined, derived: GeneratedEntry | undefined) {+ const { guidPath: _set, ...fields } = cloneRecord(entry ?? {})+ const record: NodeChange = { ...fields, type: 'TEXT' }+ if (derived?.size) record.size = cloneRecord(derived.size)+ if (derived?.transform) record.transform = cloneRecord(derived.transform)+ if (derived?.derivedTextData) record.derivedTextData = cloneRecord(derived.derivedTextData)+ return record+}++function sublayerProps(+ entry: GeneratedEntry | undefined,+ derived: GeneratedEntry | undefined,+ blobs: Uint8Array[]+): Partial<SceneNode> {+ const {+ nodeType: _type,+ name: _name,+ ...props+ } = nodeChangeToProps(sublayerRecord(entry, derived), blobs, 'occurrence')+ return { ...props, ...STICKY_SUBLAYER_LAYOUT }+}++/**+ * Gives an imported STICKY the sublayers its record describes. The note's colour is its+ * background's fill, which the note itself carries here; its layout comes from the template at+ * the scale its author line was set in.+ */+export function materializeStickyContent(+ graph: SceneGraph,+ sticky: SceneNode,+ record: NodeChange,+ blobs: Uint8Array[]+): void {+ const overrides = generationOverridesOf(record)+ const derived = derivedFrameEntriesOf(record)+ const { background, body, author } = STICKY_SLOTS+ const bodyProps = sublayerProps(overrides.get(body), derived.get(body), blobs)+ const authorProps = sublayerProps(overrides.get(author), derived.get(author), blobs)+ const scale = overrides.has(author) ? stickyScale({ fontSize: authorProps.fontSize ?? 0 }) : 1+ graph.updateNode(sticky.id, {+ fills: convertFills(overrides.get(background)?.fillPaints),+ ...stickyFrameFields(scale)+ })+ buildStickySublayers(graph, sticky, { scale }, { body: bodyProps, author: authorProps })+}diff --git a/packages/fig/src/node-change/generated/records.ts b/packages/fig/src/node-change/generated/records.tsnew file mode 100644index 000000000..9f85f2387--- /dev/null+++ b/packages/fig/src/node-change/generated/records.ts@@ -0,0 +1,47 @@+import type { GUID, NodeChange } from '@open-pencil/kiwi/fig/codec'++/**+ * A generated frame's record carries its sublayers as partial records, addressed by paths of one+ * virtual GUID in this session, numbered in template order. `nodeGenerationData` holds what a+ * user set on each, `derivedImmutableFrameData` the layout Figma computed from it.+ */+export const GENERATED_SESSION_ID = 40_000_000++export const STICKY_SLOTS = { background: 0, body: 1, author: 2 } as const++export interface GeneratedEntry extends NodeChange {+ guidPath?: { guids?: GUID[] }+}++interface GeneratedEntryList {+ overrides?: GeneratedEntry[]+}++export function generatedSlotPath(slot: number): { guids: GUID[] } {+ return { guids: [{ sessionID: GENERATED_SESSION_ID, localID: slot }] }+}++function slotOf(entry: GeneratedEntry): number | undefined {+ const guids = entry.guidPath?.guids+ if (guids?.length !== 1 || guids[0].sessionID !== GENERATED_SESSION_ID) return undefined+ return guids[0].localID+}++function bySlot(list: GeneratedEntryList | undefined): Map<number, GeneratedEntry> {+ const entries = new Map<number, GeneratedEntry>()+ for (const entry of list?.overrides ?? []) {+ const slot = slotOf(entry)+ if (slot !== undefined) entries.set(slot, entry)+ }+ return entries+}++/** What a user set on each sublayer, by slot. */+export function generationOverridesOf(record: NodeChange): Map<number, GeneratedEntry> {+ return bySlot(record.nodeGenerationData as GeneratedEntryList | undefined)+}++/** The layout Figma derived for each sublayer, by slot. */+export function derivedFrameEntriesOf(record: NodeChange): Map<number, GeneratedEntry> {+ return bySlot(record.derivedImmutableFrameData as GeneratedEntryList | undefined)+}diff --git a/packages/fig/src/node-classification.ts b/packages/fig/src/node-classification.tsindex 4093b4e8a..ddc4942aa 100644--- a/packages/fig/src/node-classification.ts+++ b/packages/fig/src/node-classification.ts@@ -4,7 +4,6 @@ const UNSUPPORTED_FRAGMENT_TYPES: ReadonlySet<string> = new Set(['INTERNAL_ONLY_NODE','WIDGET','STAMP',- 'STICKY','SHAPE_WITH_TEXT','CONNECTOR','CODE_BLOCK',diff --git a/packages/fig/tests/node-change/generated/sticky.test.ts b/packages/fig/tests/node-change/generated/sticky.test.tsnew file mode 100644index 000000000..8a971905b--- /dev/null+++ b/packages/fig/tests/node-change/generated/sticky.test.ts@@ -0,0 +1,151 @@+import { describe, expect, test } from 'bun:test'++import { expectDefined } from '#fig-tests/helpers/assert'+import { normalizeFigFragment } from '#fig/document/fragment'+import { derivedFrameEntriesOf, generationOverridesOf } from '#fig/node-change/generated/records'+import { sceneNodeToKiwi } from '#fig/node-change/index'++import { materializeDocument } from '@open-pencil/fig'+import type { NodeChange } from '@open-pencil/kiwi/fig/codec'+import { createSticky, stickySublayers, STICKY_COLORS } from '@open-pencil/scene-graph'+import type { SceneGraph, SceneNode } from '@open-pencil/scene-graph'++const guid = (localID: number) => ({ sessionID: 0, localID })+const slot = (localID: number) => ({ guids: [{ sessionID: 40_000_000, localID }] })+const at = (x: number, y: number) => ({ m00: 1, m01: 0, m02: x, m10: 0, m11: 1, m12: y })+const pink = { r: 1, g: 0.6, b: 0.8, a: 1 }+const black = { r: 0, g: 0, b: 0, a: 1 }++/** A note FigJam rescaled by 1.5 with its author hidden, as its clipboard writes it. */+const scaledNote: NodeChange = {+ guid: guid(2),+ type: 'STICKY',+ name: 'Note',+ size: { x: 360, y: 360 },+ transform: at(100, 50),+ autoRename: false,+ frameMaskDisabled: true,+ nodeGenerationData: {+ overrides: [+ {+ guidPath: slot(0),+ fillPaints: [{ type: 'SOLID', color: pink, opacity: 1, visible: true }]+ },+ {+ guidPath: slot(1),+ fontSize: 24,+ fontName: { family: 'Inter', style: 'Medium', postscript: '' },+ lineHeight: { value: 1.5, units: 'RAW' },+ letterSpacing: { value: -1.1, units: 'PERCENT' },+ textData: { characters: 'Scaled' },+ fillPaints: [{ type: 'SOLID', color: black, opacity: 0.8, visible: true }]+ },+ {+ guidPath: slot(2),+ visible: false,+ fontSize: 18,+ fontName: { family: 'Inter', style: 'Medium', postscript: '' },+ lineHeight: { value: 24, units: 'PIXELS' },+ textData: { characters: 'Ada Lovelace' }+ }+ ]+ },+ derivedImmutableFrameData: {+ overrides: [+ { guidPath: slot(0), size: { x: 360, y: 360 }, transform: at(0, 0) },+ { guidPath: slot(1), size: { x: 300, y: 36 }, transform: at(30, 30) },+ { guidPath: slot(2), size: { x: 300, y: 24 }, transform: at(30, 306) }+ ],+ version: 1+ }+}++function importNote(record: NodeChange): { graph: SceneGraph; sticky: SceneNode } {+ const graph = materializeDocument(normalizeFigFragment([record])).graph+ const sticky = graph.getChildren(graph.getPages()[0].id)[0]+ return { graph, sticky }+}++describe('sticky notes', () => {+ test('import builds the note from its generated sublayers', () => {+ const { graph, sticky } = importNote(scaledNote)+ expect(sticky.type).toBe('STICKY')+ expect(sticky.fills.map((fill) => fill.color)).toEqual([pink])+ expect(sticky).toMatchObject({+ x: 100,+ y: 50,+ width: 360,+ height: 360,+ layoutMode: 'VERTICAL',+ primaryAxisAlign: 'SPACE_BETWEEN',+ paddingTop: 30,+ itemSpacing: 24,+ minHeight: 360+ })+ const { body, author } = expectDefined(stickySublayers(graph, sticky))+ expect(body).toMatchObject({+ text: 'Scaled',+ fontFamily: 'Inter',+ fontWeight: 500,+ fontSize: 24,+ lineHeight: 36,+ x: 30,+ y: 30,+ width: 300,+ textAutoResize: 'HEIGHT',+ layoutAlignSelf: 'STRETCH'+ })+ expect(author).toMatchObject({ text: 'Ada Lovelace', fontSize: 18, visible: false })+ })++ test('export writes the sublayers on the note record, as Figma stores them', () => {+ const { graph, sticky } = importNote(scaledNote)+ const records = sceneNodeToKiwi(sticky, guid(1), 0, { value: 10 }, graph, [])+ expect(records).toHaveLength(1)+ const [record] = records+ expect(record.type).toBe('STICKY')+ expect(record.fillPaints).toBeUndefined()+ expect(record.stackMode).toBeUndefined()+ expect(record.textData).toBeUndefined()++ const overrides = generationOverridesOf(record)+ expect(overrides.get(0)?.fillPaints?.[0]?.color).toEqual(pink)+ expect(overrides.get(1)?.textData?.characters).toBe('Scaled')+ expect(overrides.get(1)?.fontSize).toBe(24)+ expect(overrides.get(2)?.textData?.characters).toBe('Ada Lovelace')+ expect(overrides.get(2)?.visible).toBe(false)++ // Without shaped glyphs, Figma would draw the saved layout's empty text; it lays the note+ // out afresh only when the derived data is missing.+ expect(record.derivedImmutableFrameData).toBeUndefined()+ expect(derivedFrameEntriesOf(record).size).toBe(0)+ })++ test('a new note round-trips through its record', () => {+ const { graph } = importNote({ ...scaledNote, nodeGenerationData: undefined })+ const page = graph.getPages()[0]+ const note = createSticky(graph, page.id, {+ text: 'Hello',+ author: 'Grace',+ color: STICKY_COLORS.yellow+ })+ const [record] = sceneNodeToKiwi(note, guid(1), 0, { value: 10 }, graph, [])+ const { graph: reread, sticky } = importNote({ ...record, guid: guid(5) })+ expect(sticky.fills[0]?.color).toEqual(STICKY_COLORS.yellow)+ expect(sticky.effects).toHaveLength(3)+ const { body, author } = expectDefined(stickySublayers(reread, sticky))+ expect(body).toMatchObject({ text: 'Hello', fontSize: 16, lineHeight: 24 })+ expect(author).toMatchObject({ text: 'Grace', fontSize: 12, lineHeight: 16, visible: true })+ expect(sticky).toMatchObject({ paddingLeft: 20, itemSpacing: 16, minHeight: 240 })+ })++ test('a note that lost its sublayers is saved as a frame with its children', () => {+ const { graph, sticky } = importNote(scaledNote)+ const author = expectDefined(stickySublayers(graph, sticky)).author+ graph.deleteNode(author.id)+ const records = sceneNodeToKiwi(sticky, guid(1), 0, { value: 10 }, graph, [])+ expect(records.map((record) => record.type)).toEqual(['FRAME', 'TEXT'])+ expect(records[1].textData?.characters).toBe('Scaled')+ expect(records[0].nodeGenerationData).toBeUndefined()+ })+})diff --git a/packages/scene-graph/AGENTS.md b/packages/scene-graph/AGENTS.mdindex b064886e5..3f915e3bc 100644--- a/packages/scene-graph/AGENTS.md+++ b/packages/scene-graph/AGENTS.md@@ -9,6 +9,7 @@ Framework-neutral document model. Owns node types, primitives, geometry, matrice- Bounds accumulation goes through the helpers in `packages/scene-graph/src/geometry.ts` (`computeBounds`, `computeAbsoluteBounds`, `computeVisualBounds`); do not add another min/max loop.- Reparenting preserves child world positions; groups preserve them too. Sort children geometrically before creating auto-layout. Consumers such as layer trees must react to reparenting rather than retaining stale child references.- Use the copy helpers in `packages/scene-graph/src/copy.ts` for nested values (fills, strokes, effects); never hand-copy node properties.+- A generated frame (`GENERATED_FRAME_TYPES`, Figma's immutable frames such as `STICKY`) owns real child layers built from its template in `packages/scene-graph/src/generated/`; nothing adds, moves, or removes them (`slotScope` reports `locked`), the layers panel lists the frame alone, and `.fig` writes them as `nodeGenerationData` on the frame's record (`packages/fig/tests/node-change/generated/sticky.test.ts`).- Instance children map to component children through `componentId`; runtime overrides use the structured `InstanceOverrideState` (`self` and `descendants` maps) in `packages/scene-graph/src/instance-overrides.ts`.- A bound numeric field records its unit conversion in `variableBindingScales`; preserve it through clone, copy, and transfer so a binding keeps meaning in its new scope. Core reconciles bindings and layout together in `packages/core/src/layout/variables.ts`, which the editor and the Figma API both call rather than reimplementing.- `componentScale` records an occurrence's coordinates relative to its component definition. Shared rescaling lives in `packages/scene-graph/src/scaling/`; Core's Figma API delegates there instead of scaling nodes itself.diff --git a/packages/scene-graph/src/generated/index.ts b/packages/scene-graph/src/generated/index.tsnew file mode 100644index 000000000..7a0e1b617--- /dev/null+++ b/packages/scene-graph/src/generated/index.ts@@ -0,0 +1,26 @@+import type { SceneGraph } from '../index'+import type { NodeType, SceneNode } from '../types'++/**+ * Layers Figma generates from a template, which it calls immutable frames: their sublayers come+ * from the type and its settings, and a user edits them only through the frame. A sticky note's+ * body and author are such sublayers. They are real children here, so layout, drawing and text+ * editing treat them as any other layer, but nothing may add, move or remove them.+ */+export const GENERATED_FRAME_TYPES: ReadonlySet<NodeType> = new Set(['STICKY'])++export function isGeneratedFrame(node: Pick<SceneNode, 'type'>): boolean {+ return GENERATED_FRAME_TYPES.has(node.type)+}++/** The generated frame a layer belongs to, if it is one of its sublayers. */+export function generatedFrameOwner(graph: SceneGraph, node: SceneNode): SceneNode | undefined {+ let current = node.parentId ? graph.nodes.get(node.parentId) : undefined+ while (current) {+ if (isGeneratedFrame(current)) return current+ current = current.parentId ? graph.nodes.get(current.parentId) : undefined+ }+ return undefined+}++export * from './sticky'diff --git a/packages/scene-graph/src/generated/sticky.ts b/packages/scene-graph/src/generated/sticky.tsnew file mode 100644index 000000000..5e3c930e0--- /dev/null+++ b/packages/scene-graph/src/generated/sticky.ts@@ -0,0 +1,190 @@+import { BLACK } from '../constants'+import type { SceneGraph } from '../index'+import type { Color } from '../primitives'+import type { Effect, Fill, SceneNode } from '../types'++/**+ * A FigJam sticky note as Figma lays it out: a fixed-width card that grows to fit its body, with+ * the author pinned to the bottom. Every length scales with the note, which `rescale` changes;+ * the values here are those of a note at scale 1, measured in Figma.+ */+export const STICKY_SIZE = 240+export const STICKY_WIDE_WIDTH = 416+const STICKY_PADDING = 20+const STICKY_GAP = 16++export const STICKY_FONT_FAMILY = 'Inter'+export const STICKY_FONT_WEIGHT = 500+export const STICKY_BODY_FONT_SIZE = 16+export const STICKY_AUTHOR_FONT_SIZE = 12++/** FigJam's sticky palette, in its picker's order. */+export const STICKY_COLORS = {+ white: { r: 1, g: 1, b: 1, a: 1 },+ gray: { r: 230 / 255, g: 230 / 255, b: 230 / 255, a: 1 },+ red: { r: 1, g: 175 / 255, b: 163 / 255, a: 1 },+ orange: { r: 1, g: 211 / 255, b: 168 / 255, a: 1 },+ yellow: { r: 1, g: 226 / 255, b: 153 / 255, a: 1 },+ green: { r: 179 / 255, g: 239 / 255, b: 189 / 255, a: 1 },+ teal: { r: 179 / 255, g: 244 / 255, b: 239 / 255, a: 1 },+ blue: { r: 168 / 255, g: 218 / 255, b: 1, a: 1 },+ violet: { r: 211 / 255, g: 189 / 255, b: 1, a: 1 },+ pink: { r: 1, g: 168 / 255, b: 219 / 255, a: 1 }+} as const satisfies Record<string, Color>++export const DEFAULT_STICKY_COLOR: Color = STICKY_COLORS.blue++function solid(color: Color, opacity = 1): Fill {+ return { type: 'SOLID', color: { ...color }, opacity, visible: true }+}++function dropShadow(y: number, radius: number, alpha: number): Effect {+ return {+ type: 'DROP_SHADOW',+ color: { ...BLACK, a: alpha },+ offset: { x: 0, y },+ radius,+ spread: 0,+ visible: true,+ blendMode: 'NORMAL',+ showShadowBehindNode: true+ }+}++/** The three soft shadows Figma gives every sticky. */+export function stickyShadows(): Effect[] {+ return [dropShadow(2.5, 2, 0.02), dropShadow(3, 5, 0.04), dropShadow(8, 10, 0.08)]+}++/**+ * The note's own fields: a vertical auto layout that hugs its sublayers above a minimum height,+ * spreading them apart so the author sits at the bottom. A generated frame keeps its gap with+ * space between, which keeps the author clear of a long body.+ */+export function stickyFrameFields(scale = 1): Partial<SceneNode> {+ const padding = STICKY_PADDING * scale+ return {+ layoutMode: 'VERTICAL',+ primaryAxisAlign: 'SPACE_BETWEEN',+ counterAxisAlign: 'MIN',+ primaryAxisSizing: 'HUG',+ counterAxisSizing: 'FIXED',+ itemSpacing: STICKY_GAP * scale,+ paddingTop: padding,+ paddingRight: padding,+ paddingBottom: padding,+ paddingLeft: padding,+ minHeight: STICKY_SIZE * scale,+ cornerRadius: 0,+ clipsContent: false+ }+}++export type StickyTextRole = 'body' | 'author'++/** How a sublayer sits in the note: as wide as the padding allows, as tall as its text. */+export const STICKY_SUBLAYER_LAYOUT = {+ textAutoResize: 'HEIGHT',+ layoutAlignSelf: 'STRETCH'+} as const satisfies Partial<SceneNode>++/** A sublayer's text style; the body follows the size preset, the author only the scale. */+export function stickyTextFields(+ role: StickyTextRole,+ scale = 1,+ fontSize = role === 'body' ? STICKY_BODY_FONT_SIZE * scale : STICKY_AUTHOR_FONT_SIZE * scale+): Partial<SceneNode> {+ return {+ name: role === 'body' ? 'Text' : 'Author',+ fontFamily: STICKY_FONT_FAMILY,+ fontWeight: STICKY_FONT_WEIGHT,+ fontSize,+ lineHeight: role === 'body' ? fontSize * 1.5 : 16 * scale,+ letterSpacing: fontSize * -0.011,+ textAlignHorizontal: 'LEFT',+ textAlignVertical: 'TOP',+ ...STICKY_SUBLAYER_LAYOUT,+ fills: [solid(BLACK, role === 'body' ? 0.8 : 128 / 255)]+ }+}++/** The scale a note was drawn at, read from its author line, whose size only the scale sets. */+export function stickyScale(author: Pick<SceneNode, 'fontSize'> | undefined): number {+ return author ? author.fontSize / STICKY_AUTHOR_FONT_SIZE : 1+}++export interface StickySublayers {+ body: SceneNode+ author: SceneNode+}++/** A note's body and author, in the order Figma generates them. */+export function stickySublayers(graph: SceneGraph, sticky: SceneNode): StickySublayers | null {+ const children = graph.getChildren(sticky.id)+ if (children.length !== 2) return null+ const [body, author] = children+ if (body.type !== 'TEXT' || author.type !== 'TEXT') return null+ return { body, author }+}++export interface StickyContent {+ text?: string+ author?: string+ authorVisible?: boolean+ color?: Color+ wide?: boolean+ scale?: number+}++/** Adds a note's sublayers to a STICKY the caller created, styled as Figma generates them. */+export function buildStickySublayers(+ graph: SceneGraph,+ sticky: SceneNode,+ content: Pick<StickyContent, 'text' | 'author' | 'authorVisible' | 'scale'> = {},+ overrides: { body?: Partial<SceneNode>; author?: Partial<SceneNode> } = {}+): StickySublayers {+ const scale = content.scale ?? 1+ const inner = sticky.width - 2 * STICKY_PADDING * scale+ // One line tall until text is measured, so a note laid out without fonts keeps Figma's square.+ const bodyFields = stickyTextFields('body', scale)+ const authorFields = stickyTextFields('author', scale)+ const body = graph.createNode('TEXT', sticky.id, {+ ...bodyFields,+ width: inner,+ height: bodyFields.lineHeight ?? undefined,+ text: content.text ?? '',+ ...overrides.body+ })+ const author = graph.createNode('TEXT', sticky.id, {+ ...authorFields,+ width: inner,+ height: authorFields.lineHeight ?? undefined,+ text: content.author ?? '',+ visible: content.authorVisible ?? true,+ ...overrides.author+ })+ return { body, author }+}++/** A new note with its sublayers; the caller lays it out to grow it to its text. */+export function createSticky(+ graph: SceneGraph,+ parentId: string,+ content: StickyContent = {},+ props: Partial<SceneNode> = {}+): SceneNode {+ const scale = content.scale ?? 1+ const size = STICKY_SIZE * scale+ const sticky = graph.createNode('STICKY', parentId, {+ name: 'Sticky',+ width: (content.wide ? STICKY_WIDE_WIDTH : STICKY_SIZE) * scale,+ height: size,+ fills: [solid(content.color ?? DEFAULT_STICKY_COLOR)],+ effects: stickyShadows(),+ autoRename: false,+ ...stickyFrameFields(scale),+ ...props+ })+ buildStickySublayers(graph, sticky, content)+ return sticky+}diff --git a/packages/scene-graph/src/index.ts b/packages/scene-graph/src/index.tsindex 84e2b3da5..3c700532f 100644--- a/packages/scene-graph/src/index.ts+++ b/packages/scene-graph/src/index.ts@@ -28,6 +28,7 @@ export {export * from './slots/content'export * from './slots/authoring'export * from './slots/limits'+export * from './generated'export * from './behaviours/kinds'export * from './icons/schema'export * from './icons/model'diff --git a/packages/scene-graph/src/slots/content.ts b/packages/scene-graph/src/slots/content.tsindex 0594c0c85..2e49f97e3 100644--- a/packages/scene-graph/src/slots/content.ts+++ b/packages/scene-graph/src/slots/content.ts@@ -1,3 +1,4 @@+import { isGeneratedFrame } from '../generated'import type { SceneGraph } from '../index'import { getInstanceOverride, setInstanceOverride } from '../instance-overrides'import { cloneChildrenWithMapping } from '../instances/sync'@@ -8,12 +9,13 @@ import { ownsSlotContent, slotPropertyId } from './frames'* Where layers may be added, moved, or removed under a parent:* - `free`: outside any instance, or inside a component definition;* - `slot`: inside a slot of an instance, whose content the instance owns or can claim;- * - `locked`: anywhere else inside an instance, whose layers come from its component.+ * - `locked`: anywhere else inside an instance, whose layers come from its component, or inside a+ * generated frame such as a sticky note, whose layers come from its template.*/export type SlotScope =| { kind: 'free' }| { kind: 'slot'; frame: SceneNode; instance: SceneNode; propertyId: string }- | { kind: 'locked'; instance: SceneNode }+ | { kind: 'locked'; owner: SceneNode }function parentOf(graph: SceneGraph, node: SceneNode): SceneNode | undefined {return node.parentId ? graph.nodes.get(node.parentId) : undefined@@ -33,7 +35,8 @@ export function slotScope(graph: SceneGraph, parentId: string): SlotScope {const instance = nearestInstance(graph, current)return instance ? { kind: 'slot', frame: current, instance, propertyId } : { kind: 'free' }}- if (current.type === 'INSTANCE') return { kind: 'locked', instance: current }+ if (current.type === 'INSTANCE' || isGeneratedFrame(current))+ return { kind: 'locked', owner: current }current = parentOf(graph, current)}return { kind: 'free' }diff --git a/packages/scene-graph/src/types.ts b/packages/scene-graph/src/types.tsindex 312ce0978..262b3923d 100644--- a/packages/scene-graph/src/types.ts+++ b/packages/scene-graph/src/types.ts@@ -121,6 +121,7 @@ export type NodeType =| 'INSTANCE'| 'CONNECTOR'| 'SHAPE_WITH_TEXT'+ | 'STICKY'export type FillType =| 'SOLID'diff --git a/packages/vue/src/primitives/LayerTree/model.ts b/packages/vue/src/primitives/LayerTree/model.tsindex 55db7891e..190a338ca 100644--- a/packages/vue/src/primitives/LayerTree/model.ts+++ b/packages/vue/src/primitives/LayerTree/model.ts@@ -1,6 +1,6 @@import { isEqual } from 'es-toolkit'-import { readIcon, slotPropertyId } from '@open-pencil/scene-graph'+import { isGeneratedFrame, readIcon, slotPropertyId } from '@open-pencil/scene-graph'import type { SceneGraph, SceneNode } from '@open-pencil/scene-graph'import type { LayerNode, LayerRow, LayerSelectionMode } from '#vue/primitives/LayerTree/context'@@ -41,7 +41,10 @@ export function buildLayerTreeModel(graph: SceneGraph, parentId: string): LayerTif (!sceneNode || sceneNode.internalOnly) continueconst node = nodeToLayerNode(sceneNode)byId.set(node.id, node)- if (sceneNode.childIds.length > 0) node.children = buildChildren(node.id)+ // A generated frame, such as a sticky note, is one layer; its template owns what is inside.+ if (sceneNode.childIds.length > 0 && !isGeneratedFrame(sceneNode)) {+ node.children = buildChildren(node.id)+ }children.push(node)}return childrendiff --git a/src/app/editor/icons.ts b/src/app/editor/icons.tsindex 1b6ffbd31..8e4242984 100644--- a/src/app/editor/icons.ts+++ b/src/app/editor/icons.ts@@ -18,6 +18,7 @@ import IconSmile from '~icons/lucide/smile'import IconSquare from '~icons/lucide/square'import IconSlot from '~icons/lucide/square-dashed'import IconStar from '~icons/lucide/star'+import IconStickyNote from '~icons/lucide/sticky-note'import IconTriangle from '~icons/lucide/triangle'import IconType from '~icons/lucide/type'@@ -52,7 +53,8 @@ export const NODE_ICONS: Partial<Record<string, typeof IconSquare>> = {LINE: IconMinus,TEXT: IconType,VECTOR: IconPenTool,- RECTANGLE: IconSquare+ RECTANGLE: IconSquare,+ STICKY: IconStickyNote}export const AUTO_LAYOUT_ICONS: Partial<Record<string, typeof IconSquare>> = {diff --git a/tests/helpers/fig/fixtures.ts b/tests/helpers/fig/fixtures.tsindex a728cea60..d189af8ba 100644--- a/tests/helpers/fig/fixtures.ts+++ b/tests/helpers/fig/fixtures.ts@@ -33,7 +33,8 @@ export const VALID_NODE_TYPES = new Set<string>(['INSTANCE','BOOLEAN_OPERATION','CONNECTOR',- 'SHAPE_WITH_TEXT'+ 'SHAPE_WITH_TEXT',+ 'STICKY'])const FixtureObjectJSON = v.pipe(v.string(), v.parseJson(), v.record(v.string(), v.unknown()))