fancy-ui-vue 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/components/animated-testimonials/AnimatedTestimonials.vue.js +23 -12
- package/dist/components/bg-falling-stars/FallingStarsBg.vue.js +10 -1
- package/dist/components/bg-falling-stars/bg-falling-stars-core.d.ts +6 -0
- package/dist/components/bg-falling-stars/bg-falling-stars-core.js +24 -2
- package/dist/components/bg-stars/StarsBackground.vue.js +1 -1
- package/dist/components/bg-stars/StarsBackground.vue2.js +13 -1
- package/dist/components/bg-stars/bg-stars-core.d.ts +6 -0
- package/dist/components/bg-stars/bg-stars-core.js +21 -1
- package/dist/components/book/Book.vue.js +5 -83
- package/dist/components/book/Book.vue2.js +82 -1
- package/dist/components/box-reveal/BoxReveal.vue.js +5 -47
- package/dist/components/box-reveal/BoxReveal.vue2.js +48 -1
- package/dist/components/compare/StarField.vue.js +1 -1
- package/dist/components/container-text-flip/ContainerTextFlip.vue.js +1 -1
- package/dist/components/container-text-flip/ContainerTextFlip.vue2.js +14 -5
- package/dist/components/flickering-grid/FlickeringGrid.vue.js +19 -1
- package/dist/components/flickering-grid/flickering-grid-core.d.ts +6 -0
- package/dist/components/flickering-grid/flickering-grid-core.js +30 -1
- package/dist/components/flip-words/FlipWords.vue.js +1 -1
- package/dist/components/flip-words/FlipWords.vue2.js +14 -7
- package/dist/components/frost-glass/FrostGlass.vue.d.ts +31 -0
- package/dist/components/frost-glass/FrostGlass.vue.js +90 -0
- package/dist/components/frost-glass/FrostGlass.vue2.js +4 -0
- package/dist/components/frost-glass/frost-glass-core.d.ts +155 -0
- package/dist/components/frost-glass/frost-glass-core.js +820 -0
- package/dist/components/frost-glass/index.d.ts +2 -0
- package/dist/components/gift-reveal/GiftReveal.vue.d.ts +50 -0
- package/dist/components/gift-reveal/GiftReveal.vue.js +7 -0
- package/dist/components/gift-reveal/GiftReveal.vue2.js +177 -0
- package/dist/components/gift-reveal/gift-reveal-core.d.ts +109 -0
- package/dist/components/gift-reveal/gift-reveal-core.js +116 -0
- package/dist/components/gift-reveal/index.d.ts +2 -0
- package/dist/components/hyper-text/HyperText.vue.js +6 -97
- package/dist/components/hyper-text/HyperText.vue2.js +101 -0
- package/dist/components/letter-pullup/LetterPullup.vue.js +6 -38
- package/dist/components/letter-pullup/LetterPullup.vue2.js +40 -0
- package/dist/components/logo-cloud/AnimatedLogoCloud.vue.js +1 -1
- package/dist/components/matrix-rain/MatrixRain.vue.js +20 -1
- package/dist/components/matrix-rain/matrix-rain-core.d.ts +6 -0
- package/dist/components/matrix-rain/matrix-rain-core.js +28 -6
- package/dist/components/noise-reveal/NoiseReveal.vue.js +7 -0
- package/dist/components/noise-reveal/noise-reveal-core.js +23 -7
- package/dist/components/ornament/Ornament.vue.d.ts +29 -0
- package/dist/components/ornament/Ornament.vue.js +112 -0
- package/dist/components/ornament/Ornament.vue2.js +4 -0
- package/dist/components/ornament/index.d.ts +2 -0
- package/dist/components/ornament/ornament-core.d.ts +177 -0
- package/dist/components/ornament/ornament-core.js +861 -0
- package/dist/components/ripple/Ripple.vue.js +1 -1
- package/dist/components/ripple/Ripple.vue2.js +6 -1
- package/dist/components/snowfall/Snowfall.vue.d.ts +29 -0
- package/dist/components/snowfall/Snowfall.vue.js +81 -0
- package/dist/components/snowfall/Snowfall.vue2.js +4 -0
- package/dist/components/snowfall/index.d.ts +2 -0
- package/dist/components/snowfall/snowfall-core.d.ts +119 -0
- package/dist/components/snowfall/snowfall-core.js +483 -0
- package/dist/components/sparkles/Sparkles.vue.js +10 -1
- package/dist/components/sparkles/sparkles-core.d.ts +6 -0
- package/dist/components/sparkles/sparkles-core.js +26 -2
- package/dist/components/sparkles-text/SparklesText.vue.js +6 -88
- package/dist/components/sparkles-text/SparklesText.vue2.js +100 -0
- package/dist/components/string-lights/StringLights.vue.d.ts +35 -0
- package/dist/components/string-lights/StringLights.vue.js +7 -0
- package/dist/components/string-lights/StringLights.vue2.js +98 -0
- package/dist/components/string-lights/index.d.ts +2 -0
- package/dist/components/string-lights/string-lights-core.d.ts +157 -0
- package/dist/components/string-lights/string-lights-core.js +228 -0
- package/dist/components/terminal-text/TerminalText.vue.js +1 -1
- package/dist/components/terminal-text/TerminalText.vue2.js +36 -4
- package/dist/components/text-generate-effect/TextGenerateEffect.vue.js +5 -72
- package/dist/components/text-generate-effect/TextGenerateEffect.vue2.js +74 -1
- package/dist/components/text-reveal-card/TextRevealCard.vue.js +5 -101
- package/dist/components/text-reveal-card/TextRevealCard.vue2.js +98 -1
- package/dist/components/text-reveal-card/TextRevealStars.vue.js +1 -1
- package/dist/components/text-reveal-card/TextRevealStars.vue2.js +29 -12
- package/dist/index.d.ts +5 -0
- package/dist/index.js +393 -386
- package/dist/styles.css +1669 -185
- package/package.json +2 -2
- package/dist/components/hyper-text/HyperText.vue3.js +0 -5
- package/dist/components/letter-pullup/LetterPullup.vue3.js +0 -5
- package/dist/components/sparkles-text/SparklesText.vue3.js +0 -5
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Animated UI components for **Vue 3.5+**, styled with Tailwind CSS v4 — the
|
|
|
10
10
|

|
|
11
11
|

|
|
12
12
|

|
|
13
|
-

|
|
14
14
|

|
|
15
15
|
|
|
16
16
|
<p align="center">
|
|
@@ -40,10 +40,10 @@ Animated UI components for **Vue 3.5+**, styled with Tailwind CSS v4 — the
|
|
|
40
40
|
|
|
41
41
|
## Features
|
|
42
42
|
|
|
43
|
-
- **
|
|
43
|
+
- **160 components** — core primitives (forms, navigation, overlays) alongside buttons, text animations, backgrounds, cursors, AI/chat building blocks and a micro-interactions collection
|
|
44
44
|
- **Motion that feels physical** — beams of light, liquid-metal and neon borders, a physical flip card, a before/after slider with a motion trail, a datamosh page transition; springs and WebGL where they earn their keep
|
|
45
45
|
- **Idiomatic Vue 3.5** — `<script setup>` single-file components, reactive props destructuring, `defineModel` for every bindable (`v-model:<name>`), snippets as named and scoped slots, `defineExpose` wherever the Svelte source exposes a `ref`; every other prop keeps its Svelte name
|
|
46
|
-
- **Same components, three frameworks** — All
|
|
46
|
+
- **Same components, three frameworks** — All 160 components of `fancy-ui-svelte` are ported, under the same names and with the same visual contract; the [Svelte package](https://github.com/RamaHerbin/fancy-ui#readme) is the reference, [`fancy-ui-react`](https://github.com/RamaHerbin/fancy-ui/tree/main/react#readme) the React edition, and parity is checked in CI
|
|
47
47
|
- **Tailwind CSS v4** — one CSS import, semantic colour tokens, light and dark themes that follow the OS or a `.dark` class
|
|
48
48
|
- **Accessible and SSR-safe** — keyboard support where it applies, `prefers-reduced-motion` respected, a `seed` prop wherever the source randomises in render so server and client agree, clean hydration under Nuxt, canvas and WebGL work deferred to mount
|
|
49
49
|
- **Opt-in sound** — eleven synthesised interface cues, a `SoundToggle` switch and the `useSound` / `useSoundFeedback` composables; silent until the user turns it on
|
|
@@ -148,7 +148,7 @@ Those two imports are the whole setup. `tailwind.css` also declares every semant
|
|
|
148
148
|
Out of the box the package follows the operating-system preference: `dark:` utilities and the components' `light-dark()` colours both switch with `prefers-color-scheme`, so an app that never touches dark mode already looks right on a dark desktop. To control it yourself, put `dark` or `light` on `<html>` (or on any ancestor of the subtree you want to force) and both halves follow the class instead:
|
|
149
149
|
|
|
150
150
|
```html
|
|
151
|
-
<html class="dark">
|
|
151
|
+
<html class="dark"></html>
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
`tailwind.css` is what makes that work, in three parts: it declares the `.dark` token block, it declares a `dark` variant that matches a `.dark` ancestor OR the media query (unless a `.light` ancestor opts out), and it sets `color-scheme: light dark` on `:root` with `.dark` / `.light` overrides so the components' `light-dark()` colours — and the browser's own form controls, scrollbars and caret — resolve the same way. An app that declares its own `@custom-variant dark` after the import keeps its own definition.
|
|
@@ -225,14 +225,14 @@ The consumer app under `examples/` is `nuxt-app`, which resolves `fancy-ui-vue`
|
|
|
225
225
|
|
|
226
226
|
`build` does more than build. After Vite and `vue-tsc` it runs six scripts in `vue/scripts/`, each guarding something no other gate can see:
|
|
227
227
|
|
|
228
|
-
| Script | What it stops
|
|
229
|
-
| --------------------------- |
|
|
228
|
+
| Script | What it stops |
|
|
229
|
+
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
230
230
|
| `strip-dts-css-imports.mjs` | `vue-tsc` copies each component's `import "./x.css"` into its `.d.ts`, naming a file dist does not ship — one TS2307 per component for any consumer without `skipLibCheck` |
|
|
231
|
-
| `check-dist-names.mjs` | a minified build shipping `AnimatedBeam` as `const ut = ...` in every consumer's devtools tree and stack traces
|
|
232
|
-
| `prune-orphan-dts.mjs` | a declaration under `dist/internals/` with no runtime module behind it, typing an import that cannot load
|
|
233
|
-
| `check-dist-shape.mjs` | a test rig reaching the tarball, a declaration pointing at a file that is not there, an SFC without `<script setup>`, a bare import of a package nobody declared
|
|
234
|
-
| `smoke-dist.mjs` | the built artifact never being executed: it imports every module with no DOM, server-renders each component export, and holds a gzip budget over the emitted JS and CSS
|
|
235
|
-
| `ensure-styles-css.mjs` | the `./styles.css` subpath being declared while no stylesheet was emitted
|
|
231
|
+
| `check-dist-names.mjs` | a minified build shipping `AnimatedBeam` as `const ut = ...` in every consumer's devtools tree and stack traces |
|
|
232
|
+
| `prune-orphan-dts.mjs` | a declaration under `dist/internals/` with no runtime module behind it, typing an import that cannot load |
|
|
233
|
+
| `check-dist-shape.mjs` | a test rig reaching the tarball, a declaration pointing at a file that is not there, an SFC without `<script setup>`, a bare import of a package nobody declared |
|
|
234
|
+
| `smoke-dist.mjs` | the built artifact never being executed: it imports every module with no DOM, server-renders each component export, and holds a gzip budget over the emitted JS and CSS |
|
|
235
|
+
| `ensure-styles-css.mjs` | the `./styles.css` subpath being declared while no stylesheet was emitted |
|
|
236
236
|
|
|
237
237
|
`test:scripts` runs `dist-gates.test.mjs`, which tests the gates' own logic (what counts as a component, what the sweep counts) so a gate cannot go quiet without a test noticing. `check-matrix.mjs` (`check:matrix`) holds the migration matrix to the Svelte reference, and `vue-floor-consumer.mjs` is the CI-only floor check above; neither is part of `build`.
|
|
238
238
|
|
|
@@ -407,7 +407,7 @@ Components are named by their exported Vue name.
|
|
|
407
407
|
|
|
408
408
|
| Technology | Version | Purpose |
|
|
409
409
|
| -------------------------------------------- | ------- | ------------------- |
|
|
410
|
-
| [Vue](https://vuejs.org)
|
|
410
|
+
| [Vue](https://vuejs.org) | 3.5 | UI framework |
|
|
411
411
|
| [Tailwind CSS](https://tailwindcss.com) | 4 | Styling |
|
|
412
412
|
| [TypeScript](https://www.typescriptlang.org) | 5 | Type safety |
|
|
413
413
|
| [Vite](https://vite.dev) | 7 | Library build |
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, onMounted, onBeforeUnmount, computed, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, Fragment, renderList,
|
|
1
|
+
import { defineComponent, ref, watch, onMounted, onBeforeUnmount, computed, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, Fragment, renderList, toDisplayString } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
3
|
import { useSoundCue } from "../../sound/use-sound.js";
|
|
4
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
4
5
|
const _hoisted_1 = {
|
|
5
6
|
key: 0,
|
|
6
7
|
class: "text-muted-foreground text-center"
|
|
@@ -37,11 +38,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
37
38
|
const direction = ref("next");
|
|
38
39
|
const isAnimating = ref(false);
|
|
39
40
|
const isHovered = ref(false);
|
|
41
|
+
const isFocused = ref(false);
|
|
42
|
+
const reducedMotion = useReducedMotion();
|
|
40
43
|
let navigateTimer = null;
|
|
41
44
|
function navigate(dir, fromUser = false) {
|
|
42
45
|
if (isAnimating.value || __props.testimonials.length === 0) return;
|
|
43
46
|
if (__props.sound && fromUser && __props.testimonials.length > 1) playCue("select");
|
|
44
47
|
direction.value = dir;
|
|
48
|
+
if (reducedMotion.value) {
|
|
49
|
+
const n = __props.testimonials.length;
|
|
50
|
+
activeIndex.value = dir === "next" ? (activeIndex.value + 1) % n : (activeIndex.value - 1 + n) % n;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
45
53
|
isAnimating.value = true;
|
|
46
54
|
navigateTimer = setTimeout(() => {
|
|
47
55
|
const count = __props.testimonials.length;
|
|
@@ -61,12 +69,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
61
69
|
[
|
|
62
70
|
() => __props.autoplay,
|
|
63
71
|
() => isHovered.value,
|
|
72
|
+
() => isFocused.value,
|
|
73
|
+
() => reducedMotion.value,
|
|
64
74
|
() => __props.interval,
|
|
65
75
|
() => __props.testimonials,
|
|
66
76
|
() => __props.testimonials.length
|
|
67
77
|
],
|
|
68
78
|
(_v, _o, onCleanup) => {
|
|
69
|
-
if (!__props.autoplay || isHovered.value || __props.testimonials.length === 0)
|
|
79
|
+
if (!__props.autoplay || isHovered.value || isFocused.value || reducedMotion.value || __props.testimonials.length === 0)
|
|
80
|
+
return;
|
|
70
81
|
const timer = setInterval(() => navigate("next"), __props.interval);
|
|
71
82
|
onCleanup(() => clearInterval(timer));
|
|
72
83
|
},
|
|
@@ -89,6 +100,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
89
100
|
),
|
|
90
101
|
onMouseenter: _cache[2] || (_cache[2] = ($event) => isHovered.value = true),
|
|
91
102
|
onMouseleave: _cache[3] || (_cache[3] = ($event) => isHovered.value = false),
|
|
103
|
+
onFocusin: _cache[4] || (_cache[4] = ($event) => isFocused.value = true),
|
|
104
|
+
onFocusout: _cache[5] || (_cache[5] = ($event) => isFocused.value = false),
|
|
92
105
|
role: "region",
|
|
93
106
|
"aria-label": "Testimonials"
|
|
94
107
|
}, [
|
|
@@ -99,12 +112,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
99
112
|
key: index,
|
|
100
113
|
class: normalizeClass(
|
|
101
114
|
unref(cn)(
|
|
102
|
-
"absolute inset-0 h-full w-full origin-bottom rounded-3xl ease-in-out motion-safe:transition-all",
|
|
115
|
+
"absolute inset-0 h-full w-full origin-bottom rounded-3xl ease-in-out motion-safe:transition-all motion-safe:duration-300",
|
|
103
116
|
index === activeIndex.value ? "z-20 translate-y-0 scale-100 rotate-0 opacity-100" : "z-10 translate-y-4 scale-95 opacity-0",
|
|
104
117
|
index !== activeIndex.value && direction.value === "next" ? "-translate-y-4" : index !== activeIndex.value ? "translate-y-4" : ""
|
|
105
118
|
)
|
|
106
|
-
)
|
|
107
|
-
style: normalizeStyle(`transition-duration: ${TRANSITION_DURATION}ms`)
|
|
119
|
+
)
|
|
108
120
|
}, [
|
|
109
121
|
createElementVNode("img", {
|
|
110
122
|
src: testimonial.src,
|
|
@@ -112,32 +124,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
112
124
|
class: "h-full w-full rounded-3xl object-cover object-center",
|
|
113
125
|
draggable: "false"
|
|
114
126
|
}, null, 8, _hoisted_4)
|
|
115
|
-
],
|
|
127
|
+
], 2);
|
|
116
128
|
}), 128))
|
|
117
129
|
]),
|
|
118
130
|
createElementVNode("div", _hoisted_5, [
|
|
119
131
|
createElementVNode("div", {
|
|
120
132
|
class: normalizeClass(
|
|
121
133
|
unref(cn)(
|
|
122
|
-
"ease-in-out",
|
|
134
|
+
"ease-in-out motion-safe:transition-[opacity,transform] motion-safe:duration-300",
|
|
123
135
|
isAnimating.value ? direction.value === "next" ? "translate-y-4 opacity-0" : "-translate-y-4 opacity-0" : "translate-y-0 opacity-100"
|
|
124
136
|
)
|
|
125
|
-
)
|
|
126
|
-
style: normalizeStyle(`transition: opacity ${TRANSITION_DURATION}ms, transform ${TRANSITION_DURATION}ms`)
|
|
137
|
+
)
|
|
127
138
|
}, [
|
|
128
139
|
createElementVNode("p", _hoisted_6, toDisplayString(activeTestimonial.value?.quote), 1),
|
|
129
140
|
createElementVNode("div", _hoisted_7, [
|
|
130
141
|
createElementVNode("p", _hoisted_8, toDisplayString(activeTestimonial.value?.name), 1),
|
|
131
142
|
createElementVNode("p", _hoisted_9, toDisplayString(activeTestimonial.value?.designation), 1)
|
|
132
143
|
])
|
|
133
|
-
],
|
|
144
|
+
], 2),
|
|
134
145
|
createElementVNode("div", _hoisted_10, [
|
|
135
146
|
createElementVNode("button", {
|
|
136
147
|
type: "button",
|
|
137
148
|
onClick: _cache[0] || (_cache[0] = ($event) => navigate("prev", true)),
|
|
138
149
|
class: "group/button flex h-10 w-10 items-center justify-center rounded-full bg-gray-100 transition-colors hover:bg-gray-200 dark:bg-neutral-800 dark:hover:bg-neutral-700",
|
|
139
150
|
"aria-label": "Previous testimonial"
|
|
140
|
-
}, [..._cache[
|
|
151
|
+
}, [..._cache[6] || (_cache[6] = [
|
|
141
152
|
createElementVNode("svg", {
|
|
142
153
|
xmlns: "http://www.w3.org/2000/svg",
|
|
143
154
|
width: "20",
|
|
@@ -158,7 +169,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
158
169
|
onClick: _cache[1] || (_cache[1] = ($event) => navigate("next", true)),
|
|
159
170
|
class: "group/button flex h-10 w-10 items-center justify-center rounded-full bg-gray-100 transition-colors hover:bg-gray-200 dark:bg-neutral-800 dark:hover:bg-neutral-700",
|
|
160
171
|
"aria-label": "Next testimonial"
|
|
161
|
-
}, [..._cache[
|
|
172
|
+
}, [..._cache[7] || (_cache[7] = [
|
|
162
173
|
createElementVNode("svg", {
|
|
163
174
|
xmlns: "http://www.w3.org/2000/svg",
|
|
164
175
|
width: "20",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, useTemplateRef, watch, onMounted, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, unref } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
3
4
|
import { createFallingStars } from "./bg-falling-stars-core.js";
|
|
4
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
6
|
...{ name: "FallingStarsBg", inheritAttrs: false },
|
|
@@ -13,6 +14,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13
14
|
const canvasRef = useTemplateRef("canvas");
|
|
14
15
|
let engine = null;
|
|
15
16
|
let resizeObserver = null;
|
|
17
|
+
const reducedMotion = useReducedMotion();
|
|
16
18
|
watch(
|
|
17
19
|
() => __props.color,
|
|
18
20
|
(nextColor) => {
|
|
@@ -23,7 +25,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
23
25
|
onMounted(() => {
|
|
24
26
|
const canvas = canvasRef.value;
|
|
25
27
|
if (!canvas) return;
|
|
26
|
-
engine = createFallingStars({ canvas }, { count: __props.count, color: __props.color });
|
|
28
|
+
engine = createFallingStars({ canvas }, { count: __props.count, color: __props.color, reducedMotion: reducedMotion.value });
|
|
27
29
|
resizeObserver = new ResizeObserver(() => engine?.resize());
|
|
28
30
|
resizeObserver.observe(canvas);
|
|
29
31
|
});
|
|
@@ -31,6 +33,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
31
33
|
engine?.destroy();
|
|
32
34
|
resizeObserver?.disconnect();
|
|
33
35
|
});
|
|
36
|
+
watch(
|
|
37
|
+
reducedMotion,
|
|
38
|
+
(next) => {
|
|
39
|
+
engine?.setOptions({ reducedMotion: next });
|
|
40
|
+
},
|
|
41
|
+
{ flush: "post" }
|
|
42
|
+
);
|
|
34
43
|
return (_ctx, _cache) => {
|
|
35
44
|
return openBlock(), createElementBlock("canvas", {
|
|
36
45
|
ref: "canvas",
|
|
@@ -11,6 +11,12 @@ export interface FallingStarsInitOptions {
|
|
|
11
11
|
export interface FallingStarsLiveOptions {
|
|
12
12
|
/** Star color: a hex string, or `currentColor` (default) to follow the text colour. */
|
|
13
13
|
color?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Reduced-motion preference, owned by the wrapper (the core never reads
|
|
16
|
+
* `matchMedia`). When true the engine paints one still frame and idles; a
|
|
17
|
+
* flip back to false resumes the loop.
|
|
18
|
+
*/
|
|
19
|
+
reducedMotion?: boolean;
|
|
14
20
|
}
|
|
15
21
|
export interface FallingStarsEngine {
|
|
16
22
|
setOptions(next: Partial<FallingStarsLiveOptions>): void;
|
|
@@ -57,6 +57,7 @@ function createFallingStars(el, options, random = Math.random) {
|
|
|
57
57
|
let perspective = 0;
|
|
58
58
|
let stars = [];
|
|
59
59
|
let rafId = 0;
|
|
60
|
+
let reducedMotion = options.reducedMotion ?? false;
|
|
60
61
|
let destroyed = false;
|
|
61
62
|
function resize() {
|
|
62
63
|
if (destroyed) return;
|
|
@@ -72,6 +73,7 @@ function createFallingStars(el, options, random = Math.random) {
|
|
|
72
73
|
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
73
74
|
}
|
|
74
75
|
perspective = width / 2;
|
|
76
|
+
if (reducedMotion && rafId === 0 && stars.length > 0) loop();
|
|
75
77
|
}
|
|
76
78
|
function drawStar(star, width, height, rgb) {
|
|
77
79
|
if (!ctx) return;
|
|
@@ -121,6 +123,10 @@ function createFallingStars(el, options, random = Math.random) {
|
|
|
121
123
|
star.y = (random() - 0.5) * 2 * height;
|
|
122
124
|
}
|
|
123
125
|
}
|
|
126
|
+
if (reducedMotion) {
|
|
127
|
+
rafId = 0;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
124
130
|
rafId = requestAnimationFrame(loop);
|
|
125
131
|
}
|
|
126
132
|
resize();
|
|
@@ -135,17 +141,33 @@ function createFallingStars(el, options, random = Math.random) {
|
|
|
135
141
|
speed: random() * 5 + 2
|
|
136
142
|
});
|
|
137
143
|
}
|
|
138
|
-
|
|
144
|
+
if (reducedMotion) loop();
|
|
145
|
+
else rafId = requestAnimationFrame(loop);
|
|
146
|
+
const themeObserver = typeof MutationObserver !== "undefined" ? new MutationObserver(() => {
|
|
147
|
+
if (reducedMotion && rafId === 0 && CURRENT_COLOR.test(color)) loop();
|
|
148
|
+
}) : null;
|
|
149
|
+
themeObserver?.observe(document.documentElement, {
|
|
150
|
+
attributes: true,
|
|
151
|
+
attributeFilter: ["class"]
|
|
152
|
+
});
|
|
139
153
|
return {
|
|
140
154
|
setOptions(next) {
|
|
141
|
-
if (
|
|
155
|
+
if (destroyed) return;
|
|
156
|
+
const wasReduced = reducedMotion;
|
|
157
|
+
if (next.reducedMotion !== void 0) reducedMotion = next.reducedMotion;
|
|
158
|
+
if (next.color !== void 0 && next.color !== color) {
|
|
142
159
|
color = next.color;
|
|
160
|
+
if (reducedMotion && rafId === 0) loop();
|
|
161
|
+
}
|
|
162
|
+
if (wasReduced && !reducedMotion && rafId === 0) {
|
|
163
|
+
rafId = requestAnimationFrame(loop);
|
|
143
164
|
}
|
|
144
165
|
},
|
|
145
166
|
resize,
|
|
146
167
|
destroy() {
|
|
147
168
|
if (destroyed) return;
|
|
148
169
|
destroyed = true;
|
|
170
|
+
themeObserver?.disconnect();
|
|
149
171
|
if (rafId) cancelAnimationFrame(rafId);
|
|
150
172
|
}
|
|
151
173
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./StarsBackground.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const StarsBackground = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const StarsBackground = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-51fcced5"]]);
|
|
5
5
|
export {
|
|
6
6
|
StarsBackground as default
|
|
7
7
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, useTemplateRef, onMounted, onBeforeUnmount, watch, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, renderSlot, normalizeStyle } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
3
4
|
import { generateStars, createBgStars } from "./bg-stars-core.js";
|
|
4
5
|
const _hoisted_1 = {
|
|
5
6
|
ref: "parallax",
|
|
@@ -41,11 +42,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
41
42
|
const hostRef = useTemplateRef("host");
|
|
42
43
|
const parallaxRef = useTemplateRef("parallax");
|
|
43
44
|
let engine = null;
|
|
45
|
+
const reducedMotion = useReducedMotion();
|
|
44
46
|
onMounted(() => {
|
|
45
47
|
const host = hostRef.value;
|
|
46
48
|
const parallax = parallaxRef.value;
|
|
47
49
|
if (!host || !parallax) return;
|
|
48
|
-
engine = createBgStars(
|
|
50
|
+
engine = createBgStars(
|
|
51
|
+
{ host, parallax },
|
|
52
|
+
{ factor: __props.factor, stiffness: __props.stiffness, damping: __props.damping, reducedMotion: reducedMotion.value }
|
|
53
|
+
);
|
|
49
54
|
});
|
|
50
55
|
onBeforeUnmount(() => {
|
|
51
56
|
engine?.destroy();
|
|
@@ -61,6 +66,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
61
66
|
const layer1Duration = computed(() => `${__props.speed}s`);
|
|
62
67
|
const layer2Duration = computed(() => `${__props.speed * 2}s`);
|
|
63
68
|
const layer3Duration = computed(() => `${__props.speed * 3}s`);
|
|
69
|
+
watch(
|
|
70
|
+
reducedMotion,
|
|
71
|
+
(next) => {
|
|
72
|
+
engine?.setOptions({ reducedMotion: next });
|
|
73
|
+
},
|
|
74
|
+
{ flush: "post" }
|
|
75
|
+
);
|
|
64
76
|
return (_ctx, _cache) => {
|
|
65
77
|
return openBlock(), createElementBlock("div", {
|
|
66
78
|
ref: "host",
|
|
@@ -16,6 +16,12 @@ export interface BgStarsLiveOptions {
|
|
|
16
16
|
stiffness?: number;
|
|
17
17
|
/** Spring damping for parallax (default: 20). */
|
|
18
18
|
damping?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Reduced-motion preference, owned by the wrapper (the core never reads
|
|
21
|
+
* `matchMedia`). When true the parallax is parked at rest and the loop idles;
|
|
22
|
+
* a flip back to false resumes it.
|
|
23
|
+
*/
|
|
24
|
+
reducedMotion?: boolean;
|
|
19
25
|
}
|
|
20
26
|
export interface BgStarsEngine {
|
|
21
27
|
setOptions(next: Partial<BgStarsLiveOptions>): void;
|
|
@@ -20,12 +20,19 @@ function createBgStars(el, options, random = Math.random) {
|
|
|
20
20
|
let targetY = 0;
|
|
21
21
|
let velocityX = 0;
|
|
22
22
|
let velocityY = 0;
|
|
23
|
+
let reducedMotion = options.reducedMotion ?? false;
|
|
23
24
|
let rafId = null;
|
|
24
25
|
let destroyed = false;
|
|
25
26
|
function applyTransform() {
|
|
26
27
|
el.parallax.style.transform = `translate(${springX}px, ${springY}px)`;
|
|
27
28
|
}
|
|
28
29
|
function tick() {
|
|
30
|
+
if (reducedMotion) {
|
|
31
|
+
springX = springY = targetX = targetY = velocityX = velocityY = 0;
|
|
32
|
+
applyTransform();
|
|
33
|
+
rafId = null;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
29
36
|
const forceX = (targetX - springX) * (stiffness / 1e3);
|
|
30
37
|
const forceY = (targetY - springY) * (stiffness / 1e3);
|
|
31
38
|
velocityX = velocityX * (1 - damping / 100) + forceX;
|
|
@@ -36,6 +43,7 @@ function createBgStars(el, options, random = Math.random) {
|
|
|
36
43
|
rafId = requestAnimationFrame(tick);
|
|
37
44
|
}
|
|
38
45
|
function handleMouseMove(e) {
|
|
46
|
+
if (reducedMotion) return;
|
|
39
47
|
const centerX = window.innerWidth / 2;
|
|
40
48
|
const centerY = window.innerHeight / 2;
|
|
41
49
|
targetX = -(e.clientX - centerX) * factor;
|
|
@@ -43,13 +51,25 @@ function createBgStars(el, options, random = Math.random) {
|
|
|
43
51
|
}
|
|
44
52
|
el.host.addEventListener("mousemove", handleMouseMove);
|
|
45
53
|
applyTransform();
|
|
46
|
-
rafId = requestAnimationFrame(tick);
|
|
54
|
+
if (!reducedMotion) rafId = requestAnimationFrame(tick);
|
|
47
55
|
return {
|
|
48
56
|
setOptions(next) {
|
|
49
57
|
if (destroyed) return;
|
|
50
58
|
if (next.factor !== void 0) factor = next.factor;
|
|
51
59
|
if (next.stiffness !== void 0) stiffness = next.stiffness;
|
|
52
60
|
if (next.damping !== void 0) damping = next.damping;
|
|
61
|
+
if (next.reducedMotion !== void 0 && next.reducedMotion !== reducedMotion) {
|
|
62
|
+
reducedMotion = next.reducedMotion;
|
|
63
|
+
if (reducedMotion) {
|
|
64
|
+
if (rafId !== null) {
|
|
65
|
+
cancelAnimationFrame(rafId);
|
|
66
|
+
rafId = null;
|
|
67
|
+
}
|
|
68
|
+
tick();
|
|
69
|
+
} else if (rafId === null) {
|
|
70
|
+
rafId = requestAnimationFrame(tick);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
53
73
|
},
|
|
54
74
|
resize() {
|
|
55
75
|
},
|
|
@@ -1,85 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
-
...{ name: "Book", inheritAttrs: false },
|
|
7
|
-
__name: "Book",
|
|
8
|
-
props: {
|
|
9
|
-
class: { type: [Boolean, null, String, Object, Array], default: "" },
|
|
10
|
-
duration: { default: 1e3 },
|
|
11
|
-
color: { default: "zinc" },
|
|
12
|
-
isStatic: { type: Boolean, default: false },
|
|
13
|
-
size: { default: "md" },
|
|
14
|
-
radius: { default: "md" },
|
|
15
|
-
shadowSize: { default: "lg" }
|
|
16
|
-
},
|
|
17
|
-
setup(__props) {
|
|
18
|
-
const props = __props;
|
|
19
|
-
const attrs = useAttrs();
|
|
20
|
-
const computedGradient = computed(() => BOOK_COLOR_MAP[props.color] || BOOK_COLOR_MAP.zinc);
|
|
21
|
-
return (_ctx, _cache) => {
|
|
22
|
-
return openBlock(), createElementBlock("div", mergeProps(unref(attrs), {
|
|
23
|
-
class: unref(cn)(
|
|
24
|
-
"group z-10 w-min [--shadowColor:#bbb] [perspective:800px] dark:[--shadowColor:#111]",
|
|
25
|
-
props.class
|
|
26
|
-
)
|
|
27
|
-
}), [
|
|
28
|
-
createElementVNode("div", {
|
|
29
|
-
style: normalizeStyle({ width: unref(BOOK_SIZE_MAP)[__props.size].width, transition: `transform ${__props.duration}ms ease` }),
|
|
30
|
-
class: normalizeClass(
|
|
31
|
-
unref(cn)(
|
|
32
|
-
"relative aspect-[3/4] [transform-style:preserve-3d]",
|
|
33
|
-
__props.isStatic ? "[transform:rotateY(-30deg)]" : "[transform:rotateY(0deg)] group-hover:[transform:rotateY(-30deg)]",
|
|
34
|
-
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
35
|
-
)
|
|
36
|
-
)
|
|
37
|
-
}, [
|
|
38
|
-
createElementVNode("div", {
|
|
39
|
-
class: normalizeClass(
|
|
40
|
-
unref(cn)(
|
|
41
|
-
"absolute inset-y-0 left-0 flex size-full flex-col justify-end overflow-hidden bg-gradient-to-tr p-6 text-white",
|
|
42
|
-
computedGradient.value.from,
|
|
43
|
-
computedGradient.value.to,
|
|
44
|
-
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
45
|
-
)
|
|
46
|
-
),
|
|
47
|
-
style: { "transform": "translateZ(25px)", "box-shadow": "5px 5px 20px var(--shadowColor)" }
|
|
48
|
-
}, [
|
|
49
|
-
_cache[0] || (_cache[0] = createElementVNode("div", {
|
|
50
|
-
class: "absolute top-0 left-0 h-full",
|
|
51
|
-
style: { "min-width": "8.2%", "background": "linear-gradient(\n 90deg,\n hsla(0, 0%, 100%, 0),\n hsla(0, 0%, 100%, 0) 12%,\n hsla(0, 0%, 100%, 0.25) 29.25%,\n hsla(0, 0%, 100%, 0) 50.5%,\n hsla(0, 0%, 100%, 0) 75.25%,\n hsla(0, 0%, 100%, 0.25) 91%,\n hsla(0, 0%, 100%, 0)\n ),\n linear-gradient(\n 90deg,\n rgba(0, 0, 0, 0.03),\n rgba(0, 0, 0, 0.1) 12%,\n transparent 30%,\n rgba(0, 0, 0, 0.02) 50%,\n rgba(0, 0, 0, 0.2) 73.5%,\n rgba(0, 0, 0, 0.5) 75.25%,\n rgba(0, 0, 0, 0.15) 85.25%,\n transparent\n )", "opacity": "0.2" }
|
|
52
|
-
}, null, -1)),
|
|
53
|
-
createElementVNode("div", _hoisted_1, [
|
|
54
|
-
renderSlot(_ctx.$slots, "default")
|
|
55
|
-
])
|
|
56
|
-
], 2),
|
|
57
|
-
createElementVNode("div", {
|
|
58
|
-
class: "absolute left-0 bg-white",
|
|
59
|
-
style: normalizeStyle({
|
|
60
|
-
top: "3px",
|
|
61
|
-
bottom: "3px",
|
|
62
|
-
width: "48px",
|
|
63
|
-
transform: `translateX(${unref(BOOK_SIZE_MAP)[__props.size].spineTranslation}) rotateY(90deg)`,
|
|
64
|
-
background: "linear-gradient(90deg, rgba(255,255,255,1) 50%, rgba(249,249,249,1) 50%)"
|
|
65
|
-
})
|
|
66
|
-
}, null, 4),
|
|
67
|
-
createElementVNode("div", {
|
|
68
|
-
class: normalizeClass(
|
|
69
|
-
unref(cn)(
|
|
70
|
-
"absolute inset-y-0 left-0 flex size-full flex-col justify-end overflow-hidden bg-gradient-to-tr p-6 text-white",
|
|
71
|
-
computedGradient.value.from,
|
|
72
|
-
computedGradient.value.to,
|
|
73
|
-
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
74
|
-
)
|
|
75
|
-
),
|
|
76
|
-
style: normalizeStyle({ transform: "translateZ(-25px)", boxShadow: unref(BOOK_SHADOW_SIZE_MAP)[__props.shadowSize] })
|
|
77
|
-
}, null, 6)
|
|
78
|
-
], 6)
|
|
79
|
-
], 16);
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
});
|
|
1
|
+
import _sfc_main from "./Book.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const Book = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-05eed92f"]]);
|
|
83
5
|
export {
|
|
84
|
-
|
|
6
|
+
Book as default
|
|
85
7
|
};
|
|
@@ -1,4 +1,85 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent, useAttrs, computed, createElementBlock, openBlock, mergeProps, unref, createElementVNode, normalizeClass, normalizeStyle, renderSlot } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import { BOOK_COLOR_MAP, BOOK_RADIUS_MAP, BOOK_SIZE_MAP, BOOK_SHADOW_SIZE_MAP } from "./index.js";
|
|
4
|
+
const _hoisted_1 = { class: "pl-1" };
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
...{ name: "Book", inheritAttrs: false },
|
|
7
|
+
__name: "Book",
|
|
8
|
+
props: {
|
|
9
|
+
class: { type: [Boolean, null, String, Object, Array], default: "" },
|
|
10
|
+
duration: { default: 1e3 },
|
|
11
|
+
color: { default: "zinc" },
|
|
12
|
+
isStatic: { type: Boolean, default: false },
|
|
13
|
+
size: { default: "md" },
|
|
14
|
+
radius: { default: "md" },
|
|
15
|
+
shadowSize: { default: "lg" }
|
|
16
|
+
},
|
|
17
|
+
setup(__props) {
|
|
18
|
+
const props = __props;
|
|
19
|
+
const attrs = useAttrs();
|
|
20
|
+
const computedGradient = computed(() => BOOK_COLOR_MAP[props.color] || BOOK_COLOR_MAP.zinc);
|
|
21
|
+
return (_ctx, _cache) => {
|
|
22
|
+
return openBlock(), createElementBlock("div", mergeProps(unref(attrs), {
|
|
23
|
+
class: unref(cn)(
|
|
24
|
+
"group z-10 w-min [--shadowColor:#bbb] [perspective:800px] dark:[--shadowColor:#111]",
|
|
25
|
+
props.class
|
|
26
|
+
)
|
|
27
|
+
}), [
|
|
28
|
+
createElementVNode("div", {
|
|
29
|
+
style: normalizeStyle({ width: unref(BOOK_SIZE_MAP)[__props.size].width, "--book-duration": `${__props.duration}ms` }),
|
|
30
|
+
class: normalizeClass(
|
|
31
|
+
unref(cn)(
|
|
32
|
+
"book-cover relative aspect-[3/4] [transform-style:preserve-3d]",
|
|
33
|
+
__props.isStatic ? "[transform:rotateY(-30deg)]" : "[transform:rotateY(0deg)] group-hover:[transform:rotateY(-30deg)]",
|
|
34
|
+
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
}, [
|
|
38
|
+
createElementVNode("div", {
|
|
39
|
+
class: normalizeClass(
|
|
40
|
+
unref(cn)(
|
|
41
|
+
"absolute inset-y-0 left-0 flex size-full flex-col justify-end overflow-hidden bg-gradient-to-tr p-6 text-white",
|
|
42
|
+
computedGradient.value.from,
|
|
43
|
+
computedGradient.value.to,
|
|
44
|
+
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
45
|
+
)
|
|
46
|
+
),
|
|
47
|
+
style: { "transform": "translateZ(25px)", "box-shadow": "5px 5px 20px var(--shadowColor)" }
|
|
48
|
+
}, [
|
|
49
|
+
_cache[0] || (_cache[0] = createElementVNode("div", {
|
|
50
|
+
class: "absolute top-0 left-0 h-full",
|
|
51
|
+
style: { "min-width": "8.2%", "background": "linear-gradient(\n 90deg,\n hsla(0, 0%, 100%, 0),\n hsla(0, 0%, 100%, 0) 12%,\n hsla(0, 0%, 100%, 0.25) 29.25%,\n hsla(0, 0%, 100%, 0) 50.5%,\n hsla(0, 0%, 100%, 0) 75.25%,\n hsla(0, 0%, 100%, 0.25) 91%,\n hsla(0, 0%, 100%, 0)\n ),\n linear-gradient(\n 90deg,\n rgba(0, 0, 0, 0.03),\n rgba(0, 0, 0, 0.1) 12%,\n transparent 30%,\n rgba(0, 0, 0, 0.02) 50%,\n rgba(0, 0, 0, 0.2) 73.5%,\n rgba(0, 0, 0, 0.5) 75.25%,\n rgba(0, 0, 0, 0.15) 85.25%,\n transparent\n )", "opacity": "0.2" }
|
|
52
|
+
}, null, -1)),
|
|
53
|
+
createElementVNode("div", _hoisted_1, [
|
|
54
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
55
|
+
])
|
|
56
|
+
], 2),
|
|
57
|
+
createElementVNode("div", {
|
|
58
|
+
class: "absolute left-0 bg-white",
|
|
59
|
+
style: normalizeStyle({
|
|
60
|
+
top: "3px",
|
|
61
|
+
bottom: "3px",
|
|
62
|
+
width: "48px",
|
|
63
|
+
transform: `translateX(${unref(BOOK_SIZE_MAP)[__props.size].spineTranslation}) rotateY(90deg)`,
|
|
64
|
+
background: "linear-gradient(90deg, rgba(255,255,255,1) 50%, rgba(249,249,249,1) 50%)"
|
|
65
|
+
})
|
|
66
|
+
}, null, 4),
|
|
67
|
+
createElementVNode("div", {
|
|
68
|
+
class: normalizeClass(
|
|
69
|
+
unref(cn)(
|
|
70
|
+
"absolute inset-y-0 left-0 flex size-full flex-col justify-end overflow-hidden bg-gradient-to-tr p-6 text-white",
|
|
71
|
+
computedGradient.value.from,
|
|
72
|
+
computedGradient.value.to,
|
|
73
|
+
unref(BOOK_RADIUS_MAP)[__props.radius]
|
|
74
|
+
)
|
|
75
|
+
),
|
|
76
|
+
style: normalizeStyle({ transform: "translateZ(-25px)", boxShadow: unref(BOOK_SHADOW_SIZE_MAP)[__props.shadowSize] })
|
|
77
|
+
}, null, 6)
|
|
78
|
+
], 6)
|
|
79
|
+
], 16);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
2
83
|
export {
|
|
3
84
|
_sfc_main as default
|
|
4
85
|
};
|
|
@@ -1,49 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
...{ name: "BoxReveal", inheritAttrs: false },
|
|
6
|
-
__name: "BoxReveal",
|
|
7
|
-
props: {
|
|
8
|
-
color: { default: "#5046e6" },
|
|
9
|
-
duration: { default: 0.5 },
|
|
10
|
-
delay: { default: 0.25 },
|
|
11
|
-
class: { type: [Boolean, null, String, Object, Array] }
|
|
12
|
-
},
|
|
13
|
-
setup(__props) {
|
|
14
|
-
const attrs = useAttrs();
|
|
15
|
-
const containerRef = useTemplateRef("containerRef");
|
|
16
|
-
const isInView = useInView(containerRef, () => ({ threshold: 0.1, once: true }));
|
|
17
|
-
const contentStyle = computed(() => ({
|
|
18
|
-
opacity: isInView.value ? "1" : "0",
|
|
19
|
-
transform: `translateY(${isInView.value ? 0 : 25}px)`,
|
|
20
|
-
transition: `opacity ${__props.duration}s ease ${__props.delay * 2}s,transform ${__props.duration}s ease ${__props.delay * 2}s`
|
|
21
|
-
}));
|
|
22
|
-
const overlayStyle = computed(() => ({
|
|
23
|
-
background: `${__props.color}`,
|
|
24
|
-
left: isInView.value ? "100%" : "0%",
|
|
25
|
-
transition: `left ${__props.duration}s ease-in ${__props.delay}s`
|
|
26
|
-
}));
|
|
27
|
-
return (_ctx, _cache) => {
|
|
28
|
-
return openBlock(), createElementBlock("div", mergeProps(unref(attrs), {
|
|
29
|
-
ref_key: "containerRef",
|
|
30
|
-
ref: containerRef,
|
|
31
|
-
class: unref(cn)("box-reveal relative overflow-hidden", __props.class)
|
|
32
|
-
}), [
|
|
33
|
-
createElementVNode("div", {
|
|
34
|
-
class: "box-reveal-content",
|
|
35
|
-
style: normalizeStyle(contentStyle.value)
|
|
36
|
-
}, [
|
|
37
|
-
renderSlot(_ctx.$slots, "default")
|
|
38
|
-
], 4),
|
|
39
|
-
createElementVNode("div", {
|
|
40
|
-
class: "box-reveal-overlay absolute inset-0 z-20",
|
|
41
|
-
style: normalizeStyle(overlayStyle.value)
|
|
42
|
-
}, null, 4)
|
|
43
|
-
], 16);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
});
|
|
1
|
+
import _sfc_main from "./BoxReveal.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const BoxReveal = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e343dd7c"]]);
|
|
47
5
|
export {
|
|
48
|
-
|
|
6
|
+
BoxReveal as default
|
|
49
7
|
};
|