AI-native design editor. Open-source Figma alternative.
fix(fig): preserve explicit blend modes
Danila Poyarkovf2ce4ac9a00b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2de5eb2ea..9934f0e20 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -37,6 +37,8 @@### Fixed+- Preserve explicit normal blend modes on imported Figma text and vector nodes across save and reload.+- Preserve implicit fixed-size text inside imported Figma auto-layout frames across save and reload.- Stop showing a misleading desktop-only warning when web font loading or catalog lookup fails.- Preserve source text offsets when resolving fallback languages after text-case transformations.diff --git a/packages/fig/src/node-change/convert.ts b/packages/fig/src/node-change/convert.tsindex e92be05e6..de1ef7814 100644--- a/packages/fig/src/node-change/convert.ts+++ b/packages/fig/src/node-change/convert.ts@@ -1043,6 +1043,7 @@ export const FIGMA_RAW_NODE_FIELD_KEYS = ['parameterConsumptionMap','editInfo','backgroundColor',+ 'blendMode','pageType','isPageDivider','guides',diff --git a/tests/engine/io/fig/import/legacy/blend/mode.test.ts b/tests/engine/io/fig/import/legacy/blend/mode.test.tsindex 577f0a7d3..979215d9e 100644--- a/tests/engine/io/fig/import/legacy/blend/mode.test.ts+++ b/tests/engine/io/fig/import/legacy/blend/mode.test.ts@@ -17,9 +17,18 @@ describe('fig-import: blend mode', () => {expect(n.blendMode).toBe('MULTIPLY')})- test('defaults to PASS_THROUGH', () => {- const graph = importNodeChanges([doc(), canvas(), node('RECTANGLE', 10, 1)])- const n = graph.getChildren(graph.getPages()[0].id)[0]- expect(n.blendMode).toBe('PASS_THROUGH')+ test('keeps omitted blend modes as PASS_THROUGH', () => {+ const graph = importNodeChanges([+ doc(),+ canvas(),+ node('TEXT', 10, 1),+ node('VECTOR', 11, 1),+ node('FRAME', 12, 1)+ ])+ expect(graph.getChildren(graph.getPages()[0].id).map((item) => item.blendMode)).toEqual([+ 'PASS_THROUGH',+ 'PASS_THROUGH',+ 'PASS_THROUGH'+ ])})})diff --git a/tests/engine/io/fig/import/raw-field-coverage.test.ts b/tests/engine/io/fig/import/raw-field-coverage.test.tsindex 7c2c42a4c..a22cc1a3d 100644--- a/tests/engine/io/fig/import/raw-field-coverage.test.ts+++ b/tests/engine/io/fig/import/raw-field-coverage.test.ts@@ -74,6 +74,7 @@ const RAW_FIELD_COVERAGE = {],roundTripOnly: ['annotationCategories',+ 'blendMode','brushType','codeSyntax','componentPropRefs',diff --git a/tests/engine/io/fig/roundtrip/basic.test.ts b/tests/engine/io/fig/roundtrip/basic.test.tsindex f99998259..2780057b7 100644--- a/tests/engine/io/fig/roundtrip/basic.test.ts+++ b/tests/engine/io/fig/roundtrip/basic.test.ts@@ -150,6 +150,30 @@ describe('roundtrip: export → re-import', () => {reImportedNodes = collectAllNodes(reImported)})+ test('preserves explicit NORMAL on imported nodes', async () => {+ await initCodec()+ const graph = new SceneGraph()+ const page = graph.getPages()[0]+ const text = graph.createNode('TEXT', page.id, {+ name: 'Normal text',+ source: {+ ...page.source,+ format: 'fig',+ id: '1:2',+ fig: {+ ...page.source.fig,+ rawNodeFields: { blendMode: 'NORMAL' }+ }+ }+ })++ const restored = await parseFigFile((await exportFigFile(graph)).buffer as ArrayBuffer)+ const roundTripped = restored.getAllNodes().find((node) => node.name === text.name)++ expect(roundTripped?.blendMode).toBe('NORMAL')+ expect(roundTripped?.source.fig.rawNodeFields.blendMode).toBe('NORMAL')+ })+test('preserves page count', () => {expect(reImported.getPages().length).toBe(2)})