Zum Hauptinhalt springen
VelinStyle v1.2.0
⌂ Home
  1. Docs
  2. Erweitern
  3. Web Components

Web Components 1.2.0

VelinStyle stellt 40 kanonische Web Components bereit (42 Lazy-Loader-Einträge inklusive Legacy velin-tooltip-wc und velin-stepper-wc). Alle nutzen Shadow DOM oder Light DOM mit XSS-sicherem Escaping, wo Inhalte dynamisch sind. English: Web Components

Reifegrad: Dokumentiert als stabil in VelinStyle 1.2.0. Design Intelligence (plan / review / agent meta) ist separat und dort beta / foundation, wo es angegeben ist.

Wann verwenden

Wann nicht

register / bootFromDOM

import { register, bootFromDOM } from '@birdapi/velinstyle';

await register(['velin-modal', 'velin-toast']);
await bootFromDOM(document, {
  attributes: true,  // bootAttributes + initMotion
  highlight: true,   // optional syntax highlighting
  haptic: false,
});

bootFromDOM scans for velin-* tags and data-velin-component, then registers only those loaders. Options wire core/attributes, core/highlight, and haptic observers.

Attribute bridges (e.g. velin-modal on a button) set data-velin-component and call lazyDefine — see HTML attributes.

Überblick

All components are custom elements registered under the velin- prefix. Include the component bundle to use them:

<script type="module" src="../../dist/velinstyle-components.iife.js"></script>

Komponentenliste

KomponenteBeschreibung
<velin-icon>SVG icon from the built-in sprite
<velin-dialog>Accessible modal dialog with focus trapping
<velin-drawer>Slide-out panel from any edge
<velin-dropdown>Dropdown menu with keyboard navigation
<velin-accordion>Collapsible content sections
<velin-tabs>Tab panel with ARIA roles
<velin-tooltip>Contextual tooltip
<velin-popover>Rich popover content
<velin-toast>Toast notification manager
<velin-carousel>Touch-friendly carousel
<velin-collapse>Expandable/collapsible content
<velin-scrollspy>Scroll position link highlighting
<velin-lightbox>Fullscreen image/video gallery
<velin-stepper>Multi-step progress indicator
<velin-countdown>Live countdown timer — docs
<velin-progress-ring>Circular progress indicator
<velin-copy>One-click copy to clipboard — docs
<velin-scroll-top>Floating back-to-top button — docs
<velin-theme-toggle>Light/dark + theme picker — docs
<velin-persist>Auto-save form data to storage — docs
<velin-data-table>Sortable, filterable, paginated tables — docs
<velin-form-summary>Accessible validation error summary — docs
<velin-modal>Accessible modal with focus trapping

Layout-Stabilität (CLS)

Before custom elements upgrade, src/base/wc-placeholder.css reserves min dimensions per display mode (block, inline, fixed, display:contents) so pages do not shift when scripts load. Enthalten in the main CSS bundle.

All components ship with TypeScript definitions. Import types from dist/velinstyle.d.ts.

Fokusmanagement

Components that overlay content (dialog, drawer, dropdown) automatically trap focus and restore it when closed — following WAI-ARIA best practices.

TypeScript

Typdefinitionen sind im npm-Paket enthalten. Importiere Typen direkt:

<script lang="ts">
import type { VelinDialog } from '@birdapi/velinstyle'; // see dist/velinstyle.d.ts

const dialog = document.querySelector('velin-dialog') as VelinDialog;
dialog.open();
</script>