@hdcodedev/snowfall 1.0.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.
Files changed (51) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +144 -0
  3. package/dist/Snowfall.d.mts +5 -0
  4. package/dist/Snowfall.d.ts +5 -0
  5. package/dist/Snowfall.js +162 -0
  6. package/dist/Snowfall.js.map +1 -0
  7. package/dist/Snowfall.mjs +142 -0
  8. package/dist/Snowfall.mjs.map +1 -0
  9. package/dist/SnowfallProvider.d.mts +32 -0
  10. package/dist/SnowfallProvider.d.ts +32 -0
  11. package/dist/SnowfallProvider.js +89 -0
  12. package/dist/SnowfallProvider.js.map +1 -0
  13. package/dist/SnowfallProvider.mjs +63 -0
  14. package/dist/SnowfallProvider.mjs.map +1 -0
  15. package/dist/index.d.mts +4 -0
  16. package/dist/index.d.ts +4 -0
  17. package/dist/index.js +47 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/index.mjs +10 -0
  20. package/dist/index.mjs.map +1 -0
  21. package/dist/utils/snowfall/constants.d.mts +10 -0
  22. package/dist/utils/snowfall/constants.d.ts +10 -0
  23. package/dist/utils/snowfall/constants.js +50 -0
  24. package/dist/utils/snowfall/constants.js.map +1 -0
  25. package/dist/utils/snowfall/constants.mjs +19 -0
  26. package/dist/utils/snowfall/constants.mjs.map +1 -0
  27. package/dist/utils/snowfall/dom.d.mts +11 -0
  28. package/dist/utils/snowfall/dom.d.ts +11 -0
  29. package/dist/utils/snowfall/dom.js +130 -0
  30. package/dist/utils/snowfall/dom.js.map +1 -0
  31. package/dist/utils/snowfall/dom.mjs +113 -0
  32. package/dist/utils/snowfall/dom.mjs.map +1 -0
  33. package/dist/utils/snowfall/draw.d.mts +7 -0
  34. package/dist/utils/snowfall/draw.d.ts +7 -0
  35. package/dist/utils/snowfall/draw.js +160 -0
  36. package/dist/utils/snowfall/draw.js.map +1 -0
  37. package/dist/utils/snowfall/draw.mjs +134 -0
  38. package/dist/utils/snowfall/draw.mjs.map +1 -0
  39. package/dist/utils/snowfall/physics.d.mts +11 -0
  40. package/dist/utils/snowfall/physics.d.ts +11 -0
  41. package/dist/utils/snowfall/physics.js +233 -0
  42. package/dist/utils/snowfall/physics.js.map +1 -0
  43. package/dist/utils/snowfall/physics.mjs +206 -0
  44. package/dist/utils/snowfall/physics.mjs.map +1 -0
  45. package/dist/utils/snowfall/types.d.mts +28 -0
  46. package/dist/utils/snowfall/types.d.ts +28 -0
  47. package/dist/utils/snowfall/types.js +17 -0
  48. package/dist/utils/snowfall/types.js.map +1 -0
  49. package/dist/utils/snowfall/types.mjs +1 -0
  50. package/dist/utils/snowfall/types.mjs.map +1 -0
  51. package/package.json +57 -0
@@ -0,0 +1,142 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { useSnowfall } from "./SnowfallProvider";
5
+ import { getElementRects } from "./utils/snowfall/dom";
6
+ import { createSnowflake, initializeAccumulation, meltAndSmoothAccumulation, updateSnowflakes } from "./utils/snowfall/physics";
7
+ import { drawAccumulations, drawSideAccumulations, drawSnowflake } from "./utils/snowfall/draw";
8
+ function Snowfall() {
9
+ const { isEnabled, physicsConfig } = useSnowfall();
10
+ const isEnabledRef = useRef(isEnabled);
11
+ const physicsConfigRef = useRef(physicsConfig);
12
+ const [isMounted, setIsMounted] = useState(false);
13
+ const [isVisible, setIsVisible] = useState(false);
14
+ const canvasRef = useRef(null);
15
+ const fixedCanvasRef = useRef(null);
16
+ const snowflakesRef = useRef([]);
17
+ const accumulationRef = useRef(/* @__PURE__ */ new Map());
18
+ const animationIdRef = useRef(0);
19
+ useEffect(() => {
20
+ setIsMounted(true);
21
+ }, []);
22
+ useEffect(() => {
23
+ isEnabledRef.current = isEnabled;
24
+ }, [isEnabled]);
25
+ useEffect(() => {
26
+ physicsConfigRef.current = physicsConfig;
27
+ }, [physicsConfig]);
28
+ useEffect(() => {
29
+ if (!isMounted) return;
30
+ const canvas = canvasRef.current;
31
+ const fixedCanvas = fixedCanvasRef.current;
32
+ if (!canvas || !fixedCanvas) return;
33
+ const ctx = canvas.getContext("2d");
34
+ const fixedCtx = fixedCanvas.getContext("2d");
35
+ if (!ctx || !fixedCtx) return;
36
+ const resizeCanvas = () => {
37
+ if (canvasRef.current && fixedCanvasRef.current) {
38
+ const newHeight = Math.max(document.documentElement.scrollHeight, window.innerHeight);
39
+ const newWidth = Math.max(document.documentElement.scrollWidth, window.innerWidth);
40
+ if (canvasRef.current.height !== newHeight || canvasRef.current.width !== newWidth) {
41
+ canvasRef.current.width = newWidth;
42
+ canvasRef.current.height = newHeight;
43
+ }
44
+ if (fixedCanvasRef.current.width !== window.innerWidth || fixedCanvasRef.current.height !== window.innerHeight) {
45
+ fixedCanvasRef.current.width = window.innerWidth;
46
+ fixedCanvasRef.current.height = window.innerHeight;
47
+ }
48
+ }
49
+ };
50
+ resizeCanvas();
51
+ const resizeObserver = new ResizeObserver(() => {
52
+ resizeCanvas();
53
+ });
54
+ resizeObserver.observe(document.body);
55
+ snowflakesRef.current = [];
56
+ const initAccumulationWrapper = () => {
57
+ initializeAccumulation(accumulationRef.current, physicsConfigRef.current);
58
+ };
59
+ initAccumulationWrapper();
60
+ setIsVisible(true);
61
+ let lastTime = 0;
62
+ const animate = (currentTime) => {
63
+ if (lastTime === 0) {
64
+ lastTime = currentTime;
65
+ animationIdRef.current = requestAnimationFrame(animate);
66
+ return;
67
+ }
68
+ const deltaTime = Math.min(currentTime - lastTime, 50);
69
+ lastTime = currentTime;
70
+ const dt = deltaTime / 16.67;
71
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
72
+ fixedCtx.clearRect(0, 0, fixedCanvas.width, fixedCanvas.height);
73
+ const snowflakes = snowflakesRef.current;
74
+ const elementRects = getElementRects(accumulationRef.current);
75
+ meltAndSmoothAccumulation(elementRects, physicsConfigRef.current, dt);
76
+ updateSnowflakes(snowflakes, elementRects, physicsConfigRef.current, dt, canvas.width, canvas.height);
77
+ for (const flake of snowflakes) {
78
+ drawSnowflake(ctx, flake);
79
+ }
80
+ if (isEnabledRef.current && snowflakes.length < physicsConfigRef.current.MAX_FLAKES) {
81
+ const isBackground = Math.random() < 0.4;
82
+ snowflakes.push(createSnowflake(canvas.width, physicsConfigRef.current, isBackground));
83
+ }
84
+ drawAccumulations(ctx, fixedCtx, elementRects);
85
+ drawSideAccumulations(ctx, fixedCtx, elementRects);
86
+ animationIdRef.current = requestAnimationFrame(animate);
87
+ };
88
+ animationIdRef.current = requestAnimationFrame(animate);
89
+ const handleResize = () => {
90
+ resizeCanvas();
91
+ accumulationRef.current.clear();
92
+ initAccumulationWrapper();
93
+ };
94
+ window.addEventListener("resize", handleResize);
95
+ const checkInterval = setInterval(initAccumulationWrapper, 3e3);
96
+ return () => {
97
+ cancelAnimationFrame(animationIdRef.current);
98
+ window.removeEventListener("resize", handleResize);
99
+ clearInterval(checkInterval);
100
+ resizeObserver.disconnect();
101
+ };
102
+ }, [isMounted]);
103
+ if (!isMounted) return null;
104
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
105
+ /* @__PURE__ */ jsx(
106
+ "canvas",
107
+ {
108
+ ref: canvasRef,
109
+ style: {
110
+ position: "absolute",
111
+ top: 0,
112
+ left: 0,
113
+ pointerEvents: "none",
114
+ zIndex: 9999,
115
+ opacity: isVisible ? 1 : 0,
116
+ transition: "opacity 0.3s ease-in"
117
+ },
118
+ "aria-hidden": "true"
119
+ }
120
+ ),
121
+ /* @__PURE__ */ jsx(
122
+ "canvas",
123
+ {
124
+ ref: fixedCanvasRef,
125
+ style: {
126
+ position: "fixed",
127
+ top: 0,
128
+ left: 0,
129
+ pointerEvents: "none",
130
+ zIndex: 9999,
131
+ opacity: isVisible ? 1 : 0,
132
+ transition: "opacity 0.3s ease-in"
133
+ },
134
+ "aria-hidden": "true"
135
+ }
136
+ )
137
+ ] });
138
+ }
139
+ export {
140
+ Snowfall as default
141
+ };
142
+ //# sourceMappingURL=Snowfall.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Snowfall.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState } from 'react';\nimport { useSnowfall } from './SnowfallProvider';\nimport { Snowflake, SnowAccumulation } from './utils/snowfall/types';\nimport { getElementRects } from './utils/snowfall/dom';\nimport { createSnowflake, initializeAccumulation, meltAndSmoothAccumulation, updateSnowflakes } from './utils/snowfall/physics';\nimport { drawAccumulations, drawSideAccumulations, drawSnowflake } from './utils/snowfall/draw';\n\nexport default function Snowfall() {\n const { isEnabled, physicsConfig } = useSnowfall();\n const isEnabledRef = useRef(isEnabled);\n const physicsConfigRef = useRef(physicsConfig);\n const [isMounted, setIsMounted] = useState(false);\n const [isVisible, setIsVisible] = useState(false);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const fixedCanvasRef = useRef<HTMLCanvasElement>(null);\n const snowflakesRef = useRef<Snowflake[]>([]);\n const accumulationRef = useRef<Map<Element, SnowAccumulation>>(new Map());\n const animationIdRef = useRef<number>(0);\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n useEffect(() => {\n isEnabledRef.current = isEnabled;\n }, [isEnabled]);\n\n useEffect(() => {\n physicsConfigRef.current = physicsConfig;\n }, [physicsConfig]);\n\n useEffect(() => {\n if (!isMounted) return;\n\n const canvas = canvasRef.current;\n const fixedCanvas = fixedCanvasRef.current;\n if (!canvas || !fixedCanvas) return;\n\n const ctx = canvas.getContext('2d');\n const fixedCtx = fixedCanvas.getContext('2d');\n if (!ctx || !fixedCtx) return;\n\n const resizeCanvas = () => {\n if (canvasRef.current && fixedCanvasRef.current) {\n const newHeight = Math.max(document.documentElement.scrollHeight, window.innerHeight);\n const newWidth = Math.max(document.documentElement.scrollWidth, window.innerWidth);\n\n if (canvasRef.current.height !== newHeight || canvasRef.current.width !== newWidth) {\n canvasRef.current.width = newWidth;\n canvasRef.current.height = newHeight;\n }\n\n // Fixed canvas matches viewport\n if (fixedCanvasRef.current.width !== window.innerWidth || fixedCanvasRef.current.height !== window.innerHeight) {\n fixedCanvasRef.current.width = window.innerWidth;\n fixedCanvasRef.current.height = window.innerHeight;\n }\n }\n };\n resizeCanvas();\n\n const resizeObserver = new ResizeObserver(() => {\n resizeCanvas();\n });\n resizeObserver.observe(document.body);\n\n snowflakesRef.current = [];\n\n const initAccumulationWrapper = () => {\n initializeAccumulation(accumulationRef.current, physicsConfigRef.current);\n };\n initAccumulationWrapper();\n\n setIsVisible(true);\n\n let lastTime = 0;\n\n const animate = (currentTime: number) => {\n if (lastTime === 0) {\n lastTime = currentTime;\n animationIdRef.current = requestAnimationFrame(animate);\n return;\n }\n\n const deltaTime = Math.min(currentTime - lastTime, 50);\n lastTime = currentTime;\n const dt = deltaTime / 16.67;\n\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n fixedCtx.clearRect(0, 0, fixedCanvas.width, fixedCanvas.height);\n\n const snowflakes = snowflakesRef.current;\n const elementRects = getElementRects(accumulationRef.current);\n\n // Physics Update: Melt and Smooth\n meltAndSmoothAccumulation(elementRects, physicsConfigRef.current, dt);\n\n // Physics Update: Snowflakes & Collisions\n updateSnowflakes(snowflakes, elementRects, physicsConfigRef.current, dt, canvas.width, canvas.height);\n\n // Draw Snowflakes\n for (const flake of snowflakes) {\n drawSnowflake(ctx, flake);\n }\n\n // Spawn new snowflakes\n if (isEnabledRef.current && snowflakes.length < physicsConfigRef.current.MAX_FLAKES) {\n const isBackground = Math.random() < 0.4;\n snowflakes.push(createSnowflake(canvas.width, physicsConfigRef.current, isBackground));\n }\n\n // Draw Accumulation\n drawAccumulations(ctx, fixedCtx, elementRects);\n drawSideAccumulations(ctx, fixedCtx, elementRects);\n\n animationIdRef.current = requestAnimationFrame(animate);\n };\n\n animationIdRef.current = requestAnimationFrame(animate);\n\n const handleResize = () => {\n resizeCanvas();\n accumulationRef.current.clear();\n initAccumulationWrapper();\n };\n\n window.addEventListener('resize', handleResize);\n const checkInterval = setInterval(initAccumulationWrapper, 3000);\n\n return () => {\n cancelAnimationFrame(animationIdRef.current);\n window.removeEventListener('resize', handleResize);\n clearInterval(checkInterval);\n resizeObserver.disconnect();\n };\n }, [isMounted]);\n\n if (!isMounted) return null;\n\n return (\n <>\n <canvas\n ref={canvasRef}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n pointerEvents: 'none',\n zIndex: 9999,\n opacity: isVisible ? 1 : 0,\n transition: 'opacity 0.3s ease-in',\n }}\n aria-hidden=\"true\"\n />\n <canvas\n ref={fixedCanvasRef}\n style={{\n position: 'fixed',\n top: 0,\n left: 0,\n pointerEvents: 'none',\n zIndex: 9999,\n opacity: isVisible ? 1 : 0,\n transition: 'opacity 0.3s ease-in',\n }}\n aria-hidden=\"true\"\n />\n </>\n );\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,32 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface PhysicsConfig {
5
+ MAX_FLAKES: number;
6
+ MELT_SPEED: number;
7
+ WIND_STRENGTH: number;
8
+ ACCUMULATION: {
9
+ SIDE_RATE: number;
10
+ TOP_CARD_RATE: number;
11
+ TOP_HEADER_RATE: number;
12
+ };
13
+ MAX_DEPTH: {
14
+ CARD_TOP: number;
15
+ HEADER_TOP: number;
16
+ CARD_SIDE: number;
17
+ };
18
+ }
19
+ declare const DEFAULT_PHYSICS: PhysicsConfig;
20
+ interface SnowfallContextType {
21
+ isEnabled: boolean;
22
+ toggleSnow: () => void;
23
+ physicsConfig: PhysicsConfig;
24
+ updatePhysicsConfig: (config: Partial<PhysicsConfig>) => void;
25
+ resetPhysics: () => void;
26
+ }
27
+ declare function SnowfallProvider({ children }: {
28
+ children: ReactNode;
29
+ }): react_jsx_runtime.JSX.Element;
30
+ declare function useSnowfall(): SnowfallContextType;
31
+
32
+ export { DEFAULT_PHYSICS, type PhysicsConfig, SnowfallProvider, useSnowfall };
@@ -0,0 +1,32 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface PhysicsConfig {
5
+ MAX_FLAKES: number;
6
+ MELT_SPEED: number;
7
+ WIND_STRENGTH: number;
8
+ ACCUMULATION: {
9
+ SIDE_RATE: number;
10
+ TOP_CARD_RATE: number;
11
+ TOP_HEADER_RATE: number;
12
+ };
13
+ MAX_DEPTH: {
14
+ CARD_TOP: number;
15
+ HEADER_TOP: number;
16
+ CARD_SIDE: number;
17
+ };
18
+ }
19
+ declare const DEFAULT_PHYSICS: PhysicsConfig;
20
+ interface SnowfallContextType {
21
+ isEnabled: boolean;
22
+ toggleSnow: () => void;
23
+ physicsConfig: PhysicsConfig;
24
+ updatePhysicsConfig: (config: Partial<PhysicsConfig>) => void;
25
+ resetPhysics: () => void;
26
+ }
27
+ declare function SnowfallProvider({ children }: {
28
+ children: ReactNode;
29
+ }): react_jsx_runtime.JSX.Element;
30
+ declare function useSnowfall(): SnowfallContextType;
31
+
32
+ export { DEFAULT_PHYSICS, type PhysicsConfig, SnowfallProvider, useSnowfall };
@@ -0,0 +1,89 @@
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
+ var SnowfallProvider_exports = {};
21
+ __export(SnowfallProvider_exports, {
22
+ DEFAULT_PHYSICS: () => DEFAULT_PHYSICS,
23
+ SnowfallProvider: () => SnowfallProvider,
24
+ useSnowfall: () => useSnowfall
25
+ });
26
+ module.exports = __toCommonJS(SnowfallProvider_exports);
27
+ var import_jsx_runtime = require("react/jsx-runtime");
28
+ var import_react = require("react");
29
+ const DEFAULT_PHYSICS = {
30
+ MAX_FLAKES: 500,
31
+ MELT_SPEED: 5e-5,
32
+ WIND_STRENGTH: 0.8,
33
+ ACCUMULATION: {
34
+ SIDE_RATE: 1.2,
35
+ TOP_CARD_RATE: 1.9,
36
+ TOP_HEADER_RATE: 1.2
37
+ },
38
+ MAX_DEPTH: {
39
+ CARD_TOP: 50,
40
+ HEADER_TOP: 25,
41
+ CARD_SIDE: 8
42
+ }
43
+ };
44
+ const SnowfallContext = (0, import_react.createContext)(void 0);
45
+ function SnowfallProvider({ children }) {
46
+ const [isEnabled, setIsEnabled] = (0, import_react.useState)(true);
47
+ const [physicsConfig, setPhysicsConfig] = (0, import_react.useState)(DEFAULT_PHYSICS);
48
+ const toggleSnow = () => {
49
+ setIsEnabled((prev) => !prev);
50
+ };
51
+ const updatePhysicsConfig = (config) => {
52
+ setPhysicsConfig((prev) => ({
53
+ ...prev,
54
+ ...config,
55
+ ACCUMULATION: {
56
+ ...prev.ACCUMULATION,
57
+ ...config.ACCUMULATION || {}
58
+ },
59
+ MAX_DEPTH: {
60
+ ...prev.MAX_DEPTH,
61
+ ...config.MAX_DEPTH || {}
62
+ }
63
+ }));
64
+ };
65
+ const resetPhysics = () => {
66
+ setPhysicsConfig(DEFAULT_PHYSICS);
67
+ };
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SnowfallContext.Provider, { value: {
69
+ isEnabled,
70
+ toggleSnow,
71
+ physicsConfig,
72
+ updatePhysicsConfig,
73
+ resetPhysics
74
+ }, children });
75
+ }
76
+ function useSnowfall() {
77
+ const context = (0, import_react.useContext)(SnowfallContext);
78
+ if (context === void 0) {
79
+ throw new Error("useSnowfall must be used within a SnowfallProvider");
80
+ }
81
+ return context;
82
+ }
83
+ // Annotate the CommonJS export names for ESM import in node:
84
+ 0 && (module.exports = {
85
+ DEFAULT_PHYSICS,
86
+ SnowfallProvider,
87
+ useSnowfall
88
+ });
89
+ //# sourceMappingURL=SnowfallProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SnowfallProvider.tsx"],"sourcesContent":["'use client';\n\nimport React, { createContext, useContext, useState, ReactNode } from 'react';\n\nexport interface PhysicsConfig {\n MAX_FLAKES: number;\n MELT_SPEED: number;\n WIND_STRENGTH: number;\n ACCUMULATION: {\n SIDE_RATE: number;\n TOP_CARD_RATE: number;\n TOP_HEADER_RATE: number;\n };\n MAX_DEPTH: {\n CARD_TOP: number;\n HEADER_TOP: number;\n CARD_SIDE: number;\n };\n}\n\nexport const DEFAULT_PHYSICS: PhysicsConfig = {\n MAX_FLAKES: 500,\n MELT_SPEED: 0.00005,\n WIND_STRENGTH: 0.8,\n ACCUMULATION: {\n SIDE_RATE: 1.2,\n TOP_CARD_RATE: 1.9,\n TOP_HEADER_RATE: 1.2,\n },\n MAX_DEPTH: {\n CARD_TOP: 50,\n HEADER_TOP: 25,\n CARD_SIDE: 8,\n }\n};\n\ninterface SnowfallContextType {\n isEnabled: boolean;\n toggleSnow: () => void;\n physicsConfig: PhysicsConfig;\n updatePhysicsConfig: (config: Partial<PhysicsConfig>) => void;\n resetPhysics: () => void;\n}\n\nconst SnowfallContext = createContext<SnowfallContextType | undefined>(undefined);\n\nexport function SnowfallProvider({ children }: { children: ReactNode }) {\n const [isEnabled, setIsEnabled] = useState(true);\n const [physicsConfig, setPhysicsConfig] = useState<PhysicsConfig>(DEFAULT_PHYSICS);\n\n const toggleSnow = () => {\n setIsEnabled((prev) => !prev);\n };\n\n const updatePhysicsConfig = (config: Partial<PhysicsConfig>) => {\n setPhysicsConfig((prev) => ({\n ...prev,\n ...config,\n ACCUMULATION: {\n ...prev.ACCUMULATION,\n ...(config.ACCUMULATION || {}),\n },\n MAX_DEPTH: {\n ...prev.MAX_DEPTH,\n ...(config.MAX_DEPTH || {}),\n },\n }));\n };\n\n const resetPhysics = () => {\n setPhysicsConfig(DEFAULT_PHYSICS);\n };\n\n return (\n <SnowfallContext.Provider value={{\n isEnabled,\n toggleSnow,\n physicsConfig,\n updatePhysicsConfig,\n resetPhysics\n }}>\n {children}\n </SnowfallContext.Provider>\n );\n}\n\nexport function useSnowfall() {\n const context = useContext(SnowfallContext);\n if (context === undefined) {\n throw new Error('useSnowfall must be used within a SnowfallProvider');\n }\n return context;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0EQ;AAxER,mBAAsE;AAkB/D,MAAM,kBAAiC;AAAA,EAC1C,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,cAAc;AAAA,IACV,WAAW;AAAA,IACX,eAAe;AAAA,IACf,iBAAiB;AAAA,EACrB;AAAA,EACA,WAAW;AAAA,IACP,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,EACf;AACJ;AAUA,MAAM,sBAAkB,4BAA+C,MAAS;AAEzE,SAAS,iBAAiB,EAAE,SAAS,GAA4B;AACpE,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAC/C,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAwB,eAAe;AAEjF,QAAM,aAAa,MAAM;AACrB,iBAAa,CAAC,SAAS,CAAC,IAAI;AAAA,EAChC;AAEA,QAAM,sBAAsB,CAAC,WAAmC;AAC5D,qBAAiB,CAAC,UAAU;AAAA,MACxB,GAAG;AAAA,MACH,GAAG;AAAA,MACH,cAAc;AAAA,QACV,GAAG,KAAK;AAAA,QACR,GAAI,OAAO,gBAAgB,CAAC;AAAA,MAChC;AAAA,MACA,WAAW;AAAA,QACP,GAAG,KAAK;AAAA,QACR,GAAI,OAAO,aAAa,CAAC;AAAA,MAC7B;AAAA,IACJ,EAAE;AAAA,EACN;AAEA,QAAM,eAAe,MAAM;AACvB,qBAAiB,eAAe;AAAA,EACpC;AAEA,SACI,4CAAC,gBAAgB,UAAhB,EAAyB,OAAO;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,GACK,UACL;AAER;AAEO,SAAS,cAAc;AAC1B,QAAM,cAAU,yBAAW,eAAe;AAC1C,MAAI,YAAY,QAAW;AACvB,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACxE;AACA,SAAO;AACX;","names":[]}
@@ -0,0 +1,63 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext, useState } from "react";
4
+ const DEFAULT_PHYSICS = {
5
+ MAX_FLAKES: 500,
6
+ MELT_SPEED: 5e-5,
7
+ WIND_STRENGTH: 0.8,
8
+ ACCUMULATION: {
9
+ SIDE_RATE: 1.2,
10
+ TOP_CARD_RATE: 1.9,
11
+ TOP_HEADER_RATE: 1.2
12
+ },
13
+ MAX_DEPTH: {
14
+ CARD_TOP: 50,
15
+ HEADER_TOP: 25,
16
+ CARD_SIDE: 8
17
+ }
18
+ };
19
+ const SnowfallContext = createContext(void 0);
20
+ function SnowfallProvider({ children }) {
21
+ const [isEnabled, setIsEnabled] = useState(true);
22
+ const [physicsConfig, setPhysicsConfig] = useState(DEFAULT_PHYSICS);
23
+ const toggleSnow = () => {
24
+ setIsEnabled((prev) => !prev);
25
+ };
26
+ const updatePhysicsConfig = (config) => {
27
+ setPhysicsConfig((prev) => ({
28
+ ...prev,
29
+ ...config,
30
+ ACCUMULATION: {
31
+ ...prev.ACCUMULATION,
32
+ ...config.ACCUMULATION || {}
33
+ },
34
+ MAX_DEPTH: {
35
+ ...prev.MAX_DEPTH,
36
+ ...config.MAX_DEPTH || {}
37
+ }
38
+ }));
39
+ };
40
+ const resetPhysics = () => {
41
+ setPhysicsConfig(DEFAULT_PHYSICS);
42
+ };
43
+ return /* @__PURE__ */ jsx(SnowfallContext.Provider, { value: {
44
+ isEnabled,
45
+ toggleSnow,
46
+ physicsConfig,
47
+ updatePhysicsConfig,
48
+ resetPhysics
49
+ }, children });
50
+ }
51
+ function useSnowfall() {
52
+ const context = useContext(SnowfallContext);
53
+ if (context === void 0) {
54
+ throw new Error("useSnowfall must be used within a SnowfallProvider");
55
+ }
56
+ return context;
57
+ }
58
+ export {
59
+ DEFAULT_PHYSICS,
60
+ SnowfallProvider,
61
+ useSnowfall
62
+ };
63
+ //# sourceMappingURL=SnowfallProvider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SnowfallProvider.tsx"],"sourcesContent":["'use client';\n\nimport React, { createContext, useContext, useState, ReactNode } from 'react';\n\nexport interface PhysicsConfig {\n MAX_FLAKES: number;\n MELT_SPEED: number;\n WIND_STRENGTH: number;\n ACCUMULATION: {\n SIDE_RATE: number;\n TOP_CARD_RATE: number;\n TOP_HEADER_RATE: number;\n };\n MAX_DEPTH: {\n CARD_TOP: number;\n HEADER_TOP: number;\n CARD_SIDE: number;\n };\n}\n\nexport const DEFAULT_PHYSICS: PhysicsConfig = {\n MAX_FLAKES: 500,\n MELT_SPEED: 0.00005,\n WIND_STRENGTH: 0.8,\n ACCUMULATION: {\n SIDE_RATE: 1.2,\n TOP_CARD_RATE: 1.9,\n TOP_HEADER_RATE: 1.2,\n },\n MAX_DEPTH: {\n CARD_TOP: 50,\n HEADER_TOP: 25,\n CARD_SIDE: 8,\n }\n};\n\ninterface SnowfallContextType {\n isEnabled: boolean;\n toggleSnow: () => void;\n physicsConfig: PhysicsConfig;\n updatePhysicsConfig: (config: Partial<PhysicsConfig>) => void;\n resetPhysics: () => void;\n}\n\nconst SnowfallContext = createContext<SnowfallContextType | undefined>(undefined);\n\nexport function SnowfallProvider({ children }: { children: ReactNode }) {\n const [isEnabled, setIsEnabled] = useState(true);\n const [physicsConfig, setPhysicsConfig] = useState<PhysicsConfig>(DEFAULT_PHYSICS);\n\n const toggleSnow = () => {\n setIsEnabled((prev) => !prev);\n };\n\n const updatePhysicsConfig = (config: Partial<PhysicsConfig>) => {\n setPhysicsConfig((prev) => ({\n ...prev,\n ...config,\n ACCUMULATION: {\n ...prev.ACCUMULATION,\n ...(config.ACCUMULATION || {}),\n },\n MAX_DEPTH: {\n ...prev.MAX_DEPTH,\n ...(config.MAX_DEPTH || {}),\n },\n }));\n };\n\n const resetPhysics = () => {\n setPhysicsConfig(DEFAULT_PHYSICS);\n };\n\n return (\n <SnowfallContext.Provider value={{\n isEnabled,\n toggleSnow,\n physicsConfig,\n updatePhysicsConfig,\n resetPhysics\n }}>\n {children}\n </SnowfallContext.Provider>\n );\n}\n\nexport function useSnowfall() {\n const context = useContext(SnowfallContext);\n if (context === undefined) {\n throw new Error('useSnowfall must be used within a SnowfallProvider');\n }\n return context;\n}\n"],"mappings":";AA0EQ;AAxER,SAAgB,eAAe,YAAY,gBAA2B;AAkB/D,MAAM,kBAAiC;AAAA,EAC1C,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,cAAc;AAAA,IACV,WAAW;AAAA,IACX,eAAe;AAAA,IACf,iBAAiB;AAAA,EACrB;AAAA,EACA,WAAW;AAAA,IACP,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,EACf;AACJ;AAUA,MAAM,kBAAkB,cAA+C,MAAS;AAEzE,SAAS,iBAAiB,EAAE,SAAS,GAA4B;AACpE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAwB,eAAe;AAEjF,QAAM,aAAa,MAAM;AACrB,iBAAa,CAAC,SAAS,CAAC,IAAI;AAAA,EAChC;AAEA,QAAM,sBAAsB,CAAC,WAAmC;AAC5D,qBAAiB,CAAC,UAAU;AAAA,MACxB,GAAG;AAAA,MACH,GAAG;AAAA,MACH,cAAc;AAAA,QACV,GAAG,KAAK;AAAA,QACR,GAAI,OAAO,gBAAgB,CAAC;AAAA,MAChC;AAAA,MACA,WAAW;AAAA,QACP,GAAG,KAAK;AAAA,QACR,GAAI,OAAO,aAAa,CAAC;AAAA,MAC7B;AAAA,IACJ,EAAE;AAAA,EACN;AAEA,QAAM,eAAe,MAAM;AACvB,qBAAiB,eAAe;AAAA,EACpC;AAEA,SACI,oBAAC,gBAAgB,UAAhB,EAAyB,OAAO;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,GACK,UACL;AAER;AAEO,SAAS,cAAc;AAC1B,QAAM,UAAU,WAAW,eAAe;AAC1C,MAAI,YAAY,QAAW;AACvB,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACxE;AACA,SAAO;AACX;","names":[]}
@@ -0,0 +1,4 @@
1
+ export { default as Snowfall } from './Snowfall.mjs';
2
+ export { DEFAULT_PHYSICS, PhysicsConfig, SnowfallProvider, useSnowfall } from './SnowfallProvider.mjs';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
@@ -0,0 +1,4 @@
1
+ export { default as Snowfall } from './Snowfall.js';
2
+ export { DEFAULT_PHYSICS, PhysicsConfig, SnowfallProvider, useSnowfall } from './SnowfallProvider.js';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
package/dist/index.js ADDED
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ DEFAULT_PHYSICS: () => import_SnowfallProvider.DEFAULT_PHYSICS,
33
+ Snowfall: () => import_Snowfall.default,
34
+ SnowfallProvider: () => import_SnowfallProvider.SnowfallProvider,
35
+ useSnowfall: () => import_SnowfallProvider.useSnowfall
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+ var import_Snowfall = __toESM(require("./Snowfall"));
39
+ var import_SnowfallProvider = require("./SnowfallProvider");
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ DEFAULT_PHYSICS,
43
+ Snowfall,
44
+ SnowfallProvider,
45
+ useSnowfall
46
+ });
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["'use client';\n\nexport { default as Snowfall } from './Snowfall';\nexport { SnowfallProvider, useSnowfall, DEFAULT_PHYSICS } from './SnowfallProvider';\nexport type { PhysicsConfig } from './SnowfallProvider';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAAoC;AACpC,8BAA+D;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { default as default2 } from "./Snowfall";
3
+ import { SnowfallProvider, useSnowfall, DEFAULT_PHYSICS } from "./SnowfallProvider";
4
+ export {
5
+ DEFAULT_PHYSICS,
6
+ default2 as Snowfall,
7
+ SnowfallProvider,
8
+ useSnowfall
9
+ };
10
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["'use client';\n\nexport { default as Snowfall } from './Snowfall';\nexport { SnowfallProvider, useSnowfall, DEFAULT_PHYSICS } from './SnowfallProvider';\nexport type { PhysicsConfig } from './SnowfallProvider';\n"],"mappings":";AAEA,SAAoB,WAAXA,gBAA2B;AACpC,SAAS,kBAAkB,aAAa,uBAAuB;","names":["default"]}
@@ -0,0 +1,10 @@
1
+ declare const ATTR_SNOWFALL = "data-snowfall";
2
+ declare const VAL_IGNORE = "ignore";
3
+ declare const VAL_TOP = "top";
4
+ declare const VAL_BOTTOM = "bottom";
5
+ declare const TAG_HEADER = "header";
6
+ declare const TAG_FOOTER = "footer";
7
+ declare const ROLE_BANNER = "banner";
8
+ declare const ROLE_CONTENTINFO = "contentinfo";
9
+
10
+ export { ATTR_SNOWFALL, ROLE_BANNER, ROLE_CONTENTINFO, TAG_FOOTER, TAG_HEADER, VAL_BOTTOM, VAL_IGNORE, VAL_TOP };
@@ -0,0 +1,10 @@
1
+ declare const ATTR_SNOWFALL = "data-snowfall";
2
+ declare const VAL_IGNORE = "ignore";
3
+ declare const VAL_TOP = "top";
4
+ declare const VAL_BOTTOM = "bottom";
5
+ declare const TAG_HEADER = "header";
6
+ declare const TAG_FOOTER = "footer";
7
+ declare const ROLE_BANNER = "banner";
8
+ declare const ROLE_CONTENTINFO = "contentinfo";
9
+
10
+ export { ATTR_SNOWFALL, ROLE_BANNER, ROLE_CONTENTINFO, TAG_FOOTER, TAG_HEADER, VAL_BOTTOM, VAL_IGNORE, VAL_TOP };
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var constants_exports = {};
20
+ __export(constants_exports, {
21
+ ATTR_SNOWFALL: () => ATTR_SNOWFALL,
22
+ ROLE_BANNER: () => ROLE_BANNER,
23
+ ROLE_CONTENTINFO: () => ROLE_CONTENTINFO,
24
+ TAG_FOOTER: () => TAG_FOOTER,
25
+ TAG_HEADER: () => TAG_HEADER,
26
+ VAL_BOTTOM: () => VAL_BOTTOM,
27
+ VAL_IGNORE: () => VAL_IGNORE,
28
+ VAL_TOP: () => VAL_TOP
29
+ });
30
+ module.exports = __toCommonJS(constants_exports);
31
+ const ATTR_SNOWFALL = "data-snowfall";
32
+ const VAL_IGNORE = "ignore";
33
+ const VAL_TOP = "top";
34
+ const VAL_BOTTOM = "bottom";
35
+ const TAG_HEADER = "header";
36
+ const TAG_FOOTER = "footer";
37
+ const ROLE_BANNER = "banner";
38
+ const ROLE_CONTENTINFO = "contentinfo";
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ ATTR_SNOWFALL,
42
+ ROLE_BANNER,
43
+ ROLE_CONTENTINFO,
44
+ TAG_FOOTER,
45
+ TAG_HEADER,
46
+ VAL_BOTTOM,
47
+ VAL_IGNORE,
48
+ VAL_TOP
49
+ });
50
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/snowfall/constants.ts"],"sourcesContent":["export const ATTR_SNOWFALL = 'data-snowfall';\n\nexport const VAL_IGNORE = 'ignore';\nexport const VAL_TOP = 'top';\nexport const VAL_BOTTOM = 'bottom';\n\nexport const TAG_HEADER = 'header';\nexport const TAG_FOOTER = 'footer';\n\nexport const ROLE_BANNER = 'banner';\nexport const ROLE_CONTENTINFO = 'contentinfo';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,gBAAgB;AAEtB,MAAM,aAAa;AACnB,MAAM,UAAU;AAChB,MAAM,aAAa;AAEnB,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,MAAM,cAAc;AACpB,MAAM,mBAAmB;","names":[]}
@@ -0,0 +1,19 @@
1
+ const ATTR_SNOWFALL = "data-snowfall";
2
+ const VAL_IGNORE = "ignore";
3
+ const VAL_TOP = "top";
4
+ const VAL_BOTTOM = "bottom";
5
+ const TAG_HEADER = "header";
6
+ const TAG_FOOTER = "footer";
7
+ const ROLE_BANNER = "banner";
8
+ const ROLE_CONTENTINFO = "contentinfo";
9
+ export {
10
+ ATTR_SNOWFALL,
11
+ ROLE_BANNER,
12
+ ROLE_CONTENTINFO,
13
+ TAG_FOOTER,
14
+ TAG_HEADER,
15
+ VAL_BOTTOM,
16
+ VAL_IGNORE,
17
+ VAL_TOP
18
+ };
19
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/snowfall/constants.ts"],"sourcesContent":["export const ATTR_SNOWFALL = 'data-snowfall';\n\nexport const VAL_IGNORE = 'ignore';\nexport const VAL_TOP = 'top';\nexport const VAL_BOTTOM = 'bottom';\n\nexport const TAG_HEADER = 'header';\nexport const TAG_FOOTER = 'footer';\n\nexport const ROLE_BANNER = 'banner';\nexport const ROLE_CONTENTINFO = 'contentinfo';\n"],"mappings":"AAAO,MAAM,gBAAgB;AAEtB,MAAM,aAAa;AACnB,MAAM,UAAU;AAChB,MAAM,aAAa;AAEnB,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,MAAM,cAAc;AACpB,MAAM,mBAAmB;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { SnowfallSurface, SnowAccumulation, ElementSurface } from './types.mjs';
2
+
3
+ declare const getElementType: (el: Element) => SnowfallSurface;
4
+ declare const getAccumulationSurfaces: () => {
5
+ el: Element;
6
+ type: SnowfallSurface;
7
+ isFixed: boolean;
8
+ }[];
9
+ declare const getElementRects: (accumulationMap: Map<Element, SnowAccumulation>) => ElementSurface[];
10
+
11
+ export { getAccumulationSurfaces, getElementRects, getElementType };
@@ -0,0 +1,11 @@
1
+ import { SnowfallSurface, SnowAccumulation, ElementSurface } from './types.js';
2
+
3
+ declare const getElementType: (el: Element) => SnowfallSurface;
4
+ declare const getAccumulationSurfaces: () => {
5
+ el: Element;
6
+ type: SnowfallSurface;
7
+ isFixed: boolean;
8
+ }[];
9
+ declare const getElementRects: (accumulationMap: Map<Element, SnowAccumulation>) => ElementSurface[];
10
+
11
+ export { getAccumulationSurfaces, getElementRects, getElementType };