You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte-kit-vice/src/uix/morfo/components/banner.ts

47 lines
1.8 KiB

feat(layout): Layout Batch 2 — aspect-ratio, auto-grid, banner, float 4 new layout primitives, full canon (morfo + eidos full set + canon demo + README). `npm run component:audit`: 81 / 81 PASS, 0 NEEDS-WORK. **AspectRatio** — composes through Box; emits single `--aspect-ratio` CSS var (uses modern CSS `aspect-ratio` property, drops legacy padding-bottom hack). Accepts numeric (16/9 → 1.777…) or string ("16/9") values. **AutoGrid** — composes through Grid. Resolves `templateColumns` from `minItemWidth` to `repeat(auto-fill, minmax(MIN, 1fr))` in JS so the recipe stays declarative. Uses `auto-fill` (not auto-fit) to preserve empty tracks when item count is low. **Banner** — `<header role="banner">` announcement strip with intent (full 8-role UIX `ColorRole`), variant (`ChipVariant` soft/solid/ outline/ghost), size (sm/md/lg). Dismissal is composition-driven: consumer wraps in {#if show} and adds `<Banner.Close>`. No `dismissible` boolean. **Float** — CSS `float` primitive with logical `inline-start` / `inline-end` sides. Redefined from air's 9-zone overlay primitive (which becomes a future `<Positioned>` component if real demand surfaces). Useful for inline images / pull-quotes / drop caps. Each component ships morfo (`scope: ['eidos']`, 1 part, 0 events, justified) + eidos set + README (Baseline / Comparativa / Decisiones / Eventos Sema / Gaps with disposition markers / Referencias / Passive justification) + canon demo with 6 tabs. Sidebar nav appends the 4 entries to the existing Layout group. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
import type { Morfo } from '../types';
/**
* Banner — full-bleed announcement strip with intent variants
* (layout primitive).
*
* Eidos-native: the provider is a `<header data-banner role="banner">`
* shell. The intent prop maps to a `data-intent="…"` selector (the
* standard UIX color-role channel for visual treatment) and the recipe
* pulls the matching `--color-{intent}-*` tokens. The explicit role
* stabilises the landmark across layouts — the HTML spec only grants
* `role="banner"` to `<header>` when it is a top-level child of `<body>`;
* nesting it inside `<main>`, `<article>`, or `<section>` loses the role.
*
* Justification for 0-event surface: Banner is a passive surface that
* shapes an announcement. The optional Close child is a composition
* concern (a `<button>` the consumer wires to their own visibility
* state) — Banner itself does not own a commit, an emerge, a keyboard
* contract, or any ARIA beyond the landmark role. Same passive
* justification as `box.ts` / `flex.ts`.
*
* Close is intentionally NOT a morfo part: it is rendered as an
* eidos-only wrapper that only adds visual treatment to a plain
* `<button>` the consumer provides. The four rules in
* `eidos/components/README.md → Partes Eidos-only` are met: no behavior,
* no aria contract (the consumer supplies `aria-label`), no event target
* role, no keyboard. The consumer handles the dismissal via their own
* onclick — Banner does not commit or emerge anything.
*/
export const bannerMorfo = {
name: 'Banner',
kebab: 'banner',
scope: ['eidos'],
parts: [
{
name: 'Provider',
kebab: 'provider',
archetype: 'provider',
kind: 'public',
defaultElement: 'header',
optional: false,
data: [],
aria: []
}
]
} as const satisfies Morfo;

Powered by TurnKey Linux.