@hdcodedev/snowfall 1.0.0 → 1.0.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.
Files changed (50) hide show
  1. package/README.md +3 -1
  2. package/dist/index.d.mts +38 -4
  3. package/dist/index.d.ts +38 -4
  4. package/dist/index.js +661 -16
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +656 -3
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +2 -2
  9. package/dist/Snowfall.d.mts +0 -5
  10. package/dist/Snowfall.d.ts +0 -5
  11. package/dist/Snowfall.js +0 -162
  12. package/dist/Snowfall.js.map +0 -1
  13. package/dist/Snowfall.mjs +0 -142
  14. package/dist/Snowfall.mjs.map +0 -1
  15. package/dist/SnowfallProvider.d.mts +0 -32
  16. package/dist/SnowfallProvider.d.ts +0 -32
  17. package/dist/SnowfallProvider.js +0 -89
  18. package/dist/SnowfallProvider.js.map +0 -1
  19. package/dist/SnowfallProvider.mjs +0 -63
  20. package/dist/SnowfallProvider.mjs.map +0 -1
  21. package/dist/utils/snowfall/constants.d.mts +0 -10
  22. package/dist/utils/snowfall/constants.d.ts +0 -10
  23. package/dist/utils/snowfall/constants.js +0 -50
  24. package/dist/utils/snowfall/constants.js.map +0 -1
  25. package/dist/utils/snowfall/constants.mjs +0 -19
  26. package/dist/utils/snowfall/constants.mjs.map +0 -1
  27. package/dist/utils/snowfall/dom.d.mts +0 -11
  28. package/dist/utils/snowfall/dom.d.ts +0 -11
  29. package/dist/utils/snowfall/dom.js +0 -130
  30. package/dist/utils/snowfall/dom.js.map +0 -1
  31. package/dist/utils/snowfall/dom.mjs +0 -113
  32. package/dist/utils/snowfall/dom.mjs.map +0 -1
  33. package/dist/utils/snowfall/draw.d.mts +0 -7
  34. package/dist/utils/snowfall/draw.d.ts +0 -7
  35. package/dist/utils/snowfall/draw.js +0 -160
  36. package/dist/utils/snowfall/draw.js.map +0 -1
  37. package/dist/utils/snowfall/draw.mjs +0 -134
  38. package/dist/utils/snowfall/draw.mjs.map +0 -1
  39. package/dist/utils/snowfall/physics.d.mts +0 -11
  40. package/dist/utils/snowfall/physics.d.ts +0 -11
  41. package/dist/utils/snowfall/physics.js +0 -233
  42. package/dist/utils/snowfall/physics.js.map +0 -1
  43. package/dist/utils/snowfall/physics.mjs +0 -206
  44. package/dist/utils/snowfall/physics.mjs.map +0 -1
  45. package/dist/utils/snowfall/types.d.mts +0 -28
  46. package/dist/utils/snowfall/types.d.ts +0 -28
  47. package/dist/utils/snowfall/types.js +0 -17
  48. package/dist/utils/snowfall/types.js.map +0 -1
  49. package/dist/utils/snowfall/types.mjs +0 -1
  50. package/dist/utils/snowfall/types.mjs.map +0 -1
@@ -1,160 +0,0 @@
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 draw_exports = {};
20
- __export(draw_exports, {
21
- drawAccumulations: () => drawAccumulations,
22
- drawSideAccumulations: () => drawSideAccumulations,
23
- drawSnowflake: () => drawSnowflake
24
- });
25
- module.exports = __toCommonJS(draw_exports);
26
- var import_constants = require("./constants");
27
- const drawSnowflake = (ctx, flake) => {
28
- ctx.beginPath();
29
- ctx.arc(flake.x, flake.y, flake.radius, 0, Math.PI * 2);
30
- ctx.fillStyle = `rgba(255, 255, 255, ${flake.opacity})`;
31
- ctx.fill();
32
- ctx.beginPath();
33
- ctx.arc(flake.x, flake.y, flake.radius * 1.5, 0, Math.PI * 2);
34
- ctx.fillStyle = `rgba(255, 255, 255, ${flake.opacity * 0.2})`;
35
- ctx.fill();
36
- };
37
- const drawAccumulations = (ctx, fixedCtx, elementRects) => {
38
- const setupCtx = (c) => {
39
- c.fillStyle = "rgba(255, 255, 255, 0.95)";
40
- c.shadowColor = "rgba(200, 230, 255, 0.6)";
41
- c.shadowBlur = 4;
42
- c.shadowOffsetY = -1;
43
- };
44
- setupCtx(ctx);
45
- if (fixedCtx) setupCtx(fixedCtx);
46
- const scrollX = window.scrollX;
47
- const scrollY = window.scrollY;
48
- for (const { rect, acc } of elementRects) {
49
- if (!acc.heights.some((h) => h > 0.1)) continue;
50
- const useFixed = acc.isFixed && fixedCtx;
51
- const targetCtx = useFixed ? fixedCtx : ctx;
52
- const dx = useFixed ? -scrollX : 0;
53
- const dy = useFixed ? -scrollY : 0;
54
- const isBottom = acc.type === import_constants.VAL_BOTTOM;
55
- const baseY = isBottom ? rect.bottom - 1 : rect.top + 1;
56
- const borderRadius = acc.borderRadius;
57
- const getCurveOffset = (xPos) => {
58
- if (borderRadius <= 0 || isBottom) return 0;
59
- let offset = 0;
60
- if (xPos < borderRadius) {
61
- const dist = borderRadius - xPos;
62
- offset = borderRadius - Math.sqrt(Math.max(0, borderRadius * borderRadius - dist * dist));
63
- } else if (xPos > rect.width - borderRadius) {
64
- const dist = xPos - (rect.width - borderRadius);
65
- offset = borderRadius - Math.sqrt(Math.max(0, borderRadius * borderRadius - dist * dist));
66
- }
67
- return offset;
68
- };
69
- targetCtx.beginPath();
70
- let first = true;
71
- const step = 2;
72
- const len = acc.heights.length;
73
- for (let x = 0; x < len; x += step) {
74
- const height = acc.heights[x] || 0;
75
- const px = rect.left + x + dx;
76
- const py = baseY - height + getCurveOffset(x) + dy;
77
- if (first) {
78
- targetCtx.moveTo(px, py);
79
- first = false;
80
- } else {
81
- targetCtx.lineTo(px, py);
82
- }
83
- }
84
- if ((len - 1) % step !== 0) {
85
- const x = len - 1;
86
- const height = acc.heights[x] || 0;
87
- const px = rect.left + x + dx;
88
- const py = baseY - height + getCurveOffset(x) + dy;
89
- targetCtx.lineTo(px, py);
90
- }
91
- for (let x = len - 1; x >= 0; x -= step) {
92
- const px = rect.left + x + dx;
93
- const py = baseY + getCurveOffset(x) + dy;
94
- targetCtx.lineTo(px, py);
95
- }
96
- const startX = 0;
97
- const startPx = rect.left + startX + dx;
98
- const startPy = baseY + getCurveOffset(startX) + dy;
99
- targetCtx.lineTo(startPx, startPy);
100
- targetCtx.closePath();
101
- targetCtx.fill();
102
- }
103
- ctx.shadowBlur = 0;
104
- ctx.shadowOffsetY = 0;
105
- if (fixedCtx) {
106
- fixedCtx.shadowBlur = 0;
107
- fixedCtx.shadowOffsetY = 0;
108
- }
109
- };
110
- const drawSideAccumulations = (ctx, fixedCtx, elementRects) => {
111
- const setupCtx = (c) => {
112
- c.fillStyle = "rgba(255, 255, 255, 0.95)";
113
- c.shadowColor = "rgba(200, 230, 255, 0.6)";
114
- c.shadowBlur = 3;
115
- };
116
- setupCtx(ctx);
117
- if (fixedCtx) setupCtx(fixedCtx);
118
- const scrollX = window.scrollX;
119
- const scrollY = window.scrollY;
120
- for (const { rect, acc } of elementRects) {
121
- if (acc.maxSideHeight === 0) continue;
122
- const hasLeftSnow = acc.leftSide.some((h) => h > 0.3);
123
- const hasRightSnow = acc.rightSide.some((h) => h > 0.3);
124
- if (!hasLeftSnow && !hasRightSnow) continue;
125
- const useFixed = acc.isFixed && fixedCtx;
126
- const targetCtx = useFixed ? fixedCtx : ctx;
127
- const dx = useFixed ? -scrollX : 0;
128
- const dy = useFixed ? -scrollY : 0;
129
- const drawSide = (sideArray, isLeft) => {
130
- targetCtx.beginPath();
131
- const baseX = isLeft ? rect.left : rect.right;
132
- targetCtx.moveTo(baseX + dx, rect.top + dy);
133
- for (let y = 0; y < sideArray.length; y += 2) {
134
- const width = sideArray[y] || 0;
135
- const nextY = Math.min(y + 2, sideArray.length - 1);
136
- const nextWidth = sideArray[nextY] || 0;
137
- const py = rect.top + y + dy;
138
- const px = (isLeft ? baseX - width : baseX + width) + dx;
139
- const ny = rect.top + nextY + dy;
140
- const nx = (isLeft ? baseX - nextWidth : baseX + nextWidth) + dx;
141
- targetCtx.lineTo(px, py);
142
- targetCtx.lineTo(nx, ny);
143
- }
144
- targetCtx.lineTo(baseX + dx, rect.bottom + dy);
145
- targetCtx.closePath();
146
- targetCtx.fill();
147
- };
148
- if (hasLeftSnow) drawSide(acc.leftSide, true);
149
- if (hasRightSnow) drawSide(acc.rightSide, false);
150
- }
151
- ctx.shadowBlur = 0;
152
- if (fixedCtx) fixedCtx.shadowBlur = 0;
153
- };
154
- // Annotate the CommonJS export names for ESM import in node:
155
- 0 && (module.exports = {
156
- drawAccumulations,
157
- drawSideAccumulations,
158
- drawSnowflake
159
- });
160
- //# sourceMappingURL=draw.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/snowfall/draw.ts"],"sourcesContent":["import { Snowflake, ElementSurface } from './types';\nimport { VAL_BOTTOM } from './constants';\n\nexport const drawSnowflake = (ctx: CanvasRenderingContext2D, flake: Snowflake) => {\n ctx.beginPath();\n ctx.arc(flake.x, flake.y, flake.radius, 0, Math.PI * 2);\n ctx.fillStyle = `rgba(255, 255, 255, ${flake.opacity})`;\n ctx.fill();\n\n ctx.beginPath();\n ctx.arc(flake.x, flake.y, flake.radius * 1.5, 0, Math.PI * 2);\n ctx.fillStyle = `rgba(255, 255, 255, ${flake.opacity * 0.2})`;\n ctx.fill();\n};\n\nexport const drawAccumulations = (\n ctx: CanvasRenderingContext2D,\n fixedCtx: CanvasRenderingContext2D | null,\n elementRects: ElementSurface[]\n) => {\n // Setup styles for both contexts\n const setupCtx = (c: CanvasRenderingContext2D) => {\n c.fillStyle = 'rgba(255, 255, 255, 0.95)';\n c.shadowColor = 'rgba(200, 230, 255, 0.6)';\n c.shadowBlur = 4;\n c.shadowOffsetY = -1;\n };\n setupCtx(ctx);\n if (fixedCtx) setupCtx(fixedCtx);\n\n const scrollX = window.scrollX;\n const scrollY = window.scrollY;\n\n for (const { rect, acc } of elementRects) {\n if (!acc.heights.some(h => h > 0.1)) continue;\n\n const useFixed = acc.isFixed && fixedCtx;\n const targetCtx = useFixed ? fixedCtx! : ctx;\n\n // If using fixed context, we need to convert absolute coordinates (rect) back to viewport coordinates\n const dx = useFixed ? -scrollX : 0;\n const dy = useFixed ? -scrollY : 0;\n\n const isBottom = acc.type === VAL_BOTTOM;\n const baseY = isBottom ? rect.bottom - 1 : rect.top + 1;\n const borderRadius = acc.borderRadius;\n\n const getCurveOffset = (xPos: number) => {\n if (borderRadius <= 0 || isBottom) return 0;\n let offset = 0;\n if (xPos < borderRadius) {\n const dist = borderRadius - xPos;\n offset = borderRadius - Math.sqrt(Math.max(0, borderRadius * borderRadius - dist * dist));\n } else if (xPos > rect.width - borderRadius) {\n const dist = xPos - (rect.width - borderRadius);\n offset = borderRadius - Math.sqrt(Math.max(0, borderRadius * borderRadius - dist * dist));\n }\n return offset;\n };\n\n targetCtx.beginPath();\n let first = true;\n const step = 2;\n const len = acc.heights.length;\n\n for (let x = 0; x < len; x += step) {\n const height = acc.heights[x] || 0;\n const px = rect.left + x + dx;\n const py = baseY - height + getCurveOffset(x) + dy;\n if (first) {\n targetCtx.moveTo(px, py);\n first = false;\n } else {\n targetCtx.lineTo(px, py);\n }\n }\n\n if ((len - 1) % step !== 0) {\n const x = len - 1;\n const height = acc.heights[x] || 0;\n const px = rect.left + x + dx;\n const py = baseY - height + getCurveOffset(x) + dy;\n targetCtx.lineTo(px, py);\n }\n\n for (let x = len - 1; x >= 0; x -= step) {\n const px = rect.left + x + dx;\n const py = baseY + getCurveOffset(x) + dy;\n targetCtx.lineTo(px, py);\n }\n\n const startX = 0;\n const startPx = rect.left + startX + dx;\n const startPy = baseY + getCurveOffset(startX) + dy;\n targetCtx.lineTo(startPx, startPy);\n\n targetCtx.closePath();\n targetCtx.fill();\n }\n\n ctx.shadowBlur = 0;\n ctx.shadowOffsetY = 0;\n if (fixedCtx) {\n fixedCtx.shadowBlur = 0;\n fixedCtx.shadowOffsetY = 0;\n }\n};\n\nexport const drawSideAccumulations = (\n ctx: CanvasRenderingContext2D,\n fixedCtx: CanvasRenderingContext2D | null,\n elementRects: ElementSurface[]\n) => {\n const setupCtx = (c: CanvasRenderingContext2D) => {\n c.fillStyle = 'rgba(255, 255, 255, 0.95)';\n c.shadowColor = 'rgba(200, 230, 255, 0.6)';\n c.shadowBlur = 3;\n };\n setupCtx(ctx);\n if (fixedCtx) setupCtx(fixedCtx);\n\n const scrollX = window.scrollX;\n const scrollY = window.scrollY;\n\n for (const { rect, acc } of elementRects) {\n if (acc.maxSideHeight === 0) continue;\n\n const hasLeftSnow = acc.leftSide.some(h => h > 0.3);\n const hasRightSnow = acc.rightSide.some(h => h > 0.3);\n\n if (!hasLeftSnow && !hasRightSnow) continue;\n\n const useFixed = acc.isFixed && fixedCtx;\n const targetCtx = useFixed ? fixedCtx! : ctx;\n const dx = useFixed ? -scrollX : 0;\n const dy = useFixed ? -scrollY : 0;\n\n const drawSide = (sideArray: number[], isLeft: boolean) => {\n targetCtx.beginPath();\n const baseX = isLeft ? rect.left : rect.right;\n targetCtx.moveTo(baseX + dx, rect.top + dy);\n\n for (let y = 0; y < sideArray.length; y += 2) {\n const width = sideArray[y] || 0;\n const nextY = Math.min(y + 2, sideArray.length - 1);\n const nextWidth = sideArray[nextY] || 0;\n\n const py = rect.top + y + dy;\n const px = (isLeft ? baseX - width : baseX + width) + dx;\n const ny = rect.top + nextY + dy;\n const nx = (isLeft ? baseX - nextWidth : baseX + nextWidth) + dx;\n\n targetCtx.lineTo(px, py);\n targetCtx.lineTo(nx, ny);\n }\n targetCtx.lineTo(baseX + dx, rect.bottom + dy);\n targetCtx.closePath();\n targetCtx.fill();\n };\n\n if (hasLeftSnow) drawSide(acc.leftSide, true);\n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AAS;AACtD,cAAM,KAAK,KAAK,MAAM,QAAQ;AAC9B,cAAM,MAAM,SAAS,QAAQ,YAAY,QAAQ,aAAa;AAE9D,kBAAU,OAAO,IAAI,EAAE;AACvB,kBAAU,OAAO,IAAI,EAAE;AAAA,MAC3B;AACA,gBAAU,OAAO,QAAQ,IAAI,KAAK,SAAS,EAAE;AAC7C,gBAAU,UAAU;AACpB,gBAAU,KAAK;AAAA,IACnB;AAEA,QAAI,YAAa,UAAS,IAAI,UAAU,IAAI;AAC5C,QAAI,aAAc,UAAS,IAAI,WAAW,KAAK;AAAA,EACnD;AAEA,MAAI,aAAa;AACjB,MAAI,SAAU,UAAS,aAAa;AACxC;","names":[]}
@@ -1,134 +0,0 @@
1
- import { VAL_BOTTOM } from "./constants";
2
- const drawSnowflake = (ctx, flake) => {
3
- ctx.beginPath();
4
- ctx.arc(flake.x, flake.y, flake.radius, 0, Math.PI * 2);
5
- ctx.fillStyle = `rgba(255, 255, 255, ${flake.opacity})`;
6
- ctx.fill();
7
- ctx.beginPath();
8
- ctx.arc(flake.x, flake.y, flake.radius * 1.5, 0, Math.PI * 2);
9
- ctx.fillStyle = `rgba(255, 255, 255, ${flake.opacity * 0.2})`;
10
- ctx.fill();
11
- };
12
- const drawAccumulations = (ctx, fixedCtx, elementRects) => {
13
- const setupCtx = (c) => {
14
- c.fillStyle = "rgba(255, 255, 255, 0.95)";
15
- c.shadowColor = "rgba(200, 230, 255, 0.6)";
16
- c.shadowBlur = 4;
17
- c.shadowOffsetY = -1;
18
- };
19
- setupCtx(ctx);
20
- if (fixedCtx) setupCtx(fixedCtx);
21
- const scrollX = window.scrollX;
22
- const scrollY = window.scrollY;
23
- for (const { rect, acc } of elementRects) {
24
- if (!acc.heights.some((h) => h > 0.1)) continue;
25
- const useFixed = acc.isFixed && fixedCtx;
26
- const targetCtx = useFixed ? fixedCtx : ctx;
27
- const dx = useFixed ? -scrollX : 0;
28
- const dy = useFixed ? -scrollY : 0;
29
- const isBottom = acc.type === VAL_BOTTOM;
30
- const baseY = isBottom ? rect.bottom - 1 : rect.top + 1;
31
- const borderRadius = acc.borderRadius;
32
- const getCurveOffset = (xPos) => {
33
- if (borderRadius <= 0 || isBottom) return 0;
34
- let offset = 0;
35
- if (xPos < borderRadius) {
36
- const dist = borderRadius - xPos;
37
- offset = borderRadius - Math.sqrt(Math.max(0, borderRadius * borderRadius - dist * dist));
38
- } else if (xPos > rect.width - borderRadius) {
39
- const dist = xPos - (rect.width - borderRadius);
40
- offset = borderRadius - Math.sqrt(Math.max(0, borderRadius * borderRadius - dist * dist));
41
- }
42
- return offset;
43
- };
44
- targetCtx.beginPath();
45
- let first = true;
46
- const step = 2;
47
- const len = acc.heights.length;
48
- for (let x = 0; x < len; x += step) {
49
- const height = acc.heights[x] || 0;
50
- const px = rect.left + x + dx;
51
- const py = baseY - height + getCurveOffset(x) + dy;
52
- if (first) {
53
- targetCtx.moveTo(px, py);
54
- first = false;
55
- } else {
56
- targetCtx.lineTo(px, py);
57
- }
58
- }
59
- if ((len - 1) % step !== 0) {
60
- const x = len - 1;
61
- const height = acc.heights[x] || 0;
62
- const px = rect.left + x + dx;
63
- const py = baseY - height + getCurveOffset(x) + dy;
64
- targetCtx.lineTo(px, py);
65
- }
66
- for (let x = len - 1; x >= 0; x -= step) {
67
- const px = rect.left + x + dx;
68
- const py = baseY + getCurveOffset(x) + dy;
69
- targetCtx.lineTo(px, py);
70
- }
71
- const startX = 0;
72
- const startPx = rect.left + startX + dx;
73
- const startPy = baseY + getCurveOffset(startX) + dy;
74
- targetCtx.lineTo(startPx, startPy);
75
- targetCtx.closePath();
76
- targetCtx.fill();
77
- }
78
- ctx.shadowBlur = 0;
79
- ctx.shadowOffsetY = 0;
80
- if (fixedCtx) {
81
- fixedCtx.shadowBlur = 0;
82
- fixedCtx.shadowOffsetY = 0;
83
- }
84
- };
85
- const drawSideAccumulations = (ctx, fixedCtx, elementRects) => {
86
- const setupCtx = (c) => {
87
- c.fillStyle = "rgba(255, 255, 255, 0.95)";
88
- c.shadowColor = "rgba(200, 230, 255, 0.6)";
89
- c.shadowBlur = 3;
90
- };
91
- setupCtx(ctx);
92
- if (fixedCtx) setupCtx(fixedCtx);
93
- const scrollX = window.scrollX;
94
- const scrollY = window.scrollY;
95
- for (const { rect, acc } of elementRects) {
96
- if (acc.maxSideHeight === 0) continue;
97
- const hasLeftSnow = acc.leftSide.some((h) => h > 0.3);
98
- const hasRightSnow = acc.rightSide.some((h) => h > 0.3);
99
- if (!hasLeftSnow && !hasRightSnow) continue;
100
- const useFixed = acc.isFixed && fixedCtx;
101
- const targetCtx = useFixed ? fixedCtx : ctx;
102
- const dx = useFixed ? -scrollX : 0;
103
- const dy = useFixed ? -scrollY : 0;
104
- const drawSide = (sideArray, isLeft) => {
105
- targetCtx.beginPath();
106
- const baseX = isLeft ? rect.left : rect.right;
107
- targetCtx.moveTo(baseX + dx, rect.top + dy);
108
- for (let y = 0; y < sideArray.length; y += 2) {
109
- const width = sideArray[y] || 0;
110
- const nextY = Math.min(y + 2, sideArray.length - 1);
111
- const nextWidth = sideArray[nextY] || 0;
112
- const py = rect.top + y + dy;
113
- const px = (isLeft ? baseX - width : baseX + width) + dx;
114
- const ny = rect.top + nextY + dy;
115
- const nx = (isLeft ? baseX - nextWidth : baseX + nextWidth) + dx;
116
- targetCtx.lineTo(px, py);
117
- targetCtx.lineTo(nx, ny);
118
- }
119
- targetCtx.lineTo(baseX + dx, rect.bottom + dy);
120
- targetCtx.closePath();
121
- targetCtx.fill();
122
- };
123
- if (hasLeftSnow) drawSide(acc.leftSide, true);
124
- if (hasRightSnow) drawSide(acc.rightSide, false);
125
- }
126
- ctx.shadowBlur = 0;
127
- if (fixedCtx) fixedCtx.shadowBlur = 0;
128
- };
129
- export {
130
- drawAccumulations,
131
- drawSideAccumulations,
132
- drawSnowflake
133
- };
134
- //# sourceMappingURL=draw.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/snowfall/draw.ts"],"sourcesContent":["import { Snowflake, ElementSurface } from './types';\nimport { VAL_BOTTOM } from './constants';\n\nexport const drawSnowflake = (ctx: CanvasRenderingContext2D, flake: Snowflake) => {\n ctx.beginPath();\n ctx.arc(flake.x, flake.y, flake.radius, 0, Math.PI * 2);\n ctx.fillStyle = `rgba(255, 255, 255, ${flake.opacity})`;\n ctx.fill();\n\n ctx.beginPath();\n ctx.arc(flake.x, flake.y, flake.radius * 1.5, 0, Math.PI * 2);\n ctx.fillStyle = `rgba(255, 255, 255, ${flake.opacity * 0.2})`;\n ctx.fill();\n};\n\nexport const drawAccumulations = (\n ctx: CanvasRenderingContext2D,\n fixedCtx: CanvasRenderingContext2D | null,\n elementRects: ElementSurface[]\n) => {\n // Setup styles for both contexts\n const setupCtx = (c: CanvasRenderingContext2D) => {\n c.fillStyle = 'rgba(255, 255, 255, 0.95)';\n c.shadowColor = 'rgba(200, 230, 255, 0.6)';\n c.shadowBlur = 4;\n c.shadowOffsetY = -1;\n };\n setupCtx(ctx);\n if (fixedCtx) setupCtx(fixedCtx);\n\n const scrollX = window.scrollX;\n const scrollY = window.scrollY;\n\n for (const { rect, acc } of elementRects) {\n if (!acc.heights.some(h => h > 0.1)) continue;\n\n const useFixed = acc.isFixed && fixedCtx;\n const targetCtx = useFixed ? fixedCtx! : ctx;\n\n // If using fixed context, we need to convert absolute coordinates (rect) back to viewport coordinates\n const dx = useFixed ? -scrollX : 0;\n const dy = useFixed ? -scrollY : 0;\n\n const isBottom = acc.type === VAL_BOTTOM;\n const baseY = isBottom ? rect.bottom - 1 : rect.top + 1;\n const borderRadius = acc.borderRadius;\n\n const getCurveOffset = (xPos: number) => {\n if (borderRadius <= 0 || isBottom) return 0;\n let offset = 0;\n if (xPos < borderRadius) {\n const dist = borderRadius - xPos;\n offset = borderRadius - Math.sqrt(Math.max(0, borderRadius * borderRadius - dist * dist));\n } else if (xPos > rect.width - borderRadius) {\n const dist = xPos - (rect.width - borderRadius);\n offset = borderRadius - Math.sqrt(Math.max(0, borderRadius * borderRadius - dist * dist));\n }\n return offset;\n };\n\n targetCtx.beginPath();\n let first = true;\n const step = 2;\n const len = acc.heights.length;\n\n for (let x = 0; x < len; x += step) {\n const height = acc.heights[x] || 0;\n const px = rect.left + x + dx;\n const py = baseY - height + getCurveOffset(x) + dy;\n if (first) {\n targetCtx.moveTo(px, py);\n first = false;\n } else {\n targetCtx.lineTo(px, py);\n }\n }\n\n if ((len - 1) % step !== 0) {\n const x = len - 1;\n const height = acc.heights[x] || 0;\n const px = rect.left + x + dx;\n const py = baseY - height + getCurveOffset(x) + dy;\n targetCtx.lineTo(px, py);\n }\n\n for (let x = len - 1; x >= 0; x -= step) {\n const px = rect.left + x + dx;\n const py = baseY + getCurveOffset(x) + dy;\n targetCtx.lineTo(px, py);\n }\n\n const startX = 0;\n const startPx = rect.left + startX + dx;\n const startPy = baseY + getCurveOffset(startX) + dy;\n targetCtx.lineTo(startPx, startPy);\n\n targetCtx.closePath();\n targetCtx.fill();\n }\n\n ctx.shadowBlur = 0;\n ctx.shadowOffsetY = 0;\n if (fixedCtx) {\n fixedCtx.shadowBlur = 0;\n fixedCtx.shadowOffsetY = 0;\n }\n};\n\nexport const drawSideAccumulations = (\n ctx: CanvasRenderingContext2D,\n fixedCtx: CanvasRenderingContext2D | null,\n elementRects: ElementSurface[]\n) => {\n const setupCtx = (c: CanvasRenderingContext2D) => {\n c.fillStyle = 'rgba(255, 255, 255, 0.95)';\n c.shadowColor = 'rgba(200, 230, 255, 0.6)';\n c.shadowBlur = 3;\n };\n setupCtx(ctx);\n if (fixedCtx) setupCtx(fixedCtx);\n\n const scrollX = window.scrollX;\n const scrollY = window.scrollY;\n\n for (const { rect, acc } of elementRects) {\n if (acc.maxSideHeight === 0) continue;\n\n const hasLeftSnow = acc.leftSide.some(h => h > 0.3);\n const hasRightSnow = acc.rightSide.some(h => h > 0.3);\n\n if (!hasLeftSnow && !hasRightSnow) continue;\n\n const useFixed = acc.isFixed && fixedCtx;\n const targetCtx = useFixed ? fixedCtx! : ctx;\n const dx = useFixed ? -scrollX : 0;\n const dy = useFixed ? -scrollY : 0;\n\n const drawSide = (sideArray: number[], isLeft: boolean) => {\n targetCtx.beginPath();\n const baseX = isLeft ? rect.left : rect.right;\n targetCtx.moveTo(baseX + dx, rect.top + dy);\n\n for (let y = 0; y < sideArray.length; y += 2) {\n const width = sideArray[y] || 0;\n const nextY = Math.min(y + 2, sideArray.length - 1);\n const nextWidth = sideArray[nextY] || 0;\n\n const py = rect.top + y + dy;\n const px = (isLeft ? baseX - width : baseX + width) + dx;\n const ny = rect.top + nextY + dy;\n const nx = (isLeft ? baseX - nextWidth : baseX + nextWidth) + dx;\n\n targetCtx.lineTo(px, py);\n targetCtx.lineTo(nx, ny);\n }\n targetCtx.lineTo(baseX + dx, rect.bottom + dy);\n targetCtx.closePath();\n targetCtx.fill();\n };\n\n if (hasLeftSnow) drawSide(acc.leftSide, true);\n if (hasRightSnow) drawSide(acc.rightSide, false);\n }\n\n ctx.shadowBlur = 0;\n if (fixedCtx) fixedCtx.shadowBlur = 0;\n};\n"],"mappings":"AACA,SAAS,kBAAkB;AAEpB,MAAM,gBAAgB,CAAC,KAA+B,UAAqB;AAC9E,MAAI,UAAU;AACd,MAAI,IAAI,MAAM,GAAG,MAAM,GAAG,MAAM,QAAQ,GAAG,KAAK,KAAK,CAAC;AACtD,MAAI,YAAY,uBAAuB,MAAM,OAAO;AACpD,MAAI,KAAK;AAET,MAAI,UAAU;AACd,MAAI,IAAI,MAAM,GAAG,MAAM,GAAG,MAAM,SAAS,KAAK,GAAG,KAAK,KAAK,CAAC;AAC5D,MAAI,YAAY,uBAAuB,MAAM,UAAU,GAAG;AAC1D,MAAI,KAAK;AACb;AAEO,MAAM,oBAAoB,CAC7B,KACA,UACA,iBACC;AAED,QAAM,WAAW,CAAC,MAAgC;AAC9C,MAAE,YAAY;AACd,MAAE,cAAc;AAChB,MAAE,aAAa;AACf,MAAE,gBAAgB;AAAA,EACtB;AACA,WAAS,GAAG;AACZ,MA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zC,UAAM,KAAK,WAAW,CAAC,UAAU;AACjC,UAAM,KAAK,WAAW,CAAC,UAAU;AAEjC,UAAM,WAAW,CAAC,WAAqB,WAAoB;AACvD,gBAAU,UAAU;AACpB,YAAM,QAAQ,SAAS,KAAK,OAAO,KAAK;AACxC,gBAAU,OAAO,QAAQ,IAAI,KAAK,MAAM,EAAE;AAE1C,eAAS,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK,GAAG;AAC1C,cAAM,QAAQ,UAAU,CAAC,KAAK;AAC9B,cAAM,QAAQ,KAAK,IAAI,IAAI,GAAG,UAAU,SAAS,CAAC;AAClD,cAAM,YAAY,UAAU,KAAK,KAAK;AAEtC,cAAM,KAAK,KAAK,MAAM,IAAI;AAC1B,cAAM,MAAM,SAAS,QAAQ,QAAQ,QAAQ,SAAS;AACtD,cAAM,KAAK,KAAK,MAAM,QAAQ;AAC9B,cAAM,MAAM,SAAS,QAAQ,YAAY,QAAQ,aAAa;AAE9D,kBAAU,OAAO,IAAI,EAAE;AACvB,kBAAU,OAAO,IAAI,EAAE;AAAA,MAC3B;AACA,gBAAU,OAAO,QAAQ,IAAI,KAAK,SAAS,EAAE;AAC7C,gBAAU,UAAU;AACpB,gBAAU,KAAK;AAAA,IACnB;AAEA,QAAI,YAAa,UAAS,IAAI,UAAU,IAAI;AAC5C,QAAI,aAAc,UAAS,IAAI,WAAW,KAAK;AAAA,EACnD;AAEA,MAAI,aAAa;AACjB,MAAI,SAAU,UAAS,aAAa;AACxC;","names":[]}
@@ -1,11 +0,0 @@
1
- import { PhysicsConfig } from '../../SnowfallProvider.mjs';
2
- import { Snowflake, SnowAccumulation, ElementSurface } from './types.mjs';
3
- import 'react/jsx-runtime';
4
- import 'react';
5
-
6
- declare const createSnowflake: (canvasWidth: number, config: PhysicsConfig, isBackground?: boolean) => Snowflake;
7
- declare const initializeAccumulation: (accumulationMap: Map<Element, SnowAccumulation>, config: PhysicsConfig) => void;
8
- declare const updateSnowflakes: (snowflakes: Snowflake[], elementRects: ElementSurface[], config: PhysicsConfig, dt: number, canvasWidth: number, canvasHeight: number) => void;
9
- declare const meltAndSmoothAccumulation: (elementRects: ElementSurface[], config: PhysicsConfig, dt: number) => void;
10
-
11
- export { createSnowflake, initializeAccumulation, meltAndSmoothAccumulation, updateSnowflakes };
@@ -1,11 +0,0 @@
1
- import { PhysicsConfig } from '../../SnowfallProvider.js';
2
- import { Snowflake, SnowAccumulation, ElementSurface } from './types.js';
3
- import 'react/jsx-runtime';
4
- import 'react';
5
-
6
- declare const createSnowflake: (canvasWidth: number, config: PhysicsConfig, isBackground?: boolean) => Snowflake;
7
- declare const initializeAccumulation: (accumulationMap: Map<Element, SnowAccumulation>, config: PhysicsConfig) => void;
8
- declare const updateSnowflakes: (snowflakes: Snowflake[], elementRects: ElementSurface[], config: PhysicsConfig, dt: number, canvasWidth: number, canvasHeight: number) => void;
9
- declare const meltAndSmoothAccumulation: (elementRects: ElementSurface[], config: PhysicsConfig, dt: number) => void;
10
-
11
- export { createSnowflake, initializeAccumulation, meltAndSmoothAccumulation, updateSnowflakes };
@@ -1,233 +0,0 @@
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 physics_exports = {};
20
- __export(physics_exports, {
21
- createSnowflake: () => createSnowflake,
22
- initializeAccumulation: () => initializeAccumulation,
23
- meltAndSmoothAccumulation: () => meltAndSmoothAccumulation,
24
- updateSnowflakes: () => updateSnowflakes
25
- });
26
- module.exports = __toCommonJS(physics_exports);
27
- var import_dom = require("./dom");
28
- var import_constants = require("./constants");
29
- const createSnowflake = (canvasWidth, config, isBackground = false) => {
30
- if (isBackground) {
31
- const radius = Math.random() * 0.8 + 0.3;
32
- return {
33
- x: Math.random() * canvasWidth,
34
- y: window.scrollY - 5,
35
- radius,
36
- speed: radius * 0.3 + Math.random() * 0.2 + 0.2,
37
- wind: (Math.random() - 0.5) * (config.WIND_STRENGTH * 0.625),
38
- opacity: Math.random() * 0.2 + 0.2,
39
- wobble: Math.random() * Math.PI * 2,
40
- wobbleSpeed: Math.random() * 0.015 + 5e-3
41
- };
42
- } else {
43
- const radius = Math.random() * 2 + 0.5;
44
- return {
45
- x: Math.random() * canvasWidth,
46
- y: window.scrollY - 5,
47
- radius,
48
- speed: radius * 0.5 + Math.random() * 0.3 + 0.5,
49
- wind: (Math.random() - 0.5) * config.WIND_STRENGTH,
50
- opacity: Math.random() * 0.3 + 0.5,
51
- wobble: Math.random() * Math.PI * 2,
52
- wobbleSpeed: Math.random() * 0.02 + 0.01
53
- };
54
- }
55
- };
56
- const initializeAccumulation = (accumulationMap, config) => {
57
- const elements = (0, import_dom.getAccumulationSurfaces)();
58
- for (const [el] of accumulationMap.entries()) {
59
- if (!el.isConnected) {
60
- accumulationMap.delete(el);
61
- }
62
- }
63
- elements.forEach(({ el, type, isFixed }) => {
64
- const existing = accumulationMap.get(el);
65
- const rect = el.getBoundingClientRect();
66
- const width = Math.ceil(rect.width);
67
- const isBottom = type === import_constants.VAL_BOTTOM;
68
- if (existing && existing.heights.length === width) {
69
- existing.type = type;
70
- existing.isFixed = isFixed;
71
- if (existing.borderRadius !== void 0) {
72
- const styleBuffer = window.getComputedStyle(el);
73
- existing.borderRadius = parseFloat(styleBuffer.borderTopLeftRadius) || 0;
74
- }
75
- return;
76
- }
77
- const height = Math.ceil(rect.height);
78
- const baseMax = isBottom ? config.MAX_DEPTH.HEADER_TOP : config.MAX_DEPTH.CARD_TOP;
79
- const styles = window.getComputedStyle(el);
80
- const borderRadius = parseFloat(styles.borderTopLeftRadius) || 0;
81
- let maxHeights = new Array(width);
82
- for (let i = 0; i < width; i++) {
83
- let edgeFactor = 1;
84
- if (!isBottom && borderRadius > 0) {
85
- if (i < borderRadius) {
86
- edgeFactor = Math.pow(i / borderRadius, 1.2);
87
- } else if (i > width - borderRadius) {
88
- edgeFactor = Math.pow((width - i) / borderRadius, 1.2);
89
- }
90
- }
91
- maxHeights[i] = baseMax * edgeFactor * (0.85 + Math.random() * 0.15);
92
- }
93
- const smoothPasses = 4;
94
- for (let p = 0; p < smoothPasses; p++) {
95
- const smoothed = [...maxHeights];
96
- for (let i = 1; i < width - 1; i++) {
97
- smoothed[i] = (maxHeights[i - 1] + maxHeights[i] + maxHeights[i + 1]) / 3;
98
- }
99
- maxHeights = smoothed;
100
- }
101
- accumulationMap.set(el, {
102
- heights: existing?.heights.length === width ? existing.heights : new Array(width).fill(0),
103
- maxHeights,
104
- leftSide: existing?.leftSide.length === height ? existing.leftSide : new Array(height).fill(0),
105
- rightSide: existing?.rightSide.length === height ? existing.rightSide : new Array(height).fill(0),
106
- maxSideHeight: isBottom ? 0 : config.MAX_DEPTH.CARD_SIDE,
107
- borderRadius,
108
- type,
109
- isFixed
110
- });
111
- });
112
- };
113
- const accumulateSide = (sideArray, rectHeight, localY, maxSideHeight, borderRadius, config) => {
114
- const spread = 4;
115
- const addHeight = config.ACCUMULATION.SIDE_RATE * (0.8 + Math.random() * 0.4);
116
- for (let dy = -spread; dy <= spread; dy++) {
117
- const y = localY + dy;
118
- if (y >= 0 && y < sideArray.length) {
119
- const inTop = y < borderRadius;
120
- const inBottom = y > rectHeight - borderRadius;
121
- if (borderRadius > 0 && (inTop || inBottom)) continue;
122
- const normalizedDist = Math.abs(dy) / spread;
123
- const falloff = (Math.cos(normalizedDist * Math.PI) + 1) / 2;
124
- sideArray[y] = Math.min(maxSideHeight, sideArray[y] + addHeight * falloff);
125
- }
126
- }
127
- };
128
- const updateSnowflakes = (snowflakes, elementRects, config, dt, canvasWidth, canvasHeight) => {
129
- for (let i = snowflakes.length - 1; i >= 0; i--) {
130
- const flake = snowflakes[i];
131
- flake.wobble += flake.wobbleSpeed * dt;
132
- flake.x += (flake.wind + Math.sin(flake.wobble) * 0.5) * dt;
133
- flake.y += (flake.speed + Math.cos(flake.wobble * 0.5) * 0.1) * dt;
134
- let landed = false;
135
- for (const { rect, acc } of elementRects) {
136
- const isBottom = acc.type === import_constants.VAL_BOTTOM;
137
- if (!landed && acc.maxSideHeight > 0 && !isBottom) {
138
- const isInVerticalBounds = flake.y >= rect.top && flake.y <= rect.bottom;
139
- if (isInVerticalBounds) {
140
- const localY = Math.floor(flake.y - rect.top);
141
- const borderRadius = acc.borderRadius;
142
- const isInTopCorner = localY < borderRadius;
143
- const isInBottomCorner = localY > rect.height - borderRadius;
144
- const isCorner = borderRadius > 0 && (isInTopCorner || isInBottomCorner);
145
- if (flake.x >= rect.left - 5 && flake.x < rect.left + 3) {
146
- if (!isCorner) {
147
- accumulateSide(acc.leftSide, rect.height, localY, acc.maxSideHeight, borderRadius, config);
148
- landed = true;
149
- }
150
- }
151
- if (!landed && flake.x > rect.right - 3 && flake.x <= rect.right + 5) {
152
- if (!isCorner) {
153
- accumulateSide(acc.rightSide, rect.height, localY, acc.maxSideHeight, borderRadius, config);
154
- landed = true;
155
- }
156
- }
157
- if (landed) break;
158
- }
159
- }
160
- if (flake.x >= rect.left && flake.x <= rect.right) {
161
- const localX = Math.floor(flake.x - rect.left);
162
- const currentHeight = acc.heights[localX] || 0;
163
- const maxHeight = acc.maxHeights[localX] || 5;
164
- const surfaceY = isBottom ? rect.bottom - currentHeight : rect.top - currentHeight;
165
- if (flake.y >= surfaceY && flake.y < surfaceY + 10 && currentHeight < maxHeight) {
166
- const shouldAccumulate = isBottom ? Math.random() < 0.15 : true;
167
- if (shouldAccumulate) {
168
- const baseSpread = Math.ceil(flake.radius);
169
- const spread = baseSpread + Math.floor(Math.random() * 2);
170
- const accumRate = isBottom ? config.ACCUMULATION.TOP_HEADER_RATE : config.ACCUMULATION.TOP_CARD_RATE;
171
- const centerOffset = Math.floor(Math.random() * 3) - 1;
172
- for (let dx = -spread; dx <= spread; dx++) {
173
- if (Math.random() < 0.15) continue;
174
- const idx = localX + dx + centerOffset;
175
- if (idx >= 0 && idx < acc.heights.length) {
176
- const dist = Math.abs(dx);
177
- const pixelMax = acc.maxHeights[idx] || 5;
178
- const normDist = dist / spread;
179
- const falloff = (Math.cos(normDist * Math.PI) + 1) / 2;
180
- const baseAdd = 0.3 * falloff;
181
- const randomFactor = 0.8 + Math.random() * 0.4;
182
- const addHeight = baseAdd * randomFactor * accumRate;
183
- if (acc.heights[idx] < pixelMax && addHeight > 0) {
184
- acc.heights[idx] = Math.min(pixelMax, acc.heights[idx] + addHeight);
185
- }
186
- }
187
- }
188
- if (isBottom) {
189
- landed = true;
190
- break;
191
- }
192
- }
193
- if (!isBottom) {
194
- landed = true;
195
- break;
196
- }
197
- }
198
- }
199
- }
200
- if (landed || flake.y > canvasHeight + 10 || flake.x < -20 || flake.x > canvasWidth + 20) {
201
- snowflakes.splice(i, 1);
202
- }
203
- }
204
- };
205
- const meltAndSmoothAccumulation = (elementRects, config, dt) => {
206
- for (const { acc } of elementRects) {
207
- const meltRate = config.MELT_SPEED * dt;
208
- const len = acc.heights.length;
209
- if (len > 2) {
210
- for (let i = 1; i < len - 1; i++) {
211
- if (acc.heights[i] > 0.05) {
212
- const avg = (acc.heights[i - 1] + acc.heights[i + 1]) / 2;
213
- acc.heights[i] = acc.heights[i] * 0.99 + avg * 0.01;
214
- }
215
- }
216
- }
217
- for (let i = 0; i < acc.heights.length; i++) {
218
- if (acc.heights[i] > 0) acc.heights[i] = Math.max(0, acc.heights[i] - meltRate);
219
- }
220
- for (let i = 0; i < acc.leftSide.length; i++) {
221
- if (acc.leftSide[i] > 0) acc.leftSide[i] = Math.max(0, acc.leftSide[i] - meltRate);
222
- if (acc.rightSide[i] > 0) acc.rightSide[i] = Math.max(0, acc.rightSide[i] - meltRate);
223
- }
224
- }
225
- };
226
- // Annotate the CommonJS export names for ESM import in node:
227
- 0 && (module.exports = {
228
- createSnowflake,
229
- initializeAccumulation,
230
- meltAndSmoothAccumulation,
231
- updateSnowflakes
232
- });
233
- //# sourceMappingURL=physics.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/snowfall/physics.ts"],"sourcesContent":["import { PhysicsConfig } from '../../SnowfallProvider';\nimport { Snowflake, SnowAccumulation, ElementSurface } from './types';\nimport { getAccumulationSurfaces } from './dom';\nimport { VAL_BOTTOM } from './constants';\n\nexport const createSnowflake = (\n canvasWidth: number,\n config: PhysicsConfig,\n isBackground: boolean = false\n): Snowflake => {\n if (isBackground) {\n const radius = Math.random() * 0.8 + 0.3;\n return {\n x: Math.random() * canvasWidth,\n y: window.scrollY - 5,\n radius,\n speed: radius * 0.3 + Math.random() * 0.2 + 0.2,\n wind: (Math.random() - 0.5) * (config.WIND_STRENGTH * 0.625),\n opacity: Math.random() * 0.2 + 0.2,\n wobble: Math.random() * Math.PI * 2,\n wobbleSpeed: Math.random() * 0.015 + 0.005,\n };\n } else {\n const radius = Math.random() * 2 + 0.5;\n return {\n x: Math.random() * canvasWidth,\n y: window.scrollY - 5,\n radius,\n speed: radius * 0.5 + Math.random() * 0.3 + 0.5,\n wind: (Math.random() - 0.5) * config.WIND_STRENGTH,\n opacity: Math.random() * 0.3 + 0.5,\n wobble: Math.random() * Math.PI * 2,\n wobbleSpeed: Math.random() * 0.02 + 0.01,\n };\n }\n};\n\nexport const initializeAccumulation = (\n accumulationMap: Map<Element, SnowAccumulation>,\n config: PhysicsConfig\n) => {\n const elements = getAccumulationSurfaces();\n // Prune disconnected elements\n for (const [el] of accumulationMap.entries()) {\n if (!el.isConnected) {\n accumulationMap.delete(el);\n }\n }\n\n elements.forEach(({ el, type, isFixed }) => {\n const existing = accumulationMap.get(el);\n const rect = el.getBoundingClientRect();\n const width = Math.ceil(rect.width);\n const isBottom = type === VAL_BOTTOM;\n\n if (existing && existing.heights.length === width) {\n existing.type = type;\n existing.isFixed = isFixed;\n if (existing.borderRadius !== undefined) {\n const styleBuffer = window.getComputedStyle(el); // Potentially slow in loop, strictly necessary?\n existing.borderRadius = parseFloat(styleBuffer.borderTopLeftRadius) || 0;\n }\n return;\n }\n\n const height = Math.ceil(rect.height);\n const baseMax = isBottom ? config.MAX_DEPTH.HEADER_TOP : config.MAX_DEPTH.CARD_TOP;\n\n const styles = window.getComputedStyle(el);\n const borderRadius = parseFloat(styles.borderTopLeftRadius) || 0;\n\n let maxHeights = new Array(width);\n for (let i = 0; i < width; i++) {\n let edgeFactor = 1.0;\n if (!isBottom && borderRadius > 0) {\n if (i < borderRadius) {\n edgeFactor = Math.pow(i / borderRadius, 1.2);\n } else if (i > width - borderRadius) {\n edgeFactor = Math.pow((width - i) / borderRadius, 1.2);\n }\n }\n maxHeights[i] = baseMax * edgeFactor * (0.85 + Math.random() * 0.15);\n }\n\n // Smooth maxHeights\n const smoothPasses = 4;\n for (let p = 0; p < smoothPasses; p++) {\n const smoothed = [...maxHeights];\n for (let i = 1; i < width - 1; i++) {\n smoothed[i] = (maxHeights[i - 1] + maxHeights[i] + maxHeights[i + 1]) / 3;\n }\n maxHeights = smoothed;\n }\n\n accumulationMap.set(el, {\n heights: existing?.heights.length === width ? existing.heights : new Array(width).fill(0),\n maxHeights,\n leftSide: existing?.leftSide.length === height ? existing.leftSide : new Array(height).fill(0),\n rightSide: existing?.rightSide.length === height ? existing.rightSide : new Array(height).fill(0),\n maxSideHeight: isBottom ? 0 : config.MAX_DEPTH.CARD_SIDE,\n borderRadius,\n type,\n isFixed,\n });\n });\n};\n\nconst accumulateSide = (\n sideArray: number[],\n rectHeight: number,\n localY: number,\n maxSideHeight: number,\n borderRadius: number,\n config: PhysicsConfig\n) => {\n const spread = 4;\n const addHeight = config.ACCUMULATION.SIDE_RATE * (0.8 + Math.random() * 0.4);\n\n for (let dy = -spread; dy <= spread; dy++) {\n const y = localY + dy;\n if (y >= 0 && y < sideArray.length) {\n const inTop = y < borderRadius;\n const inBottom = y > rectHeight - borderRadius;\n if (borderRadius > 0 && (inTop || inBottom)) continue;\n\n const normalizedDist = Math.abs(dy) / spread;\n const falloff = (Math.cos(normalizedDist * Math.PI) + 1) / 2;\n sideArray[y] = Math.min(maxSideHeight, sideArray[y] + addHeight * falloff);\n }\n }\n};\n\nexport const updateSnowflakes = (\n snowflakes: Snowflake[],\n elementRects: ElementSurface[],\n config: PhysicsConfig,\n dt: number,\n canvasWidth: number,\n canvasHeight: number\n) => {\n for (let i = snowflakes.length - 1; i >= 0; i--) {\n const flake = snowflakes[i];\n\n flake.wobble += flake.wobbleSpeed * dt;\n flake.x += (flake.wind + Math.sin(flake.wobble) * 0.5) * dt;\n flake.y += (flake.speed + Math.cos(flake.wobble * 0.5) * 0.1) * dt;\n\n let landed = false;\n\n for (const { rect, acc } of elementRects) {\n const isBottom = acc.type === VAL_BOTTOM;\n\n // Side collisions\n if (!landed && acc.maxSideHeight > 0 && !isBottom) {\n const isInVerticalBounds = flake.y >= rect.top && flake.y <= rect.bottom;\n\n if (isInVerticalBounds) {\n const localY = Math.floor(flake.y - rect.top);\n const borderRadius = acc.borderRadius;\n\n const isInTopCorner = localY < borderRadius;\n const isInBottomCorner = localY > rect.height - borderRadius;\n const isCorner = borderRadius > 0 && (isInTopCorner || isInBottomCorner);\n\n if (flake.x >= rect.left - 5 && flake.x < rect.left + 3) {\n if (!isCorner) {\n accumulateSide(acc.leftSide, rect.height, localY, acc.maxSideHeight, borderRadius, config);\n landed = true;\n }\n }\n\n if (!landed && flake.x > rect.right - 3 && flake.x <= rect.right + 5) {\n if (!isCorner) {\n accumulateSide(acc.rightSide, rect.height, localY, acc.maxSideHeight, borderRadius, config);\n landed = true;\n }\n }\n\n if (landed) break;\n }\n }\n\n // Top accumulation\n if (flake.x >= rect.left && flake.x <= rect.right) {\n const localX = Math.floor(flake.x - rect.left);\n const currentHeight = acc.heights[localX] || 0;\n const maxHeight = acc.maxHeights[localX] || 5;\n\n const surfaceY = isBottom ? rect.bottom - currentHeight : rect.top - currentHeight;\n\n if (flake.y >= surfaceY && flake.y < surfaceY + 10 && currentHeight < maxHeight) {\n const shouldAccumulate = isBottom ? Math.random() < 0.15 : true;\n\n if (shouldAccumulate) {\n const baseSpread = Math.ceil(flake.radius);\n const spread = baseSpread + Math.floor(Math.random() * 2);\n const accumRate = isBottom ? config.ACCUMULATION.TOP_HEADER_RATE : config.ACCUMULATION.TOP_CARD_RATE;\n const centerOffset = Math.floor(Math.random() * 3) - 1;\n\n for (let dx = -spread; dx <= spread; dx++) {\n if (Math.random() < 0.15) continue;\n const idx = localX + dx + centerOffset;\n if (idx >= 0 && idx < acc.heights.length) {\n const dist = Math.abs(dx);\n const pixelMax = acc.maxHeights[idx] || 5;\n\n const normDist = dist / spread;\n const falloff = (Math.cos(normDist * Math.PI) + 1) / 2;\n const baseAdd = 0.3 * falloff;\n\n const randomFactor = 0.8 + Math.random() * 0.4;\n const addHeight = baseAdd * randomFactor * accumRate;\n\n if (acc.heights[idx] < pixelMax && addHeight > 0) {\n acc.heights[idx] = Math.min(pixelMax, acc.heights[idx] + addHeight);\n }\n }\n }\n\n if (isBottom) {\n landed = true;\n break;\n }\n }\n\n if (!isBottom) {\n landed = true;\n break;\n }\n }\n }\n }\n\n if (landed || flake.y > canvasHeight + 10 || flake.x < -20 || flake.x > canvasWidth + 20) {\n snowflakes.splice(i, 1);\n }\n }\n};\n\nexport const meltAndSmoothAccumulation = (\n elementRects: ElementSurface[],\n config: PhysicsConfig,\n dt: number\n) => {\n for (const { acc } of elementRects) {\n const meltRate = config.MELT_SPEED * dt;\n const len = acc.heights.length;\n\n // Smooth\n if (len > 2) {\n for (let i = 1; i < len - 1; i++) {\n if (acc.heights[i] > 0.05) {\n const avg = (acc.heights[i - 1] + acc.heights[i + 1]) / 2;\n acc.heights[i] = acc.heights[i] * 0.99 + avg * 0.01;\n }\n }\n }\n\n // Melt\n for (let i = 0; i < acc.heights.length; i++) {\n if (acc.heights[i] > 0) acc.heights[i] = Math.max(0, acc.heights[i] - meltRate);\n }\n for (let i = 0; i < acc.leftSide.length; i++) {\n if (acc.leftSide[i] > 0) acc.leftSide[i] = Math.max(0, acc.leftSide[i] - meltRate);\n if (acc.rightSide[i] > 0) acc.rightSide[i] = Math.max(0, acc.rightSide[i] - meltRate);\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAwC;AACxC,uBAA2B;AAEpB,MAAM,kBAAkB,CAC3B,aACA,QACA,eAAwB,UACZ;AACZ,MAAI,cAAc;AACd,UAAM,SAAS,KAAK,OAAO,IAAI,MAAM;AACrC,WAAO;AAAA,MACH,GAAG,KAAK,OAAO,IAAI;AAAA,MACnB,GAAG,OAAO,UAAU;AAAA,MACpB;AAAA,MACA,OAAO,SAAS,MAAM,KAAK,OAAO,IAAI,MAAM;AAAA,MAC5C,OAAO,KAAK,OAAO,IAAI,QAAQ,OAAO,gBAAgB;AAAA,MACtD,SAAS,KAAK,OAAO,IAAI,MAAM;AAAA,MAC/B,QAAQ,KAAK,OAAO,IAAI,KAAK,KAAK;AAAA,MAClC,aAAa,KAAK,OAAO,IAAI,QAAQ;AAAA,IACzC;AAAA,EACJ,OAAO;AACH,UAAM,SAAS,KAAK,OAAO,IAAI,IAAI;AACnC,WAAO;AAAA,MACH,GAAG,KAAK,OAAO,IAAI;AAAA,MACnB,GAAG,OAAO,UAAU;AAAA,MACpB;AAAA,MACA,OAAO,SAAS,MAAM,KAAK,OAAO,IAAI,MAAM;AAAA,MAC5C,OAAO,KAAK,OAAO,IAAI,OAAO,OAAO;AAAA,MACrC,SAAS,KAAK,OAAO,IAAI,MAAM;AAAA,MAC/B,QAAQ,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