fancy-ui-vue 0.4.0 → 0.4.1
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/dist/components/animated-testimonials/AnimatedTestimonials.vue.js +23 -12
- package/dist/components/bg-falling-stars/FallingStarsBg.vue.js +10 -1
- package/dist/components/bg-falling-stars/bg-falling-stars-core.d.ts +6 -0
- package/dist/components/bg-falling-stars/bg-falling-stars-core.js +24 -2
- package/dist/components/bg-stars/StarsBackground.vue.js +1 -1
- package/dist/components/bg-stars/StarsBackground.vue2.js +13 -1
- package/dist/components/bg-stars/bg-stars-core.d.ts +6 -0
- package/dist/components/bg-stars/bg-stars-core.js +21 -1
- package/dist/components/book/Book.vue.js +5 -83
- package/dist/components/book/Book.vue2.js +82 -1
- package/dist/components/box-reveal/BoxReveal.vue.js +5 -47
- package/dist/components/box-reveal/BoxReveal.vue2.js +48 -1
- package/dist/components/compare/StarField.vue.js +1 -1
- package/dist/components/container-text-flip/ContainerTextFlip.vue.js +1 -1
- package/dist/components/container-text-flip/ContainerTextFlip.vue2.js +14 -5
- package/dist/components/flickering-grid/FlickeringGrid.vue.js +19 -1
- package/dist/components/flickering-grid/flickering-grid-core.d.ts +6 -0
- package/dist/components/flickering-grid/flickering-grid-core.js +30 -1
- package/dist/components/flip-words/FlipWords.vue.js +1 -1
- package/dist/components/flip-words/FlipWords.vue2.js +14 -7
- package/dist/components/hyper-text/HyperText.vue.js +6 -97
- package/dist/components/hyper-text/HyperText.vue2.js +101 -0
- package/dist/components/letter-pullup/LetterPullup.vue.js +6 -38
- package/dist/components/letter-pullup/LetterPullup.vue2.js +40 -0
- package/dist/components/logo-cloud/AnimatedLogoCloud.vue.js +1 -1
- package/dist/components/matrix-rain/MatrixRain.vue.js +20 -1
- package/dist/components/matrix-rain/matrix-rain-core.d.ts +6 -0
- package/dist/components/matrix-rain/matrix-rain-core.js +28 -6
- package/dist/components/noise-reveal/NoiseReveal.vue.js +7 -0
- package/dist/components/noise-reveal/noise-reveal-core.js +23 -7
- package/dist/components/ripple/Ripple.vue.js +1 -1
- package/dist/components/ripple/Ripple.vue2.js +6 -1
- package/dist/components/sparkles/Sparkles.vue.js +10 -1
- package/dist/components/sparkles/sparkles-core.d.ts +6 -0
- package/dist/components/sparkles/sparkles-core.js +26 -2
- package/dist/components/sparkles-text/SparklesText.vue.js +6 -88
- package/dist/components/sparkles-text/SparklesText.vue2.js +100 -0
- package/dist/components/terminal-text/TerminalText.vue.js +1 -1
- package/dist/components/terminal-text/TerminalText.vue2.js +36 -4
- package/dist/components/text-generate-effect/TextGenerateEffect.vue.js +5 -72
- package/dist/components/text-generate-effect/TextGenerateEffect.vue2.js +74 -1
- package/dist/components/text-reveal-card/TextRevealCard.vue.js +5 -101
- package/dist/components/text-reveal-card/TextRevealCard.vue2.js +98 -1
- package/dist/components/text-reveal-card/TextRevealStars.vue.js +1 -1
- package/dist/components/text-reveal-card/TextRevealStars.vue2.js +29 -12
- package/dist/index.js +387 -390
- package/dist/styles.css +232 -89
- package/package.json +1 -1
- package/dist/components/hyper-text/HyperText.vue3.js +0 -5
- package/dist/components/letter-pullup/LetterPullup.vue3.js +0 -5
- package/dist/components/sparkles-text/SparklesText.vue3.js +0 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, onMounted, onBeforeUnmount, computed, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, Fragment, renderList,
|
|
1
|
+
import { defineComponent, ref, watch, onMounted, onBeforeUnmount, computed, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, Fragment, renderList, toDisplayString } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
3
|
import { useSoundCue } from "../../sound/use-sound.js";
|
|
4
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
4
5
|
const _hoisted_1 = {
|
|
5
6
|
key: 0,
|
|
6
7
|
class: "text-muted-foreground text-center"
|
|
@@ -37,11 +38,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
37
38
|
const direction = ref("next");
|
|
38
39
|
const isAnimating = ref(false);
|
|
39
40
|
const isHovered = ref(false);
|
|
41
|
+
const isFocused = ref(false);
|
|
42
|
+
const reducedMotion = useReducedMotion();
|
|
40
43
|
let navigateTimer = null;
|
|
41
44
|
function navigate(dir, fromUser = false) {
|
|
42
45
|
if (isAnimating.value || __props.testimonials.length === 0) return;
|
|
43
46
|
if (__props.sound && fromUser && __props.testimonials.length > 1) playCue("select");
|
|
44
47
|
direction.value = dir;
|
|
48
|
+
if (reducedMotion.value) {
|
|
49
|
+
const n = __props.testimonials.length;
|
|
50
|
+
activeIndex.value = dir === "next" ? (activeIndex.value + 1) % n : (activeIndex.value - 1 + n) % n;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
45
53
|
isAnimating.value = true;
|
|
46
54
|
navigateTimer = setTimeout(() => {
|
|
47
55
|
const count = __props.testimonials.length;
|
|
@@ -61,12 +69,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
61
69
|
[
|
|
62
70
|
() => __props.autoplay,
|
|
63
71
|
() => isHovered.value,
|
|
72
|
+
() => isFocused.value,
|
|
73
|
+
() => reducedMotion.value,
|
|
64
74
|
() => __props.interval,
|
|
65
75
|
() => __props.testimonials,
|
|
66
76
|
() => __props.testimonials.length
|
|
67
77
|
],
|
|
68
78
|
(_v, _o, onCleanup) => {
|
|
69
|
-
if (!__props.autoplay || isHovered.value || __props.testimonials.length === 0)
|
|
79
|
+
if (!__props.autoplay || isHovered.value || isFocused.value || reducedMotion.value || __props.testimonials.length === 0)
|
|
80
|
+
return;
|
|
70
81
|
const timer = setInterval(() => navigate("next"), __props.interval);
|
|
71
82
|
onCleanup(() => clearInterval(timer));
|
|
72
83
|
},
|
|
@@ -89,6 +100,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
89
100
|
),
|
|
90
101
|
onMouseenter: _cache[2] || (_cache[2] = ($event) => isHovered.value = true),
|
|
91
102
|
onMouseleave: _cache[3] || (_cache[3] = ($event) => isHovered.value = false),
|
|
103
|
+
onFocusin: _cache[4] || (_cache[4] = ($event) => isFocused.value = true),
|
|
104
|
+
onFocusout: _cache[5] || (_cache[5] = ($event) => isFocused.value = false),
|
|
92
105
|
role: "region",
|
|
93
106
|
"aria-label": "Testimonials"
|
|
94
107
|
}, [
|
|
@@ -99,12 +112,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
99
112
|
key: index,
|
|
100
113
|
class: normalizeClass(
|
|
101
114
|
unref(cn)(
|
|
102
|
-
"absolute inset-0 h-full w-full origin-bottom rounded-3xl ease-in-out motion-safe:transition-all",
|
|
115
|
+
"absolute inset-0 h-full w-full origin-bottom rounded-3xl ease-in-out motion-safe:transition-all motion-safe:duration-300",
|
|
103
116
|
index === activeIndex.value ? "z-20 translate-y-0 scale-100 rotate-0 opacity-100" : "z-10 translate-y-4 scale-95 opacity-0",
|
|
104
117
|
index !== activeIndex.value && direction.value === "next" ? "-translate-y-4" : index !== activeIndex.value ? "translate-y-4" : ""
|
|
105
118
|
)
|
|
106
|
-
)
|
|
107
|
-
style: normalizeStyle(`transition-duration: ${TRANSITION_DURATION}ms`)
|
|
119
|
+
)
|
|
108
120
|
}, [
|
|
109
121
|
createElementVNode("img", {
|
|
110
122
|
src: testimonial.src,
|
|
@@ -112,32 +124,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
112
124
|
class: "h-full w-full rounded-3xl object-cover object-center",
|
|
113
125
|
draggable: "false"
|
|
114
126
|
}, null, 8, _hoisted_4)
|
|
115
|
-
],
|
|
127
|
+
], 2);
|
|
116
128
|
}), 128))
|
|
117
129
|
]),
|
|
118
130
|
createElementVNode("div", _hoisted_5, [
|
|
119
131
|
createElementVNode("div", {
|
|
120
132
|
class: normalizeClass(
|
|
121
133
|
unref(cn)(
|
|
122
|
-
"ease-in-out",
|
|
134
|
+
"ease-in-out motion-safe:transition-[opacity,transform] motion-safe:duration-300",
|
|
123
135
|
isAnimating.value ? direction.value === "next" ? "translate-y-4 opacity-0" : "-translate-y-4 opacity-0" : "translate-y-0 opacity-100"
|
|
124
136
|
)
|
|
125
|
-
)
|
|
126
|
-
style: normalizeStyle(`transition: opacity ${TRANSITION_DURATION}ms, transform ${TRANSITION_DURATION}ms`)
|
|
137
|
+
)
|
|
127
138
|
}, [
|
|
128
139
|
createElementVNode("p", _hoisted_6, toDisplayString(activeTestimonial.value?.quote), 1),
|
|
129
140
|
createElementVNode("div", _hoisted_7, [
|
|
130
141
|
createElementVNode("p", _hoisted_8, toDisplayString(activeTestimonial.value?.name), 1),
|
|
131
142
|
createElementVNode("p", _hoisted_9, toDisplayString(activeTestimonial.value?.designation), 1)
|
|
132
143
|
])
|
|
133
|
-
],
|
|
144
|
+
], 2),
|
|
134
145
|
createElementVNode("div", _hoisted_10, [
|
|
135
146
|
createElementVNode("button", {
|
|
136
147
|
type: "button",
|
|
137
148
|
onClick: _cache[0] || (_cache[0] = ($event) => navigate("prev", true)),
|
|
138
149
|
class: "group/button flex h-10 w-10 items-center justify-center rounded-full bg-gray-100 transition-colors hover:bg-gray-200 dark:bg-neutral-800 dark:hover:bg-neutral-700",
|
|
139
150
|
"aria-label": "Previous testimonial"
|
|
140
|
-
}, [..._cache[
|
|
151
|
+
}, [..._cache[6] || (_cache[6] = [
|
|
141
152
|
createElementVNode("svg", {
|
|
142
153
|
xmlns: "http://www.w3.org/2000/svg",
|
|
143
154
|
width: "20",
|
|
@@ -158,7 +169,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
158
169
|
onClick: _cache[1] || (_cache[1] = ($event) => navigate("next", true)),
|
|
159
170
|
class: "group/button flex h-10 w-10 items-center justify-center rounded-full bg-gray-100 transition-colors hover:bg-gray-200 dark:bg-neutral-800 dark:hover:bg-neutral-700",
|
|
160
171
|
"aria-label": "Next testimonial"
|
|
161
|
-
}, [..._cache[
|
|
172
|
+
}, [..._cache[7] || (_cache[7] = [
|
|
162
173
|
createElementVNode("svg", {
|
|
163
174
|
xmlns: "http://www.w3.org/2000/svg",
|
|
164
175
|
width: "20",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, useTemplateRef, watch, onMounted, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, unref } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
3
4
|
import { createFallingStars } from "./bg-falling-stars-core.js";
|
|
4
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
6
|
...{ name: "FallingStarsBg", inheritAttrs: false },
|
|
@@ -13,6 +14,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13
14
|
const canvasRef = useTemplateRef("canvas");
|
|
14
15
|
let engine = null;
|
|
15
16
|
let resizeObserver = null;
|
|
17
|
+
const reducedMotion = useReducedMotion();
|
|
16
18
|
watch(
|
|
17
19
|
() => __props.color,
|
|
18
20
|
(nextColor) => {
|
|
@@ -23,7 +25,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
23
25
|
onMounted(() => {
|
|
24
26
|
const canvas = canvasRef.value;
|
|
25
27
|
if (!canvas) return;
|
|
26
|
-
engine = createFallingStars({ canvas }, { count: __props.count, color: __props.color });
|
|
28
|
+
engine = createFallingStars({ canvas }, { count: __props.count, color: __props.color, reducedMotion: reducedMotion.value });
|
|
27
29
|
resizeObserver = new ResizeObserver(() => engine?.resize());
|
|
28
30
|
resizeObserver.observe(canvas);
|
|
29
31
|
});
|
|
@@ -31,6 +33,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
31
33
|
engine?.destroy();
|
|
32
34
|
resizeObserver?.disconnect();
|
|
33
35
|
});
|
|
36
|
+
watch(
|
|
37
|
+
reducedMotion,
|
|
38
|
+
(next) => {
|
|
39
|
+
engine?.setOptions({ reducedMotion: next });
|
|
40
|
+
},
|
|
41
|
+
{ flush: "post" }
|
|
42
|
+
);
|
|
34
43
|
return (_ctx, _cache) => {
|
|
35
44
|
return openBlock(), createElementBlock("canvas", {
|
|
36
45
|
ref: "canvas",
|
|
@@ -11,6 +11,12 @@ export interface FallingStarsInitOptions {
|
|
|
11
11
|
export interface FallingStarsLiveOptions {
|
|
12
12
|
/** Star color: a hex string, or `currentColor` (default) to follow the text colour. */
|
|
13
13
|
color?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Reduced-motion preference, owned by the wrapper (the core never reads
|
|
16
|
+
* `matchMedia`). When true the engine paints one still frame and idles; a
|
|
17
|
+
* flip back to false resumes the loop.
|
|
18
|
+
*/
|
|
19
|
+
reducedMotion?: boolean;
|
|
14
20
|
}
|
|
15
21
|
export interface FallingStarsEngine {
|
|
16
22
|
setOptions(next: Partial<FallingStarsLiveOptions>): void;
|
|
@@ -57,6 +57,7 @@ function createFallingStars(el, options, random = Math.random) {
|
|
|
57
57
|
let perspective = 0;
|
|
58
58
|
let stars = [];
|
|
59
59
|
let rafId = 0;
|
|
60
|
+
let reducedMotion = options.reducedMotion ?? false;
|
|
60
61
|
let destroyed = false;
|
|
61
62
|
function resize() {
|
|
62
63
|
if (destroyed) return;
|
|
@@ -72,6 +73,7 @@ function createFallingStars(el, options, random = Math.random) {
|
|
|
72
73
|
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
73
74
|
}
|
|
74
75
|
perspective = width / 2;
|
|
76
|
+
if (reducedMotion && rafId === 0 && stars.length > 0) loop();
|
|
75
77
|
}
|
|
76
78
|
function drawStar(star, width, height, rgb) {
|
|
77
79
|
if (!ctx) return;
|
|
@@ -121,6 +123,10 @@ function createFallingStars(el, options, random = Math.random) {
|
|
|
121
123
|
star.y = (random() - 0.5) * 2 * height;
|
|
122
124
|
}
|
|
123
125
|
}
|
|
126
|
+
if (reducedMotion) {
|
|
127
|
+
rafId = 0;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
124
130
|
rafId = requestAnimationFrame(loop);
|
|
125
131
|
}
|
|
126
132
|
resize();
|
|
@@ -135,17 +141,33 @@ function createFallingStars(el, options, random = Math.random) {
|
|
|
135
141
|
speed: random() * 5 + 2
|
|
136
142
|
});
|
|
137
143
|
}
|
|
138
|
-
|
|
144
|
+
if (reducedMotion) loop();
|
|
145
|
+
else rafId = requestAnimationFrame(loop);
|
|
146
|
+
const themeObserver = typeof MutationObserver !== "undefined" ? new MutationObserver(() => {
|
|
147
|
+
if (reducedMotion && rafId === 0 && CURRENT_COLOR.test(color)) loop();
|
|
148
|
+
}) : null;
|
|
149
|
+
themeObserver?.observe(document.documentElement, {
|
|
150
|
+
attributes: true,
|
|
151
|
+
attributeFilter: ["class"]
|
|
152
|
+
});
|
|
139
153
|
return {
|
|
140
154
|
setOptions(next) {
|
|
141
|
-
if (
|
|
155
|
+
if (destroyed) return;
|
|
156
|
+
const wasReduced = reducedMotion;
|
|
157
|
+
if (next.reducedMotion !== void 0) reducedMotion = next.reducedMotion;
|
|
158
|
+
if (next.color !== void 0 && next.color !== color) {
|
|
142
159
|
color = next.color;
|
|
160
|
+
if (reducedMotion && rafId === 0) loop();
|
|
161
|
+
}
|
|
162
|
+
if (wasReduced && !reducedMotion && rafId === 0) {
|
|
163
|
+
rafId = requestAnimationFrame(loop);
|
|
143
164
|
}
|
|
144
165
|
},
|
|
145
166
|
resize,
|
|
146
167
|
destroy() {
|
|
147
168
|
if (destroyed) return;
|
|
148
169
|
destroyed = true;
|
|
170
|
+
themeObserver?.disconnect();
|
|
149
171
|
if (rafId) cancelAnimationFrame(rafId);
|
|
150
172
|
}
|
|
151
173
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./StarsBackground.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const StarsBackground = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const StarsBackground = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-51fcced5"]]);
|
|
5
5
|
export {
|
|
6
6
|
StarsBackground as default
|
|
7
7
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, useTemplateRef, onMounted, onBeforeUnmount, watch, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, renderSlot, normalizeStyle } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
3
4
|
import { generateStars, createBgStars } from "./bg-stars-core.js";
|
|
4
5
|
const _hoisted_1 = {
|
|
5
6
|
ref: "parallax",
|
|
@@ -41,11 +42,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
41
42
|
const hostRef = useTemplateRef("host");
|
|
42
43
|
const parallaxRef = useTemplateRef("parallax");
|
|
43
44
|
let engine = null;
|
|
45
|
+
const reducedMotion = useReducedMotion();
|
|
44
46
|
onMounted(() => {
|
|
45
47
|
const host = hostRef.value;
|
|
46
48
|
const parallax = parallaxRef.value;
|
|
47
49
|
if (!host || !parallax) return;
|
|
48
|
-
engine = createBgStars(
|
|
50
|
+
engine = createBgStars(
|
|
51
|
+
{ host, parallax },
|
|
52
|
+
{ factor: __props.factor, stiffness: __props.stiffness, damping: __props.damping, reducedMotion: reducedMotion.value }
|
|
53
|
+
);
|
|
49
54
|
});
|
|
50
55
|
onBeforeUnmount(() => {
|
|
51
56
|
engine?.destroy();
|
|
@@ -61,6 +66,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
61
66
|
const layer1Duration = computed(() => `${__props.speed}s`);
|
|
62
67
|
const layer2Duration = computed(() => `${__props.speed * 2}s`);
|
|
63
68
|
const layer3Duration = computed(() => `${__props.speed * 3}s`);
|
|
69
|
+
watch(
|
|
70
|
+
reducedMotion,
|
|
71
|
+
(next) => {
|
|
72
|
+
engine?.setOptions({ reducedMotion: next });
|
|
73
|
+
},
|
|
74
|
+
{ flush: "post" }
|
|
75
|
+
);
|
|
64
76
|
return (_ctx, _cache) => {
|
|
65
77
|
return openBlock(), createElementBlock("div", {
|
|
66
78
|
ref: "host",
|
|
@@ -16,6 +16,12 @@ export interface BgStarsLiveOptions {
|
|
|
16
16
|
stiffness?: number;
|
|
17
17
|
/** Spring damping for parallax (default: 20). */
|
|
18
18
|
damping?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Reduced-motion preference, owned by the wrapper (the core never reads
|
|
21
|
+
* `matchMedia`). When true the parallax is parked at rest and the loop idles;
|
|
22
|
+
* a flip back to false resumes it.
|
|
23
|
+
*/
|
|
24
|
+
reducedMotion?: boolean;
|
|
19
25
|
}
|
|
20
26
|
export interface BgStarsEngine {
|
|
21
27
|
setOptions(next: Partial<BgStarsLiveOptions>): void;
|
|
@@ -20,12 +20,19 @@ function createBgStars(el, options, random = Math.random) {
|
|
|
20
20
|
let targetY = 0;
|
|
21
21
|
let velocityX = 0;
|
|
22
22
|
let velocityY = 0;
|
|
23
|
+
let reducedMotion = options.reducedMotion ?? false;
|
|
23
24
|
let rafId = null;
|
|
24
25
|
let destroyed = false;
|
|
25
26
|
function applyTransform() {
|
|
26
27
|
el.parallax.style.transform = `translate(${springX}px, ${springY}px)`;
|
|
27
28
|
}
|
|
28
29
|
function tick() {
|
|
30
|
+
if (reducedMotion) {
|
|
31
|
+
springX = springY = targetX = targetY = velocityX = velocityY = 0;
|
|
32
|
+
applyTransform();
|
|
33
|
+
rafId = null;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
29
36
|
const forceX = (targetX - springX) * (stiffness / 1e3);
|
|
30
37
|
const forceY = (targetY - springY) * (stiffness / 1e3);
|
|
31
38
|
velocityX = velocityX * (1 - damping / 100) + forceX;
|
|
@@ -36,6 +43,7 @@ function createBgStars(el, options, random = Math.random) {
|
|
|
36
43
|
rafId = requestAnimationFrame(tick);
|
|
37
44
|
}
|
|
38
45
|
function handleMouseMove(e) {
|
|
46
|
+
if (reducedMotion) return;
|
|
39
47
|
const centerX = window.innerWidth / 2;
|
|
40
48
|
const centerY = window.innerHeight / 2;
|
|
41
49
|
targetX = -(e.clientX - centerX) * factor;
|
|
@@ -43,13 +51,25 @@ function createBgStars(el, options, random = Math.random) {
|
|
|
43
51
|
}
|
|
44
52
|
el.host.addEventListener("mousemove", handleMouseMove);
|
|
45
53
|
applyTransform();
|
|
46
|
-
rafId = requestAnimationFrame(tick);
|
|
54
|
+
if (!reducedMotion) rafId = requestAnimationFrame(tick);
|
|
47
55
|
return {
|
|
48
56
|
setOptions(next) {
|
|
49
57
|
if (destroyed) return;
|
|
50
58
|
if (next.factor !== void 0) factor = next.factor;
|
|
51
59
|
if (next.stiffness !== void 0) stiffness = next.stiffness;
|
|
52
60
|
if (next.damping !== void 0) damping = next.damping;
|
|
61
|
+
if (next.reducedMotion !== void 0 && next.reducedMotion !== reducedMotion) {
|
|
62
|
+
reducedMotion = next.reducedMotion;
|
|
63
|
+
if (reducedMotion) {
|
|
64
|
+
if (rafId !== null) {
|
|
65
|
+
cancelAnimationFrame(rafId);
|
|
66
|
+
rafId = null;
|
|
67
|
+
}
|
|
68
|
+
tick();
|
|
69
|
+
} else if (rafId === null) {
|
|
70
|
+
rafId = requestAnimationFrame(tick);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
53
73
|
},
|
|
54
74
|
resize() {
|
|
55
75
|
},
|
|
@@ -1,85 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
-
...{ name: "Book", inheritAttrs: false },
|
|
7
|
-
__name: "Book",
|
|
8
|
-
props: {
|
|
9
|
-
class: { type: [Boolean, null, String, Object, Array], default: "" },
|
|
10
|
-
duration: { default: 1e3 },
|
|
11
|
-
color: { default: "zinc" },
|
|
12
|
-
isStatic: { type: Boolean, default: false },
|
|
13
|
-
size: { default: "md" },
|
|
14
|
-
radius: { default: "md" },
|
|
15
|
-
shadowSize: { default: "lg" }
|
|
16
|
-
},
|
|
17
|
-
setup(__props) {
|
|
18
|
-
const props = __props;
|
|
19
|
-
const attrs = useAttrs();
|
|
20
|
-
const computedGradient = computed(() => BOOK_COLOR_MAP[props.color] || BOOK_COLOR_MAP.zinc);
|
|
21
|
-
return (_ctx, _cache) => {
|
|
22
|
-
return openBlock(), createElementBlock("div", mergeProps(unref(attrs), {
|
|
23
|
-
class: unref(cn)(
|
|
24
|
-
"group z-10 w-min [--shadowColor:#bbb] [perspective:800px] dark:[--shadowColor:#111]",
|
|
25
|
-
props.class
|
|
26
|
-
)
|
|
27
|
-
}), [
|
|
28
|
-
createElementVNode("div", {
|
|
29
|
-
style: normalizeStyle({ width: unref(BOOK_SIZE_MAP)[__props.size].width, transition: `transform ${__props.duration}ms ease` }),
|
|
30
|
-
class: normalizeClass(
|
|
31
|
-
unref(cn)(
|
|
32
|
-
"relative aspect-[3/4] [transform-style:preserve-3d]",
|
|
33
|
-
__props.isStatic ? "[transform:rotateY(-30deg)]" : "[transform:rotateY(0deg)] group-hover:[transform:rotateY(-30deg)]",
|
|
34
|
-
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
35
|
-
)
|
|
36
|
-
)
|
|
37
|
-
}, [
|
|
38
|
-
createElementVNode("div", {
|
|
39
|
-
class: normalizeClass(
|
|
40
|
-
unref(cn)(
|
|
41
|
-
"absolute inset-y-0 left-0 flex size-full flex-col justify-end overflow-hidden bg-gradient-to-tr p-6 text-white",
|
|
42
|
-
computedGradient.value.from,
|
|
43
|
-
computedGradient.value.to,
|
|
44
|
-
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
45
|
-
)
|
|
46
|
-
),
|
|
47
|
-
style: { "transform": "translateZ(25px)", "box-shadow": "5px 5px 20px var(--shadowColor)" }
|
|
48
|
-
}, [
|
|
49
|
-
_cache[0] || (_cache[0] = createElementVNode("div", {
|
|
50
|
-
class: "absolute top-0 left-0 h-full",
|
|
51
|
-
style: { "min-width": "8.2%", "background": "linear-gradient(\n 90deg,\n hsla(0, 0%, 100%, 0),\n hsla(0, 0%, 100%, 0) 12%,\n hsla(0, 0%, 100%, 0.25) 29.25%,\n hsla(0, 0%, 100%, 0) 50.5%,\n hsla(0, 0%, 100%, 0) 75.25%,\n hsla(0, 0%, 100%, 0.25) 91%,\n hsla(0, 0%, 100%, 0)\n ),\n linear-gradient(\n 90deg,\n rgba(0, 0, 0, 0.03),\n rgba(0, 0, 0, 0.1) 12%,\n transparent 30%,\n rgba(0, 0, 0, 0.02) 50%,\n rgba(0, 0, 0, 0.2) 73.5%,\n rgba(0, 0, 0, 0.5) 75.25%,\n rgba(0, 0, 0, 0.15) 85.25%,\n transparent\n )", "opacity": "0.2" }
|
|
52
|
-
}, null, -1)),
|
|
53
|
-
createElementVNode("div", _hoisted_1, [
|
|
54
|
-
renderSlot(_ctx.$slots, "default")
|
|
55
|
-
])
|
|
56
|
-
], 2),
|
|
57
|
-
createElementVNode("div", {
|
|
58
|
-
class: "absolute left-0 bg-white",
|
|
59
|
-
style: normalizeStyle({
|
|
60
|
-
top: "3px",
|
|
61
|
-
bottom: "3px",
|
|
62
|
-
width: "48px",
|
|
63
|
-
transform: `translateX(${unref(BOOK_SIZE_MAP)[__props.size].spineTranslation}) rotateY(90deg)`,
|
|
64
|
-
background: "linear-gradient(90deg, rgba(255,255,255,1) 50%, rgba(249,249,249,1) 50%)"
|
|
65
|
-
})
|
|
66
|
-
}, null, 4),
|
|
67
|
-
createElementVNode("div", {
|
|
68
|
-
class: normalizeClass(
|
|
69
|
-
unref(cn)(
|
|
70
|
-
"absolute inset-y-0 left-0 flex size-full flex-col justify-end overflow-hidden bg-gradient-to-tr p-6 text-white",
|
|
71
|
-
computedGradient.value.from,
|
|
72
|
-
computedGradient.value.to,
|
|
73
|
-
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
74
|
-
)
|
|
75
|
-
),
|
|
76
|
-
style: normalizeStyle({ transform: "translateZ(-25px)", boxShadow: unref(BOOK_SHADOW_SIZE_MAP)[__props.shadowSize] })
|
|
77
|
-
}, null, 6)
|
|
78
|
-
], 6)
|
|
79
|
-
], 16);
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
});
|
|
1
|
+
import _sfc_main from "./Book.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const Book = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-05eed92f"]]);
|
|
83
5
|
export {
|
|
84
|
-
|
|
6
|
+
Book as default
|
|
85
7
|
};
|
|
@@ -1,4 +1,85 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent, useAttrs, computed, createElementBlock, openBlock, mergeProps, unref, createElementVNode, normalizeClass, normalizeStyle, renderSlot } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import { BOOK_COLOR_MAP, BOOK_RADIUS_MAP, BOOK_SIZE_MAP, BOOK_SHADOW_SIZE_MAP } from "./index.js";
|
|
4
|
+
const _hoisted_1 = { class: "pl-1" };
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
...{ name: "Book", inheritAttrs: false },
|
|
7
|
+
__name: "Book",
|
|
8
|
+
props: {
|
|
9
|
+
class: { type: [Boolean, null, String, Object, Array], default: "" },
|
|
10
|
+
duration: { default: 1e3 },
|
|
11
|
+
color: { default: "zinc" },
|
|
12
|
+
isStatic: { type: Boolean, default: false },
|
|
13
|
+
size: { default: "md" },
|
|
14
|
+
radius: { default: "md" },
|
|
15
|
+
shadowSize: { default: "lg" }
|
|
16
|
+
},
|
|
17
|
+
setup(__props) {
|
|
18
|
+
const props = __props;
|
|
19
|
+
const attrs = useAttrs();
|
|
20
|
+
const computedGradient = computed(() => BOOK_COLOR_MAP[props.color] || BOOK_COLOR_MAP.zinc);
|
|
21
|
+
return (_ctx, _cache) => {
|
|
22
|
+
return openBlock(), createElementBlock("div", mergeProps(unref(attrs), {
|
|
23
|
+
class: unref(cn)(
|
|
24
|
+
"group z-10 w-min [--shadowColor:#bbb] [perspective:800px] dark:[--shadowColor:#111]",
|
|
25
|
+
props.class
|
|
26
|
+
)
|
|
27
|
+
}), [
|
|
28
|
+
createElementVNode("div", {
|
|
29
|
+
style: normalizeStyle({ width: unref(BOOK_SIZE_MAP)[__props.size].width, "--book-duration": `${__props.duration}ms` }),
|
|
30
|
+
class: normalizeClass(
|
|
31
|
+
unref(cn)(
|
|
32
|
+
"book-cover relative aspect-[3/4] [transform-style:preserve-3d]",
|
|
33
|
+
__props.isStatic ? "[transform:rotateY(-30deg)]" : "[transform:rotateY(0deg)] group-hover:[transform:rotateY(-30deg)]",
|
|
34
|
+
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
}, [
|
|
38
|
+
createElementVNode("div", {
|
|
39
|
+
class: normalizeClass(
|
|
40
|
+
unref(cn)(
|
|
41
|
+
"absolute inset-y-0 left-0 flex size-full flex-col justify-end overflow-hidden bg-gradient-to-tr p-6 text-white",
|
|
42
|
+
computedGradient.value.from,
|
|
43
|
+
computedGradient.value.to,
|
|
44
|
+
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
45
|
+
)
|
|
46
|
+
),
|
|
47
|
+
style: { "transform": "translateZ(25px)", "box-shadow": "5px 5px 20px var(--shadowColor)" }
|
|
48
|
+
}, [
|
|
49
|
+
_cache[0] || (_cache[0] = createElementVNode("div", {
|
|
50
|
+
class: "absolute top-0 left-0 h-full",
|
|
51
|
+
style: { "min-width": "8.2%", "background": "linear-gradient(\n 90deg,\n hsla(0, 0%, 100%, 0),\n hsla(0, 0%, 100%, 0) 12%,\n hsla(0, 0%, 100%, 0.25) 29.25%,\n hsla(0, 0%, 100%, 0) 50.5%,\n hsla(0, 0%, 100%, 0) 75.25%,\n hsla(0, 0%, 100%, 0.25) 91%,\n hsla(0, 0%, 100%, 0)\n ),\n linear-gradient(\n 90deg,\n rgba(0, 0, 0, 0.03),\n rgba(0, 0, 0, 0.1) 12%,\n transparent 30%,\n rgba(0, 0, 0, 0.02) 50%,\n rgba(0, 0, 0, 0.2) 73.5%,\n rgba(0, 0, 0, 0.5) 75.25%,\n rgba(0, 0, 0, 0.15) 85.25%,\n transparent\n )", "opacity": "0.2" }
|
|
52
|
+
}, null, -1)),
|
|
53
|
+
createElementVNode("div", _hoisted_1, [
|
|
54
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
55
|
+
])
|
|
56
|
+
], 2),
|
|
57
|
+
createElementVNode("div", {
|
|
58
|
+
class: "absolute left-0 bg-white",
|
|
59
|
+
style: normalizeStyle({
|
|
60
|
+
top: "3px",
|
|
61
|
+
bottom: "3px",
|
|
62
|
+
width: "48px",
|
|
63
|
+
transform: `translateX(${unref(BOOK_SIZE_MAP)[__props.size].spineTranslation}) rotateY(90deg)`,
|
|
64
|
+
background: "linear-gradient(90deg, rgba(255,255,255,1) 50%, rgba(249,249,249,1) 50%)"
|
|
65
|
+
})
|
|
66
|
+
}, null, 4),
|
|
67
|
+
createElementVNode("div", {
|
|
68
|
+
class: normalizeClass(
|
|
69
|
+
unref(cn)(
|
|
70
|
+
"absolute inset-y-0 left-0 flex size-full flex-col justify-end overflow-hidden bg-gradient-to-tr p-6 text-white",
|
|
71
|
+
computedGradient.value.from,
|
|
72
|
+
computedGradient.value.to,
|
|
73
|
+
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
74
|
+
)
|
|
75
|
+
),
|
|
76
|
+
style: normalizeStyle({ transform: "translateZ(-25px)", boxShadow: unref(BOOK_SHADOW_SIZE_MAP)[__props.shadowSize] })
|
|
77
|
+
}, null, 6)
|
|
78
|
+
], 6)
|
|
79
|
+
], 16);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
2
83
|
export {
|
|
3
84
|
_sfc_main as default
|
|
4
85
|
};
|
|
@@ -1,49 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
...{ name: "BoxReveal", inheritAttrs: false },
|
|
6
|
-
__name: "BoxReveal",
|
|
7
|
-
props: {
|
|
8
|
-
color: { default: "#5046e6" },
|
|
9
|
-
duration: { default: 0.5 },
|
|
10
|
-
delay: { default: 0.25 },
|
|
11
|
-
class: { type: [Boolean, null, String, Object, Array] }
|
|
12
|
-
},
|
|
13
|
-
setup(__props) {
|
|
14
|
-
const attrs = useAttrs();
|
|
15
|
-
const containerRef = useTemplateRef("containerRef");
|
|
16
|
-
const isInView = useInView(containerRef, () => ({ threshold: 0.1, once: true }));
|
|
17
|
-
const contentStyle = computed(() => ({
|
|
18
|
-
opacity: isInView.value ? "1" : "0",
|
|
19
|
-
transform: `translateY(${isInView.value ? 0 : 25}px)`,
|
|
20
|
-
transition: `opacity ${__props.duration}s ease ${__props.delay * 2}s,transform ${__props.duration}s ease ${__props.delay * 2}s`
|
|
21
|
-
}));
|
|
22
|
-
const overlayStyle = computed(() => ({
|
|
23
|
-
background: `${__props.color}`,
|
|
24
|
-
left: isInView.value ? "100%" : "0%",
|
|
25
|
-
transition: `left ${__props.duration}s ease-in ${__props.delay}s`
|
|
26
|
-
}));
|
|
27
|
-
return (_ctx, _cache) => {
|
|
28
|
-
return openBlock(), createElementBlock("div", mergeProps(unref(attrs), {
|
|
29
|
-
ref_key: "containerRef",
|
|
30
|
-
ref: containerRef,
|
|
31
|
-
class: unref(cn)("box-reveal relative overflow-hidden", __props.class)
|
|
32
|
-
}), [
|
|
33
|
-
createElementVNode("div", {
|
|
34
|
-
class: "box-reveal-content",
|
|
35
|
-
style: normalizeStyle(contentStyle.value)
|
|
36
|
-
}, [
|
|
37
|
-
renderSlot(_ctx.$slots, "default")
|
|
38
|
-
], 4),
|
|
39
|
-
createElementVNode("div", {
|
|
40
|
-
class: "box-reveal-overlay absolute inset-0 z-20",
|
|
41
|
-
style: normalizeStyle(overlayStyle.value)
|
|
42
|
-
}, null, 4)
|
|
43
|
-
], 16);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
});
|
|
1
|
+
import _sfc_main from "./BoxReveal.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const BoxReveal = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e343dd7c"]]);
|
|
47
5
|
export {
|
|
48
|
-
|
|
6
|
+
BoxReveal as default
|
|
49
7
|
};
|
|
@@ -1,4 +1,51 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent, useAttrs, useTemplateRef, computed, createElementBlock, openBlock, mergeProps, unref, createElementVNode, normalizeStyle, renderSlot } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import { useInView } from "../../internals/motion/use-in-view.js";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
...{ name: "BoxReveal", inheritAttrs: false },
|
|
6
|
+
__name: "BoxReveal",
|
|
7
|
+
props: {
|
|
8
|
+
color: { default: "#5046e6" },
|
|
9
|
+
duration: { default: 0.5 },
|
|
10
|
+
delay: { default: 0.25 },
|
|
11
|
+
class: { type: [Boolean, null, String, Object, Array] }
|
|
12
|
+
},
|
|
13
|
+
setup(__props) {
|
|
14
|
+
const attrs = useAttrs();
|
|
15
|
+
const containerRef = useTemplateRef("containerRef");
|
|
16
|
+
const isInView = useInView(containerRef, () => ({ threshold: 0.1, once: true }));
|
|
17
|
+
const contentStyle = computed(() => ({
|
|
18
|
+
opacity: isInView.value ? "1" : "0",
|
|
19
|
+
transform: `translateY(${isInView.value ? 0 : 25}px)`,
|
|
20
|
+
"--box-reveal-duration": `${__props.duration}s`,
|
|
21
|
+
"--box-reveal-delay": `${__props.delay * 2}s`
|
|
22
|
+
}));
|
|
23
|
+
const overlayStyle = computed(() => ({
|
|
24
|
+
background: `${__props.color}`,
|
|
25
|
+
left: isInView.value ? "100%" : "0%",
|
|
26
|
+
"--box-reveal-duration": `${__props.duration}s`,
|
|
27
|
+
"--box-reveal-delay": `${__props.delay}s`
|
|
28
|
+
}));
|
|
29
|
+
return (_ctx, _cache) => {
|
|
30
|
+
return openBlock(), createElementBlock("div", mergeProps(unref(attrs), {
|
|
31
|
+
ref_key: "containerRef",
|
|
32
|
+
ref: containerRef,
|
|
33
|
+
class: unref(cn)("box-reveal relative overflow-hidden", __props.class)
|
|
34
|
+
}), [
|
|
35
|
+
createElementVNode("div", {
|
|
36
|
+
class: "box-reveal-content",
|
|
37
|
+
style: normalizeStyle(contentStyle.value)
|
|
38
|
+
}, [
|
|
39
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
40
|
+
], 4),
|
|
41
|
+
createElementVNode("div", {
|
|
42
|
+
class: "box-reveal-overlay absolute inset-0 z-20",
|
|
43
|
+
style: normalizeStyle(overlayStyle.value)
|
|
44
|
+
}, null, 4)
|
|
45
|
+
], 16);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
2
49
|
export {
|
|
3
50
|
_sfc_main as default
|
|
4
51
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./StarField.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const StarField = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const StarField = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-06a2b4e6"]]);
|
|
5
5
|
export {
|
|
6
6
|
StarField as default
|
|
7
7
|
};
|
|
@@ -2,7 +2,7 @@ import _sfc_main from "./ContainerTextFlip.vue2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
4
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const ContainerTextFlip = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const ContainerTextFlip = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ad8bc4bd"]]);
|
|
6
6
|
export {
|
|
7
7
|
ContainerTextFlip as default
|
|
8
8
|
};
|