Fast analysis, transformation, and rendering for Figma .fig files.
Use Figler.Scene to inspect large files, decode/1 and encode/1 to change
complete documents with ordinary Elixir data operations, and Figler.Render
to render pages or selected layers.
Lower-level schema and message codecs are available for tools that already manage their own Figma archive or container boundary.
Summary
Functions
Decodes a complete .fig archive, fig-kiwi container, or raw message.
Like decode/1, but raises Figler.Error for malformed input.
Decodes a Figma Message payload into generated schema structs.
Decodes a Figma Message payload with the runtime schema interpreter.
Decodes a Figma Message payload into sparse schema-backed maps.
Encodes a Figler.Document back to its original representation.
Like encode/1, but raises Figler.Error for invalid document data.
Encodes a generated Figma Message struct.
Encodes a Figma Message map with the runtime schema interpreter.
Parses the vendored Figma Kiwi schema.
Returns the vendored Figma Kiwi schema text.
Functions
@spec decode(binary()) :: {:ok, Figler.Document.t()} | {:error, Figler.Error.t()}
Decodes a complete .fig archive, fig-kiwi container, or raw message.
The returned Figler.Document contains the decoded message alongside every
preserved archive entry. It can be changed with ordinary Elixir struct,
Enum, and Access operations before being passed to encode/1.
@spec decode!(binary()) :: Figler.Document.t()
Like decode/1, but raises Figler.Error for malformed input.
@spec decode_message(binary()) :: Figler.Schema.Message.t()
Decodes a Figma Message payload into generated schema structs.
Decodes a Figma Message payload with the runtime schema interpreter.
Decodes a Figma Message payload into sparse schema-backed maps.
Sparse maps include :__kiwi_module__ and only fields present on the wire.
This avoids materializing hundreds of nil fields per large NodeChange.
@spec encode(Figler.Document.t()) :: {:ok, binary()} | {:error, Figler.Error.t()}
Encodes a Figler.Document back to its original representation.
Archives retain all entries and replace only their canvas.fig container.
Containers retain their schema, version, compression family, and trailing
chunks. Documents decoded from raw messages encode back to raw messages.
@spec encode!(Figler.Document.t()) :: binary()
Like encode/1, but raises Figler.Error for invalid document data.
@spec encode_message(Figler.Schema.Message.t()) :: binary()
Encodes a generated Figma Message struct.
Encodes a Figma Message map with the runtime schema interpreter.
@spec schema() :: KiwiCodec.Schema.t()
Parses the vendored Figma Kiwi schema.
@spec schema_text() :: String.t()
Returns the vendored Figma Kiwi schema text.