{#- mgf-brand-web · the shared operator macro pack (M1 P4.1) ========================================================================= The Jinja macros fed-web and test-web used to copy-paste, now shipped by the kit (G3's duplication list): the sync/test state chips, the workflow chip, the origin badge, the derived tag, honest absence, the inline empty state — and the sprite `icon()` helper they build on. Import (with the kit templates dir on your loader path — see console.html): {% import "mgf/macros.html" as mgf %} {{ mgf.sync_chip(project.state) }} {{ mgf.status_chip('pass', icon='success') }} {{ mgf.icon('proof', label='Verified') }} Icons resolve against the vendored sprite at /static/brand/icons/icons-sprite.svg (same-origin external — the canon usage from mgf-brand's icon sheet); pass `sprite=` if your brand mount differs. Everything renders kit classes themed by --mgf-* tokens. ========================================================================= -#} {#- A sprite icon. Decorative by default (aria-hidden, per the icon law); pass `label` to make it meaningful (role="img" + aria-label). Sizes in text-flow at 1em via .mgf-icon; pass `size` (px) to fix it. -#} {%- macro icon(name, size=none, label=none, sprite="/static/brand/icons/icons-sprite.svg") -%} {%- endmacro -%} {#- SYNC-language state chip (IN_SYNC, STALE, TAMPERED, UNKNOWN, UNREADABLE, CHECKING, SYNCING, ERROR …) — the brand state-chip; the in-flight states swap the dot for a spinner. `icon` (optional) adds a sprite glyph beside the dot — decoration on top of dot + label, never instead of them. -#} {%- macro sync_chip(state, icon_name=none) -%} {%- if state in ('CHECKING', 'SYNCING') %}{% else %}{% endif -%} {%- if icon_name %}{{ icon(icon_name) }}{% endif -%} {{ state }} {%- endmacro -%} {#- TEST-language state chip (pass, fail, error, skipped, running, …); `running=True` overrides the committed last status. -#} {%- macro status_chip(value, running=false, icon_name=none) -%} {%- set v = 'running' if running else (value or 'unknown') -%} {%- if icon_name %}{{ icon(icon_name) }}{% endif -%} {{ v }} {%- endmacro -%} {#- Task / stage WORKFLOW-state chip (done, in_progress, next, postponed, blocked, todo, …) — kebab-cased modifier, de-underscored label. -#} {%- macro tstate(state) -%} {{ state|replace('_', ' ') }} {%- endmacro -%} {#- Actor-origin badge — who submitted the run / produced the record (web · cli · agent · ci). -#} {%- macro origin_badge(origin) -%} {{ origin }} {%- endmacro -%} {#- The violet "derived" tag — inferred by the web layer, never a project-reported fact. Name the inferring surface. -#} {%- macro derived_tag(source="the web layer") -%} derived {%- endmacro -%} {#- Honest-absence block — every absence is an explicit state + reason, with the state chip restated and (optionally) the raw errors. UNREADABLE reads warning ("!"), UNKNOWN reads neutral ("?"), anything else is no-data. -#} {%- macro absence(state, title, reason, action=none, errors=none) -%} {%- set kind = 'unreadable' if state == 'UNREADABLE' else ('unknown' if state == 'UNKNOWN' else 'no-data') -%}
{{ '!' if state == 'UNREADABLE' else '?' }}

{{ title }}

{{ reason }}

{{ sync_chip(state) }}{% if action %} {{ action }}{% endif %}

{% if errors %}{% endif %}
{%- endmacro -%} {#- Inline "nothing here" empty card — data present, slice empty. -#} {%- macro empty_state(title, reason, icon_glyph="∅") -%}
{{ icon_glyph }}

{{ title }}

{{ reason }}

{%- endmacro -%} {#- The living Magogi mark as INLINE, addressable SVG so its geometry can animate — an -referenced SVG has no animatable internals. Renders the class-targeted parts that logo-motion.css drives (idle heartbeat; hover pulse via a `.lm-host` ancestor; success/error moods via `.is-success` / `.is-error`). Load `/static/brand/logo-motion.css` for the motion; without it the mark is a correct static drawing. Decorative by default (aria-hidden); pass `title` for a meaningful name. `on_dark=true` forces mist ink on indigo grounds (the console top bar). `mode="lockup"` adds the wordmark. `class` is added to the (e.g. a sizing class like mgf-console__mark-glyph). -#} {%- macro logo_mark(mode="mark", on_dark=false, title=none, class="", id="lm") -%} {%- if title %}{{ title }}{%- endif %} {%- if mode == 'lockup' %} {%- endif %} {%- endmacro -%}