Installation
Alacris is ESM-only and has no dependencies. There is nothing to configure.
From a CDN
Section titled “From a CDN”The fastest way to try it, and a perfectly good way to ship it. No bundler, no install:
<script type="module"> import { define, html, signal } from 'https://unpkg.com/@alacris/core@0.11.3';
define('hello-world', () => html`<p>hello</p>`);</script>
<hello-world></hello-world>import { define, html, signal } from 'https://unpkg.com/@alacris/core@0.11.3';import { store } from 'https://unpkg.com/@alacris/core@0.11.3/dist/store.js';import { createContext } from 'https://unpkg.com/@alacris/core@0.11.3/dist/context.js';import { define, html, signal } from 'https://cdn.jsdelivr.net/npm/@alacris/core@0.11.3/+esm';An import map lets you write bare specifiers without a bundler — the same thing this documentation site does for its live examples.
<script type="importmap"> { "imports": { "@alacris/core": "https://unpkg.com/@alacris/core@0.11.3/dist/alacris.js", "@alacris/core/store": "https://unpkg.com/@alacris/core@0.11.3/dist/store.js", "@alacris/core/context": "https://unpkg.com/@alacris/core@0.11.3/dist/context.js" } }</script><script type="module"> import { define, html, signal } from '@alacris/core';</script>From npm
Section titled “From npm”npm install @alacris/coreimport { define, html, signal, computed, effect } from '@alacris/core';import { store, selector } from '@alacris/core/store';import { createContext, provide, consume } from '@alacris/core/context';TypeScript declarations ship with the package. There is nothing to add.
A component library, not a blank runtime
Section titled “A component library, not a blank runtime”If you want buttons, fields, and a theme rather than starting from
define(...), install Alacris UI (@alacris/ui
on npm). It is sixty-eight custom elements and a theme engine, and it works
in any framework that can render a tag.
The entry points
Section titled “The entry points”Add-ons import the core rather than bundling it, so there is exactly one reactive graph at runtime however many you use.
| Import | What it is | gzip |
|---|---|---|
@alacris/core | signals, templates, styling, custom elements | 6.56 kB |
@alacris/core/store | deep reactive state, selector | 1.03 kB |
@alacris/core/context | the context protocol | 0.54 kB |
@alacris/core/signal | reactivity alone, no DOM | 1.03 kB |
If you use a bundler, anything you do not import is tree-shaken away — the
package is marked sideEffects: false.
Browser support
Section titled “Browser support”Alacris uses <template>, TreeWalker, custom elements and — for styles —
constructable stylesheets, with a <style> fallback where those are missing.
That means Chrome and Edge 86+, Safari 16.4+, and Firefox 101+. There are no polyfills and no transpiled build; the published code is modern ESM.
- Your first component — the whole model in one file
- Alacris UI catalog — every component, live
- Alacris UI — buttons, fields, and a theme, from npm