Unbinding a fill or stroke and saving handed Figma back the variable the layer was imported with: the raw paint kept its `colorVar` and only the bound path ever touched it. The unbound path now clears it, and an emptied bindings record is dropped rather than written, since nothing reads an empty map and it would otherwise sit in every exported file. With that, nothing writes `colorVariableBinding`. It had no entry in `fig.kiwi`, so encoding one meant splicing bytes into the encoded message by searching for marker sequences; exports have written `colorVar`, the field the schema defines, since the reader landed. The splicing encoder and the three helpers it exposed are gone, leaving `parseVariableId`. Importers still read the old field, so files earlier versions wrote still open. Co-authored-by: mrhard9090 <74858909+mrhard9090@users.noreply.github.com>
9 lines
295 B
TypeScript
9 lines
295 B
TypeScript
import { expect, test } from 'bun:test'
|
|
|
|
import { parseVariableId } from '../src/fig/variable-bindings'
|
|
|
|
test('parses Figma variable IDs', () => {
|
|
expect(parseVariableId('VariableID:123:456')).toEqual({ sessionID: 123, localID: 456 })
|
|
expect(parseVariableId('not-a-variable')).toBeNull()
|
|
})
|