fancy-ui-vue 0.3.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/README.md +9 -6
- 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/magnetic-field/MagnetPuck.vue.d.ts +51 -0
- package/dist/components/magnetic-field/MagnetPuck.vue.js +7 -0
- package/dist/components/magnetic-field/MagnetPuck.vue2.js +191 -0
- package/dist/components/magnetic-field/MagneticField.vue.d.ts +39 -0
- package/dist/components/magnetic-field/MagneticField.vue.js +7 -0
- package/dist/components/magnetic-field/MagneticField.vue2.js +157 -0
- package/dist/components/magnetic-field/MagneticItem.vue.d.ts +28 -0
- package/dist/components/magnetic-field/MagneticItem.vue.js +7 -0
- package/dist/components/magnetic-field/MagneticItem.vue2.js +72 -0
- package/dist/components/magnetic-field/index.d.ts +10 -0
- package/dist/components/magnetic-field/magnetic-field-core.d.ts +163 -0
- package/dist/components/magnetic-field/magnetic-field-core.js +534 -0
- package/dist/components/magnetic-field/magnetic-field-source.d.ts +58 -0
- package/dist/components/magnetic-field/magnetic-field-source.js +58 -0
- package/dist/components/magnetic-field/types.d.ts +14 -0
- package/dist/components/magnetic-field/types.js +5 -0
- 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/pixel-scene/PixelScene.vue.d.ts +60 -0
- package/dist/components/pixel-scene/PixelScene.vue.js +184 -0
- package/dist/components/pixel-scene/PixelScene.vue2.js +4 -0
- package/dist/components/pixel-scene/index.d.ts +4 -0
- package/dist/components/pixel-scene/pixel-scene-core.d.ts +256 -0
- package/dist/components/pixel-scene/pixel-scene-core.js +878 -0
- package/dist/components/pixel-scene/pixel-scene-hdr.d.ts +68 -0
- package/dist/components/pixel-scene/pixel-scene-hdr.js +312 -0
- package/dist/components/pixel-scene/pixel-scene-scenes.d.ts +31 -0
- package/dist/components/pixel-scene/pixel-scene-scenes.js +1074 -0
- 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/story-thread/StoryNode.vue.d.ts +11 -0
- package/dist/components/story-thread/StoryNode.vue.js +7 -0
- package/dist/components/story-thread/StoryNode.vue2.js +23 -0
- package/dist/components/story-thread/StoryThread.vue.d.ts +56 -0
- package/dist/components/story-thread/StoryThread.vue.js +7 -0
- package/dist/components/story-thread/StoryThread.vue2.js +103 -0
- package/dist/components/story-thread/index.d.ts +5 -0
- package/dist/components/story-thread/story-thread-core.d.ts +119 -0
- package/dist/components/story-thread/story-thread-core.js +491 -0
- package/dist/components/story-thread/types.d.ts +1 -0
- package/dist/components/sun-switch/SunSwitch.vue.d.ts +61 -0
- package/dist/components/sun-switch/SunSwitch.vue.js +7 -0
- package/dist/components/sun-switch/SunSwitch.vue2.js +559 -0
- package/dist/components/sun-switch/index.d.ts +4 -0
- package/dist/components/sun-switch/pixel-wave-core.d.ts +82 -0
- package/dist/components/sun-switch/pixel-wave-core.js +508 -0
- package/dist/components/sun-switch/sun-switch-core.d.ts +251 -0
- package/dist/components/sun-switch/sun-switch-core.js +546 -0
- package/dist/components/sun-switch/sun-switch-hdr.d.ts +70 -0
- package/dist/components/sun-switch/sun-switch-hdr.js +311 -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/components/tracing-beam/TracingBeam.vue.d.ts +20 -1
- package/dist/components/tracing-beam/TracingBeam.vue.js +5 -164
- package/dist/components/tracing-beam/TracingBeam.vue2.js +168 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +361 -338
- package/dist/styles.css +731 -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,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
|
})
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import type { HTMLAttributes } from "vue";
|
|
2
2
|
export interface TracingBeamProps {
|
|
3
|
-
/** Additional CSS classes */
|
|
3
|
+
/** Additional CSS classes for the outer wrapper */
|
|
4
4
|
class?: HTMLAttributes["class"];
|
|
5
|
+
/**
|
|
6
|
+
* Colour of the lamp, its trail and the lit markers. Any CSS colour.
|
|
7
|
+
* Unset, it follows the theme's `--primary` token and falls back to a
|
|
8
|
+
* soft violet when no theme is present. Also settable from CSS via
|
|
9
|
+
* `--tracing-beam-accent`.
|
|
10
|
+
*/
|
|
11
|
+
accent?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Where the reader's eye is assumed to be, as a fraction of the viewport
|
|
14
|
+
* height from the top. The lamp sits on that line, clamped to the content.
|
|
15
|
+
*/
|
|
16
|
+
readingLine?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Draw a marker on the rail for every heading (`h1`–`h4`) inside the
|
|
19
|
+
* content — or, when there is none, for every direct child. Markers light
|
|
20
|
+
* up as the lamp passes them.
|
|
21
|
+
*/
|
|
22
|
+
markers?: boolean;
|
|
5
23
|
}
|
|
6
24
|
declare const _default: typeof __VLS_export;
|
|
7
25
|
export default _default;
|
|
8
26
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<TracingBeamProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TracingBeamProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
27
|
+
/** Long-form content the beam reads alongside */
|
|
9
28
|
default?(): unknown;
|
|
10
29
|
}>;
|
|
11
30
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -1,166 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
const _hoisted_2 = ["viewBox", "height"];
|
|
6
|
-
const _hoisted_3 = ["d"];
|
|
7
|
-
const _hoisted_4 = ["d", "stroke"];
|
|
8
|
-
const _hoisted_5 = ["y1", "y2"];
|
|
9
|
-
function mapRange(value, inMin, inMax, outMin, outMax) {
|
|
10
|
-
return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
|
|
11
|
-
}
|
|
12
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
-
...{ name: "TracingBeam", inheritAttrs: false },
|
|
14
|
-
__name: "TracingBeam",
|
|
15
|
-
props: {
|
|
16
|
-
class: { type: [Boolean, null, String, Object, Array], default: "" }
|
|
17
|
-
},
|
|
18
|
-
setup(__props) {
|
|
19
|
-
const gradientId = `${useFancyId()}-gradient`;
|
|
20
|
-
const tracingBeamRef = useTemplateRef("tracingBeamRef");
|
|
21
|
-
const contentRef = useTemplateRef("contentRef");
|
|
22
|
-
const svgHeight = ref(0);
|
|
23
|
-
const scrollYProgress = ref(0);
|
|
24
|
-
const scrollPercentage = ref(0);
|
|
25
|
-
const springY1 = ref(0);
|
|
26
|
-
const springY2 = ref(0);
|
|
27
|
-
let springVelY1 = 0;
|
|
28
|
-
let springVelY2 = 0;
|
|
29
|
-
const targetY1 = computed(
|
|
30
|
-
() => mapRange(scrollYProgress.value, 0, 0.8, scrollYProgress.value, svgHeight.value) * (1.4 - scrollPercentage.value)
|
|
31
|
-
);
|
|
32
|
-
const targetY2 = computed(
|
|
33
|
-
() => mapRange(scrollYProgress.value, 0, 1, scrollYProgress.value, svgHeight.value - 500) * (1.4 - scrollPercentage.value)
|
|
34
|
-
);
|
|
35
|
-
const circleHasShadow = computed(() => scrollYProgress.value <= 0);
|
|
36
|
-
const circleBg = computed(() => scrollYProgress.value > 0 ? "bg-white" : "bg-emerald-500");
|
|
37
|
-
const circleBorder = computed(
|
|
38
|
-
() => scrollYProgress.value > 0 ? "border-neutral-300" : "border-emerald-600"
|
|
39
|
-
);
|
|
40
|
-
const svgPath = computed(
|
|
41
|
-
() => `M 1 0V -36 l 18 24 V ${svgHeight.value * 0.8} l -18 24V ${svgHeight.value}`
|
|
42
|
-
);
|
|
43
|
-
let rafId = 0;
|
|
44
|
-
function updateSpring() {
|
|
45
|
-
const tension = 80;
|
|
46
|
-
const friction = 26;
|
|
47
|
-
const precision = 0.01;
|
|
48
|
-
const forceY1 = tension * (targetY1.value - springY1.value);
|
|
49
|
-
springVelY1 = (springVelY1 + forceY1 * 1e-3) * (1 - friction * 1e-3);
|
|
50
|
-
springY1.value += springVelY1;
|
|
51
|
-
const forceY2 = tension * (targetY2.value - springY2.value);
|
|
52
|
-
springVelY2 = (springVelY2 + forceY2 * 1e-3) * (1 - friction * 1e-3);
|
|
53
|
-
springY2.value += springVelY2;
|
|
54
|
-
const settled = Math.abs(springVelY1) < precision && Math.abs(targetY1.value - springY1.value) < precision && Math.abs(springVelY2) < precision && Math.abs(targetY2.value - springY2.value) < precision;
|
|
55
|
-
if (!settled) {
|
|
56
|
-
rafId = requestAnimationFrame(updateSpring);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function updateScrollProgress() {
|
|
60
|
-
const el = tracingBeamRef.value;
|
|
61
|
-
if (!el) return;
|
|
62
|
-
const rect = el.getBoundingClientRect();
|
|
63
|
-
const windowHeight = window.innerHeight;
|
|
64
|
-
const elementHeight = rect.height;
|
|
65
|
-
scrollPercentage.value = (windowHeight - rect.top) / (windowHeight + elementHeight);
|
|
66
|
-
scrollYProgress.value = rect.y / windowHeight * -1;
|
|
67
|
-
cancelAnimationFrame(rafId);
|
|
68
|
-
rafId = requestAnimationFrame(updateSpring);
|
|
69
|
-
}
|
|
70
|
-
function updateSVGHeight() {
|
|
71
|
-
const el = contentRef.value;
|
|
72
|
-
if (!el) return;
|
|
73
|
-
svgHeight.value = el.offsetHeight;
|
|
74
|
-
}
|
|
75
|
-
let resizeObserver;
|
|
76
|
-
onMounted(() => {
|
|
77
|
-
window.addEventListener("scroll", updateScrollProgress, { passive: true });
|
|
78
|
-
window.addEventListener("resize", updateScrollProgress, { passive: true });
|
|
79
|
-
updateScrollProgress();
|
|
80
|
-
resizeObserver = new ResizeObserver(updateSVGHeight);
|
|
81
|
-
if (contentRef.value) {
|
|
82
|
-
resizeObserver.observe(contentRef.value);
|
|
83
|
-
}
|
|
84
|
-
updateSVGHeight();
|
|
85
|
-
});
|
|
86
|
-
onBeforeUnmount(() => {
|
|
87
|
-
cancelAnimationFrame(rafId);
|
|
88
|
-
window.removeEventListener("scroll", updateScrollProgress);
|
|
89
|
-
window.removeEventListener("resize", updateScrollProgress);
|
|
90
|
-
resizeObserver?.disconnect();
|
|
91
|
-
});
|
|
92
|
-
return (_ctx, _cache) => {
|
|
93
|
-
return openBlock(), createElementBlock("div", {
|
|
94
|
-
ref_key: "tracingBeamRef",
|
|
95
|
-
ref: tracingBeamRef,
|
|
96
|
-
class: normalizeClass(unref(cn)("relative mx-auto h-full w-full max-w-4xl", __props.class))
|
|
97
|
-
}, [
|
|
98
|
-
createElementVNode("div", _hoisted_1, [
|
|
99
|
-
createElementVNode("div", {
|
|
100
|
-
class: "ml-[27px] flex size-4 items-center justify-center rounded-full border border-neutral-200 shadow-sm",
|
|
101
|
-
style: normalizeStyle({ boxShadow: circleHasShadow.value ? "rgba(0, 0, 0, 0.24) 0px 3px 8px" : "none" })
|
|
102
|
-
}, [
|
|
103
|
-
createElementVNode("div", {
|
|
104
|
-
class: normalizeClass(unref(cn)("size-2 rounded-full border", circleBg.value, circleBorder.value))
|
|
105
|
-
}, null, 2)
|
|
106
|
-
], 4),
|
|
107
|
-
(openBlock(), createElementBlock("svg", {
|
|
108
|
-
viewBox: `0 0 20 ${svgHeight.value}`,
|
|
109
|
-
width: "20",
|
|
110
|
-
height: svgHeight.value,
|
|
111
|
-
class: "ml-4 block",
|
|
112
|
-
"aria-hidden": "true"
|
|
113
|
-
}, [
|
|
114
|
-
createElementVNode("path", {
|
|
115
|
-
d: svgPath.value,
|
|
116
|
-
fill: "none",
|
|
117
|
-
stroke: "#9091A0",
|
|
118
|
-
"stroke-opacity": "0.16"
|
|
119
|
-
}, null, 8, _hoisted_3),
|
|
120
|
-
createElementVNode("path", {
|
|
121
|
-
d: svgPath.value,
|
|
122
|
-
fill: "none",
|
|
123
|
-
stroke: `url(#${gradientId})`,
|
|
124
|
-
"stroke-width": "1.25",
|
|
125
|
-
class: "motion-reduce:hidden"
|
|
126
|
-
}, null, 8, _hoisted_4),
|
|
127
|
-
createElementVNode("defs", null, [
|
|
128
|
-
createElementVNode("linearGradient", {
|
|
129
|
-
id: gradientId,
|
|
130
|
-
gradientUnits: "userSpaceOnUse",
|
|
131
|
-
x1: "0",
|
|
132
|
-
x2: "0",
|
|
133
|
-
y1: springY1.value,
|
|
134
|
-
y2: springY2.value
|
|
135
|
-
}, [..._cache[0] || (_cache[0] = [
|
|
136
|
-
createElementVNode("stop", {
|
|
137
|
-
"stop-color": "#18CCFC",
|
|
138
|
-
"stop-opacity": "0"
|
|
139
|
-
}, null, -1),
|
|
140
|
-
createElementVNode("stop", { "stop-color": "#18CCFC" }, null, -1),
|
|
141
|
-
createElementVNode("stop", {
|
|
142
|
-
offset: "0.325",
|
|
143
|
-
"stop-color": "#6344F5"
|
|
144
|
-
}, null, -1),
|
|
145
|
-
createElementVNode("stop", {
|
|
146
|
-
offset: "1",
|
|
147
|
-
"stop-color": "#AE48FF",
|
|
148
|
-
"stop-opacity": "0"
|
|
149
|
-
}, null, -1)
|
|
150
|
-
])], 8, _hoisted_5)
|
|
151
|
-
])
|
|
152
|
-
], 8, _hoisted_2))
|
|
153
|
-
]),
|
|
154
|
-
createElementVNode("div", {
|
|
155
|
-
ref_key: "contentRef",
|
|
156
|
-
ref: contentRef
|
|
157
|
-
}, [
|
|
158
|
-
renderSlot(_ctx.$slots, "default")
|
|
159
|
-
], 512)
|
|
160
|
-
], 2);
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
});
|
|
1
|
+
import _sfc_main from "./TracingBeam.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const TracingBeam = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-297de2d4"]]);
|
|
164
5
|
export {
|
|
165
|
-
|
|
6
|
+
TracingBeam as default
|
|
166
7
|
};
|
|
@@ -1,4 +1,171 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent, useTemplateRef, ref, onMounted, onBeforeUnmount, watch, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createElementVNode, Fragment, renderList, renderSlot } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import { rafThrottle } from "../../internals/motion/raf.js";
|
|
4
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
5
|
+
const _hoisted_1 = ["data-motion"];
|
|
6
|
+
const _hoisted_2 = {
|
|
7
|
+
class: "tb-gutter",
|
|
8
|
+
"aria-hidden": "true"
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_3 = ["data-lit"];
|
|
11
|
+
const _hoisted_4 = ["data-ready"];
|
|
12
|
+
const TENSION = 120;
|
|
13
|
+
const FRICTION = 22;
|
|
14
|
+
const PRECISION = 0.05;
|
|
15
|
+
const MAX_DT = 1 / 30;
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
+
...{ name: "TracingBeam", inheritAttrs: false },
|
|
18
|
+
__name: "TracingBeam",
|
|
19
|
+
props: {
|
|
20
|
+
class: { type: [Boolean, null, String, Object, Array], default: "" },
|
|
21
|
+
accent: {},
|
|
22
|
+
readingLine: { default: 0.38 },
|
|
23
|
+
markers: { type: Boolean, default: true }
|
|
24
|
+
},
|
|
25
|
+
setup(__props) {
|
|
26
|
+
const reduced = useReducedMotion();
|
|
27
|
+
const contentRef = useTemplateRef("contentRef");
|
|
28
|
+
const height = ref(0);
|
|
29
|
+
const ticks = ref([]);
|
|
30
|
+
const head = ref(0);
|
|
31
|
+
const ready = ref(false);
|
|
32
|
+
let target = 0;
|
|
33
|
+
let velocity = 0;
|
|
34
|
+
let rafId = 0;
|
|
35
|
+
let lastTime = 0;
|
|
36
|
+
function isLit(offset) {
|
|
37
|
+
return offset <= head.value + 0.5;
|
|
38
|
+
}
|
|
39
|
+
function clamp(value, min, max) {
|
|
40
|
+
return Math.min(max, Math.max(min, value));
|
|
41
|
+
}
|
|
42
|
+
function localScale(el, rect) {
|
|
43
|
+
const layout = el.offsetHeight;
|
|
44
|
+
if (layout <= 0 || rect.height <= 0 || Math.abs(rect.height - layout) < 1) return 1;
|
|
45
|
+
return rect.height / layout;
|
|
46
|
+
}
|
|
47
|
+
function step(time) {
|
|
48
|
+
const dt = Math.min(MAX_DT, (time - lastTime) / 1e3 || 0);
|
|
49
|
+
lastTime = time;
|
|
50
|
+
const force = TENSION * (target - head.value) - FRICTION * velocity;
|
|
51
|
+
velocity += force * dt;
|
|
52
|
+
head.value += velocity * dt;
|
|
53
|
+
if (Math.abs(velocity) < PRECISION && Math.abs(target - head.value) < PRECISION) {
|
|
54
|
+
head.value = target;
|
|
55
|
+
velocity = 0;
|
|
56
|
+
rafId = 0;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
rafId = requestAnimationFrame(step);
|
|
60
|
+
}
|
|
61
|
+
function place() {
|
|
62
|
+
const el = contentRef.value;
|
|
63
|
+
if (!el) return;
|
|
64
|
+
const rect = el.getBoundingClientRect();
|
|
65
|
+
const scale = localScale(el, rect);
|
|
66
|
+
const line = window.innerHeight * clamp(__props.readingLine, 0, 1);
|
|
67
|
+
target = clamp((line - rect.top) / scale, 0, Math.max(0, rect.height / scale));
|
|
68
|
+
ready.value = true;
|
|
69
|
+
if (reduced.value) {
|
|
70
|
+
cancelAnimationFrame(rafId);
|
|
71
|
+
rafId = 0;
|
|
72
|
+
velocity = 0;
|
|
73
|
+
head.value = target;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (!rafId) {
|
|
77
|
+
lastTime = performance.now();
|
|
78
|
+
rafId = requestAnimationFrame(step);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function measure() {
|
|
82
|
+
const el = contentRef.value;
|
|
83
|
+
if (!el) return;
|
|
84
|
+
const rect = el.getBoundingClientRect();
|
|
85
|
+
const scale = localScale(el, rect);
|
|
86
|
+
height.value = rect.height / scale;
|
|
87
|
+
if (__props.markers) {
|
|
88
|
+
const headings = el.querySelectorAll("h1, h2, h3, h4");
|
|
89
|
+
const anchors = headings.length ? [...headings] : [...el.children];
|
|
90
|
+
ticks.value = anchors.filter((node) => node instanceof HTMLElement).map((node) => {
|
|
91
|
+
const box = node.getBoundingClientRect();
|
|
92
|
+
return (box.top + box.height / 2 - rect.top) / scale;
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
ticks.value = [];
|
|
96
|
+
}
|
|
97
|
+
place();
|
|
98
|
+
}
|
|
99
|
+
onMounted(() => {
|
|
100
|
+
const onScroll = rafThrottle(place);
|
|
101
|
+
const onResize = rafThrottle(measure);
|
|
102
|
+
const resizeObserver = new ResizeObserver(() => onResize());
|
|
103
|
+
if (contentRef.value) resizeObserver.observe(contentRef.value);
|
|
104
|
+
window.addEventListener("scroll", onScroll, { passive: true });
|
|
105
|
+
window.addEventListener("resize", onResize, { passive: true });
|
|
106
|
+
measure();
|
|
107
|
+
onBeforeUnmount(() => {
|
|
108
|
+
onScroll.cancel();
|
|
109
|
+
onResize.cancel();
|
|
110
|
+
cancelAnimationFrame(rafId);
|
|
111
|
+
rafId = 0;
|
|
112
|
+
resizeObserver.disconnect();
|
|
113
|
+
window.removeEventListener("scroll", onScroll);
|
|
114
|
+
window.removeEventListener("resize", onResize);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
watch(
|
|
118
|
+
() => [__props.markers, __props.readingLine, reduced.value],
|
|
119
|
+
() => {
|
|
120
|
+
if (contentRef.value) queueMicrotask(measure);
|
|
121
|
+
},
|
|
122
|
+
{ flush: "post" }
|
|
123
|
+
);
|
|
124
|
+
return (_ctx, _cache) => {
|
|
125
|
+
return openBlock(), createElementBlock("div", {
|
|
126
|
+
class: normalizeClass(unref(cn)("tb-root relative mx-auto w-full max-w-4xl", __props.class)),
|
|
127
|
+
style: normalizeStyle({
|
|
128
|
+
"--tracing-beam-accent": __props.accent,
|
|
129
|
+
"--tb-progress": `${head.value}px`,
|
|
130
|
+
"--tb-height": `${height.value}px`
|
|
131
|
+
}),
|
|
132
|
+
"data-motion": unref(reduced) ? "reduced" : "full",
|
|
133
|
+
"data-tracing-beam": ""
|
|
134
|
+
}, [
|
|
135
|
+
createElementVNode("div", _hoisted_2, [
|
|
136
|
+
_cache[1] || (_cache[1] = createElementVNode("div", { class: "tb-rail" }, [
|
|
137
|
+
createElementVNode("span", { class: "tb-hair" }),
|
|
138
|
+
createElementVNode("span", { class: "tb-trail" })
|
|
139
|
+
], -1)),
|
|
140
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(ticks.value, (offset, index) => {
|
|
141
|
+
return openBlock(), createElementBlock("span", {
|
|
142
|
+
key: index,
|
|
143
|
+
class: "tb-tick",
|
|
144
|
+
style: normalizeStyle({ top: `${offset}px` }),
|
|
145
|
+
"data-tracing-beam-marker": "",
|
|
146
|
+
"data-lit": String(isLit(offset))
|
|
147
|
+
}, null, 12, _hoisted_3);
|
|
148
|
+
}), 128)),
|
|
149
|
+
createElementVNode("div", {
|
|
150
|
+
class: "tb-head",
|
|
151
|
+
"data-tracing-beam-head": "",
|
|
152
|
+
"data-ready": String(ready.value)
|
|
153
|
+
}, [..._cache[0] || (_cache[0] = [
|
|
154
|
+
createElementVNode("span", { class: "tb-spill" }, null, -1),
|
|
155
|
+
createElementVNode("span", { class: "tb-lamp" }, null, -1)
|
|
156
|
+
])], 8, _hoisted_4)
|
|
157
|
+
]),
|
|
158
|
+
createElementVNode("div", {
|
|
159
|
+
ref_key: "contentRef",
|
|
160
|
+
ref: contentRef,
|
|
161
|
+
class: "tb-content"
|
|
162
|
+
}, [
|
|
163
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
164
|
+
], 512)
|
|
165
|
+
], 14, _hoisted_1);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
});
|
|
2
169
|
export {
|
|
3
170
|
_sfc_main as default
|
|
4
171
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -87,6 +87,7 @@ export * from "./components/liquid-glass/index.js";
|
|
|
87
87
|
export * from "./components/liquid-text/index.js";
|
|
88
88
|
export * from "./components/logo-cloud/index.js";
|
|
89
89
|
export * from "./components/magnetic/index.js";
|
|
90
|
+
export * from "./components/magnetic-field/index.js";
|
|
90
91
|
export * from "./components/marquee/index.js";
|
|
91
92
|
export * from "./components/matrix-rain/index.js";
|
|
92
93
|
export * from "./components/meteors/index.js";
|
|
@@ -100,6 +101,7 @@ export * from "./components/number-ticker/index.js";
|
|
|
100
101
|
export * from "./components/pagination/index.js";
|
|
101
102
|
export * from "./components/password-input/index.js";
|
|
102
103
|
export * from "./components/pixel-loader/index.js";
|
|
104
|
+
export * from "./components/pixel-scene/index.js";
|
|
103
105
|
export * from "./components/popover/index.js";
|
|
104
106
|
export * from "./components/presence/index.js";
|
|
105
107
|
export * from "./components/pressable/index.js";
|
|
@@ -128,8 +130,10 @@ export * from "./components/sparkles-text/index.js";
|
|
|
128
130
|
export * from "./components/status-morph/index.js";
|
|
129
131
|
export * from "./components/stepper/index.js";
|
|
130
132
|
export * from "./components/sticky-scroll/index.js";
|
|
133
|
+
export * from "./components/story-thread/index.js";
|
|
131
134
|
export * from "./components/streaming-text/index.js";
|
|
132
135
|
export * from "./components/subagent-list/index.js";
|
|
136
|
+
export * from "./components/sun-switch/index.js";
|
|
133
137
|
export * from "./components/switch/index.js";
|
|
134
138
|
export * from "./components/tabs/index.js";
|
|
135
139
|
export * from "./components/terminal-block/index.js";
|