@stianlarsen/react-light-beam 3.1.0 → 3.1.2
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/LICENSE +0 -0
- package/README.md +76 -451
- package/dist/index.cjs +168 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +2 -123
- package/dist/index.js +100 -412
- package/dist/index.js.map +1 -1
- package/package.json +33 -31
- package/dist/index.d.mts +0 -138
- package/dist/index.mjs +0 -450
- package/dist/index.mjs.map +0 -1
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.tsx
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
LightBeam: () => LightBeam
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
var import_framer_motion = require("framer-motion");
|
|
28
|
+
var import_react2 = require("react");
|
|
29
|
+
|
|
30
|
+
// #style-inject:#style-inject
|
|
31
|
+
function styleInject(css, { insertAt } = {}) {
|
|
32
|
+
if (!css || typeof document === "undefined") return;
|
|
33
|
+
const head = document.head || document.getElementsByTagName("head")[0];
|
|
34
|
+
const style = document.createElement("style");
|
|
35
|
+
style.type = "text/css";
|
|
36
|
+
if (insertAt === "top") {
|
|
37
|
+
if (head.firstChild) {
|
|
38
|
+
head.insertBefore(style, head.firstChild);
|
|
39
|
+
} else {
|
|
40
|
+
head.appendChild(style);
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
head.appendChild(style);
|
|
44
|
+
}
|
|
45
|
+
if (style.styleSheet) {
|
|
46
|
+
style.styleSheet.cssText = css;
|
|
47
|
+
} else {
|
|
48
|
+
style.appendChild(document.createTextNode(css));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/css/lightBeam.css
|
|
53
|
+
styleInject(".react__light__beam {\n height: 500px;\n width: 100vw;\n transition: all 0.25s ease;\n will-change: all;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n pointer-events: none;\n -webkit-transition: all 0.25s ease;\n}\n");
|
|
54
|
+
|
|
55
|
+
// src/hooks/useDarkmode.tsx
|
|
56
|
+
var import_react = require("react");
|
|
57
|
+
var useIsDarkmode = () => {
|
|
58
|
+
const [isDarkmode, setIsDarkmodeActive] = (0, import_react.useState)(false);
|
|
59
|
+
(0, import_react.useEffect)(() => {
|
|
60
|
+
const matchMedia = window.matchMedia("(prefers-color-scheme: dark)");
|
|
61
|
+
const handleChange = () => {
|
|
62
|
+
setIsDarkmodeActive(matchMedia.matches);
|
|
63
|
+
};
|
|
64
|
+
setIsDarkmodeActive(matchMedia.matches);
|
|
65
|
+
matchMedia.addEventListener("change", handleChange);
|
|
66
|
+
return () => {
|
|
67
|
+
matchMedia.removeEventListener("change", handleChange);
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
return { isDarkmode };
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// src/index.tsx
|
|
74
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
75
|
+
var LightBeam = ({
|
|
76
|
+
className,
|
|
77
|
+
colorLightmode = "rgba(0,0,0, 0.5)",
|
|
78
|
+
colorDarkmode = "rgba(255, 255, 255, 0.5)",
|
|
79
|
+
maskLightByProgress = false,
|
|
80
|
+
fullWidth = 1,
|
|
81
|
+
// Default to full width
|
|
82
|
+
invert = false,
|
|
83
|
+
id = void 0,
|
|
84
|
+
onLoaded = void 0,
|
|
85
|
+
scrollElement
|
|
86
|
+
// Add this line
|
|
87
|
+
}) => {
|
|
88
|
+
const elementRef = (0, import_react2.useRef)(null);
|
|
89
|
+
const inViewProgress = (0, import_framer_motion.useMotionValue)(0);
|
|
90
|
+
const opacity = (0, import_framer_motion.useMotionValue)(0.839322);
|
|
91
|
+
const { isDarkmode } = useIsDarkmode();
|
|
92
|
+
const chosenColor = isDarkmode ? colorDarkmode : colorLightmode;
|
|
93
|
+
(0, import_react2.useEffect)(() => {
|
|
94
|
+
onLoaded && onLoaded();
|
|
95
|
+
}, []);
|
|
96
|
+
(0, import_react2.useEffect)(() => {
|
|
97
|
+
if (typeof window !== "undefined") {
|
|
98
|
+
const handleScroll = () => {
|
|
99
|
+
if (elementRef.current) {
|
|
100
|
+
const rect = elementRef.current.getBoundingClientRect();
|
|
101
|
+
const windowHeight = window.innerHeight;
|
|
102
|
+
const adjustedFullWidth = 1 - fullWidth;
|
|
103
|
+
const progress = invert ? 0 + Math.max(adjustedFullWidth, Math.min(1, rect.top / windowHeight)) : 1 - Math.max(adjustedFullWidth, Math.min(1, rect.top / windowHeight));
|
|
104
|
+
inViewProgress.set(progress);
|
|
105
|
+
opacity.set(0.839322 + (1 - 0.839322) * progress);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const handleScrollThrottled = throttle(handleScroll);
|
|
109
|
+
const target = scrollElement || window;
|
|
110
|
+
target.addEventListener("scroll", handleScrollThrottled);
|
|
111
|
+
window.addEventListener("resize", handleScrollThrottled);
|
|
112
|
+
handleScroll();
|
|
113
|
+
return () => {
|
|
114
|
+
target.removeEventListener("scroll", handleScrollThrottled);
|
|
115
|
+
window.removeEventListener("resize", handleScrollThrottled);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}, [inViewProgress, opacity, scrollElement]);
|
|
119
|
+
const backgroundPosition = (0, import_framer_motion.useTransform)(
|
|
120
|
+
inViewProgress,
|
|
121
|
+
[0, 1],
|
|
122
|
+
[
|
|
123
|
+
`conic-gradient(from 90deg at 90% 0%, ${chosenColor}, transparent 180deg) 0% 0% / 50% 150% no-repeat, conic-gradient(from 270deg at 10% 0%, transparent 180deg, ${chosenColor}) 100% 0% / 50% 100% no-repeat`,
|
|
124
|
+
`conic-gradient(from 90deg at 0% 0%, ${chosenColor}, transparent 180deg) 0% 0% / 50% 100% no-repeat, conic-gradient(from 270deg at 100% 0%, transparent 180deg, ${chosenColor}) 100% 0% / 50% 100% no-repeat`
|
|
125
|
+
]
|
|
126
|
+
);
|
|
127
|
+
const maskImageOpacity = (0, import_framer_motion.useTransform)(
|
|
128
|
+
inViewProgress,
|
|
129
|
+
[0, 1],
|
|
130
|
+
[
|
|
131
|
+
`linear-gradient(to bottom, ${chosenColor} 0%, transparent 50%)`,
|
|
132
|
+
`linear-gradient(to bottom, ${chosenColor} 0%, transparent 95%)`
|
|
133
|
+
]
|
|
134
|
+
);
|
|
135
|
+
const maskImage = maskLightByProgress ? maskImageOpacity : `linear-gradient(to bottom, ${chosenColor} 25%, transparent 95%)`;
|
|
136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
137
|
+
import_framer_motion.motion.div,
|
|
138
|
+
{
|
|
139
|
+
style: {
|
|
140
|
+
background: backgroundPosition,
|
|
141
|
+
opacity,
|
|
142
|
+
maskImage,
|
|
143
|
+
WebkitMaskImage: maskImage,
|
|
144
|
+
willChange: "background, opacity"
|
|
145
|
+
},
|
|
146
|
+
ref: elementRef,
|
|
147
|
+
id,
|
|
148
|
+
className: `lightBeam ${className} react__light__beam`
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
var throttle = (func) => {
|
|
153
|
+
let ticking = false;
|
|
154
|
+
return function(...args) {
|
|
155
|
+
if (!ticking) {
|
|
156
|
+
requestAnimationFrame(() => {
|
|
157
|
+
func.apply(this, args);
|
|
158
|
+
ticking = false;
|
|
159
|
+
});
|
|
160
|
+
ticking = true;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
165
|
+
0 && (module.exports = {
|
|
166
|
+
LightBeam
|
|
167
|
+
});
|
|
168
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx","#style-inject:#style-inject","../src/css/lightBeam.css","../src/hooks/useDarkmode.tsx"],"sourcesContent":["\"use client\";\nimport { motion, useMotionValue, useTransform } from \"framer-motion\";\nimport React, { useEffect, useRef } from \"react\";\nimport { LightBeamProps } from \"../types/types\";\nexport type { LightBeamProps } from \"../types/types\";\nimport \"./css/lightBeam.css\";\nimport { useIsDarkmode } from \"./hooks/useDarkmode\";\n\nexport const LightBeam = ({\n className,\n colorLightmode = \"rgba(0,0,0, 0.5)\",\n colorDarkmode = \"rgba(255, 255, 255, 0.5)\",\n maskLightByProgress = false,\n fullWidth = 1.0, // Default to full width\n invert = false,\n id = undefined,\n onLoaded = undefined,\n scrollElement, // Add this line\n}: LightBeamProps) => {\n const elementRef = useRef<HTMLDivElement>(null);\n const inViewProgress = useMotionValue(0);\n const opacity = useMotionValue(0.839322);\n const { isDarkmode } = useIsDarkmode();\n const chosenColor = isDarkmode ? colorDarkmode : colorLightmode;\n\n useEffect(() => {\n onLoaded && onLoaded();\n }, []);\n\n useEffect(() => {\n if (typeof window !== \"undefined\") {\n const handleScroll = () => {\n if (elementRef.current) {\n const rect = elementRef.current.getBoundingClientRect();\n const windowHeight = window.innerHeight;\n\n // Invert the fullWidth value: 1 becomes 0, and 0 becomes 1\n const adjustedFullWidth = 1 - fullWidth;\n\n // Calculate progress\n const progress = invert\n ? 0 +\n Math.max(adjustedFullWidth, Math.min(1, rect.top / windowHeight))\n : 1 -\n Math.max(adjustedFullWidth, Math.min(1, rect.top / windowHeight));\n\n // Update motion values\n inViewProgress.set(progress);\n opacity.set(0.839322 + (1 - 0.839322) * progress);\n }\n };\n\n const handleScrollThrottled = throttle(handleScroll); // Approx 60fps\n\n const target = scrollElement || window;\n\n target.addEventListener(\"scroll\", handleScrollThrottled);\n window.addEventListener(\"resize\", handleScrollThrottled);\n\n // Initial call to handleScroll to set initial state\n handleScroll();\n\n return () => {\n target.removeEventListener(\"scroll\", handleScrollThrottled);\n window.removeEventListener(\"resize\", handleScrollThrottled);\n };\n }\n }, [inViewProgress, opacity, scrollElement]);\n\n const backgroundPosition = useTransform(\n inViewProgress,\n [0, 1],\n [\n `conic-gradient(from 90deg at 90% 0%, ${chosenColor}, transparent 180deg) 0% 0% / 50% 150% no-repeat, conic-gradient(from 270deg at 10% 0%, transparent 180deg, ${chosenColor}) 100% 0% / 50% 100% no-repeat`,\n `conic-gradient(from 90deg at 0% 0%, ${chosenColor}, transparent 180deg) 0% 0% / 50% 100% no-repeat, conic-gradient(from 270deg at 100% 0%, transparent 180deg, ${chosenColor}) 100% 0% / 50% 100% no-repeat`,\n ]\n );\n const maskImageOpacity = useTransform(\n inViewProgress,\n [0, 1],\n [\n `linear-gradient(to bottom, ${chosenColor} 0%, transparent 50%)`,\n `linear-gradient(to bottom, ${chosenColor} 0%, transparent 95%)`,\n ]\n );\n\n const maskImage = maskLightByProgress\n ? maskImageOpacity\n : `linear-gradient(to bottom, ${chosenColor} 25%, transparent 95%)`;\n\n return (\n <motion.div\n style={{\n background: backgroundPosition,\n opacity: opacity,\n maskImage: maskImage,\n WebkitMaskImage: maskImage,\n willChange: \"background, opacity\",\n }}\n ref={elementRef}\n id={id}\n className={`lightBeam ${className} react__light__beam`}\n />\n );\n};\n\nconst throttle = (func: Function) => {\n let ticking = false;\n return function (this: any, ...args: any[]) {\n if (!ticking) {\n requestAnimationFrame(() => {\n func.apply(this, args);\n ticking = false;\n });\n ticking = true;\n }\n };\n};\n","\n export default function styleInject(css, { insertAt } = {}) {\n if (!css || typeof document === 'undefined') return\n \n const head = document.head || document.getElementsByTagName('head')[0]\n const style = document.createElement('style')\n style.type = 'text/css'\n \n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild)\n } else {\n head.appendChild(style)\n }\n } else {\n head.appendChild(style)\n }\n \n if (style.styleSheet) {\n style.styleSheet.cssText = css\n } else {\n style.appendChild(document.createTextNode(css))\n }\n }\n ","import styleInject from '#style-inject';styleInject(\".react__light__beam {\\n height: 500px;\\n width: 100vw;\\n transition: all 0.25s ease;\\n will-change: all;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n user-select: none;\\n pointer-events: none;\\n -webkit-transition: all 0.25s ease;\\n}\\n\")","\"use client\";\nimport { useEffect, useState } from \"react\";\n\nexport const useIsDarkmode = () => {\n const [isDarkmode, setIsDarkmodeActive] = useState(false);\n\n useEffect(() => {\n const matchMedia = window.matchMedia(\"(prefers-color-scheme: dark)\");\n\n const handleChange = () => {\n setIsDarkmodeActive(matchMedia.matches);\n };\n\n // Set the initial value\n setIsDarkmodeActive(matchMedia.matches);\n\n // Listen for changes\n matchMedia.addEventListener(\"change\", handleChange);\n\n // Cleanup listener on unmount\n return () => {\n matchMedia.removeEventListener(\"change\", handleChange);\n };\n }, []);\n\n return { isDarkmode };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,2BAAqD;AACrD,IAAAA,gBAAyC;;;ACDhB,SAAR,YAA6B,KAAK,EAAE,SAAS,IAAI,CAAC,GAAG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sBACd,mBACA,8BAA8B,WAAW;AAE7C,SACE;AAAA,IAAC,4BAAO;AAAA,IAAP;AAAA,MACC,OAAO;AAAA,QACL,YAAY;AAAA,QACZ;AAAA,QACA;AAAA,QACA,iBAAiB;AAAA,QACjB,YAAY;AAAA,MACd;AAAA,MACA,KAAK;AAAA,MACL;AAAA,MACA,WAAW,aAAa,SAAS;AAAA;AAAA,EACnC;AAEJ;AAEA,IAAM,WAAW,CAAC,SAAmB;AACnC,MAAI,UAAU;AACd,SAAO,YAAwB,MAAa;AAC1C,QAAI,CAAC,SAAS;AACZ,4BAAsB,MAAM;AAC1B,aAAK,MAAM,MAAM,IAAI;AACrB,kBAAU;AAAA,MACZ,CAAC;AACD,gBAAU;AAAA,IACZ;AAAA,EACF;AACF;","names":["import_react"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type LightBeamProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
fullWidth?: number;
|
|
6
|
+
colorLightmode?: string;
|
|
7
|
+
colorDarkmode?: string;
|
|
8
|
+
maskLightByProgress?: boolean;
|
|
9
|
+
invert?: boolean;
|
|
10
|
+
id?: string;
|
|
11
|
+
scrollElement?: EventTarget;
|
|
12
|
+
onLoaded?: () => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
declare const LightBeam: ({ className, colorLightmode, colorDarkmode, maskLightByProgress, fullWidth, invert, id, onLoaded, scrollElement, }: LightBeamProps) => react_jsx_runtime.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { LightBeam, type LightBeamProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,91 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
type DustParticlesConfig = {
|
|
4
|
-
/**
|
|
5
|
-
* Enable floating dust particles in the beam
|
|
6
|
-
* @default false
|
|
7
|
-
*/
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Number of dust particles
|
|
11
|
-
* @default 30
|
|
12
|
-
*/
|
|
13
|
-
count?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Animation speed multiplier (1 = normal, 2 = twice as fast)
|
|
16
|
-
* @default 1
|
|
17
|
-
*/
|
|
18
|
-
speed?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Particle size range [min, max] in pixels
|
|
21
|
-
* @default [1, 3]
|
|
22
|
-
*/
|
|
23
|
-
sizeRange?: [number, number];
|
|
24
|
-
/**
|
|
25
|
-
* Particle opacity range [min, max]
|
|
26
|
-
* @default [0.2, 0.6]
|
|
27
|
-
*/
|
|
28
|
-
opacityRange?: [number, number];
|
|
29
|
-
/**
|
|
30
|
-
* Particle color (inherits beam color if not specified)
|
|
31
|
-
*/
|
|
32
|
-
color?: string;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
type MistConfig = {
|
|
36
|
-
/**
|
|
37
|
-
* Enable mist/fog effect
|
|
38
|
-
* @default false
|
|
39
|
-
*/
|
|
40
|
-
enabled?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Mist intensity (0-1)
|
|
43
|
-
* @default 0.3
|
|
44
|
-
*/
|
|
45
|
-
intensity?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Animation speed multiplier
|
|
48
|
-
* @default 1
|
|
49
|
-
*/
|
|
50
|
-
speed?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Number of layered mist effects for depth
|
|
53
|
-
* @default 2
|
|
54
|
-
*/
|
|
55
|
-
layers?: number;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
type PulseConfig = {
|
|
59
|
-
/**
|
|
60
|
-
* Enable rhythmic pulse effect
|
|
61
|
-
* @default false
|
|
62
|
-
*/
|
|
63
|
-
enabled?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Pulse duration in seconds
|
|
66
|
-
* @default 2
|
|
67
|
-
*/
|
|
68
|
-
duration?: number;
|
|
69
|
-
/**
|
|
70
|
-
* Pulse intensity (0-1) - how much brightness varies
|
|
71
|
-
* @default 0.2
|
|
72
|
-
*/
|
|
73
|
-
intensity?: number;
|
|
74
|
-
/**
|
|
75
|
-
* GSAP easing function
|
|
76
|
-
* @default "sine.inOut"
|
|
77
|
-
*/
|
|
78
|
-
easing?: string;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
3
|
type LightBeamProps = {
|
|
82
4
|
className?: string;
|
|
83
|
-
/**
|
|
84
|
-
* Custom styles to merge with or override default styles.
|
|
85
|
-
* User styles take priority over defaults.
|
|
86
|
-
* @example style={{ height: '800px', width: '80vw' }}
|
|
87
|
-
*/
|
|
88
|
-
style?: React.CSSProperties;
|
|
89
5
|
fullWidth?: number;
|
|
90
6
|
colorLightmode?: string;
|
|
91
7
|
colorDarkmode?: string;
|
|
@@ -94,45 +10,8 @@ type LightBeamProps = {
|
|
|
94
10
|
id?: string;
|
|
95
11
|
scrollElement?: EventTarget;
|
|
96
12
|
onLoaded?: () => void;
|
|
97
|
-
/**
|
|
98
|
-
* Disable default inline styles. Set to true if you want to provide custom CSS via className only.
|
|
99
|
-
* @default false
|
|
100
|
-
*/
|
|
101
|
-
disableDefaultStyles?: boolean;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* GSAP ScrollTrigger start position
|
|
105
|
-
* @default "top bottom"
|
|
106
|
-
* @example "top center", "center bottom", "top 80%"
|
|
107
|
-
*/
|
|
108
|
-
scrollStart?: string;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* GSAP ScrollTrigger end position
|
|
112
|
-
* @default "top top"
|
|
113
|
-
* @example "top 20%", "center center", "bottom top"
|
|
114
|
-
*/
|
|
115
|
-
scrollEnd?: string;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Dust particles configuration
|
|
119
|
-
* @example dustParticles={{ enabled: true, count: 50, speed: 1.5 }}
|
|
120
|
-
*/
|
|
121
|
-
dustParticles?: DustParticlesConfig;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Mist/fog effect configuration
|
|
125
|
-
* @example mist={{ enabled: true, intensity: 0.5, layers: 3 }}
|
|
126
|
-
*/
|
|
127
|
-
mist?: MistConfig;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Pulse effect configuration
|
|
131
|
-
* @example pulse={{ enabled: true, duration: 3, intensity: 0.3 }}
|
|
132
|
-
*/
|
|
133
|
-
pulse?: PulseConfig;
|
|
134
13
|
};
|
|
135
14
|
|
|
136
|
-
declare const LightBeam: ({ className,
|
|
15
|
+
declare const LightBeam: ({ className, colorLightmode, colorDarkmode, maskLightByProgress, fullWidth, invert, id, onLoaded, scrollElement, }: LightBeamProps) => react_jsx_runtime.JSX.Element;
|
|
137
16
|
|
|
138
|
-
export { LightBeam };
|
|
17
|
+
export { LightBeam, type LightBeamProps };
|