@livestorm/ui-vue 2.0.1 → 2.0.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/README.md +64 -94
- package/dist/{UiTimelineItem.vue_vue_type_style_index_0_lang-BN5208td.mjs → UiTimelineItem.vue_vue_type_style_index_0_lang-UNNkatTS.mjs} +405 -405
- package/dist/components.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/layouts.mjs +27 -26
- package/dist/responsive.mjs +33 -19
- package/dist/types/src/utils/responsive.d.ts +9 -1
- package/dist/{useThemeAndModes-DY5SDC0a.mjs → useThemeAndModes-CUK56j0z.mjs} +20 -21
- package/package.json +8 -4
- package/src/components/Toast/LayoutToasts.vue +4 -1
- package/src/components/UiPage/UiPage.vue +4 -1
- package/src/composables/useThemeAndModes.ts +8 -4
- package/src/utils/responsive.js +70 -16
package/README.md
CHANGED
|
@@ -11,37 +11,43 @@
|
|
|
11
11
|
A modern, strongly-typed Vue 3 component library for Livestorm’s design system.
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://main--65bcc25b1bd5ef5d8b1a8505.chromatic.com/"><strong>Browse the components →</strong></a>
|
|
16
|
+
</p>
|
|
14
17
|
|
|
15
18
|
## Table of Contents
|
|
16
19
|
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
20
|
+
- [Requirements](#requirements)
|
|
21
|
+
- [Installation](#installation)
|
|
22
|
+
- [Tailwind CSS setup](#tailwind-css-setup)
|
|
23
|
+
- [App setup](#app-setup)
|
|
24
|
+
- [Using components](#using-components)
|
|
25
|
+
- [Entry points](#entry-points)
|
|
23
26
|
- [Contributing](#contributing)
|
|
24
|
-
- [License](#license)
|
|
25
27
|
|
|
26
28
|
---
|
|
27
29
|
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
`ui-vue` provides a suite of reusable, accessible, and well-tested Vue 3 components, following Livestorm’s design system. It is built with Vue.js, TypeScript, Vitest, and Storybook.
|
|
30
|
+
## Requirements
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
- **Vue 3.5+**, a peer dependency provided by your app.
|
|
33
|
+
- **vue-router 5+**, an optional peer dependency. Everything works without it — install it only if you use one of these router-aware features:
|
|
34
|
+
- the `to` prop on `UiButton`, `UiListItem`, `UiActionBarItem` and `UiSideMenu` items, which renders a `<router-link>` (each also accepts a plain `href` link instead);
|
|
35
|
+
- the `confirmTo` action of toasts (`confirmHref` is the plain-link alternative);
|
|
36
|
+
- the logo link of `UiPageHeader` when `showLogo` is enabled;
|
|
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
|
+
- **Tailwind CSS 4**, since components are styled with Tailwind utility classes.
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
Installing the package also pulls in `@livestorm/ui-tokens` (design tokens) and `@livestorm/ui-icons` (icon utilities).
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
## Installation
|
|
37
43
|
|
|
38
44
|
```bash
|
|
39
45
|
pnpm add @livestorm/ui-vue
|
|
40
46
|
```
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
## Tailwind CSS setup
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
Components use Tailwind utility classes (including the `i-ls-*` icon classes), so your app needs to run Tailwind and scan the library. In your Tailwind entry CSS:
|
|
45
51
|
|
|
46
52
|
```css
|
|
47
53
|
@import "tailwindcss";
|
|
@@ -58,116 +64,80 @@ Then import the library base styles once (body defaults, transitions, animations
|
|
|
58
64
|
import '@livestorm/ui-vue/style'
|
|
59
65
|
```
|
|
60
66
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
### Local Import
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
import { UiButton } from '@livestorm/ui-vue'
|
|
67
|
-
|
|
68
|
-
export default {
|
|
69
|
-
components: { UiButton }
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Example
|
|
74
|
-
|
|
75
|
-
```vue
|
|
76
|
-
<template>
|
|
77
|
-
<UiButton variant="primary">Click me</UiButton>
|
|
78
|
-
</template>
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Importing Components
|
|
67
|
+
## App setup
|
|
82
68
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
```ts
|
|
86
|
-
import { UiInput, UiInputSelect } from '@livestorm/ui-vue'
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Or import a specific component directly:
|
|
90
|
-
|
|
91
|
-
```ts
|
|
92
|
-
import UiDialog from '@livestorm/ui-vue/src/components/UiDialog'
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
To register every component globally under its own name (`<UiButton>`, `<UiTag>`, …):
|
|
96
|
-
|
|
97
|
-
```ts
|
|
98
|
-
import { registerComponents } from '@livestorm/ui-vue/components-vite'
|
|
99
|
-
|
|
100
|
-
registerComponents(app) // registers UiButton, UiTag, ...
|
|
101
|
-
registerComponents(app, 'Ls') // optional custom prefix: LsButton, LsTag, ...
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### App setup
|
|
105
|
-
|
|
106
|
-
Beyond the Tailwind CSS setup above, one runtime plugin must be registered when you create the app. `@livestorm/ui-vue/responsive` installs the `$responsive` global that layout components (`UiPage`, the toast layout) read; without it those components won't render correctly.
|
|
69
|
+
No runtime plugin is required. Create your app, import components, done:
|
|
107
70
|
|
|
108
71
|
```ts
|
|
109
72
|
import { createApp } from 'vue'
|
|
110
|
-
import Responsive from '@livestorm/ui-vue/responsive'
|
|
111
73
|
import { registerComponents } from '@livestorm/ui-vue/components-vite'
|
|
112
74
|
import '@livestorm/ui-vue/style'
|
|
113
75
|
import App from './App.vue'
|
|
114
76
|
|
|
115
77
|
const app = createApp(App)
|
|
116
78
|
|
|
117
|
-
app.use(Responsive) // provides $responsive (required by UiPage, toasts)
|
|
118
79
|
registerComponents(app) // optional: register all Ui* components globally
|
|
119
80
|
|
|
120
81
|
app.mount('#app')
|
|
121
82
|
```
|
|
122
83
|
|
|
123
|
-
|
|
84
|
+
Server-side rendering works out of the box: pages render with a desktop layout on the server, then adapt to the real screen size as soon as they load in the browser. No configuration and no hydration warnings. Overlay components (dialogs, dropdowns, menus, popovers, tooltips) render through client-only teleports and hydrate with no extra setup.
|
|
124
85
|
|
|
125
|
-
|
|
86
|
+
<details>
|
|
87
|
+
<summary>Optional: customizing the responsive breakpoints</summary>
|
|
126
88
|
|
|
127
|
-
|
|
89
|
+
Layout components read the viewport from a shared helper with sensible defaults. Install the responsive plugin only if you want to override the breakpoint flags, or read `$responsive` in your own templates:
|
|
128
90
|
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
pnpm dev:storybook
|
|
91
|
+
```ts
|
|
92
|
+
import Responsive from '@livestorm/ui-vue/responsive'
|
|
132
93
|
|
|
94
|
+
app.use(Responsive, {
|
|
95
|
+
computed: {
|
|
96
|
+
mobile: state => state.width < 900, // override the built-in flag
|
|
97
|
+
},
|
|
98
|
+
})
|
|
133
99
|
```
|
|
134
100
|
|
|
135
|
-
|
|
101
|
+
</details>
|
|
136
102
|
|
|
137
|
-
##
|
|
103
|
+
## Using components
|
|
138
104
|
|
|
139
|
-
|
|
105
|
+
Every component is a named export:
|
|
140
106
|
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
# or watch mode (preferred for debugging)
|
|
145
|
-
pnpm test:vitest:watch
|
|
146
|
-
# regenerate snapshots
|
|
147
|
-
pnpm test:vitest:updateSnapshots
|
|
107
|
+
```ts
|
|
108
|
+
import { UiButton, UiTextField, UiInputSelect } from '@livestorm/ui-vue'
|
|
109
|
+
```
|
|
148
110
|
|
|
111
|
+
```vue
|
|
112
|
+
<template>
|
|
113
|
+
<UiButton variant="cta" color="primary" icon="i-ls-check">
|
|
114
|
+
Click me
|
|
115
|
+
</UiButton>
|
|
116
|
+
</template>
|
|
149
117
|
```
|
|
150
118
|
|
|
151
|
-
|
|
152
|
-
|
|
119
|
+
Props, variants and events for each component are documented in the [hosted Storybook](https://main--65bcc25b1bd5ef5d8b1a8505.chromatic.com/), where every story is interactive. TypeScript definitions ship with the package, so editors autocomplete props and catch mistakes.
|
|
120
|
+
|
|
121
|
+
If you registered components globally with `registerComponents(app)`, you can use `<UiButton>` in any template without importing it. A custom prefix is supported too:
|
|
153
122
|
|
|
154
|
-
|
|
123
|
+
```ts
|
|
124
|
+
registerComponents(app, 'Ls') // <LsButton>, <LsTextField>, ...
|
|
125
|
+
```
|
|
155
126
|
|
|
156
|
-
|
|
157
|
-
- Runs automatically on every pull request that modifies packages/ui-vue.
|
|
158
|
-
- Installs dependencies, builds required packages, and runs all Vitest tests with coverage.
|
|
159
|
-
- Posts test results as a GitHub Check, including whether tests passed or failed.
|
|
160
|
-
- Ensures code quality before any code is merged.
|
|
127
|
+
## Entry points
|
|
161
128
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
|
|
167
|
-
-
|
|
129
|
+
| Import | Contents |
|
|
130
|
+
| --- | --- |
|
|
131
|
+
| `@livestorm/ui-vue` | All components and utilities |
|
|
132
|
+
| `@livestorm/ui-vue/style` | Base stylesheet (import once) |
|
|
133
|
+
| `@livestorm/ui-vue/components-vite` | `registerComponents` for global registration |
|
|
134
|
+
| `@livestorm/ui-vue/integrations` | Toast helpers (`openToast`, ...) |
|
|
135
|
+
| `@livestorm/ui-vue/layouts` | Layout components such as the toast container |
|
|
136
|
+
| `@livestorm/ui-vue/utils` | Helpers (`useCopyToClipboard`, `useRouteQueryModel`, ...) — the one entry that requires `vue-router` |
|
|
137
|
+
| `@livestorm/ui-vue/responsive` | Optional responsive plugin |
|
|
168
138
|
|
|
169
|
-
|
|
139
|
+
The package ships prebuilt ES modules, so no special bundler configuration is needed. The original sources are included as well, if your setup prefers to compile the components itself.
|
|
170
140
|
|
|
171
141
|
## Contributing
|
|
172
142
|
|
|
173
|
-
See CONTRIBUTING.md for
|
|
143
|
+
This package lives in Livestorm's [entropy](https://github.com/livestorm/entropy) monorepo, under `packages/ui-vue`. See that directory's `CONTRIBUTING.md` for architecture, conventions and the release process.
|