@todovue/tv-ui 0.1.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/LICENSE +21 -0
- package/README.md +207 -0
- package/dist/.htaccess +8 -0
- package/dist/demos/tv-alert/CHANGELOG.md +127 -0
- package/dist/demos/tv-alert/README.md +334 -0
- package/dist/demos/tv-article/CHANGELOG.md +221 -0
- package/dist/demos/tv-article/README.md +258 -0
- package/dist/demos/tv-breadcrumbs/CHANGELOG.md +135 -0
- package/dist/demos/tv-breadcrumbs/README.md +364 -0
- package/dist/demos/tv-button/CHANGELOG.md +158 -0
- package/dist/demos/tv-button/README.md +255 -0
- package/dist/demos/tv-card/CHANGELOG.md +158 -0
- package/dist/demos/tv-card/README.md +332 -0
- package/dist/demos/tv-demo/CHANGELOG.md +352 -0
- package/dist/demos/tv-demo/README.md +229 -0
- package/dist/demos/tv-footer/CHANGELOG.md +67 -0
- package/dist/demos/tv-footer/README.md +760 -0
- package/dist/demos/tv-hero/CHANGELOG.md +137 -0
- package/dist/demos/tv-hero/README.md +410 -0
- package/dist/demos/tv-label/CHANGELOG.md +138 -0
- package/dist/demos/tv-label/README.md +357 -0
- package/dist/demos/tv-menu/CHANGELOG.md +145 -0
- package/dist/demos/tv-menu/README.md +389 -0
- package/dist/demos/tv-modal/CHANGELOG.md +127 -0
- package/dist/demos/tv-modal/README.md +466 -0
- package/dist/demos/tv-pagination/CHANGELOG.md +125 -0
- package/dist/demos/tv-pagination/README.md +275 -0
- package/dist/demos/tv-progress-bar/CHANGELOG.md +84 -0
- package/dist/demos/tv-progress-bar/README.md +894 -0
- package/dist/demos/tv-relative-time/CHANGELOG.md +122 -0
- package/dist/demos/tv-relative-time/README.md +405 -0
- package/dist/demos/tv-scroll-top/CHANGELOG.md +69 -0
- package/dist/demos/tv-scroll-top/README.md +445 -0
- package/dist/demos/tv-search/CHANGELOG.md +155 -0
- package/dist/demos/tv-search/README.md +407 -0
- package/dist/demos/tv-settings/CHANGELOG.md +94 -0
- package/dist/demos/tv-settings/README.md +314 -0
- package/dist/demos/tv-sidebar/CHANGELOG.md +229 -0
- package/dist/demos/tv-sidebar/README.md +592 -0
- package/dist/demos/tv-theme-button/CHANGELOG.md +136 -0
- package/dist/demos/tv-theme-button/README.md +392 -0
- package/dist/demos/tv-toc/CHANGELOG.md +80 -0
- package/dist/demos/tv-toc/README.md +288 -0
- package/dist/entry.d.ts +48 -0
- package/dist/favicon.ico +0 -0
- package/dist/tv-ui.cjs.js +1 -0
- package/dist/tv-ui.css +1 -0
- package/dist/tv-ui.d.ts +6 -0
- package/dist/tv-ui.es.js +92 -0
- package/nuxt.js +58 -0
- package/package.json +92 -0
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
<p align="center"><img width="150" src="https://res.cloudinary.com/dcdfhi8qz/image/upload/v1763663056/uqqtkgp1lg3xdplutpga.png" alt="TODOvue logo">
|
|
2
|
+
</p>
|
|
3
|
+
|
|
4
|
+
# TODOvue Scroll Top (TvScrollTop)
|
|
5
|
+
A lightweight, customizable Vue 3 "scroll to top" button component with smooth animations, position variants, configurable threshold, and SSR support. Works seamlessly in Single Page Apps and Server-Side Rendered (SSR) environments like Nuxt 3.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@todovue/tv-scroll-top)
|
|
8
|
+
[](https://www.npmjs.com/package/@todovue/tv-scroll-top)
|
|
9
|
+
[](https://www.npmjs.com/package/@todovue/tv-scroll-top)
|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+

|
|
14
|
+

|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
> Demo: https://ui.todovue.blog/scrolltop
|
|
18
|
+
|
|
19
|
+
## Table of Contents
|
|
20
|
+
- [Features](#features)
|
|
21
|
+
- [Installation](#installation)
|
|
22
|
+
- [Quick Start (SPA)](#quick-start-spa)
|
|
23
|
+
- [Nuxt 4 / SSR Usage](#nuxt-4--ssr-usage)
|
|
24
|
+
- [Component Registration Options](#component-registration-options)
|
|
25
|
+
- [Props](#props)
|
|
26
|
+
- [Composable API](#composable-api)
|
|
27
|
+
- [Usage Examples](#usage-examples)
|
|
28
|
+
- [Animations](#animations)
|
|
29
|
+
- [Accessibility](#accessibility)
|
|
30
|
+
- [SSR Notes](#ssr-notes)
|
|
31
|
+
- [Development](#development)
|
|
32
|
+
- [Contributing](#contributing)
|
|
33
|
+
- [License](#license)
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
- Smooth scroll to top with one click
|
|
37
|
+
- Configurable visibility threshold (show button after X pixels scrolled)
|
|
38
|
+
- Position variants: left or right side
|
|
39
|
+
- Beautiful entrance/exit animations with rotation and bounce effects
|
|
40
|
+
- Backdrop blur effect for modern UI
|
|
41
|
+
- Automatic show/hide based on scroll position
|
|
42
|
+
- SSR-safe (works with Nuxt 3 and other SSR frameworks)
|
|
43
|
+
- Composable API (`useScrollTop`) for custom implementations
|
|
44
|
+
- Keyboard accessible (focus states and ARIA labels)
|
|
45
|
+
- Lightweight and tree-shakeable
|
|
46
|
+
- TypeScript support
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
Using npm:
|
|
50
|
+
```bash
|
|
51
|
+
npm install @todovue/tv-scroll-top
|
|
52
|
+
```
|
|
53
|
+
Using yarn:
|
|
54
|
+
```bash
|
|
55
|
+
yarn add @todovue/tv-scroll-top
|
|
56
|
+
```
|
|
57
|
+
Using pnpm:
|
|
58
|
+
```bash
|
|
59
|
+
pnpm add @todovue/tv-scroll-top
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Importing Styles
|
|
63
|
+
**Important:** You must explicitly import the stylesheet in your application.
|
|
64
|
+
|
|
65
|
+
#### For Vue/Vite SPA:
|
|
66
|
+
```ts
|
|
67
|
+
// main.ts
|
|
68
|
+
import { createApp } from 'vue'
|
|
69
|
+
import App from './App.vue'
|
|
70
|
+
|
|
71
|
+
import '@todovue/tv-scroll-top/style.css'
|
|
72
|
+
import { TvScrollTop } from '@todovue/tv-scroll-top'
|
|
73
|
+
|
|
74
|
+
const app = createApp(App)
|
|
75
|
+
app.component('TvScrollTop', TvScrollTop)
|
|
76
|
+
app.mount('#app')
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### For Nuxt 3/4:
|
|
80
|
+
```ts
|
|
81
|
+
// nuxt.config.ts
|
|
82
|
+
export default defineNuxtConfig({
|
|
83
|
+
modules: [
|
|
84
|
+
'@todovue/tv-scroll-top/nuxt'
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Then register the component in a plugin as shown in the [Nuxt 3 / SSR Usage](#nuxt-3--ssr-usage) section.
|
|
90
|
+
|
|
91
|
+
## Quick Start (SPA)
|
|
92
|
+
Global registration (main.js / main.ts):
|
|
93
|
+
```js
|
|
94
|
+
import { createApp } from 'vue'
|
|
95
|
+
import App from './App.vue'
|
|
96
|
+
import '@todovue/tv-scroll-top/style.css'
|
|
97
|
+
import TvScrollTop from '@todovue/tv-scroll-top'
|
|
98
|
+
|
|
99
|
+
createApp(App)
|
|
100
|
+
.use(TvScrollTop) // enables <TvScrollTop /> globally
|
|
101
|
+
.mount('#app')
|
|
102
|
+
```
|
|
103
|
+
Local import inside a component:
|
|
104
|
+
```vue
|
|
105
|
+
<script setup>
|
|
106
|
+
import { TvScrollTop } from '@todovue/tv-scroll-top'
|
|
107
|
+
import '@todovue/tv-scroll-top/style.css'
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<template>
|
|
111
|
+
<div>
|
|
112
|
+
<!-- Your page content -->
|
|
113
|
+
<div style="height: 2000px">
|
|
114
|
+
Scroll down to see the button appear...
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<!-- Scroll to top button (appears after scrolling 300px by default) -->
|
|
118
|
+
<TvScrollTop />
|
|
119
|
+
</div>
|
|
120
|
+
</template>
|
|
121
|
+
```
|
|
122
|
+
**Note:** Don't forget to import the CSS in your main entry file as shown above.
|
|
123
|
+
|
|
124
|
+
## Nuxt 4 / SSR Usage
|
|
125
|
+
First, add the module to your `nuxt.config.ts`:
|
|
126
|
+
```ts
|
|
127
|
+
// nuxt.config.ts
|
|
128
|
+
export default defineNuxtConfig({
|
|
129
|
+
modules: ['@todovue/tv-scroll-top/nuxt']
|
|
130
|
+
})
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Alternatively, you can manually add the CSS:
|
|
134
|
+
```ts
|
|
135
|
+
// nuxt.config.ts
|
|
136
|
+
export default defineNuxtConfig({
|
|
137
|
+
css: ['@todovue/tv-scroll-top/style.css'],
|
|
138
|
+
})
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Then create a plugin file: `plugins/tv-scroll-top.client.ts`:
|
|
142
|
+
```ts
|
|
143
|
+
import { defineNuxtPlugin } from '#app'
|
|
144
|
+
import TvScrollTop from '@todovue/tv-scroll-top'
|
|
145
|
+
|
|
146
|
+
export default defineNuxtPlugin(nuxtApp => {
|
|
147
|
+
nuxtApp.vueApp.use(TvScrollTop)
|
|
148
|
+
})
|
|
149
|
+
```
|
|
150
|
+
Use anywhere in your Nuxt app:
|
|
151
|
+
```vue
|
|
152
|
+
<template>
|
|
153
|
+
<div>
|
|
154
|
+
<NuxtPage />
|
|
155
|
+
|
|
156
|
+
<!-- Scroll to top button -->
|
|
157
|
+
<TvScrollTop :threshold="400" position="right" />
|
|
158
|
+
</div>
|
|
159
|
+
</template>
|
|
160
|
+
```
|
|
161
|
+
Optional direct import (no plugin):
|
|
162
|
+
```vue
|
|
163
|
+
<script setup>
|
|
164
|
+
import { TvScrollTop } from '@todovue/tv-scroll-top'
|
|
165
|
+
</script>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Component Registration Options
|
|
169
|
+
| Approach | When to use |
|
|
170
|
+
|--------------------------------------------------------------------------|------------------------------------------------|
|
|
171
|
+
| Global via `app.use(TvScrollTop)` | Many usages across app / design system install |
|
|
172
|
+
| Local named import `{ TvScrollTop }` | Isolated / code-split contexts |
|
|
173
|
+
| Direct default import `import TvScrollTop from '@todovue/tv-scroll-top'` | Single usage or manual registration |
|
|
174
|
+
|
|
175
|
+
## Props
|
|
176
|
+
| Prop | Type | Default | Description |
|
|
177
|
+
|----------------|---------|---------|-----------------------------------------------------------------------------|
|
|
178
|
+
| threshold | Number | 300 | Scroll position (in pixels) after which the button becomes visible. |
|
|
179
|
+
| position | String | 'right' | Position of the button: `'left'` or `'right'`. |
|
|
180
|
+
| showOnScrollUp | Boolean | false | When true, the button only appears when scrolling up (not down). |
|
|
181
|
+
|
|
182
|
+
### Prop Details
|
|
183
|
+
|
|
184
|
+
#### `threshold`
|
|
185
|
+
Controls when the scroll-to-top button appears. The button will show when the user has scrolled down more than this value (in pixels).
|
|
186
|
+
|
|
187
|
+
Example:
|
|
188
|
+
```vue
|
|
189
|
+
<TvScrollTop :threshold="500" />
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### `position`
|
|
193
|
+
Controls the horizontal position of the button on the screen.
|
|
194
|
+
|
|
195
|
+
Accepted values:
|
|
196
|
+
- `'right'` - Button appears on the right side (default)
|
|
197
|
+
- `'left'` - Button appears on the left side
|
|
198
|
+
|
|
199
|
+
Example:
|
|
200
|
+
```vue
|
|
201
|
+
<TvScrollTop position="left" />
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
#### `showOnScrollUp`
|
|
205
|
+
Controls whether the button should only appear when the user is scrolling up. When enabled, the button will hide when scrolling down and show when scrolling up (as long as the threshold is met).
|
|
206
|
+
|
|
207
|
+
Accepted values:
|
|
208
|
+
- `false` - Button shows whenever scroll position exceeds threshold (default behavior)
|
|
209
|
+
- `true` - Button only shows when scrolling up AND scroll position exceeds threshold
|
|
210
|
+
|
|
211
|
+
Example:
|
|
212
|
+
```vue
|
|
213
|
+
<!-- Button appears only when scrolling up -->
|
|
214
|
+
<TvScrollTop :show-on-scroll-up="true" />
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
This is particularly useful for a better user experience, as the button won't obstruct content while the user is reading down the page.
|
|
218
|
+
|
|
219
|
+
## Composable API
|
|
220
|
+
TvScrollTop includes a composable `useScrollTop` that you can use to build custom scroll-to-top functionality.
|
|
221
|
+
|
|
222
|
+
### `useScrollTop(threshold, showOnScrollUp)`
|
|
223
|
+
```js
|
|
224
|
+
import { useScrollTop } from '@todovue/tv-scroll-top'
|
|
225
|
+
|
|
226
|
+
const { isVisible, scrollToTop } = useScrollTop(300, false)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Parameters:**
|
|
230
|
+
- `threshold` (Number|Ref): Scroll position in pixels (default: 300)
|
|
231
|
+
- `showOnScrollUp` (Boolean|Ref): Whether to show the button only when scrolling up (default: false)
|
|
232
|
+
|
|
233
|
+
**Returns:**
|
|
234
|
+
- `isVisible` (Ref<Boolean>): Reactive boolean indicating if scroll position is past the threshold (and scrolling direction if enabled)
|
|
235
|
+
- `scrollToTop` (Function): Function to smoothly scroll to the top of the page
|
|
236
|
+
|
|
237
|
+
**Example:**
|
|
238
|
+
```vue
|
|
239
|
+
<script setup>
|
|
240
|
+
import { useScrollTop } from '@todovue/tv-scroll-top'
|
|
241
|
+
|
|
242
|
+
const { isVisible, scrollToTop } = useScrollTop(400, true)
|
|
243
|
+
</script>
|
|
244
|
+
|
|
245
|
+
<template>
|
|
246
|
+
<button v-if="isVisible" @click="scrollToTop">
|
|
247
|
+
Custom Scroll Top Button
|
|
248
|
+
</button>
|
|
249
|
+
</template>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Usage Examples
|
|
253
|
+
|
|
254
|
+
### Default (Right Position, 300px Threshold)
|
|
255
|
+
```vue
|
|
256
|
+
<script setup>
|
|
257
|
+
import { TvScrollTop } from '@todovue/tv-scroll-top'
|
|
258
|
+
import '@todovue/tv-scroll-top/style.css'
|
|
259
|
+
</script>
|
|
260
|
+
|
|
261
|
+
<template>
|
|
262
|
+
<div>
|
|
263
|
+
<div style="height: 2000px">
|
|
264
|
+
<!-- Your content -->
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<TvScrollTop />
|
|
268
|
+
</div>
|
|
269
|
+
</template>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Left Position
|
|
273
|
+
```vue
|
|
274
|
+
<script setup>
|
|
275
|
+
import { TvScrollTop } from '@todovue/tv-scroll-top'
|
|
276
|
+
import '@todovue/tv-scroll-top/style.css'
|
|
277
|
+
</script>
|
|
278
|
+
|
|
279
|
+
<template>
|
|
280
|
+
<div>
|
|
281
|
+
<div style="height: 2000px">
|
|
282
|
+
<!-- Your content -->
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
<TvScrollTop position="left" />
|
|
286
|
+
</div>
|
|
287
|
+
</template>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Low Threshold (100px)
|
|
291
|
+
Perfect for shorter pages or when you want the button to appear quickly.
|
|
292
|
+
```vue
|
|
293
|
+
<script setup>
|
|
294
|
+
import { TvScrollTop } from '@todovue/tv-scroll-top'
|
|
295
|
+
import '@todovue/tv-scroll-top/style.css'
|
|
296
|
+
</script>
|
|
297
|
+
|
|
298
|
+
<template>
|
|
299
|
+
<div>
|
|
300
|
+
<div style="height: 2000px">
|
|
301
|
+
<!-- Your content -->
|
|
302
|
+
</div>
|
|
303
|
+
|
|
304
|
+
<TvScrollTop :threshold="100" />
|
|
305
|
+
</div>
|
|
306
|
+
</template>
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### High Threshold (600px)
|
|
310
|
+
For longer pages where you want the button to appear later.
|
|
311
|
+
```vue
|
|
312
|
+
<script setup>
|
|
313
|
+
import { TvScrollTop } from '@todovue/tv-scroll-top'
|
|
314
|
+
import '@todovue/tv-scroll-top/style.css'
|
|
315
|
+
</script>
|
|
316
|
+
|
|
317
|
+
<template>
|
|
318
|
+
<div>
|
|
319
|
+
<div style="height: 3000px">
|
|
320
|
+
<!-- Your content -->
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
<TvScrollTop :threshold="600" />
|
|
324
|
+
</div>
|
|
325
|
+
</template>
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Show Only When Scrolling Up
|
|
329
|
+
The button only appears when the user scrolls up, preventing content obstruction while reading down the page.
|
|
330
|
+
```vue
|
|
331
|
+
<script setup>
|
|
332
|
+
import { TvScrollTop } from '@todovue/tv-scroll-top'
|
|
333
|
+
import '@todovue/tv-scroll-top/style.css'
|
|
334
|
+
</script>
|
|
335
|
+
|
|
336
|
+
<template>
|
|
337
|
+
<div>
|
|
338
|
+
<div style="height: 2000px">
|
|
339
|
+
<!-- Your content -->
|
|
340
|
+
</div>
|
|
341
|
+
|
|
342
|
+
<TvScrollTop :show-on-scroll-up="true" />
|
|
343
|
+
</div>
|
|
344
|
+
</template>
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Custom Implementation with Composable
|
|
348
|
+
```vue
|
|
349
|
+
<script setup>
|
|
350
|
+
import { useScrollTop } from '@todovue/tv-scroll-top'
|
|
351
|
+
|
|
352
|
+
const { isVisible, scrollToTop } = useScrollTop(200, true)
|
|
353
|
+
|
|
354
|
+
const handleClick = () => {
|
|
355
|
+
scrollToTop()
|
|
356
|
+
console.log('Scrolling to top!')
|
|
357
|
+
}
|
|
358
|
+
</script>
|
|
359
|
+
|
|
360
|
+
<template>
|
|
361
|
+
<Transition name="fade">
|
|
362
|
+
<button
|
|
363
|
+
v-if="isVisible"
|
|
364
|
+
@click="handleClick"
|
|
365
|
+
class="my-custom-scroll-button"
|
|
366
|
+
>
|
|
367
|
+
↑ Top
|
|
368
|
+
</button>
|
|
369
|
+
</Transition>
|
|
370
|
+
</template>
|
|
371
|
+
|
|
372
|
+
<style scoped>
|
|
373
|
+
.my-custom-scroll-button {
|
|
374
|
+
position: fixed;
|
|
375
|
+
bottom: 20px;
|
|
376
|
+
right: 20px;
|
|
377
|
+
padding: 10px 20px;
|
|
378
|
+
background: #007bff;
|
|
379
|
+
color: white;
|
|
380
|
+
border: none;
|
|
381
|
+
border-radius: 5px;
|
|
382
|
+
cursor: pointer;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.fade-enter-active, .fade-leave-active {
|
|
386
|
+
transition: opacity 0.3s;
|
|
387
|
+
}
|
|
388
|
+
.fade-enter-from, .fade-leave-to {
|
|
389
|
+
opacity: 0;
|
|
390
|
+
}
|
|
391
|
+
</style>
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## Animations
|
|
395
|
+
TvScrollTop includes beautiful built-in animations that differ based on position:
|
|
396
|
+
|
|
397
|
+
### Right Position Animations
|
|
398
|
+
- **Enter**: Slides in from right with rotation (180° to 0°), bounce effect, and scale
|
|
399
|
+
- **Leave**: Slides out to right with rotation (0° to 180°) and scale down
|
|
400
|
+
|
|
401
|
+
### Left Position Animations
|
|
402
|
+
- **Enter**: Slides in from left with rotation (-180° to 0°), bounce effect, and scale
|
|
403
|
+
- **Leave**: Slides out to left with rotation (0° to -180°) and scale down
|
|
404
|
+
|
|
405
|
+
### Visual Effects
|
|
406
|
+
- Smooth cubic-bezier timing functions for natural movement
|
|
407
|
+
- Backdrop blur effect (10px) for modern glass-morphism look
|
|
408
|
+
- Shadow elevation on hover (4px → 8px)
|
|
409
|
+
- Scale transform on hover (1.05x) and active (1.02x)
|
|
410
|
+
|
|
411
|
+
Animations are implemented using Vue's `<Transition>` component and CSS keyframes.
|
|
412
|
+
|
|
413
|
+
## Accessibility
|
|
414
|
+
- **ARIA Label**: Button includes `aria-label="Scroll to top"` for screen readers
|
|
415
|
+
- **Keyboard Support**: Fully keyboard accessible (can be focused and activated with Enter/Space)
|
|
416
|
+
- **Focus States**: Clear focus indicators for keyboard navigation
|
|
417
|
+
- **Semantic HTML**: Uses proper `<button>` element
|
|
418
|
+
- **SVG Icon**: Uses semantic SVG with proper stroke and viewBox attributes
|
|
419
|
+
|
|
420
|
+
## SSR Notes
|
|
421
|
+
- **SSR-Safe**: No direct `window`/`document` access during module evaluation
|
|
422
|
+
- **Smart Guards**: Uses `typeof window !== 'undefined'` checks
|
|
423
|
+
- **Lifecycle Hooks**: Scroll listeners are added in `onMounted` hook
|
|
424
|
+
- **Cleanup**: Automatically removes event listeners in `onUnmounted`
|
|
425
|
+
- **Nuxt 3 Compatible**: Works seamlessly with Nuxt 3 out of the box
|
|
426
|
+
- **Hydration Safe**: No hydration mismatches
|
|
427
|
+
|
|
428
|
+
## Development
|
|
429
|
+
```bash
|
|
430
|
+
git clone https://github.com/TODOvue/tv-scroll-top.git
|
|
431
|
+
cd tv-scroll-top
|
|
432
|
+
npm install
|
|
433
|
+
npm run dev # run demo playground
|
|
434
|
+
npm run build # build library
|
|
435
|
+
```
|
|
436
|
+
Local demo served from Vite using `index.html` and demo examples in `src/demo`.
|
|
437
|
+
|
|
438
|
+
## Contributing
|
|
439
|
+
PRs and issues welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md).
|
|
440
|
+
|
|
441
|
+
## License
|
|
442
|
+
MIT © TODOvue
|
|
443
|
+
|
|
444
|
+
### Attributions
|
|
445
|
+
Crafted for the TODOvue component ecosystem
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@todovue/tv-search` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
This project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [1.2.1] - 2026-01-27
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- Simplified the file list in `package.json` to include only essential assets.
|
|
11
|
+
- Simplified the build configuration by removing demo-specific logic.
|
|
12
|
+
- Enhanced GitHub Actions workflows to automate npm package publishing and GitHub release creation.
|
|
13
|
+
- Moved the `@todovue/tv-demo` component import from main.js to `Demo.vue` to localize its usage.
|
|
14
|
+
- Updated build commands to include `README.md` and `CHANGELOG.md` files in the public directory during the build process.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- Included the `src` directory in the `package.json` files list to ensure component source files are bundled in the package distribution.
|
|
18
|
+
|
|
19
|
+
### Removed
|
|
20
|
+
- Eliminated the global import of the `@todovue/tv-demo` component from `main.js`.
|
|
21
|
+
|
|
22
|
+
### Dependencies
|
|
23
|
+
- Updated `@todovue/tv-demo` to `^1.4.11`.
|
|
24
|
+
- Updated `vue` to `^3.5.27`.
|
|
25
|
+
- Updated `sass` to `^1.97.3`.
|
|
26
|
+
|
|
27
|
+
## [1.2.0] - 2026-01-20
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- Added `searchKeys` prop to allow searching by multiple object properties (default is `['title']`).
|
|
31
|
+
- Added `noResultsText` prop for customizable empty state text (default: "No results found for").
|
|
32
|
+
- Added scoped `item` slot for customizing search result rendering.
|
|
33
|
+
- Added `no-results` slot for customizing the empty state.
|
|
34
|
+
|
|
35
|
+
### Dependencies
|
|
36
|
+
- Updated the `@todovue/tv-demo` dependency to `^1.4.4`.
|
|
37
|
+
- Updated the `@todovue/tv-button` dependency to `^1.2.4`.
|
|
38
|
+
- Updated the `sass` dependency to `^1.97.2`.
|
|
39
|
+
- Updated the `vite` dependency to `^7.3.1`.
|
|
40
|
+
|
|
41
|
+
## [1.1.3] - 2025-12-27
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
- Fixed publish in npm with new token.
|
|
45
|
+
|
|
46
|
+
## [1.1.2] - 2025-12-27
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
- Added automatic publishing to the TODOvue cPanel in `release.yml` for each release, simplifying package distribution and updates.
|
|
50
|
+
- Added `package-lock.json` to the repository to ensure dependency consistency and facilitate version management across development and production environments.
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
- Changed the `base` option in `vite.config.js` for website deployment in cpanel.
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
- Fixed repository URL in `package.json` to point to the correct GitHub repository.
|
|
57
|
+
- Fixed the token configuration used to generate the package in the GitHub Actions workflow `release.yml`.
|
|
58
|
+
|
|
59
|
+
### Dependencies
|
|
60
|
+
- Updated dependency versions in `package.json` to maintain compatibility and benefit from improvements and bug fixes in the used libraries.
|
|
61
|
+
|
|
62
|
+
## [1.1.1] - 2025-11-24
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
- Updated background and text colors for dark and light themes to improve readability and visual comfort.
|
|
66
|
+
- Deleted unused styles files.
|
|
67
|
+
|
|
68
|
+
### Dependencies
|
|
69
|
+
- Updated the `@todovue/tv-demo` dependency to `^1.2.2` to ensure compatibility with the latest changes.
|
|
70
|
+
|
|
71
|
+
## [1.1.0] - 2025-11-21
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
- Added `nux.js` configuration file for Nuxt 4 integration.
|
|
75
|
+
- Added `tsconfig.json` for proper type checking during build.
|
|
76
|
+
- Create `global.d.ts` to declare module for TypeScript users.
|
|
77
|
+
- Added Nuxt module for automatic style injection and auto-registration of the `TvSearch` component.
|
|
78
|
+
- The `@todovue/tv-search` component is now externalized from the final build, reducing bundle size.
|
|
79
|
+
- Added `CHANGELOG.md` in script to generate demo and documentation site.
|
|
80
|
+
|
|
81
|
+
### Dependencies
|
|
82
|
+
- Updated the `@todovue/tv-demo` dependency to `^1.2.1` to ensure compatibility with the latest changes.
|
|
83
|
+
- Updated the `@todovue/tv-button` dependency to `^1.2.2` to ensure compatibility with the latest changes.
|
|
84
|
+
|
|
85
|
+
## [1.0.5] - 2025-11-18
|
|
86
|
+
|
|
87
|
+
### Changed
|
|
88
|
+
- Modified search behavior: pressing Enter or the search button now always emits the input string. The result object is only emitted when explicitly selected from the list.
|
|
89
|
+
|
|
90
|
+
## [1.0.4] - 2025-11-15
|
|
91
|
+
|
|
92
|
+
### Changed
|
|
93
|
+
- Styles are now served as a separate CSS file (`dist/tv-search.css`) generated by Vite during the build process.
|
|
94
|
+
- Users must now explicitly import the stylesheet in their application:
|
|
95
|
+
- For Vue/Vite SPA: `import '@todovue/tv-search/style.css'` in `main.ts`
|
|
96
|
+
- For Nuxt 3/4: Add `'@todovue/tv-search/style.css'` to the `css` array in `nuxt.config.ts`
|
|
97
|
+
|
|
98
|
+
### Added
|
|
99
|
+
- Added `sideEffects` field to `package.json` to support proper tree-shaking with CSS files.
|
|
100
|
+
- Added `./style.css` export path in `package.json` for explicit CSS imports.
|
|
101
|
+
- Improved SSR/SSG compatibility, especially for Nuxt 3/4 applications.
|
|
102
|
+
|
|
103
|
+
### Dependencies
|
|
104
|
+
- Removed dependency on `vite-plugin-css-injected-by-js` from `devDependencies`
|
|
105
|
+
|
|
106
|
+
## [1.0.3] - 2025-11-13
|
|
107
|
+
|
|
108
|
+
### Fixed
|
|
109
|
+
- The emit event is fixed to send the selected object and not the input.
|
|
110
|
+
|
|
111
|
+
### Changed
|
|
112
|
+
- Corrected demo application routes.
|
|
113
|
+
|
|
114
|
+
## [1.0.2] - 2025-10-17
|
|
115
|
+
|
|
116
|
+
### Changed
|
|
117
|
+
- The library build now uses `src/entry.ts` (exports both the component and the plugin) instead of directly exporting the `.vue` file.
|
|
118
|
+
- CSS injection via JS has been removed for the library build (it is only kept for the demo), generating a `tv-search.css` file optimized for SSR/Nuxt.
|
|
119
|
+
- Changed node-version to workflows release.yml to 20.
|
|
120
|
+
|
|
121
|
+
### Added
|
|
122
|
+
- Plugin installation support: `app.use(TvSearch)` or `app.use(TvSearchPlugin)`.
|
|
123
|
+
- Explicit export of the style file: `import '@todovue/tv-search/style.css'`.
|
|
124
|
+
- Documentation for usage in SSR and Nuxt 3 applications.
|
|
125
|
+
|
|
126
|
+
## [1.0.1] - 2025-05-07
|
|
127
|
+
|
|
128
|
+
### Fixed
|
|
129
|
+
- Rename `global.scss` to `_global.scss`
|
|
130
|
+
- Update imports in component
|
|
131
|
+
|
|
132
|
+
## [1.0.0] - 2025-05-06
|
|
133
|
+
|
|
134
|
+
### Features
|
|
135
|
+
- Initial release of `TvSearch` component.
|
|
136
|
+
- Added support for `Ctrl + K` / `⌘ + K` keyboard shortcuts to open the search modal.
|
|
137
|
+
- Supports customizable search result list via `results` prop.
|
|
138
|
+
- Allows overriding styles with `customStyles` prop.
|
|
139
|
+
- Emits `search` event on form submission.
|
|
140
|
+
- Full keyboard accessibility and responsive design.
|
|
141
|
+
- Easy integration into any Vue 3 application.
|
|
142
|
+
- Published to [npm](https://www.npmjs.com/package/@todovue/tv-search) under the `@todovue` namespace.
|
|
143
|
+
|
|
144
|
+
[1.2.1]: https://github.com/TODOvue/tv-button/pull/13/files
|
|
145
|
+
[1.2.0]: https://github.com/TODOvue/tv-button/pull/12/files
|
|
146
|
+
[1.1.3]: https://github.com/TODOvue/tv-button/pull/11/files
|
|
147
|
+
[1.1.2]: https://github.com/TODOvue/tv-button/pull/10/files
|
|
148
|
+
[1.1.1]: https://github.com/TODOvue/tv-button/pull/9/files
|
|
149
|
+
[1.1.0]: https://github.com/TODOvue/tv-button/pull/8/files
|
|
150
|
+
[1.0.5]: https://github.com/TODOvue/tv-button/pull/7/files
|
|
151
|
+
[1.0.4]: https://github.com/TODOvue/tv-button/pull/6/files
|
|
152
|
+
[1.0.3]: https://github.com/TODOvue/tv-button/pull/5/files
|
|
153
|
+
[1.0.2]: https://github.com/TODOvue/tv-button/pull/4/files
|
|
154
|
+
[1.0.1]: https://github.com/TODOvue/tv-button/pull/2/files
|
|
155
|
+
[1.0.0]: https://github.com/TODOvue/tv-button/pull/2/files
|