@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 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
- - [Introduction](#introduction)
18
- - [Usage](#usage)
19
- - [Importing Components](#importing-components)
20
- - [Storybook](#storybook)
21
- - [Testing](#testing)
22
- - [CI/CD](#cicd)
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
- ## Introduction
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
- ## Usage
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
- This package is used as a workspace dependency inside the `@livestorm/entropy` monorepo, and is also published to npm as [`@livestorm/ui-vue`](https://www.npmjs.com/package/@livestorm/ui-vue) for other Livestorm projects.
40
+ Installing the package also pulls in `@livestorm/ui-tokens` (design tokens) and `@livestorm/ui-icons` (icon utilities).
35
41
 
36
- ### Installation (outside the monorepo)
42
+ ## Installation
37
43
 
38
44
  ```bash
39
45
  pnpm add @livestorm/ui-vue
40
46
  ```
41
47
 
42
- This pulls in `@livestorm/ui-tokens` (design tokens) and `@livestorm/ui-icons` (icon utilities) as dependencies. `vue` (and `vue-router`, if you use router-aware components) are peer dependencies you provide.
48
+ ## Tailwind CSS setup
43
49
 
44
- The library is Tailwind CSS 4 based: components use Tailwind utility classes (including `i-ls-*` icon classes), so your app must run Tailwind and scan the library for classes. In your Tailwind entry CSS:
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
- The published package ships prebuilt ES modules (`dist/`), so no special bundler configuration is needed. The source is also included under `src/` if your Vite setup prefers compiling the components itself.
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
- All components are available as named exports. Example:
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
- The overlay components (dialogs, dropdowns, menus, popovers, tooltips) render through client-only teleports; under SSR they hydrate on the client with no extra setup.
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
- ### Storybook
86
+ <details>
87
+ <summary>Optional: customizing the responsive breakpoints</summary>
126
88
 
127
- Interactive documentation and playground for all components.
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
- ```bash
130
- # From the ui-vue package directory
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
- Visit http://localhost:6006 after starting.
101
+ </details>
136
102
 
137
- ## Testing
103
+ ## Using components
138
104
 
139
- We use Vitest for unit/component tests.
105
+ Every component is a named export:
140
106
 
141
- ```bash
142
- # Run all tests just one time
143
- pnpm test:vitest
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
- > Minimum 95% coverage required.
152
- > See CONTRIBUTING.md for writing good tests.
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
- ## CI/CD
123
+ ```ts
124
+ registerComponents(app, 'Ls') // <LsButton>, <LsTextField>, ...
125
+ ```
155
126
 
156
- #### Testing (ui-vue-test.yml):
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
- #### Deployment (ui-vue-deploy.yml):
163
- - Triggers on pushes to main or when a pull request affecting ui-vue has the deploy-storybook label.
164
- - For PRs, checks if the label `deploy-storybook` is present. If not, deployment is skipped.
165
- - Verifies that all tests have passed before proceeding with deployment.
166
- - If conditions are met, builds and deploys the Storybook for ui-vue (typically to Chromatic or a static host).
167
- - Ensures only tested and reviewed code is deployed and that Storybook previews are available for review.
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
- Every code change is tested automatically. Storybook deployments for review are gated by a label and require passing tests, ensuring high confidence in merged and released code.
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 guidelines, architecture, and best practices.
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.