@thebase/ui 1.1.6 → 1.2.0

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 (63) hide show
  1. package/CHANGELOG.md +80 -1
  2. package/README.md +9 -5
  3. package/bin/create-baseui-app.mjs +31 -8
  4. package/dist/baseui.apidoc.esm.js +68 -60
  5. package/dist/baseui.apidoc.min.js +68 -60
  6. package/dist/baseui.esm.js +44 -47
  7. package/dist/baseui.icons.esm.js +1 -1
  8. package/dist/baseui.min.css +2 -2
  9. package/dist/baseui.min.js +62 -46
  10. package/dist/baseui.pwa.esm.js +71 -9
  11. package/dist/baseui.registry.json +26 -33
  12. package/dist/baseui.templates.xml +353 -370
  13. package/dist/baseui.vite.esm.js +116 -0
  14. package/dist/runtime/lazy/apidoc.logic.js +20 -0
  15. package/dist/runtime/milkdown/milkdown-editor.js +1 -1
  16. package/dist/runtime/milkdown/milkdown-text-editor.js +1 -1
  17. package/dist/themes/baseui-dark.css +80 -1
  18. package/dist/themes/baseui-dark.min.css +1 -0
  19. package/dist/themes/baseui-light.css +81 -1
  20. package/dist/themes/baseui-light.min.css +1 -0
  21. package/dist/types/pwa.d.ts +1 -45
  22. package/dist/types/vite.d.ts +4 -0
  23. package/docs/analytics.md +3 -3
  24. package/docs/base-ui-skill.md +54 -0
  25. package/docs/blocks.md +1 -1
  26. package/docs/components/accordion.md +4 -4
  27. package/docs/components/apidoc.md +1 -1
  28. package/docs/components/block-viewer.md +1 -1
  29. package/docs/components/breadcrumb.md +1 -1
  30. package/docs/components/button.md +1 -1
  31. package/docs/components/chart.md +2 -0
  32. package/docs/components/code-editor.md +77 -0
  33. package/docs/components/combobox.md +10 -0
  34. package/docs/components/data-table.md +2 -2
  35. package/docs/components/date-picker.md +10 -0
  36. package/docs/components/dialog.md +5 -5
  37. package/docs/components/empty.md +1 -1
  38. package/docs/components/field.md +8 -0
  39. package/docs/components/form.md +29 -29
  40. package/docs/components/input.md +28 -2
  41. package/docs/components/kbd.md +3 -6
  42. package/docs/components/markdown.md +3 -1
  43. package/docs/components/message-scroller.md +3 -8
  44. package/docs/components/native-select.md +13 -0
  45. package/docs/components/navigation-menu.md +2 -0
  46. package/docs/components/pwa.md +1 -1
  47. package/docs/components/select.md +16 -0
  48. package/docs/components/shell.md +4 -2
  49. package/docs/components/sidebar.md +18 -16
  50. package/docs/components/switch.md +11 -0
  51. package/docs/components/text-editor.md +1 -1
  52. package/docs/components/textarea.md +23 -0
  53. package/docs/components/theme-button.md +1 -1
  54. package/docs/components/toast.md +10 -10
  55. package/docs/components/typography.md +21 -2
  56. package/docs/icons.md +1 -1
  57. package/docs/installation.md +2 -2
  58. package/docs/owl-components.md +1 -1
  59. package/docs/runtime-api.md +2 -2
  60. package/docs/theming.md +33 -3
  61. package/docs/usage-guide.md +23 -6
  62. package/package.json +6 -1
  63. package/docs/components/input-group.md +0 -68
@@ -166,7 +166,7 @@ import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarMenu, Sid
166
166
 
167
167
  Reusable nav-content primitives, extracted from the recurring group/item shapes across the `sidebar-*` example blocks (`examples/blocks/sidebar-01.html`, `-02`, `-03`, `-08`, `-10`, etc.). Compose them instead of hand-rolling static markup for each new sidebar.
168
168
 
169
- `SidebarMenu` (`.bu-sidebar-menu`) fills the remaining height of the panel and scrolls on its own (`overflow-y: auto`) when its items overflow. `SidebarHeader` and `SidebarFooter` stay in place, so a long nav list no longer pushes the footer off-screen.
169
+ `SidebarMenu` (`.b-sidebar-menu`) fills the remaining height of the panel and scrolls on its own (`overflow-y: auto`) when its items overflow. `SidebarHeader` and `SidebarFooter` stay in place, so a long nav list no longer pushes the footer off-screen.
170
170
 
171
171
  ```base-ui
172
172
  <Sidebar defaultOpen="true">
@@ -239,16 +239,16 @@ See [Base Components](/examples/blocks.html#/docs/guide/owl-components) for how
239
239
  ## Static component
240
240
 
241
241
  ```base-ui
242
- <div class="bu-sidebar-demo-frame">
242
+ <div class="b-sidebar-demo-frame">
243
243
  <aside b-ui="sidebar" b-att-state="open">
244
244
  <div b-sidebar-header>
245
- <a href="#" class="bu-sidebar-demo-brand">
246
- <span class="bu-sidebar-demo-brand-mark"><span b-icon="gallery-vertical-end"></span></span>
247
- <span class="bu-sidebar-demo-meta">
248
- <span class="bu-sidebar-demo-title">Acme Inc</span>
249
- <span class="bu-sidebar-demo-email">Enterprise</span>
245
+ <a href="#" class="b-sidebar-demo-brand">
246
+ <span class="b-sidebar-demo-brand-mark"><span b-icon="gallery-vertical-end"></span></span>
247
+ <span class="b-sidebar-demo-meta">
248
+ <span class="b-sidebar-demo-title">Acme Inc</span>
249
+ <span class="b-sidebar-demo-email">Enterprise</span>
250
250
  </span>
251
- <span class="bu-sidebar-demo-chevrons" b-icon="chevrons-up-down"></span>
251
+ <span class="b-sidebar-demo-chevrons" b-icon="chevrons-up-down"></span>
252
252
  </a>
253
253
  </div>
254
254
 
@@ -287,18 +287,18 @@ See [Base Components](/examples/blocks.html#/docs/guide/owl-components) for how
287
287
  </div>
288
288
 
289
289
  <div b-sidebar-footer>
290
- <a href="#" class="bu-sidebar-demo-user">
291
- <span b-ui="avatar" class="bu-sidebar-demo-avatar">SC</span>
292
- <span class="bu-sidebar-demo-meta">
293
- <span class="bu-sidebar-demo-title">shadcn</span>
294
- <span class="bu-sidebar-demo-email">m@example.com</span>
290
+ <a href="#" class="b-sidebar-demo-user">
291
+ <span b-ui="avatar" class="b-sidebar-demo-avatar">SC</span>
292
+ <span class="b-sidebar-demo-meta">
293
+ <span class="b-sidebar-demo-title">shadcn</span>
294
+ <span class="b-sidebar-demo-email">m@example.com</span>
295
295
  </span>
296
- <span class="bu-sidebar-demo-chevrons" b-icon="chevrons-up-down"></span>
296
+ <span class="b-sidebar-demo-chevrons" b-icon="chevrons-up-down"></span>
297
297
  </a>
298
298
  </div>
299
299
  </aside>
300
- <main class="bu-sidebar-demo-main">
301
- <button class="bu-sidebar-trigger" type="button" aria-label="Toggle Sidebar">
300
+ <main class="b-sidebar-demo-main">
301
+ <button class="b-sidebar-trigger" type="button" aria-label="Toggle Sidebar">
302
302
  <span b-icon="panel-left"></span>
303
303
  </button>
304
304
  </main>
@@ -306,3 +306,5 @@ See [Base Components](/examples/blocks.html#/docs/guide/owl-components) for how
306
306
  ```
307
307
 
308
308
  State is reflected through `b-att-state="open|closed"`. Events: `baseui:open`, `baseui:close`.
309
+
310
+ Below 992px the sidebar is an off-canvas drawer closed by navigation; the `Shell` and `Sidebar` CSS and `matchMedia` checks share this breakpoint.
@@ -14,10 +14,21 @@ import { Switch } from "@thebase/ui";
14
14
  </div>
15
15
  ```
16
16
 
17
+ ### Help tooltip (`useTip`)
18
+
19
+ ```base-ui
20
+ <div class="d-flex flex-column gap-3" style="max-width: 28rem">
21
+ <Switch supportingText="'Turns off all wireless radios'">Airplane Mode</Switch>
22
+ <Switch supportingText="'Turns off all wireless radios'" useTip="1">Airplane Mode</Switch>
23
+ </div>
24
+ ```
25
+
17
26
  | Component | Prop | Type | Notes |
18
27
  | --- | --- | --- | --- |
19
28
  | `Switch` | `checked` | `Boolean` | optional |
20
29
  | `Switch` | `disabled` | `Boolean` | optional |
30
+ | `Switch` | `supportingText` | `String` | optional helper text shown under the label |
31
+ | `Switch` | `useTip` | `Number` | `1` moves `supportingText` into a tooltip on a question-mark icon right after the label |
21
32
  | `Switch` | `className` | `String` | optional |
22
33
  | `Switch` | `onChange` | `Function` | optional |
23
34
 
@@ -86,7 +86,7 @@ Or the same session hosted on an external websocket backend instead of peer-to-p
86
86
  - `b-att-placeholder` / `placeholder` — empty-editor hint text.
87
87
  - `b-att-collaborative` / `collaborative` — set to `"true"` to connect through Yjs; off by default.
88
88
  - `b-att-provider` / `provider` — collaboration transport: `"webrtc"` (default, peer-to-peer) or `"websocket"` (connects to an external y-websocket-compatible backend).
89
- - `b-att-room` / `room` — document/room name for collaborative sessions (defaults to `bu-text-editor`); shared across peers for y-webrtc, or used as the document name on the y-websocket backend.
89
+ - `b-att-room` / `room` — document/room name for collaborative sessions (defaults to `b-text-editor`); shared across peers for y-webrtc, or used as the document name on the y-websocket backend.
90
90
  - `b-att-url` / `url` — y-websocket server URL (e.g. `wss://your-backend.example.com/mkdn`), required when `provider` is `"websocket"`. Ignored for `"webrtc"`.
91
91
  - `b-att-password` / `password` — optional y-webrtc room password. Ignored for `"websocket"`.
92
92
  - `b-att-signaling` / `signaling` — comma-separated signaling URLs for the static API, or an array prop for Owl. y-webrtc only.
@@ -27,6 +27,28 @@ import { Textarea } from "@thebase/ui";
27
27
  </div>
28
28
  ```
29
29
 
30
+ ### Footer slot
31
+
32
+ The `footer` slot draws a bar along the bottom edge inside the field (counter on the left, send button on the right). `start` and `end` work as on [Input](/examples/blocks.html#/docs/components/input).
33
+
34
+ ```base-ui
35
+ <div style="max-width: 28rem" class="w-100 pt-3">
36
+ <Textarea label="'Message'" rows="3">
37
+ <t t-set-slot="footer"><span>0/280</span><Button size="'xs'">Send</Button></t>
38
+ </Textarea>
39
+ </div>
40
+ ```
41
+
42
+ ### Help tooltip (`useTip`)
43
+
44
+ Set `useTip="1"` to move `supportingText` into a tooltip: a question-mark icon appears right after the label, in the same label box, and the text shows on hover or focus. Error text still shows under the field.
45
+
46
+ ```base-ui
47
+ <div style="max-width: 28rem" class="w-100 pt-3">
48
+ <Textarea label="'Your message'" supportingText="'Copied to the support team'" useTip="1"/>
49
+ </div>
50
+ ```
51
+
30
52
  | Component | Prop | Type | Notes |
31
53
  | --- | --- | --- | --- |
32
54
  | `Textarea` | `value` | `String` | optional |
@@ -39,6 +61,7 @@ import { Textarea } from "@thebase/ui";
39
61
  | `Textarea` | `id` | `String` | optional, e.g. for `Label`'s `for` |
40
62
  | `Textarea` | `onInput` | `Function` | optional |
41
63
  | `Textarea` | `onChange` | `Function` | optional |
64
+ | `Textarea` | slots `start` / `end` / `footer` | slot | content drawn inside the box; `footer` sits along the bottom edge |
42
65
  | `Textarea` | `label`, `supportingText`, `useTip`, `errorText`, `maxLength`, `invalid`, `placeholder` | `String` / `Boolean` | Material-style outlined field, same behaviour as [Input](/examples/blocks.html#/docs/components/input): the label floats onto the border, `errorText` replaces `supportingText`. Also inherited from a parent `Field`. |
43
66
 
44
67
  See [Base Components](/examples/blocks.html#/docs/guide/owl-components) for how to load `@base/owl` and `dist/baseui.templates.xml`.
@@ -13,7 +13,7 @@ import { ThemeButton } from "@thebase/ui";
13
13
  ```
14
14
 
15
15
  ```base-ui
16
- <ThemeButton variant="'outline'" storageKey="'bu-theme'"/>
16
+ <ThemeButton variant="'outline'" storageKey="'b-theme'"/>
17
17
  ```
18
18
 
19
19
  | Component | Prop | Type | Notes |
@@ -39,12 +39,12 @@ See [Base Components](/examples/blocks.html#/docs/guide/owl-components) for how
39
39
 
40
40
  ## Static component
41
41
 
42
- The toast root is a flex row: wrap message content in `.bu-toast-content` (grows to fill the width) and any action button plus the close button in `.bu-toast-actions` (grouped tight on the trailing edge).
42
+ The toast root is a flex row: wrap message content in `.b-toast-content` (grows to fill the width) and any action button plus the close button in `.b-toast-actions` (grouped tight on the trailing edge).
43
43
 
44
44
  ```base-ui
45
45
  <div b-ui="toast">
46
- <div class="bu-toast-content">Saved successfully.</div>
47
- <div class="bu-toast-actions">
46
+ <div class="b-toast-content">Saved successfully.</div>
47
+ <div class="b-toast-actions">
48
48
  <button b-toast-close type="button">Close</button>
49
49
  </div>
50
50
  </div>
@@ -54,14 +54,14 @@ The toast stays hidden until shown — omit `b-att-state="open"` and call `.show
54
54
 
55
55
  ```base-ui
56
56
  <div class="d-flex flex-column align-items-center gap-3">
57
- <button type="button" class="btn bu-button btn-outline-secondary" onclick="document.getElementById('demo-toast').BaseUIToast.show()">Show Toast</button>
57
+ <button type="button" class="btn b-button btn-outline-secondary" onclick="document.getElementById('demo-toast').BaseUIToast.show()">Show Toast</button>
58
58
  <div id="demo-toast" b-ui="toast" b-att-delay="3000">
59
- <div class="bu-toast-content">
59
+ <div class="b-toast-content">
60
60
  <div class="fw-medium">Event created</div>
61
61
  <div class="text-body-secondary small">Sunday, December 3 at 9:00 AM</div>
62
62
  </div>
63
- <div class="bu-toast-actions">
64
- <button type="button" class="btn bu-button btn-outline-secondary btn-sm">Undo</button>
63
+ <div class="b-toast-actions">
64
+ <button type="button" class="btn b-button btn-outline-secondary btn-sm">Undo</button>
65
65
  <button b-toast-close type="button">Close</button>
66
66
  </div>
67
67
  </div>
@@ -70,7 +70,7 @@ The toast stays hidden until shown — omit `b-att-state="open"` and call `.show
70
70
 
71
71
  Programmatic API: after mount, call `element.BaseUIToast.show()` or `element.BaseUIToast.hide()`. Events: `baseui:open`, `baseui:close`.
72
72
 
73
- Toasts are backed by `bootstrap.Toast`: the root receives Bootstrap's `toast fade` classes, and visibility is driven by Bootstrap's own `show`/`showing` classes (not `hidden`). The close button(s) carry `data-bs-dismiss="toast"` in addition to the `b-toast-close`/`bu-toast-close` selector, so Bootstrap's own delegated dismiss handler drives them.
73
+ Toasts are backed by `bootstrap.Toast`: the root receives Bootstrap's `toast fade` classes, and visibility is driven by Bootstrap's own `show`/`showing` classes (not `hidden`). The close button(s) carry `data-bs-dismiss="toast"` in addition to the `b-toast-close`/`b-toast-close` selector, so Bootstrap's own delegated dismiss handler drives them.
74
74
 
75
75
  ### Screen-corner placement
76
76
 
@@ -78,8 +78,8 @@ Set `b-att-position` to `top-left`, `top-right`, `bottom-left`, or `bottom-right
78
78
 
79
79
  ```base-ui
80
80
  <div id="corner-toast" b-ui="toast" b-att-position="bottom-right" b-att-delay="3000">
81
- <div class="bu-toast-content">Saved successfully.</div>
82
- <div class="bu-toast-actions">
81
+ <div class="b-toast-content">Saved successfully.</div>
82
+ <div class="b-toast-actions">
83
83
  <button b-toast-close type="button">Close</button>
84
84
  </div>
85
85
  </div>
@@ -82,11 +82,30 @@ import { Typography } from "@thebase/ui";
82
82
 
83
83
  | Component | Prop | Type | Notes |
84
84
  | --- | --- | --- | --- |
85
- | `Typography` | `variant` | `String` | optional |
85
+ | `Typography` | `variant` | `String` | optional; `lead`, `muted`, `code`, `kbd`, `h1`-`h4`, `blockquote`, `small`, `list` |
86
+ | `Typography` | `tag` | `String` | optional; defaults to `h1`-`h4`, `blockquote`, `small`, `ul` for those variants, else `p` |
86
87
  | `Typography` | `className` | `String` | optional |
87
88
 
88
89
  See [Base Components](/examples/blocks.html#/docs/guide/owl-components) for how to load `@base/owl` and `dist/baseui.templates.xml`.
89
90
 
91
+ ## Bootstrap typography classes
92
+
93
+ Base UI redefines the Bootstrap 5 typography classes to the shadcn typeset values
94
+ (`src/styles/base-extensions.css`), in Be Vietnam Pro. Use plain Bootstrap markup:
95
+
96
+ | Element / class | Result |
97
+ | --- | --- |
98
+ | `h1` / `.h1` ... `h4` / `.h4` | 1.75rem, 1.25rem, 1.125rem, 1rem; weight 600; line-height 1.3 to 1.5 |
99
+ | `h5` / `.h5`, `h6` / `.h6` | 0.875rem / 0.8125rem, weight 500, muted; `h6` is uppercase with 0.08em tracking |
100
+ | `.display-1` ... `.display-6` | Bootstrap sizes, weight 600, line-height 1.2 |
101
+ | `.lead`, `.small`, `mark`, `del`, `abbr[title]` | muted lead text, `--b-text-sm`, shadcn highlight, muted strike-through, dotted underline |
102
+ | `blockquote` / `.blockquote` | 2px start border, 1em inline padding, inherited size |
103
+ | `hr`, `dt`, `dd`, `code`, `pre`, `kbd`, `caption` | shadcn rule, weights, muted-background code, keycap border |
104
+
105
+ Bootstrap's bottom-margin rhythm is unchanged. For the shadcn flow model (margin-top only,
106
+ 1.25em between blocks, 1.75 line-height, styled lists, links and tables) wrap prose in
107
+ `class="b-typeset"`; tune with `--b-typeset-flow` and `--b-typeset-leading`.
108
+
90
109
  ## Static component
91
110
 
92
111
  ```base-ui
@@ -94,6 +113,6 @@ See [Base Components](/examples/blocks.html#/docs/guide/owl-components) for how
94
113
  <span b-ui="typography" b-att-variant="code">baseui</span>
95
114
  ```
96
115
 
97
- Options: `b-att-variant="body|lead|muted|code|kbd"`.
116
+ Options: `b-att-variant="body|lead|muted|code|kbd|h1|h2|h3|h4|blockquote|small|list"` (static markup keeps its own element, so write `<h2 b-ui="typography" b-att-variant="h2">`; the variant only adds the class).
98
117
 
99
118
  Accessibility: choose semantic HTML elements first, then add the Base UI typography attributes for styling.
package/docs/icons.md CHANGED
@@ -22,7 +22,7 @@ Load the normal the Base UI assets. No separate icon script is required.
22
22
  <script src="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.js" defer></script>
23
23
  ```
24
24
 
25
- `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@1.1.6`, or `@1` to take only non-breaking updates) instead of `@latest` for production. `b-icon` also works with the [pure Base `Icon` component](components/icon.md) — the recommended API in an application; the classic script above is for pages using the static `b-ui` API.
25
+ `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@1.2.0`, or `@1` to take only non-breaking updates) instead of `@latest` for production. `b-icon` also works with the [pure Base `Icon` component](components/icon.md) — the recommended API in an application; the classic script above is for pages using the static `b-ui` API.
26
26
 
27
27
  The build publishes every Lucide SVG to `dist/icons/lucide/` and writes the generated icon manifest to `dist/icons/lucide.json`.
28
28
 
@@ -4,7 +4,7 @@ See the [Usage Guide](usage-guide.md) for the end-to-end integration path (choos
4
4
 
5
5
  The Base UI is distributed as one CSS file and one JavaScript file for browser use. `dist/baseui.min.js` is fully self-contained: Bootstrap's JS bundle (Popper.js included) and the Owl runtime are embedded ahead of the Base UI's own code, in load order (Bootstrap, then Owl, then the Base UI) — nothing else needs to load first. Both install paths below load this same file; the Base component API is the recommended way to consume the Base UI in an application, with the base static markup (`b-ui`) API available as a lighter-weight alternative for non-Owl pages.
6
6
 
7
- The snippets below use the `@latest` tag for readability. Pin an exact version instead (e.g. `@1.1.6`, or `@1` to take only non-breaking updates) for any production page — `@latest` can silently change what your page loads the moment a new version is published.
7
+ The snippets below use the `@latest` tag for readability. Pin an exact version instead (e.g. `@1.2.0`, or `@1` to take only non-breaking updates) for any production page — `@latest` can silently change what your page loads the moment a new version is published.
8
8
 
9
9
  ## Base component install (recommended)
10
10
 
@@ -43,7 +43,7 @@ For static HTML, a server-rendered page, or a Base HUB website page that has no
43
43
 
44
44
  Bootstrap 5 is the bundled baseline CSS framework, and its JS bundle now drives the Base UI's interactive components directly.
45
45
 
46
- `@thebase/ui` is published on npm, so [unpkg](https://unpkg.com/@thebase/ui@latest/) mirrors the same files as an alternative CDN (`https://unpkg.com/@thebase/ui@latest/dist/baseui.min.css` / `baseui.min.js`) if jsDelivr is unreachable in your environment. Pin an exact version (e.g. `@1.1.6`, or `@1` to take only non-breaking updates) instead of `@latest` for production.
46
+ `@thebase/ui` is published on npm, so [unpkg](https://unpkg.com/@thebase/ui@latest/) mirrors the same files as an alternative CDN (`https://unpkg.com/@thebase/ui@latest/dist/baseui.min.css` / `baseui.min.js`) if jsDelivr is unreachable in your environment. Pin an exact version (e.g. `@1.2.0`, or `@1` to take only non-breaking updates) instead of `@latest` for production.
47
47
 
48
48
  For npm/self-hosted usage:
49
49
 
@@ -55,7 +55,7 @@ Everything — the static `b-ui` runtime, the Owl framework, every Base componen
55
55
  </script>
56
56
  ```
57
57
 
58
- `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable — swap the host in each URL above. For a self-hosted build, replace the CDN host with your own served path (e.g. `/dist/baseui.esm.js`). These snippets use `@latest` for readability; pin an exact version (e.g. `@1.1.6`, or `@1` to take only non-breaking updates) in production so a new release can't change what your page loads.
58
+ `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable — swap the host in each URL above. For a self-hosted build, replace the CDN host with your own served path (e.g. `/dist/baseui.esm.js`). These snippets use `@latest` for readability; pin an exact version (e.g. `@1.2.0`, or `@1` to take only non-breaking updates) in production so a new release can't change what your page loads.
59
59
 
60
60
  No `@odoo/owl` import appears anywhere in that snippet — `@base/owl` is the only Owl entry point the Base UI components and consumer apps need. Because `@base/owl`, `@base/component`, and `@base/theme` all point at the exact same `dist/baseui.esm.js` URL, the browser fetches and evaluates it once and every key shares the same module instance — no separate classic `<script>` needs to load first to set up a shared global.
61
61
 
@@ -38,8 +38,8 @@ Mounted components dispatch lifecycle events on their root element:
38
38
  ```js
39
39
  import { cn } from "@thebase/ui";
40
40
 
41
- cn("btn", isActive && "active", ["bu-button", className]);
42
- // "btn active bu-button my-class" (when isActive is truthy and className is "my-class")
41
+ cn("btn", isActive && "active", ["b-button", className]);
42
+ // "btn active b-button my-class" (when isActive is truthy and className is "my-class")
43
43
  ```
44
44
 
45
45
  It's a standalone named export — `import { cn } from "@thebase/ui"` in npm/bundler apps, or `BaseUIBundle.cn` in the browser IIFE global — not a method on `BaseUI` itself. Use it to build your own components' class lists on top of the Base UI's conventions.
package/docs/theming.md CHANGED
@@ -13,6 +13,36 @@ thebase.theme.set("dark");
13
13
  thebase.theme.set({ primary: "#0057d8", radius: "0.5rem" });
14
14
  ```
15
15
 
16
+ ## Make your own theme
17
+
18
+ `dist/baseui.min.css` is the only stylesheet an app loads; it already includes the default light and dark themes. A custom theme is two small files, `baseui-light.css` and `baseui-dark.css` (readable copies in `dist/themes/`, minified `.min.css` versions beside them), loaded after it.
19
+
20
+ 1. Build one visually in the **theme creator** (the **Theme** tab of the examples app (`examples/index.html#/theme`)): pick a base colour, accent and radius, preview Base UI live in light or dark, then download `baseui-light.css` and `baseui-dark.css`.
21
+ 2. Or download the two files from `dist/themes/` (or copy `src/themes/`) and edit the values by hand.
22
+ 3. Load them after the Base UI stylesheet:
23
+
24
+ ```html
25
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@thebase/ui@1.2.0/dist/baseui.min.css">
26
+ <link rel="stylesheet" href="/css/baseui-light.css">
27
+ <link rel="stylesheet" href="/css/baseui-dark.css">
28
+ ```
29
+
30
+ Each file declares the same variables on its own selector (`light`: `:root`, `[b-theme="light"]`, `.light`; `dark`: `[b-theme="dark"]`, `.dark`), so loading yours after the defaults replaces them. Edit only the values; keep the selectors and variable names. The tokens you will usually change:
31
+
32
+ | Token | Controls |
33
+ | --- | --- |
34
+ | `--b-background`, `--b-foreground` | Page background and text |
35
+ | `--b-surface`, `--b-card`, `--b-popover` (+ `-foreground`) | Raised surfaces |
36
+ | `--b-primary`, `--b-primary-rgb`, `--b-primary-foreground` | Primary buttons, links, active states (keep `-rgb` in sync with the colour) |
37
+ | `--b-secondary`, `--b-muted`, `--b-accent` (+ `-foreground`) | Subtle fills and hover states |
38
+ | `--b-danger`, `--b-success`, `--b-warning`, `--b-info` (each with `-rgb` and `-foreground`) | Error/destructive, success, warning and info states: buttons (`.btn-success` …), badges, alerts, Bootstrap `text-*`/`bg-*` helpers |
39
+ | `--b-border`, `--b-input`, `--b-ring` | Borders, field outlines, focus ring |
40
+ | `--b-chart-1` … `--b-chart-5`, `--b-sidebar-*` | Charts and the sidebar |
41
+ | `--base-radius` | Corner roundness; every `--b-radius-*` step is derived from it |
42
+ | `--b-overlay` | Backdrop behind dialogs and sheets |
43
+
44
+ To change a few values without a full theme, override them on `:root` / `[b-theme="dark"]` in your own CSS, or at runtime with `thebase.theme.set({ primary: "#0057d8", radius: "0.5rem" })`.
45
+
16
46
  The Base UI maps semantic tokens such as `--b-background`, `--b-primary`, `--b-border`, and `--b-radius` into Bootstrap 5 variables. Radius tokens are sourced from the shorter public alias family `--base-radius`, `--base-radius-sm`, `--base-radius-md`, `--base-radius-lg`, `--base-radius-xl`, `--base-radius-2xl`, `--base-radius-3xl`, `--base-radius-4xl`, and `--base-radius-full`, then mirrored to `--b-radius*` for component CSS.
17
47
 
18
48
  For a reusable theme toggle with persistence, URL override, button-label sync, and iframe preview sync, import the theme helper:
@@ -38,7 +68,7 @@ For a reusable theme toggle with persistence, URL override, button-label sync, a
38
68
  </script>
39
69
  ```
40
70
 
41
- `https://unpkg.com/@thebase/ui@latest/dist/baseui.esm.js` mirrors the same file as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@1.1.6`, or `@1` to take only non-breaking updates) instead of `@latest` for production. Npm/bundler consumers can import the same API from `@thebase/ui`.
71
+ `https://unpkg.com/@thebase/ui@latest/dist/baseui.esm.js` mirrors the same file as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@1.2.0`, or `@1` to take only non-breaking updates) instead of `@latest` for production. Npm/bundler consumers can import the same API from `@thebase/ui`.
42
72
 
43
73
  For a ready-made icon button, use the Base UI component instead of wiring your own click handler:
44
74
 
@@ -50,6 +80,6 @@ The documentation and example pages use the same theme infrastructure. Owl examp
50
80
 
51
81
  ## Design tokens
52
82
 
53
- The default light/dark palettes and radius follow the current [shadcn/ui](https://ui.shadcn.com) Base UI neutral theme: black/neutral primary on white in light mode, neutral-900/50 foreground-background inversion in dark mode, neutral `--b-secondary`/`--b-muted`/`--b-accent` surfaces, `--base-radius: var(--radius, 0.625rem)`, and a derived radius scale (`--base-radius-sm|md|lg|xl`, mirrored as `--b-radius-sm|md|lg|xl`) and shadow scale (`--b-shadow-sm|md|lg`) for consistent elevation across popovers, menus, dialogs, and toasts. The Base UI reads an existing upstream `--radius` value when present, but it does not redefine `--radius` back to `--b-radius`; that one-way bridge avoids CSS custom-property cycles. `--b-card`/`--b-popover` alias `--b-surface` for shadcn-token-name parity.
83
+ The default light/dark palettes and radius follow the current [shadcn/ui](https://ui.shadcn.com) Base UI neutral theme: black/neutral primary on white in light mode, neutral-900/50 foreground-background inversion in dark mode, neutral `--b-secondary`/`--b-muted`/`--b-accent` surfaces, `--base-radius: var(--radius, 0.625rem)` (set in the theme files), and a derived radius scale (`--base-radius-sm|md|lg|xl`, mirrored as `--b-radius-sm|md|lg|xl`) and shadow scale (`--b-shadow-sm|md|lg`) for consistent elevation across popovers, menus, dialogs, and toasts. The Base UI reads an existing upstream `--radius` value when present, but it does not redefine `--radius` back to `--b-radius`; that one-way bridge avoids CSS custom-property cycles. `--b-card`/`--b-popover` alias `--b-surface` for shadcn-token-name parity.
54
84
 
55
- Because the Base UI ships Bootstrap's stock precompiled CSS, most `.btn-*`/badge colors are not driven by `--bs-*` variables directly — `src/styles/baseui.css` re-points the `.btn-primary`/`.btn-secondary`/`.btn-danger`/`.btn-outline-secondary`/`.btn-light` variants at the Base UI tokens so `thebase.theme.set(...)` overrides actually render. Badges use their own `bu-badge-*` classes (`src/components/badge/badge.css`) instead of Bootstrap's `text-bg-*`, which hardcode non-overridable colors.
85
+ Because the Base UI ships Bootstrap's stock precompiled CSS, most `.btn-*`/badge colors are not driven by `--bs-*` variables directly — `src/styles/base-extensions.css` re-points the `.btn-primary`/`.btn-secondary`/`.btn-danger`/`.btn-outline-secondary`/`.btn-light` variants at the Base UI tokens so `thebase.theme.set(...)` overrides actually render. Badges use their own `b-badge-*` classes (`src/components/badge/badge.css`) instead of Bootstrap's `text-bg-*`, which hardcode non-overridable colors.
@@ -32,7 +32,7 @@ Save this as an `.html` file and open it — no build step, no server required.
32
32
  </html>
33
33
  ```
34
34
 
35
- `https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/...` is the real jsDelivr URL for the published `@thebase/ui` npm package's `latest` tag, used here for a copy-paste-and-go quick start. Pin an exact version instead (e.g. `@1.1.6`, or `@1` to take only non-breaking updates) for production, so a new release can't change what your page loads. See [Installation](installation.md) for jsDelivr/unpkg/npm/self-hosted paths.
35
+ `https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/...` is the real jsDelivr URL for the published `@thebase/ui` npm package's `latest` tag, used here for a copy-paste-and-go quick start. Pin an exact version instead (e.g. `@1.2.0`, or `@1` to take only non-breaking updates) for production, so a new release can't change what your page loads. See [Installation](installation.md) for jsDelivr/unpkg/npm/self-hosted paths.
36
36
 
37
37
  The static bundle calls `thebase.mountAll()` automatically on `DOMContentLoaded`, so initial `[b-ui]` and `[b-icon]` markup mounts without an extra script. Call `thebase.mountAll(root)` yourself only after injecting new markup or when mounting a specific fragment. If the consumer is itself an application, use [step 2](#2-install-pure-owl-api--recommended) instead — that's the recommended path.
38
38
 
@@ -63,7 +63,7 @@ Both APIs come from the same package and the same CSS file, and can be mixed on
63
63
  </script>
64
64
  ```
65
65
 
66
- `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable — swap the host in each URL above. Pin an exact version (e.g. `@1.1.6`, or `@1` to take only non-breaking updates) instead of `@latest` for production.
66
+ `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable — swap the host in each URL above. Pin an exact version (e.g. `@1.2.0`, or `@1` to take only non-breaking updates) instead of `@latest` for production.
67
67
 
68
68
  ```html
69
69
  <script type="module">
@@ -103,7 +103,7 @@ Two rules that account for most integration failures — see [Base Components](o
103
103
  <script src="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.js" defer></script>
104
104
  ```
105
105
 
106
- `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@1.1.6`, or `@1` to take only non-breaking updates) instead of `@latest` for production.
106
+ `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@1.2.0`, or `@1` to take only non-breaking updates) instead of `@latest` for production.
107
107
 
108
108
  **Option B — npm (bundler-based apps: Vite, webpack, etc.):**
109
109
 
@@ -120,7 +120,7 @@ import "@thebase/ui"; // side-effect import: registers window.thebase and auto-m
120
120
 
121
121
  Rule that applies to both options:
122
122
 
123
- - Production pages must use a pinned version (e.g. `@thebase/ui@1.1.6` or `@thebase/ui@1`), never `@latest`.
123
+ - Production pages must use a pinned version (e.g. `@thebase/ui@1.2.0` or `@thebase/ui@1`), never `@latest`.
124
124
 
125
125
  Mount markup:
126
126
 
@@ -219,7 +219,7 @@ export default {
219
219
  },
220
220
  serviceWorker: {
221
221
  cacheName: "my-app-cache-v1",
222
- cdnVersion: "1.1.6", // pin to match the importmap in index.html
222
+ cdnVersion: "1.2.0", // pin to match the importmap in index.html
223
223
  appFiles: ["/app.css", "/app.js", "/app.xml", "/favicon.svg", "/icons/icon-192.png", "/icons/icon-512.png"],
224
224
  },
225
225
  };
@@ -227,9 +227,17 @@ export default {
227
227
 
228
228
  ```sh
229
229
  npx create-baseui-app pwa . --config baseui.pwa.config.js
230
- # writes ./manifest.webmanifest and ./sw.js
230
+ # writes ./manifest.webmanifest, ./sw.js, ./sw-register.js and ./version.json
231
231
  ```
232
232
 
233
+ **Auto-reload on a new deploy.** The generated `sw.js` fetches `version.json` (never cached) on activate, on
234
+ every page navigation and when the page posts `"check-version"`. When the value differs from the last one it
235
+ saw, it wipes the caches, re-precaches the app shell and posts `"version-changed"` to every open page.
236
+ `sw-register.js` (load it with `<script type="module" src="/sw-register.js">`, replacing your own
237
+ `serviceWorker.register`) registers the worker, reloads on that message and re-checks when the tab becomes
238
+ visible. `version.json` is a content hash of `sw.js`, the manifest and every `appFiles` entry found under
239
+ `<path>`, so re-run the `pwa` command as the last step of every deploy.
240
+
233
241
  Re-run the command whenever `appFiles`, the CDN pin, or manifest fields change — both output files are
234
242
  fully regenerated, never hand-patched. Only `manifest.name`, `serviceWorker.cacheName`, and
235
243
  `serviceWorker.cdnVersion` are required; everything else (icons, theme/background color, display
@@ -239,6 +247,15 @@ files are kept, so your own icons win). Serving icons from another folder? Set `
239
247
  service worker) and `manifestUrl` (service worker) in the config. See
240
248
  `dist/types/pwa.d.ts` for the full config shape.
241
249
 
250
+ **Default in every scaffolded project.** `create-baseui-app create|init` projects ship
251
+ `plugins: [baseuiPwa({ name })]` (from `@thebase/ui/vite`) in `vite.config.js`. Each `vite build` then emits
252
+ `manifest.webmanifest`, `sw.js`, `sw-register.js`, `version.json` (hash of the built bundle) and the default
253
+ icons into `dist/`, and injects the manifest link, theme color and register script into every page — no
254
+ config file, no extra command. Every deploy with changed code therefore reloads open pages automatically.
255
+ `vite dev` is untouched. Options: `name`, `description`, `themeColor` and the other manifest fields, plus
256
+ `cdnVersion` (only for apps that load BaseUI from the CDN). For an existing project, add the plugin to
257
+ `vite.config.js` (`convert` prints this hint). Remove the plugin to opt out.
258
+
242
259
  ## 6. Copy a block instead of assembling from primitives
243
260
 
244
261
  For common layouts (dashboard shells, sidebars, login/signup forms, charts), copy a ready-made block from the gallery instead of composing primitives by hand: [Blocks](blocks.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thebase/ui",
3
- "version": "1.1.6",
3
+ "version": "1.2.0",
4
4
  "description": "CDN-installable Bootstrap 5 UI component library.",
5
5
  "type": "module",
6
6
  "main": "./dist/baseui.min.js",
@@ -34,6 +34,10 @@
34
34
  "types": "./dist/types/pwa.d.ts",
35
35
  "import": "./dist/baseui.pwa.esm.js"
36
36
  },
37
+ "./vite": {
38
+ "types": "./dist/types/vite.d.ts",
39
+ "import": "./dist/baseui.vite.esm.js"
40
+ },
37
41
  "./dist/baseui.templates.xml": "./dist/baseui.templates.xml"
38
42
  },
39
43
  "files": [
@@ -47,6 +51,7 @@
47
51
  "dist/baseui.apidoc.esm.js",
48
52
  "dist/baseui.apidoc.min.js",
49
53
  "dist/baseui.pwa.esm.js",
54
+ "dist/baseui.vite.esm.js",
50
55
  "dist/baseui.templates.xml",
51
56
  "dist/icons",
52
57
  "dist/pwa-icons",
@@ -1,68 +0,0 @@
1
- # Input Group
2
-
3
- ## Base component
4
-
5
- ```js
6
- import {
7
- InputGroup,
8
- InputGroupAddon,
9
- InputGroupButton,
10
- InputGroupInput,
11
- InputGroupText,
12
- InputGroupTextarea,
13
- } from "@thebase/ui";
14
- ```
15
-
16
- ```base-ui
17
- <div class="d-flex flex-column gap-4 w-100" style="max-width: 28rem">
18
- <InputGroup label="'Search'" supportingText="'Search the docs'">
19
- <InputGroupInput/>
20
- <InputGroupAddon align="'inline-end'">
21
- <Icon name="'search'"/>
22
- </InputGroupAddon>
23
- </InputGroup>
24
-
25
- <InputGroup label="'Website'">
26
- <InputGroupInput placeholder="'https://'"/>
27
- <InputGroupAddon align="'inline-end'">
28
- <InputGroupButton>Search</InputGroupButton>
29
- </InputGroupAddon>
30
- </InputGroup>
31
-
32
- <InputGroup label="'Message'">
33
- <InputGroupTextarea rows="3"/>
34
- <InputGroupAddon align="'block-end'">
35
- <InputGroupText>0/280</InputGroupText>
36
- <InputGroupButton variant="'default'" className="'ms-auto'">Send</InputGroupButton>
37
- </InputGroupAddon>
38
- </InputGroup>
39
- </div>
40
- ```
41
-
42
- | Component | Prop | Type | Notes |
43
- | --- | --- | --- | --- |
44
- | `InputGroup` | `className` | `String` | optional |
45
- | `InputGroup` | `label`, `labelBackground`, `supportingText`, `useTip`, `errorText`, `invalid` | `String` / `Boolean` | Material-style outlined group, same label as [Input](/examples/blocks.html#/docs/components/input): the label floats onto the border once the control is focused or filled. Also inherited from a parent `Field`. |
46
- | `InputGroupAddon` | `align` | `String` | `inline-start` (default), `inline-end`, `block-start`, `block-end` |
47
- | `InputGroupButton` | `variant` | `String` | `default`, `destructive`, `outline`, `secondary`, `ghost` (default), `link` |
48
- | `InputGroupButton` | `size` | `String` | `xs` (default), `icon-xs`, `sm`, `icon-sm` |
49
- | `InputGroupText` | `className` | `String` | optional |
50
- | `InputGroupInput` | `type`, `value`, `placeholder`, `disabled`, `readonly`, `invalid` | mixed | input control |
51
- | `InputGroupTextarea` | `value`, `placeholder`, `rows`, `disabled`, `readonly`, `invalid`, `resize` | mixed | textarea control |
52
-
53
- See [Base Components](/examples/blocks.html#/docs/guide/owl-components) for how to load `@base/owl` and `dist/baseui.templates.xml`.
54
-
55
- ## Static component
56
-
57
- ```base-ui
58
- <div b-ui="input-group">
59
- <div b-input-group-addon b-att-align="inline-start">
60
- <span b-input-group-text>@</span>
61
- </div>
62
- <input b-ui="input" placeholder="username">
63
- </div>
64
- ```
65
-
66
- Use `b-att-align="inline-start|inline-end|block-start|block-end"` on `b-input-group-addon`.
67
- Use `b-input-group-button` with `b-att-size="xs|icon-xs|sm|icon-sm"` and
68
- `b-att-variant="default|destructive|outline|secondary|ghost|link"` for embedded actions.