@vanelsas/baredom 0.2.6-alpha → 1.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +16 -101
  2. package/README.md +15 -222
  3. package/dist/base.js +349 -346
  4. package/dist/x-alert.js +17 -17
  5. package/dist/x-avatar-group.js +11 -11
  6. package/dist/x-avatar.js +17 -17
  7. package/dist/x-badge.js +11 -11
  8. package/dist/x-breadcrumbs.js +14 -14
  9. package/dist/x-button.js +15 -15
  10. package/dist/x-cancel-dialogue.js +16 -16
  11. package/dist/x-card.js +7 -7
  12. package/dist/x-chart.js +47 -47
  13. package/dist/x-checkbox.js +11 -11
  14. package/dist/x-chip.js +8 -8
  15. package/dist/x-collapse.js +10 -10
  16. package/dist/x-command-palette.js +30 -30
  17. package/dist/x-container.js +6 -6
  18. package/dist/x-context-menu.js +19 -19
  19. package/dist/x-copy.js +22 -22
  20. package/dist/x-currency-field.js +21 -21
  21. package/dist/x-date-picker.js +37 -37
  22. package/dist/x-divider.js +13 -10
  23. package/dist/x-drawer.js +11 -11
  24. package/dist/x-dropdown.js +9 -9
  25. package/dist/x-fieldset.js +6 -6
  26. package/dist/x-file-download.js +7 -7
  27. package/dist/x-form-field.js +15 -15
  28. package/dist/x-form.js +9 -9
  29. package/dist/x-grid.js +7 -7
  30. package/dist/x-menu-item.js +10 -10
  31. package/dist/x-menu.js +10 -10
  32. package/dist/x-modal.js +12 -12
  33. package/dist/x-navbar.js +13 -12
  34. package/dist/x-notification-center.js +10 -9
  35. package/dist/x-pagination.js +16 -16
  36. package/dist/x-popover.js +14 -11
  37. package/dist/x-progress-circle.js +7 -7
  38. package/dist/x-progress.js +9 -8
  39. package/dist/x-radio.js +11 -11
  40. package/dist/x-search-field.js +14 -14
  41. package/dist/x-select.js +10 -10
  42. package/dist/x-sidebar.js +17 -26
  43. package/dist/x-skeleton.js +5 -5
  44. package/dist/x-slider.js +16 -16
  45. package/dist/x-spacer.js +5 -5
  46. package/dist/x-spinner.js +5 -5
  47. package/dist/x-stat.js +12 -9
  48. package/dist/x-stepper.js +16 -16
  49. package/dist/x-switch.js +10 -10
  50. package/dist/x-tab.js +8 -8
  51. package/dist/x-table-cell.js +20 -20
  52. package/dist/x-table-row.js +10 -10
  53. package/dist/x-table.js +15 -14
  54. package/dist/x-tabs.js +12 -11
  55. package/dist/x-text-area.js +17 -17
  56. package/dist/x-timeline-item.js +21 -21
  57. package/dist/x-timeline.js +9 -9
  58. package/dist/x-toast.js +23 -23
  59. package/dist/x-toaster.js +8 -8
  60. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,113 +2,28 @@
2
2
 
3
3
  All notable changes to BareDome will be documented in this file.
4
4
 
5
- ## [0.2.4-alpha] - 2026-03-30
5
+ ## [1.0.0-rc.2] - 2026-03-31
6
6
 
7
- ### Fixed
8
-
9
- - Multiple small changes to components code and docs so that they can be shipped
10
- - x-alert, x-avatar-group, x-avatar, x-badge, x-breadcrumbs, x-button, x-cancel-dialogue, x-card, x-chart, x-checkbox, x-chip, x-collapse, x-command-palette, x-container, x-context-menu, x-copy, x-currency-field, x-date-picker, x-divider, x-drawer, x-dropdown, x-fieldset, x-file-download, x-form-field, x-form, x-grid, x-menu-item, x-menu, x-modal are all stable now
11
-
12
- ## [0.2.3-alpha] - 2026-03-29
13
-
14
- ### Fixed
15
-
16
- - Code updates to x-alert, x-avatar-group, x-avatar, x-badge, x-breadcrumbs, x-cancel-dialogue, x-card, x-chart, x-checkbox, x-chip to improve quality
17
- - Accompanying docs updated where needed
18
-
19
- ## [0.2.2-alpha] - 2026-03-27
20
-
21
- ### Fixed
22
-
23
- - Code updates to x-button, x-alert, x-drawer, x-form, x-form-field to improve quality
24
- - Accompanying docs updated if needed
25
-
26
- ## [0.2.1-alpha] - 2026-03-27
27
-
28
- ### Fixed
29
-
30
- - Fixes tests for x-file-download
31
-
32
- ## [0.2.0-alpha] - 2026-03-27
33
-
34
- ### Fixed
35
-
36
- - Fixes design issues x-context-menu and x-modal
37
- - Fixes small bugs in x-file-download, x-fieldset, x-date-picker, x-button
38
-
39
- ## [0.1.11-alpha] - 2026-03-27
7
+ Release candidate — all components audited and stable.
40
8
 
41
9
  ### Changed
42
10
 
43
- - Renamed internal ClojureScript namespace root from `app` to `baredom` to match the published npm package name `@vanelsas/baredom`. No public API
44
- changes.
45
-
46
- ## [0.1.10-alpha] - 2026-03-27
47
-
48
- ## Fixed
49
-
50
- - Updates package.json to ensure the latest alpha version is also the latest version on NPM
51
- - Add report.html to .gitignore
52
-
53
- ## [0.1.9-alpha] - 2026-03-27
54
-
55
- ## Fixed
56
-
57
- - Updates build.clj and README.md
58
-
59
- ## [0.1.8-alpha] - 2026-03-27
60
-
61
- ## Fixed
62
-
63
- - Updates release.yml
64
-
65
- ## [0.1.7-alpha] - 2026-03-27
66
-
67
- ## Fixed
68
-
69
- - Updates package.json
70
- - Updates release.yml
71
-
72
- ## [0.1.6-alpha] - 2026-03-27
11
+ - All 54 components reviewed and updated for API consistency, accessibility, theming, Closure Advanced compilation safety, and test coverage
12
+ - Accompanying documentation and demo files updated for all components
13
+ - Namespace renamed from `app` to `baredom` to match published package name
73
14
 
74
- ## Fixed
75
-
76
- - Updates package.json
77
-
78
- ## [0.1.5-alpha] - 2026-03-27
79
-
80
- ## Fixed
81
-
82
- - Updates package.json
83
-
84
- ## [0.1.4-alpha] - 2026-03-27
85
-
86
- ## Fixed
87
-
88
- - renames Release in yml to release
89
-
90
- ## [0.1.3-alpha] - 2026-03-27
91
-
92
- ## Fixed
93
-
94
- - Fixes Release with OIDC
95
-
96
- ## [0.1.2-alpha] - 2026-03-27
97
-
98
- ## Fixed
99
-
100
- - Release with OIDC
101
-
102
- ## [0.1.1-alpha] - 2026-03-27
103
-
104
- ## Fixed
105
-
106
- - Fixes x-date-picker disabled
107
- - Fixes loading of logo in darkmode/lightmode in main demo
108
-
109
- ## Adds
15
+ ### Components
110
16
 
111
- - Pure HTML/JS demo + README.md
17
+ - **Layout** — x-container, x-grid, x-spacer, x-divider, x-sidebar, x-navbar
18
+ - **Typography & Display** — x-badge, x-chip, x-stat, x-avatar, x-avatar-group, x-skeleton
19
+ - **Feedback** — x-alert, x-spinner, x-progress, x-progress-circle, x-toast, x-toaster
20
+ - **Overlays** — x-modal, x-drawer, x-popover, x-context-menu, x-command-palette, x-cancel-dialogue
21
+ - **Navigation** — x-breadcrumbs, x-pagination, x-tab, x-tabs, x-menu, x-menu-item, x-stepper
22
+ - **Forms** — x-button, x-checkbox, x-radio, x-switch, x-select, x-slider, x-text-area, x-form, x-form-field, x-fieldset, x-search-field, x-currency-field, x-date-picker
23
+ - **Content** — x-card, x-collapse, x-chart, x-copy, x-file-download, x-dropdown
24
+ - **Data** — x-table, x-table-row, x-table-cell
25
+ - **Timeline** — x-timeline, x-timeline-item
26
+ - **Notifications** — x-notification-center
112
27
 
113
28
  ## [0.1.0-alpha] - 2026-03-25
114
29
 
package/README.md CHANGED
@@ -1,13 +1,5 @@
1
1
  # BareDOM
2
2
 
3
- <p align="left">
4
- <picture>
5
- <source media="(prefers-color-scheme: dark)" srcset="public/assets/baredom_darkmode.svg">
6
- <source media="(prefers-color-scheme: light)" srcset="public/assets/baredom_lightmode.svg">
7
- <img alt="Baredom Logo" src="public/assets/baredom_lightmode.svg" width="120">
8
- </picture>
9
- </p>
10
-
11
3
  **Native web components. Zero runtime. No framework required.**
12
4
 
13
5
  [![npm version](https://img.shields.io/npm/v/%40vanelsas%2Fbaredom.svg)](https://www.npmjs.com/package/@vanelsas/baredom)
@@ -37,14 +29,6 @@ BareDOM has been created using Claude Code. The CLAUDE.md file is added to the r
37
29
 
38
30
  ## Why BareDOM?
39
31
 
40
- I started working on BareDOM after going though all the motions that Clojure developers often go through when deciding to build a UI. I worked with Reagent and Re-frame and in general the experience was pretty good. At some point I was building larger UI's with reusable components that were pretty basic (e.g. inputs, buttons etc). For complex UI's the bundle size became larger and larger.
41
-
42
- I wondered if there would be a better way to do this, and I ended up reading about web components. It seemed like a good idea to try that. For me it as a learning exercise, trying to understand how it all works. I tried to build a few, and had to learn how to do that in Clojurescript. Building a larger set of web components is quite a bit of work.
43
-
44
- When Claude Code appeared, I was thinking about a project to try it out with, and web components seemed like a good fit. I picked up the project again and started to build Clojurescript based web components assisted by Claude. A good experiment to work with AI tooling and build something I find interesting myself.
45
-
46
- The project is still in an alpha state. The components and demo's work, but there are bound to be some things not working properly yet. Feel free to give it a spin.
47
-
48
32
  **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.
49
33
 
50
34
  **No framework lock-in.** Your components are not tied to the framework you are building with today. Migrate your app, keep your components.
@@ -63,188 +47,44 @@ The project is still in an alpha state. The components and demo's work, but ther
63
47
 
64
48
  ## Installation
65
49
 
66
- BareDOM can be consumed in three ways. Pick the one that matches your stack.
67
-
68
- ---
69
-
70
- ### Option 1 — ClojureScript via Clojars
71
-
72
- This is the primary distribution for ClojureScript projects. Add the dependency to your `deps.edn`:
73
-
74
- ```clojure
75
- {:deps {com.github.avanelsas/baredom {:mvn/version "0.1.10-alpha"}}}
76
- ```
77
-
78
- Or, if you use Leiningen, add to `:dependencies` in `project.clj`:
79
-
80
- ```clojure
81
- [com.github.avanelsas/baredom "0.1.10-alpha"]
82
- ```
83
-
84
- Components live under the `app.exports` namespace. Require only what you use — unused namespaces are eliminated by the Closure compiler:
85
-
86
- ```clojure
87
- (ns my-app.core
88
- (:require [app.exports.x-button :as x-button]
89
- [app.exports.x-alert :as x-alert]
90
- [app.exports.x-toaster :as x-toaster]
91
- [app.exports.x-toast :as x-toast]))
92
-
93
- (defn- register-components! []
94
- (x-button/register!)
95
- (x-alert/register!)
96
- (x-toaster/register!)
97
- (x-toast/register!))
98
- ```
99
-
100
- Call `register-components!` once in your `init!` entry point. Registration is idempotent — calling `register!` on an already-registered element is a no-op.
101
-
102
- ---
103
-
104
- ### Option 2 — npm (JavaScript / TypeScript projects)
105
-
106
- If your project uses npm, install the package:
107
-
108
- ```bash
109
- npm install @vanelsas/baredom
110
- ```
111
-
112
- Or add it manually to `package.json`:
50
+ **Step 1 — Add the npm dependency to your `package.json`:**
113
51
 
114
52
  ```json
115
53
  {
116
54
  "dependencies": {
117
- "@vanelsas/baredom": "^0.1.0-alpha"
55
+ "@vanelsas/baredom": "^1.0.0-rc.2"
118
56
  }
119
57
  }
120
58
  ```
121
59
 
122
- Each component is a separate ES module — import only what you need:
123
-
124
- ```js
125
- import { init as initButton } from "@vanelsas/baredom/x-button";
126
- import { init as initAlert } from "@vanelsas/baredom/x-alert";
60
+ Then run `npm install`.
127
61
 
128
- initButton();
129
- initAlert();
130
- ```
131
-
132
- > **shadow-cljs users using npm:** no extra configuration needed. shadow-cljs resolves npm packages from `node_modules` automatically. You can use `["@vanelsas/baredom/x-button" :as x-button]` in `:require` and call `(.init x-button)`.
62
+ **Step 2 — shadow-cljs:** no extra configuration needed. shadow-cljs resolves npm packages automatically via the `:npm-deps` or `node_modules` integration built into every shadow-cljs project.
133
63
 
134
64
  ---
135
65
 
136
- ### Option 3 — CDN (no build step)
137
-
138
- BareDOM components are standard ES modules. Load them directly in any HTML page using a CDN — no npm, no bundler, no framework required.
139
-
140
- #### Import and initialise
141
-
142
- ```html
143
- <!DOCTYPE html>
144
- <html lang="en">
145
- <head>
146
- <meta charset="UTF-8">
147
- <title>My App</title>
148
- </head>
149
- <body>
150
-
151
- <x-button variant="primary">Hello</x-button>
152
- <x-alert type="success" text="It works!"></x-alert>
153
-
154
- <script type="module">
155
- import { init as initButton } from "https://esm.sh/@vanelsas/baredom/x-button";
156
- import { init as initAlert } from "https://esm.sh/@vanelsas/baredom/x-alert";
157
-
158
- initButton();
159
- initAlert();
160
- </script>
161
-
162
- </body>
163
- </html>
164
- ```
165
-
166
- `<script type="module">` is required because BareDOM components are ES modules. Each `init()` call registers the custom element with the browser. Only the components you import are loaded — unused components cost nothing.
167
-
168
- #### Set attributes in HTML
169
-
170
- Every attribute can be set directly in markup:
171
-
172
- ```html
173
- <x-button variant="secondary" size="sm" disabled>Cancel</x-button>
174
- <x-checkbox checked></x-checkbox>
175
- <x-alert type="warning" text="Check your input." dismissible></x-alert>
176
- <x-progress value="65" max="100"></x-progress>
177
- ```
178
-
179
- Boolean attributes follow the HTML convention: presence means `true`, absence means `false`.
180
-
181
- #### Handle events
182
-
183
- ```html
184
- <x-button id="btn" variant="primary">Click me</x-button>
185
- <x-tabs id="tabs" value="home">
186
- <x-tab value="home">Home</x-tab>
187
- <x-tab value="settings">Settings</x-tab>
188
- </x-tabs>
189
-
190
- <script type="module">
191
- import { init as initButton } from "https://esm.sh/@vanelsas/baredom/x-button";
192
- import { init as initTabs } from "https://esm.sh/@vanelsas/baredom/x-tabs";
193
- import { init as initTab } from "https://esm.sh/@vanelsas/baredom/x-tab";
194
-
195
- initButton(); initTabs(); initTab();
196
-
197
- document.getElementById("btn").addEventListener("click", () => {
198
- console.log("button clicked");
199
- });
200
-
201
- document.getElementById("tabs").addEventListener("value-change", e => {
202
- console.log("active tab:", e.detail.value);
203
- });
204
- </script>
205
- ```
206
-
207
- Custom events carry a `detail` payload — check the individual component docs for the event name and `detail` shape.
208
-
209
- #### Theme with CSS custom properties
210
-
211
- ```html
212
- <style>
213
- :root {
214
- --x-button-radius: 4px;
215
- --x-button-bg-primary: #0a5c99;
216
- }
217
- </style>
218
- ```
219
-
220
- CSS custom properties cascade normally into the open Shadow DOM. No JavaScript required for theming.
221
-
222
- ---
223
-
224
- ## Usage (ClojureScript)
225
-
226
- The examples below use the Clojars distribution. If you installed via npm, replace the `app.exports.*` requires with `["@vanelsas/baredom/x-button" :as x-button]` etc., and call `(.init x-button)` instead of `(x-button/register!)`.
66
+ ## Usage
227
67
 
228
68
  ### 1. Register components
229
69
 
230
- Require each component namespace you need and call `register!` on it once, before any rendering. Only the components you require are included in your build.
70
+ Require each component module you need and call `.init` on it once, before any rendering. Only the components you require are included in your bundle.
231
71
 
232
72
  ```clojure
233
73
  (ns my-app.core
234
74
  (:require
235
- [app.exports.x-button :as x-button]
236
- [app.exports.x-alert :as x-alert]
237
- [app.exports.x-toaster :as x-toaster]
238
- [app.exports.x-toast :as x-toast]))
75
+ ["@vanelsas/baredom/x-button" :as x-button]
76
+ ["@vanelsas/baredom/x-alert" :as x-alert]
77
+ ["@vanelsas/baredom/x-toaster" :as x-toaster]
78
+ ["@vanelsas/baredom/x-toast" :as x-toast]))
239
79
 
240
80
  (defn- register-components! []
241
- (x-button/register!)
242
- (x-alert/register!)
243
- (x-toaster/register!)
244
- (x-toast/register!))
81
+ (.init x-button)
82
+ (.init x-alert)
83
+ (.init x-toaster)
84
+ (.init x-toast))
245
85
  ```
246
86
 
247
- Call `register-components!` once in your `init!` entry point. Registration is idempotent — calling `register!` on an already-registered element is a no-op.
87
+ Call `register-components!` once in your `init!` entry point. Registration is idempotent — calling `.init` on an already-registered element is a no-op.
248
88
 
249
89
  ### 2. Add a renderer
250
90
 
@@ -579,53 +419,6 @@ See [`bare-demo/README.md`](./bare-demo/README.md) for a full walkthrough of the
579
419
 
580
420
  ---
581
421
 
582
- ## bare-reagent-demo — Reagent usage example
583
-
584
- The `bare-reagent-demo/` folder is visually identical to `bare-demo` but replaces the custom hiccup renderer with [Reagent](https://reagent-project.github.io/) — a minimalist ClojureScript wrapper around React. It demonstrates the integration patterns and trade-offs that arise when pairing a virtual-DOM framework with native Custom Elements.
585
-
586
- The key differences from `bare-demo`:
587
-
588
- - **`reagent.core/atom`** drives reactivity. Any component that dereferences a ratom with `@` re-renders automatically — no `add-watch` or manual render trigger required.
589
- - **Standard events** (`:on-click`) work transparently through React's synthetic event system.
590
- - **Custom events** (`x-modal-dismiss`, `toggle`) are not handled by React and must be wired imperatively. The demo uses `reagent/create-class` lifecycle hooks (`component-did-mount` / `component-will-unmount`) and `rdom/dom-node` to attach and clean up native event listeners on the real DOM element.
591
-
592
- **Run it:**
593
-
594
- ```bash
595
- cd bare-reagent-demo
596
- npm install
597
- npm start
598
- ```
599
-
600
- Then open `http://localhost:8002`.
601
-
602
- See [`bare-reagent-demo/README.md`](./bare-reagent-demo/README.md) for a full code walkthrough, the custom-event workaround, and a side-by-side comparison with `bare-demo`.
603
-
604
- ---
605
-
606
- ## bare-html — HTML/JS only demo
607
-
608
- The `bare-html/` folder contains the same demo — navbar, sidebar, modal, and event log — written entirely in plain HTML and JavaScript. There is no ClojureScript, no build step, and no bundler. Components are loaded by importing their pre-built ES modules directly from the `dist/` folder using a `<script type="module">` tag.
609
-
610
- The implementation uses three ideas:
611
-
612
- - **Declarative HTML markup.** All components are written as custom element tags in the HTML source. Attributes are set directly in markup or via `setAttribute` / `removeAttribute` from JavaScript.
613
- - **A plain state object and a `render()` function.** A simple JS object holds `sidebarOpen`, `modalOpen`, and `activeNav`. The `render()` function reads this object and reconciles attributes — open/close state is a single `setAttribute` or `removeAttribute` call.
614
- - **Native event listeners.** `x-button` fires a `press` event; `x-sidebar` fires `toggle` with `detail.open`; `x-modal` fires `x-modal-dismiss` on Escape or backdrop click. All are wired with standard `addEventListener`.
615
-
616
- **Run it:**
617
-
618
- ```bash
619
- # From the project root
620
- python3 -m http.server 8000
621
- ```
622
-
623
- Then open `http://localhost:8000/bare-html/demo.html`. The demo must be served over HTTP — ES module imports are blocked by browsers on `file://` URLs.
624
-
625
- See [`bare-html/README.md`](./bare-html/README.md) for a full walkthrough and a comparison with `bare-demo`.
626
-
627
- ---
628
-
629
422
  ## Building from Source
630
423
 
631
424
  BareDOM is authored in ClojureScript and compiled with [shadow-cljs](https://shadow-cljs.github.io/docs/UsersGuide.html).