@thebase/ui 1.2.0 → 1.3.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.
- package/CHANGELOG.md +32 -260
- package/LICENSE +1 -1
- package/README.md +98 -93
- package/bin/{create-baseui-app.mjs → create-nodexui-app.mjs} +65 -65
- package/dist/{baseui.apidoc.esm.js → nodexui.apidoc.esm.js} +136 -136
- package/dist/{baseui.apidoc.min.js → nodexui.apidoc.min.js} +137 -137
- package/dist/nodexui.esm.js +58 -0
- package/dist/nodexui.i18n.esm.js +2 -0
- package/dist/nodexui.i18n.min.js +2 -0
- package/dist/nodexui.icons.esm.js +1 -0
- package/dist/{baseui.min.css → nodexui.min.css} +1 -1
- package/dist/nodexui.min.js +77 -0
- package/dist/{baseui.pwa.esm.js → nodexui.pwa.esm.js} +5 -5
- package/dist/{baseui.registry.json → nodexui.registry.json} +162 -162
- package/dist/{baseui.templates.xml → nodexui.templates.xml} +573 -573
- package/dist/{baseui.vite.esm.js → nodexui.vite.esm.js} +6 -6
- package/dist/runtime/mermaid/mermaid.esm.min.mjs +2 -2
- package/dist/runtime/milkdown/milkdown-editor.js +1 -1
- package/dist/runtime/milkdown/milkdown-text-editor.js +1 -1
- package/dist/themes/{baseui-dark.css → nodexui-dark.css} +2 -2
- package/dist/themes/{baseui-light.css → nodexui-light.css} +2 -2
- package/dist/types/analytics.d.ts +12 -12
- package/dist/types/apidoc.d.ts +1 -1
- package/dist/types/i18n.d.ts +25 -0
- package/dist/types/index.d.ts +16 -14
- package/dist/types/vite.d.ts +2 -2
- package/docs/analytics.md +12 -12
- package/docs/base-ui-skill.md +4 -4
- package/docs/blocks.md +6 -6
- package/docs/components/accordion.md +4 -4
- package/docs/components/alert-dialog.md +2 -2
- package/docs/components/alert.md +5 -5
- package/docs/components/apidoc.md +14 -14
- package/docs/components/aspect-ratio.md +2 -2
- package/docs/components/attachment.md +5 -5
- package/docs/components/avatar.md +7 -7
- package/docs/components/badge.md +2 -2
- package/docs/components/block-viewer.md +8 -8
- 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 +7 -7
- package/docs/components/card.md +2 -2
- package/docs/components/carousel.md +9 -9
- package/docs/components/chart.md +7 -7
- package/docs/components/checkbox.md +2 -2
- package/docs/components/clipboard-button.md +7 -7
- package/docs/components/code-editor.md +1 -1
- package/docs/components/collapsible.md +4 -4
- package/docs/components/combobox.md +7 -7
- package/docs/components/command.md +7 -7
- package/docs/components/context-menu.md +7 -7
- package/docs/components/data-table.md +9 -9
- package/docs/components/date-picker.md +7 -7
- package/docs/components/dialog.md +5 -5
- package/docs/components/direction.md +2 -2
- package/docs/components/drawer.md +4 -4
- 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-otp.md +7 -7
- package/docs/components/input.md +6 -6
- package/docs/components/item.md +3 -3
- package/docs/components/kbd.md +2 -2
- package/docs/components/label.md +2 -2
- package/docs/components/markdown.md +13 -13
- package/docs/components/marker.md +2 -2
- package/docs/components/menubar.md +2 -2
- package/docs/components/message-scroller.md +7 -7
- package/docs/components/message.md +7 -7
- package/docs/components/native-select.md +3 -3
- package/docs/components/navigation-menu.md +3 -3
- package/docs/components/pagination.md +3 -3
- package/docs/components/popover.md +10 -10
- package/docs/components/progress.md +2 -2
- package/docs/components/pwa.md +4 -4
- package/docs/components/questionnaire.md +7 -7
- package/docs/components/radio-group.md +2 -2
- package/docs/components/resizable.md +7 -7
- package/docs/components/scroll-area.md +7 -7
- 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 +7 -7
- package/docs/components/sidebar.md +3 -3
- package/docs/components/skeleton.md +2 -2
- package/docs/components/slider.md +2 -2
- package/docs/components/spinner.md +4 -4
- package/docs/components/switch.md +2 -2
- package/docs/components/table.md +2 -2
- package/docs/components/tabs.md +6 -6
- package/docs/components/text-editor.md +6 -6
- package/docs/components/textarea.md +3 -3
- package/docs/components/theme-button.md +6 -6
- package/docs/components/toast.md +6 -6
- package/docs/components/toggle-group.md +7 -7
- package/docs/components/toggle.md +7 -7
- package/docs/components/tooltip.md +9 -9
- package/docs/components/typography.md +9 -9
- package/docs/i18n.md +119 -0
- package/docs/icons.md +9 -9
- package/docs/installation.md +31 -32
- package/docs/owl-components.md +36 -38
- package/docs/registry.md +14 -13
- package/docs/runtime-api.md +14 -12
- package/docs/theming.md +15 -15
- package/docs/usage-guide.md +54 -56
- package/package.json +51 -35
- package/dist/baseui.esm.js +0 -58
- package/dist/baseui.icons.esm.js +0 -1
- package/dist/baseui.min.js +0 -77
- /package/dist/{baseui.analytics.esm.js → nodexui.analytics.esm.js} +0 -0
- /package/dist/{baseui.analytics.min.js → nodexui.analytics.min.js} +0 -0
- /package/dist/themes/{baseui-dark.min.css → nodexui-dark.min.css} +0 -0
- /package/dist/themes/{baseui-light.min.css → nodexui-light.min.css} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Textarea
|
|
2
2
|
|
|
3
|
-
Native multiline text input with
|
|
3
|
+
Native multiline text input with Nodex UI and built-in styling.
|
|
4
4
|
|
|
5
5
|
## Base component
|
|
6
6
|
|
|
7
7
|
```js
|
|
8
|
-
import { Textarea } from "
|
|
8
|
+
import { Textarea } from "nodexui";
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
```base-ui
|
|
@@ -64,7 +64,7 @@ Set `useTip="1"` to move `supportingText` into a tooltip: a question-mark icon a
|
|
|
64
64
|
| `Textarea` | slots `start` / `end` / `footer` | slot | content drawn inside the box; `footer` sits along the bottom edge |
|
|
65
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`. |
|
|
66
66
|
|
|
67
|
-
See [
|
|
67
|
+
See [Nodex UI Component](/examples/blocks.html#/docs/guide/owl-components) for how to load `nodexui` and `dist/nodexui.templates.xml`.
|
|
68
68
|
|
|
69
69
|
## Static component
|
|
70
70
|
|
|
@@ -4,12 +4,12 @@ Use `b-ui="theme-button"` for an icon-only light/dark theme toggle.
|
|
|
4
4
|
|
|
5
5
|
## CDN install requirements
|
|
6
6
|
|
|
7
|
-
Load
|
|
7
|
+
Load Nodex UI CSS and Nodex UI JavaScript bundle (`nodexui.min.js`). The component uses the built-in Lucide icon renderer and the `nodexui` helper bundled with Nodex UI.
|
|
8
8
|
|
|
9
9
|
## Base component
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
|
-
import { ThemeButton } from "
|
|
12
|
+
import { ThemeButton } from "nodexui";
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
```base-ui
|
|
@@ -24,7 +24,7 @@ import { ThemeButton } from "@thebase/ui";
|
|
|
24
24
|
| `ThemeButton` | `className` | `String` | optional |
|
|
25
25
|
| `ThemeButton` | `onChange` | `Function` | optional |
|
|
26
26
|
|
|
27
|
-
See [
|
|
27
|
+
See [Nodex UI Component](/examples/blocks.html#/docs/guide/owl-components) for how to load `nodexui` and `dist/nodexui.templates.xml`.
|
|
28
28
|
|
|
29
29
|
## Static component
|
|
30
30
|
|
|
@@ -42,11 +42,11 @@ Use `b-att-variant="default|outline|ghost|destructive|secondary|link"` and `b-at
|
|
|
42
42
|
|
|
43
43
|
## Methods
|
|
44
44
|
|
|
45
|
-
Use the global runtime methods: `thebase.mount()`, `thebase.mountAll()`, and `thebase.destroy()`. For direct theme control, import `createThemeController` from
|
|
45
|
+
Use the global runtime methods: `thebase.mount()`, `thebase.mountAll()`, and `thebase.destroy()`. For direct theme control, import `createThemeController` from `nodexui`.
|
|
46
46
|
|
|
47
47
|
## Events
|
|
48
48
|
|
|
49
|
-
Theme changes dispatch `
|
|
49
|
+
Theme changes dispatch `nodexui:theme-change` on `document` with `{ theme }` in `event.detail`.
|
|
50
50
|
|
|
51
51
|
## CSS variables
|
|
52
52
|
|
|
@@ -62,7 +62,7 @@ See the example page headers for working `b-ui="theme-button"` navigation usage.
|
|
|
62
62
|
|
|
63
63
|
## Browser support
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Nodex UI targets modern evergreen browsers that support ES modules, CSS variables.
|
|
66
66
|
|
|
67
67
|
## Test checklist
|
|
68
68
|
|
package/docs/components/toast.md
CHANGED
|
@@ -5,7 +5,7 @@ Use `b-ui="toast"` for transient status messages.
|
|
|
5
5
|
## Base component
|
|
6
6
|
|
|
7
7
|
```js
|
|
8
|
-
import { Toast } from "
|
|
8
|
+
import { Toast } from "nodexui";
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
```base-ui
|
|
@@ -35,7 +35,7 @@ The toast stays hidden until `open`/`state` becomes truthy (never shows on mount
|
|
|
35
35
|
| `Toast` | `onOpenChange` | `Function` | optional |
|
|
36
36
|
| `Toast` | `action` slot | — | optional — e.g. a `<Button/>`, rendered grouped next to the close button (`<t t-set-slot="action">...</t>`) |
|
|
37
37
|
|
|
38
|
-
See [
|
|
38
|
+
See [Nodex UI Component](/examples/blocks.html#/docs/guide/owl-components) for how to load `nodexui` and `dist/nodexui.templates.xml`.
|
|
39
39
|
|
|
40
40
|
## Static component
|
|
41
41
|
|
|
@@ -54,7 +54,7 @@ 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 b-button btn-outline-secondary" onclick="document.getElementById('demo-toast').
|
|
57
|
+
<button type="button" class="btn b-button btn-outline-secondary" onclick="document.getElementById('demo-toast').NodexUIToast.show()">Show Toast</button>
|
|
58
58
|
<div id="demo-toast" b-ui="toast" b-att-delay="3000">
|
|
59
59
|
<div class="b-toast-content">
|
|
60
60
|
<div class="fw-medium">Event created</div>
|
|
@@ -68,13 +68,13 @@ The toast stays hidden until shown — omit `b-att-state="open"` and call `.show
|
|
|
68
68
|
</div>
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
Programmatic API: after mount, call `element.
|
|
71
|
+
Programmatic API: after mount, call `element.NodexUIToast.show()` or `element.NodexUIToast.hide()`. Events: `nodexui:open`, `nodexui:close`.
|
|
72
72
|
|
|
73
|
-
Toasts are backed by `bootstrap.Toast`: the root receives
|
|
73
|
+
Toasts are backed by `bootstrap.Toast`: the root receives the built-in `toast fade` classes, and visibility is driven by the built-in `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 the built-in delegated dismiss handler drives them.
|
|
74
74
|
|
|
75
75
|
### Screen-corner placement
|
|
76
76
|
|
|
77
|
-
Set `b-att-position` to `top-left`, `top-right`, `bottom-left`, or `bottom-right` to fix the toast to that corner of the viewport. The toast element itself gets the
|
|
77
|
+
Set `b-att-position` to `top-left`, `top-right`, `bottom-left`, or `bottom-right` to fix the toast to that corner of the viewport. The toast element itself gets the built-in `toast-container position-fixed p-3 pe-auto` classes plus the matching edge utility classes (`top-0`/`bottom-0` + `start-0`/`end-0`) merged in — no wrapper element. Omit the attribute to leave the toast inline in the document flow (the previous, default behavior):
|
|
78
78
|
|
|
79
79
|
```base-ui
|
|
80
80
|
<div id="corner-toast" b-ui="toast" b-att-position="bottom-right" b-att-delay="3000">
|
|
@@ -4,12 +4,12 @@ Use `b-ui="toggle-group"` for a CDN-ready toggle group component.
|
|
|
4
4
|
|
|
5
5
|
## CDN install requirements
|
|
6
6
|
|
|
7
|
-
Load the pinned
|
|
7
|
+
Load the pinned Nodex UI CSS and JavaScript files; no extra dependency is required for this component.
|
|
8
8
|
|
|
9
9
|
## Base component
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
|
-
import { ToggleGroup, ToggleGroupItem } from "
|
|
12
|
+
import { ToggleGroup, ToggleGroupItem } from "nodexui";
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
```base-ui
|
|
@@ -36,7 +36,7 @@ import { ToggleGroup, ToggleGroupItem } from "@thebase/ui";
|
|
|
36
36
|
| `ToggleGroupItem` | `value` | `String` | required |
|
|
37
37
|
| `ToggleGroupItem` | `className` | `String` | optional |
|
|
38
38
|
|
|
39
|
-
See [
|
|
39
|
+
See [Nodex UI Component](/examples/blocks.html#/docs/guide/owl-components) for how to load `nodexui` and `dist/nodexui.templates.xml`.
|
|
40
40
|
|
|
41
41
|
## Static component
|
|
42
42
|
|
|
@@ -50,7 +50,7 @@ Call `thebase.mount(element)` or rely on `thebase.mountAll()` after the script l
|
|
|
50
50
|
|
|
51
51
|
## Options and attributes
|
|
52
52
|
|
|
53
|
-
See `dist/
|
|
53
|
+
See `dist/nodexui.registry.json` for the supported attribute list.
|
|
54
54
|
|
|
55
55
|
## Methods
|
|
56
56
|
|
|
@@ -58,11 +58,11 @@ Use the global runtime methods: `thebase.mount()`, `thebase.mountAll()`, and `th
|
|
|
58
58
|
|
|
59
59
|
## Events
|
|
60
60
|
|
|
61
|
-
Interactive components emit documented `
|
|
61
|
+
Interactive components emit documented `nodexui:*` events from their root element. Static components do not emit events.
|
|
62
62
|
|
|
63
63
|
## CSS variables
|
|
64
64
|
|
|
65
|
-
The component inherits
|
|
65
|
+
The component inherits Nodex UI semantic tokens such as `--b-surface`, `--b-border`, `--b-primary`, and `--b-radius`.
|
|
66
66
|
|
|
67
67
|
## Accessibility behavior
|
|
68
68
|
|
|
@@ -74,7 +74,7 @@ See `examples/index.html` for a working CDN-style page.
|
|
|
74
74
|
|
|
75
75
|
## Browser support
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
Nodex UI targets modern evergreen browsers that support ES modules, CSS variables.
|
|
78
78
|
|
|
79
79
|
## Test checklist
|
|
80
80
|
|
|
@@ -4,12 +4,12 @@ Use `b-ui="toggle"` for a CDN-ready toggle component.
|
|
|
4
4
|
|
|
5
5
|
## CDN install requirements
|
|
6
6
|
|
|
7
|
-
Load the pinned
|
|
7
|
+
Load the pinned Nodex UI CSS and JavaScript files; no extra dependency is required for this component.
|
|
8
8
|
|
|
9
9
|
## Base component
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
|
-
import { Toggle } from "
|
|
12
|
+
import { Toggle } from "nodexui";
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
```base-ui
|
|
@@ -37,7 +37,7 @@ import { Toggle } from "@thebase/ui";
|
|
|
37
37
|
| `Toggle` | `className` | `String` | optional |
|
|
38
38
|
| `Toggle` | `onChange` | `Function` | optional |
|
|
39
39
|
|
|
40
|
-
See [
|
|
40
|
+
See [Nodex UI Component](/examples/blocks.html#/docs/guide/owl-components) for how to load `nodexui` and `dist/nodexui.templates.xml`.
|
|
41
41
|
|
|
42
42
|
## Static component
|
|
43
43
|
|
|
@@ -51,7 +51,7 @@ Call `thebase.mount(element)` or rely on `thebase.mountAll()` after the script l
|
|
|
51
51
|
|
|
52
52
|
## Options and attributes
|
|
53
53
|
|
|
54
|
-
See `dist/
|
|
54
|
+
See `dist/nodexui.registry.json` for the supported attribute list.
|
|
55
55
|
|
|
56
56
|
## Methods
|
|
57
57
|
|
|
@@ -59,11 +59,11 @@ Use the global runtime methods: `thebase.mount()`, `thebase.mountAll()`, and `th
|
|
|
59
59
|
|
|
60
60
|
## Events
|
|
61
61
|
|
|
62
|
-
Interactive components emit documented `
|
|
62
|
+
Interactive components emit documented `nodexui:*` events from their root element. Static components do not emit events.
|
|
63
63
|
|
|
64
64
|
## CSS variables
|
|
65
65
|
|
|
66
|
-
The component inherits
|
|
66
|
+
The component inherits Nodex UI semantic tokens such as `--b-surface`, `--b-border`, `--b-primary`, and `--b-radius`.
|
|
67
67
|
|
|
68
68
|
## Accessibility behavior
|
|
69
69
|
|
|
@@ -75,7 +75,7 @@ See `examples/index.html` for a working CDN-style page.
|
|
|
75
75
|
|
|
76
76
|
## Browser support
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Nodex UI targets modern evergreen browsers that support ES modules, CSS variables.
|
|
79
79
|
|
|
80
80
|
## Test checklist
|
|
81
81
|
|
|
@@ -5,7 +5,7 @@ Use `b-ui="tooltip"` with either `b-att-content` or a tooltip content child.
|
|
|
5
5
|
## Base component
|
|
6
6
|
|
|
7
7
|
```js
|
|
8
|
-
import { Tooltip } from "
|
|
8
|
+
import { Tooltip } from "nodexui";
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
```base-ui
|
|
@@ -24,11 +24,11 @@ import { Tooltip } from "@thebase/ui";
|
|
|
24
24
|
| `Tooltip` | `state` | `String` | optional; `"open"`/`"on"`/`"active"` shows the tooltip once on mount (uncontrolled testing hook) |
|
|
25
25
|
| `Tooltip` | `className` | `String` | optional |
|
|
26
26
|
|
|
27
|
-
See [
|
|
27
|
+
See [Nodex UI Component](/examples/blocks.html#/docs/guide/owl-components) for how to load `nodexui` and `dist/nodexui.templates.xml`.
|
|
28
28
|
|
|
29
|
-
Both the pure Base and static forms are driven by a live `bootstrap.Tooltip` instance owned on the trigger element, with `trigger: "hover focus"` — **the visible popup is
|
|
29
|
+
Both the pure Base and static forms are driven by a live `bootstrap.Tooltip` instance owned on the trigger element, with `trigger: "hover focus"` — **the visible popup is the built-in generated DOM (a `.tooltip`/`.tooltip-arrow`/`.tooltip-inner` node, positioned via Popper), appended to `document.body`, not rendered inline where you authored the tooltip.** Don't query for it as a descendant of the trigger; query `document.body.querySelector(".tooltip .tooltip-inner")` instead. base sets `aria-describedby` on the trigger itself, but only while the tooltip is actually shown (removed again on hide) — Nodex UI does not additionally set a static `aria-describedby` up front.
|
|
30
30
|
|
|
31
|
-
The default slot's rendered markup is captured into an HTML string for
|
|
31
|
+
The default slot's rendered markup is captured into an HTML string for the built-in `title`/`html: true` options (the library can't consume live vnodes): the Base component renders the slot into a hidden buffer element internal to its own template, reads its `innerHTML` on mount, and re-syncs the live popup via `.setContent({'.tooltip-inner': html})` whenever that HTML changes on a later render.
|
|
32
32
|
|
|
33
33
|
## Static component
|
|
34
34
|
|
|
@@ -38,7 +38,7 @@ The default slot's rendered markup is captured into an HTML string for Bootstrap
|
|
|
38
38
|
</span>
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
Tooltips show on hover and focus, then hide on mouse leave and blur —
|
|
41
|
+
Tooltips show on hover and focus, then hide on mouse leave and blur — the built-in `trigger: "hover focus"` wires this, not manual event listeners. The static adapter reads `[b-tooltip-content]` (or the element built from `b-att-content`) once at mount time as the tooltip's HTML content, then removes that node from the DOM — the library owns showing/hiding the content from then on, so no `[b-tooltip-content]` element survives in the authored markup post-mount.
|
|
42
42
|
|
|
43
43
|
## Enhanced usage
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ Call `thebase.mount(element)` or rely on `thebase.mountAll()` after the script l
|
|
|
46
46
|
|
|
47
47
|
## Options and attributes
|
|
48
48
|
|
|
49
|
-
See `dist/
|
|
49
|
+
See `dist/nodexui.registry.json` for the supported attribute list.
|
|
50
50
|
|
|
51
51
|
## Methods
|
|
52
52
|
|
|
@@ -54,11 +54,11 @@ Use the global runtime methods: `thebase.mount()`, `thebase.mountAll()`, and `th
|
|
|
54
54
|
|
|
55
55
|
## Events
|
|
56
56
|
|
|
57
|
-
Interactive components emit documented `
|
|
57
|
+
Interactive components emit documented `nodexui:*` events from their root element. Listen for the built-in `shown.bs.tooltip`/`hidden.bs.tooltip` on the trigger element to react to show/hide; Nodex UI mirrors those into `b-att-state` (`open`/`closed`) on the static root and `this.state.open` on the Base component.
|
|
58
58
|
|
|
59
59
|
## CSS variables
|
|
60
60
|
|
|
61
|
-
The component inherits
|
|
61
|
+
The component inherits Nodex UI semantic tokens such as `--b-surface`, `--b-border`, `--b-primary`, and `--b-radius`. The popup itself is styled by the built-in bundled `.tooltip`/`.tooltip-arrow`/`.tooltip-inner` CSS (loaded via `dist/nodexui.min.css`), not Nodex UI's own classes.
|
|
62
62
|
|
|
63
63
|
## Accessibility behavior
|
|
64
64
|
|
|
@@ -70,7 +70,7 @@ See `examples/index.html` for a working CDN-style page.
|
|
|
70
70
|
|
|
71
71
|
## Browser support
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
Nodex UI targets modern evergreen browsers that support ES modules, CSS variables.
|
|
74
74
|
|
|
75
75
|
## Test checklist
|
|
76
76
|
|
|
@@ -5,7 +5,7 @@ Small text helpers for plain content.
|
|
|
5
5
|
## Base component
|
|
6
6
|
|
|
7
7
|
```js
|
|
8
|
-
import { Typography } from "
|
|
8
|
+
import { Typography } from "nodexui";
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
```base-ui
|
|
@@ -86,23 +86,23 @@ import { Typography } from "@thebase/ui";
|
|
|
86
86
|
| `Typography` | `tag` | `String` | optional; defaults to `h1`-`h4`, `blockquote`, `small`, `ul` for those variants, else `p` |
|
|
87
87
|
| `Typography` | `className` | `String` | optional |
|
|
88
88
|
|
|
89
|
-
See [
|
|
89
|
+
See [Nodex UI Component](/examples/blocks.html#/docs/guide/owl-components) for how to load `nodexui` and `dist/nodexui.templates.xml`.
|
|
90
90
|
|
|
91
|
-
##
|
|
91
|
+
## built-in typography classes
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
(`src/styles/base-extensions.css`), in Be Vietnam Pro. Use plain
|
|
93
|
+
Nodex UI redefines the built-in typography classes to the shadcn typeset values
|
|
94
|
+
(`src/styles/base-extensions.css`), in Be Vietnam Pro. Use plain built-in markup:
|
|
95
95
|
|
|
96
96
|
| Element / class | Result |
|
|
97
97
|
| --- | --- |
|
|
98
98
|
| `h1` / `.h1` ... `h4` / `.h4` | 1.75rem, 1.25rem, 1.125rem, 1rem; weight 600; line-height 1.3 to 1.5 |
|
|
99
99
|
| `h5` / `.h5`, `h6` / `.h6` | 0.875rem / 0.8125rem, weight 500, muted; `h6` is uppercase with 0.08em tracking |
|
|
100
|
-
| `.display-1` ... `.display-6` |
|
|
100
|
+
| `.display-1` ... `.display-6` | built-in sizes, weight 600, line-height 1.2 |
|
|
101
101
|
| `.lead`, `.small`, `mark`, `del`, `abbr[title]` | muted lead text, `--b-text-sm`, shadcn highlight, muted strike-through, dotted underline |
|
|
102
102
|
| `blockquote` / `.blockquote` | 2px start border, 1em inline padding, inherited size |
|
|
103
103
|
| `hr`, `dt`, `dd`, `code`, `pre`, `kbd`, `caption` | shadcn rule, weights, muted-background code, keycap border |
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
the built-in bottom-margin rhythm is unchanged. For the shadcn flow model (margin-top only,
|
|
106
106
|
1.25em between blocks, 1.75 line-height, styled lists, links and tables) wrap prose in
|
|
107
107
|
`class="b-typeset"`; tune with `--b-typeset-flow` and `--b-typeset-leading`.
|
|
108
108
|
|
|
@@ -110,9 +110,9 @@ Bootstrap's bottom-margin rhythm is unchanged. For the shadcn flow model (margin
|
|
|
110
110
|
|
|
111
111
|
```base-ui
|
|
112
112
|
<p b-ui="typography" b-att-variant="lead">Readable intro text.</p>
|
|
113
|
-
<span b-ui="typography" b-att-variant="code">
|
|
113
|
+
<span b-ui="typography" b-att-variant="code">nodexui</span>
|
|
114
114
|
```
|
|
115
115
|
|
|
116
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).
|
|
117
117
|
|
|
118
|
-
Accessibility: choose semantic HTML elements first, then add
|
|
118
|
+
Accessibility: choose semantic HTML elements first, then add Nodex UI typography attributes for styling.
|
package/docs/i18n.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# i18n service
|
|
2
|
+
|
|
3
|
+
Instructions for adding translations to a page or app with Nodex UI i18n service (`nodexui/i18n`). It is optional and standalone: no framework or component runtime, and it is not part of the main bundles.
|
|
4
|
+
|
|
5
|
+
- **Audience:** developers adding a language switcher or translating an existing page.
|
|
6
|
+
- **Runnable example:** `examples/i18n/` (open `/examples/i18n/` from `npm run dev`).
|
|
7
|
+
- **Real-world use:** `emvhub/i18n.js` and the `i18n/*.po` folders beside each emvhub module; the examples app does the same in `examples/i18n.js` and `examples/components/*/i18n/` (English and Vietnamese). Update catalogs with `node scripts/emvhub-i18n.mjs extract [--site=emvhub|examples/components] [newLang]`.
|
|
8
|
+
|
|
9
|
+
## 1. How it works
|
|
10
|
+
|
|
11
|
+
You write every text in the default language and wrap it in `t()`. Each module keeps its translations in an `i18n/<code>.po` folder next to it and loads them with `loadCatalog(import.meta.url)`. The service picks one language per page load and fills a shared lookup; `t()` returns the translation, or the original text when none exists.
|
|
12
|
+
|
|
13
|
+
```mermaid
|
|
14
|
+
flowchart LR
|
|
15
|
+
A["init(config)"] --> B["loadCatalog(import.meta.url)"]
|
|
16
|
+
B --> C{"Pick language"}
|
|
17
|
+
C -->|"?lang= → saved choice → browser → default"| D["Fetch ./i18n/code.po"]
|
|
18
|
+
D --> E["Finished entries join the lookup"]
|
|
19
|
+
E --> F["t(text) returns translation"]
|
|
20
|
+
G["setLanguage(code)"] -->|"saves choice, reloads"| B
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 2. Install
|
|
24
|
+
|
|
25
|
+
| How you load it | Use |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| ES module | `import { init, t, loadCatalog } from "nodexui/i18n"` (file: `dist/nodexui.i18n.esm.js`) |
|
|
28
|
+
| Import map | map `nodexui/i18n` to the ESM file, then `import … from "nodexui/i18n"` |
|
|
29
|
+
| Script tag | `dist/nodexui.i18n.min.js` sets `window.thebase.i18n` |
|
|
30
|
+
|
|
31
|
+
## 3. Quick start
|
|
32
|
+
|
|
33
|
+
1. Map the module in your HTML:
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<script type="importmap">
|
|
37
|
+
{ "imports": { "nodexui/i18n": "https://cdn.jsdelivr.net/npm/nodexui@<version>/dist/nodexui.i18n.esm.js" } }
|
|
38
|
+
</script>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. Configure once, then load the catalog next to your module:
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
import { init, t, loadCatalog, languages, currentLanguage, setLanguage, translateHead } from "nodexui/i18n";
|
|
45
|
+
|
|
46
|
+
init({ languages: [{ code: "en", label: "English" }, { code: "vi", label: "Tiếng Việt" }], storageKey: "my-lang" });
|
|
47
|
+
await loadCatalog(import.meta.url); // fetches ./i18n/vi.po when Vietnamese is picked
|
|
48
|
+
translateHead();
|
|
49
|
+
document.querySelector("h1").textContent = t("Hello {name}", { name: "An" });
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
3. Add `i18n/vi.po` beside the module:
|
|
53
|
+
|
|
54
|
+
```po
|
|
55
|
+
msgid ""
|
|
56
|
+
msgstr "Language: vi\n"
|
|
57
|
+
|
|
58
|
+
msgid "Hello {name}"
|
|
59
|
+
msgstr "Xin chào {name}"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 4. API reference
|
|
63
|
+
|
|
64
|
+
| Function | Purpose |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `init(options)` | Sets languages and defaults. Call once, before the first `loadCatalog()`; it throws afterwards. |
|
|
67
|
+
| `loadCatalog(moduleUrl)` | Picks the language on the first call, then fetches `<catalogDir>/<code>.po` next to `moduleUrl` once. Returns a promise; await it before using `t()`. No request is made for the default language. |
|
|
68
|
+
| `t(text, params?)` | Returns the translation or the original text; replaces `{name}` placeholders from `params`. |
|
|
69
|
+
| `languages()` | The configured `{ code, label }` list, for a switcher. |
|
|
70
|
+
| `currentLanguage()` | The code in use, to mark the active switcher item. |
|
|
71
|
+
| `setLanguage(code)` | Saves the choice and reloads the page with `?lang=<code>`. |
|
|
72
|
+
| `translateHead()` | Translates `document.title` and the meta description. |
|
|
73
|
+
| `parsePo(text)` | Parses `.po` text into a `Map` of original text → `{ id, str, fuzzy }` (useful in tooling and tests). |
|
|
74
|
+
|
|
75
|
+
### `init()` options
|
|
76
|
+
|
|
77
|
+
| Option | Default | Meaning |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| `languages` | `[{ code: "en", label: "English" }]` | Languages the page can show; `code` is the `.po` file name, `label` is shown in the language's own words. |
|
|
80
|
+
| `defaultLanguage` | first language | The language your texts are written in; no catalog is loaded for it. |
|
|
81
|
+
| `storageKey` | `"thebase-lang"` | `localStorage` key that remembers the visitor's choice. |
|
|
82
|
+
| `queryParam` | `"lang"` | URL parameter that forces a language. |
|
|
83
|
+
| `catalogDir` | `"i18n"` | Folder beside each module that holds the `.po` files. |
|
|
84
|
+
| `headDescription` | `meta[name="description"]` | Selector of the tag `translateHead()` translates. |
|
|
85
|
+
|
|
86
|
+
Language order: URL parameter, saved choice, browser languages (first two letters), default.
|
|
87
|
+
|
|
88
|
+
## 5. Writing `.po` files
|
|
89
|
+
|
|
90
|
+
- One block per text: `msgid` (original, exact match) and `msgstr` (translation). Long texts may continue on following quoted lines.
|
|
91
|
+
- Entries with an empty `msgstr` or a `#, fuzzy` flag are ignored, so unfinished work never reaches visitors.
|
|
92
|
+
- Text matching is exact and case-sensitive. Changing a source string in code means updating its `msgid`.
|
|
93
|
+
- Keep placeholders identical in both: `{name}` in the `msgid` must appear as `{name}` in the `msgstr`.
|
|
94
|
+
- Never build a sentence from joined fragments; use one text with placeholders.
|
|
95
|
+
|
|
96
|
+
## 6. Multi-module apps
|
|
97
|
+
|
|
98
|
+
Each module loads its own catalog, but language selection and `init()` must happen once and first. Create one local file that every module imports:
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
// i18n.js
|
|
102
|
+
import { init } from "nodexui/i18n";
|
|
103
|
+
|
|
104
|
+
init({ languages: [{ code: "en", label: "English" }, { code: "vi", label: "Tiếng Việt" }], storageKey: "my-lang" });
|
|
105
|
+
export * from "nodexui/i18n";
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Because ES modules evaluate dependencies first, `init()` runs before any module's top-level `await loadCatalog(import.meta.url)`. A module that shares another folder's texts loads both: `await Promise.all([loadCatalog(import.meta.url), loadCatalog(new URL("../lib/", import.meta.url))])`.
|
|
109
|
+
|
|
110
|
+
## 7. Gotchas
|
|
111
|
+
|
|
112
|
+
| Symptom | Cause and fix |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `init() must be called before the first loadCatalog()` | A module loaded a catalog first. Route all imports through the single local file above. |
|
|
115
|
+
| Texts stay in English | The `msgid` differs from the code string, the entry is fuzzy or empty, or the `.po` URL 404s (check `catalogDir` and `moduleUrl`). Failed fetches are silent by design. |
|
|
116
|
+
| Module-level texts untranslated | `t()` ran before `await loadCatalog(...)` finished. Await it at the top of the module. |
|
|
117
|
+
| Switching language reloads the page | By design: every text is redrawn in the new language. |
|
|
118
|
+
| Choice not remembered | Storage is blocked; the `?lang=` link still works for that visit. |
|
|
119
|
+
| Offline/PWA | Precache each `i18n/<code>.po` in your service worker (see `emvhub/nodexui.pwa.config.js`). |
|
package/docs/icons.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Built-in Icons
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Nodex UI ships the full Lucide icon set as a built-in CDN-ready icon library. Icons use the `b-icon` attribute, render as CSS masks, and inherit `currentColor` from the surrounding button, link, menu item, block, or theme.
|
|
4
4
|
|
|
5
5
|
```html
|
|
6
6
|
<button b-ui="button" type="button">
|
|
@@ -15,20 +15,20 @@ The Base UI ships the full Lucide icon set as a built-in CDN-ready icon library.
|
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
18
|
-
Load the normal
|
|
18
|
+
Load the normal Nodex UI assets. No separate icon script is required.
|
|
19
19
|
|
|
20
20
|
```html
|
|
21
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm
|
|
22
|
-
<script src="https://cdn.jsdelivr.net/npm
|
|
21
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nodexui@latest/dist/nodexui.min.css">
|
|
22
|
+
<script src="https://cdn.jsdelivr.net/npm/nodexui@latest/dist/nodexui.min.js" defer></script>
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
`https://unpkg.com
|
|
25
|
+
`https://unpkg.com/nodexui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@1.3.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
|
|
|
29
29
|
## Markup
|
|
30
30
|
|
|
31
|
-
Use the Lucide icon name in kebab-case, camelCase, snake_case, or space-separated form.
|
|
31
|
+
Use the Lucide icon name in kebab-case, camelCase, snake_case, or space-separated form. Nodex UI normalizes the name to the matching Lucide SVG file.
|
|
32
32
|
|
|
33
33
|
```html
|
|
34
34
|
<span b-icon="check"></span>
|
|
@@ -46,7 +46,7 @@ Use `b-icon-size` when the surrounding component should not control the icon siz
|
|
|
46
46
|
|
|
47
47
|
## Color
|
|
48
48
|
|
|
49
|
-
Icons inherit `currentColor`, so set color on the parent element or let
|
|
49
|
+
Icons inherit `currentColor`, so set color on the parent element or let Nodex UI component variants and themes do it.
|
|
50
50
|
|
|
51
51
|
```html
|
|
52
52
|
<button b-ui="button" b-att-variant="destructive" type="button">
|
|
@@ -62,7 +62,7 @@ Icons inherit `currentColor`, so set color on the parent element or let the Base
|
|
|
62
62
|
|
|
63
63
|
## Accessibility
|
|
64
64
|
|
|
65
|
-
Decorative icons should not have a label.
|
|
65
|
+
Decorative icons should not have a label. Nodex UI marks them with `aria-hidden="true"`.
|
|
66
66
|
|
|
67
67
|
```html
|
|
68
68
|
<span b-icon="mail"></span>
|
|
@@ -84,7 +84,7 @@ Standalone meaningful icons can use `aria-label`.
|
|
|
84
84
|
|
|
85
85
|
## Self-hosting
|
|
86
86
|
|
|
87
|
-
By default, icon URLs point to the pinned Lucide CDN configured in the registry. To serve icons from your own
|
|
87
|
+
By default, icon URLs point to the pinned Lucide CDN configured in the registry. To serve icons from your own Nodex UI build, point `b-icon-base-url` at the published icon folder.
|
|
88
88
|
|
|
89
89
|
```html
|
|
90
90
|
<span b-icon="search" b-icon-base-url="/dist/icons/lucide"></span>
|