@once-ui-system/core 1.6.3 → 1.7.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/LICENSE.md +21 -0
- package/dist/components/Avatar.d.ts +1 -0
- package/dist/components/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar.js +2 -2
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/BlobFx.d.ts +8 -0
- package/dist/components/BlobFx.d.ts.map +1 -0
- package/dist/components/BlobFx.js +82 -0
- package/dist/components/BlobFx.js.map +1 -0
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +2 -2
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Button.module.scss +62 -32
- package/dist/components/CelebrationFx.d.ts +1 -0
- package/dist/components/CelebrationFx.d.ts.map +1 -1
- package/dist/components/CelebrationFx.js +7 -3
- package/dist/components/CelebrationFx.js.map +1 -1
- package/dist/components/ContextMenu.d.ts +1 -0
- package/dist/components/ContextMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu.js +8 -4
- package/dist/components/ContextMenu.js.map +1 -1
- package/dist/components/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog.js +99 -91
- package/dist/components/Dialog.js.map +1 -1
- package/dist/components/Dropdown.d.ts +1 -0
- package/dist/components/Dropdown.d.ts.map +1 -1
- package/dist/components/Dropdown.js +4 -2
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/FadingLettersFx.d.ts +15 -0
- package/dist/components/FadingLettersFx.d.ts.map +1 -0
- package/dist/components/FadingLettersFx.js +27 -0
- package/dist/components/FadingLettersFx.js.map +1 -0
- package/dist/components/FadingLettersFx.module.scss +71 -0
- package/dist/components/HoloFx.d.ts +1 -0
- package/dist/components/HoloFx.d.ts.map +1 -1
- package/dist/components/HoloFx.js +10 -3
- package/dist/components/HoloFx.js.map +1 -1
- package/dist/components/IconButton.d.ts +5 -2
- package/dist/components/IconButton.d.ts.map +1 -1
- package/dist/components/IconButton.js +6 -4
- package/dist/components/IconButton.js.map +1 -1
- package/dist/components/IconButton.module.scss +14 -0
- package/dist/components/Input.d.ts +3 -1
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +18 -5
- package/dist/components/Input.js.map +1 -1
- package/dist/components/Input.module.scss +38 -3
- package/dist/components/Mask.d.ts +1 -0
- package/dist/components/Mask.d.ts.map +1 -1
- package/dist/components/Mask.js +56 -32
- package/dist/components/Mask.js.map +1 -1
- package/dist/components/MatrixFx.d.ts +1 -0
- package/dist/components/MatrixFx.d.ts.map +1 -1
- package/dist/components/MatrixFx.js +8 -1
- package/dist/components/MatrixFx.js.map +1 -1
- package/dist/components/Media.d.ts +5 -1
- package/dist/components/Media.d.ts.map +1 -1
- package/dist/components/Media.js +20 -7
- package/dist/components/Media.js.map +1 -1
- package/dist/components/Modal.d.ts +11 -0
- package/dist/components/Modal.d.ts.map +1 -0
- package/dist/components/Modal.js +72 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/NumberInput.d.ts.map +1 -1
- package/dist/components/NumberInput.js +1 -1
- package/dist/components/NumberInput.js.map +1 -1
- package/dist/components/Particle.d.ts +1 -0
- package/dist/components/Particle.d.ts.map +1 -1
- package/dist/components/Particle.js +86 -78
- package/dist/components/Particle.js.map +1 -1
- package/dist/components/ScrollContainer.d.ts +9 -0
- package/dist/components/ScrollContainer.d.ts.map +1 -0
- package/dist/components/ScrollContainer.js +67 -0
- package/dist/components/ScrollContainer.js.map +1 -0
- package/dist/components/ScrollLock.d.ts.map +1 -1
- package/dist/components/ScrollLock.js +4 -91
- package/dist/components/ScrollLock.js.map +1 -1
- package/dist/components/ServerFlex.d.ts.map +1 -1
- package/dist/components/ServerFlex.js +3 -3
- package/dist/components/ServerFlex.js.map +1 -1
- package/dist/components/ServerGrid.d.ts.map +1 -1
- package/dist/components/ServerGrid.js +2 -2
- package/dist/components/ServerGrid.js.map +1 -1
- package/dist/components/ShineFx.d.ts +1 -0
- package/dist/components/ShineFx.d.ts.map +1 -1
- package/dist/components/ShineFx.js +5 -2
- package/dist/components/ShineFx.js.map +1 -1
- package/dist/components/SplitView.d.ts +16 -0
- package/dist/components/SplitView.d.ts.map +1 -0
- package/dist/components/SplitView.js +80 -0
- package/dist/components/SplitView.js.map +1 -0
- package/dist/components/SplitView.module.scss +18 -0
- package/dist/components/StylePanel.d.ts.map +1 -1
- package/dist/components/StylePanel.js +10 -10
- package/dist/components/StylePanel.js.map +1 -1
- package/dist/components/Textarea.d.ts +2 -0
- package/dist/components/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea.js +22 -12
- package/dist/components/Textarea.js.map +1 -1
- package/dist/components/ThemeInit.d.ts.map +1 -1
- package/dist/components/ThemeInit.js +39 -40
- package/dist/components/ThemeInit.js.map +1 -1
- package/dist/components/TiltFx.d.ts +1 -0
- package/dist/components/TiltFx.d.ts.map +1 -1
- package/dist/components/TiltFx.js +27 -10
- package/dist/components/TiltFx.js.map +1 -1
- package/dist/components/Timeline.d.ts +1 -1
- package/dist/components/Timeline.d.ts.map +1 -1
- package/dist/components/Timeline.js +50 -6
- package/dist/components/Timeline.js.map +1 -1
- package/dist/components/ToggleButton.d.ts +2 -1
- package/dist/components/ToggleButton.d.ts.map +1 -1
- package/dist/components/ToggleButton.js +3 -3
- package/dist/components/ToggleButton.js.map +1 -1
- package/dist/components/ToggleButton.module.scss +27 -8
- package/dist/components/TypeFx.d.ts.map +1 -1
- package/dist/components/TypeFx.js +66 -87
- package/dist/components/TypeFx.js.map +1 -1
- package/dist/components/WeatherFx.d.ts +1 -0
- package/dist/components/WeatherFx.d.ts.map +1 -1
- package/dist/components/WeatherFx.js +97 -2
- package/dist/components/WeatherFx.js.map +1 -1
- package/dist/components/index.d.ts +9 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +9 -1
- package/dist/components/index.js.map +1 -1
- package/dist/css/styles.css +1 -1
- package/dist/css/styles.css.map +1 -1
- package/dist/css/tokens.css +1 -1
- package/dist/css/tokens.css.map +1 -1
- package/dist/data/emoji-data.json +0 -8
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useInViewport.d.ts +3 -0
- package/dist/hooks/useInViewport.d.ts.map +1 -0
- package/dist/hooks/useInViewport.js +19 -0
- package/dist/hooks/useInViewport.js.map +1 -0
- package/dist/hooks/useReducedMotion.d.ts +8 -0
- package/dist/hooks/useReducedMotion.d.ts.map +1 -0
- package/dist/hooks/useReducedMotion.js +44 -0
- package/dist/hooks/useReducedMotion.js.map +1 -0
- package/dist/interfaces.d.ts +1 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/internal/dialogState.d.ts +17 -0
- package/dist/internal/dialogState.d.ts.map +1 -0
- package/dist/internal/dialogState.js +101 -0
- package/dist/internal/dialogState.js.map +1 -0
- package/dist/internal/scrollLockState.d.ts +15 -0
- package/dist/internal/scrollLockState.d.ts.map +1 -0
- package/dist/internal/scrollLockState.js +172 -0
- package/dist/internal/scrollLockState.js.map +1 -0
- package/dist/modules/code/CodeBlock.d.ts +3 -31
- package/dist/modules/code/CodeBlock.d.ts.map +1 -1
- package/dist/modules/code/CodeBlock.impl.d.ts +34 -0
- package/dist/modules/code/CodeBlock.impl.d.ts.map +1 -0
- package/dist/modules/code/CodeBlock.impl.js +487 -0
- package/dist/modules/code/CodeBlock.impl.js.map +1 -0
- package/dist/modules/code/CodeBlock.js +10 -483
- package/dist/modules/code/CodeBlock.js.map +1 -1
- package/dist/modules/data/BarChart.d.ts +1 -8
- package/dist/modules/data/BarChart.d.ts.map +1 -1
- package/dist/modules/data/BarChart.impl.d.ts +12 -0
- package/dist/modules/data/BarChart.impl.d.ts.map +1 -0
- package/dist/modules/data/BarChart.impl.js +137 -0
- package/dist/modules/data/BarChart.impl.js.map +1 -0
- package/dist/modules/data/BarChart.js +9 -132
- package/dist/modules/data/BarChart.js.map +1 -1
- package/dist/modules/data/DataTooltip.d.ts +2 -2
- package/dist/modules/data/DataTooltip.d.ts.map +1 -1
- package/dist/modules/data/Legend.d.ts +1 -1
- package/dist/modules/data/Legend.d.ts.map +1 -1
- package/dist/modules/data/LineBarChart.d.ts +1 -8
- package/dist/modules/data/LineBarChart.d.ts.map +1 -1
- package/dist/modules/data/LineBarChart.impl.d.ts +12 -0
- package/dist/modules/data/LineBarChart.impl.d.ts.map +1 -0
- package/dist/modules/data/LineBarChart.impl.js +142 -0
- package/dist/modules/data/LineBarChart.impl.js.map +1 -0
- package/dist/modules/data/LineBarChart.js +9 -137
- package/dist/modules/data/LineBarChart.js.map +1 -1
- package/dist/modules/data/LineChart.d.ts +1 -13
- package/dist/modules/data/LineChart.d.ts.map +1 -1
- package/dist/modules/data/LineChart.impl.d.ts +17 -0
- package/dist/modules/data/LineChart.impl.d.ts.map +1 -0
- package/dist/modules/data/LineChart.impl.js +148 -0
- package/dist/modules/data/LineChart.impl.js.map +1 -0
- package/dist/modules/data/LineChart.js +9 -143
- package/dist/modules/data/LineChart.js.map +1 -1
- package/dist/modules/data/PieChart.d.ts +4 -16
- package/dist/modules/data/PieChart.d.ts.map +1 -1
- package/dist/modules/data/PieChart.impl.d.ts +18 -0
- package/dist/modules/data/PieChart.impl.d.ts.map +1 -0
- package/dist/modules/data/PieChart.impl.js +102 -0
- package/dist/modules/data/PieChart.impl.js.map +1 -0
- package/dist/modules/data/PieChart.js +11 -97
- package/dist/modules/data/PieChart.js.map +1 -1
- package/dist/modules/media/MediaUpload.d.ts +2 -20
- package/dist/modules/media/MediaUpload.d.ts.map +1 -1
- package/dist/modules/media/MediaUpload.impl.d.ts +24 -0
- package/dist/modules/media/MediaUpload.impl.d.ts.map +1 -0
- package/dist/modules/media/MediaUpload.impl.js +92 -0
- package/dist/modules/media/MediaUpload.impl.js.map +1 -0
- package/dist/modules/media/MediaUpload.js +10 -88
- package/dist/modules/media/MediaUpload.js.map +1 -1
- package/dist/modules/navigation/Kbar.d.ts.map +1 -1
- package/dist/modules/navigation/Kbar.js +13 -28
- package/dist/modules/navigation/Kbar.js.map +1 -1
- package/dist/package.json +17 -6
- package/dist/styles/size.scss +20 -0
- package/dist/styles/typography.scss +8 -40
- package/dist/test/dialogTestUtils.d.ts +2 -0
- package/dist/test/dialogTestUtils.d.ts.map +1 -0
- package/dist/test/dialogTestUtils.js +9 -0
- package/dist/test/dialogTestUtils.js.map +1 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +59 -0
- package/dist/test/setup.js.map +1 -0
- package/dist/tokens/layout.scss +5 -0
- package/dist/utils/MissingDependency.d.ts +7 -0
- package/dist/utils/MissingDependency.d.ts.map +1 -0
- package/dist/utils/MissingDependency.js +6 -0
- package/dist/utils/MissingDependency.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/next-env.d.ts +5 -0
- package/package.json +135 -115
- package/tsconfig.vitest.json +20 -0
- package/vitest.config.ts +19 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeline.js","sourceRoot":"","sources":["../../src/components/Timeline.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAiB7C,MAAM,QAAQ,GAA4B,CAAC,
|
|
1
|
+
{"version":3,"file":"Timeline.js","sourceRoot":"","sources":["../../src/components/Timeline.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAiB7C,MAAM,QAAQ,GAA4B,CAAC,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,EAAE,IAAI,GAAG,GAAG,EAAE,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OAAO,EAAC,iBAAiB,EACzB,YAAY,EAAE,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,YAE3D,IAAI,CAAC,KAAK,GACN,CACR,EACA,IAAI,CAAC,WAAW,IAAI,CACnB,KAAC,IAAI,IACH,OAAO,EAAC,gBAAgB,EACxB,YAAY,EAAE,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,YAEhE,IAAI,CAAC,WAAW,GACZ,CACR,EACA,IAAI,CAAC,QAAQ,IACb,GACI,KAxIJ,KAAK,CAyIL,CACR,CAAC;QACJ,CAAC,CAAC,GACK,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -4,8 +4,9 @@ interface CommonProps {
|
|
|
4
4
|
label?: ReactNode;
|
|
5
5
|
selected?: boolean;
|
|
6
6
|
variant?: "ghost" | "outline";
|
|
7
|
-
size?: "s" | "m" | "l";
|
|
7
|
+
size?: "xs" | "s" | "m" | "l" | "xl";
|
|
8
8
|
radius?: "none" | "top" | "right" | "bottom" | "left" | "top-left" | "top-right" | "bottom-right" | "bottom-left";
|
|
9
|
+
rounded?: boolean;
|
|
9
10
|
horizontal?: "start" | "center" | "end" | "between";
|
|
10
11
|
fillWidth?: boolean;
|
|
11
12
|
weight?: "default" | "strong";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleButton.d.ts","sourceRoot":"","sources":["../../src/components/ToggleButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAIrD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC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MAAM,YAAY,iIAqEjB,CAAC;AAGF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -4,8 +4,8 @@ import { forwardRef } from "react";
|
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import { Flex, Icon, ElementType } from ".";
|
|
6
6
|
import styles from "./ToggleButton.module.scss";
|
|
7
|
-
const ToggleButton = forwardRef(({ label, selected = false, variant = "ghost", size = "m", radius, horizontal = "center", fillWidth = false, weight = "default", truncate = false, prefixIcon, suffixIcon, className, style, children, href, ...props }, ref) => {
|
|
8
|
-
return (_jsxs(ElementType, { ref: ref, href: href, className: classNames(styles.button, styles[variant], styles[size], selected && styles.selected, radius === "none"
|
|
7
|
+
const ToggleButton = forwardRef(({ label, selected = false, variant = "ghost", size = "m", radius, rounded = false, horizontal = "center", fillWidth = false, weight = "default", truncate = false, prefixIcon, suffixIcon, className, style, children, href, ...props }, ref) => {
|
|
8
|
+
return (_jsxs(ElementType, { ref: ref, href: href, "data-border": rounded ? "rounded" : undefined, className: classNames(styles.button, styles[variant], styles[size], selected && styles.selected, radius === "none"
|
|
9
9
|
? "radius-none"
|
|
10
10
|
: radius
|
|
11
11
|
? `radius-${size}-${radius}`
|
|
@@ -13,7 +13,7 @@ const ToggleButton = forwardRef(({ label, selected = false, variant = "ghost", s
|
|
|
13
13
|
["fill-width"]: fillWidth,
|
|
14
14
|
["fit-width"]: !fillWidth,
|
|
15
15
|
["justify-" + horizontal]: horizontal,
|
|
16
|
-
}, className), style: style, ...props, children: [prefixIcon && _jsx(Icon, { name: prefixIcon, size: size === "l" ? "s" : "xs" }), (label || children) && (_jsx(Flex, { fillWidth: fillWidth, horizontal: horizontal, textWeight: weight, paddingX: size === "
|
|
16
|
+
}, className), style: style, ...props, children: [prefixIcon && _jsx(Icon, { name: prefixIcon, size: size === "xl" ? "m" : size === "l" ? "s" : "xs" }), (label || children) && (_jsx(Flex, { fillWidth: fillWidth, horizontal: horizontal, textWeight: weight, paddingX: size === "xl" ? "12" : size === "l" ? "8" : size === "s" ? "4" : "2", textSize: size === "xl" ? "l" : size === "l" ? "m" : "s", className: "font-label", position: "static", children: label || children })), suffixIcon && _jsx(Icon, { name: suffixIcon, size: size === "xl" ? "m" : size === "l" ? "s" : "xs" })] }));
|
|
17
17
|
});
|
|
18
18
|
ToggleButton.displayName = "ToggleButton";
|
|
19
19
|
export { ToggleButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleButton.js","sourceRoot":"","sources":["../../src/components/ToggleButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,UAAU,EAAa,MAAM,OAAO,CAAC;AACrD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC;AAC5C,OAAO,MAAM,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"ToggleButton.js","sourceRoot":"","sources":["../../src/components/ToggleButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,UAAU,EAAa,MAAM,OAAO,CAAC;AACrD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC;AAC5C,OAAO,MAAM,MAAM,4BAA4B,CAAC;AAiChD,MAAM,YAAY,GAAG,UAAU,CAC7B,CACE,EACE,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,OAAO,EACjB,IAAI,GAAG,GAAG,EACV,MAAM,EACN,OAAO,GAAG,KAAK,EACf,UAAU,GAAG,QAAQ,EACrB,SAAS,GAAG,KAAK,EACjB,MAAM,GAAG,SAAS,EAClB,QAAQ,GAAG,KAAK,EAChB,UAAU,EACV,UAAU,EACV,SAAS,EACT,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF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AK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EACxD,SAAS,EAAC,YAAY,EACtB,QAAQ,EAAC,QAAQ,YAEhB,KAAK,IAAI,QAAQ,GACb,CACR,EACA,UAAU,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAI,IACpF,CACf,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -7,14 +7,21 @@
|
|
|
7
7
|
background: var(--static-transparent);
|
|
8
8
|
color: var(--neutral-on-background-strong);
|
|
9
9
|
transition: var(--transition-micro-medium);
|
|
10
|
-
|
|
10
|
+
user-select: none;
|
|
11
11
|
white-space: nowrap;
|
|
12
|
-
|
|
13
|
-
&:
|
|
12
|
+
|
|
13
|
+
&:focus-visible {
|
|
14
14
|
background: var(--neutral-alpha-weak);
|
|
15
15
|
border-color: var(--neutral-alpha-weak);
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
@media (hover: hover) and (pointer: fine) {
|
|
19
|
+
&:hover {
|
|
20
|
+
background: var(--neutral-alpha-weak);
|
|
21
|
+
border-color: var(--neutral-alpha-weak);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
&.selected {
|
|
19
26
|
background-color: var(--neutral-alpha-medium);
|
|
20
27
|
border-color: var(--neutral-alpha-weak);
|
|
@@ -23,12 +30,18 @@
|
|
|
23
30
|
&:disabled {
|
|
24
31
|
background: var(--neutral-alpha-weak);
|
|
25
32
|
color: var(--neutral-on-background-medium);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
border: none;
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
cursor: not-allowed;
|
|
29
36
|
}
|
|
30
37
|
}
|
|
31
38
|
|
|
39
|
+
.xs {
|
|
40
|
+
height: var(--static-space-20);
|
|
41
|
+
min-height: var(--static-space-20);
|
|
42
|
+
padding: var(--static-space-2) var(--static-space-8);
|
|
43
|
+
}
|
|
44
|
+
|
|
32
45
|
.s {
|
|
33
46
|
height: var(--static-space-24);
|
|
34
47
|
min-height: var(--static-space-24);
|
|
@@ -40,13 +53,19 @@
|
|
|
40
53
|
min-height: var(--static-space-32);
|
|
41
54
|
padding: var(--static-space-4) var(--static-space-8);
|
|
42
55
|
}
|
|
43
|
-
|
|
56
|
+
|
|
44
57
|
.l {
|
|
45
58
|
height: var(--static-space-40);
|
|
46
59
|
min-height: var(--static-space-40);
|
|
47
60
|
padding: var(--static-space-8) var(--static-space-16);
|
|
48
61
|
}
|
|
49
62
|
|
|
63
|
+
.xl {
|
|
64
|
+
height: var(--static-space-48);
|
|
65
|
+
min-height: var(--static-space-48);
|
|
66
|
+
padding: var(--static-space-12) var(--static-space-20);
|
|
67
|
+
}
|
|
68
|
+
|
|
50
69
|
.ghost {
|
|
51
70
|
border-color: var(--static-transparent);
|
|
52
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeFx.d.ts","sourceRoot":"","sources":["../../src/components/TypeFx.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"TypeFx.d.ts","sourceRoot":"","sources":["../../src/components/TypeFx.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAEzB,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,EAAE,UAAU,CAAC;IACtF,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC5C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAwGjC,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1,103 +1,82 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect, useRef
|
|
3
|
+
import { useState, useEffect, useRef } from "react";
|
|
4
4
|
import { Text } from ".";
|
|
5
5
|
const TypeFx = ({ words, speed = 100, delay = 0, hold = 2000, trigger = "instant", onTrigger, loop = true, children, ...text }) => {
|
|
6
6
|
const [displayText, setDisplayText] = useState("");
|
|
7
7
|
const [isComplete, setIsComplete] = useState(false);
|
|
8
|
-
const
|
|
8
|
+
const [triggered, setTriggered] = useState(trigger === "instant");
|
|
9
9
|
const timeoutRef = useRef(null);
|
|
10
|
-
const
|
|
11
|
-
const prevWordsRef = useRef(words);
|
|
12
|
-
// Store config in refs to avoid re-creating typeText on every prop change
|
|
13
|
-
const configRef = useRef({ speed, delay, hold, loop });
|
|
14
|
-
configRef.current = { speed, delay, hold, loop };
|
|
15
|
-
const wordsRef = useRef(Array.isArray(words) ? words : [words]);
|
|
16
|
-
wordsRef.current = Array.isArray(words) ? words : [words];
|
|
17
|
-
const typeText = useCallback(async () => {
|
|
18
|
-
if (isRunningRef.current)
|
|
19
|
-
return;
|
|
20
|
-
hasTriggeredRef.current = true;
|
|
21
|
-
isRunningRef.current = true;
|
|
22
|
-
const wordsArray = wordsRef.current;
|
|
23
|
-
const isSingleWord = wordsArray.length === 1;
|
|
24
|
-
const { speed, delay, hold, loop } = configRef.current;
|
|
25
|
-
// Initial delay
|
|
26
|
-
if (delay > 0) {
|
|
27
|
-
await new Promise((resolve) => {
|
|
28
|
-
timeoutRef.current = window.setTimeout(resolve, delay);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
let currentIndex = 0;
|
|
32
|
-
while (true) {
|
|
33
|
-
const currentWord = wordsArray[currentIndex];
|
|
34
|
-
// Type out the word
|
|
35
|
-
for (let i = 0; i <= currentWord.length; i++) {
|
|
36
|
-
if (!isRunningRef.current)
|
|
37
|
-
return;
|
|
38
|
-
setDisplayText(currentWord.substring(0, i));
|
|
39
|
-
await new Promise((resolve) => {
|
|
40
|
-
timeoutRef.current = window.setTimeout(resolve, speed);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
// If single word, stop here
|
|
44
|
-
if (isSingleWord) {
|
|
45
|
-
setIsComplete(true);
|
|
46
|
-
isRunningRef.current = false;
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
// Hold the complete text
|
|
50
|
-
await new Promise((resolve) => {
|
|
51
|
-
timeoutRef.current = window.setTimeout(resolve, hold);
|
|
52
|
-
});
|
|
53
|
-
// Delete the word
|
|
54
|
-
for (let i = currentWord.length; i >= 0; i--) {
|
|
55
|
-
if (!isRunningRef.current)
|
|
56
|
-
return;
|
|
57
|
-
setDisplayText(currentWord.substring(0, i));
|
|
58
|
-
await new Promise((resolve) => {
|
|
59
|
-
timeoutRef.current = window.setTimeout(resolve, speed / 2); // Delete faster
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
// Move to next word
|
|
63
|
-
currentIndex = (currentIndex + 1) % wordsArray.length;
|
|
64
|
-
// If not looping and we're back at the start, stop
|
|
65
|
-
if (!loop && currentIndex === 0) {
|
|
66
|
-
isRunningRef.current = false;
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
// Small pause before typing next word
|
|
70
|
-
await new Promise((resolve) => {
|
|
71
|
-
timeoutRef.current = window.setTimeout(resolve, speed);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}, []); // Empty deps since all values are in refs
|
|
10
|
+
const wordsHash = JSON.stringify(Array.isArray(words) ? words : [words]);
|
|
75
11
|
useEffect(() => {
|
|
76
|
-
if (trigger === "instant"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
onTrigger(typeText);
|
|
12
|
+
if (trigger === "instant")
|
|
13
|
+
setTriggered(true);
|
|
14
|
+
}, [trigger]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (trigger === "custom" && onTrigger) {
|
|
17
|
+
onTrigger(() => setTriggered(true));
|
|
83
18
|
}
|
|
84
|
-
|
|
85
|
-
}, []); // Only run on mount - typeText is stable via useCallback
|
|
86
|
-
// Reset when words actually change
|
|
19
|
+
}, [trigger, onTrigger]);
|
|
87
20
|
useEffect(() => {
|
|
88
|
-
|
|
89
|
-
const wordsChanged = prevWordsRef.current !== words;
|
|
90
|
-
if (!wordsChanged)
|
|
21
|
+
if (!triggered)
|
|
91
22
|
return;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
hasTriggeredRef.current = false;
|
|
95
|
-
if (timeoutRef.current !== null) {
|
|
96
|
-
clearTimeout(timeoutRef.current);
|
|
97
|
-
}
|
|
23
|
+
let active = true;
|
|
24
|
+
let pendingResolve = null;
|
|
98
25
|
setDisplayText("");
|
|
99
26
|
setIsComplete(false);
|
|
100
|
-
|
|
27
|
+
const sleep = (ms) => new Promise((resolve) => {
|
|
28
|
+
pendingResolve = resolve;
|
|
29
|
+
timeoutRef.current = window.setTimeout(resolve, ms);
|
|
30
|
+
});
|
|
31
|
+
const run = async () => {
|
|
32
|
+
const wordsArray = JSON.parse(wordsHash);
|
|
33
|
+
const isSingleWord = wordsArray.length === 1;
|
|
34
|
+
if (delay > 0) {
|
|
35
|
+
await sleep(delay);
|
|
36
|
+
if (!active)
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
let currentIndex = 0;
|
|
40
|
+
while (active) {
|
|
41
|
+
const currentWord = wordsArray[currentIndex];
|
|
42
|
+
for (let i = 0; i <= currentWord.length; i++) {
|
|
43
|
+
if (!active)
|
|
44
|
+
return;
|
|
45
|
+
setDisplayText(currentWord.substring(0, i));
|
|
46
|
+
await sleep(speed);
|
|
47
|
+
}
|
|
48
|
+
if (isSingleWord) {
|
|
49
|
+
if (active)
|
|
50
|
+
setIsComplete(true);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (!active)
|
|
54
|
+
return;
|
|
55
|
+
await sleep(hold);
|
|
56
|
+
for (let i = currentWord.length; i >= 0; i--) {
|
|
57
|
+
if (!active)
|
|
58
|
+
return;
|
|
59
|
+
setDisplayText(currentWord.substring(0, i));
|
|
60
|
+
await sleep(speed / 2);
|
|
61
|
+
}
|
|
62
|
+
currentIndex = (currentIndex + 1) % wordsArray.length;
|
|
63
|
+
if (!loop && currentIndex === 0)
|
|
64
|
+
return;
|
|
65
|
+
if (!active)
|
|
66
|
+
return;
|
|
67
|
+
await sleep(speed);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
run();
|
|
71
|
+
return () => {
|
|
72
|
+
active = false;
|
|
73
|
+
if (timeoutRef.current !== null) {
|
|
74
|
+
clearTimeout(timeoutRef.current);
|
|
75
|
+
}
|
|
76
|
+
if (pendingResolve)
|
|
77
|
+
pendingResolve();
|
|
78
|
+
};
|
|
79
|
+
}, [triggered, wordsHash, speed, delay, hold, loop]);
|
|
101
80
|
return (_jsxs(Text, { ...text, children: [children, displayText, !isComplete && _jsx("span", { style: { opacity: 0.5 }, children: "|" })] }));
|
|
102
81
|
};
|
|
103
82
|
TypeFx.displayName = "TypeFx";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeFx.js","sourceRoot":"","sources":["../../src/components/TypeFx.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"TypeFx.js","sourceRoot":"","sources":["../../src/components/TypeFx.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAazB,MAAM,MAAM,GAA0B,CAAC,EACrC,KAAK,EACL,KAAK,GAAG,GAAG,EACX,KAAK,GAAG,CAAC,EACT,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,SAAS,EACnB,SAAS,EACT,IAAI,GAAG,IAAI,EACX,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAE/C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAEzE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,KAAK,SAAS;YAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,SAAS,CAAC,GA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D,OAAO,CACL,MAAC,IAAI,OAAK,IAAI,aACX,QAAQ,EACR,WAAW,EACX,CAAC,UAAU,IAAI,eAAM,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,kBAAU,IAClD,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -10,6 +10,7 @@ interface WeatherFxProps extends React.ComponentProps<typeof Flex> {
|
|
|
10
10
|
duration?: number;
|
|
11
11
|
trigger?: "mount" | "hover" | "click" | "manual";
|
|
12
12
|
active?: boolean;
|
|
13
|
+
reducedMotion?: boolean | "auto";
|
|
13
14
|
children?: React.ReactNode;
|
|
14
15
|
}
|
|
15
16
|
declare const WeatherFx: React.ForwardRefExoticComponent<Omit<WeatherFxProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeatherFx.d.ts","sourceRoot":"","sources":["../../src/components/WeatherFx.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"WeatherFx.d.ts","sourceRoot":"","sources":["../../src/components/WeatherFx.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAGzB,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE5D,UAAU,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC;IAChE,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAgED,QAAA,MAAM,SAAS,oGA0+Bd,CAAC;AAGF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React, { useEffect, useRef } from "react";
|
|
4
4
|
import { Flex } from ".";
|
|
5
|
-
|
|
5
|
+
import { useReducedMotion } from "../hooks/useReducedMotion";
|
|
6
|
+
const WeatherFx = React.forwardRef(({ type = "rain", speed = 1, colors = ["brand-solid-medium"], intensity = 50, angle = 0, duration, trigger = "mount", active = false, reducedMotion = "auto", children, ...rest }, forwardedRef) => {
|
|
7
|
+
const { shouldAnimate } = useReducedMotion(reducedMotion);
|
|
6
8
|
const containerRef = useRef(null);
|
|
7
9
|
const canvasRef = useRef(null);
|
|
8
10
|
const animationRef = useRef(undefined);
|
|
@@ -532,6 +534,12 @@ const WeatherFx = React.forwardRef(({ type = "rain", speed = 1, colors = ["brand
|
|
|
532
534
|
ctx.globalAlpha = 1;
|
|
533
535
|
animationRef.current = requestAnimationFrame(animate);
|
|
534
536
|
};
|
|
537
|
+
if (!shouldAnimate) {
|
|
538
|
+
// When reduced motion is active, don't start the animation loop at all
|
|
539
|
+
return () => {
|
|
540
|
+
window.removeEventListener("resize", updateSize);
|
|
541
|
+
};
|
|
542
|
+
}
|
|
535
543
|
animate();
|
|
536
544
|
return () => {
|
|
537
545
|
window.removeEventListener("resize", updateSize);
|
|
@@ -539,7 +547,7 @@ const WeatherFx = React.forwardRef(({ type = "rain", speed = 1, colors = ["brand
|
|
|
539
547
|
cancelAnimationFrame(animationRef.current);
|
|
540
548
|
}
|
|
541
549
|
};
|
|
542
|
-
}, [type, colors, speed, intensity, angle, duration, trigger]);
|
|
550
|
+
}, [type, colors, speed, intensity, angle, duration, trigger, shouldAnimate]);
|
|
543
551
|
// Respond to external control in manual mode
|
|
544
552
|
useEffect(() => {
|
|
545
553
|
if (trigger !== "manual")
|
|
@@ -647,6 +655,93 @@ const WeatherFx = React.forwardRef(({ type = "rain", speed = 1, colors = ["brand
|
|
|
647
655
|
isHoveredRef.current = true;
|
|
648
656
|
isEmittingRef.current = true;
|
|
649
657
|
emitStartTimeRef.current = Date.now();
|
|
658
|
+
// Initialize particles if none exist yet
|
|
659
|
+
if (particlesRef.current.length === 0) {
|
|
660
|
+
const canvas = canvasRef.current;
|
|
661
|
+
const container = containerRef.current;
|
|
662
|
+
if (canvas && container) {
|
|
663
|
+
const cw = canvas.width / 2;
|
|
664
|
+
const ch = canvas.height / 2;
|
|
665
|
+
const parsedColors = colors.map((color) => {
|
|
666
|
+
const computedColor = getComputedStyle(container).getPropertyValue(`--${color}`);
|
|
667
|
+
return computedColor || color;
|
|
668
|
+
});
|
|
669
|
+
const angleRad = (angle * Math.PI) / 180;
|
|
670
|
+
const horizontalOffset = Math.abs(Math.tan(angleRad) * ch);
|
|
671
|
+
if (type === "rain") {
|
|
672
|
+
const particles = [];
|
|
673
|
+
for (let i = 0; i < intensity; i++) {
|
|
674
|
+
const spawnWidth = cw + horizontalOffset * 2;
|
|
675
|
+
const spawnX = Math.random() * spawnWidth - horizontalOffset;
|
|
676
|
+
particles.push({
|
|
677
|
+
x: spawnX,
|
|
678
|
+
y: Math.random() * ch - ch,
|
|
679
|
+
length: 10 + Math.random() * 20,
|
|
680
|
+
speed: (2 + Math.random() * 3) * speed,
|
|
681
|
+
color: parsedColors[Math.floor(Math.random() * parsedColors.length)],
|
|
682
|
+
opacity: 0.3 + Math.random() * 0.5,
|
|
683
|
+
thickness: 1 + Math.random() * 1.5,
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
particlesRef.current = particles;
|
|
687
|
+
}
|
|
688
|
+
else if (type === "snow") {
|
|
689
|
+
const particles = [];
|
|
690
|
+
for (let i = 0; i < intensity; i++) {
|
|
691
|
+
const depth = Math.random();
|
|
692
|
+
const size = 2 + depth * 4;
|
|
693
|
+
const spawnWidth = cw + horizontalOffset * 2;
|
|
694
|
+
const spawnX = Math.random() * spawnWidth - horizontalOffset;
|
|
695
|
+
particles.push({
|
|
696
|
+
x: spawnX,
|
|
697
|
+
y: Math.random() * ch - ch,
|
|
698
|
+
size,
|
|
699
|
+
speed: (0.3 + depth * 0.7) * speed,
|
|
700
|
+
color: parsedColors[Math.floor(Math.random() * parsedColors.length)],
|
|
701
|
+
opacity: 0.4 + depth * 0.5,
|
|
702
|
+
swayAmplitude: 20 + Math.random() * 30,
|
|
703
|
+
swaySpeed: 0.5 + Math.random() * 1,
|
|
704
|
+
swayOffset: Math.random() * Math.PI * 2,
|
|
705
|
+
depth,
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
particlesRef.current = particles;
|
|
709
|
+
}
|
|
710
|
+
else if (type === "leaves") {
|
|
711
|
+
const particles = [];
|
|
712
|
+
for (let i = 0; i < intensity; i++) {
|
|
713
|
+
const depth = Math.random();
|
|
714
|
+
const width = 8 + depth * 12;
|
|
715
|
+
const height = width * (0.6 + Math.random() * 0.4);
|
|
716
|
+
const spawnWidth = cw + horizontalOffset * 2;
|
|
717
|
+
const spawnX = Math.random() * spawnWidth - horizontalOffset;
|
|
718
|
+
const colorIndex = Math.floor(Math.random() * parsedColors.length);
|
|
719
|
+
const color1 = parsedColors[colorIndex];
|
|
720
|
+
const color2 = parsedColors[Math.min(colorIndex + 1, parsedColors.length - 1)];
|
|
721
|
+
particles.push({
|
|
722
|
+
x: spawnX,
|
|
723
|
+
y: Math.random() * ch - ch,
|
|
724
|
+
width,
|
|
725
|
+
height,
|
|
726
|
+
speed: (0.4 + depth * 0.8) * speed,
|
|
727
|
+
color1,
|
|
728
|
+
color2,
|
|
729
|
+
opacity: 0.6 + depth * 0.3,
|
|
730
|
+
swayAmplitude: 30 + Math.random() * 50,
|
|
731
|
+
swaySpeed: 0.3 + Math.random() * 0.7,
|
|
732
|
+
swayOffset: Math.random() * Math.PI * 2,
|
|
733
|
+
rotation: Math.random() * Math.PI * 2,
|
|
734
|
+
rotationSpeed: (Math.random() - 0.5) * 0.08,
|
|
735
|
+
rotation3D: Math.random() * Math.PI * 2,
|
|
736
|
+
rotation3DSpeed: (Math.random() - 0.5) * 0.06,
|
|
737
|
+
depth,
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
particlesRef.current = particles;
|
|
741
|
+
}
|
|
742
|
+
// Lightning doesn't need pre-initialization (spawns dynamically)
|
|
743
|
+
}
|
|
744
|
+
}
|
|
650
745
|
}
|
|
651
746
|
};
|
|
652
747
|
const handleMouseLeave = () => {
|