MishkaCmsBuilder.Marketplace.Token (Mishka CMS Builder v0.0.1-alpha.2)

Copy Markdown View Source

One design token — the validated shape both the Mock adapter and any real backend must produce.

usage is how many places in the site currently reference the token; the Studio sorts and dims by it, so an unused token is visibly unused. custom? marks a token the team added rather than one the theme shipped with, which the CSS generator highlights. default is the value the theme shipped, where it shipped one, which is what the Studio offers to reset a custom token to.

Summary

Functions

A sample %MishkaCmsBuilder.Marketplace.Token{} populated from defaults + type-based fallbacks.

Whether a token matches a category filter — "all", "custom", or a category name.

Builds a token, raising on an invalid one — seeds are compile-time data, not user input.

Types

t()

@type t() :: %MishkaCmsBuilder.Marketplace.Token{
  category: String.t(),
  custom?: boolean() | nil,
  default: String.t() | nil,
  glyph: String.t() | nil,
  key: String.t(),
  label: String.t(),
  usage: integer() | nil,
  value: String.t()
}

Functions

builder(attrs_or_input, error \\ false)

enforce_keys()

enforce_keys(field)

example()

A sample %MishkaCmsBuilder.Marketplace.Token{} populated from defaults + type-based fallbacks.

keys()

keys(field)

matches?(token, category)

@spec matches?(t(), String.t()) :: boolean()

Whether a token matches a category filter — "all", "custom", or a category name.

new!(attrs)

@spec new!(map()) :: t()

Builds a token, raising on an invalid one — seeds are compile-time data, not user input.