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

Copy Markdown View Source

The properties a component draws only while one of its switches is on.

Why the Inspector has to say so

chelekom-pagination draws its first and last buttons under :if={@rest[:show_edges]}, so first_label, first_label_class, last_label and last_label_class reach the canvas only once Show edges is on. Until then, whatever is typed into them changes nothing, and the palette sweep reported exactly that. The fields work; they are waiting for a switch the panel offers a few rows away, and the panel says which.

Read off the component's markup

A property is behind a switch when EVERY place the component reads it sits inside an element whose :if is that switch alone — :if={@rest[:show_edges]} or :if={@show_edges} — itself or through an ancestor. One read anywhere else (outside such an element, in a :for, in a helper's body, in text) and the property may show without it, so nothing is said. A switch counts only when the panel offers it as one: a boolean the component declares, or a @rest key its body reads as a flag (MishkaCmsCore.Runtime.Authoring.Inspector.rest_attrs/1).

Summary

Functions

Whether the switch name is on for this node: written, and not written false or nil, or not written at all and declared on by default — chelekom-skeleton's visible.

Each property drawn only behind a switch, with that switch's name: %{"first_label" => "show_edges"}. Empty for a component with no markup, or none behind a switch.

Functions

on?(node, name, entry)

Whether the switch name is on for this node: written, and not written false or nil, or not written at all and declared on by default — chelekom-skeleton's visible.

switches(entry)

@spec switches(map()) :: %{required(String.t()) => String.t()}

Each property drawn only behind a switch, with that switch's name: %{"first_label" => "show_edges"}. Empty for a component with no markup, or none behind a switch.