@once-ui-system/fx 3.0.0-beta.1 → 3.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CelebrationFx.d.ts +24 -4
- package/dist/CelebrationFx.js +444 -272
- package/dist/GlitchFx.module.css +1 -0
- package/dist/HoloFx.module.css +1 -0
- package/dist/MatrixFx.js +7 -2
- package/dist/RevealFx.module.css +1 -0
- package/dist/ShineFx.module.css +1 -0
- package/dist/TiltFx.module.css +1 -0
- package/dist/WeatherFx.d.ts +25 -4
- package/dist/WeatherFx.js +471 -818
- package/dist/internal/FadingLetters.module.css +1 -0
- package/dist/internal/canvasStage.d.ts +61 -0
- package/dist/internal/canvasStage.js +163 -0
- package/dist/internal/cssColor.js +10 -1
- package/dist/internal/useControllableState.d.ts +14 -0
- package/dist/internal/useControllableState.js +35 -0
- package/package.json +1 -1
package/dist/GlitchFx.module.css
CHANGED
package/dist/HoloFx.module.css
CHANGED
package/dist/MatrixFx.js
CHANGED
|
@@ -40,6 +40,10 @@ const MatrixFx = ({ ref: forwardedRef, speed: speedProp, colors = ["brand-solid-
|
|
|
40
40
|
entries.forEach((entry) => {
|
|
41
41
|
isVisibleRef.current = entry.isIntersecting;
|
|
42
42
|
});
|
|
43
|
+
// The loop sleeps while offscreen (see `animate`); wake it on return.
|
|
44
|
+
if (isVisibleRef.current && !animationRef.current && animateFnRef.current) {
|
|
45
|
+
animationRef.current = requestAnimationFrame(animateFnRef.current);
|
|
46
|
+
}
|
|
43
47
|
}, {
|
|
44
48
|
// Start animating when 10% visible for smooth transitions
|
|
45
49
|
threshold: 0.1,
|
|
@@ -224,9 +228,10 @@ const MatrixFx = ({ ref: forwardedRef, speed: speedProp, colors = ["brand-solid-
|
|
|
224
228
|
animationRef.current = requestAnimationFrame(animate);
|
|
225
229
|
return;
|
|
226
230
|
}
|
|
227
|
-
//
|
|
231
|
+
// Offscreen: stop the loop instead of spinning on empty frames. The
|
|
232
|
+
// IntersectionObserver restarts it when the grid comes back into view.
|
|
228
233
|
if (!isVisibleRef.current) {
|
|
229
|
-
animationRef.current =
|
|
234
|
+
animationRef.current = undefined;
|
|
230
235
|
return;
|
|
231
236
|
}
|
|
232
237
|
// FPS throttling
|
package/dist/RevealFx.module.css
CHANGED
package/dist/ShineFx.module.css
CHANGED
package/dist/TiltFx.module.css
CHANGED
package/dist/WeatherFx.d.ts
CHANGED
|
@@ -1,22 +1,43 @@
|
|
|
1
1
|
import { Flex, type Speed } from "@once-ui-system/core";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
type WeatherType = "rain" | "snow" | "leaves" | "lightning";
|
|
4
|
-
interface WeatherFxProps extends React.ComponentProps<typeof Flex> {
|
|
4
|
+
interface WeatherFxProps extends Omit<React.ComponentProps<typeof Flex>, "onChange" | "defaultValue"> {
|
|
5
5
|
type?: WeatherType;
|
|
6
6
|
/** A multiplier on the designed pace (`1`), or `"slow"`/`"medium"`/`"fast"` (0.5, 1, 2). */
|
|
7
7
|
speed?: Speed;
|
|
8
|
+
/**
|
|
9
|
+
* Colours to draw with: tokens (`brand-solid-medium`, `accent-weak`), custom
|
|
10
|
+
* properties (`--my-color`) or CSS colours. Leaves blend each colour into the
|
|
11
|
+
* next. Read again when the theme changes.
|
|
12
|
+
*/
|
|
8
13
|
colors?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* How much weather: drops, flakes or leaves on screen (0 to 400). For
|
|
16
|
+
* lightning, how often it strikes: 10 is about every 1.5 s, 50 and up as
|
|
17
|
+
* often as is safe (never more than twice a second).
|
|
18
|
+
*/
|
|
9
19
|
intensity?: number;
|
|
20
|
+
/** Degrees the weather leans from straight down; positive drifts right. */
|
|
10
21
|
angle?: number;
|
|
11
|
-
/** Milliseconds
|
|
22
|
+
/** Milliseconds the weather runs once it starts; then `active` turns off. Unset runs until `active` is false. */
|
|
12
23
|
duration?: number;
|
|
13
|
-
|
|
24
|
+
/**
|
|
25
|
+
* What starts the weather by itself: `mount` (on load), `hover` (while the
|
|
26
|
+
* pointer is over it; a tap toggles it on touch screens) or `click` (each
|
|
27
|
+
* click toggles it). Setting `active` drives it from outside, whatever the trigger.
|
|
28
|
+
*/
|
|
29
|
+
trigger?: "mount" | "hover" | "click";
|
|
30
|
+
/** Whether the weather is running. Controlled; pair with `onActiveChange`. */
|
|
14
31
|
active?: boolean;
|
|
32
|
+
/** The first value of `active` when uncontrolled. Defaults to `trigger === "mount"`. */
|
|
33
|
+
defaultActive?: boolean;
|
|
34
|
+
/** Called when the weather starts or stops by hover, click or `duration`. */
|
|
35
|
+
onActiveChange?: (active: boolean) => void;
|
|
15
36
|
reducedMotion?: boolean | "auto";
|
|
16
37
|
children?: React.ReactNode;
|
|
17
38
|
}
|
|
18
39
|
declare const WeatherFx: {
|
|
19
|
-
({ ref: forwardedRef, type, speed: speedProp, colors, intensity, angle, duration, trigger, active, reducedMotion, children, ...rest }: WeatherFxProps): React.JSX.Element;
|
|
40
|
+
({ ref: forwardedRef, type, speed: speedProp, colors: colorsProp, intensity, angle, duration, trigger, active: activeProp, defaultActive, onActiveChange, reducedMotion, children, onClick, onMouseEnter, onMouseLeave, ...rest }: WeatherFxProps): React.JSX.Element;
|
|
20
41
|
displayName: string;
|
|
21
42
|
};
|
|
22
43
|
export { WeatherFx };
|