nuxt-ui-elements 0.1.4 → 0.1.7

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.4",
4
+ "version": "0.1.7",
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
+ };
@@ -239,7 +239,9 @@ watch(
239
239
 
240
240
  <template>
241
241
  <div ref="containerRef" :class="ui.base({ class: [props.ui?.base] })">
242
- <canvas ref="canvasRef" :class="ui.canvas({ class: props.ui?.canvas })" :style="maskStyle" />
242
+ <ClientOnly>
243
+ <canvas ref="canvasRef" :class="ui.canvas({ class: props.ui?.canvas })" :style="maskStyle" />
244
+ </ClientOnly>
243
245
  <slot />
244
246
  </div>
245
247
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-ui-elements",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
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
- };