OpenFresco.OgImport (open_fresco v0.1.0)

Copy Markdown View Source

Convert a phoenix_kit_og canvas map into an OpenFresco.Scene — the concrete step that lets an og host migrate stored templates and render them through open_fresco.

It maps faithfully because the two models line up: og's text / image / rect / stamp elements become text / image / shape / stamp, its color / image backgrounds become the matching fills, and — crucially — og's {{slot}} / [[global]] token syntax is preserved verbatim (open fresco adopted it), so an imported template resolves the same values and renders the same output.

og canvas shape (all string keys):

%{"width" => 1200, "height" => 630,
  "background" => %{"type" => "color", "value" => "#0b1220"},
  "elements" => [%{"type" => "text", "x" => .., "text" => "{{Title}}", ..}, ..]}

Unknown element types are skipped (tolerant import).

Summary

Functions

Build an OpenFresco.Scene from an og canvas map.

Functions

scene_from_canvas(canvas)

@spec scene_from_canvas(map()) :: OpenFresco.Scene.t()

Build an OpenFresco.Scene from an og canvas map.