Figler.Document (figler v0.1.0-beta.1)

Copy Markdown View Source

A complete decoded boundary for a Figma document.

This representation preserves archive entries and rendering assets alongside the raw Kiwi payload and document metadata. open/1 leaves :message as nil for analysis and rendering; Figler.decode/1 additionally fills it with a complete generated message for ordinary Elixir transformations.

Summary

Functions

Opens an exported .fig archive, fig-kiwi container, or raw Kiwi payload.

Like open/1, but raises Figler.Error when the input cannot be decoded.

Types

source()

@type source() :: :archive | :container | :payload

t()

@type t() :: %Figler.Document{
  blobs: [binary()],
  canvas: binary() | nil,
  canvas_path: String.t() | nil,
  entries: %{optional(String.t()) => binary()},
  images: %{optional(String.t()) => binary()},
  message: Figler.Schema.Message.t() | nil,
  pages: [Figler.Document.Page.t()],
  payload: binary(),
  source: source()
}

Functions

open(input)

@spec open(binary()) :: {:ok, t()} | {:error, Figler.Error.t()}

Opens an exported .fig archive, fig-kiwi container, or raw Kiwi payload.

Returns {:error, %Figler.Error{}} for malformed input.

open!(input)

@spec open!(binary()) :: t()

Like open/1, but raises Figler.Error when the input cannot be decoded.