nuxt-ui-elements 0.1.3 → 0.1.6

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
@@ -21,6 +21,7 @@ A collection of beautiful, animated UI components for Nuxt applications. Built w
21
21
  ## Features
22
22
 
23
23
  - ✨ **FlickeringGrid** - Animated canvas-based grid background with gradient effects
24
+ - 🌟 **ShimmerButton** - Animated button with elegant shimmer effect
24
25
  - 🎨 **Dark Mode Support** - Automatic theme switching with customizable colors
25
26
  - 🚀 **Performance Optimized** - Uses IntersectionObserver and only animates when visible
26
27
  - 📦 **Auto-import** - Components are automatically available in your app
@@ -100,6 +101,92 @@ A beautiful animated grid background component perfect for hero sections and lan
100
101
  - `top-left-bottom-right`
101
102
  - `bottom-right-top-left`
102
103
 
104
+ ### ShimmerButton
105
+
106
+ An animated button component with an elegant shimmer effect, perfect for call-to-action buttons and hero sections.
107
+
108
+ ```vue
109
+ <template>
110
+ <UEButtonShimmer
111
+ label="Get Started"
112
+ size="lg"
113
+ shimmer-color="#60a5fa"
114
+ background="rgba(59, 130, 246, 1)"
115
+ :speed="2.5"
116
+ @click="handleClick"
117
+ />
118
+ </template>
119
+ ```
120
+
121
+ #### Props
122
+
123
+ | Prop | Type | Default | Description |
124
+ | --------------- | -------- | -------------------- | ------------------------------------------------ |
125
+ | `label` | `string` | - | Button label text |
126
+ | `shimmerColor` | `string` | `'#ffffff'` | Color of the shimmer effect |
127
+ | `shimmerSize` | `string` | `'0.05em'` | Size of the shimmer effect |
128
+ | `speed` | `number` | `3` | Animation speed in seconds (lower = faster) |
129
+ | `background` | `string` | `'rgba(0, 0, 0, 1)'` | Background color of the button |
130
+ | `radius` | `string` | `'100px'` | Border radius of the button |
131
+ | `size` | `string` | `'md'` | Button size: `xs`, `sm`, `md`, `lg`, `xl` |
132
+ | `class` | `string` | - | Additional CSS classes |
133
+ | `ui` | `object` | - | UI slot customization for advanced styling |
134
+
135
+ #### Slots
136
+
137
+ - `leading` - Content before the label (e.g., icons)
138
+ - `default` - Main button content (overrides `label` prop)
139
+ - `trailing` - Content after the label (e.g., icons)
140
+
141
+ #### Events
142
+
143
+ - `click` - Emitted when the button is clicked
144
+
145
+ #### Examples
146
+
147
+ **Basic Usage:**
148
+ ```vue
149
+ <UEButtonShimmer label="Click Me" />
150
+ ```
151
+
152
+ **With Custom Colors:**
153
+ ```vue
154
+ <UEButtonShimmer
155
+ label="Primary Action"
156
+ shimmer-color="#a78bfa"
157
+ background="rgba(139, 92, 246, 1)"
158
+ />
159
+ ```
160
+
161
+ **Different Sizes:**
162
+ ```vue
163
+ <UEButtonShimmer label="Small" size="sm" />
164
+ <UEButtonShimmer label="Medium" size="md" />
165
+ <UEButtonShimmer label="Large" size="lg" />
166
+ <UEButtonShimmer label="Extra Large" size="xl" />
167
+ ```
168
+
169
+ **With Slots:**
170
+ ```vue
171
+ <UEButtonShimmer>
172
+ <template #leading>
173
+ <Icon name="i-heroicons-arrow-right" />
174
+ </template>
175
+ Get Started
176
+ <template #trailing>
177
+ <Icon name="i-heroicons-arrow-right" />
178
+ </template>
179
+ </UEButtonShimmer>
180
+ ```
181
+
182
+ **Fast Animation:**
183
+ ```vue
184
+ <UEButtonShimmer
185
+ label="Fast Shimmer"
186
+ :speed="1.5"
187
+ />
188
+ ```
189
+
103
190
  ## Configuration
104
191
 
105
192
  You can customize the component prefix in your `nuxt.config.ts`:
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.3",
4
+ "version": "0.1.6",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -19,10 +19,9 @@ const module$1 = defineNuxtModule({
19
19
  logger.error("[nuxt-ui-elements] @nuxt/ui is required. Please install it");
20
20
  }
21
21
  addComponentsDir({
22
- path: resolver.resolve("./runtime/components/background"),
22
+ path: resolver.resolve("./runtime/components"),
23
23
  pathPrefix: false,
24
- prefix: `${options.prefix}Background`,
25
- global: true
24
+ prefix: options.prefix
26
25
  });
27
26
  }
28
27
  });
@@ -0,0 +1,137 @@
1
+ import type { ColorInput } from "../../composables/useColorResolver.js";
2
+ /**
3
+ * Aurora - An animated aurora background component with gradient effects
4
+ *
5
+ * A beautiful CSS-based gradient animation that creates flowing aurora-like effects.
6
+ * Perfect for hero sections, landing pages, or anywhere you want eye-catching backgrounds.
7
+ */
8
+ export type AuroraVariant = "calm" | "energetic" | "cosmic";
9
+ export interface AuroraProps {
10
+ /**
11
+ * Pin the aurora to a specific corner or edge of the container.
12
+ *
13
+ * When set, creates a radial mask that constrains the aurora effect to originate from
14
+ * the specified position, creating a spotlight or glow effect from that corner/edge.
15
+ *
16
+ * When undefined, aurora flows freely across the entire container without masking.
17
+ *
18
+ * Use cases:
19
+ * - 'top-right': Glow from top-right corner (perfect for hero sections)
20
+ * - 'bottom-left': Accent from bottom corner
21
+ * - 'top': Top edge glow (header backgrounds)
22
+ * - undefined: Full-screen flowing effect (landing pages)
23
+ *
24
+ * @default 'top-right'
25
+ */
26
+ pin?: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
27
+ /**
28
+ * Color for the aurora gradient. Supports:
29
+ * - Nuxt UI semantic: 'primary', 'secondary', 'success', 'info', 'warning', 'error', 'neutral'
30
+ * - Tailwind colors: 'blue-500', 'red-600', 'purple-400', etc.
31
+ * - Direct values: '#3b82f6', 'oklch(0.6 0.15 250)', 'rgb(59, 130, 246)'
32
+ *
33
+ * The component automatically generates multiple gradient shades from this base color
34
+ * with different lightness values for a rich, multi-tone aurora effect.
35
+ *
36
+ * @example 'primary' - Uses Nuxt UI theme primary color
37
+ * @example 'purple-500' - Tailwind purple
38
+ * @example '#8b5cf6' - Direct hex value
39
+ *
40
+ * @default 'primary'
41
+ */
42
+ color?: ColorInput;
43
+ /**
44
+ * Speed of the aurora animation (0-100, where 100 is fastest).
45
+ *
46
+ * Controls how quickly the aurora gradient flows across the screen.
47
+ * - 0: Paused (no animation)
48
+ * - 1-30: Slow, calm movement
49
+ * - 40-60: Medium, steady flow
50
+ * - 70-100: Fast, energetic motion
51
+ *
52
+ * Range: 0-100
53
+ * @default 50
54
+ */
55
+ speed?: number;
56
+ /**
57
+ * Opacity/visibility of the aurora effect (0-100).
58
+ *
59
+ * Controls the overall transparency of the aurora gradient overlay.
60
+ * Does NOT affect blur amount - use `variant` for preset blur configurations.
61
+ *
62
+ * - 0: Completely invisible
63
+ * - 30: Subtle, gentle glow
64
+ * - 50: Balanced visibility
65
+ * - 80-100: Bold, prominent effect
66
+ *
67
+ * Range: 0-100
68
+ * @default 50
69
+ */
70
+ opacity?: number;
71
+ /**
72
+ * Lightness adjustment for the base color in OKLCH color space (0-100).
73
+ *
74
+ * Controls the brightness/saturation of the generated gradient colors.
75
+ * - Lower values (30-50): Darker, more saturated colors (better for dark mode)
76
+ * - Higher values (60-80): Lighter, pastel colors (better for light mode)
77
+ *
78
+ * The component automatically adjusts this for dark mode, but you can override
79
+ * using the `dark` prop for custom dark mode appearance.
80
+ *
81
+ * Range: 0-100
82
+ * @default 70 (light mode), 40 (dark mode)
83
+ */
84
+ lightness?: number;
85
+ /**
86
+ * Dark mode overrides for color, lightness, and opacity.
87
+ *
88
+ * Allows you to customize the aurora appearance specifically for dark mode.
89
+ * Any property not specified will use the default light mode value.
90
+ *
91
+ * @example { color: 'blue-400', lightness: 30, opacity: 60 }
92
+ */
93
+ dark?: {
94
+ color?: ColorInput;
95
+ lightness?: number;
96
+ opacity?: number;
97
+ };
98
+ /**
99
+ * Animation style variant with preset configurations.
100
+ *
101
+ * When set, overrides `speed`, `opacity`, and blur settings with carefully tuned presets.
102
+ * - 'calm': Slow, gentle, heavily blurred (meditative feel)
103
+ * - 'energetic': Fast, vibrant, lightly blurred (dynamic feel)
104
+ * - 'cosmic': Medium speed, high opacity, moderate blur (space-like effect)
105
+ *
106
+ * Leave undefined to manually control speed and opacity.
107
+ */
108
+ variant?: AuroraVariant;
109
+ /**
110
+ * Reverse the animation direction.
111
+ *
112
+ * When true, the aurora flows in the opposite direction.
113
+ *
114
+ * @default false
115
+ */
116
+ reverse?: boolean;
117
+ /**
118
+ * Additional CSS classes for the container element.
119
+ */
120
+ class?: any;
121
+ }
122
+ export interface AuroraSlots {
123
+ /**
124
+ * Default slot content rendered on top of the aurora background.
125
+ *
126
+ * Content is positioned with z-index above the aurora effect.
127
+ */
128
+ default(): any;
129
+ }
130
+ declare const _default: typeof __VLS_export;
131
+ export default _default;
132
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<AuroraProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AuroraProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, AuroraSlots>;
133
+ type __VLS_WithSlots<T, S> = T & {
134
+ new (): {
135
+ $slots: S;
136
+ };
137
+ };
@@ -0,0 +1,147 @@
1
+ <script>
2
+
3
+ </script>
4
+
5
+ <script setup>
6
+ import { computed, ref, onMounted, watch } from "vue";
7
+ import { useColorMode } from "#imports";
8
+ import { resolveColor } from "../../composables/useColorResolver";
9
+ import {
10
+ adjustLightness,
11
+ oklchToRgb
12
+ } from "../../composables/useThemeColors";
13
+ import { createRepeatingGradient } from "../../composables/useGradient";
14
+ const {
15
+ pin = "top-right",
16
+ color = "primary",
17
+ speed = 50,
18
+ opacity = 50,
19
+ lightness = 70,
20
+ reverse = false,
21
+ ...props
22
+ } = defineProps({
23
+ pin: { type: String, required: false },
24
+ color: { type: null, required: false },
25
+ speed: { type: Number, required: false },
26
+ opacity: { type: Number, required: false },
27
+ lightness: { type: Number, required: false },
28
+ dark: { type: Object, required: false },
29
+ variant: { type: String, required: false },
30
+ reverse: { type: Boolean, required: false },
31
+ class: { type: null, required: false }
32
+ });
33
+ defineSlots();
34
+ const isDark = ref(false);
35
+ onMounted(() => {
36
+ const colorMode = useColorMode();
37
+ isDark.value = colorMode.value === "dark";
38
+ watch(
39
+ () => colorMode.value,
40
+ (newValue) => {
41
+ isDark.value = newValue === "dark";
42
+ }
43
+ );
44
+ });
45
+ const variants = {
46
+ calm: { speed: 20, opacity: 30, blur: 15 },
47
+ energetic: { speed: 80, opacity: 70, blur: 8 },
48
+ cosmic: { speed: 50, opacity: 90, blur: 12 }
49
+ };
50
+ const effectiveSpeed = computed(
51
+ () => props.variant ? variants[props.variant].speed : speed
52
+ );
53
+ const effectiveOpacity = computed(
54
+ () => props.variant ? variants[props.variant].opacity : opacity
55
+ );
56
+ const effectiveBlur = computed(
57
+ () => props.variant ? variants[props.variant].blur : 10
58
+ );
59
+ const effectiveColor = computed(
60
+ () => isDark.value && props.dark?.color ? props.dark.color : color
61
+ );
62
+ const effectiveLightness = computed(
63
+ () => isDark.value && props.dark?.lightness !== void 0 ? props.dark.lightness : isDark.value ? 40 : lightness
64
+ );
65
+ const effectiveOpacityValue = computed(
66
+ () => isDark.value && props.dark?.opacity !== void 0 ? props.dark.opacity : effectiveOpacity.value
67
+ );
68
+ const baseColor = computed(() => resolveColor(effectiveColor.value));
69
+ const auroraColors = computed(() => {
70
+ const base = baseColor.value;
71
+ const baseLightness = effectiveLightness.value;
72
+ return [
73
+ oklchToRgb(adjustLightness(base, baseLightness - 10)),
74
+ oklchToRgb(adjustLightness(base, baseLightness + 5)),
75
+ oklchToRgb(adjustLightness(base, baseLightness)),
76
+ oklchToRgb(adjustLightness(base, baseLightness + 10)),
77
+ oklchToRgb(adjustLightness(base, baseLightness - 5))
78
+ ];
79
+ });
80
+ const auroraGradient = computed(
81
+ () => createRepeatingGradient(auroraColors.value, 100)
82
+ );
83
+ const animationDuration = computed(() => {
84
+ const clampedSpeed = Math.max(1, Math.min(100, effectiveSpeed.value));
85
+ const duration = 120 - clampedSpeed * 0.9;
86
+ return `${duration}s`;
87
+ });
88
+ const animationState = computed(
89
+ () => effectiveSpeed.value === 0 ? "paused" : "running"
90
+ );
91
+ const animationDirection = computed(() => reverse ? "reverse" : "normal");
92
+ const auroraOpacityValue = computed(() => {
93
+ const clampedOpacity = Math.max(
94
+ 0,
95
+ Math.min(100, effectiveOpacityValue.value)
96
+ );
97
+ return clampedOpacity / 100;
98
+ });
99
+ const auroraBlur = computed(() => `${effectiveBlur.value}px`);
100
+ const lineColor = computed(() => isDark.value ? "#000" : "#fff");
101
+ const lineColorAfter = computed(
102
+ () => isDark.value ? "rgba(0, 0, 0, 0.3)" : "#fff"
103
+ );
104
+ const filterInvert = computed(() => isDark.value ? "invert(0)" : "invert(1)");
105
+ const afterOpacity = computed(() => isDark.value ? 0.3 : 1);
106
+ const maskGradient = computed(() => {
107
+ if (!pin) return void 0;
108
+ const positions = {
109
+ "top-left": "ellipse at 0% 0%",
110
+ "top-right": "ellipse at 100% 0%",
111
+ "bottom-left": "ellipse at 0% 100%",
112
+ "bottom-right": "ellipse at 100% 100%",
113
+ top: "ellipse at 50% 0%",
114
+ bottom: "ellipse at 50% 100%",
115
+ left: "ellipse at 0% 50%",
116
+ right: "ellipse at 100% 50%"
117
+ };
118
+ return `radial-gradient(${positions[pin]}, black 10%, transparent 70%)`;
119
+ });
120
+ </script>
121
+
122
+ <template>
123
+ <div
124
+ class="relative flex h-full w-full items-center justify-center bg-zinc-50 text-slate-950 transition-bg dark:bg-zinc-900"
125
+ :class="props.class"
126
+ >
127
+ <div
128
+ class="absolute inset-0 overflow-hidden"
129
+ :style="maskGradient ? { maskImage: maskGradient } : {}"
130
+ >
131
+ <ClientOnly>
132
+ <div
133
+ class="aurora-effect pointer-events-none absolute -inset-2.5 h-full w-full will-change-transform animate-in fade-in duration-1000"
134
+ :style="{ opacity: auroraOpacityValue }"
135
+ />
136
+ </ClientOnly>
137
+ </div>
138
+
139
+ <div class="relative z-10">
140
+ <slot />
141
+ </div>
142
+ </div>
143
+ </template>
144
+
145
+ <style scoped>
146
+ .aurora-effect{background-image:repeating-linear-gradient(100deg,v-bind(lineColor),v-bind(lineColor) 7%,transparent 10%,transparent 12%,v-bind(lineColor) 16%),v-bind(auroraGradient);background-size:200%,100%;filter:blur(v-bind(auroraBlur)) v-bind(filterInvert)}.aurora-effect,.aurora-effect:after{animation:aurora v-bind(animationDuration) linear infinite;animation-direction:v-bind(animationDirection);animation-play-state:v-bind(animationState);background-position:50% 50%,50% 50%}.aurora-effect:after{background-attachment:fixed;background-image:repeating-linear-gradient(100deg,v-bind(lineColorAfter),v-bind(lineColorAfter) 7%,transparent 10%,transparent 12%,v-bind(lineColorAfter) 16%),v-bind(auroraGradient);background-size:180%,100%;content:"";inset:0;mix-blend-mode:difference;opacity:v-bind(afterOpacity);position:absolute}@keyframes aurora{0%{background-position:50% 50%,50% 50%}to{background-position:350% 50%,350% 50%}}
147
+ </style>
@@ -0,0 +1,137 @@
1
+ import type { ColorInput } from "../../composables/useColorResolver.js";
2
+ /**
3
+ * Aurora - An animated aurora background component with gradient effects
4
+ *
5
+ * A beautiful CSS-based gradient animation that creates flowing aurora-like effects.
6
+ * Perfect for hero sections, landing pages, or anywhere you want eye-catching backgrounds.
7
+ */
8
+ export type AuroraVariant = "calm" | "energetic" | "cosmic";
9
+ export interface AuroraProps {
10
+ /**
11
+ * Pin the aurora to a specific corner or edge of the container.
12
+ *
13
+ * When set, creates a radial mask that constrains the aurora effect to originate from
14
+ * the specified position, creating a spotlight or glow effect from that corner/edge.
15
+ *
16
+ * When undefined, aurora flows freely across the entire container without masking.
17
+ *
18
+ * Use cases:
19
+ * - 'top-right': Glow from top-right corner (perfect for hero sections)
20
+ * - 'bottom-left': Accent from bottom corner
21
+ * - 'top': Top edge glow (header backgrounds)
22
+ * - undefined: Full-screen flowing effect (landing pages)
23
+ *
24
+ * @default 'top-right'
25
+ */
26
+ pin?: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
27
+ /**
28
+ * Color for the aurora gradient. Supports:
29
+ * - Nuxt UI semantic: 'primary', 'secondary', 'success', 'info', 'warning', 'error', 'neutral'
30
+ * - Tailwind colors: 'blue-500', 'red-600', 'purple-400', etc.
31
+ * - Direct values: '#3b82f6', 'oklch(0.6 0.15 250)', 'rgb(59, 130, 246)'
32
+ *
33
+ * The component automatically generates multiple gradient shades from this base color
34
+ * with different lightness values for a rich, multi-tone aurora effect.
35
+ *
36
+ * @example 'primary' - Uses Nuxt UI theme primary color
37
+ * @example 'purple-500' - Tailwind purple
38
+ * @example '#8b5cf6' - Direct hex value
39
+ *
40
+ * @default 'primary'
41
+ */
42
+ color?: ColorInput;
43
+ /**
44
+ * Speed of the aurora animation (0-100, where 100 is fastest).
45
+ *
46
+ * Controls how quickly the aurora gradient flows across the screen.
47
+ * - 0: Paused (no animation)
48
+ * - 1-30: Slow, calm movement
49
+ * - 40-60: Medium, steady flow
50
+ * - 70-100: Fast, energetic motion
51
+ *
52
+ * Range: 0-100
53
+ * @default 50
54
+ */
55
+ speed?: number;
56
+ /**
57
+ * Opacity/visibility of the aurora effect (0-100).
58
+ *
59
+ * Controls the overall transparency of the aurora gradient overlay.
60
+ * Does NOT affect blur amount - use `variant` for preset blur configurations.
61
+ *
62
+ * - 0: Completely invisible
63
+ * - 30: Subtle, gentle glow
64
+ * - 50: Balanced visibility
65
+ * - 80-100: Bold, prominent effect
66
+ *
67
+ * Range: 0-100
68
+ * @default 50
69
+ */
70
+ opacity?: number;
71
+ /**
72
+ * Lightness adjustment for the base color in OKLCH color space (0-100).
73
+ *
74
+ * Controls the brightness/saturation of the generated gradient colors.
75
+ * - Lower values (30-50): Darker, more saturated colors (better for dark mode)
76
+ * - Higher values (60-80): Lighter, pastel colors (better for light mode)
77
+ *
78
+ * The component automatically adjusts this for dark mode, but you can override
79
+ * using the `dark` prop for custom dark mode appearance.
80
+ *
81
+ * Range: 0-100
82
+ * @default 70 (light mode), 40 (dark mode)
83
+ */
84
+ lightness?: number;
85
+ /**
86
+ * Dark mode overrides for color, lightness, and opacity.
87
+ *
88
+ * Allows you to customize the aurora appearance specifically for dark mode.
89
+ * Any property not specified will use the default light mode value.
90
+ *
91
+ * @example { color: 'blue-400', lightness: 30, opacity: 60 }
92
+ */
93
+ dark?: {
94
+ color?: ColorInput;
95
+ lightness?: number;
96
+ opacity?: number;
97
+ };
98
+ /**
99
+ * Animation style variant with preset configurations.
100
+ *
101
+ * When set, overrides `speed`, `opacity`, and blur settings with carefully tuned presets.
102
+ * - 'calm': Slow, gentle, heavily blurred (meditative feel)
103
+ * - 'energetic': Fast, vibrant, lightly blurred (dynamic feel)
104
+ * - 'cosmic': Medium speed, high opacity, moderate blur (space-like effect)
105
+ *
106
+ * Leave undefined to manually control speed and opacity.
107
+ */
108
+ variant?: AuroraVariant;
109
+ /**
110
+ * Reverse the animation direction.
111
+ *
112
+ * When true, the aurora flows in the opposite direction.
113
+ *
114
+ * @default false
115
+ */
116
+ reverse?: boolean;
117
+ /**
118
+ * Additional CSS classes for the container element.
119
+ */
120
+ class?: any;
121
+ }
122
+ export interface AuroraSlots {
123
+ /**
124
+ * Default slot content rendered on top of the aurora background.
125
+ *
126
+ * Content is positioned with z-index above the aurora effect.
127
+ */
128
+ default(): any;
129
+ }
130
+ declare const _default: typeof __VLS_export;
131
+ export default _default;
132
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<AuroraProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AuroraProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, AuroraSlots>;
133
+ type __VLS_WithSlots<T, S> = T & {
134
+ new (): {
135
+ $slots: S;
136
+ };
137
+ };
@@ -35,41 +35,68 @@ export interface FlickeringGridProps {
35
35
  * - Tailwind colors: 'blue-500', 'red-600', 'slate-200', etc.
36
36
  * - Direct values: '#3b82f6', 'oklch(0.6 0.15 250)', 'rgb(59, 130, 246)'
37
37
  *
38
- * Choose lighter shades (e.g., 'blue-200') for subtle backgrounds or darker shades (e.g., 'blue-600') for bolder effects.
38
+ * This controls the base hue/color of the grid. Use `lightness` to adjust how bright/washed out it appears.
39
39
  *
40
40
  * @example 'primary' - Nuxt UI semantic color
41
- * @example 'blue-200' - Light Tailwind color for subtle effect
42
- * @example 'blue-600' - Dark Tailwind color for bold effect
43
- * @example '#e0f2fe' - Direct hex color value (light blue)
41
+ * @example 'blue-500' - Tailwind color
42
+ * @example '#3b82f6' - Direct hex color value
44
43
  *
45
44
  * @default 'neutral'
46
45
  */
47
46
  color?: ColorInput;
48
47
  /**
49
- * Opacity/visibility of the grid squares.
50
- * Controls how transparent the grid appears.
48
+ * Lightness adjustment in OKLCH color space (0-100).
51
49
  *
52
- * - 0: Completely invisible
53
- * - 0.3: Subtle, background texture
54
- * - 0.5: Medium visibility
55
- * - 0.8: Bold, prominent
56
- * - 1: Fully opaque
50
+ * Controls how bright or washed-out the color appears WITHOUT changing transparency.
51
+ * This modifies the color itself, making it closer to white (higher values) or more saturated (lower values).
57
52
  *
58
- * Range: 0-1
53
+ * Think of it as a "color brightness" slider:
54
+ * - Lower values (70-80): Darker, more saturated, vibrant colors
55
+ * - Medium values (85-92): Balanced, natural colors
56
+ * - Higher values (93-100): Very light, pastel, washed-out colors (approaching white)
59
57
  *
60
- * @default 0.5
58
+ * Use cases:
59
+ * - Subtle background: `color="blue-500" lightness={95}` → Very light blue tint
60
+ * - Bold accent: `color="blue-500" lightness={75}` → Vibrant, saturated blue
61
+ * - Combined with opacity: `lightness={90} opacity={0.3}` → Medium-tone color, very transparent
62
+ *
63
+ * Range: 0-100
64
+ * @default 95
65
+ */
66
+ lightness?: number;
67
+ /**
68
+ * Opacity/transparency of the grid squares (0-100).
69
+ *
70
+ * Controls how see-through the grid is WITHOUT changing the color itself.
71
+ * This is pure transparency - the color stays the same, just more/less visible.
72
+ *
73
+ * Think of it as a "visibility" slider:
74
+ * - 0: Completely invisible (transparent)
75
+ * - 30: Very subtle, barely visible
76
+ * - 50: Medium visibility
77
+ * - 80: Bold, prominent
78
+ * - 100: Fully opaque, no transparency
79
+ *
80
+ * Use cases:
81
+ * - Gentle texture: `opacity={20}` → Barely visible background pattern
82
+ * - Strong effect: `opacity={80}` → Prominent, eye-catching grid
83
+ * - Combined with lightness: `lightness={95} opacity={50}` → Light color, medium transparency
84
+ *
85
+ * Range: 0-100
86
+ * @default 50
61
87
  */
62
88
  opacity?: number;
63
89
  /**
64
- * Dark mode overrides for color and opacity.
90
+ * Dark mode overrides for color, lightness, and opacity.
65
91
  *
66
92
  * Allows you to customize the grid appearance specifically for dark mode.
67
93
  * Any property not specified will use the default light mode value.
68
94
  *
69
- * @example { color: 'blue-300', opacity: 0.3 }
95
+ * @example { color: 'blue-300', lightness: 90, opacity: 0.3 }
70
96
  */
71
97
  dark?: {
72
98
  color?: ColorInput;
99
+ lightness?: number;
73
100
  opacity?: number;
74
101
  };
75
102
  /**
@@ -7,7 +7,7 @@ import { ref, computed, onMounted, onBeforeUnmount, watch } from "vue";
7
7
  import { useColorMode } from "#imports";
8
8
  import { tv } from "../../utils/tv";
9
9
  import theme from "../../themes/background-flickering-grid";
10
- import { darkenColor, oklchToRgb } from "../../composables/useThemeColors";
10
+ import { adjustLightness, darkenColor, oklchToRgb } from "../../composables/useThemeColors";
11
11
  import {
12
12
  resolveColor
13
13
  } from "../../composables/useColorResolver";
@@ -16,7 +16,8 @@ const {
16
16
  gap = 9,
17
17
  speed = 5,
18
18
  color = "neutral",
19
- opacity = 0.5,
19
+ lightness = 95,
20
+ opacity = 50,
20
21
  ...props
21
22
  } = defineProps({
22
23
  size: { type: Number, required: false },
@@ -24,6 +25,7 @@ const {
24
25
  speed: { type: Number, required: false },
25
26
  fade: { type: String, required: false },
26
27
  color: { type: null, required: false },
28
+ lightness: { type: Number, required: false },
27
29
  opacity: { type: Number, required: false },
28
30
  dark: { type: Object, required: false },
29
31
  ui: { type: null, required: false }
@@ -36,11 +38,15 @@ const effectiveColor = computed(() => {
36
38
  }
37
39
  return color;
38
40
  });
39
- const effectiveOpacity = computed(() => {
40
- if (isDark.value && props.dark?.opacity !== void 0) {
41
- return props.dark.opacity;
41
+ const effectiveLightness = computed(() => {
42
+ if (isDark.value && props.dark?.lightness !== void 0) {
43
+ return props.dark.lightness;
42
44
  }
43
- return opacity;
45
+ return lightness;
46
+ });
47
+ const effectiveOpacity = computed(() => {
48
+ const opacityValue = isDark.value && props.dark?.opacity !== void 0 ? props.dark.opacity : opacity;
49
+ return opacityValue / 100;
44
50
  });
45
51
  const internalSpeed = computed(() => {
46
52
  return speed * 0.01;
@@ -88,8 +94,9 @@ function parseColor(color2) {
88
94
  }
89
95
  const gridColors = computed(() => {
90
96
  const baseColor = resolveColor(effectiveColor.value);
91
- const baseRgb = oklchToRgb(baseColor);
92
- const darkerColor = darkenColor(baseColor, 10);
97
+ const adjustedColor = adjustLightness(baseColor, effectiveLightness.value);
98
+ const baseRgb = oklchToRgb(adjustedColor);
99
+ const darkerColor = darkenColor(adjustedColor, 10);
93
100
  const flickerRgb = oklchToRgb(darkerColor);
94
101
  return {
95
102
  base: parseColor(baseRgb),
@@ -218,8 +225,10 @@ watch(
218
225
  () => size,
219
226
  () => gap,
220
227
  () => color,
228
+ () => lightness,
221
229
  () => opacity,
222
230
  () => props.dark?.color,
231
+ () => props.dark?.lightness,
223
232
  () => props.dark?.opacity
224
233
  ],
225
234
  () => {
@@ -35,41 +35,68 @@ export interface FlickeringGridProps {
35
35
  * - Tailwind colors: 'blue-500', 'red-600', 'slate-200', etc.
36
36
  * - Direct values: '#3b82f6', 'oklch(0.6 0.15 250)', 'rgb(59, 130, 246)'
37
37
  *
38
- * Choose lighter shades (e.g., 'blue-200') for subtle backgrounds or darker shades (e.g., 'blue-600') for bolder effects.
38
+ * This controls the base hue/color of the grid. Use `lightness` to adjust how bright/washed out it appears.
39
39
  *
40
40
  * @example 'primary' - Nuxt UI semantic color
41
- * @example 'blue-200' - Light Tailwind color for subtle effect
42
- * @example 'blue-600' - Dark Tailwind color for bold effect
43
- * @example '#e0f2fe' - Direct hex color value (light blue)
41
+ * @example 'blue-500' - Tailwind color
42
+ * @example '#3b82f6' - Direct hex color value
44
43
  *
45
44
  * @default 'neutral'
46
45
  */
47
46
  color?: ColorInput;
48
47
  /**
49
- * Opacity/visibility of the grid squares.
50
- * Controls how transparent the grid appears.
48
+ * Lightness adjustment in OKLCH color space (0-100).
51
49
  *
52
- * - 0: Completely invisible
53
- * - 0.3: Subtle, background texture
54
- * - 0.5: Medium visibility
55
- * - 0.8: Bold, prominent
56
- * - 1: Fully opaque
50
+ * Controls how bright or washed-out the color appears WITHOUT changing transparency.
51
+ * This modifies the color itself, making it closer to white (higher values) or more saturated (lower values).
57
52
  *
58
- * Range: 0-1
53
+ * Think of it as a "color brightness" slider:
54
+ * - Lower values (70-80): Darker, more saturated, vibrant colors
55
+ * - Medium values (85-92): Balanced, natural colors
56
+ * - Higher values (93-100): Very light, pastel, washed-out colors (approaching white)
59
57
  *
60
- * @default 0.5
58
+ * Use cases:
59
+ * - Subtle background: `color="blue-500" lightness={95}` → Very light blue tint
60
+ * - Bold accent: `color="blue-500" lightness={75}` → Vibrant, saturated blue
61
+ * - Combined with opacity: `lightness={90} opacity={0.3}` → Medium-tone color, very transparent
62
+ *
63
+ * Range: 0-100
64
+ * @default 95
65
+ */
66
+ lightness?: number;
67
+ /**
68
+ * Opacity/transparency of the grid squares (0-100).
69
+ *
70
+ * Controls how see-through the grid is WITHOUT changing the color itself.
71
+ * This is pure transparency - the color stays the same, just more/less visible.
72
+ *
73
+ * Think of it as a "visibility" slider:
74
+ * - 0: Completely invisible (transparent)
75
+ * - 30: Very subtle, barely visible
76
+ * - 50: Medium visibility
77
+ * - 80: Bold, prominent
78
+ * - 100: Fully opaque, no transparency
79
+ *
80
+ * Use cases:
81
+ * - Gentle texture: `opacity={20}` → Barely visible background pattern
82
+ * - Strong effect: `opacity={80}` → Prominent, eye-catching grid
83
+ * - Combined with lightness: `lightness={95} opacity={50}` → Light color, medium transparency
84
+ *
85
+ * Range: 0-100
86
+ * @default 50
61
87
  */
62
88
  opacity?: number;
63
89
  /**
64
- * Dark mode overrides for color and opacity.
90
+ * Dark mode overrides for color, lightness, and opacity.
65
91
  *
66
92
  * Allows you to customize the grid appearance specifically for dark mode.
67
93
  * Any property not specified will use the default light mode value.
68
94
  *
69
- * @example { color: 'blue-300', opacity: 0.3 }
95
+ * @example { color: 'blue-300', lightness: 90, opacity: 0.3 }
70
96
  */
71
97
  dark?: {
72
98
  color?: ColorInput;
99
+ lightness?: number;
73
100
  opacity?: number;
74
101
  };
75
102
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-ui-elements",
3
- "version": "0.1.3",
3
+ "version": "0.1.6",
4
4
  "description": "A collection of beautiful, animated UI components for Nuxt applications",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/genu/nuxt-ui-elements.git",
@@ -55,7 +55,7 @@
55
55
  "lint:fix": "oxlint --fix --type-aware",
56
56
  "format": "oxfmt --write",
57
57
  "format:check": "oxfmt --check",
58
- "release": "pnpm lint && pnpm test && pnpm prepack && changelogen --release",
58
+ "release": "pnpm lint && pnpm test && pnpm prepack && changelogen --release && pnpm publish && git push --follow-tags",
59
59
  "test": "vitest run",
60
60
  "test:watch": "vitest watch",
61
61
  "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
@@ -1,62 +0,0 @@
1
- /**
2
- * Aurora - An animated aurora background component with gradient effects
3
- */
4
- export type AuroraVariant = "calm" | "energetic" | "cosmic";
5
- export interface AuroraProps {
6
- /**
7
- * Pin the aurora to a specific corner or edge
8
- * If undefined, aurora flows across the entire screen without mask
9
- * @default 'top-right'
10
- */
11
- pin?: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
12
- /**
13
- * Color variant
14
- * @default 'primary'
15
- */
16
- color?: "primary" | "secondary" | "success" | "info" | "warning" | "error" | "neutral";
17
- /**
18
- * Speed of the animation (0-100, where 100 is fastest)
19
- * @default 50
20
- */
21
- speed?: number;
22
- /**
23
- * Intensity of the aurora effect (0-100)
24
- * Controls opacity and blur
25
- * @default 50
26
- */
27
- intensity?: number;
28
- /**
29
- * Animation style variant
30
- * Overrides speed and intensity when set
31
- */
32
- variant?: AuroraVariant;
33
- /**
34
- * Reverse the animation direction
35
- * @default false
36
- */
37
- reverse?: boolean;
38
- /**
39
- * Additional CSS classes for the container
40
- */
41
- class?: any;
42
- }
43
- export interface AuroraSlots {
44
- /**
45
- * Default slot content rendered on top of the aurora
46
- */
47
- default(): any;
48
- }
49
- declare const _default: typeof __VLS_export;
50
- export default _default;
51
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<AuroraProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AuroraProps> & Readonly<{}>, {
52
- pin: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
53
- color: "primary" | "secondary" | "success" | "info" | "warning" | "error" | "neutral";
54
- speed: number;
55
- intensity: number;
56
- reverse: boolean;
57
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, AuroraSlots>;
58
- type __VLS_WithSlots<T, S> = T & {
59
- new (): {
60
- $slots: S;
61
- };
62
- };
@@ -1,120 +0,0 @@
1
- <script>
2
-
3
- </script>
4
-
5
- <script setup>
6
- import { computed } from "vue";
7
- import {
8
- adjustLightness,
9
- getThemeColor,
10
- oklchToRgb
11
- } from "../../composables/useThemeColors";
12
- import { createRepeatingGradient } from "../../composables/useGradient";
13
- const props = defineProps({
14
- pin: { type: String, required: false, default: "top-right" },
15
- color: { type: String, required: false, default: "primary" },
16
- speed: { type: Number, required: false, default: 50 },
17
- intensity: { type: Number, required: false, default: 50 },
18
- variant: { type: String, required: false },
19
- reverse: { type: Boolean, required: false, default: false },
20
- class: { type: null, required: false }
21
- });
22
- defineSlots();
23
- const variants = {
24
- calm: { speed: 20, intensity: 30, blur: 15 },
25
- energetic: { speed: 80, intensity: 70, blur: 8 },
26
- cosmic: { speed: 50, intensity: 90, blur: 12 }
27
- };
28
- const effectiveSpeed = computed(
29
- () => props.variant ? variants[props.variant].speed : props.speed
30
- );
31
- const effectiveIntensity = computed(
32
- () => props.variant ? variants[props.variant].intensity : props.intensity
33
- );
34
- const effectiveBlur = computed(
35
- () => props.variant ? variants[props.variant].blur : 10
36
- );
37
- const baseColor = computed(() => getThemeColor(props.color, 500));
38
- const auroraColors = computed(() => {
39
- const base = baseColor.value;
40
- return [
41
- oklchToRgb(adjustLightness(base, 60)),
42
- oklchToRgb(adjustLightness(base, 75)),
43
- oklchToRgb(adjustLightness(base, 70)),
44
- oklchToRgb(adjustLightness(base, 80)),
45
- oklchToRgb(adjustLightness(base, 65))
46
- ];
47
- });
48
- const auroraColorsDark = computed(() => {
49
- const base = baseColor.value;
50
- return [
51
- oklchToRgb(adjustLightness(base, 30)),
52
- oklchToRgb(adjustLightness(base, 45)),
53
- oklchToRgb(adjustLightness(base, 40)),
54
- oklchToRgb(adjustLightness(base, 50)),
55
- oklchToRgb(adjustLightness(base, 35))
56
- ];
57
- });
58
- const auroraGradient = computed(
59
- () => createRepeatingGradient(auroraColors.value, 100)
60
- );
61
- const auroraGradientDark = computed(
62
- () => createRepeatingGradient(auroraColorsDark.value, 100)
63
- );
64
- const animationDuration = computed(() => {
65
- const clampedSpeed = Math.max(1, Math.min(100, effectiveSpeed.value));
66
- const duration = 120 - clampedSpeed * 0.9;
67
- return `${duration}s`;
68
- });
69
- const animationState = computed(
70
- () => effectiveSpeed.value === 0 ? "paused" : "running"
71
- );
72
- const animationDirection = computed(
73
- () => props.reverse ? "reverse" : "normal"
74
- );
75
- const auroraOpacity = computed(() => {
76
- const clampedIntensity = Math.max(0, Math.min(100, effectiveIntensity.value));
77
- return clampedIntensity / 100;
78
- });
79
- const auroraBlur = computed(() => `${effectiveBlur.value}px`);
80
- const maskGradient = computed(() => {
81
- if (!props.pin) return void 0;
82
- const positions = {
83
- "top-left": "ellipse at 0% 0%",
84
- "top-right": "ellipse at 100% 0%",
85
- "bottom-left": "ellipse at 0% 100%",
86
- "bottom-right": "ellipse at 100% 100%",
87
- top: "ellipse at 50% 0%",
88
- bottom: "ellipse at 50% 100%",
89
- left: "ellipse at 0% 50%",
90
- right: "ellipse at 100% 50%"
91
- };
92
- return `radial-gradient(${positions[props.pin]}, black 10%, transparent 70%)`;
93
- });
94
- </script>
95
-
96
- <template>
97
- <div
98
- class="relative flex h-full w-full items-center justify-center bg-zinc-50 text-slate-950 transition-bg dark:bg-zinc-900"
99
- >
100
- <div
101
- class="absolute inset-0 overflow-hidden"
102
- :style="maskGradient ? { maskImage: maskGradient } : {}"
103
- >
104
- <ClientOnly>
105
- <div
106
- class="aurora-effect pointer-events-none absolute -inset-2.5 h-full w-full will-change-transform animate-in fade-in duration-1000"
107
- :style="{ opacity: auroraOpacity }"
108
- />
109
- </ClientOnly>
110
- </div>
111
-
112
- <div class="relative z-10">
113
- <slot />
114
- </div>
115
- </div>
116
- </template>
117
-
118
- <style scoped>
119
- .aurora-effect{background-size:200%,100%;filter:blur(v-bind(auroraBlur)) invert(1)}.aurora-effect,.aurora-effect:after{animation:aurora v-bind(animationDuration) linear infinite;animation-direction:v-bind(animationDirection);animation-play-state:v-bind(animationState);background-image:repeating-linear-gradient(100deg,#fff,#fff 7%,transparent 10%,transparent 12%,#fff 16%),v-bind(auroraGradient);background-position:50% 50%,50% 50%}.aurora-effect:after{background-attachment:fixed;background-size:180%,100%;content:"";inset:0;mix-blend-mode:difference;position:absolute}:global(.dark) .aurora-effect{background-image:repeating-linear-gradient(100deg,#000,#000 7%,transparent 10%,transparent 12%,#000 16%),v-bind(auroraGradientDark);filter:blur(10px) invert(0)}:global(.dark) .aurora-effect:after{background-image:repeating-linear-gradient(100deg,rgba(0,0,0,.3),rgba(0,0,0,.3) 7%,transparent 10%,transparent 12%,rgba(0,0,0,.3) 16%),v-bind(auroraGradientDark);opacity:.3}@keyframes aurora{0%{background-position:50% 50%,50% 50%}to{background-position:350% 50%,350% 50%}}
120
- </style>
@@ -1,62 +0,0 @@
1
- /**
2
- * Aurora - An animated aurora background component with gradient effects
3
- */
4
- export type AuroraVariant = "calm" | "energetic" | "cosmic";
5
- export interface AuroraProps {
6
- /**
7
- * Pin the aurora to a specific corner or edge
8
- * If undefined, aurora flows across the entire screen without mask
9
- * @default 'top-right'
10
- */
11
- pin?: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
12
- /**
13
- * Color variant
14
- * @default 'primary'
15
- */
16
- color?: "primary" | "secondary" | "success" | "info" | "warning" | "error" | "neutral";
17
- /**
18
- * Speed of the animation (0-100, where 100 is fastest)
19
- * @default 50
20
- */
21
- speed?: number;
22
- /**
23
- * Intensity of the aurora effect (0-100)
24
- * Controls opacity and blur
25
- * @default 50
26
- */
27
- intensity?: number;
28
- /**
29
- * Animation style variant
30
- * Overrides speed and intensity when set
31
- */
32
- variant?: AuroraVariant;
33
- /**
34
- * Reverse the animation direction
35
- * @default false
36
- */
37
- reverse?: boolean;
38
- /**
39
- * Additional CSS classes for the container
40
- */
41
- class?: any;
42
- }
43
- export interface AuroraSlots {
44
- /**
45
- * Default slot content rendered on top of the aurora
46
- */
47
- default(): any;
48
- }
49
- declare const _default: typeof __VLS_export;
50
- export default _default;
51
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<AuroraProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AuroraProps> & Readonly<{}>, {
52
- pin: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
53
- color: "primary" | "secondary" | "success" | "info" | "warning" | "error" | "neutral";
54
- speed: number;
55
- intensity: number;
56
- reverse: boolean;
57
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, AuroraSlots>;
58
- type __VLS_WithSlots<T, S> = T & {
59
- new (): {
60
- $slots: S;
61
- };
62
- };