Resolves DTCG 2025.10 resolver documents into standard token config maps.
A resolver document describes how to compose token files using sets (static
collections) and modifiers (conditional contexts like light/dark themes).
Given an input selecting modifier contexts, the resolver produces a merged
DTCG config map ready for Jetons.Parser.from_config/2.
Example
light = Jetons.Resolver.resolve_file!("tokens.resolver.json", %{"theme" => "light"})
dark = Jetons.Resolver.resolve_file!("tokens.resolver.json", %{"theme" => "dark"})
defmodule MyTokens do
use Jetons, light: light, dark: dark
end
Summary
Functions
Computes the default input map for a set of modifiers.
Returns all valid input permutations for a resolver document.
Resolves a parsed resolver document with the given input.
Reads a .resolver.json file and resolves it with the given input.
Resolves a single context of a named modifier from a resolver document.
Resolves a single named set from a resolver document.
Functions
Computes the default input map for a set of modifiers.
For each modifier, uses the explicit "default" value if present,
otherwise falls back to the first context key.
Examples
iex> Jetons.Resolver.default_input(%{
...> "theme" => %{"default" => "light", "contexts" => %{"light" => [], "dark" => []}},
...> "density" => %{"contexts" => %{"compact" => [], "comfortable" => []}}
...> })
%{"density" => "comfortable", "theme" => "light"}
Returns all valid input permutations for a resolver document.
Useful for generating all theme combinations at compile time.
Resolves a parsed resolver document with the given input.
Options
:base_dir- directory for resolving file$refpaths. Required when the document contains file references.
Reads a .resolver.json file and resolves it with the given input.
File $ref paths are resolved relative to the resolver file's directory.
Resolves a single context of a named modifier from a resolver document.
Returns the merged config map for that context's sources. Useful for inspecting which tokens a modifier contributes without resolving the whole document.
Options
:base_dir- directory for resolving file$refpaths.
Resolves a single named set from a resolver document.
Returns the merged config map for that set's sources, including any
transitive $ref chains to other sets.
Options
:base_dir- directory for resolving file$refpaths.