Skip to content

AI-native design editor. Open-source Figma alternative.

fix(kiwi): export variant prop defs as text

Danila Poyarkov2fc90769b19d
diff --git a/packages/core/src/kiwi/node-change/export-node.ts b/packages/core/src/kiwi/node-change/export-node.ts
index b4ddc1f60..76f0be4b6 100644
--- a/packages/core/src/kiwi/node-change/export-node.ts
+++ b/packages/core/src/kiwi/node-change/export-node.ts
@@ -59,6 +59,12 @@ function componentPropertyValue(value: string) {
return { textValue: { characters: value } }
}
+function componentPropertyTypeForKiwi(type: string) {
+ if (type === 'BOOLEAN') return 'BOOL'
+ if (type === 'VARIANT') return 'TEXT'
+ return type
+}
+
function parseGuidOrNull(value: string) {
return /^\d+:\d+$/.test(value) ? stringToGuid(value) : null
}
@@ -83,7 +89,7 @@ function applyComponentMetadata(node: SceneNode, nc: KiwiNodeChange): void {
? {
id,
name: def.name,
- type: def.type,
+ type: componentPropertyTypeForKiwi(def.type),
initialValue: componentPropertyValue(def.defaultValue)
}
: null
diff --git a/tests/engine/kiwi/serialize-fixes/component-metadata.test.ts b/tests/engine/kiwi/serialize-fixes/component-metadata.test.ts
index 933b6c6ce..7f3005933 100644
--- a/tests/engine/kiwi/serialize-fixes/component-metadata.test.ts
+++ b/tests/engine/kiwi/serialize-fixes/component-metadata.test.ts
@@ -46,7 +46,7 @@ describe('component metadata serialization', () => {
{
id: { sessionID: 90, localID: 1 },
name: 'State',
- type: 'VARIANT',
+ type: 'TEXT',
initialValue: { textValue: { characters: 'Enabled' } }
}
])