From dd2917a4ac7db630b5c936d78b06b0485f5056f9 Mon Sep 17 00:00:00 2001 From: Alexander van Elsas <58037137+avanelsas@users.noreply.github.com> Date: Tue, 26 May 2026 14:08:40 +0200 Subject: [PATCH 1/3] docs(readme): promote framework adapters, trim theming, fix structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restructures the root README so first-time visitors see install → working example → framework options → catalogue without scrolling past project narrative. Changes: - New "Framework adapters" section between Installation and Components with a comparison table for all five published adapters (React, Vue, Angular, Svelte, Solid) linking to each adapter's README + npm page. Previously the README mentioned React and Angular only. - Theming section trimmed from 37 lines to 6: one paragraph, the eight preset names, and links to docs/x-theme.md (full API) and docs/THEMING.md (token catalogue). registerPreset and CSS-override examples are already in docs/x-theme.md. - Installation gains a working "Quick start" snippet — minimal HTML page rendering x-button + x-alert inside x-theme — replacing the bare import-init stub. - Origin story ("Why BareDOM?") moved to the bottom as "About" so it no longer pushes install/quick-start below the fold. - BareForge section moved below Components — companion product reads as "also check this out" rather than competing with the catalogue. - "Why web components?" heading fixed from H1 to H2 (was a hierarchy bug breaking the section nesting). - Custom Elements Manifest promoted from a parenthetical inside the TypeScript bullet to its own bullet — it's what makes the typed adapters work and was previously buried. Net: 290 lines (was 300), 62 insertions / 72 deletions. Co-Authored-By: Claude Opus 4.7 (1M context) --- README.md | 134 +++++++++++++++++++++++++----------------------------- 1 file changed, 62 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 76cd0f16..7f733160 100644 --- a/README.md +++ b/README.md @@ -38,15 +38,7 @@ All components can be explored in the [live demo](https://avanelsas.github.io/ba --- -## Why BareDOM? - -Like most Clojure/ClojureScript developers starting out with UIs, I went through the common phases of using Reagent and Re-frame—which are great utilities in their own right. However, as my UIs became larger and more complex, bundle sizes increased, and I found myself spending too much time rebuilding generic, reusable components from scratch. - -I started looking for a different approach and discovered Web Components. I built a few, but didn't have the spare time to develop a comprehensive set that could be used in any project. Then AI arrived. While experimenting with Claude Code, I realised that 1 + 1 could be 3. That is how BareDOM, my first open-source project, was born. - -I first built the usual suspects for web components, a basis to create a UI. I then thought about trying something more exciting, with animations, shapes, colours, and a whole range of web components that deal with morphing, kinetics and organic styles were born. I hope it brings you joy when using them in your web application! - -# Why web components? +## Why web components? **Works in any stack.** Because components are native HTML elements, they work wherever HTML works — vanilla JavaScript, React, Vue, Svelte, Angular, server-rendered HTML, or a static page. No adapter layer, no wrapper library. @@ -64,89 +56,54 @@ I first built the usual suspects for web components, a basis to create a UI. I t **Open Shadow DOM.** Shadow roots are `mode: "open"` — inspectable in DevTools, styleable via `::part()`, and testable with standard DOM APIs. -**First-class TypeScript support.** Every component ships with auto-generated `.d.ts` type declarations and a [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest). TypeScript consumers get typed element interfaces, typed custom events with detail payloads, and `HTMLElementTagNameMap` augmentation for `querySelector` type narrowing — all without installing a separate `@types` package. - ---- - -## BareForge — Visual Page Builder - -[![GitHub](https://img.shields.io/github/stars/avanelsas/bareforge?style=social)](https://github.com/avanelsas/bareforge) - -[BareForge](https://github.com/avanelsas/bareforge) is a companion visual landing-page builder for BareDOM. Drag-and-drop BareDOM components onto a canvas, configure them in the inspector, and export a complete project. +**First-class TypeScript support.** Every component ships with auto-generated `.d.ts` type declarations. TypeScript consumers get typed element interfaces, typed custom events with detail payloads, and `HTMLElementTagNameMap` augmentation for `querySelector` type narrowing — all without installing a separate `@types` package. -- **Drag-and-drop canvas** with snap-aware placement -- **Inspector** with type-aware editors for every BareDOM component -- **Theme editor** with all 8 BareDOM presets and per-token overrides -- **Four export modes** — CDN, bundle, ClojureScript, and JavaScript - -Try the [live editor](https://avanelsas.github.io/bareforge/) or see the [repository](https://github.com/avanelsas/bareforge) for details. +**Standards-based metadata.** Every component also ships a [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest) — the same machine-readable interface description used by Storybook, VS Code Custom Data, and the BareDOM framework adapters themselves to generate typed wrappers. If you build tooling on top of BareDOM, the manifest is the source of truth. --- -## Theming - -Wrap any subtree in `` to apply a consistent palette across all components: +## Installation -```html - - Themed button - - +```bash +npm install @vanelsas/baredom ``` -Ships with **8 built-in presets**: `default`, `ocean`, `forest`, `sunset`, `neo-brutalist`, `aurora`, `mono-ai`, `warm-mineral`. All presets include both light and dark mode values that work with `prefers-color-scheme`. - -For custom themes, register your own preset via JavaScript: +Also available via [Clojars](./docs/installation.md#clojurescript-via-clojars) and [standalone ES modules](./docs/installation.md#vanilla-htmljs-via-es-modules). See the [full installation guide](./docs/installation.md). -```js -import { registerPreset } from '@vanelsas/baredom/x-theme'; +### Quick start -registerPreset('acme', { - light: { '--x-color-primary': '#e11d48', '--x-color-surface': '#fff' }, - dark: { '--x-color-primary': '#fb7185', '--x-color-surface': '#1a1a2e' } -}); -``` +A minimal page that renders a themed button and alert — no build step required: ```html -... -``` - -Or override individual tokens via CSS: - -```html - - ... + + Click me + + ``` -See [docs/x-theme.md](./docs/x-theme.md) for the full token list, preset details, and API reference. +For deeper usage by stack, see the [JavaScript Developer Guide](./docs/javascript-guide.md), [TypeScript Guide](./docs/typescript.md), or [ClojureScript Guide](./docs/clojurescript-guide.md). --- -## Installation - -```bash -npm install @vanelsas/baredom -``` - -```js -import { init } from '@vanelsas/baredom/x-button'; -init(); -``` +## Framework adapters -Also available via [Clojars](./docs/installation.md#clojurescript-via-clojars) and [standalone ES modules](./docs/installation.md#vanilla-htmljs-via-es-modules). See the [full installation guide](./docs/installation.md). - ---- +BareDOM components are native HTML elements — they work natively in any framework, with no adapter required. The published adapters below add typed props, typed custom events, and framework-idiomatic ergonomics on top of the same underlying components. -## Usage +| Framework | Package | Minimum version | Docs | +|-----------|---------|-----------------|------| +| React 19+ | `@vanelsas/baredom-react` | 2.6.0 | [README](./adapters/react/README.md) · [npm](https://www.npmjs.com/package/@vanelsas/baredom-react) | +| Vue 3.4+ | `@vanelsas/baredom-vue` | 2.6.0 | [README](./adapters/vue/README.md) · [npm](https://www.npmjs.com/package/@vanelsas/baredom-vue) | +| Angular 17+ | `@vanelsas/baredom-angular` | 2.6.0 | [README](./adapters/angular/README.md) · [npm](https://www.npmjs.com/package/@vanelsas/baredom-angular) | +| Svelte 5+ | `@vanelsas/baredom-svelte` | 2.6.0 | [README](./adapters/svelte/README.md) · [npm](https://www.npmjs.com/package/@vanelsas/baredom-svelte) | +| Solid 1.9+ | `@vanelsas/baredom-solid` | 2.6.0 | [README](./adapters/solid/README.md) · [npm](https://www.npmjs.com/package/@vanelsas/baredom-solid) | -BareDOM components are native HTML elements. Import, register, and use them in any framework or vanilla HTML. - -- **JavaScript / TypeScript** — see the [JavaScript Developer Guide](./docs/javascript-guide.md) -- **TypeScript types** — see the [TypeScript Guide](./docs/typescript.md) -- **ClojureScript** — see the [ClojureScript Guide](./docs/clojurescript-guide.md) -- **React** — see [`@vanelsas/baredom-react`](https://www.npmjs.com/package/@vanelsas/baredom-react) -- **Angular** — see [`@vanelsas/baredom-angular`](https://www.npmjs.com/package/@vanelsas/baredom-angular) +All adapters are auto-generated from the same Custom Elements Manifest, so adding a new BareDOM component updates every adapter in lockstep. --- @@ -242,6 +199,29 @@ BareDOM components are native HTML elements. Import, register, and use them in a --- +## Theming + +Wrap any subtree in `` to apply a coordinated palette across every BareDOM component inside it. Eight presets ship in the box — `default`, `ocean`, `forest`, `sunset`, `neo-brutalist`, `aurora`, `mono-ai`, `warm-mineral` — each with light and dark variants that follow `prefers-color-scheme`. + +Register your own preset, override individual tokens via CSS, or nest themes for per-section palettes. See [`docs/x-theme.md`](./docs/x-theme.md) for the full API (presets, `registerPreset`, CSS overrides) and [`docs/THEMING.md`](./docs/THEMING.md) for the token catalogue. + +--- + +## BareForge — Visual Page Builder + +[![GitHub](https://img.shields.io/github/stars/avanelsas/bareforge?style=social)](https://github.com/avanelsas/bareforge) + +[BareForge](https://github.com/avanelsas/bareforge) is a companion visual landing-page builder for BareDOM. Drag-and-drop BareDOM components onto a canvas, configure them in the inspector, and export a complete project. + +- **Drag-and-drop canvas** with snap-aware placement +- **Inspector** with type-aware editors for every BareDOM component +- **Theme editor** with all 8 BareDOM presets and per-token overrides +- **Four export modes** — CDN, bundle, ClojureScript, and JavaScript + +Try the [live editor](https://avanelsas.github.io/bareforge/) or see the [repository](https://github.com/avanelsas/bareforge) for details. + +--- + ## Design Principles **Stateless.** No `atom`, no signal, no reactive state container lives inside a component. Every render is a pure function of the current attributes and properties. Debugging a component means inspecting attributes in DevTools — no hidden state to hunt for. For deeper investigations, the optional [`x-trace-history`](./docs/x-trace-history.md) dev tool ships as a separate ESM module and records every dispatch, attribute change, and lifecycle callback as a navigable timeline with cause→effect chains. Load it with `