@hdcodedev/snowfall 1.0.4 → 1.0.6
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 +7 -6
- package/dist/index.d.mts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +433 -169
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +433 -170
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
# @hdcodedev/snowfall
|
|
1
|
+
# [@hdcodedev/snowfall](https://next-snowfall.vercel.app)
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@hdcodedev/snowfall)
|
|
4
|
+
|
|
2
5
|
|
|
3
6
|
A realistic snowfall effect for React with physics-based accumulation on surfaces. Features melting, wind, and smart surface detection.
|
|
4
7
|
|
|
5
|
-

|
|
9
|
+
|
|
10
|
+
|
|
6
11
|
|
|
7
12
|
## Features
|
|
8
13
|
|
|
@@ -135,10 +140,6 @@ Hook to access snowfall controls. Must be used within `SnowfallProvider`.
|
|
|
135
140
|
}
|
|
136
141
|
```
|
|
137
142
|
|
|
138
|
-
## Demo
|
|
139
|
-
|
|
140
|
-
Check out the [live demo](https://snowfall-2026.vercel.app)
|
|
141
|
-
|
|
142
143
|
## Tips
|
|
143
144
|
|
|
144
145
|
- The snowfall canvas has `pointer-events: none`, so it won't interfere with user interactions
|
package/dist/index.d.mts
CHANGED
|
@@ -21,18 +21,41 @@ interface PhysicsConfig {
|
|
|
21
21
|
MIN: number;
|
|
22
22
|
MAX: number;
|
|
23
23
|
};
|
|
24
|
+
MAX_SURFACES: number;
|
|
24
25
|
}
|
|
25
26
|
declare const DEFAULT_PHYSICS: PhysicsConfig;
|
|
27
|
+
interface PerformanceMetrics {
|
|
28
|
+
fps: number;
|
|
29
|
+
frameTime: number;
|
|
30
|
+
scanTime: number;
|
|
31
|
+
rectUpdateTime: number;
|
|
32
|
+
surfaceCount: number;
|
|
33
|
+
flakeCount: number;
|
|
34
|
+
maxFlakes: number;
|
|
35
|
+
rafGap: number;
|
|
36
|
+
clearTime: number;
|
|
37
|
+
physicsTime: number;
|
|
38
|
+
drawTime: number;
|
|
39
|
+
}
|
|
26
40
|
interface SnowfallContextType {
|
|
27
41
|
isEnabled: boolean;
|
|
28
42
|
toggleSnow: () => void;
|
|
29
43
|
physicsConfig: PhysicsConfig;
|
|
30
44
|
updatePhysicsConfig: (config: Partial<PhysicsConfig>) => void;
|
|
31
45
|
resetPhysics: () => void;
|
|
46
|
+
debugMode: boolean;
|
|
47
|
+
toggleDebug: () => void;
|
|
48
|
+
metrics: PerformanceMetrics | null;
|
|
49
|
+
setMetrics: (metrics: PerformanceMetrics) => void;
|
|
32
50
|
}
|
|
33
|
-
declare function SnowfallProvider({ children }: {
|
|
51
|
+
declare function SnowfallProvider({ children, initialDebug }: {
|
|
34
52
|
children: ReactNode;
|
|
53
|
+
initialDebug?: boolean;
|
|
35
54
|
}): react_jsx_runtime.JSX.Element;
|
|
36
55
|
declare function useSnowfall(): SnowfallContextType;
|
|
37
56
|
|
|
38
|
-
|
|
57
|
+
declare function DebugPanel({ defaultOpen }: {
|
|
58
|
+
defaultOpen?: boolean;
|
|
59
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
60
|
+
|
|
61
|
+
export { DEFAULT_PHYSICS, DebugPanel, type PerformanceMetrics, type PhysicsConfig, Snowfall, SnowfallProvider, useSnowfall };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,18 +21,41 @@ interface PhysicsConfig {
|
|
|
21
21
|
MIN: number;
|
|
22
22
|
MAX: number;
|
|
23
23
|
};
|
|
24
|
+
MAX_SURFACES: number;
|
|
24
25
|
}
|
|
25
26
|
declare const DEFAULT_PHYSICS: PhysicsConfig;
|
|
27
|
+
interface PerformanceMetrics {
|
|
28
|
+
fps: number;
|
|
29
|
+
frameTime: number;
|
|
30
|
+
scanTime: number;
|
|
31
|
+
rectUpdateTime: number;
|
|
32
|
+
surfaceCount: number;
|
|
33
|
+
flakeCount: number;
|
|
34
|
+
maxFlakes: number;
|
|
35
|
+
rafGap: number;
|
|
36
|
+
clearTime: number;
|
|
37
|
+
physicsTime: number;
|
|
38
|
+
drawTime: number;
|
|
39
|
+
}
|
|
26
40
|
interface SnowfallContextType {
|
|
27
41
|
isEnabled: boolean;
|
|
28
42
|
toggleSnow: () => void;
|
|
29
43
|
physicsConfig: PhysicsConfig;
|
|
30
44
|
updatePhysicsConfig: (config: Partial<PhysicsConfig>) => void;
|
|
31
45
|
resetPhysics: () => void;
|
|
46
|
+
debugMode: boolean;
|
|
47
|
+
toggleDebug: () => void;
|
|
48
|
+
metrics: PerformanceMetrics | null;
|
|
49
|
+
setMetrics: (metrics: PerformanceMetrics) => void;
|
|
32
50
|
}
|
|
33
|
-
declare function SnowfallProvider({ children }: {
|
|
51
|
+
declare function SnowfallProvider({ children, initialDebug }: {
|
|
34
52
|
children: ReactNode;
|
|
53
|
+
initialDebug?: boolean;
|
|
35
54
|
}): react_jsx_runtime.JSX.Element;
|
|
36
55
|
declare function useSnowfall(): SnowfallContextType;
|
|
37
56
|
|
|
38
|
-
|
|
57
|
+
declare function DebugPanel({ defaultOpen }: {
|
|
58
|
+
defaultOpen?: boolean;
|
|
59
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
60
|
+
|
|
61
|
+
export { DEFAULT_PHYSICS, DebugPanel, type PerformanceMetrics, type PhysicsConfig, Snowfall, SnowfallProvider, useSnowfall };
|