@thebase/ui 1.1.3 → 1.1.4
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.
- package/CHANGELOG.md +18 -18
- package/README.md +20 -20
- package/bin/create-baseui-app.mjs +7 -7
- package/dist/baseui.apidoc.esm.js +935 -0
- package/dist/baseui.apidoc.min.js +936 -0
- package/dist/baseui.esm.js +1 -1
- package/dist/baseui.min.js +1 -1
- package/dist/baseui.registry.json +3 -3
- package/dist/baseui.templates.xml +1 -1
- package/dist/types/apidoc.d.ts +27 -0
- package/docs/analytics.md +3 -3
- package/docs/blocks.md +5 -5
- package/docs/components/accordion.md +3 -3
- package/docs/components/alert-dialog.md +2 -2
- package/docs/components/alert.md +2 -2
- package/docs/components/apidoc.md +17 -4
- package/docs/components/aspect-ratio.md +2 -2
- package/docs/components/attachment.md +3 -3
- package/docs/components/avatar.md +5 -5
- package/docs/components/badge.md +2 -2
- package/docs/components/block-viewer.md +4 -4
- package/docs/components/breadcrumb.md +3 -3
- package/docs/components/bubble.md +2 -2
- package/docs/components/button-group.md +2 -2
- package/docs/components/button.md +2 -2
- package/docs/components/calendar.md +5 -5
- package/docs/components/card.md +2 -2
- package/docs/components/carousel.md +5 -5
- package/docs/components/chart.md +5 -5
- package/docs/components/checkbox.md +2 -2
- package/docs/components/clipboard-button.md +2 -2
- package/docs/components/collapsible.md +2 -2
- package/docs/components/combobox.md +5 -5
- package/docs/components/command.md +5 -5
- package/docs/components/context-menu.md +5 -5
- package/docs/components/data-table.md +6 -6
- package/docs/components/date-picker.md +5 -5
- package/docs/components/dialog.md +4 -4
- package/docs/components/direction.md +2 -2
- package/docs/components/drawer.md +3 -3
- package/docs/components/dropdown-menu.md +3 -3
- package/docs/components/empty.md +3 -3
- package/docs/components/field.md +1 -1
- package/docs/components/form.md +3 -3
- package/docs/components/hover-card.md +2 -2
- package/docs/components/icon.md +3 -3
- package/docs/components/input-group.md +2 -2
- package/docs/components/input-otp.md +5 -5
- package/docs/components/input.md +5 -5
- package/docs/components/item.md +2 -2
- package/docs/components/kbd.md +2 -2
- package/docs/components/label.md +2 -2
- package/docs/components/markdown.md +3 -3
- package/docs/components/marker.md +2 -2
- package/docs/components/menubar.md +2 -2
- package/docs/components/message-scroller.md +5 -5
- package/docs/components/message.md +5 -5
- package/docs/components/native-select.md +2 -2
- package/docs/components/navigation-menu.md +3 -3
- package/docs/components/pagination.md +3 -3
- package/docs/components/popover.md +7 -7
- package/docs/components/progress.md +2 -2
- package/docs/components/pwa.md +2 -2
- package/docs/components/questionnaire.md +5 -5
- package/docs/components/radio-group.md +2 -2
- package/docs/components/resizable.md +5 -5
- package/docs/components/scroll-area.md +5 -5
- package/docs/components/select.md +2 -2
- package/docs/components/separator.md +2 -2
- package/docs/components/sheet.md +3 -3
- package/docs/components/shell.md +2 -2
- package/docs/components/sidebar.md +2 -2
- package/docs/components/skeleton.md +2 -2
- package/docs/components/slider.md +2 -2
- package/docs/components/spinner.md +3 -3
- package/docs/components/switch.md +2 -2
- package/docs/components/table.md +2 -2
- package/docs/components/tabs.md +4 -4
- package/docs/components/text-editor.md +2 -2
- package/docs/components/textarea.md +3 -3
- package/docs/components/theme-button.md +4 -4
- package/docs/components/toast.md +3 -3
- package/docs/components/toggle-group.md +5 -5
- package/docs/components/toggle.md +5 -5
- package/docs/components/tooltip.md +7 -7
- package/docs/components/typography.md +3 -3
- package/docs/icons.md +7 -7
- package/docs/installation.md +12 -11
- package/docs/owl-components.md +16 -16
- package/docs/registry.md +8 -8
- package/docs/runtime-api.md +3 -3
- package/docs/theming.md +4 -4
- package/docs/usage-guide.md +21 -21
- package/package.json +8 -1
package/docs/usage-guide.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# Usage Guide — Integrating
|
|
1
|
+
# Usage Guide — Integrating the Base UI Into a Project
|
|
2
2
|
|
|
3
|
-
This is the single entry point for adding
|
|
3
|
+
This is the single entry point for adding the Base UI to a consumer project (a static page, a Base HUB website page, a server-rendered app, or your own application). It sequences the existing reference docs into one path and gives copy-paste-ready examples — read the linked page for exhaustive detail on any step.
|
|
4
4
|
|
|
5
5
|
Audience: engineers and AI coding agents integrating `@thebase/ui` into a project that is **not** this repository.
|
|
6
6
|
|
|
7
7
|
## Quick start (copy-paste, works as-is)
|
|
8
8
|
|
|
9
|
-
Save this as an `.html` file and open it — no build step, no server required. It installs
|
|
9
|
+
Save this as an `.html` file and open it — no build step, no server required. It installs the Base UI from the pinned CDN and renders a button, an input, and a card using the base static markup (`b-ui`) API (the zero-build alternative). If you're building an application, skip straight to the [pure Base install](#2-install-pure-owl-api--recommended) below — it's the recommended way to consume the Base UI.
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
12
|
<!doctype html>
|
|
@@ -34,20 +34,20 @@ Save this as an `.html` file and open it — no build step, no server required.
|
|
|
34
34
|
|
|
35
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.3`, 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
|
-
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
|
|
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
|
|
|
39
39
|
## 1. Decide which API you need
|
|
40
40
|
|
|
41
41
|
| You are building... | Use | Install | Full reference |
|
|
42
42
|
| --- | --- | --- | --- |
|
|
43
|
-
| Your own
|
|
44
|
-
| Static HTML, a server-rendered page, or a Base HUB website page with no Owl runtime | The static `b-ui`
|
|
43
|
+
| Your own application that wants `<Button/>`, `<Card/>`, `<Dialog/>` as real component classes | The Base component API (recommended) | CSS + the same `baseui.min.js`/`baseui.esm.js` (via `@base/owl`/`@base/component` import-map keys or a plain npm import) + `dist/baseui.templates.xml` | [Base Components](owl-components.md) |
|
|
44
|
+
| Static HTML, a server-rendered page, or a Base HUB website page with no Owl runtime | The base static markup (`b-ui`) API (alternative) | One CSS file + one `<script>` tag | [Installation](installation.md) |
|
|
45
45
|
|
|
46
|
-
Both APIs come from the same package and the same CSS file, and can be mixed on one page. Prefer the
|
|
46
|
+
Both APIs come from the same package and the same CSS file, and can be mixed on one page. Prefer the Base component API by default — real component classes, props, and slots compose more predictably than markup attributes. Reach for the static API only when the target page has no Owl runtime of its own (plain HTML, server-rendered templates, a Base HUB website page) and adding one isn't worthwhile just to use the Base UI.
|
|
47
47
|
|
|
48
48
|
**[VERIFY]** Before choosing, confirm whether the target project already runs Owl (check for `@odoo/owl` or `@base/owl` in its `package.json`), or whether it's a plain page you'd rather not add a component-mount step to. Use the static API for the latter.
|
|
49
49
|
|
|
50
|
-
## 2. Install (pure
|
|
50
|
+
## 2. Install (pure Base API — recommended)
|
|
51
51
|
|
|
52
52
|
```html
|
|
53
53
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.css">
|
|
@@ -87,12 +87,12 @@ Both APIs come from the same package and the same CSS file, and can be mixed on
|
|
|
87
87
|
</script>
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
`@base/owl`, `@base/component`, and `@base/theme` all resolve to the exact same `dist/baseui.esm.js` — the one file this whole guide installs for the static API too. For npm/bundler usage, skip the import map entirely and import everything straight from `@thebase/ui` (plus `@thebase/ui/dist/baseui.templates.xml` as a fetch target) — see [
|
|
90
|
+
`@base/owl`, `@base/component`, and `@base/theme` all resolve to the exact same `dist/baseui.esm.js` — the one file this whole guide installs for the static API too. For npm/bundler usage, skip the import map entirely and import everything straight from `@thebase/ui` (plus `@thebase/ui/dist/baseui.templates.xml` as a fetch target) — see [Base Components](owl-components.md#npm--bundler-usage).
|
|
91
91
|
|
|
92
|
-
Two rules that account for most integration failures — see [
|
|
92
|
+
Two rules that account for most integration failures — see [Base Components](owl-components.md#common-mistakes) for the worked example:
|
|
93
93
|
|
|
94
|
-
1. `dist/baseui.templates.xml` must be loaded and passed to `mount()` before any
|
|
95
|
-
2. Import Owl itself from `@base/owl`, never `@odoo/owl` — otherwise the consumer's `Component` class and
|
|
94
|
+
1. `dist/baseui.templates.xml` must be loaded and passed to `mount()` before any Base UI tag renders.
|
|
95
|
+
2. Import Owl itself from `@base/owl`, never `@odoo/owl` — otherwise the consumer's `Component` class and the Base UI's are different runtime identities and mounting throws.
|
|
96
96
|
|
|
97
97
|
## 3. Install (static `b-ui` API — alternative, no Owl runtime needed)
|
|
98
98
|
|
|
@@ -116,7 +116,7 @@ import "@thebase/ui/baseui.css";
|
|
|
116
116
|
import "@thebase/ui"; // side-effect import: registers window.thebase and auto-mounts on DOMContentLoaded
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
`dist/baseui.min.js`/`baseui.esm.js` are fully self-contained — Bootstrap's JS bundle and the Owl runtime are embedded ahead of
|
|
119
|
+
`dist/baseui.min.js`/`baseui.esm.js` are fully self-contained — Bootstrap's JS bundle and the Owl runtime are embedded ahead of the Base UI's own code, in load order, inside this one file. No other script or import is needed for the static API.
|
|
120
120
|
|
|
121
121
|
Rule that applies to both options:
|
|
122
122
|
|
|
@@ -198,11 +198,11 @@ Full token list and the shadcn-aligned default palette: [Theming](theming.md).
|
|
|
198
198
|
</button>
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
Icons ship with the normal
|
|
201
|
+
Icons ship with the normal the Base UI assets — no separate script tag, and every Lucide icon name is available by kebab-case (`panel-left`), camelCase, or snake_case. Sizing, color, accessibility rules, and self-hosting: [Built-in Icons](icons.md).
|
|
202
202
|
|
|
203
203
|
## 5b. PWA toolkit (optional) — generate manifest.webmanifest + sw.js
|
|
204
204
|
|
|
205
|
-
Any
|
|
205
|
+
Any Base UI app can become an installable PWA without hand-writing a service worker. `@thebase/ui/pwa`
|
|
206
206
|
exports two pure functions, `buildManifest(config)` and `buildServiceWorker(config)`, that turn a
|
|
207
207
|
config object into the exact manifest JSON and service-worker source a hand-written PWA needs
|
|
208
208
|
(precache the app shell, network-first for same-origin requests, cache-first for the pinned CDN
|
|
@@ -248,7 +248,7 @@ For common layouts (dashboard shells, sidebars, login/signup forms, charts), cop
|
|
|
248
248
|
- [ ] Only `baseui.min.css` + `baseui.min.js` (or `baseui.esm.js`) are loaded — no separate `baseui.owl.*`/`bootstrap.bundle.min.js`/`baseui.components.esm.js` files needed, for either API.
|
|
249
249
|
- [ ] `thebase.version` returns the expected pinned version in the browser console.
|
|
250
250
|
- [ ] Initial static markup mounts without an extra call; injected markup mounts after `thebase.mountAll(root)`.
|
|
251
|
-
- [ ]
|
|
251
|
+
- [ ] Base components render with no console errors (a missing-template error means step 2's `dist/baseui.templates.xml` load is missing or unawaited).
|
|
252
252
|
- [ ] Toggling `b-theme` actually changes rendered colors (a no-op usually means CSS custom properties are being overridden by the consumer's own stylesheet loaded after `baseui.min.css`).
|
|
253
253
|
- [ ] Look up the specific component in [`docs/components/`](components/) for its attributes, events, and accessibility notes before wiring it up.
|
|
254
254
|
|
|
@@ -259,10 +259,10 @@ For common layouts (dashboard shells, sidebars, login/signup forms, charts), cop
|
|
|
259
259
|
| `ReferenceError: BaseUI is not defined` | The bundle script hasn't run yet, or its `<script>` tag is missing/mistyped. | Confirm the `<script src=".../baseui.min.js" defer>` tag is present and the network tab shows it loading (200, not 404). |
|
|
260
260
|
| Components render unstyled (plain HTML, no Bootstrap look) | `baseui.min.css` isn't loaded, or loaded after your own stylesheet overrides it. | Load `baseui.min.css` in `<head>`, before any of your own CSS that touches the same elements. |
|
|
261
261
|
| `tabs` (or another Owl-backed static component) silently does nothing | `baseui.min.js` didn't finish loading. | Confirm `baseui.min.js` loads (network tab, 200 not 404). |
|
|
262
|
-
| Pure
|
|
263
|
-
|
|
|
262
|
+
| Pure Base mount throws `"X is not a Component. It must inherit from the Component class"` | Your app imports `@odoo/owl` directly somewhere instead of `@base/owl`. | Replace every `@odoo/owl` import with `@base/owl` in your own app code — both must resolve to the same `globalThis.owl` instance. |
|
|
263
|
+
| Base component renders blank / throws a template-not-found error | `dist/baseui.templates.xml` was never fetched and passed to `mount()`. | Fetch the templates string and pass it as `{ templates }` to `mount()` (or `app.addTemplates(...)`) before rendering any Base UI tag. |
|
|
264
264
|
| New markup injected via AJAX/fetch doesn't turn into components | Auto-mount only covers markup present when the bundle initializes. | Call `thebase.mountAll(root)` after injecting new `[b-ui]` or `[b-icon]` markup — it's idempotent, safe to call repeatedly. |
|
|
265
|
-
| `thebase.theme.set(...)` has no visible effect | A page stylesheet loaded after `baseui.min.css` re-hardcodes the same properties, or the element isn't a descendant of the themed root. | Load consumer CSS after
|
|
265
|
+
| `thebase.theme.set(...)` has no visible effect | A page stylesheet loaded after `baseui.min.css` re-hardcodes the same properties, or the element isn't a descendant of the themed root. | Load consumer CSS after the Base UI's, and confirm `b-theme` is set on `<html>` or an ancestor of the components you expect to change. |
|
|
266
266
|
|
|
267
267
|
## 9. Common mistakes
|
|
268
268
|
|
|
@@ -270,8 +270,8 @@ For common layouts (dashboard shells, sidebars, login/signup forms, charts), cop
|
|
|
270
270
|
- Using `/latest/` CDN paths in production instead of a pinned version.
|
|
271
271
|
- Assuming auto-mount watches the DOM forever — it does not; call `thebase.mountAll(root)` after injecting new `[b-ui]` markup client-side (e.g. from a fetched partial).
|
|
272
272
|
- Mixing `@odoo/owl` imports into a project that also imports `@thebase/ui` — always go through `@base/owl`.
|
|
273
|
-
- Expecting `thebase.mountAll()` to pick up Owl component tags (`<Button/>`) — it only mounts static `[b-ui]` markers;
|
|
273
|
+
- Expecting `thebase.mountAll()` to pick up Owl component tags (`<Button/>`) — it only mounts static `[b-ui]` markers; Base components are registered and mounted through your own app's `static components` + `mount()`, per step 2.
|
|
274
274
|
|
|
275
275
|
## Related docs
|
|
276
276
|
|
|
277
|
-
[Installation](installation.md) · [Runtime API](runtime-api.md) · [Theming](theming.md) · [Built-in Icons](icons.md) · [
|
|
277
|
+
[Installation](installation.md) · [Runtime API](runtime-api.md) · [Theming](theming.md) · [Built-in Icons](icons.md) · [Base Components](owl-components.md) · [Blocks](blocks.md) · [Component Authoring](component-authoring.md) (for contributing to the Base UI itself, not for consuming it) · [Registry](registry.md) · [Component Reference index](components/button.md) (per-component pages live under `docs/components/`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thebase/ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "CDN-installable Owl and Bootstrap 5 UI component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/baseui.min.js",
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"import": "./dist/baseui.analytics.esm.js",
|
|
26
26
|
"default": "./dist/baseui.analytics.min.js"
|
|
27
27
|
},
|
|
28
|
+
"./apidoc": {
|
|
29
|
+
"types": "./dist/types/apidoc.d.ts",
|
|
30
|
+
"import": "./dist/baseui.apidoc.esm.js",
|
|
31
|
+
"default": "./dist/baseui.apidoc.min.js"
|
|
32
|
+
},
|
|
28
33
|
"./pwa": {
|
|
29
34
|
"types": "./dist/types/pwa.d.ts",
|
|
30
35
|
"import": "./dist/baseui.pwa.esm.js"
|
|
@@ -39,6 +44,8 @@
|
|
|
39
44
|
"dist/baseui.icons.esm.js",
|
|
40
45
|
"dist/baseui.analytics.esm.js",
|
|
41
46
|
"dist/baseui.analytics.min.js",
|
|
47
|
+
"dist/baseui.apidoc.esm.js",
|
|
48
|
+
"dist/baseui.apidoc.min.js",
|
|
42
49
|
"dist/baseui.pwa.esm.js",
|
|
43
50
|
"dist/baseui.templates.xml",
|
|
44
51
|
"dist/icons",
|