nuxt-ui-elements 0.1.24 → 0.1.26

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 (34) hide show
  1. package/README.md +199 -160
  2. package/dist/module.d.mts +1 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +8 -1
  5. package/dist/runtime/composables/useUploadManager/index.d.ts +368 -0
  6. package/dist/runtime/composables/useUploadManager/index.js +369 -0
  7. package/dist/runtime/composables/useUploadManager/plugins/image-compressor.d.ts +56 -0
  8. package/dist/runtime/composables/useUploadManager/plugins/image-compressor.js +133 -0
  9. package/dist/runtime/composables/useUploadManager/plugins/index.d.ts +3 -0
  10. package/dist/runtime/composables/useUploadManager/plugins/index.js +3 -0
  11. package/dist/runtime/composables/useUploadManager/plugins/storage/azure-datalake.d.ts +45 -0
  12. package/dist/runtime/composables/useUploadManager/plugins/storage/azure-datalake.js +108 -0
  13. package/dist/runtime/composables/useUploadManager/plugins/storage/index.d.ts +10 -0
  14. package/dist/runtime/composables/useUploadManager/plugins/storage/index.js +1 -0
  15. package/dist/runtime/composables/useUploadManager/plugins/thumbnail-generator.d.ts +7 -0
  16. package/dist/runtime/composables/useUploadManager/plugins/thumbnail-generator.js +66 -0
  17. package/dist/runtime/composables/useUploadManager/types.d.ts +220 -0
  18. package/dist/runtime/composables/useUploadManager/types.js +3 -0
  19. package/dist/runtime/composables/useUploadManager/validators/allowed-file-types.d.ts +5 -0
  20. package/dist/runtime/composables/useUploadManager/validators/allowed-file-types.js +13 -0
  21. package/dist/runtime/composables/useUploadManager/validators/duplicate-file.d.ts +13 -0
  22. package/dist/runtime/composables/useUploadManager/validators/duplicate-file.js +27 -0
  23. package/dist/runtime/composables/useUploadManager/validators/index.d.ts +4 -0
  24. package/dist/runtime/composables/useUploadManager/validators/index.js +4 -0
  25. package/dist/runtime/composables/useUploadManager/validators/max-file-size.d.ts +5 -0
  26. package/dist/runtime/composables/useUploadManager/validators/max-file-size.js +13 -0
  27. package/dist/runtime/composables/useUploadManager/validators/max-files.d.ts +5 -0
  28. package/dist/runtime/composables/useUploadManager/validators/max-files.js +13 -0
  29. package/dist/runtime/index.d.ts +1 -0
  30. package/dist/runtime/index.js +1 -0
  31. package/dist/runtime/types/index.d.ts +3 -0
  32. package/dist/runtime/types/index.js +3 -0
  33. package/dist/types.d.mts +2 -0
  34. package/package.json +9 -2
package/README.md CHANGED
@@ -1,12 +1,3 @@
1
- <!--
2
- Get your module up and running quickly.
3
-
4
- Find and replace all on all files (CMD+SHIFT+F):
5
- - Name: My Module
6
- - Package name: my-module
7
- - Description: My new Nuxt module
8
- -->
9
-
10
1
  # Nuxt UI Elements
11
2
 
12
3
  [![npm version][npm-version-src]][npm-version-href]
@@ -14,37 +5,49 @@ Find and replace all on all files (CMD+SHIFT+F):
14
5
  [![License][license-src]][license-href]
15
6
  [![Nuxt][nuxt-src]][nuxt-href]
16
7
 
17
- A collection of beautiful, animated UI components for Nuxt applications. Built with Vue 3 and designed to work seamlessly with Nuxt UI.
8
+ **A growing collection of components and utilities that extend [@nuxt/ui](https://ui.nuxt.com) with enhanced functionality.**
9
+
10
+ This module extends Nuxt UI with additional components and utilities designed to integrate with Nuxt UI's design system.
11
+
12
+ > **Early Development Notice**: This project is in early development. APIs, component interfaces, and utilities are subject to change in future releases. Please use with caution in production environments.
18
13
 
19
14
  - [✨ &nbsp;Release Notes](/CHANGELOG.md)
20
15
 
21
16
  ## Features
22
17
 
23
- - **FlickeringGrid** - Animated canvas-based grid background with gradient effects
24
- - 🌟 **ShimmerButton** - Animated button with elegant shimmer effect
25
- - 🎨 **Dark Mode Support** - Automatic theme switching with customizable colors
26
- - 🚀 **Performance Optimized** - Uses IntersectionObserver and only animates when visible
27
- - 📦 **Auto-import** - Components are automatically available in your app
18
+ - 🧩 **Additional Components** - Extended component library built on top of Nuxt UI
19
+ - 🎨 **Themeable** - Seamlessly extends Nuxt UI's theme system with color variants
20
+ - 📦 **Tree-shakeable Utilities** - Standard utilities via `#std` for common tasks
21
+ - 🔄 **Auto-import** - Components and composables are automatically available
28
22
  - 🎯 **TypeScript** - Full type safety out of the box
29
- - ⚡️ **Lightweight** - Zero external dependencies
23
+ - 🌙 **Dark Mode** - Automatic theme switching compatible with Nuxt UI
24
+
25
+ ## Requirements
30
26
 
31
- ## Quick Setup
27
+ This module requires [@nuxt/ui](https://ui.nuxt.com) v4.0.0 or higher.
32
28
 
33
- 1. Install the module to your Nuxt application:
29
+ ## Installation
34
30
 
35
31
  ```bash
32
+ # pnpm
36
33
  pnpm add nuxt-ui-elements
34
+
35
+ # npm
36
+ npm install nuxt-ui-elements
37
+
38
+ # yarn
39
+ yarn add nuxt-ui-elements
37
40
  ```
38
41
 
39
- 2. Add the module to your `nuxt.config.ts`:
42
+ Add the module to your `nuxt.config.ts`:
40
43
 
41
- ```ts
44
+ ```typescript
42
45
  export default defineNuxtConfig({
43
- modules: ["@nuxt/ui", "nuxt-ui-elements"],
46
+ modules: ['nuxt-ui-elements']
44
47
  })
45
48
  ```
46
49
 
47
- 3. Import the module's CSS in your main CSS file (e.g., `assets/css/main.css`):
50
+ Import the module's CSS in your main CSS file (e.g., `assets/css/main.css`):
48
51
 
49
52
  ```css
50
53
  @import "tailwindcss";
@@ -54,196 +57,232 @@ export default defineNuxtConfig({
54
57
 
55
58
  That's it! You can now use Nuxt UI Elements in your Nuxt app ✨
56
59
 
57
- > **Note:** This module requires `@nuxt/ui` v4.x as a peer dependency. The CSS import is required for Tailwind v4 to properly scan and generate styles from the component themes.
60
+ > **Note:** The CSS import is required for Tailwind v4 to properly scan and generate styles from the component themes.
58
61
 
59
62
  ## Usage
60
63
 
61
- ### FlickeringGrid
64
+ Components and composables are automatically imported. Standard utilities (`#std`) are available via explicit imports.
65
+
66
+ ### Dialog Components
67
+
68
+ The module provides two dialog components via the `useDialog` composable: Alert and Confirm dialogs.
62
69
 
63
- A beautiful animated grid background component perfect for hero sections and landing pages.
70
+ #### Alert Dialog
71
+
72
+ Display informational messages to users:
64
73
 
65
74
  ```vue
75
+ <script setup>
76
+ const { alert } = useDialog()
77
+
78
+ function showAlert() {
79
+ alert({
80
+ title: 'Success!',
81
+ description: 'Your changes have been saved.',
82
+ icon: 'i-lucide-check-circle',
83
+ label: 'Got it',
84
+ color: 'success'
85
+ })
86
+ }
87
+ </script>
88
+
66
89
  <template>
67
- <div class="relative w-full h-screen">
68
- <UiElementsFlickeringGrid
69
- :square-size="7"
70
- :grid-gap="10"
71
- gradient-direction="left-right"
72
- gradient-end-color="white"
73
- :flicker-speed="0.2"
74
- class="z-0" />
75
- <div class="relative z-10">
76
- <!-- Your content here -->
77
- </div>
78
- </div>
90
+ <UButton @click="showAlert">Show Alert</UButton>
79
91
  </template>
80
92
  ```
81
93
 
82
- #### Props
83
-
84
- | Prop | Type | Default | Description |
85
- | ------------------------ | -------- | -------------- | -------------------------------------- |
86
- | `squareSize` | `number` | `4` | Size of each grid square in pixels |
87
- | `gridGap` | `number` | `6` | Gap between grid squares |
88
- | `flickerChance` | `number` | `0.3` | Probability of flicker per frame |
89
- | `flickerSpeed` | `number` | `1` | Animation speed multiplier |
90
- | `gradientDirection` | `string` | `'left-right'` | Gradient direction (see options below) |
91
- | `gradientStartColor` | `string` | `'#aaf'` | Light mode gradient start color |
92
- | `gradientEndColor` | `string` | `'#fff'` | Light mode gradient end color |
93
- | `flickerColor` | `string` | `'#fff'` | Light mode flicker color |
94
- | `darkGradientStartColor` | `string` | `'#23272f'` | Dark mode gradient start color |
95
- | `darkGradientEndColor` | `string` | `'#353b45'` | Dark mode gradient end color |
96
- | `darkFlickerColor` | `string` | `'#6b7280'` | Dark mode flicker color |
97
- | `maxOpacity` | `number` | `0.3` | Maximum opacity of grid squares |
98
- | `width` | `number` | - | Custom width (defaults to container) |
99
- | `height` | `number` | - | Custom height (defaults to container) |
100
- | `class` | `string` | - | Additional CSS classes |
101
-
102
- #### Gradient Directions
103
-
104
- - `left-right`
105
- - `right-left`
106
- - `top-bottom`
107
- - `bottom-top`
108
- - `in-out` (radial from center)
109
- - `out-in` (radial to center)
110
- - `top-left-bottom-right`
111
- - `bottom-right-top-left`
112
-
113
- ### ShimmerButton
114
-
115
- An animated button component with an elegant shimmer effect, perfect for call-to-action buttons and hero sections.
94
+ **Alert Dialog API:**
95
+
96
+ | Property | Type | Default | Description |
97
+ |----------|------|---------|-------------|
98
+ | `title` | `string` | `''` | Dialog title |
99
+ | `description` | `string` | `''` | Dialog description/message |
100
+ | `icon` | `string` | `undefined` | Icon name (e.g., 'i-lucide-info') |
101
+ | `label` | `string` | `'Ok'` | Dismiss button label |
102
+ | `color` | `'primary' \| 'secondary' \| 'success' \| 'info' \| 'warning' \| 'error' \| 'neutral'` | `'neutral'` | Color theme |
103
+ | `variant` | `'solid' \| 'outline'` | `'solid'` | Dialog variant |
104
+ | `onDismiss` | `() => void \| Promise<void>` | `() => {}` | Callback when dismissed |
105
+ | `ui` | `object` | `{}` | Custom UI classes override |
106
+
107
+ #### Confirm Dialog
108
+
109
+ Request user confirmation with async support:
116
110
 
117
111
  ```vue
112
+ <script setup>
113
+ const { confirm } = useDialog()
114
+
115
+ async function handleDelete() {
116
+ confirm({
117
+ title: 'Delete Item',
118
+ description: 'Are you sure? This action cannot be undone.',
119
+ confirmLabel: 'Delete',
120
+ dismissLabel: 'Cancel',
121
+ color: 'error',
122
+ onConfirm: async () => {
123
+ // Async operations are supported
124
+ await deleteItem()
125
+ // Dialog shows loading state and success feedback automatically
126
+ },
127
+ onDismiss: () => {
128
+ console.log('User cancelled')
129
+ }
130
+ })
131
+ }
132
+ </script>
133
+
118
134
  <template>
119
- <UEButtonShimmer
120
- label="Get Started"
121
- size="lg"
122
- shimmer-color="#60a5fa"
123
- background="rgba(59, 130, 246, 1)"
124
- :speed="2.5"
125
- @click="handleClick" />
135
+ <UButton @click="handleDelete">Delete</UButton>
126
136
  </template>
127
137
  ```
128
138
 
129
- #### Props
139
+ **Confirm Dialog API:**
130
140
 
131
- | Prop | Type | Default | Description |
132
- | -------------- | -------- | -------------------- | ------------------------------------------- |
133
- | `label` | `string` | - | Button label text |
134
- | `shimmerColor` | `string` | `'#ffffff'` | Color of the shimmer effect |
135
- | `shimmerSize` | `string` | `'0.05em'` | Size of the shimmer effect |
136
- | `speed` | `number` | `3` | Animation speed in seconds (lower = faster) |
137
- | `background` | `string` | `'rgba(0, 0, 0, 1)'` | Background color of the button |
138
- | `radius` | `string` | `'100px'` | Border radius of the button |
139
- | `size` | `string` | `'md'` | Button size: `xs`, `sm`, `md`, `lg`, `xl` |
140
- | `class` | `string` | - | Additional CSS classes |
141
- | `ui` | `object` | - | UI slot customization for advanced styling |
141
+ | Property | Type | Default | Description |
142
+ |----------|------|---------|-------------|
143
+ | `title` | `string` | `''` | Dialog title |
144
+ | `description` | `string` | `''` | Dialog description/message |
145
+ | `icon` | `boolean` | `true` | Show icon (auto-selected based on color) |
146
+ | `confirmLabel` | `string` | `'Yes'` | Confirm button label |
147
+ | `dismissLabel` | `string` | `'No'` | Dismiss button label |
148
+ | `color` | `'primary' \| 'secondary' \| 'success' \| 'info' \| 'warning' \| 'error' \| 'neutral'` | `'neutral'` | Color theme |
149
+ | `variant` | `'solid' \| 'outline'` | `'solid'` | Dialog variant |
150
+ | `close` | `boolean` | `false` | Show close button in header |
151
+ | `onConfirm` | `() => void \| Promise<void>` | `() => {}` | Callback when confirmed (supports async) |
152
+ | `onDismiss` | `() => void \| Promise<void>` | `() => {}` | Callback when dismissed |
153
+ | `ui` | `object` | `{}` | Custom UI classes override |
142
154
 
143
- #### Slots
155
+ **Async Support**: When `onConfirm` returns a Promise, the dialog automatically shows loading state and displays success/error feedback before closing.
144
156
 
145
- - `leading` - Content before the label (e.g., icons)
146
- - `default` - Main button content (overrides `label` prop)
147
- - `trailing` - Content after the label (e.g., icons)
157
+ ## Standard Utilities (`#std`)
148
158
 
149
- #### Events
159
+ The module provides tree-shakeable utility functions via the `#std` alias. These are **not** auto-imported and must be explicitly imported.
150
160
 
151
- - `click` - Emitted when the button is clicked
161
+ ### Date Utilities
152
162
 
153
- #### Examples
163
+ Comprehensive date manipulation built on `@internationalized/date`. Import the entire module or individual functions:
154
164
 
155
- **Basic Usage:**
165
+ ```typescript
166
+ import std from '#std'
156
167
 
157
- ```vue
158
- <UEButtonShimmer label="Click Me" />
159
- ```
168
+ const nextMonth = std.date.add(std.date.today(), 1, 'month')
169
+ const formatted = std.date.format(new Date(), 'YYYY-MM-DD')
160
170
 
161
- **With Custom Colors:**
171
+ // Or import individual functions
172
+ import { add, format, today, relative } from '#std/date'
162
173
 
163
- ```vue
164
- <UEButtonShimmer label="Primary Action" shimmer-color="#a78bfa" background="rgba(139, 92, 246, 1)" />
165
- ```
174
+ // Add/subtract time
175
+ const nextMonth = add(today(), 1, 'month')
176
+ const lastWeek = subtract(new Date(), 7, 'day')
166
177
 
167
- **Different Sizes:**
178
+ // Format dates (Day.js-compatible tokens)
179
+ format(new Date(), 'YYYY-MM-DD') // "2024-01-15"
180
+ format(new Date(), 'MMMM D, YYYY') // "January 15, 2024"
181
+ format(new Date(), 'MMM DD, YYYY h:mm A') // "Jan 15, 2024 3:30 PM"
168
182
 
169
- ```vue
170
- <UEButtonShimmer label="Small" size="sm" />
171
- <UEButtonShimmer label="Medium" size="md" />
172
- <UEButtonShimmer label="Large" size="lg" />
173
- <UEButtonShimmer label="Extra Large" size="xl" />
174
- ```
183
+ // Relative time
184
+ relative(someDate) // "2 days ago" or "in 3 months"
175
185
 
176
- **With Slots:**
186
+ // Date comparisons
187
+ isBefore(date1, date2)
188
+ isAfter(date1, date2)
189
+ isSame(date1, date2)
190
+ isBetween(date, startDate, endDate)
177
191
 
178
- ```vue
179
- <UEButtonShimmer>
180
- <template #leading>
181
- <Icon name="i-heroicons-arrow-right" />
182
- </template>
183
- Get Started
184
- <template #trailing>
185
- <Icon name="i-heroicons-arrow-right" />
186
- </template>
187
- </UEButtonShimmer>
188
- ```
189
-
190
- **Fast Animation:**
191
-
192
- ```vue
193
- <UEButtonShimmer label="Fast Shimmer" :speed="1.5" />
194
- ```
192
+ // Date manipulation
193
+ set(someDate, { day: 15, month: 3 })
194
+ startOf(someDate, 'month')
195
+ endOf(someDate, 'week')
195
196
 
196
- ## Configuration
197
+ // Calculate differences
198
+ diff(date1, date2, 'days') // number of days between dates
197
199
 
198
- You can customize the component prefix in your `nuxt.config.ts`:
200
+ // Conversions
201
+ toDate(dateValue) // Convert to JavaScript Date
202
+ asCalendarDate(date) // Date without time
203
+ asCalendarDateTime(date) // Date with time, no timezone
204
+ asZonedDateTime(date, 'UTC') // Date with timezone
199
205
 
200
- ```ts
201
- export default defineNuxtConfig({
202
- modules: ["nuxt-ui-elements"],
203
- uiElements: {
204
- prefix: "Custom", // Components will be named CustomFlickeringGrid
205
- },
206
- })
206
+ // Utilities
207
+ today() // Current date
208
+ now() // Current date and time
209
+ parse('2024-01-15') // Parse date string
207
210
  ```
208
211
 
212
+ **Available Functions:**
213
+
214
+ | Function | Description |
215
+ |----------|-------------|
216
+ | `add(date, amount, unit)` | Add time to a date |
217
+ | `subtract(date, amount, unit)` | Subtract time from a date |
218
+ | `set(date, values)` | Set specific date/time values |
219
+ | `format(date, formatString, locale?)` | Format date with Day.js tokens |
220
+ | `relative(date, locale?)` | Get relative time string |
221
+ | `toDate(input, timeZone?)` | Convert to JavaScript Date |
222
+ | `asCalendarDate(input)` | Convert to date without time |
223
+ | `asCalendarDateTime(input)` | Convert to date with time |
224
+ | `asZonedDateTime(input, timeZone?)` | Convert to date with timezone |
225
+ | `isBefore(date1, date2)` | Check if date1 is before date2 |
226
+ | `isAfter(date1, date2)` | Check if date1 is after date2 |
227
+ | `isSame(date1, date2)` | Check if dates are equal |
228
+ | `isBetween(date, start, end, inclusive?)` | Check if date is in range |
229
+ | `diff(date1, date2, unit?)` | Calculate difference between dates |
230
+ | `startOf(date, unit, locale?)` | Get start of time period |
231
+ | `endOf(date, unit, locale?)` | Get end of time period |
232
+ | `today(timeZone?)` | Get today's date |
233
+ | `now(timeZone?)` | Get current date and time |
234
+ | `parse(dateString)` | Parse YYYY-MM-DD string |
235
+
236
+ Plus re-exported utilities: `isSameDay`, `isSameMonth`, `isSameYear`, `isToday`, `isWeekend`, `getDayOfWeek`, `getWeeksInMonth`, `getLocalTimeZone`
237
+
238
+ **Tree-shakeable**: All utilities under `#std` are tree-shakeable. Only imported functions will be included in your bundle, whether you import the entire module or individual functions.
239
+
209
240
  ## Contribution
210
241
 
211
242
  <details>
212
243
  <summary>Local development</summary>
213
-
244
+
214
245
  ```bash
215
246
  # Install dependencies
216
- npm install
217
-
247
+ pnpm install
248
+
218
249
  # Generate type stubs
219
- npm run dev:prepare
220
-
250
+ pnpm run dev:prepare
251
+
221
252
  # Develop with the playground
222
- npm run dev
223
-
253
+ pnpm run dev
254
+
224
255
  # Build the playground
225
- npm run dev:build
226
-
256
+ pnpm run dev:build
257
+
227
258
  # Run ESLint
228
- npm run lint
229
-
259
+ pnpm run lint
260
+
230
261
  # Run Vitest
231
- npm run test
232
- npm run test:watch
233
-
262
+ pnpm run test
263
+ pnpm run test:watch
264
+
234
265
  # Release new version
235
- npm run release
266
+ pnpm run release
236
267
  ```
237
268
 
238
269
  </details>
239
270
 
271
+ ## License
272
+
273
+ MIT
274
+
275
+ ## Repository
276
+
277
+ [https://github.com/genu/nuxt-ui-elements](https://github.com/genu/nuxt-ui-elements)
278
+
240
279
  <!-- Badges -->
241
280
 
242
- [npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
243
- [npm-version-href]: https://npmjs.com/package/my-module
244
- [npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
245
- [npm-downloads-href]: https://npm.chart.dev/my-module
246
- [license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
247
- [license-href]: https://npmjs.com/package/my-module
281
+ [npm-version-src]: https://img.shields.io/npm/v/nuxt-ui-elements/latest.svg?style=flat&colorA=020420&colorB=00DC82
282
+ [npm-version-href]: https://npmjs.com/package/nuxt-ui-elements
283
+ [npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-ui-elements.svg?style=flat&colorA=020420&colorB=00DC82
284
+ [npm-downloads-href]: https://npm.chart.dev/nuxt-ui-elements
285
+ [license-src]: https://img.shields.io/npm/l/nuxt-ui-elements.svg?style=flat&colorA=020420&colorB=00DC82
286
+ [license-href]: https://npmjs.com/package/nuxt-ui-elements
248
287
  [nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
249
288
  [nuxt-href]: https://nuxt.com
package/dist/module.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
+ export * from '../dist/runtime/types/index.js';
2
3
 
3
4
  interface ModuleOptions {
4
5
  /**
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-ui-elements",
3
3
  "configKey": "uiElements",
4
- "version": "0.1.24",
4
+ "version": "0.1.26",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { addTemplate, defineNuxtModule, createResolver, addImportsDir } from '@nuxt/kit';
1
+ import { addTemplate, defineNuxtModule, createResolver, addImportsDir, addImports } from '@nuxt/kit';
2
2
  import { kebabCase } from 'scule';
3
3
 
4
4
  const dialogConfirm = (options) => ({
@@ -251,7 +251,14 @@ const module$1 = defineNuxtModule({
251
251
  addTemplates(optionsWithTheme);
252
252
  nuxt.options.css.push(resolver.resolve("./runtime/index.css"));
253
253
  addImportsDir(resolver.resolve("./runtime/composables"));
254
+ addImports([
255
+ {
256
+ name: "useUploadManager",
257
+ from: resolver.resolve("./runtime/composables/useUploadManager")
258
+ }
259
+ ]);
254
260
  nuxt.options.alias["#std"] = resolver.resolve("./runtime/utils/std");
261
+ nuxt.options.alias["#ui-elements"] = resolver.resolve("./runtime");
255
262
  }
256
263
  });
257
264