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,5 +1,6 @@
|
|
|
1
|
-
import { defineComponent, useAttrs, ref, computed, onMounted,
|
|
1
|
+
import { defineComponent, useAttrs, ref, computed, onMounted, watch, createElementBlock, openBlock, mergeProps, unref, createElementVNode, normalizeClass, Fragment, renderList, normalizeStyle, 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 = { class: "inline-block" };
|
|
4
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
6
|
...{ name: "ContainerTextFlip", inheritAttrs: false },
|
|
@@ -16,11 +17,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16
17
|
const currentWordIndex = ref(0);
|
|
17
18
|
const currentWord = computed(() => __props.words[currentWordIndex.value] ?? "");
|
|
18
19
|
const letters = computed(() => currentWord.value.split(""));
|
|
20
|
+
const reducedMotion = useReducedMotion();
|
|
19
21
|
onMounted(() => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
watch(
|
|
23
|
+
reducedMotion,
|
|
24
|
+
(reduced, _old, onCleanup) => {
|
|
25
|
+
if (reduced) return;
|
|
26
|
+
const id = setInterval(() => {
|
|
27
|
+
currentWordIndex.value = (currentWordIndex.value + 1) % __props.words.length;
|
|
28
|
+
}, __props.interval);
|
|
29
|
+
onCleanup(() => clearInterval(id));
|
|
30
|
+
},
|
|
31
|
+
{ flush: "post", immediate: true }
|
|
32
|
+
);
|
|
24
33
|
});
|
|
25
34
|
return (_ctx, _cache) => {
|
|
26
35
|
return openBlock(), createElementBlock("p", mergeProps(unref(attrs), {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, useTemplateRef, watch, onMounted, onBeforeUnmount, createElementBlock, openBlock, 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 { createFlickeringGrid } from "./flickering-grid-core.js";
|
|
4
5
|
const _hoisted_1 = {
|
|
5
6
|
ref: "canvas",
|
|
@@ -24,6 +25,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
24
25
|
let engine = null;
|
|
25
26
|
let resizeObserver = null;
|
|
26
27
|
let intersectionObserver = null;
|
|
28
|
+
const reducedMotion = useReducedMotion();
|
|
27
29
|
watch(
|
|
28
30
|
() => ({ squareSize: __props.squareSize, gridGap: __props.gridGap, flickerChance: __props.flickerChance, color: __props.color, maxOpacity: __props.maxOpacity, width: __props.width, height: __props.height }),
|
|
29
31
|
(next) => {
|
|
@@ -37,7 +39,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
37
39
|
if (!container || !canvas) return;
|
|
38
40
|
engine = createFlickeringGrid(
|
|
39
41
|
{ container, canvas },
|
|
40
|
-
{
|
|
42
|
+
{
|
|
43
|
+
squareSize: __props.squareSize,
|
|
44
|
+
gridGap: __props.gridGap,
|
|
45
|
+
flickerChance: __props.flickerChance,
|
|
46
|
+
color: __props.color,
|
|
47
|
+
maxOpacity: __props.maxOpacity,
|
|
48
|
+
width: __props.width,
|
|
49
|
+
height: __props.height,
|
|
50
|
+
reducedMotion: reducedMotion.value
|
|
51
|
+
}
|
|
41
52
|
);
|
|
42
53
|
if (!engine) return;
|
|
43
54
|
resizeObserver = new ResizeObserver(() => {
|
|
@@ -60,6 +71,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
60
71
|
engine?.destroy();
|
|
61
72
|
engine = null;
|
|
62
73
|
});
|
|
74
|
+
watch(
|
|
75
|
+
reducedMotion,
|
|
76
|
+
(next) => {
|
|
77
|
+
engine?.setOptions({ reducedMotion: next });
|
|
78
|
+
},
|
|
79
|
+
{ flush: "post" }
|
|
80
|
+
);
|
|
63
81
|
return (_ctx, _cache) => {
|
|
64
82
|
return openBlock(), createElementBlock("div", {
|
|
65
83
|
ref: "container",
|
|
@@ -27,6 +27,12 @@ export interface FlickeringGridLiveOptions {
|
|
|
27
27
|
width?: number;
|
|
28
28
|
/** Fixed height in pixels (defaults to container height) */
|
|
29
29
|
height?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Reduced-motion preference, owned by the wrapper (the core never reads
|
|
32
|
+
* `matchMedia`). When true the grid paints one still frame while in view and
|
|
33
|
+
* idles; a flip back to false resumes the flicker.
|
|
34
|
+
*/
|
|
35
|
+
reducedMotion?: boolean;
|
|
30
36
|
}
|
|
31
37
|
export interface FlickeringGridEngine {
|
|
32
38
|
setOptions(next: Partial<FlickeringGridLiveOptions>): void;
|
|
@@ -56,7 +56,10 @@ function createColorResolver(el) {
|
|
|
56
56
|
function createFlickeringGrid(el, options, random = Math.random) {
|
|
57
57
|
const ctx = el.canvas.getContext("2d");
|
|
58
58
|
if (!ctx) return null;
|
|
59
|
-
const opts = {
|
|
59
|
+
const opts = {
|
|
60
|
+
...DEFAULTS,
|
|
61
|
+
...options
|
|
62
|
+
};
|
|
60
63
|
let isInView = false;
|
|
61
64
|
let animationFrameId;
|
|
62
65
|
let lastTime = 0;
|
|
@@ -112,14 +115,38 @@ function createFlickeringGrid(el, options, random = Math.random) {
|
|
|
112
115
|
if (!isInView || destroyed) return;
|
|
113
116
|
const deltaTime = (time - lastTime) / 1e3;
|
|
114
117
|
lastTime = time;
|
|
118
|
+
if (opts.reducedMotion) {
|
|
119
|
+
drawGrid();
|
|
120
|
+
animationFrameId = void 0;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
115
123
|
updateSquares(deltaTime);
|
|
116
124
|
drawGrid();
|
|
117
125
|
animationFrameId = requestAnimationFrame(animate);
|
|
118
126
|
}
|
|
127
|
+
function repaintIdle() {
|
|
128
|
+
if (opts.reducedMotion && isInView && animationFrameId === void 0) drawGrid();
|
|
129
|
+
}
|
|
119
130
|
updateCanvasSize();
|
|
131
|
+
const themeObserver = typeof MutationObserver !== "undefined" ? new MutationObserver(() => {
|
|
132
|
+
if (CURRENT_COLOR.test(opts.color)) repaintIdle();
|
|
133
|
+
}) : null;
|
|
134
|
+
themeObserver?.observe(document.documentElement, {
|
|
135
|
+
attributes: true,
|
|
136
|
+
attributeFilter: ["class"]
|
|
137
|
+
});
|
|
120
138
|
return {
|
|
121
139
|
setOptions(next) {
|
|
140
|
+
if (destroyed) return;
|
|
141
|
+
const wasReduced = opts.reducedMotion;
|
|
122
142
|
Object.assign(opts, next);
|
|
143
|
+
if (wasReduced && !opts.reducedMotion) {
|
|
144
|
+
if (isInView && animationFrameId === void 0) {
|
|
145
|
+
animationFrameId = requestAnimationFrame(animate);
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
repaintIdle();
|
|
149
|
+
}
|
|
123
150
|
},
|
|
124
151
|
setInView(nextIsInView) {
|
|
125
152
|
if (destroyed) return;
|
|
@@ -131,10 +158,12 @@ function createFlickeringGrid(el, options, random = Math.random) {
|
|
|
131
158
|
resize() {
|
|
132
159
|
if (destroyed) return;
|
|
133
160
|
updateCanvasSize();
|
|
161
|
+
repaintIdle();
|
|
134
162
|
},
|
|
135
163
|
destroy() {
|
|
136
164
|
if (destroyed) return;
|
|
137
165
|
destroyed = true;
|
|
166
|
+
themeObserver?.disconnect();
|
|
138
167
|
if (animationFrameId !== void 0) {
|
|
139
168
|
cancelAnimationFrame(animationFrameId);
|
|
140
169
|
animationFrameId = void 0;
|
|
@@ -2,7 +2,7 @@ import _sfc_main from "./FlipWords.vue2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
4
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const FlipWords = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const FlipWords = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8436152b"]]);
|
|
6
6
|
export {
|
|
7
7
|
FlipWords as default
|
|
8
8
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, watch, onMounted, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, normalizeStyle, createTextVNode, 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 = { class: "flip-words relative inline-block px-2" };
|
|
4
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
6
|
...{ name: "FlipWords", inheritAttrs: false },
|
|
@@ -13,6 +14,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13
14
|
const EXIT_MS = 600;
|
|
14
15
|
const currentIndex = ref(0);
|
|
15
16
|
const isExiting = ref(false);
|
|
17
|
+
const reducedMotion = useReducedMotion();
|
|
16
18
|
let timeoutId = null;
|
|
17
19
|
let exitTimeoutId = null;
|
|
18
20
|
const currentWord = computed(() => __props.words[currentIndex.value] ?? "");
|
|
@@ -37,8 +39,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
37
39
|
timeoutId = setTimeout(startAnimation, d);
|
|
38
40
|
}
|
|
39
41
|
watch(
|
|
40
|
-
() => [currentIndex.value, isExiting.value, __props.words.length, __props.duration],
|
|
41
|
-
([index, exiting, , d]) => {
|
|
42
|
+
() => [currentIndex.value, isExiting.value, __props.words.length, __props.duration, reducedMotion.value],
|
|
43
|
+
([index, exiting, , d, reduced]) => {
|
|
44
|
+
if (reduced) {
|
|
45
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
46
|
+
timeoutId = null;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
42
49
|
if (!exiting) {
|
|
43
50
|
scheduleNext(index, d);
|
|
44
51
|
}
|
|
@@ -46,7 +53,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
46
53
|
{ flush: "post" }
|
|
47
54
|
);
|
|
48
55
|
onMounted(() => {
|
|
49
|
-
if (!isExiting.value) {
|
|
56
|
+
if (!isExiting.value && !reducedMotion.value) {
|
|
50
57
|
scheduleNext(currentIndex.value, __props.duration);
|
|
51
58
|
}
|
|
52
59
|
});
|
|
@@ -69,14 +76,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
69
76
|
(openBlock(true), createElementBlock(Fragment, null, renderList(splitWords.value, (wordObj, wordIndex) => {
|
|
70
77
|
return openBlock(), createElementBlock("span", {
|
|
71
78
|
key: wordObj.word + wordIndex,
|
|
72
|
-
class: "flip-words-word inline-block whitespace-nowrap
|
|
73
|
-
style: normalizeStyle(
|
|
79
|
+
class: "flip-words-word inline-block whitespace-nowrap",
|
|
80
|
+
style: normalizeStyle({ "--flip-words-word-delay": `${wordIndex * 0.3}s` })
|
|
74
81
|
}, [
|
|
75
82
|
(openBlock(true), createElementBlock(Fragment, null, renderList(wordObj.letters, (letter, letterIndex) => {
|
|
76
83
|
return openBlock(), createElementBlock("span", {
|
|
77
84
|
key: wordObj.word + letterIndex,
|
|
78
|
-
class: "inline-block
|
|
79
|
-
style: normalizeStyle(
|
|
85
|
+
class: "flip-words-letter inline-block",
|
|
86
|
+
style: normalizeStyle({ "--flip-words-letter-delay": `${wordIndex * 0.3 + letterIndex * 0.05}s` })
|
|
80
87
|
}, toDisplayString(letter), 5);
|
|
81
88
|
}), 128)),
|
|
82
89
|
_cache[0] || (_cache[0] = createTextVNode(toDisplayString(" "), -1)),
|
|
@@ -1,99 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
__name: "HyperText",
|
|
7
|
-
props: {
|
|
8
|
-
text: {},
|
|
9
|
-
duration: { default: 800 },
|
|
10
|
-
animateOnLoad: { type: Boolean, default: false },
|
|
11
|
-
seed: { default: 1 },
|
|
12
|
-
class: { type: [Boolean, null, String, Object, Array] }
|
|
13
|
-
},
|
|
14
|
-
setup(__props) {
|
|
15
|
-
const ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
16
|
-
function mulberry32(seedValue) {
|
|
17
|
-
let state = seedValue >>> 0;
|
|
18
|
-
return () => {
|
|
19
|
-
state = state + 1831565813 >>> 0;
|
|
20
|
-
let t = state;
|
|
21
|
-
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
22
|
-
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
23
|
-
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const displayChars = computed(() => __props.text.split(""));
|
|
27
|
-
const displayText = ref(displayChars.value);
|
|
28
|
-
let intervalId = null;
|
|
29
|
-
let iterations = 0;
|
|
30
|
-
watch(
|
|
31
|
-
displayChars,
|
|
32
|
-
(next) => {
|
|
33
|
-
displayText.value = next;
|
|
34
|
-
},
|
|
35
|
-
{ flush: "post" }
|
|
36
|
-
);
|
|
37
|
-
function getRandomLetter(random) {
|
|
38
|
-
return ALPHABETS[Math.floor(random() * ALPHABETS.length)] ?? "A";
|
|
39
|
-
}
|
|
40
|
-
function stopAnimation() {
|
|
41
|
-
if (intervalId) {
|
|
42
|
-
clearInterval(intervalId);
|
|
43
|
-
intervalId = null;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function startAnimation() {
|
|
47
|
-
stopAnimation();
|
|
48
|
-
iterations = 0;
|
|
49
|
-
const intervalMs = __props.duration / (__props.text.length * 10);
|
|
50
|
-
const random = mulberry32(__props.seed);
|
|
51
|
-
intervalId = setInterval(() => {
|
|
52
|
-
const target = __props.text;
|
|
53
|
-
if (iterations < target.length) {
|
|
54
|
-
displayText.value = displayText.value.map(
|
|
55
|
-
(l, i) => l === " " ? l : i <= iterations ? target[i] ?? l : getRandomLetter(random)
|
|
56
|
-
);
|
|
57
|
-
iterations += 0.1;
|
|
58
|
-
} else {
|
|
59
|
-
stopAnimation();
|
|
60
|
-
displayText.value = target.split("");
|
|
61
|
-
}
|
|
62
|
-
}, intervalMs);
|
|
63
|
-
}
|
|
64
|
-
function triggerAnimation() {
|
|
65
|
-
iterations = 0;
|
|
66
|
-
startAnimation();
|
|
67
|
-
}
|
|
68
|
-
onMounted(() => {
|
|
69
|
-
if (__props.animateOnLoad) {
|
|
70
|
-
triggerAnimation();
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
onBeforeUnmount(stopAnimation);
|
|
74
|
-
return (_ctx, _cache) => {
|
|
75
|
-
return openBlock(), createElementBlock("div", {
|
|
76
|
-
class: normalizeClass(unref(cn)("hyper-text flex scale-100 cursor-default overflow-hidden py-2", __props.class)),
|
|
77
|
-
onMouseenter: triggerAnimation,
|
|
78
|
-
role: "presentation"
|
|
79
|
-
}, [
|
|
80
|
-
createElementVNode("div", _hoisted_1, [
|
|
81
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(displayText.value, (letter, i) => {
|
|
82
|
-
return openBlock(), createElementBlock("span", {
|
|
83
|
-
key: i,
|
|
84
|
-
class: normalizeClass(unref(cn)("hyper-text-char inline-block font-mono", letter === " " ? "w-3" : "")),
|
|
85
|
-
style: normalizeStyle({
|
|
86
|
-
animation: "hyperFadeIn 0.3s ease forwards",
|
|
87
|
-
animationDelay: `${i * (__props.duration / (__props.text.length * 10))}ms`,
|
|
88
|
-
opacity: 0
|
|
89
|
-
})
|
|
90
|
-
}, toDisplayString(letter.toUpperCase()), 7);
|
|
91
|
-
}), 128))
|
|
92
|
-
])
|
|
93
|
-
], 34);
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
});
|
|
1
|
+
import _sfc_main from "./HyperText.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
/* empty css */
|
|
4
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
+
const HyperText = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f520f7e3"]]);
|
|
97
6
|
export {
|
|
98
|
-
|
|
7
|
+
HyperText as default
|
|
99
8
|
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, watch, onMounted, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, Fragment, renderList, normalizeStyle, toDisplayString } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import { prefersReducedMotion } from "../../internals/motion/anchored.js";
|
|
4
|
+
const _hoisted_1 = { class: "flex" };
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
...{ name: "HyperText", inheritAttrs: false },
|
|
7
|
+
__name: "HyperText",
|
|
8
|
+
props: {
|
|
9
|
+
text: {},
|
|
10
|
+
duration: { default: 800 },
|
|
11
|
+
animateOnLoad: { type: Boolean, default: false },
|
|
12
|
+
seed: { default: 1 },
|
|
13
|
+
class: { type: [Boolean, null, String, Object, Array] }
|
|
14
|
+
},
|
|
15
|
+
setup(__props) {
|
|
16
|
+
const ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
17
|
+
function mulberry32(seedValue) {
|
|
18
|
+
let state = seedValue >>> 0;
|
|
19
|
+
return () => {
|
|
20
|
+
state = state + 1831565813 >>> 0;
|
|
21
|
+
let t = state;
|
|
22
|
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
23
|
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
24
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const displayChars = computed(() => __props.text.split(""));
|
|
28
|
+
const displayText = ref(displayChars.value);
|
|
29
|
+
let intervalId = null;
|
|
30
|
+
let iterations = 0;
|
|
31
|
+
watch(
|
|
32
|
+
displayChars,
|
|
33
|
+
(next) => {
|
|
34
|
+
displayText.value = next;
|
|
35
|
+
},
|
|
36
|
+
{ flush: "post" }
|
|
37
|
+
);
|
|
38
|
+
function getRandomLetter(random) {
|
|
39
|
+
return ALPHABETS[Math.floor(random() * ALPHABETS.length)] ?? "A";
|
|
40
|
+
}
|
|
41
|
+
function stopAnimation() {
|
|
42
|
+
if (intervalId) {
|
|
43
|
+
clearInterval(intervalId);
|
|
44
|
+
intervalId = null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function startAnimation() {
|
|
48
|
+
stopAnimation();
|
|
49
|
+
iterations = 0;
|
|
50
|
+
const intervalMs = __props.duration / (__props.text.length * 10);
|
|
51
|
+
const random = mulberry32(__props.seed);
|
|
52
|
+
intervalId = setInterval(() => {
|
|
53
|
+
const target = __props.text;
|
|
54
|
+
if (iterations < target.length) {
|
|
55
|
+
displayText.value = displayText.value.map(
|
|
56
|
+
(l, i) => l === " " ? l : i <= iterations ? target[i] ?? l : getRandomLetter(random)
|
|
57
|
+
);
|
|
58
|
+
iterations += 0.1;
|
|
59
|
+
} else {
|
|
60
|
+
stopAnimation();
|
|
61
|
+
displayText.value = target.split("");
|
|
62
|
+
}
|
|
63
|
+
}, intervalMs);
|
|
64
|
+
}
|
|
65
|
+
function triggerAnimation() {
|
|
66
|
+
iterations = 0;
|
|
67
|
+
if (prefersReducedMotion()) {
|
|
68
|
+
stopAnimation();
|
|
69
|
+
displayText.value = __props.text.split("");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
startAnimation();
|
|
73
|
+
}
|
|
74
|
+
onMounted(() => {
|
|
75
|
+
if (__props.animateOnLoad) {
|
|
76
|
+
triggerAnimation();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
onBeforeUnmount(stopAnimation);
|
|
80
|
+
return (_ctx, _cache) => {
|
|
81
|
+
return openBlock(), createElementBlock("div", {
|
|
82
|
+
class: normalizeClass(unref(cn)("hyper-text flex scale-100 cursor-default overflow-hidden py-2", __props.class)),
|
|
83
|
+
onMouseenter: triggerAnimation,
|
|
84
|
+
role: "presentation"
|
|
85
|
+
}, [
|
|
86
|
+
createElementVNode("div", _hoisted_1, [
|
|
87
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(displayText.value, (letter, i) => {
|
|
88
|
+
return openBlock(), createElementBlock("span", {
|
|
89
|
+
key: i,
|
|
90
|
+
class: normalizeClass(unref(cn)("hyper-text-char inline-block font-mono", letter === " " ? "w-3" : "")),
|
|
91
|
+
style: normalizeStyle({ "--hyper-text-delay": `${i * (__props.duration / (__props.text.length * 10))}ms` })
|
|
92
|
+
}, toDisplayString(letter.toUpperCase()), 7);
|
|
93
|
+
}), 128))
|
|
94
|
+
])
|
|
95
|
+
], 34);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
export {
|
|
100
|
+
_sfc_main as default
|
|
101
|
+
};
|
|
@@ -1,40 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
props: {
|
|
7
|
-
words: {},
|
|
8
|
-
delay: { default: 0.05 },
|
|
9
|
-
class: { type: [Boolean, null, String, Object, Array] }
|
|
10
|
-
},
|
|
11
|
-
setup(__props) {
|
|
12
|
-
const attrs = useAttrs();
|
|
13
|
-
const letters = computed(() => __props.words.split(""));
|
|
14
|
-
return (_ctx, _cache) => {
|
|
15
|
-
return openBlock(), createElementBlock("div", mergeProps(unref(attrs), { class: "letter-pullup flex justify-center" }), [
|
|
16
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(letters.value, (letter, index) => {
|
|
17
|
-
return openBlock(), createElementBlock("span", {
|
|
18
|
-
key: index,
|
|
19
|
-
class: normalizeClass(
|
|
20
|
-
unref(cn)(
|
|
21
|
-
"letter-pullup-char inline-block text-center text-4xl font-bold tracking-[-0.02em] text-black drop-shadow-sm md:leading-[5rem] dark:text-white",
|
|
22
|
-
__props.class
|
|
23
|
-
)
|
|
24
|
-
),
|
|
25
|
-
style: normalizeStyle(`animation:letterPullUp 0.5s ease forwards;animation-delay:${index * __props.delay}s;opacity:0;transform:translateY(100px)`)
|
|
26
|
-
}, [
|
|
27
|
-
letter === " " ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
28
|
-
createTextVNode(" ")
|
|
29
|
-
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
30
|
-
createTextVNode(toDisplayString(letter), 1)
|
|
31
|
-
], 64))
|
|
32
|
-
], 6);
|
|
33
|
-
}), 128))
|
|
34
|
-
], 16);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
});
|
|
1
|
+
import _sfc_main from "./LetterPullup.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
/* empty css */
|
|
4
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
+
const LetterPullup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-83f4fa7b"]]);
|
|
38
6
|
export {
|
|
39
|
-
|
|
7
|
+
LetterPullup as default
|
|
40
8
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineComponent, useAttrs, computed, createElementBlock, openBlock, mergeProps, unref, Fragment, renderList, normalizeStyle, normalizeClass, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
...{ name: "LetterPullup", inheritAttrs: false },
|
|
5
|
+
__name: "LetterPullup",
|
|
6
|
+
props: {
|
|
7
|
+
words: {},
|
|
8
|
+
delay: { default: 0.05 },
|
|
9
|
+
class: { type: [Boolean, null, String, Object, Array] }
|
|
10
|
+
},
|
|
11
|
+
setup(__props) {
|
|
12
|
+
const attrs = useAttrs();
|
|
13
|
+
const letters = computed(() => __props.words.split(""));
|
|
14
|
+
return (_ctx, _cache) => {
|
|
15
|
+
return openBlock(), createElementBlock("div", mergeProps(unref(attrs), { class: "letter-pullup flex justify-center" }), [
|
|
16
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(letters.value, (letter, index) => {
|
|
17
|
+
return openBlock(), createElementBlock("span", {
|
|
18
|
+
key: index,
|
|
19
|
+
class: normalizeClass(
|
|
20
|
+
unref(cn)(
|
|
21
|
+
"letter-pullup-char inline-block text-center text-4xl font-bold tracking-[-0.02em] text-black drop-shadow-sm md:leading-[5rem] dark:text-white",
|
|
22
|
+
__props.class
|
|
23
|
+
)
|
|
24
|
+
),
|
|
25
|
+
style: normalizeStyle({ "--letter-pullup-delay": `${index * __props.delay}s` })
|
|
26
|
+
}, [
|
|
27
|
+
letter === " " ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
28
|
+
createTextVNode(" ")
|
|
29
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
30
|
+
createTextVNode(toDisplayString(letter), 1)
|
|
31
|
+
], 64))
|
|
32
|
+
], 6);
|
|
33
|
+
}), 128))
|
|
34
|
+
], 16);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
_sfc_main as default
|
|
40
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./AnimatedLogoCloud.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const AnimatedLogoCloud = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const AnimatedLogoCloud = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3366d174"]]);
|
|
5
5
|
export {
|
|
6
6
|
AnimatedLogoCloud as default
|
|
7
7
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, useTemplateRef, onMounted, onBeforeUnmount, watch, 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 { createMatrixRain } from "./matrix-rain-core.js";
|
|
4
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
6
|
...{ name: "MatrixRain", inheritAttrs: false },
|
|
@@ -16,10 +17,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16
17
|
const canvasRef = useTemplateRef("canvas");
|
|
17
18
|
let engine = null;
|
|
18
19
|
let observer = null;
|
|
20
|
+
const reducedMotion = useReducedMotion();
|
|
19
21
|
onMounted(() => {
|
|
20
22
|
const canvas = canvasRef.value;
|
|
21
23
|
if (!canvas) return;
|
|
22
|
-
engine = createMatrixRain(
|
|
24
|
+
engine = createMatrixRain(
|
|
25
|
+
{ canvas },
|
|
26
|
+
{
|
|
27
|
+
color: __props.color,
|
|
28
|
+
speed: __props.speed,
|
|
29
|
+
density: __props.density,
|
|
30
|
+
glyphSize: __props.glyphSize,
|
|
31
|
+
fadeOpacity: __props.fadeOpacity,
|
|
32
|
+
reducedMotion: reducedMotion.value
|
|
33
|
+
}
|
|
34
|
+
);
|
|
23
35
|
if (!engine) return;
|
|
24
36
|
observer = new ResizeObserver(() => engine?.resize());
|
|
25
37
|
observer.observe(canvas);
|
|
@@ -44,6 +56,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
44
56
|
},
|
|
45
57
|
{ flush: "post" }
|
|
46
58
|
);
|
|
59
|
+
watch(
|
|
60
|
+
reducedMotion,
|
|
61
|
+
(next) => {
|
|
62
|
+
engine?.setOptions({ reducedMotion: next });
|
|
63
|
+
},
|
|
64
|
+
{ flush: "post" }
|
|
65
|
+
);
|
|
47
66
|
return (_ctx, _cache) => {
|
|
48
67
|
return openBlock(), createElementBlock("canvas", {
|
|
49
68
|
ref: "canvas",
|
|
@@ -18,6 +18,12 @@ export interface MatrixRainLiveOptions {
|
|
|
18
18
|
glyphSize?: number;
|
|
19
19
|
/** Alpha of the per-frame fade-trail rectangle. Per-frame. */
|
|
20
20
|
fadeOpacity?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Reduced-motion preference, owned by the wrapper (the core stays free of
|
|
23
|
+
* `matchMedia`). When true the engine paints one still frame and idles; a
|
|
24
|
+
* flip back to false resumes the loop.
|
|
25
|
+
*/
|
|
26
|
+
reducedMotion?: boolean;
|
|
21
27
|
}
|
|
22
28
|
export interface MatrixRainEngine {
|
|
23
29
|
setOptions(next: Partial<MatrixRainLiveOptions>): void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const GLYPHS = "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%&";
|
|
2
|
+
const STILL_PRE_ROLL_STEPS = 80;
|
|
2
3
|
const DEFAULTS = {
|
|
3
4
|
color: "#00ff41",
|
|
4
5
|
speed: 1,
|
|
5
6
|
density: 1,
|
|
6
7
|
glyphSize: 16,
|
|
7
|
-
fadeOpacity: 0.05
|
|
8
|
+
fadeOpacity: 0.05,
|
|
9
|
+
reducedMotion: false
|
|
8
10
|
};
|
|
9
11
|
function merge(base, next) {
|
|
10
12
|
return {
|
|
@@ -12,7 +14,8 @@ function merge(base, next) {
|
|
|
12
14
|
speed: next.speed ?? base.speed,
|
|
13
15
|
density: next.density ?? base.density,
|
|
14
16
|
glyphSize: next.glyphSize ?? base.glyphSize,
|
|
15
|
-
fadeOpacity: next.fadeOpacity ?? base.fadeOpacity
|
|
17
|
+
fadeOpacity: next.fadeOpacity ?? base.fadeOpacity,
|
|
18
|
+
reducedMotion: next.reducedMotion ?? base.reducedMotion
|
|
16
19
|
};
|
|
17
20
|
}
|
|
18
21
|
function createMatrixRain(elements, options, random = Math.random) {
|
|
@@ -47,9 +50,12 @@ function createMatrixRain(elements, options, random = Math.random) {
|
|
|
47
50
|
ctx.fillStyle = "black";
|
|
48
51
|
ctx.fillRect(0, 0, canvasW, canvasH);
|
|
49
52
|
initColumns(canvasW, canvasH);
|
|
53
|
+
if (opts.reducedMotion && rafId === null) paintStill();
|
|
50
54
|
}
|
|
51
|
-
function
|
|
52
|
-
|
|
55
|
+
function paintStill() {
|
|
56
|
+
for (let i = 0; i < STILL_PRE_ROLL_STEPS; i++) step(true);
|
|
57
|
+
}
|
|
58
|
+
function step(advanceNow = false) {
|
|
53
59
|
const w = canvasW;
|
|
54
60
|
const h = canvasH;
|
|
55
61
|
ctx.fillStyle = `rgba(0, 0, 0, ${opts.fadeOpacity})`;
|
|
@@ -59,7 +65,7 @@ function createMatrixRain(elements, options, random = Math.random) {
|
|
|
59
65
|
ctx.shadowColor = opts.color;
|
|
60
66
|
const rowsPerFrame = Math.max(1, opts.speed);
|
|
61
67
|
frameCount++;
|
|
62
|
-
const shouldAdvance = opts.speed >= 1 || frameCount % Math.round(1 / opts.speed) === 0;
|
|
68
|
+
const shouldAdvance = advanceNow || opts.speed >= 1 || frameCount % Math.round(1 / opts.speed) === 0;
|
|
63
69
|
if (shouldAdvance) {
|
|
64
70
|
for (let i = 0; i < columns.length; i++) {
|
|
65
71
|
const column = columns[i];
|
|
@@ -79,10 +85,18 @@ function createMatrixRain(elements, options, random = Math.random) {
|
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
87
|
ctx.shadowBlur = 0;
|
|
88
|
+
}
|
|
89
|
+
function draw() {
|
|
90
|
+
if (destroyed) return;
|
|
91
|
+
step();
|
|
92
|
+
if (opts.reducedMotion) {
|
|
93
|
+
rafId = null;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
82
96
|
rafId = requestAnimationFrame(draw);
|
|
83
97
|
}
|
|
84
98
|
resize();
|
|
85
|
-
rafId = requestAnimationFrame(draw);
|
|
99
|
+
if (!opts.reducedMotion) rafId = requestAnimationFrame(draw);
|
|
86
100
|
return {
|
|
87
101
|
setOptions(next) {
|
|
88
102
|
if (destroyed) return;
|
|
@@ -90,6 +104,14 @@ function createMatrixRain(elements, options, random = Math.random) {
|
|
|
90
104
|
opts = merge(opts, next);
|
|
91
105
|
if (opts.glyphSize !== prev.glyphSize || opts.density !== prev.density) {
|
|
92
106
|
resize();
|
|
107
|
+
} else if (opts.reducedMotion && rafId === null && (opts.color !== prev.color || opts.fadeOpacity !== prev.fadeOpacity)) {
|
|
108
|
+
ctx.fillStyle = "black";
|
|
109
|
+
ctx.fillRect(0, 0, canvasW, canvasH);
|
|
110
|
+
initColumns(canvasW, canvasH);
|
|
111
|
+
paintStill();
|
|
112
|
+
}
|
|
113
|
+
if (prev.reducedMotion && !opts.reducedMotion && rafId === null) {
|
|
114
|
+
rafId = requestAnimationFrame(draw);
|
|
93
115
|
}
|
|
94
116
|
},
|
|
95
117
|
resize,
|