@livestorm/ui-vue 2.0.3 → 2.0.5
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/README.md +30 -2
- package/dist/{UiTimelineItem.vue_vue_type_style_index_0_lang-UNNkatTS.mjs → UiTimelineItem.vue_vue_type_style_index_0_lang-DJFdCn2R.mjs} +1522 -1518
- package/dist/a11y-BhF_nl7L.mjs +159 -0
- package/dist/components.mjs +2 -2
- package/dist/i18n-Cktw9hIu.mjs +49 -0
- package/dist/index.mjs +2 -2
- package/dist/integrations.mjs +10 -4
- package/dist/layouts.mjs +1 -1
- package/dist/types/src/components/Toast/ToastMessage.vue.d.ts +4 -4
- package/dist/types/src/components/UiBanner/UiBanner.vue.d.ts +2 -2
- package/dist/types/src/components/UiButton/UiButton.vue.d.ts +1 -1
- package/dist/types/src/components/UiButtonGroup/UiButtonGroup.vue.d.ts +1 -1
- package/dist/types/src/components/UiColorField/UiColorField.vue.d.ts +2 -2
- package/dist/types/src/components/UiColorPicker/UiColorPicker.vue.d.ts +2 -2
- package/dist/types/src/components/UiDropdown/UiDropdownTrigger.vue.d.ts +1 -1
- package/dist/types/src/components/UiFieldWrapper/UiFieldWrapper.vue.d.ts +1 -1
- package/dist/types/src/components/UiForm/UiFormField.vue.d.ts +1 -1
- package/dist/types/src/components/UiInputCheckbox/UiInputCheckbox.vue.d.ts +5 -5
- package/dist/types/src/components/UiInputSelect/UiInputSelect.vue.d.ts +3 -3
- package/dist/types/src/components/UiInputTextarea/UiInputTextarea.vue.d.ts +3 -3
- package/dist/types/src/components/UiTextField/UiTextField.vue.d.ts +5 -5
- package/dist/types/src/composables/useButtonStyles.d.ts +1 -1
- package/dist/types/src/integrations/index.d.ts +1 -0
- package/dist/types/src/utils/i18n.d.ts +51 -0
- package/dist/ui-vue.css +1 -1
- package/dist/{useThemeAndModes-CUK56j0z.mjs → useThemeAndModes-BzYwSOEv.mjs} +1 -1
- package/dist/utils.mjs +152 -97
- package/integrations.d.ts +1 -0
- package/package.json +26 -19
- package/src/components/UiBanner/UiBanner.vue +4 -2
- package/src/components/UiButtonGroup/UiButtonGroup.vue +2 -0
- package/src/components/UiButtonGroup/UiButtonGroupItem.vue +2 -0
- package/src/components/UiDialog/UiDialogContent.vue +12 -4
- package/src/components/UiPage/UiPage.vue +7 -2
- package/src/components/UiSideMenu/UiSideMenu.vue +4 -3
- package/src/css/body.css +15 -7
- package/src/css/fonts.css +10 -0
- package/src/integrations/index.js +1 -0
- package/src/utils/clipboard.js +5 -2
- package/src/utils/i18n.ts +113 -0
- package/dist/a11y--y7uaY4j.mjs +0 -217
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@ A modern, strongly-typed Vue 3 component library for Livestorm’s design system
|
|
|
36
36
|
- the logo link of `UiPageHeader` when `showLogo` is enabled;
|
|
37
37
|
- the `@livestorm/ui-vue/utils` entry point: its `useRouteQueryModel` helper is built on the router, so importing this entry requires vue-router to be installed.
|
|
38
38
|
- **Tailwind CSS 4**, since components are styled with Tailwind utility classes.
|
|
39
|
+
- **The Inter font**, which components are designed for. The package never loads it for you: self-host it, or import the optional Google Fonts shortcut once (`import '@livestorm/ui-vue/fonts'`). Without Inter, components fall back to the system font stack.
|
|
39
40
|
|
|
40
41
|
Installing the package also pulls in `@livestorm/ui-tokens` (design tokens) and `@livestorm/ui-icons` (icon utilities).
|
|
41
42
|
|
|
@@ -58,12 +59,17 @@ Components use Tailwind utility classes (including the `i-ls-*` icon classes), s
|
|
|
58
59
|
@source "../node_modules/@livestorm/ui-vue/dist";
|
|
59
60
|
```
|
|
60
61
|
|
|
62
|
+
> [!WARNING]
|
|
63
|
+
> Components rely on the design-token utilities these two imports produce (`bg-actions-primary-idle`, `i-ls-*`, ...). Those class names live in the component code, not in the shipped stylesheet, so if your own theme resets the token namespace (for example `--color-*: initial` in an `@theme`), Tailwind silently stops generating them and components render unstyled — no error, no warning. Keep the Livestorm token imports alongside your palette instead of resetting all colors.
|
|
64
|
+
|
|
61
65
|
Then import the library base styles once (body defaults, transitions, animations):
|
|
62
66
|
|
|
63
67
|
```ts
|
|
64
68
|
import '@livestorm/ui-vue/style'
|
|
65
69
|
```
|
|
66
70
|
|
|
71
|
+
The body defaults ship inside `@layer base`, so anything your app declares — layered or not — takes precedence over them.
|
|
72
|
+
|
|
67
73
|
## App setup
|
|
68
74
|
|
|
69
75
|
No runtime plugin is required. Create your app, import components, done:
|
|
@@ -100,7 +106,28 @@ app.use(Responsive, {
|
|
|
100
106
|
|
|
101
107
|
</details>
|
|
102
108
|
|
|
103
|
-
|
|
109
|
+
<details>
|
|
110
|
+
<summary>Optional: plugging your own translations</summary>
|
|
111
|
+
|
|
112
|
+
Components render a few built-in labels themselves (the dialog and banner close buttons, the "Copied!" tooltip, the side menu's "More"). Out of the box they come in English or French, picked from `<html lang>`. An app running [i18next](https://www.i18next.com/) with Livestorm's keys keeps control automatically; any other i18n stack can take over with a translator function:
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
import { setTranslator } from '@livestorm/ui-vue/integrations'
|
|
116
|
+
|
|
117
|
+
setTranslator((key) => myI18n.t(`ui-vue.${key}`))
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
On an SSR server, provide the translator on the app instance instead — `setTranslator` is process-wide state shared by concurrent requests, and without a translator the server falls back to English (it cannot read `<html lang>`). For a non-English SSR app this is the difference between hydrating correct labels and keeping English aria-labels:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
import { UI_VUE_TRANSLATOR } from '@livestorm/ui-vue/integrations'
|
|
124
|
+
|
|
125
|
+
app.provide(UI_VUE_TRANSLATOR, (key) => myI18n.t(`ui-vue.${key}`))
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Return the key itself (or `null`) to fall back to the built-in labels. The keys used: `general_close`, `general_dialog_title`, `general_misc_copied-text`, `room_bottom-bar_controls-label_more`.
|
|
129
|
+
|
|
130
|
+
</details>
|
|
104
131
|
|
|
105
132
|
Every component is a named export:
|
|
106
133
|
|
|
@@ -130,8 +157,9 @@ registerComponents(app, 'Ls') // <LsButton>, <LsTextField>, ...
|
|
|
130
157
|
| --- | --- |
|
|
131
158
|
| `@livestorm/ui-vue` | All components and utilities |
|
|
132
159
|
| `@livestorm/ui-vue/style` | Base stylesheet (import once) |
|
|
160
|
+
| `@livestorm/ui-vue/fonts` | Optional: loads Inter from Google Fonts (skip it if you self-host) |
|
|
133
161
|
| `@livestorm/ui-vue/components-vite` | `registerComponents` for global registration |
|
|
134
|
-
| `@livestorm/ui-vue/integrations` | Toast helpers (`openToast`, ...) |
|
|
162
|
+
| `@livestorm/ui-vue/integrations` | Toast helpers (`openToast`, ... — call client-side only: toast state is per-process on a server) and translation wiring (`setTranslator`, `UI_VUE_TRANSLATOR`) |
|
|
135
163
|
| `@livestorm/ui-vue/layouts` | Layout components such as the toast container |
|
|
136
164
|
| `@livestorm/ui-vue/utils` | Helpers (`useCopyToClipboard`, `useRouteQueryModel`, ...) — the one entry that requires `vue-router` |
|
|
137
165
|
| `@livestorm/ui-vue/responsive` | Optional responsive plugin |
|