@thebase/ui 1.1.1 → 1.1.3
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 +26 -0
- package/README.md +21 -6
- package/bin/create-baseui-app.mjs +464 -4
- package/dist/apidoc/img/bash-plain.svg +1 -0
- package/dist/apidoc/img/c-original.svg +1 -0
- package/dist/apidoc/img/csharp-original.svg +1 -0
- package/dist/apidoc/img/dart-original.svg +1 -0
- package/dist/apidoc/img/go-original-wordmark.svg +1 -0
- package/dist/apidoc/img/java-original.svg +1 -0
- package/dist/apidoc/img/javascript-original.svg +1 -0
- package/dist/apidoc/img/kotlin-original.svg +10 -0
- package/dist/apidoc/img/lua.svg +7 -0
- package/dist/apidoc/img/nodejs-original.svg +1 -0
- package/dist/apidoc/img/objectivec-plain.svg +1 -0
- package/dist/apidoc/img/php-original.svg +2 -0
- package/dist/apidoc/img/python-original.svg +1 -0
- package/dist/apidoc/img/ruby-plain.svg +1 -0
- package/dist/apidoc/img/rust-original.svg +1 -0
- package/dist/apidoc/img/swift-original.svg +1 -0
- package/dist/apidoc/img/windows8-original.svg +1 -0
- package/dist/baseui.esm.js +33 -11
- package/dist/baseui.min.css +1 -1
- package/dist/baseui.min.js +33 -11
- package/dist/baseui.pwa.esm.js +53 -0
- package/dist/baseui.registry.json +42 -5
- package/dist/baseui.templates.xml +469 -1
- package/dist/pwa-icons/apple-touch-icon.png +0 -0
- package/dist/pwa-icons/favicon-16x16.png +0 -0
- package/dist/pwa-icons/favicon-32x32.png +0 -0
- package/dist/pwa-icons/favicon.ico +0 -0
- package/dist/pwa-icons/icon-192.png +0 -0
- package/dist/pwa-icons/icon-512.png +0 -0
- package/dist/types/pwa.d.ts +45 -0
- package/docs/analytics.md +4 -4
- package/docs/blocks.md +2 -1
- package/docs/components/apidoc.md +66 -0
- package/docs/components/input.md +17 -0
- package/docs/components/markdown.md +1 -1
- package/docs/icons.md +1 -1
- package/docs/installation.md +2 -2
- package/docs/owl-components.md +1 -1
- package/docs/registry.md +1 -1
- package/docs/theming.md +1 -1
- package/docs/usage-guide.md +43 -4
- package/package.json +8 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Optional PWA toolkit: builds manifest.webmanifest/sw.js content from a config object. */
|
|
2
|
+
export interface BaseUIManifestConfig {
|
|
3
|
+
name: string;
|
|
4
|
+
/** Defaults to `name`. */
|
|
5
|
+
shortName?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
/** Defaults to "/". */
|
|
8
|
+
startUrl?: string;
|
|
9
|
+
/** Defaults to "/". */
|
|
10
|
+
scope?: string;
|
|
11
|
+
/** Defaults to "standalone". */
|
|
12
|
+
display?: string;
|
|
13
|
+
/** Defaults to "portrait-primary". */
|
|
14
|
+
orientation?: string;
|
|
15
|
+
/** Defaults to "#ffffff". */
|
|
16
|
+
backgroundColor?: string;
|
|
17
|
+
/** Defaults to "#0f172a". */
|
|
18
|
+
themeColor?: string;
|
|
19
|
+
/** Defaults to "en". */
|
|
20
|
+
lang?: string;
|
|
21
|
+
/** Folder URL holding the default logo files. Defaults to "/icons/". */
|
|
22
|
+
iconsBase?: string;
|
|
23
|
+
/** Defaults to the shipped logo: `icon-192.png` and `icon-512.png` under `iconsBase`. */
|
|
24
|
+
icons?: Array<{ src: string; sizes: string; type: string; purpose?: string }>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface BaseUIServiceWorkerConfig {
|
|
28
|
+
/** Cache bucket name, e.g. "my-app-cache-v1" — bump the suffix to invalidate old caches. */
|
|
29
|
+
cacheName: string;
|
|
30
|
+
/** Pinned `@thebase/ui` version the generated sw.js precaches/serves from jsdelivr. */
|
|
31
|
+
cdnVersion: string;
|
|
32
|
+
/** Where the manifest is served from. Defaults to "/manifest.webmanifest". */
|
|
33
|
+
manifestUrl?: string;
|
|
34
|
+
/** Folder URL holding the default logo/favicon files to precache. Defaults to "/icons/". */
|
|
35
|
+
iconsBase?: string;
|
|
36
|
+
/** Same-origin app-shell paths to precache (JS/CSS/XML/icons/etc). */
|
|
37
|
+
appFiles?: string[];
|
|
38
|
+
/** Extra same-origin or cross-origin URLs to precache alongside `appFiles`. */
|
|
39
|
+
extraPrecacheUrls?: string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Default logo/favicon file names (in `dist/pwa-icons/`), precached from `/icons/` by default. */
|
|
43
|
+
export const DEFAULT_ICON_FILES: string[];
|
|
44
|
+
export function buildManifest(config: BaseUIManifestConfig): Record<string, unknown>;
|
|
45
|
+
export function buildServiceWorker(config: BaseUIServiceWorkerConfig): string;
|
package/docs/analytics.md
CHANGED
|
@@ -13,12 +13,12 @@ init({ backendUrl: "https://stats.example.com" });
|
|
|
13
13
|
```html
|
|
14
14
|
<!-- ES module from the CDN (or map it as "@base/analytics" in an import map) -->
|
|
15
15
|
<script type="module">
|
|
16
|
-
import { init } from "https://cdn.jsdelivr.net/npm/@thebase/ui@1.1.
|
|
16
|
+
import { init } from "https://cdn.jsdelivr.net/npm/@thebase/ui@1.1.3/dist/baseui.analytics.esm.js";
|
|
17
17
|
init({ backendUrl: "https://stats.example.com" });
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
20
|
<!-- Classic script tag: sets window.thebase.analytics (load order vs dist/baseui.min.js doesn't matter) -->
|
|
21
|
-
<script src="https://cdn.jsdelivr.net/npm/@thebase/ui@1.1.
|
|
21
|
+
<script src="https://cdn.jsdelivr.net/npm/@thebase/ui@1.1.3/dist/baseui.analytics.min.js"></script>
|
|
22
22
|
<script>
|
|
23
23
|
thebase.analytics.init({ backendUrl: "https://stats.example.com" });
|
|
24
24
|
</script>
|
|
@@ -84,7 +84,7 @@ init({ backendUrl: "https://stats.example.com", customProperties: visitorContext
|
|
|
84
84
|
| `lang` | `navigator.language`, e.g. `vi-VN`. |
|
|
85
85
|
| `screen` | Viewport width bucket: `Mobile` (< 576 px), `Tablet` (< 992), `Laptop` (< 1440), `Desktop`. |
|
|
86
86
|
|
|
87
|
-
The values are deliberately coarse: no exact pixels, nothing persistent. Backends can treat `tz`, `lang` and `screen` as visit dimensions instead of event props. To combine it with your own props, call it inside your function: `customProperties: (name) => ({ ...visitorContext(), plan: "pro" })`. The IP address and user agent never appear in the payload; the server reads them from the HTTP request (see [Receiving events](#receiving-events-backend)).
|
|
87
|
+
The values are deliberately coarse: no exact pixels, nothing persistent. Backends can treat `tz`, `lang` and `screen` as visit dimensions instead of event props. To combine it with your own props, call it inside your function: `customProperties: (name) => ({ ...visitorContext(), plan: "pro" })`. Don't use `tz`, `lang` or `screen` as your own event prop names: event props override custom properties with the same key, so the visitor's value would be lost. Use something like `uiLang` instead. The IP address and user agent never appear in the payload; the server reads them from the HTTP request (see [Receiving events](#receiving-events-backend)).
|
|
88
88
|
|
|
89
89
|
## Engagement
|
|
90
90
|
|
|
@@ -228,7 +228,7 @@ curl -i -X POST http://localhost:8080/api/event -H 'Content-Type: text/plain' \
|
|
|
228
228
|
|
|
229
229
|
[`examples/analytics/`](../examples/analytics/dashboard/?backend=http://localhost:8080) contains a working dashboard plus two complete sample backends: [`server-go`](../examples/analytics/server-go/main.go) (Fiber v3) and [`server-fastapi`](../examples/analytics/server-fastapi/main.py). Each one extends the receivers above with an in-memory store, a daily-salted cookieless visitor hash, a `GET /api/stats` endpoint, and static hosting for the dashboard.
|
|
230
230
|
|
|
231
|
-
The dashboard ([`dashboard/`](../examples/analytics/dashboard/?backend=http://localhost:8080)) is a pure Owl app that loads `@thebase/ui@1.1.
|
|
231
|
+
The dashboard ([`dashboard/`](../examples/analytics/dashboard/?backend=http://localhost:8080)) is a pure Owl app that loads `@thebase/ui@1.1.3` from jsDelivr: KPI `Card`s, an area `Chart`, top pages/sources/events `Table`s, site and period `NativeSelect`s, and a `ThemeButton`. It refreshes every 30 s and tracks its own visits through `@thebase/ui/analytics`, so a fresh backend has data straight away.
|
|
232
232
|
|
|
233
233
|
```sh
|
|
234
234
|
# Go (1.25+)
|
package/docs/blocks.md
CHANGED
|
@@ -13,7 +13,7 @@ Blocks are not standalone runtime components. Paste the markup and load the norm
|
|
|
13
13
|
<script src="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.js" defer></script>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
`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.
|
|
16
|
+
`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.3`, or `@1` to take only non-breaking updates) instead of `@latest` for production. Blocks are static markup, so they only need the static `b-ui` runtime above — see [Usage Guide](usage-guide.md) if the surrounding page is itself an Owl app and you'd rather compose the equivalent layout from [Pure Owl Components](owl-components.md).
|
|
17
17
|
|
|
18
18
|
Use `b-block` to select the block style:
|
|
19
19
|
|
|
@@ -30,6 +30,7 @@ The docs/dev server serves the block gallery at `/blocks` through the shared `ex
|
|
|
30
30
|
|
|
31
31
|
## Included Blocks
|
|
32
32
|
|
|
33
|
+
- `apidoc-01`: full-page API reference built from an OpenAPI 3 file with the pure Owl `ApiDoc` component (sidebar, schemas, Try It, Authorize); see [ApiDoc](components/apidoc.md).
|
|
33
34
|
- `chart-01`: copyable usage block showing how to compose `b-ui="chart"` with chart slots, SVG primitives, tokens, and footer copy.
|
|
34
35
|
- `dashboard-01`: dashboard shell with inset sidebar, header, metric cards, chart surface, and table area.
|
|
35
36
|
- `sidebar-01` through `sidebar-16`: static conversions of the current shadcn/ui sidebar block family, including documentation sidebars, collapsible groups, inset navigation, mail, workspace, file explorer, calendar, dialog, right TOC, dual-sidebar, and sticky-header variants.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# ApiDoc
|
|
2
|
+
|
|
3
|
+
Use `b-ui="apidoc"` (or the pure Owl `ApiDoc` component) to render an **OpenAPI 3.0+ JSON** document as browsable API documentation: a grouped sidebar, per-operation parameters / request body / responses / callbacks, a **Try It** panel with request code samples in 17 languages, and an **Authorize** dialog (API key, HTTP basic, bearer, OpenID Connect token, OAuth2 implicit / authorization-code / password / client-credentials).
|
|
4
|
+
|
|
5
|
+
Swagger 2.0 documents still render, but OpenAPI 3.x is the supported input: `requestBody`, `components.securitySchemes` (`http`, `apiKey`, `oauth2` `flows`, `openIdConnect`, `mutualTLS`), `servers` with variables, `webhooks`, `callbacks`, `links`, tag `parent`/`kind`, and `$ref` to components are all understood.
|
|
6
|
+
|
|
7
|
+
Markdown in `info.description`, tag and operation descriptions is rendered with the [Markdown](markdown.md) component (fenced ` ```mermaid ` blocks become diagrams). The spec is trusted content — descriptions are rendered as Markdown/HTML, so do not point ApiDoc at a spec you do not control.
|
|
8
|
+
|
|
9
|
+
## Pure Owl component
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { ApiDoc } from "@base/component";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<ApiDoc src="'/openapi.json'" height="'100vh'" theme="'auto'" themeToggle="true" hash="true"/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Pass an already-parsed document with `spec` instead of `src`:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<ApiDoc spec="state.spec" serverUrl="'https://api.example.com'" tryIt="false"/>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Static component
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<div b-ui="apidoc" b-att-src="/openapi.json" b-att-height="100vh" b-att-hash="true"></div>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The static adapter fetches `baseui.templates.xml` from the folder the BaseUI script was loaded from; set `b-att-templates` to override.
|
|
32
|
+
|
|
33
|
+
## Props / attributes
|
|
34
|
+
|
|
35
|
+
| Owl prop | Static attribute | Default | Meaning |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| `src` | `b-att-src` | — | URL of the OpenAPI JSON file. |
|
|
38
|
+
| `spec` | — | — | Parsed OpenAPI object (alternative to `src`). |
|
|
39
|
+
| `title` | `b-att-title` | `info.title` | Heading shown in the header and introduction. |
|
|
40
|
+
| `serverUrl` | `b-att-server-url` | `servers` of the spec | Replaces the spec's servers (e.g. `location.origin`) so Try It targets one host. |
|
|
41
|
+
| `theme` | `b-att-theme` | `auto` | `light`, `dark`, or `auto` (follows `data-bs-theme` on `<html>`, else the OS). |
|
|
42
|
+
| `themeToggle` | `b-att-theme-toggle` | `false` | Shows a light/dark button in the header. |
|
|
43
|
+
| `hash` | `b-att-hash` | `false` | Keep the open page in `location.hash` (`#/<operationId>`), so pages are linkable. Off by default so ApiDoc does not fight an app's own router. |
|
|
44
|
+
| `operation` | `b-att-operation` | introduction | Operation id to open first (the lower-cased, dash-separated `operationId`). |
|
|
45
|
+
| `tryIt` | `b-att-try-it` | `true` | Show the Try It panel (code samples + Send API Request). |
|
|
46
|
+
| `authorize` | `b-att-authorize` | `true` | Show the Authorize button when the spec defines security schemes. |
|
|
47
|
+
| `languages` | `b-att-languages` | all 17 | Which code-sample languages to offer, e.g. `['curl', 'node', 'python']` / `curl,node,python`. |
|
|
48
|
+
| `language` | `b-att-language` | `curl` | Language selected first. |
|
|
49
|
+
| `assetBase` | `b-att-asset-base` | `dist/apidoc` beside the BaseUI script | Folder that holds `img/*.svg` language logos. Empty string hides the logos. |
|
|
50
|
+
| `oauthRedirectUri` | `b-att-oauth-redirect-uri` | `oauth2-redirect.html` next to the page | Popup landing page for the implicit / authorization-code flows (see `src/components/apidoc/oauth2-redirect.html`). |
|
|
51
|
+
| `height` | `b-att-height` | `100vh` | CSS height of the component. |
|
|
52
|
+
| `className`, `style` | — | — | Standard root class / inline style. |
|
|
53
|
+
|
|
54
|
+
## Events
|
|
55
|
+
|
|
56
|
+
| Owl callback | Static event | Detail |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| `onLoad(doc)` | `baseui:load` | `{ info, operations }` once the spec is parsed. |
|
|
59
|
+
| `onError(error)` | `baseui:error` | `{ error }` when the spec cannot be fetched or is not OpenAPI. |
|
|
60
|
+
| `onNavigate(id)` | `baseui:navigate` | `{ id }` — `introduction` or an operation id. |
|
|
61
|
+
|
|
62
|
+
## Notes
|
|
63
|
+
|
|
64
|
+
- Credentials entered in Authorize live in the tab's `sessionStorage` (`apikey`, `oauthkey`) and are applied to every Try It request. Try It sends the request from the browser, so the API must allow CORS from the docs origin.
|
|
65
|
+
- Language logos are copied to `dist/apidoc/img/` by `npm run build`; the CDN URL pattern is `https://cdn.jsdelivr.net/npm/@thebase/ui@<version>/dist/apidoc/img/`.
|
|
66
|
+
- Styles are scoped under `.bu-apidoc` and use their own palette (`--line`, `--accent`, … on `.bu-apidoc`); override them on a wrapper selector to re-theme.
|
package/docs/components/input.md
CHANGED
|
@@ -14,9 +14,26 @@ import { Input } from "@thebase/ui";
|
|
|
14
14
|
</div>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
```base-ui
|
|
18
|
+
<div style="max-width: 28rem" class="w-100 pt-3">
|
|
19
|
+
<Input label="'First name'" value="'Odette'" supportingText="'As on your ID'" leadingIcon="'user'"/>
|
|
20
|
+
</div>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```base-ui
|
|
24
|
+
<div style="max-width: 28rem" class="w-100 pt-3">
|
|
25
|
+
<Input label="'Email'" value="'odette@'" errorText="'Enter a valid email'" leadingIcon="'mail'"/>
|
|
26
|
+
</div>
|
|
27
|
+
```
|
|
28
|
+
|
|
17
29
|
| Prop | Type | Notes |
|
|
18
30
|
| --- | --- | --- |
|
|
19
31
|
| `value` | `String` | controlled value; the component never mutates it itself |
|
|
32
|
+
| `label` | `String` | Material-style outlined field: label rests inside, floats onto the border when focused/filled (or when `placeholder` is set) |
|
|
33
|
+
| `supportingText` | `String` | helper line under the field, linked via `aria-describedby` |
|
|
34
|
+
| `errorText` | `String` | marks the field invalid, replaces `supportingText`, swaps the trailing icon for an error icon, sets `aria-invalid` |
|
|
35
|
+
| `leadingIcon` / `trailingIcon` | `String` | Lucide icon names (outlined mode only) |
|
|
36
|
+
| `maxLength` | `Number` | native limit; outlined mode also shows a `n/max` counter |
|
|
20
37
|
| `placeholder` | `String` | |
|
|
21
38
|
| `type` | `String` | native `<input type>` |
|
|
22
39
|
| `disabled` | `Boolean` | |
|
|
@@ -97,7 +97,7 @@ A fenced ` ```base-ui ` block renders as a live component, not a code sample:
|
|
|
97
97
|
|
|
98
98
|
- `b-att-src` / `src` — fetch a remote Markdown file instead of using inline content.
|
|
99
99
|
- `b-att-content` / `content` — a static `<script type="text/markdown">` child (or a `<template>`), `b-att-content`, or the element's own text content supplies the Markdown source when no `src` is set.
|
|
100
|
-
- `b-att-mermaid` / `mermaid` — set to `"false"` to skip mermaid diagram rendering (defaults to enabled).
|
|
100
|
+
- `b-att-mermaid` / `mermaid` — set to `"false"` to skip mermaid diagram rendering (defaults to enabled). Diagrams use mermaid's dark theme when the nearest `data-bs-theme` (else the system preference) is dark.
|
|
101
101
|
- `b-att-base-ui` / `baseUi` — set to `"false"` to skip live-mounting fenced ` ```base-ui ` blocks; they render as plain code instead (defaults to enabled).
|
|
102
102
|
- `b-att-editable` / `editable` — set to `"true"` to mount Milkdown instead of read-only rendered HTML.
|
|
103
103
|
- `b-att-collaborative` / `collaborative` — set to `"true"` to connect the editor through Yjs + y-webrtc.
|
package/docs/icons.md
CHANGED
|
@@ -22,7 +22,7 @@ Load the normal BaseUI 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.
|
|
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.3`, or `@1` to take only non-breaking updates) instead of `@latest` for production. `b-icon` also works with the [pure Owl `Icon` component](components/icon.md) — the recommended API in an Owl app; 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
|
|
package/docs/installation.md
CHANGED
|
@@ -4,7 +4,7 @@ See the [Usage Guide](usage-guide.md) for the end-to-end integration path (choos
|
|
|
4
4
|
|
|
5
5
|
BaseUI 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 BaseUI's own code, in load order (Bootstrap, then Owl, then BaseUI) — nothing else needs to load first. Both install paths below load this same file; the pure Owl component API is the recommended way to consume BaseUI in an Owl app, with the static `b-ui` markup 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.
|
|
7
|
+
The snippets below use the `@latest` tag for readability. Pin an exact version instead (e.g. `@1.1.3`, 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
|
## Pure Owl 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 BaseUI'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.
|
|
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.3`, or `@1` to take only non-breaking updates) instead of `@latest` for production.
|
|
47
47
|
|
|
48
48
|
For npm/self-hosted usage:
|
|
49
49
|
|
package/docs/owl-components.md
CHANGED
|
@@ -4,7 +4,7 @@ See the [Usage Guide](usage-guide.md) for when to reach for this API versus the
|
|
|
4
4
|
|
|
5
5
|
BaseUI ships a second, additive public API alongside the static `b-ui` markers: real Owl component classes you import, compose with `static components`, and mount as part of your own Owl app. This page covers how to load and use it; see [Component Authoring](component-authoring.md) for how components implement both APIs from one source folder.
|
|
6
6
|
|
|
7
|
-
As of 1.1.0, every component in the registry (all
|
|
7
|
+
As of 1.1.0, every component in the registry (all 74) has a pure Owl export — there are no static-only components left. Compound components export a root class plus sub-components (e.g. `Dialog`/`DialogTrigger`/`DialogContent`/...); check a component's `owlComponents` entry in `dist/baseui.registry.json`, or its doc page under [`docs/components/`](components/), for the exact export list. A few components have a deliberately reshaped pure Owl API versus their static markup-scanning adapter — see [Registry](registry.md#component-export-policy) for which ones and why.
|
|
8
8
|
|
|
9
9
|
## What you need to load
|
|
10
10
|
|
package/docs/registry.md
CHANGED
|
@@ -20,7 +20,7 @@ BaseUI ships as bundled files only — there is no per-component source distribu
|
|
|
20
20
|
|
|
21
21
|
Every component folder under `src/components/<name>/` is one of:
|
|
22
22
|
|
|
23
|
-
1. **Both APIs** — has `<name>.js` (static `BaseUI.register(...)` adapter) *and* `<name>.component.js` (pure Owl `Component` class(es)). As of the Phase 8 rollout this is **all
|
|
23
|
+
1. **Both APIs** — has `<name>.js` (static `BaseUI.register(...)` adapter) *and* `<name>.component.js` (pure Owl `Component` class(es)). As of the Phase 8 rollout this is **all 74** registry components; there are no static-only exceptions left. A handful of components (`chart`, most notably) have lighter-fidelity pure Owl treatments than their static adapter — see their component doc page for the documented gap — but every registry component has a real Owl export.
|
|
24
24
|
2. Static-only components would report `"type": "static"` with no `owlComponents` field, but none currently exist in this registry.
|
|
25
25
|
|
|
26
26
|
Per-component registry entries now include:
|
package/docs/theming.md
CHANGED
|
@@ -38,7 +38,7 @@ For a reusable theme toggle with persistence, URL override, button-label sync, a
|
|
|
38
38
|
</script>
|
|
39
39
|
```
|
|
40
40
|
|
|
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.
|
|
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.3`, 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
42
|
|
|
43
43
|
For a ready-made icon button, use the BaseUI component instead of wiring your own click handler:
|
|
44
44
|
|
package/docs/usage-guide.md
CHANGED
|
@@ -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.
|
|
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
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 Owl app, 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.
|
|
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.3`, 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 [Pure Owl Component
|
|
|
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.
|
|
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.3`, 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.
|
|
123
|
+
- Production pages must use a pinned version (e.g. `@thebase/ui@1.1.3` or `@thebase/ui@1`), never `@latest`.
|
|
124
124
|
|
|
125
125
|
Mount markup:
|
|
126
126
|
|
|
@@ -200,6 +200,45 @@ Full token list and the shadcn-aligned default palette: [Theming](theming.md).
|
|
|
200
200
|
|
|
201
201
|
Icons ship with the normal BaseUI 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
|
+
## 5b. PWA toolkit (optional) — generate manifest.webmanifest + sw.js
|
|
204
|
+
|
|
205
|
+
Any BaseUI app can become an installable PWA without hand-writing a service worker. `@thebase/ui/pwa`
|
|
206
|
+
exports two pure functions, `buildManifest(config)` and `buildServiceWorker(config)`, that turn a
|
|
207
|
+
config object into the exact manifest JSON and service-worker source a hand-written PWA needs
|
|
208
|
+
(precache the app shell, network-first for same-origin requests, cache-first for the pinned CDN
|
|
209
|
+
build). Define the variables once, regenerate the files whenever they change:
|
|
210
|
+
|
|
211
|
+
```js
|
|
212
|
+
// baseui.pwa.config.js
|
|
213
|
+
export default {
|
|
214
|
+
manifest: {
|
|
215
|
+
name: "My App",
|
|
216
|
+
shortName: "MyApp",
|
|
217
|
+
description: "One sentence about the app.",
|
|
218
|
+
themeColor: "#0f172a",
|
|
219
|
+
},
|
|
220
|
+
serviceWorker: {
|
|
221
|
+
cacheName: "my-app-cache-v1",
|
|
222
|
+
cdnVersion: "1.1.3", // pin to match the importmap in index.html
|
|
223
|
+
appFiles: ["/app.css", "/app.js", "/app.xml", "/favicon.svg", "/icons/icon-192.png", "/icons/icon-512.png"],
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
```sh
|
|
229
|
+
npx create-baseui-app pwa . --config baseui.pwa.config.js
|
|
230
|
+
# writes ./manifest.webmanifest and ./sw.js
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Re-run the command whenever `appFiles`, the CDN pin, or manifest fields change — both output files are
|
|
234
|
+
fully regenerated, never hand-patched. Only `manifest.name`, `serviceWorker.cacheName`, and
|
|
235
|
+
`serviceWorker.cdnVersion` are required; everything else (icons, theme/background color, display
|
|
236
|
+
mode, extra precache URLs) has defaults. The default logo and favicon set (`favicon.ico`, 16/32 px favicons,
|
|
237
|
+
`apple-touch-icon.png`, `icon-192.png`, `icon-512.png`) is copied into `<path>/icons/` by the command (existing
|
|
238
|
+
files are kept, so your own icons win). Serving icons from another folder? Set `iconsBase` (manifest and
|
|
239
|
+
service worker) and `manifestUrl` (service worker) in the config. See
|
|
240
|
+
`dist/types/pwa.d.ts` for the full config shape.
|
|
241
|
+
|
|
203
242
|
## 6. Copy a block instead of assembling from primitives
|
|
204
243
|
|
|
205
244
|
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.
|
|
3
|
+
"version": "1.1.3",
|
|
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,10 @@
|
|
|
25
25
|
"import": "./dist/baseui.analytics.esm.js",
|
|
26
26
|
"default": "./dist/baseui.analytics.min.js"
|
|
27
27
|
},
|
|
28
|
+
"./pwa": {
|
|
29
|
+
"types": "./dist/types/pwa.d.ts",
|
|
30
|
+
"import": "./dist/baseui.pwa.esm.js"
|
|
31
|
+
},
|
|
28
32
|
"./dist/baseui.templates.xml": "./dist/baseui.templates.xml"
|
|
29
33
|
},
|
|
30
34
|
"files": [
|
|
@@ -35,8 +39,11 @@
|
|
|
35
39
|
"dist/baseui.icons.esm.js",
|
|
36
40
|
"dist/baseui.analytics.esm.js",
|
|
37
41
|
"dist/baseui.analytics.min.js",
|
|
42
|
+
"dist/baseui.pwa.esm.js",
|
|
38
43
|
"dist/baseui.templates.xml",
|
|
39
44
|
"dist/icons",
|
|
45
|
+
"dist/pwa-icons",
|
|
46
|
+
"dist/apidoc",
|
|
40
47
|
"dist/baseui.registry.json",
|
|
41
48
|
"dist/runtime",
|
|
42
49
|
"dist/themes",
|