# `MishkaDocument.Resources.Changes.ContentFacts`
[🔗](https://github.com/mishka-group/mishka_document/blob/v0.0.1/lib/mishka_document/resources/__changes/content_facts.ex#L5)

The components, the icons and the classes a page's or a note's `content` names, worked out when
it is written — reading either works out nothing:

  * `content_components` — the names its markers give
    (`MishkaCmsCore.Runtime.ContentComponents.names/1`), `nil` when it names none. A site's
    stylesheet is built from them — see `MishkaDocument.Plugins.ContentComponents`.
  * `content_icons` — the icon classes it names, in a marker's attribute or in its HTML
    (`MishkaCmsCore.Runtime.ContentComponents.icons/1`), `nil` when it names none. The site's
    stylesheet carries a rule for each — see `MishkaDocument.Plugins.ContentComponents`.
  * `content_classes` — the classes it writes: its HTML's class lists, a marker's `class` and
    `*_class` attributes, and the attributes its component takes a class string in
    (`MishkaCmsCore.Runtime.ContentComponents.site_classes/2`), `nil` when it writes none. The
    site's stylesheet is built with each — see `MishkaDocument.Plugins.ContentComponents`.

Worked out in a `before_action` hook, which runs after every change an action lists — the
`guardedstruct` sanitizer and `MishkaDocument.Resources.Changes.HighlightCode` included — so they
are read off the content that is stored. Every write works them out again from the content it
stores, whether or not it changed it, so a row never names what its content does not.

## The stylesheet

A write that makes a name, an icon or a class live on its site — an approved page or note names it
now and did not before, and no other approved page or note of the site names it — rebuilds the
site's stylesheet, through `MishkaCmsCore.Runtime.Compilers.TailwindCompiler.schedule/1`. The job
is enqueued in the write's own transaction, so a write rolled back asks for nothing. A name, an
icon or a class dropped, or a page sent back to review, rebuilds nothing.

## Usage

    update :update do
      change MishkaDocument.Resources.Changes.HighlightCode
      change MishkaDocument.Resources.Changes.ContentFacts
    end

# `newly_live`

```elixir
@spec newly_live(
  map(),
  map(),
  :content_components | :content_icons | :content_classes
) :: [String.t()]
```

What `record` makes live of `fact` that `was` did not — its component names
(`:content_components`, the default), its icons (`:content_icons`) or its classes
(`:content_classes`): what an approved page or note lists, less what it listed while approved
before the write.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
