fix(kiwi): export variant prop defs as text

This commit is contained in:
Danila Poyarkov 2026-05-16 13:09:48 +03:00
parent 535d243a14
commit 2fc90769b1
2 changed files with 8 additions and 2 deletions

View file

@ -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

View file

@ -46,7 +46,7 @@ describe('component metadata serialization', () => {
{
id: { sessionID: 90, localID: 1 },
name: 'State',
type: 'VARIANT',
type: 'TEXT',
initialValue: { textValue: { characters: 'Enabled' } }
}
])