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
|
@@ -76,6 +76,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
76
76
|
},
|
|
77
77
|
{ flush: "post" }
|
|
78
78
|
);
|
|
79
|
+
watch(
|
|
80
|
+
[engine, reducedMotion],
|
|
81
|
+
([currentEngine, currentReduced]) => {
|
|
82
|
+
currentEngine?.setOptions({ reducedMotion: currentReduced });
|
|
83
|
+
},
|
|
84
|
+
{ flush: "post" }
|
|
85
|
+
);
|
|
79
86
|
watch(
|
|
80
87
|
[() => __props.trigger, engine, () => __props.revealed],
|
|
81
88
|
([currentTrigger, currentEngine, currentRevealed]) => {
|
|
@@ -196,6 +196,7 @@ function createNoiseReveal(el, options) {
|
|
|
196
196
|
uniforms.uTexture.value = loaded;
|
|
197
197
|
const image = loaded.image;
|
|
198
198
|
uniforms.uImageRes.value.set(image.naturalWidth || 1, image.naturalHeight || 1);
|
|
199
|
+
wake();
|
|
199
200
|
});
|
|
200
201
|
let destroyed = false;
|
|
201
202
|
let reducedMotion = options.reducedMotion ?? false;
|
|
@@ -207,11 +208,12 @@ function createNoiseReveal(el, options) {
|
|
|
207
208
|
if (reducedMotion) {
|
|
208
209
|
progress = value;
|
|
209
210
|
tween.active = false;
|
|
210
|
-
|
|
211
|
+
} else {
|
|
212
|
+
tween.from = progress;
|
|
213
|
+
tween.start = performance.now();
|
|
214
|
+
tween.active = true;
|
|
211
215
|
}
|
|
212
|
-
|
|
213
|
-
tween.start = performance.now();
|
|
214
|
-
tween.active = true;
|
|
216
|
+
wake();
|
|
215
217
|
};
|
|
216
218
|
const handleResize = () => {
|
|
217
219
|
if (destroyed) return;
|
|
@@ -221,27 +223,41 @@ function createNoiseReveal(el, options) {
|
|
|
221
223
|
camera.updateProjectionMatrix();
|
|
222
224
|
renderer.setSize(r.width, r.height, false);
|
|
223
225
|
fitPlane(r.width, r.height);
|
|
226
|
+
wake();
|
|
224
227
|
};
|
|
225
228
|
window.addEventListener("resize", handleResize);
|
|
226
229
|
const clock = new THREE.Clock();
|
|
227
230
|
let animationId = 0;
|
|
228
|
-
|
|
231
|
+
function wake() {
|
|
232
|
+
if (destroyed || animationId !== 0) return;
|
|
229
233
|
animationId = requestAnimationFrame(animate);
|
|
234
|
+
}
|
|
235
|
+
const animate = () => {
|
|
236
|
+
animationId = 0;
|
|
230
237
|
if (tween.active) {
|
|
231
238
|
const t = getProgress(performance.now() - tween.start, duration * 1e3);
|
|
232
239
|
progress = lerp(tween.from, tween.to, easeInOutCubic(t));
|
|
233
240
|
if (t >= 1) tween.active = false;
|
|
234
241
|
}
|
|
235
242
|
uniforms.uProgress.value = progress;
|
|
236
|
-
uniforms.uTime.value = clock.getElapsedTime();
|
|
243
|
+
if (!reducedMotion) uniforms.uTime.value = clock.getElapsedTime();
|
|
237
244
|
renderer.render(scene, camera);
|
|
245
|
+
if (reducedMotion && !tween.active) return;
|
|
246
|
+
animationId = requestAnimationFrame(animate);
|
|
238
247
|
};
|
|
239
248
|
animate();
|
|
240
249
|
if (options.target !== void 0) setTarget(options.target);
|
|
241
250
|
return {
|
|
242
251
|
setOptions(next) {
|
|
243
252
|
if (destroyed) return;
|
|
244
|
-
if (next.reducedMotion !== void 0
|
|
253
|
+
if (next.reducedMotion !== void 0 && next.reducedMotion !== reducedMotion) {
|
|
254
|
+
reducedMotion = next.reducedMotion;
|
|
255
|
+
if (reducedMotion && tween.active) {
|
|
256
|
+
progress = tween.to;
|
|
257
|
+
tween.active = false;
|
|
258
|
+
}
|
|
259
|
+
wake();
|
|
260
|
+
}
|
|
245
261
|
if (next.target !== void 0) setTarget(next.target);
|
|
246
262
|
},
|
|
247
263
|
resize: handleResize,
|
|
@@ -2,7 +2,7 @@ import _sfc_main from "./Ripple.vue2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
4
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const Ripple = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const Ripple = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cf5b782d"]]);
|
|
6
6
|
export {
|
|
7
7
|
Ripple as default
|
|
8
8
|
};
|
|
@@ -30,7 +30,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30
30
|
(openBlock(true), createElementBlock(Fragment, null, renderList(circles.value, (circle, i) => {
|
|
31
31
|
return openBlock(), createElementBlock("div", {
|
|
32
32
|
key: i,
|
|
33
|
-
class: normalizeClass(
|
|
33
|
+
class: normalizeClass(
|
|
34
|
+
unref(cn)(
|
|
35
|
+
"animate-ripple-circle absolute rounded-full shadow-xl motion-reduce:animate-none",
|
|
36
|
+
__props.circleClass
|
|
37
|
+
)
|
|
38
|
+
),
|
|
34
39
|
style: normalizeStyle(`width: ${circle.size}px; height: ${circle.size}px; opacity: ${circle.opacity}; animation-delay: ${circle.delay}ms; border-style: ${circle.borderStyle}; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(1); border-width: 1px;`)
|
|
35
40
|
}, null, 6);
|
|
36
41
|
}), 128))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, useTemplateRef, onMounted, onBeforeUnmount, watch, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createElementVNode } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
3
4
|
import { createSparkles } from "./sparkles-core.js";
|
|
4
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
6
|
...{ name: "Sparkles", inheritAttrs: false },
|
|
@@ -18,11 +19,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
18
19
|
const canvasRef = useTemplateRef("canvasRef");
|
|
19
20
|
let engine = null;
|
|
20
21
|
let resizeObserver = null;
|
|
22
|
+
const reducedMotion = useReducedMotion();
|
|
21
23
|
onMounted(() => {
|
|
22
24
|
if (!canvasRef.value || !containerRef.value) return;
|
|
23
25
|
engine = createSparkles(
|
|
24
26
|
{ canvas: canvasRef.value, container: containerRef.value },
|
|
25
|
-
{ minSize: __props.minSize, maxSize: __props.maxSize, speed: __props.speed, particleDensity: __props.particleDensity, particleColor: __props.particleColor }
|
|
27
|
+
{ minSize: __props.minSize, maxSize: __props.maxSize, speed: __props.speed, particleDensity: __props.particleDensity, particleColor: __props.particleColor, reducedMotion: reducedMotion.value }
|
|
26
28
|
);
|
|
27
29
|
resizeObserver = new ResizeObserver(() => engine?.resize());
|
|
28
30
|
resizeObserver.observe(containerRef.value);
|
|
@@ -38,6 +40,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
38
40
|
(color) => engine?.setOptions({ particleColor: color }),
|
|
39
41
|
{ flush: "post" }
|
|
40
42
|
);
|
|
43
|
+
watch(
|
|
44
|
+
reducedMotion,
|
|
45
|
+
(next) => {
|
|
46
|
+
engine?.setOptions({ reducedMotion: next });
|
|
47
|
+
},
|
|
48
|
+
{ flush: "post" }
|
|
49
|
+
);
|
|
41
50
|
return (_ctx, _cache) => {
|
|
42
51
|
return openBlock(), createElementBlock("div", {
|
|
43
52
|
ref_key: "containerRef",
|
|
@@ -17,6 +17,12 @@ export interface SparklesInitOptions {
|
|
|
17
17
|
export interface SparklesLiveOptions {
|
|
18
18
|
/** Hex color (e.g. "#ffffff") or `currentColor` particles are filled with; re-read every frame. */
|
|
19
19
|
particleColor?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Reduced-motion preference, owned by the wrapper (the core never reads
|
|
22
|
+
* `matchMedia`). When true the engine paints one still frame and idles; a
|
|
23
|
+
* flip back to false resumes the drift.
|
|
24
|
+
*/
|
|
25
|
+
reducedMotion?: boolean;
|
|
20
26
|
}
|
|
21
27
|
export interface SparklesEngine {
|
|
22
28
|
setOptions(next: Partial<SparklesLiveOptions>): void;
|
|
@@ -42,6 +42,7 @@ function createSparkles(elements, options, random = Math.random) {
|
|
|
42
42
|
let particles = [];
|
|
43
43
|
let dpr = 1;
|
|
44
44
|
let rafId = 0;
|
|
45
|
+
let reducedMotion = options.reducedMotion ?? false;
|
|
45
46
|
let destroyed = false;
|
|
46
47
|
function resize() {
|
|
47
48
|
if (destroyed) return;
|
|
@@ -51,6 +52,7 @@ function createSparkles(elements, options, random = Math.random) {
|
|
|
51
52
|
canvas.height = rect.height * dpr;
|
|
52
53
|
ctx = canvas.getContext("2d");
|
|
53
54
|
if (ctx) ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
55
|
+
if (reducedMotion && rafId === 0 && particles.length > 0) updateAndDraw();
|
|
54
56
|
}
|
|
55
57
|
function generateParticles() {
|
|
56
58
|
particles = [];
|
|
@@ -93,19 +95,41 @@ function createSparkles(elements, options, random = Math.random) {
|
|
|
93
95
|
ctx.fillStyle = `${fill}${Math.floor(opacity * 255).toString(16).padStart(2, "0")}`;
|
|
94
96
|
ctx.fill();
|
|
95
97
|
}
|
|
98
|
+
if (reducedMotion) {
|
|
99
|
+
rafId = 0;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
96
102
|
rafId = requestAnimationFrame(updateAndDraw);
|
|
97
103
|
}
|
|
98
104
|
resize();
|
|
99
105
|
generateParticles();
|
|
100
|
-
|
|
106
|
+
if (reducedMotion) updateAndDraw();
|
|
107
|
+
else rafId = requestAnimationFrame(updateAndDraw);
|
|
108
|
+
const themeObserver = typeof MutationObserver !== "undefined" ? new MutationObserver(() => {
|
|
109
|
+
if (reducedMotion && rafId === 0 && CURRENT_COLOR.test(particleColor)) updateAndDraw();
|
|
110
|
+
}) : null;
|
|
111
|
+
themeObserver?.observe(document.documentElement, {
|
|
112
|
+
attributes: true,
|
|
113
|
+
attributeFilter: ["class"]
|
|
114
|
+
});
|
|
101
115
|
return {
|
|
102
116
|
setOptions(next) {
|
|
103
|
-
if (
|
|
117
|
+
if (destroyed) return;
|
|
118
|
+
const wasReduced = reducedMotion;
|
|
119
|
+
if (next.reducedMotion !== void 0) reducedMotion = next.reducedMotion;
|
|
120
|
+
if (next.particleColor !== void 0 && next.particleColor !== particleColor) {
|
|
121
|
+
particleColor = next.particleColor;
|
|
122
|
+
if (reducedMotion && rafId === 0) updateAndDraw();
|
|
123
|
+
}
|
|
124
|
+
if (wasReduced && !reducedMotion && rafId === 0) {
|
|
125
|
+
rafId = requestAnimationFrame(updateAndDraw);
|
|
126
|
+
}
|
|
104
127
|
},
|
|
105
128
|
resize,
|
|
106
129
|
destroy() {
|
|
107
130
|
if (destroyed) return;
|
|
108
131
|
destroyed = true;
|
|
132
|
+
themeObserver?.disconnect();
|
|
109
133
|
cancelAnimationFrame(rafId);
|
|
110
134
|
}
|
|
111
135
|
};
|
|
@@ -1,90 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let state = seed >>> 0;
|
|
7
|
-
return () => {
|
|
8
|
-
state = state + 1831565813 >>> 0;
|
|
9
|
-
let t = state;
|
|
10
|
-
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
11
|
-
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
12
|
-
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function generateStar(random, colors) {
|
|
16
|
-
const x = `${random() * 100}%`;
|
|
17
|
-
const y = `${random() * 100}%`;
|
|
18
|
-
const color = random() > 0.5 ? colors.first : colors.second;
|
|
19
|
-
const delay = random() * 2;
|
|
20
|
-
const scale = random() * 1 + 0.3;
|
|
21
|
-
const lifespan = random() * 10 + 5;
|
|
22
|
-
const id = `${x}-${y}-${random()}`;
|
|
23
|
-
return { id, x, y, color, delay, scale, lifespan };
|
|
24
|
-
}
|
|
25
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
26
|
-
...{ name: "SparklesText", inheritAttrs: false },
|
|
27
|
-
__name: "SparklesText",
|
|
28
|
-
props: {
|
|
29
|
-
text: {},
|
|
30
|
-
sparklesCount: { default: 10 },
|
|
31
|
-
colors: { default: () => ({ first: "#9E7AFF", second: "#FE8BBB" }) },
|
|
32
|
-
class: { type: [Boolean, null, String, Object, Array] },
|
|
33
|
-
seed: { default: 1 }
|
|
34
|
-
},
|
|
35
|
-
setup(__props) {
|
|
36
|
-
const initialRandom = mulberry32(__props.seed);
|
|
37
|
-
const sparkles = ref(
|
|
38
|
-
Array.from({ length: __props.sparklesCount }, () => generateStar(initialRandom, __props.colors))
|
|
39
|
-
);
|
|
40
|
-
let intervalId;
|
|
41
|
-
onMounted(() => {
|
|
42
|
-
const random = mulberry32(__props.seed + 1);
|
|
43
|
-
intervalId = setInterval(() => {
|
|
44
|
-
sparkles.value = sparkles.value.map((star) => {
|
|
45
|
-
if (star.lifespan <= 0) {
|
|
46
|
-
return generateStar(random, __props.colors);
|
|
47
|
-
}
|
|
48
|
-
return { ...star, lifespan: star.lifespan - 0.1 };
|
|
49
|
-
});
|
|
50
|
-
}, 100);
|
|
51
|
-
});
|
|
52
|
-
onBeforeUnmount(() => {
|
|
53
|
-
if (intervalId !== void 0) clearInterval(intervalId);
|
|
54
|
-
});
|
|
55
|
-
return (_ctx, _cache) => {
|
|
56
|
-
return openBlock(), createElementBlock("div", {
|
|
57
|
-
class: normalizeClass(unref(cn)("sparkles-text text-6xl font-bold", __props.class))
|
|
58
|
-
}, [
|
|
59
|
-
createElementVNode("span", _hoisted_1, [
|
|
60
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(sparkles.value, (sparkle) => {
|
|
61
|
-
return openBlock(), createElementBlock("svg", {
|
|
62
|
-
key: sparkle.id,
|
|
63
|
-
class: "sparkles-star pointer-events-none absolute z-20",
|
|
64
|
-
style: normalizeStyle({
|
|
65
|
-
left: sparkle.x,
|
|
66
|
-
top: sparkle.y,
|
|
67
|
-
"--sparkle-scale": `${sparkle.scale}`,
|
|
68
|
-
animation: `sparkleAnim 0.8s ease-in-out ${sparkle.delay}s infinite`,
|
|
69
|
-
transform: "scale(0) rotate(75deg)",
|
|
70
|
-
opacity: 0
|
|
71
|
-
}),
|
|
72
|
-
width: "21",
|
|
73
|
-
height: "21",
|
|
74
|
-
viewBox: "0 0 21 21"
|
|
75
|
-
}, [
|
|
76
|
-
createElementVNode("path", {
|
|
77
|
-
d: "M9.82531 0.843845C10.0553 0.215178 10.9446 0.215178 11.1746 0.843845L11.8618 2.72026C12.4006 4.19229 12.3916 6.39157 13.5 7.5C14.6084 8.60843 16.8077 8.59935 18.2797 9.13822L20.1561 9.82534C20.7858 10.0553 20.7858 10.9447 20.1561 11.1747L18.2797 11.8618C16.8077 12.4007 14.6084 12.3916 13.5 13.5C12.3916 14.6084 12.4006 16.8077 11.8618 18.2798L11.1746 20.1562C10.9446 20.7858 10.0553 20.7858 9.82531 20.1562L9.13819 18.2798C8.59932 16.8077 8.60843 14.6084 7.5 13.5C6.39157 12.3916 4.19225 12.4007 2.72023 11.8618L0.843814 11.1747C0.215148 10.9447 0.215148 10.0553 0.843814 9.82534L2.72023 9.13822C4.19225 8.59935 6.39157 8.60843 7.5 7.5C8.60843 6.39157 8.59932 4.19229 9.13819 2.72026L9.82531 0.843845Z",
|
|
78
|
-
fill: sparkle.color
|
|
79
|
-
}, null, 8, _hoisted_2)
|
|
80
|
-
], 4);
|
|
81
|
-
}), 128)),
|
|
82
|
-
createTextVNode(" " + toDisplayString(__props.text), 1)
|
|
83
|
-
])
|
|
84
|
-
], 2);
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
});
|
|
1
|
+
import _sfc_main from "./SparklesText.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
/* empty css */
|
|
4
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
+
const SparklesText = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f06a1c48"]]);
|
|
88
6
|
export {
|
|
89
|
-
|
|
7
|
+
SparklesText as default
|
|
90
8
|
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { defineComponent, ref, onMounted, watch, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, createTextVNode, Fragment, renderList, normalizeStyle, toDisplayString } from "vue";
|
|
2
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
3
|
+
import { cn } from "../../utils.js";
|
|
4
|
+
const _hoisted_1 = { class: "relative inline-block" };
|
|
5
|
+
const _hoisted_2 = ["fill"];
|
|
6
|
+
function mulberry32(seed) {
|
|
7
|
+
let state = seed >>> 0;
|
|
8
|
+
return () => {
|
|
9
|
+
state = state + 1831565813 >>> 0;
|
|
10
|
+
let t = state;
|
|
11
|
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
12
|
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
13
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function generateStar(random, colors) {
|
|
17
|
+
const x = `${random() * 100}%`;
|
|
18
|
+
const y = `${random() * 100}%`;
|
|
19
|
+
const color = random() > 0.5 ? colors.first : colors.second;
|
|
20
|
+
const delay = random() * 2;
|
|
21
|
+
const scale = random() * 1 + 0.3;
|
|
22
|
+
const lifespan = random() * 10 + 5;
|
|
23
|
+
const id = `${x}-${y}-${random()}`;
|
|
24
|
+
return { id, x, y, color, delay, scale, lifespan };
|
|
25
|
+
}
|
|
26
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
27
|
+
...{ name: "SparklesText", inheritAttrs: false },
|
|
28
|
+
__name: "SparklesText",
|
|
29
|
+
props: {
|
|
30
|
+
text: {},
|
|
31
|
+
sparklesCount: { default: 10 },
|
|
32
|
+
colors: { default: () => ({ first: "#9E7AFF", second: "#FE8BBB" }) },
|
|
33
|
+
class: { type: [Boolean, null, String, Object, Array] },
|
|
34
|
+
seed: { default: 1 }
|
|
35
|
+
},
|
|
36
|
+
setup(__props) {
|
|
37
|
+
const initialRandom = mulberry32(__props.seed);
|
|
38
|
+
const sparkles = ref(
|
|
39
|
+
Array.from({ length: __props.sparklesCount }, () => generateStar(initialRandom, __props.colors))
|
|
40
|
+
);
|
|
41
|
+
let intervalId;
|
|
42
|
+
function stop() {
|
|
43
|
+
if (intervalId !== void 0) clearInterval(intervalId);
|
|
44
|
+
intervalId = void 0;
|
|
45
|
+
}
|
|
46
|
+
const reducedMotion = useReducedMotion();
|
|
47
|
+
onMounted(() => {
|
|
48
|
+
const random = mulberry32(__props.seed + 1);
|
|
49
|
+
watch(
|
|
50
|
+
reducedMotion,
|
|
51
|
+
(reduced) => {
|
|
52
|
+
stop();
|
|
53
|
+
if (reduced) return;
|
|
54
|
+
intervalId = setInterval(() => {
|
|
55
|
+
sparkles.value = sparkles.value.map((star) => {
|
|
56
|
+
if (star.lifespan <= 0) {
|
|
57
|
+
return generateStar(random, __props.colors);
|
|
58
|
+
}
|
|
59
|
+
return { ...star, lifespan: star.lifespan - 0.1 };
|
|
60
|
+
});
|
|
61
|
+
}, 100);
|
|
62
|
+
},
|
|
63
|
+
{ flush: "post", immediate: true }
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
onBeforeUnmount(stop);
|
|
67
|
+
return (_ctx, _cache) => {
|
|
68
|
+
return openBlock(), createElementBlock("div", {
|
|
69
|
+
class: normalizeClass(unref(cn)("sparkles-text text-6xl font-bold", __props.class))
|
|
70
|
+
}, [
|
|
71
|
+
createElementVNode("span", _hoisted_1, [
|
|
72
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(sparkles.value, (sparkle) => {
|
|
73
|
+
return openBlock(), createElementBlock("svg", {
|
|
74
|
+
key: sparkle.id,
|
|
75
|
+
class: "sparkles-star pointer-events-none absolute z-20",
|
|
76
|
+
style: normalizeStyle({
|
|
77
|
+
left: sparkle.x,
|
|
78
|
+
top: sparkle.y,
|
|
79
|
+
"--sparkle-scale": `${sparkle.scale}`,
|
|
80
|
+
"--sparkles-text-delay": `${sparkle.delay}s`
|
|
81
|
+
}),
|
|
82
|
+
width: "21",
|
|
83
|
+
height: "21",
|
|
84
|
+
viewBox: "0 0 21 21"
|
|
85
|
+
}, [
|
|
86
|
+
createElementVNode("path", {
|
|
87
|
+
d: "M9.82531 0.843845C10.0553 0.215178 10.9446 0.215178 11.1746 0.843845L11.8618 2.72026C12.4006 4.19229 12.3916 6.39157 13.5 7.5C14.6084 8.60843 16.8077 8.59935 18.2797 9.13822L20.1561 9.82534C20.7858 10.0553 20.7858 10.9447 20.1561 11.1747L18.2797 11.8618C16.8077 12.4007 14.6084 12.3916 13.5 13.5C12.3916 14.6084 12.4006 16.8077 11.8618 18.2798L11.1746 20.1562C10.9446 20.7858 10.0553 20.7858 9.82531 20.1562L9.13819 18.2798C8.59932 16.8077 8.60843 14.6084 7.5 13.5C6.39157 12.3916 4.19225 12.4007 2.72023 11.8618L0.843814 11.1747C0.215148 10.9447 0.215148 10.0553 0.843814 9.82534L2.72023 9.13822C4.19225 8.59935 6.39157 8.60843 7.5 7.5C8.60843 6.39157 8.59932 4.19229 9.13819 2.72026L9.82531 0.843845Z",
|
|
88
|
+
fill: sparkle.color
|
|
89
|
+
}, null, 8, _hoisted_2)
|
|
90
|
+
], 4);
|
|
91
|
+
}), 128)),
|
|
92
|
+
createTextVNode(" " + toDisplayString(__props.text), 1)
|
|
93
|
+
])
|
|
94
|
+
], 2);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
export {
|
|
99
|
+
_sfc_main as default
|
|
100
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./TerminalText.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const TerminalText = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const TerminalText = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4e11cdd8"]]);
|
|
5
5
|
export {
|
|
6
6
|
TerminalText as default
|
|
7
7
|
};
|
|
@@ -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
|
};
|