AttractorEx.ModelStylesheet (attractor_phoenix v0.1.0)

Copy Markdown View Source

Parses and applies the model_stylesheet graph attribute.

AttractorEx supports both legacy JSON-style stylesheets and a CSS-like selector syntax. Styles are resolved before validation so the validator and engine see the same effective node attributes.

Summary

Functions

Resolves the effective stylesheet attributes for a node.

Returns non-fatal stylesheet diagnostics.

Parses a stylesheet definition into ranked rules.

Types

lint_diagnostic()

@type lint_diagnostic() :: %{
  severity: :warning,
  code: atom(),
  message: String.t(),
  node_id: nil
}

rule()

@type rule() :: %{
  selector: String.t(),
  attrs: map(),
  rank: integer(),
  order: integer()
}

Functions

attrs_for_node(rules, node_id, node_attrs)

Resolves the effective stylesheet attributes for a node.

lint(stylesheet)

Returns non-fatal stylesheet diagnostics.

parse(stylesheet)

Parses a stylesheet definition into ranked rules.