@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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +207 -0
  3. package/dist/.htaccess +8 -0
  4. package/dist/demos/tv-alert/CHANGELOG.md +127 -0
  5. package/dist/demos/tv-alert/README.md +334 -0
  6. package/dist/demos/tv-article/CHANGELOG.md +221 -0
  7. package/dist/demos/tv-article/README.md +258 -0
  8. package/dist/demos/tv-breadcrumbs/CHANGELOG.md +135 -0
  9. package/dist/demos/tv-breadcrumbs/README.md +364 -0
  10. package/dist/demos/tv-button/CHANGELOG.md +158 -0
  11. package/dist/demos/tv-button/README.md +255 -0
  12. package/dist/demos/tv-card/CHANGELOG.md +158 -0
  13. package/dist/demos/tv-card/README.md +332 -0
  14. package/dist/demos/tv-demo/CHANGELOG.md +352 -0
  15. package/dist/demos/tv-demo/README.md +229 -0
  16. package/dist/demos/tv-footer/CHANGELOG.md +67 -0
  17. package/dist/demos/tv-footer/README.md +760 -0
  18. package/dist/demos/tv-hero/CHANGELOG.md +137 -0
  19. package/dist/demos/tv-hero/README.md +410 -0
  20. package/dist/demos/tv-label/CHANGELOG.md +138 -0
  21. package/dist/demos/tv-label/README.md +357 -0
  22. package/dist/demos/tv-menu/CHANGELOG.md +145 -0
  23. package/dist/demos/tv-menu/README.md +389 -0
  24. package/dist/demos/tv-modal/CHANGELOG.md +127 -0
  25. package/dist/demos/tv-modal/README.md +466 -0
  26. package/dist/demos/tv-pagination/CHANGELOG.md +125 -0
  27. package/dist/demos/tv-pagination/README.md +275 -0
  28. package/dist/demos/tv-progress-bar/CHANGELOG.md +84 -0
  29. package/dist/demos/tv-progress-bar/README.md +894 -0
  30. package/dist/demos/tv-relative-time/CHANGELOG.md +122 -0
  31. package/dist/demos/tv-relative-time/README.md +405 -0
  32. package/dist/demos/tv-scroll-top/CHANGELOG.md +69 -0
  33. package/dist/demos/tv-scroll-top/README.md +445 -0
  34. package/dist/demos/tv-search/CHANGELOG.md +155 -0
  35. package/dist/demos/tv-search/README.md +407 -0
  36. package/dist/demos/tv-settings/CHANGELOG.md +94 -0
  37. package/dist/demos/tv-settings/README.md +314 -0
  38. package/dist/demos/tv-sidebar/CHANGELOG.md +229 -0
  39. package/dist/demos/tv-sidebar/README.md +592 -0
  40. package/dist/demos/tv-theme-button/CHANGELOG.md +136 -0
  41. package/dist/demos/tv-theme-button/README.md +392 -0
  42. package/dist/demos/tv-toc/CHANGELOG.md +80 -0
  43. package/dist/demos/tv-toc/README.md +288 -0
  44. package/dist/entry.d.ts +48 -0
  45. package/dist/favicon.ico +0 -0
  46. package/dist/tv-ui.cjs.js +1 -0
  47. package/dist/tv-ui.css +1 -0
  48. package/dist/tv-ui.d.ts +6 -0
  49. package/dist/tv-ui.es.js +92 -0
  50. package/nuxt.js +58 -0
  51. package/package.json +92 -0
@@ -0,0 +1,136 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@todovue/tv-theme-button` 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
+ - Introduced a primary color variable to the global style configuration to facilitate easier branding and theme customization.
31
+ - Improved the theme detection logic to more accurately identify system preferences.
32
+ - Implemented a `storage` event listener to ensure theme changes synchronize instantly across multiple open browser tabs or windows.
33
+ - Introduced support for custom colors to allow for more flexible branding and component styling.
34
+ - Added configurable size options `sm` and `lg` to provide greater control over component dimensions.
35
+ - Implemented `rounded` properties to support various border-radius styles across components.
36
+
37
+ ### Dependencies
38
+ - Updated the `@todovue/tv-demo` dependency to `^1.4.4`.
39
+ - Updated the `sass` dependency to `^1.97.2`.
40
+ - Updated the `vite` dependency to `^7.3.1`.
41
+
42
+ ### Changed
43
+ - Enhanced accessibility across components to improve screen reader compatibility and keyboard navigation.
44
+ - Updated the application default to light mode when no specific theme preference is found.
45
+
46
+ ### Performance
47
+ - Improved transition effects and transform properties to ensure smoother animations and better rendering performance.
48
+
49
+ ## [1.1.1] - 2025-12-19
50
+
51
+ ### Added
52
+ - Added automatic publishing to the TODOvue cPanel in `release.yml` for each release, simplifying package distribution and updates.
53
+ - Added `package-lock.json` to the repository to ensure dependency consistency and facilitate version management across development and production environments.
54
+ - Added `darkIcon` prop to customize the dark mode icon. Accepts URLs (http/https), data URIs, local paths, or inline SVG strings.
55
+ - Added `lightIcon` prop to customize the light mode icon. Accepts URLs (http/https), data URIs, local paths, or inline SVG strings.
56
+ - Added prop validators to ensure icon values are valid URLs or SVG strings.
57
+
58
+ ### Changed
59
+ - Changed the `base` option in `vite.config.js` for website deployment in cpanel.
60
+ - Modified `useThemeButton` composable to accept `props` parameter for custom icon support.
61
+ - Modified `iconContent()` function to return an object with `content` and `isUrl` properties instead of just a string.
62
+ - Updated component template to conditionally render `<img>` tags for URLs or `<i>` tags with `v-html` for SVG strings.
63
+
64
+ ### Fixed
65
+ - Fixed repository URL in `package.json` to point to the correct GitHub repository.
66
+ - Fixed the token configuration used to generate the package in the GitHub Actions workflow `release.yml`.
67
+
68
+ ### Dependencies
69
+ - Updated dependency versions in `package.json` to maintain compatibility and benefit from improvements and bug fixes in the used libraries.
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 `TvThemeButton` component.
78
+ - The `@todovue/tv-theme-button` 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
+
84
+ ### Fixed
85
+ - Fixed files to export in `package.json` to ensure proper module resolution.
86
+
87
+ ## [1.0.3] - 2025-11-15
88
+
89
+ ### Changed
90
+ - Styles are now served as a separate CSS file (`dist/tv-theme-button.css`) generated by Vite during the build process.
91
+ - Users must now explicitly import the stylesheet in their application:
92
+ - For Vue/Vite SPA: `import '@todovue/tv-theme-button/style.css'` in `main.ts`
93
+ - For Nuxt 3/4: Add `'@todovue/tv-theme-button/style.css'` to the `css` array in `nuxt.config.ts`
94
+
95
+ ### Added
96
+ - Added `sideEffects` field to `package.json` to support proper tree-shaking with CSS files.
97
+ - Added `./style.css` export path in `package.json` for explicit CSS imports.
98
+ - Improved SSR/SSG compatibility, especially for Nuxt 3/4 applications.
99
+
100
+ ### Dependencies
101
+ - Removed dependency on `vite-plugin-css-injected-by-js` from `devDependencies`
102
+
103
+ ## [1.0.2] - 2025-11-13
104
+
105
+ ### Fixed
106
+ - Fixed SSR hydration error in Nuxt caused by localStorage access during server-side rendering
107
+ - Fixed component import path in demo application
108
+
109
+ ## [1.0.1] - 2025-10-19
110
+
111
+ ###️ Changed
112
+ - The library build now uses `src/entry.ts` (exports both the component and the plugin) instead of directly exporting the `.vue` file.
113
+ - CSS injection via JS has been removed for the library build (it is only kept for the demo), generating a `tv-theme-button.css` file optimized for SSR/Nuxt.
114
+ - Changed node-version to workflows release.yml to 20.
115
+
116
+ ### Added
117
+ - Plugin installation support: `app.use(TvThemeButton)` or `app.use(TvThemeButtonPlugin)`.
118
+ - Explicit export of the style file: `import '@todovue/tv-theme-button/style.css'`.
119
+ - Documentation for usage in SSR and Nuxt 3 applications.
120
+
121
+ ## [1.0.0] - 2025-05-05
122
+
123
+ ### Added
124
+
125
+ - Initial release of `TvThemeButton`
126
+ - Theme toggle functionality between `light` and `dark` modes
127
+ - `change-theme` event to emit the selected theme
128
+
129
+ [1.2.1]: https://github.com/TODOvue/tv-theme-button/pull/9/files
130
+ [1.2.0]: https://github.com/TODOvue/tv-theme-button/pull/8/files
131
+ [1.1.1]: https://github.com/TODOvue/tv-theme-button/pull/7/files
132
+ [1.1.0]: https://github.com/TODOvue/tv-theme-button/pull/6/files
133
+ [1.0.3]: https://github.com/TODOvue/tv-theme-button/pull/5/files
134
+ [1.0.2]: https://github.com/TODOvue/tv-theme-button/pull/4/files
135
+ [1.0.1]: https://github.com/TODOvue/tv-theme-button/pull/3/files
136
+ [1.0.0]: https://github.com/TODOvue/tv-theme-button/pull/2/files
@@ -0,0 +1,392 @@
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 ThemeButton (TvThemeButton)
5
+ A lightweight and customizable Vue 3 theme switcher component that allows users to toggle between light and dark modes. Designed for modern interfaces, it persists the theme preference in localStorage and integrates seamlessly into any Vue 3 project or SSR environment (e.g. Nuxt 3).
6
+
7
+ [![npm](https://img.shields.io/npm/v/@todovue/tv-theme-button.svg)](https://www.npmjs.com/package/@todovue/tv-theme-button)
8
+ [![npm downloads](https://img.shields.io/npm/dm/@todovue/tv-theme-button.svg)](https://www.npmjs.com/package/@todovue/tv-theme-button)
9
+ [![npm total downloads](https://img.shields.io/npm/dt/@todovue/tv-theme-button.svg)](https://www.npmjs.com/package/@todovue/tv-theme-button)
10
+ ![License](https://img.shields.io/github/license/TODOvue/tv-theme-button)
11
+ ![Release Date](https://img.shields.io/github/release-date/TODOvue/tv-theme-button)
12
+ ![Bundle Size](https://img.shields.io/bundlephobia/minzip/@todovue/tv-theme-button)
13
+ ![Node Version](https://img.shields.io/node/v/@todovue/tv-theme-button)
14
+ ![Last Commit](https://img.shields.io/github/last-commit/TODOvue/tv-theme-button)
15
+ ![Stars](https://img.shields.io/github/stars/TODOvue/tv-theme-button?style=social)
16
+
17
+ > Demo: https://ui.todovue.blog/themebutton
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
+ - [Events](#events)
27
+ - [Customization (Styles / Theming)](#customization-styles--theming)
28
+ - [Accessibility](#accessibility)
29
+ - [SSR Notes](#ssr-notes)
30
+ - [Development](#development)
31
+ - [Changelog](https://github.com/TODOvue/tv-theme-button/blob/main/CHANGELOG.md)
32
+ - [Contributing](https://github.com/TODOvue/tv-theme-button/blob/main/CONTRIBUTING.md)
33
+ - [License](https://github.com/TODOvue/tv-theme-button/blob/main/LICENSE)
34
+
35
+ ## Features
36
+ - **Simple theme toggle**: Switch between light and dark modes with a single click
37
+ - **Persistent state**: Automatically saves theme preference to localStorage (key: `theme`)
38
+ - **Animated transition**: Smooth visual toggle animation between states
39
+ - **Bundled SVG icons**: Pre-bundled light and dark mode icons (no external dependencies)
40
+ - **Event emission**: Emits `change-theme` event with the selected theme value
41
+ - **SSR compatible**: Works in both SPA and Server-Side Rendered (Nuxt 3) environments
42
+ - **Lightweight**: Minimal footprint with CSS injected automatically
43
+ - **Vue 3 Composition API**: Built with modern Vue 3 patterns using composables
44
+ - **Tree-shake friendly**: Vue marked as external in library build
45
+ - **TypeScript support**: Includes type definitions
46
+
47
+ ## Installation
48
+ Using npm:
49
+ ```bash
50
+ npm install @todovue/tv-theme-button
51
+ ```
52
+ Using yarn:
53
+ ```bash
54
+ yarn add @todovue/tv-theme-button
55
+ ```
56
+ Using pnpm:
57
+ ```bash
58
+ pnpm add @todovue/tv-theme-button
59
+ ```
60
+
61
+ ## Quick Start (SPA)
62
+ ### Import Styles
63
+ You must explicitly import the component's stylesheet in your application:
64
+
65
+ ```ts
66
+ // main.ts or main.js
67
+ import { createApp } from 'vue'
68
+ import App from './App.vue'
69
+
70
+ // Import the component styles
71
+ import { TvThemeButton } from '@todovue/tv-theme-button'
72
+ import '@todovue/tv-theme-button/style.css' // Import styles
73
+
74
+ const app = createApp(App)
75
+ app.component('TvThemeButton', TvThemeButton)
76
+ app.mount('#app')
77
+ ```
78
+
79
+ ### Global registration (main.js / main.ts):
80
+ ```js
81
+ import { createApp } from 'vue'
82
+ import App from './App.vue'
83
+ import TvThemeButton from '@todovue/tv-theme-button'
84
+ import '@todovue/tv-theme-button/style.css'
85
+
86
+ createApp(App)
87
+ .use(TvThemeButton) // enables <TvThemeButton /> globally
88
+ .mount('#app')
89
+ ```
90
+
91
+ ## Nuxt 4 / SSR Usage
92
+ ### Import Styles in Nuxt Config
93
+ Add the stylesheet to your `nuxt.config.ts`:
94
+
95
+ ```ts
96
+ // nuxt.config.ts
97
+ export default defineNuxtConfig({
98
+ modules: [
99
+ '@todovue/tv-theme-button/nuxt'
100
+ ]
101
+ })
102
+ ```
103
+
104
+ ### Component Registration
105
+ Create a plugin file: `plugins/tv-theme-button.client.ts` (client-only is recommended for localStorage access):
106
+ ```ts
107
+ import { defineNuxtPlugin } from '#app'
108
+ import TvThemeButton from '@todovue/tv-theme-button'
109
+
110
+ export default defineNuxtPlugin(nuxtApp => {
111
+ nuxtApp.vueApp.use(TvThemeButton)
112
+ })
113
+ ```
114
+
115
+ Use anywhere in your app:
116
+ ```vue
117
+ <template>
118
+ <TvThemeButton @change-theme="onThemeChange" />
119
+ </template>
120
+
121
+ <script setup>
122
+ const onThemeChange = (theme) => {
123
+ console.log('Current theme:', theme)
124
+ }
125
+ </script>
126
+ ```
127
+
128
+ ### Optional direct import (no plugin):
129
+ ```vue
130
+ <script setup>
131
+ import { TvThemeButton } from '@todovue/tv-theme-button'
132
+ </script>
133
+
134
+ <template>
135
+ <TvThemeButton @change-theme="handleTheme" />
136
+ </template>
137
+ ```
138
+
139
+ ## Component Registration Options
140
+ | Approach | When to use |
141
+ |------------------------------------------------------------------------------|------------------------------------------------|
142
+ | Global via `app.use(TvThemeButton)` | Many usages across app / design system install |
143
+ | Local named import `{ TvThemeButton }` | Isolated / code-split contexts |
144
+ | Direct default import `import TvThemeButton from '@todovue/tv-theme-button'` | Single usage or manual registration |
145
+
146
+ ## Props
147
+ | Prop Name | Type | Default | Description |
148
+ |---------------|-----------|---------|---------------------------------------------------------------------------------------------------------|
149
+ | `darkIcon` | `String` | `null` | Custom icon for dark mode. Accepts URL (http/https/data:), relative path (/path), or inline SVG string |
150
+ | `lightIcon` | `String` | `null` | Custom icon for light mode. Accepts URL (http/https/data:), relative path (/path), or inline SVG string |
151
+ | `buttonColor` | `String` | `null` | Custom background color for the switch button. Overrides the default theme background. |
152
+ | `knobColor` | `String` | `null` | Custom color for the sliding knob. |
153
+ | `sunColor` | `String` | `null` | Custom color for the sun icon (light mode icon). |
154
+ | `moonColor` | `String` | `null` | Custom color for the moon icon (dark mode icon). |
155
+ | `size` | `String` | `'md'` | Size of the button. Options: `'sm'`, `'md'`, `'lg'`. |
156
+ | `square` | `Boolean` | `false` | If true, makes the button square instead of rounded. |
157
+
158
+ ### Icon Customization
159
+ You can customize the theme icons in three ways:
160
+
161
+ #### 1. Using Image URLs
162
+ ```vue
163
+ <template>
164
+ <TvThemeButton
165
+ dark-icon="https://example.com/moon-icon.png"
166
+ light-icon="https://example.com/sun-icon.png"
167
+ @change-theme="handleTheme"
168
+ />
169
+ </template>
170
+ ```
171
+
172
+ #### 2. Using Local Assets
173
+ ```vue
174
+ <template>
175
+ <TvThemeButton
176
+ dark-icon="/icons/moon.svg"
177
+ light-icon="/icons/sun.svg"
178
+ @change-theme="handleTheme"
179
+ />
180
+ </template>
181
+ ```
182
+
183
+ #### 3. Using Inline SVG
184
+ ```vue
185
+ <template>
186
+ <TvThemeButton
187
+ :dark-icon="darkSvg"
188
+ :light-icon="lightSvg"
189
+ @change-theme="handleTheme"
190
+ />
191
+ </template>
192
+
193
+ <script setup>
194
+ const darkSvg = '<svg viewBox="0 0 24 24"><path d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"/></svg>'
195
+ const lightSvg = '<svg viewBox="0 0 24 24"><path d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"/></svg>'
196
+ </script>
197
+ ```
198
+
199
+ > **Note:** If no custom icons are provided, the component uses built-in default icons.
200
+
201
+ ### Default Behavior
202
+ - Initial theme is loaded from localStorage (key: `theme`)
203
+ - Falls back to `'dark'` if no saved preference exists
204
+ - Icons and animations are built-in
205
+
206
+ ## Events
207
+ | Event name (kebab) | Emits (camel) | Payload Type | Description |
208
+ |--------------------|---------------|---------------------|---------------------------------------------------------------|
209
+ | `change-theme` | `changeTheme` | `'light' \| 'dark'` | Emitted when user toggles theme. Returns current theme value. |
210
+
211
+ ### Usage Example:
212
+ ```vue
213
+ <template>
214
+ <TvThemeButton @change-theme="applyTheme" />
215
+ </template>
216
+
217
+ <script setup>
218
+ const applyTheme = (theme) => {
219
+ // Option 1: Apply CSS class to document
220
+ document.documentElement.setAttribute('data-theme', theme)
221
+
222
+ // Option 2: Update a Pinia/Vuex store
223
+ // useThemeStore().setTheme(theme)
224
+
225
+ // Option 3: Update CSS variables
226
+ if (theme === 'dark') {
227
+ document.documentElement.style.setProperty('--bg-color', '#1a1a1a')
228
+ document.documentElement.style.setProperty('--text-color', '#ffffff')
229
+ } else {
230
+ document.documentElement.style.setProperty('--bg-color', '#ffffff')
231
+ document.documentElement.style.setProperty('--text-color', '#000000')
232
+ }
233
+ }
234
+ </script>
235
+ ```
236
+
237
+ ## Customization (Styles / Theming)
238
+ The component comes with default styles that can be customized using CSS variables or by overriding the scoped styles.
239
+
240
+ ### CSS Variables Override:
241
+ ```css
242
+ /* In your global CSS or component style */
243
+ .tv-theme-button {
244
+ /* Customize the switch background */
245
+ --switch-bg: #e0e0e0;
246
+ --switch-active-bg: #333;
247
+ --switch-size: 60px;
248
+ }
249
+
250
+ .tv-theme-icon {
251
+ /* Customize icon colors */
252
+ --icon-color: currentColor;
253
+ }
254
+ ```
255
+
256
+ ### Custom Styling:
257
+ ```vue
258
+ <style>
259
+ /* Override component styles */
260
+ :deep(.tv-theme-switch) {
261
+ border-radius: 25px;
262
+ padding: 4px;
263
+ background: linear-gradient(to right, #667eea 0%, #764ba2 100%);
264
+ }
265
+
266
+ :deep(.tv-theme-icon) {
267
+ width: 24px;
268
+ height: 24px;
269
+ }
270
+ </style>
271
+ ```
272
+
273
+ ### Integration with Theme Systems:
274
+ ```vue
275
+ <script setup>
276
+ import { TvThemeButton } from '@todovue/tv-theme-button'
277
+ import { useDark, useToggle } from '@vueuse/core'
278
+
279
+ // Example with VueUse
280
+ const isDark = useDark()
281
+
282
+ const handleThemeChange = (theme) => {
283
+ isDark.value = theme === 'dark'
284
+ }
285
+ </script>
286
+
287
+ <template>
288
+ <TvThemeButton @change-theme="handleThemeChange" />
289
+ </template>
290
+ ```
291
+
292
+ ## Accessibility
293
+ - **Keyboard accessible**: The toggle button can be activated via click (mouse/touch)
294
+ - **Visual feedback**: Clear visual indication of current theme state
295
+ - **Semantic HTML**: Uses proper div/span structure with click handlers
296
+
297
+ ### Recommended Improvements:
298
+ For better accessibility, wrap the component or add context:
299
+ ```vue
300
+ <div role="switch" :aria-checked="currentTheme === 'dark'" aria-label="Toggle dark mode">
301
+ <TvThemeButton @change-theme="currentTheme = $event" />
302
+ </div>
303
+ ```
304
+
305
+ ## SSR Notes
306
+ - **localStorage safe**: Component uses `onMounted` lifecycle hook to safely access localStorage only on client-side
307
+ - **No hydration issues**: Initial state is set client-side, preventing SSR/CSR mismatches
308
+ - **Vite compatible**: SVG icons are bundled via Vite's `import.meta.glob` (works in Vite + Nuxt)
309
+ - **Auto CSS injection**: Styles are automatically injected when you import the library
310
+ - **Client-side plugin recommended**: For Nuxt 3, use `.client.ts` suffix to ensure localStorage access
311
+
312
+ ### Preventing Flash of Unstyled Content (FOUC):
313
+ ```html
314
+ <!-- Add to your app.vue or layout -->
315
+ <script setup>
316
+ onMounted(() => {
317
+ const theme = localStorage.getItem('theme') || 'dark'
318
+ document.documentElement.setAttribute('data-theme', theme)
319
+ })
320
+ </script>
321
+ ```
322
+
323
+ ## Roadmap
324
+ | Feature | Status | Version |
325
+ |----------------------------------------------|-------------|---------|
326
+ | Add `defaultTheme` prop | Planned | 1.1.0 |
327
+ | Add `storageKey` prop | Planned | 1.1.0 |
328
+ | Custom icon slots/props | Planned | 1.2.0 |
329
+ | Add ARIA attributes internally | Planned | 1.2.0 |
330
+ | CSS variables for easy theming | Considering | 2.0.0 |
331
+ | Animation customization options | Considering | 2.0.0 |
332
+ | Multiple theme support (not just light/dark) | Considering | 2.0.0 |
333
+ | Expose composable `useThemeButton` publicly | Considering | 2.0.0 |
334
+
335
+ ## Development
336
+ Clone the repository and install dependencies:
337
+ ```bash
338
+ git clone https://github.com/TODOvue/tv-theme-button.git
339
+ cd tv-theme-button
340
+ yarn install
341
+ ```
342
+
343
+ ### Available Scripts:
344
+ ```bash
345
+ yarn dev # Run development server with demo playground
346
+ yarn build # Build library for production
347
+ yarn build:demo # Build demo site for deployment
348
+ ```
349
+
350
+ Local demo is served from Vite using `index.html` + `src/demo` examples.
351
+
352
+ ### Project Structure:
353
+ ```
354
+ tv-theme-button/
355
+ ├── src/
356
+ │ ├── components/
357
+ │ │ └── TvThemeButton.vue # Main component
358
+ │ ├── composable/
359
+ │ │ └── useThemeButton.js # Composable logic
360
+ │ ├── assets/
361
+ │ │ ├── icons/
362
+ │ │ │ ├── dark.svg # Dark mode icon
363
+ │ │ │ └── light.svg # Light mode icon
364
+ │ │ └── scss/ # Styles
365
+ │ ├── entry.ts # Library entry point
366
+ │ └── demo/ # Demo playground
367
+ ├── dist/ # Build output
368
+ └── package.json
369
+ ```
370
+
371
+ ## Contributing
372
+ We welcome contributions! Please see our contributing guidelines:
373
+ - [CONTRIBUTING.md](https://github.com/TODOvue/tv-theme-button/blob/main/CONTRIBUTING.md)
374
+ - [CODE_OF_CONDUCT.md](https://github.com/TODOvue/tv-theme-button/blob/main/CODE_OF_CONDUCT.md)
375
+
376
+ ### How to Contribute:
377
+ 1. Fork the repository
378
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
379
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
380
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
381
+ 5. Open a Pull Request
382
+
383
+ ## License
384
+ MIT © TODOvue
385
+
386
+ See [LICENSE](https://github.com/TODOvue/tv-theme-button/blob/main/LICENSE) for more information.
387
+
388
+ ## Changelog
389
+ See [CHANGELOG.md](https://github.com/TODOvue/tv-theme-button/blob/main/CHANGELOG.md) for version history and release notes.
390
+
391
+ ### Attributions
392
+ Crafted with ❤️ for the TODOvue component ecosystem
@@ -0,0 +1,80 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@todovue/tv-toc` will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.1.1] - 2026-01-27
9
+
10
+ ### Changed
11
+ - Simplified the file list in `package.json` to include only essential assets.
12
+ - Simplified the build configuration by removing demo-specific logic.
13
+ - Enhanced GitHub Actions workflows to automate npm package publishing and GitHub release creation.
14
+ - Moved the `@todovue/tv-demo` component import from main.js to `Demo.vue` to localize its usage.
15
+ - Updated build commands to include `README.md` and `CHANGELOG.md` files in the public directory during the build process.
16
+
17
+ ### Added
18
+ - Included the `src` directory in the `package.json` files list to ensure component source files are bundled in the package distribution.
19
+
20
+ ### Removed
21
+ - Eliminated the global import of the `@todovue/tv-demo` component from `main.js`.
22
+
23
+ ### Dependencies
24
+ - Updated `@todovue/tv-demo` to `^1.4.11`.
25
+ - Updated `vue` to `^3.5.27`.
26
+ - Updated `sass` to `^1.97.3`.
27
+
28
+ ## [1.1.0] - 2026-01-20
29
+
30
+ ### Added
31
+ - Introduced a customizable marker for Table of Contents (ToC) items to allow for personalized bullet styles or icons.
32
+ - Added an active class property to ToC items, enabling specific styling for the currently viewed section to improve navigation clarity.
33
+ - Added `observerOptions` prop to customize IntersectionObserver behavior (rootMargin, threshold).
34
+ - Introduced a scroll progress indicator to the Table of Contents, providing a visual cue of the user's current position within the document.
35
+ - Implemented collapsible sections in the Table of Contents, allowing users to toggle the visibility of subsections for a cleaner, more focused navigation experience.
36
+ - Introduced animated active indicators to the Table of Contents, providing smooth transitions as the user scrolls through different sections.
37
+ - Added customizable color properties for ToC elements, allowing for deeper integration with specific brand palettes.
38
+
39
+ ### Dependencies
40
+ - Updated `@todovue/tv-demo` to `^1.4.4`.
41
+ - Updated `sass` to `^1.97.2`.
42
+ - Updated `vite` to `^7.3.1`.
43
+
44
+ ## [1.0.2] - 2025-12-27
45
+
46
+ ### Added
47
+ - Added automatic publishing to the TODOvue cPanel in `release.yml` for each release, simplifying package distribution and updates.
48
+ - Added `package-lock.json` to the repository to ensure dependency consistency and facilitate version management across development and production environments.
49
+
50
+ ### Changed
51
+ - Changed the `base` option in `vite.config.js` for website deployment in cpanel.
52
+
53
+ ### Fixed
54
+ - Fixed repository URL in `package.json` to point to the correct GitHub repository.
55
+ - Fixed the token configuration used to generate the package in the GitHub Actions workflow `release.yml`.
56
+
57
+ ### Dependencies
58
+ - Updated dependency versions in `package.json` to maintain compatibility and benefit from improvements and bug fixes in the used libraries.
59
+
60
+ ## [1.0.1] - 2025-11-28
61
+
62
+ ### Fixed
63
+ - Correct CSS file extension for Table of Contents styles.
64
+
65
+ ## [1.0.0] - 2025-11-28
66
+
67
+ ### Added
68
+ - Initial stable release of `@todovue/tv-toc`.
69
+ - `TvToc` Vue 3 component to render a table of contents (TOC) from a `toc` object.
70
+ - Support for nested sections via `children` links.
71
+ - Smooth scrolling to headings using `scrollIntoView` and URL hash update with `history.pushState`.
72
+ - `useToc` composable with `scrollToId` and `formatId` helpers.
73
+ - Minimal default styles and BEM-like CSS classes for easy customization.
74
+ - Vite demo with basic and blog-like TOC examples.
75
+
76
+ [1.1.1]: https://github.com/TODOvue/tv-toc/pull/5/files
77
+ [1.1.0]: https://github.com/TODOvue/tv-toc/pull/4/files
78
+ [1.0.2]: https://github.com/TODOvue/tv-toc/pull/3/files
79
+ [1.0.1]: https://github.com/TODOvue/tv-toc/pull/2/files
80
+ [1.0.0]: https://github.com/TODOvue/tv-toc/pull/1/files