fancy-ui-vue 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- 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/frost-glass/FrostGlass.vue.d.ts +31 -0
- package/dist/components/frost-glass/FrostGlass.vue.js +90 -0
- package/dist/components/frost-glass/FrostGlass.vue2.js +4 -0
- package/dist/components/frost-glass/frost-glass-core.d.ts +155 -0
- package/dist/components/frost-glass/frost-glass-core.js +820 -0
- package/dist/components/frost-glass/index.d.ts +2 -0
- package/dist/components/gift-reveal/GiftReveal.vue.d.ts +50 -0
- package/dist/components/gift-reveal/GiftReveal.vue.js +7 -0
- package/dist/components/gift-reveal/GiftReveal.vue2.js +177 -0
- package/dist/components/gift-reveal/gift-reveal-core.d.ts +109 -0
- package/dist/components/gift-reveal/gift-reveal-core.js +116 -0
- package/dist/components/gift-reveal/index.d.ts +2 -0
- 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/ornament/Ornament.vue.d.ts +29 -0
- package/dist/components/ornament/Ornament.vue.js +112 -0
- package/dist/components/ornament/Ornament.vue2.js +4 -0
- package/dist/components/ornament/index.d.ts +2 -0
- package/dist/components/ornament/ornament-core.d.ts +177 -0
- package/dist/components/ornament/ornament-core.js +861 -0
- package/dist/components/ripple/Ripple.vue.js +1 -1
- package/dist/components/ripple/Ripple.vue2.js +6 -1
- package/dist/components/snowfall/Snowfall.vue.d.ts +29 -0
- package/dist/components/snowfall/Snowfall.vue.js +81 -0
- package/dist/components/snowfall/Snowfall.vue2.js +4 -0
- package/dist/components/snowfall/index.d.ts +2 -0
- package/dist/components/snowfall/snowfall-core.d.ts +119 -0
- package/dist/components/snowfall/snowfall-core.js +483 -0
- 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/string-lights/StringLights.vue.d.ts +35 -0
- package/dist/components/string-lights/StringLights.vue.js +7 -0
- package/dist/components/string-lights/StringLights.vue2.js +98 -0
- package/dist/components/string-lights/index.d.ts +2 -0
- package/dist/components/string-lights/string-lights-core.d.ts +157 -0
- package/dist/components/string-lights/string-lights-core.js +228 -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.d.ts +5 -0
- package/dist/index.js +393 -386
- package/dist/styles.css +1669 -185
- package/package.json +2 -2
- 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,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, onMounted, watch, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, unref, createCommentVNode, Fragment, renderList, createElementVNode, toDisplayString } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
3
4
|
const _hoisted_1 = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "cursor-blink"
|
|
@@ -26,6 +27,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26
27
|
const GLITCH_GLYPHS = "アイウエオ@#$%&!?░▒▓█▄▀■□▪▫";
|
|
27
28
|
const displayedLines = ref([]);
|
|
28
29
|
const done = ref(false);
|
|
30
|
+
const reducedMotion = useReducedMotion();
|
|
29
31
|
const glitchState = ref(null);
|
|
30
32
|
let timeouts = [];
|
|
31
33
|
let glitchLoopId = null;
|
|
@@ -40,6 +42,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40
42
|
glitchRestoreId = null;
|
|
41
43
|
}
|
|
42
44
|
}
|
|
45
|
+
function restoreGlitch() {
|
|
46
|
+
const live = glitchState.value;
|
|
47
|
+
if (!live) return;
|
|
48
|
+
const { lineIdx, charIdx, original } = live;
|
|
49
|
+
displayedLines.value = displayedLines.value.map(
|
|
50
|
+
(line, idx) => idx === lineIdx ? line.slice(0, charIdx) + original + line.slice(charIdx + 1) : line
|
|
51
|
+
);
|
|
52
|
+
glitchState.value = null;
|
|
53
|
+
}
|
|
43
54
|
function scheduleTimeout(fn, ms) {
|
|
44
55
|
const id = setTimeout(fn, ms);
|
|
45
56
|
timeouts.push(id);
|
|
@@ -49,11 +60,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
49
60
|
timeouts.forEach(clearTimeout);
|
|
50
61
|
timeouts = [];
|
|
51
62
|
}
|
|
63
|
+
let streamedReduced = false;
|
|
64
|
+
function showAllLines() {
|
|
65
|
+
clearAllTimeouts();
|
|
66
|
+
displayedLines.value = [...__props.lines];
|
|
67
|
+
done.value = true;
|
|
68
|
+
__props.onComplete?.();
|
|
69
|
+
}
|
|
52
70
|
function streamLines() {
|
|
53
71
|
clearAllTimeouts();
|
|
54
72
|
displayedLines.value = [];
|
|
55
73
|
done.value = false;
|
|
56
74
|
glitchState.value = null;
|
|
75
|
+
streamedReduced = reducedMotion.value;
|
|
76
|
+
if (streamedReduced) {
|
|
77
|
+
scheduleTimeout(showAllLines, __props.delay);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
57
80
|
let totalDelay = __props.delay;
|
|
58
81
|
for (let lineIdx = 0; lineIdx < __props.lines.length; lineIdx++) {
|
|
59
82
|
const line = __props.lines[lineIdx];
|
|
@@ -117,7 +140,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
117
140
|
}
|
|
118
141
|
onMounted(() => {
|
|
119
142
|
streamLines();
|
|
120
|
-
if (__props.glitch) startGlitchLoop();
|
|
143
|
+
if (__props.glitch && !reducedMotion.value) startGlitchLoop();
|
|
121
144
|
});
|
|
122
145
|
watch(
|
|
123
146
|
[() => JSON.stringify(__props.lines), () => __props.speed, () => __props.delay],
|
|
@@ -127,13 +150,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
127
150
|
{ flush: "post" }
|
|
128
151
|
);
|
|
129
152
|
watch(
|
|
130
|
-
() =>
|
|
153
|
+
() => reducedMotion.value,
|
|
131
154
|
(value) => {
|
|
155
|
+
if (!value || done.value || streamedReduced) return;
|
|
156
|
+
streamedReduced = true;
|
|
157
|
+
showAllLines();
|
|
158
|
+
},
|
|
159
|
+
{ flush: "post" }
|
|
160
|
+
);
|
|
161
|
+
watch(
|
|
162
|
+
[() => __props.glitch, () => reducedMotion.value],
|
|
163
|
+
([value, reduced]) => {
|
|
132
164
|
stopGlitchLoop();
|
|
133
|
-
if (value) {
|
|
165
|
+
if (value && !reduced) {
|
|
134
166
|
startGlitchLoop();
|
|
135
167
|
} else {
|
|
136
|
-
|
|
168
|
+
restoreGlitch();
|
|
137
169
|
}
|
|
138
170
|
},
|
|
139
171
|
{ flush: "post" }
|
|
@@ -1,74 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
__name: "TextGenerateEffect",
|
|
6
|
-
props: {
|
|
7
|
-
words: {},
|
|
8
|
-
filter: { type: Boolean, default: true },
|
|
9
|
-
duration: { default: 0.7 },
|
|
10
|
-
delay: { default: 0 },
|
|
11
|
-
stagger: { default: 200 },
|
|
12
|
-
class: { type: [Boolean, null, String, Object, Array] }
|
|
13
|
-
},
|
|
14
|
-
setup(__props) {
|
|
15
|
-
const wordsArray = computed(() => __props.words.split(" "));
|
|
16
|
-
const scopeRef = useTemplateRef("scopeRef");
|
|
17
|
-
let revealSpans = null;
|
|
18
|
-
let revealTimeout = null;
|
|
19
|
-
function stopReveal() {
|
|
20
|
-
if (revealTimeout) clearTimeout(revealTimeout);
|
|
21
|
-
revealTimeout = null;
|
|
22
|
-
revealSpans?.forEach((span) => {
|
|
23
|
-
if (span._tid) clearTimeout(span._tid);
|
|
24
|
-
});
|
|
25
|
-
revealSpans = null;
|
|
26
|
-
}
|
|
27
|
-
function startReveal() {
|
|
28
|
-
const scope = scopeRef.value;
|
|
29
|
-
if (!scope) return;
|
|
30
|
-
const spans = scope.querySelectorAll("span");
|
|
31
|
-
revealSpans = spans;
|
|
32
|
-
revealTimeout = setTimeout(() => {
|
|
33
|
-
revealTimeout = null;
|
|
34
|
-
spans.forEach((span, index) => {
|
|
35
|
-
span._tid = setTimeout(() => {
|
|
36
|
-
span.style.opacity = "1";
|
|
37
|
-
span.style.filter = __props.filter ? "blur(0px)" : "none";
|
|
38
|
-
}, index * __props.stagger);
|
|
39
|
-
});
|
|
40
|
-
}, __props.delay);
|
|
41
|
-
}
|
|
42
|
-
onMounted(startReveal);
|
|
43
|
-
watch(
|
|
44
|
-
() => __props.words,
|
|
45
|
-
() => {
|
|
46
|
-
stopReveal();
|
|
47
|
-
startReveal();
|
|
48
|
-
},
|
|
49
|
-
{ flush: "post" }
|
|
50
|
-
);
|
|
51
|
-
onBeforeUnmount(stopReveal);
|
|
52
|
-
return (_ctx, _cache) => {
|
|
53
|
-
return openBlock(), createElementBlock("div", {
|
|
54
|
-
class: normalizeClass(unref(cn)("leading-snug tracking-wide", __props.class))
|
|
55
|
-
}, [
|
|
56
|
-
createElementVNode("div", {
|
|
57
|
-
ref_key: "scopeRef",
|
|
58
|
-
ref: scopeRef
|
|
59
|
-
}, [
|
|
60
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(wordsArray.value, (word, idx) => {
|
|
61
|
-
return openBlock(), createElementBlock("span", {
|
|
62
|
-
key: word + idx,
|
|
63
|
-
class: "inline-block",
|
|
64
|
-
style: normalizeStyle(`opacity: 0; filter: ${__props.filter ? "blur(10px)" : "none"}; transition: opacity ${__props.duration}s, filter ${__props.duration}s;`)
|
|
65
|
-
}, toDisplayString(word) + " ", 5);
|
|
66
|
-
}), 128))
|
|
67
|
-
], 512)
|
|
68
|
-
], 2);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
});
|
|
1
|
+
import _sfc_main from "./TextGenerateEffect.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const TextGenerateEffect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3e55378a"]]);
|
|
72
5
|
export {
|
|
73
|
-
|
|
6
|
+
TextGenerateEffect as default
|
|
74
7
|
};
|
|
@@ -1,4 +1,77 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent, computed, useTemplateRef, onMounted, watch, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, Fragment, renderList, normalizeStyle, toDisplayString } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
...{ name: "TextGenerateEffect", inheritAttrs: false },
|
|
5
|
+
__name: "TextGenerateEffect",
|
|
6
|
+
props: {
|
|
7
|
+
words: {},
|
|
8
|
+
filter: { type: Boolean, default: true },
|
|
9
|
+
duration: { default: 0.7 },
|
|
10
|
+
delay: { default: 0 },
|
|
11
|
+
stagger: { default: 200 },
|
|
12
|
+
class: { type: [Boolean, null, String, Object, Array] }
|
|
13
|
+
},
|
|
14
|
+
setup(__props) {
|
|
15
|
+
const wordsArray = computed(() => __props.words.split(" "));
|
|
16
|
+
const scopeRef = useTemplateRef("scopeRef");
|
|
17
|
+
let revealSpans = null;
|
|
18
|
+
let revealTimeout = null;
|
|
19
|
+
function stopReveal() {
|
|
20
|
+
if (revealTimeout) clearTimeout(revealTimeout);
|
|
21
|
+
revealTimeout = null;
|
|
22
|
+
revealSpans?.forEach((span) => {
|
|
23
|
+
if (span._tid) clearTimeout(span._tid);
|
|
24
|
+
});
|
|
25
|
+
revealSpans = null;
|
|
26
|
+
}
|
|
27
|
+
function startReveal() {
|
|
28
|
+
const scope = scopeRef.value;
|
|
29
|
+
if (!scope) return;
|
|
30
|
+
const spans = scope.querySelectorAll("span");
|
|
31
|
+
revealSpans = spans;
|
|
32
|
+
revealTimeout = setTimeout(() => {
|
|
33
|
+
revealTimeout = null;
|
|
34
|
+
spans.forEach((span, index) => {
|
|
35
|
+
span._tid = setTimeout(() => {
|
|
36
|
+
span.style.opacity = "1";
|
|
37
|
+
span.style.filter = __props.filter ? "blur(0px)" : "none";
|
|
38
|
+
}, index * __props.stagger);
|
|
39
|
+
});
|
|
40
|
+
}, __props.delay);
|
|
41
|
+
}
|
|
42
|
+
onMounted(startReveal);
|
|
43
|
+
watch(
|
|
44
|
+
() => __props.words,
|
|
45
|
+
() => {
|
|
46
|
+
stopReveal();
|
|
47
|
+
startReveal();
|
|
48
|
+
},
|
|
49
|
+
{ flush: "post" }
|
|
50
|
+
);
|
|
51
|
+
onBeforeUnmount(stopReveal);
|
|
52
|
+
return (_ctx, _cache) => {
|
|
53
|
+
return openBlock(), createElementBlock("div", {
|
|
54
|
+
class: normalizeClass(unref(cn)("text-generate-effect leading-snug tracking-wide", __props.class))
|
|
55
|
+
}, [
|
|
56
|
+
createElementVNode("div", {
|
|
57
|
+
ref_key: "scopeRef",
|
|
58
|
+
ref: scopeRef
|
|
59
|
+
}, [
|
|
60
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(wordsArray.value, (word, idx) => {
|
|
61
|
+
return openBlock(), createElementBlock("span", {
|
|
62
|
+
key: word + idx,
|
|
63
|
+
class: "tge-word inline-block",
|
|
64
|
+
style: normalizeStyle({
|
|
65
|
+
"--tge-duration": `${__props.duration}s`,
|
|
66
|
+
"--tge-blur": __props.filter ? "blur(10px)" : "none"
|
|
67
|
+
})
|
|
68
|
+
}, toDisplayString(word) + " ", 5);
|
|
69
|
+
}), 128))
|
|
70
|
+
], 512)
|
|
71
|
+
], 2);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
2
75
|
export {
|
|
3
76
|
_sfc_main as default
|
|
4
77
|
};
|
|
@@ -1,103 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
const _hoisted_2 = { class: "overflow-hidden [mask-image:linear-gradient(to_bottom,transparent,white,transparent)]" };
|
|
6
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
-
...{ name: "TextRevealCard", inheritAttrs: false },
|
|
8
|
-
__name: "TextRevealCard",
|
|
9
|
-
props: {
|
|
10
|
-
class: { type: [Boolean, null, String, Object, Array], default: "" },
|
|
11
|
-
starsCount: { default: 130 },
|
|
12
|
-
starsClass: { default: "" },
|
|
13
|
-
starsSeed: {}
|
|
14
|
-
},
|
|
15
|
-
setup(__props) {
|
|
16
|
-
const cardRef = useTemplateRef("cardRef");
|
|
17
|
-
const widthPercentage = ref(0);
|
|
18
|
-
const isMouseOver = ref(false);
|
|
19
|
-
const rotateDeg = computed(() => (widthPercentage.value - 50) * 0.1);
|
|
20
|
-
function mouseMoveHandler(event) {
|
|
21
|
-
event.preventDefault();
|
|
22
|
-
const card = cardRef.value;
|
|
23
|
-
if (card) {
|
|
24
|
-
const rect = card.getBoundingClientRect();
|
|
25
|
-
const relativeX = event.clientX - rect.left;
|
|
26
|
-
widthPercentage.value = relativeX / rect.width * 100;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function mouseLeaveHandler() {
|
|
30
|
-
isMouseOver.value = false;
|
|
31
|
-
setTimeout(() => {
|
|
32
|
-
if (!isMouseOver.value) {
|
|
33
|
-
widthPercentage.value = 0;
|
|
34
|
-
}
|
|
35
|
-
}, 100);
|
|
36
|
-
}
|
|
37
|
-
function mouseEnterHandler() {
|
|
38
|
-
isMouseOver.value = true;
|
|
39
|
-
}
|
|
40
|
-
function touchMoveHandler(event) {
|
|
41
|
-
const card = cardRef.value;
|
|
42
|
-
if (card) {
|
|
43
|
-
const rect = card.getBoundingClientRect();
|
|
44
|
-
const relativeX = event.touches[0].clientX - rect.left;
|
|
45
|
-
widthPercentage.value = relativeX / rect.width * 100;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return (_ctx, _cache) => {
|
|
49
|
-
return openBlock(), createElementBlock("div", {
|
|
50
|
-
ref_key: "cardRef",
|
|
51
|
-
ref: cardRef,
|
|
52
|
-
class: normalizeClass(
|
|
53
|
-
unref(cn)(
|
|
54
|
-
"relative w-full max-w-[40rem] touch-pan-y touch-pinch-zoom overflow-hidden rounded-lg border border-white/[0.08] bg-[#1d1c20] p-4 sm:p-6 md:p-8",
|
|
55
|
-
__props.class
|
|
56
|
-
)
|
|
57
|
-
),
|
|
58
|
-
role: "presentation",
|
|
59
|
-
onMouseenter: mouseEnterHandler,
|
|
60
|
-
onMouseleave: mouseLeaveHandler,
|
|
61
|
-
onMousemove: mouseMoveHandler,
|
|
62
|
-
onTouchstart: mouseEnterHandler,
|
|
63
|
-
onTouchend: mouseLeaveHandler,
|
|
64
|
-
onTouchmove: touchMoveHandler
|
|
65
|
-
}, [
|
|
66
|
-
renderSlot(_ctx.$slots, "default"),
|
|
67
|
-
createElementVNode("div", _hoisted_1, [
|
|
68
|
-
createElementVNode("div", {
|
|
69
|
-
style: normalizeStyle({
|
|
70
|
-
width: "100%",
|
|
71
|
-
opacity: widthPercentage.value > 0 ? 1 : 0,
|
|
72
|
-
clipPath: `inset(0 ${100 - widthPercentage.value}% 0 0)`,
|
|
73
|
-
transition: isMouseOver.value ? "none" : "all 0.4s ease-out"
|
|
74
|
-
}),
|
|
75
|
-
class: "absolute z-20 bg-[#1d1c20] will-change-transform"
|
|
76
|
-
}, [
|
|
77
|
-
renderSlot(_ctx.$slots, "text")
|
|
78
|
-
], 4),
|
|
79
|
-
createElementVNode("div", {
|
|
80
|
-
style: normalizeStyle({
|
|
81
|
-
left: `${widthPercentage.value}%`,
|
|
82
|
-
transform: `rotate(${rotateDeg.value}deg)`,
|
|
83
|
-
opacity: widthPercentage.value > 0 ? 1 : 0,
|
|
84
|
-
transition: isMouseOver.value ? "none" : "all 0.4s ease-out"
|
|
85
|
-
}),
|
|
86
|
-
class: "absolute z-50 h-40 w-[8px] bg-gradient-to-b from-transparent via-neutral-800 to-transparent will-change-transform"
|
|
87
|
-
}, null, 4),
|
|
88
|
-
createElementVNode("div", _hoisted_2, [
|
|
89
|
-
renderSlot(_ctx.$slots, "revealText"),
|
|
90
|
-
createVNode(TextRevealStars, {
|
|
91
|
-
starsCount: __props.starsCount,
|
|
92
|
-
class: normalizeClass(__props.starsClass),
|
|
93
|
-
seed: __props.starsSeed
|
|
94
|
-
}, null, 8, ["starsCount", "class", "seed"])
|
|
95
|
-
])
|
|
96
|
-
])
|
|
97
|
-
], 34);
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
});
|
|
1
|
+
import _sfc_main from "./TextRevealCard.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const TextRevealCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7675d2f2"]]);
|
|
101
5
|
export {
|
|
102
|
-
|
|
6
|
+
TextRevealCard as default
|
|
103
7
|
};
|
|
@@ -1,4 +1,101 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent, useTemplateRef, ref, computed, createElementBlock, openBlock, normalizeClass, unref, renderSlot, createElementVNode, normalizeStyle, createVNode } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import TextRevealStars from "./TextRevealStars.vue.js";
|
|
4
|
+
const _hoisted_1 = { class: "relative flex h-40 items-center overflow-hidden" };
|
|
5
|
+
const _hoisted_2 = { class: "overflow-hidden [mask-image:linear-gradient(to_bottom,transparent,white,transparent)]" };
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
...{ name: "TextRevealCard", inheritAttrs: false },
|
|
8
|
+
__name: "TextRevealCard",
|
|
9
|
+
props: {
|
|
10
|
+
class: { type: [Boolean, null, String, Object, Array], default: "" },
|
|
11
|
+
starsCount: { default: 130 },
|
|
12
|
+
starsClass: { default: "" },
|
|
13
|
+
starsSeed: {}
|
|
14
|
+
},
|
|
15
|
+
setup(__props) {
|
|
16
|
+
const cardRef = useTemplateRef("cardRef");
|
|
17
|
+
const widthPercentage = ref(0);
|
|
18
|
+
const isMouseOver = ref(false);
|
|
19
|
+
const rotateDeg = computed(() => (widthPercentage.value - 50) * 0.1);
|
|
20
|
+
function mouseMoveHandler(event) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
const card = cardRef.value;
|
|
23
|
+
if (card) {
|
|
24
|
+
const rect = card.getBoundingClientRect();
|
|
25
|
+
const relativeX = event.clientX - rect.left;
|
|
26
|
+
widthPercentage.value = relativeX / rect.width * 100;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function mouseLeaveHandler() {
|
|
30
|
+
isMouseOver.value = false;
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
if (!isMouseOver.value) {
|
|
33
|
+
widthPercentage.value = 0;
|
|
34
|
+
}
|
|
35
|
+
}, 100);
|
|
36
|
+
}
|
|
37
|
+
function mouseEnterHandler() {
|
|
38
|
+
isMouseOver.value = true;
|
|
39
|
+
}
|
|
40
|
+
function touchMoveHandler(event) {
|
|
41
|
+
const card = cardRef.value;
|
|
42
|
+
if (card) {
|
|
43
|
+
const rect = card.getBoundingClientRect();
|
|
44
|
+
const relativeX = event.touches[0].clientX - rect.left;
|
|
45
|
+
widthPercentage.value = relativeX / rect.width * 100;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return (_ctx, _cache) => {
|
|
49
|
+
return openBlock(), createElementBlock("div", {
|
|
50
|
+
ref_key: "cardRef",
|
|
51
|
+
ref: cardRef,
|
|
52
|
+
class: normalizeClass(
|
|
53
|
+
unref(cn)(
|
|
54
|
+
"relative w-full max-w-[40rem] touch-pan-y touch-pinch-zoom overflow-hidden rounded-lg border border-white/[0.08] bg-[#1d1c20] p-4 sm:p-6 md:p-8",
|
|
55
|
+
__props.class
|
|
56
|
+
)
|
|
57
|
+
),
|
|
58
|
+
role: "presentation",
|
|
59
|
+
onMouseenter: mouseEnterHandler,
|
|
60
|
+
onMouseleave: mouseLeaveHandler,
|
|
61
|
+
onMousemove: mouseMoveHandler,
|
|
62
|
+
onTouchstart: mouseEnterHandler,
|
|
63
|
+
onTouchend: mouseLeaveHandler,
|
|
64
|
+
onTouchmove: touchMoveHandler
|
|
65
|
+
}, [
|
|
66
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true),
|
|
67
|
+
createElementVNode("div", _hoisted_1, [
|
|
68
|
+
createElementVNode("div", {
|
|
69
|
+
style: normalizeStyle({
|
|
70
|
+
width: "100%",
|
|
71
|
+
opacity: widthPercentage.value > 0 ? 1 : 0,
|
|
72
|
+
clipPath: `inset(0 ${100 - widthPercentage.value}% 0 0)`
|
|
73
|
+
}),
|
|
74
|
+
class: normalizeClass(["absolute z-20 bg-[#1d1c20] will-change-transform", { "text-reveal-settle": !isMouseOver.value }])
|
|
75
|
+
}, [
|
|
76
|
+
renderSlot(_ctx.$slots, "text", {}, void 0, true)
|
|
77
|
+
], 6),
|
|
78
|
+
createElementVNode("div", {
|
|
79
|
+
style: normalizeStyle({
|
|
80
|
+
left: `${widthPercentage.value}%`,
|
|
81
|
+
transform: `rotate(${rotateDeg.value}deg)`,
|
|
82
|
+
opacity: widthPercentage.value > 0 ? 1 : 0
|
|
83
|
+
}),
|
|
84
|
+
class: normalizeClass(["absolute z-50 h-40 w-[8px] bg-gradient-to-b from-transparent via-neutral-800 to-transparent will-change-transform", { "text-reveal-settle": !isMouseOver.value }])
|
|
85
|
+
}, null, 6),
|
|
86
|
+
createElementVNode("div", _hoisted_2, [
|
|
87
|
+
renderSlot(_ctx.$slots, "revealText", {}, void 0, true),
|
|
88
|
+
createVNode(TextRevealStars, {
|
|
89
|
+
starsCount: __props.starsCount,
|
|
90
|
+
class: normalizeClass(__props.starsClass),
|
|
91
|
+
seed: __props.starsSeed
|
|
92
|
+
}, null, 8, ["starsCount", "class", "seed"])
|
|
93
|
+
])
|
|
94
|
+
])
|
|
95
|
+
], 34);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
2
99
|
export {
|
|
3
100
|
_sfc_main as default
|
|
4
101
|
};
|
|
@@ -2,7 +2,7 @@ import _sfc_main from "./TextRevealStars.vue2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
4
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const TextRevealStars = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const TextRevealStars = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ce39bf0f"]]);
|
|
6
6
|
export {
|
|
7
7
|
TextRevealStars as default
|
|
8
8
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { defineComponent, computed, createElementBlock, openBlock, Fragment, renderList, normalizeStyle, normalizeClass, unref } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
|
-
const _hoisted_1 = {
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
class: "absolute inset-0",
|
|
5
|
+
style: { "container-type": "size" }
|
|
6
|
+
};
|
|
4
7
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
8
|
...{ name: "TextRevealStars", inheritAttrs: false },
|
|
6
9
|
__name: "TextRevealStars",
|
|
@@ -22,26 +25,40 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
22
25
|
const stars = computed(() => {
|
|
23
26
|
const random = mulberry32(__props.seed);
|
|
24
27
|
const randomMove = () => random() * 4 - 2;
|
|
25
|
-
return Array.from({ length: __props.starsCount }, () =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
return Array.from({ length: __props.starsCount }, () => {
|
|
29
|
+
const topPct = random() * 100;
|
|
30
|
+
const topMove = randomMove();
|
|
31
|
+
const leftPct = random() * 100;
|
|
32
|
+
const leftMove = randomMove();
|
|
33
|
+
const targetTopPct = random() * 100;
|
|
34
|
+
const targetTopMove = randomMove();
|
|
35
|
+
const targetLeftPct = random() * 100;
|
|
36
|
+
const targetLeftMove = randomMove();
|
|
37
|
+
return {
|
|
38
|
+
top: `calc(${topPct}% + ${topMove}px)`,
|
|
39
|
+
left: `calc(${leftPct}% + ${leftMove}px)`,
|
|
40
|
+
// The drift is a transform (compositor) rather than animated top/left.
|
|
41
|
+
// Percent deltas resolve against the size-container wrapper.
|
|
42
|
+
driftX: `calc(${targetLeftPct - leftPct}cqw + ${targetLeftMove - leftMove}px)`,
|
|
43
|
+
driftY: `calc(${targetTopPct - topPct}cqh + ${targetTopMove - topMove}px)`,
|
|
44
|
+
opacity: random(),
|
|
45
|
+
duration: random() * 10 + 20
|
|
46
|
+
};
|
|
47
|
+
});
|
|
33
48
|
});
|
|
34
49
|
return (_ctx, _cache) => {
|
|
35
50
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
36
51
|
(openBlock(true), createElementBlock(Fragment, null, renderList(stars.value, (star, i) => {
|
|
37
52
|
return openBlock(), createElementBlock("span", {
|
|
38
53
|
key: i,
|
|
39
|
-
class: normalizeClass(
|
|
54
|
+
class: normalizeClass(
|
|
55
|
+
unref(cn)("star-animate absolute z-[1] inline-block h-0.5 w-0.5 rounded-full bg-white", __props.class)
|
|
56
|
+
),
|
|
40
57
|
style: normalizeStyle({
|
|
41
58
|
top: star.top,
|
|
42
59
|
left: star.left,
|
|
43
|
-
"--
|
|
44
|
-
"--
|
|
60
|
+
"--drift-x": star.driftX,
|
|
61
|
+
"--drift-y": star.driftY,
|
|
45
62
|
"--star-opacity": star.opacity,
|
|
46
63
|
animationDuration: `${star.duration}s`
|
|
47
64
|
})
|
package/dist/index.d.ts
CHANGED
|
@@ -96,6 +96,11 @@ export * from "./components/navbar/index.js";
|
|
|
96
96
|
export * from "./components/navigation-menu/index.js";
|
|
97
97
|
export * from "./components/neon-border/index.js";
|
|
98
98
|
export * from "./components/noise-reveal/index.js";
|
|
99
|
+
export * from "./components/snowfall/index.js";
|
|
100
|
+
export * from "./components/string-lights/index.js";
|
|
101
|
+
export * from "./components/frost-glass/index.js";
|
|
102
|
+
export * from "./components/ornament/index.js";
|
|
103
|
+
export * from "./components/gift-reveal/index.js";
|
|
99
104
|
export * from "./components/number-input/index.js";
|
|
100
105
|
export * from "./components/number-ticker/index.js";
|
|
101
106
|
export * from "./components/pagination/index.js";
|