@corvaui/vanilla
v0.2.1
Published
Typed, framework-free CorvaUI registration and custom-element helpers.
Readme
@corvaui/vanilla
Framework-free CorvaUI registration, typed custom-element APIs, and generated per-component registration helpers.
npm install @corvaui/vanilla @corvaui/tokensimport "@corvaui/tokens/css";
import { defineCorvaUI, onCorvaEvent, setCorvaProperty } from "@corvaui/vanilla";
await defineCorvaUI();
const chart = document.querySelector("corva-chart");
if (chart) {
setCorvaProperty(chart, "data", [{ label: "Ready", value: 92 }]);
}
const select = document.querySelector("corva-select");
const stopListening = select
? onCorvaEvent<{ value: string }>(select, "corvaChange", ({ detail }) => {
console.info(detail.value);
})
: () => {};Use light-DOM children for the default slot and the native slot attribute for
named slots. Themes are scoped with data-corva-theme and may change at
runtime without registering components again:
<section data-corva-theme="corva-light">
<corva-app-bar heading="Workspace">
<corva-button slot="actions">Save</corva-button>
</corva-app-bar>
</section>Register only selected elements when bundle control matters:
import { defineCorvaButton, defineCorvaCard } from "@corvaui/vanilla/components";
defineCorvaButton();
defineCorvaCard();Both full and per-component registration are idempotent. defineCorvaUI
returns false during SSR instead of touching browser globals. Use attributes
for simple values and setCorvaProperty for arrays and objects. Call the
cleanup returned by onCorvaEvent when its owning view is removed. See the
CorvaUI documentation and included
support policy for themes, events, complex properties, and
supported runtimes.
