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/eidos/components/float/float.svelte

50 lines
1.3 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
<script lang="ts">
/**
* Eidos `<Float>` — pulls its child to the start or end of the text
* flow so adjacent inline content wraps around it. Composes through
* `<Box>` and writes a `--float-side` / `--float-gap` pair that the
* recipe consumes via `float: inline-{start | end}` + a logical
* margin against the text. Typical uses: inline images, pull-quotes,
* drop caps.
*
* <p>
* <Float side="start" maxWidth={120}>
* <img src="…" alt="…" />
* </Float>
* Long paragraph that wraps around the float…
* </p>
*/
import { ActiveEidos } from '$uix/eidos';
import Box from '../box/box.svelte';
import { composeStyle, formatLayoutSpace, pushStyleVar } from '../_layout/shared';
import type { FloatProps } from './types';
let {
side = 'start',
gap = 3,
style,
class: className,
children,
...restProps
}: FloatProps = $props();
const eidos = ActiveEidos.require();
const resolvedSide = $derived(eidos.resolve(side) ?? 'start');
const resolvedStyle = $derived.by(() => {
const decls: string[] = [];
pushStyleVar(decls, '--float-gap', formatLayoutSpace(eidos.resolve(gap)));
return composeStyle(decls, style);
});
</script>
<Box
{...restProps}
class={className}
style={resolvedStyle}
data-float=""
data-side={resolvedSide}
>
{@render children?.()}
</Box>

Powered by TurnKey Linux.