@moontra/moonui-pro 3.3.18 → 3.3.20

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/index.mjs CHANGED
@@ -88920,76 +88920,41 @@ var MeshGradientInternal = ({
88920
88920
  const canvas = canvasRef.current;
88921
88921
  if (!canvas)
88922
88922
  return;
88923
+ const width = canvas.width > 0 ? canvas.width : 800;
88924
+ const height = canvas.height > 0 ? canvas.height : 600;
88923
88925
  const points = [];
88924
88926
  const totalPoints = complexity;
88925
88927
  for (let i = 0; i < totalPoints; i++) {
88926
88928
  const angle = i / totalPoints * Math.PI * 2;
88927
88929
  const distance = Math.random() * 0.5 + 0.2;
88928
88930
  points.push({
88929
- x: canvas.width / 2 + Math.cos(angle) * distance * canvas.width,
88930
- y: canvas.height / 2 + Math.sin(angle) * distance * canvas.height,
88931
+ x: width / 2 + Math.cos(angle) * distance * width,
88932
+ y: height / 2 + Math.sin(angle) * distance * height,
88931
88933
  vx: (Math.random() - 0.5) * speed,
88932
88934
  vy: (Math.random() - 0.5) * speed,
88933
88935
  color: colors[i % colors.length],
88934
- radius: (canvas.width + canvas.height) / 4,
88936
+ radius: Math.max(100, (width + height) / 4),
88935
88937
  phase: i / totalPoints * Math.PI * 2
88936
88938
  });
88937
88939
  }
88938
88940
  meshPointsRef.current = points;
88939
88941
  }, [colors, complexity, speed]);
88940
- const adjustColor = useCallback((color) => {
88942
+ const adjustColor = useCallback((color, alpha2 = 1) => {
88941
88943
  const hex = color.replace("#", "");
88942
88944
  const r2 = parseInt(hex.substring(0, 2), 16);
88943
88945
  const g = parseInt(hex.substring(2, 4), 16);
88944
88946
  const b = parseInt(hex.substring(4, 6), 16);
88945
- const max2 = Math.max(r2, g, b);
88946
- const min2 = Math.min(r2, g, b);
88947
- const delta = max2 - min2;
88948
- let h2 = 0, s = 0, l = (max2 + min2) / 510;
88949
- if (delta !== 0) {
88950
- s = delta / (510 - Math.abs(max2 + min2 - 510));
88951
- if (max2 === r2)
88952
- h2 = ((g - b) / delta + (g < b ? 6 : 0)) / 6;
88953
- else if (max2 === g)
88954
- h2 = ((b - r2) / delta + 2) / 6;
88955
- else
88956
- h2 = ((r2 - g) / delta + 4) / 6;
88957
- }
88958
- s *= saturation;
88959
- l *= brightness;
88960
- const c2 = (1 - Math.abs(2 * l - 1)) * s;
88961
- const x = c2 * (1 - Math.abs(h2 * 6 % 2 - 1));
88962
- const m = l - c2 / 2;
88963
- let r1 = 0, g1 = 0, b1 = 0;
88964
- if (h2 < 1 / 6) {
88965
- r1 = c2;
88966
- g1 = x;
88967
- b1 = 0;
88968
- } else if (h2 < 2 / 6) {
88969
- r1 = x;
88970
- g1 = c2;
88971
- b1 = 0;
88972
- } else if (h2 < 3 / 6) {
88973
- r1 = 0;
88974
- g1 = c2;
88975
- b1 = x;
88976
- } else if (h2 < 4 / 6) {
88977
- r1 = 0;
88978
- g1 = x;
88979
- b1 = c2;
88980
- } else if (h2 < 5 / 6) {
88981
- r1 = x;
88982
- g1 = 0;
88983
- b1 = c2;
88984
- } else {
88985
- r1 = c2;
88986
- g1 = 0;
88987
- b1 = x;
88988
- }
88989
- const finalR = Math.round((r1 + m) * 255);
88990
- const finalG = Math.round((g1 + m) * 255);
88991
- const finalB = Math.round((b1 + m) * 255);
88992
- return `rgb(${finalR}, ${finalG}, ${finalB})`;
88947
+ const adjustedR = Math.min(255, Math.max(0, r2 * brightness));
88948
+ const adjustedG = Math.min(255, Math.max(0, g * brightness));
88949
+ const adjustedB = Math.min(255, Math.max(0, b * brightness));
88950
+ if (saturation !== 1) {
88951
+ const gray = (adjustedR + adjustedG + adjustedB) / 3;
88952
+ const finalR = Math.round(gray + (adjustedR - gray) * saturation);
88953
+ const finalG = Math.round(gray + (adjustedG - gray) * saturation);
88954
+ const finalB = Math.round(gray + (adjustedB - gray) * saturation);
88955
+ return `rgba(${Math.min(255, Math.max(0, finalR))}, ${Math.min(255, Math.max(0, finalG))}, ${Math.min(255, Math.max(0, finalB))}, ${alpha2})`;
88956
+ }
88957
+ return `rgba(${Math.round(adjustedR)}, ${Math.round(adjustedG)}, ${Math.round(adjustedB)}, ${alpha2})`;
88993
88958
  }, [saturation, brightness]);
88994
88959
  const updateMeshPoints = useCallback((canvas) => {
88995
88960
  const points = meshPointsRef.current;
@@ -88997,13 +88962,13 @@ var MeshGradientInternal = ({
88997
88962
  points.forEach((point, index2) => {
88998
88963
  switch (animationType) {
88999
88964
  case "wave":
89000
- point.x += Math.sin(time + point.phase) * speed;
89001
- point.y += Math.cos(time + point.phase) * speed;
88965
+ point.x += Math.sin(time + point.phase) * 0.5;
88966
+ point.y += Math.cos(time + point.phase) * 0.5;
89002
88967
  break;
89003
88968
  case "morph":
89004
88969
  const morphAngle = time + point.phase;
89005
- point.x += Math.sin(morphAngle) * speed * 2;
89006
- point.y += Math.cos(morphAngle * 1.5) * speed * 2;
88970
+ point.x += Math.sin(morphAngle) * 1;
88971
+ point.y += Math.cos(morphAngle * 1.5) * 1;
89007
88972
  break;
89008
88973
  case "pulse":
89009
88974
  const pulseScale = 1 + Math.sin(time * 2 + point.phase) * 0.2;
@@ -89040,12 +89005,16 @@ var MeshGradientInternal = ({
89040
89005
  const mdx = point.x - mouseRef.current.x;
89041
89006
  const mdy = point.y - mouseRef.current.y;
89042
89007
  const distance = Math.sqrt(mdx * mdx + mdy * mdy);
89043
- if (distance < mouseRadius) {
89008
+ if (distance > 0 && distance < mouseRadius) {
89044
89009
  const force = (1 - distance / mouseRadius) * 3;
89045
89010
  point.x += mdx / distance * force;
89046
89011
  point.y += mdy / distance * force;
89047
89012
  }
89048
89013
  }
89014
+ if (!isFinite(point.x))
89015
+ point.x = canvas.width / 2;
89016
+ if (!isFinite(point.y))
89017
+ point.y = canvas.height / 2;
89049
89018
  });
89050
89019
  }, [animationType, speed, interactive, mouseRadius]);
89051
89020
  const drawMeshGradient = useCallback((ctx, canvas) => {
@@ -89057,28 +89026,30 @@ var MeshGradientInternal = ({
89057
89026
  ctx.filter = `blur(${blur2}px)`;
89058
89027
  }
89059
89028
  points.forEach((point, i) => {
89029
+ const x = isFinite(point.x) ? point.x : canvas.width / 2;
89030
+ const y = isFinite(point.y) ? point.y : canvas.height / 2;
89031
+ const radius = isFinite(point.radius) && point.radius > 0 ? point.radius : 100;
89060
89032
  const gradient = ctx.createRadialGradient(
89061
- point.x,
89062
- point.y,
89033
+ x,
89034
+ y,
89063
89035
  0,
89064
- point.x,
89065
- point.y,
89066
- point.radius
89036
+ x,
89037
+ y,
89038
+ radius
89067
89039
  );
89068
- const adjustedColor = adjustColor(point.color);
89069
89040
  if (interpolation === "smooth") {
89070
- gradient.addColorStop(0, adjustedColor);
89071
- gradient.addColorStop(0.5, adjustedColor + "80");
89072
- gradient.addColorStop(1, adjustedColor + "00");
89041
+ gradient.addColorStop(0, adjustColor(point.color, 1));
89042
+ gradient.addColorStop(0.5, adjustColor(point.color, 0.5));
89043
+ gradient.addColorStop(1, adjustColor(point.color, 0));
89073
89044
  } else if (interpolation === "bezier") {
89074
- gradient.addColorStop(0, adjustedColor);
89075
- gradient.addColorStop(0.25, adjustedColor + "CC");
89076
- gradient.addColorStop(0.5, adjustedColor + "80");
89077
- gradient.addColorStop(0.75, adjustedColor + "40");
89078
- gradient.addColorStop(1, adjustedColor + "00");
89045
+ gradient.addColorStop(0, adjustColor(point.color, 1));
89046
+ gradient.addColorStop(0.25, adjustColor(point.color, 0.8));
89047
+ gradient.addColorStop(0.5, adjustColor(point.color, 0.5));
89048
+ gradient.addColorStop(0.75, adjustColor(point.color, 0.25));
89049
+ gradient.addColorStop(1, adjustColor(point.color, 0));
89079
89050
  } else {
89080
- gradient.addColorStop(0, adjustedColor);
89081
- gradient.addColorStop(1, adjustedColor + "00");
89051
+ gradient.addColorStop(0, adjustColor(point.color, 1));
89052
+ gradient.addColorStop(1, adjustColor(point.color, 0));
89082
89053
  }
89083
89054
  ctx.fillStyle = gradient;
89084
89055
  ctx.fillRect(0, 0, canvas.width, canvas.height);
@@ -89115,12 +89086,12 @@ var MeshGradientInternal = ({
89115
89086
  }
89116
89087
  lastFrameTimeRef.current = currentTime;
89117
89088
  if (animate4) {
89118
- timeRef.current += 1;
89089
+ timeRef.current += speed * 2.5;
89119
89090
  }
89120
89091
  updateMeshPoints(canvas);
89121
89092
  drawMeshGradient(ctx, canvas);
89122
89093
  animationRef.current = requestAnimationFrame(animateLoop);
89123
- }, [frameInterval, updateMeshPoints, drawMeshGradient]);
89094
+ }, [frameInterval, updateMeshPoints, drawMeshGradient, animate4]);
89124
89095
  const handleResize = useCallback(() => {
89125
89096
  const canvas = canvasRef.current;
89126
89097
  if (!canvas)
@@ -89167,7 +89138,7 @@ var MeshGradientInternal = ({
89167
89138
  cancelAnimationFrame(animationRef.current);
89168
89139
  }
89169
89140
  };
89170
- }, [initializeMeshPoints, handleResize, handleMouseMove2, animateLoop, drawMeshGradient, interactive]);
89141
+ }, [initializeMeshPoints, handleResize, handleMouseMove2, animateLoop, drawMeshGradient, interactive, animate4]);
89171
89142
  return /* @__PURE__ */ jsxs(
89172
89143
  "div",
89173
89144
  {
@@ -89186,7 +89157,7 @@ var MeshGradientInternal = ({
89186
89157
  )
89187
89158
  }
89188
89159
  ),
89189
- children && /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
89160
+ children && /* @__PURE__ */ jsx("div", { className: "relative z-10 h-full w-full", children })
89190
89161
  ]
89191
89162
  }
89192
89163
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "3.3.18",
3
+ "version": "3.3.20",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",