Accrue.Invoices.Styles (accrue v0.3.0)

Copy Markdown View Source

Static branding-aware inline-CSS lookup used by Accrue.Invoices.Components to stamp style="..." attributes on every structural element.

Why inline, not classname-driven?

MJML's post-render CSS inliner does NOT descend into <mj-raw> blocks (D6-01 Pitfall 2). Components rendered via Accrue.Emails.HtmlBridge into an <mj-raw> therefore cannot rely on classname selectors — every structural element must carry its styling inline, and every inline style must be derived from the frozen branding snapshot in the render context.

The second parameter is always the branding keyword list — a direct slice of ctx.branding. Callers must NEVER re-read Accrue.Config.branding/0 inside component code; pass the frozen snapshot through.

Summary

Functions

Returns an inline CSS string for the given style key and frozen branding snapshot. Always returns a binary — never nil.

Types

key()

@type key() ::
  :table_reset
  | :logo_cell
  | :number_cell
  | :line_items
  | :line_row
  | :th
  | :td
  | :td_num
  | :totals
  | :totals_row
  | :totals_label
  | :totals_value
  | :footer
  | :footer_line
  | :cta_button
  | :heading
  | :body

Functions

for(key, branding)

@spec for(
  key(),
  keyword()
) :: String.t()

Returns an inline CSS string for the given style key and frozen branding snapshot. Always returns a binary — never nil.