artode-icons 0.1.4 → 0.1.5

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.js CHANGED
@@ -142,7 +142,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
142
142
  var InteractiveArtodeIcon = ({
143
143
  path,
144
144
  size = 32,
145
- color = "currentColor",
145
+ color = "#D80018",
146
146
  className,
147
147
  forceHover = false,
148
148
  globalMouse = false,
@@ -152,20 +152,9 @@ var InteractiveArtodeIcon = ({
152
152
  var _a, _b;
153
153
  const canvasRef = (0, import_react.useRef)(null);
154
154
  const [internalHover, setInternalHover] = (0, import_react.useState)(false);
155
- const [resolvedColor, setResolvedColor] = (0, import_react.useState)(color === "currentColor" ? "#D80018" : color);
156
155
  const isHovered = forceHover || internalHover || globalMouse;
157
156
  const width = (_a = customCanvasSize == null ? void 0 : customCanvasSize.width) != null ? _a : size;
158
157
  const height = (_b = customCanvasSize == null ? void 0 : customCanvasSize.height) != null ? _b : size;
159
- (0, import_react.useEffect)(() => {
160
- if (color !== "currentColor") {
161
- setResolvedColor(color);
162
- return;
163
- }
164
- const canvas = canvasRef.current;
165
- if (!canvas) return;
166
- const computedColor = window.getComputedStyle(canvas).color;
167
- setResolvedColor(computedColor || "#D80018");
168
- }, [color, className]);
169
158
  const isHoveredRef = (0, import_react.useRef)(isHovered);
170
159
  (0, import_react.useEffect)(() => {
171
160
  isHoveredRef.current = isHovered;
@@ -248,7 +237,7 @@ var InteractiveArtodeIcon = ({
248
237
  let animId;
249
238
  const render = () => {
250
239
  ctx.clearRect(0, 0, width, height);
251
- ctx.fillStyle = resolvedColor;
240
+ ctx.fillStyle = color;
252
241
  if (isHoveredRef.current) {
253
242
  particles.forEach((p) => {
254
243
  const tx = mouseRef.current.x + p.swarmOffset.x;
@@ -277,7 +266,7 @@ var InteractiveArtodeIcon = ({
277
266
  return () => {
278
267
  if (animId) cancelAnimationFrame(animId);
279
268
  };
280
- }, [path, size, resolvedColor, width, height]);
269
+ }, [path, size, color, width, height]);
281
270
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
282
271
  "canvas",
283
272
  {
@@ -296,7 +285,7 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
296
285
  var ArtodeIcon = ({
297
286
  path: pathString,
298
287
  size = 32,
299
- color = "currentColor",
288
+ color = "#D80018",
300
289
  className,
301
290
  forceHover = false,
302
291
  drawType = "fill",
@@ -307,25 +296,14 @@ var ArtodeIcon = ({
307
296
  }) => {
308
297
  const canvasRef = (0, import_react2.useRef)(null);
309
298
  const [internalHover, setInternalHover] = import_react2.default.useState(false);
310
- const [resolvedColor, setResolvedColor] = import_react2.default.useState(color === "currentColor" ? "#D80018" : color);
311
299
  const isHovered = forceHover || internalHover;
312
- (0, import_react2.useEffect)(() => {
313
- if (color !== "currentColor") {
314
- setResolvedColor(color);
315
- return;
316
- }
317
- const canvas = canvasRef.current;
318
- if (!canvas) return;
319
- const computedColor = window.getComputedStyle(canvas).color;
320
- setResolvedColor(computedColor || "#D80018");
321
- }, [color, className]);
322
300
  if (interactive) {
323
301
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
324
302
  InteractiveArtodeIcon,
325
303
  {
326
304
  path: pathString,
327
305
  size,
328
- color: resolvedColor,
306
+ color,
329
307
  className,
330
308
  forceHover,
331
309
  globalMouse,
@@ -378,7 +356,7 @@ var ArtodeIcon = ({
378
356
  time = 1;
379
357
  }
380
358
  ctx.clearRect(0, 0, size, size);
381
- ctx.fillStyle = resolvedColor;
359
+ ctx.fillStyle = color;
382
360
  for (let y = 0; y < size; y++) {
383
361
  for (let x = 0; x < size; x++) {
384
362
  const index = (y * size + x) * 4;
@@ -412,7 +390,7 @@ var ArtodeIcon = ({
412
390
  return () => {
413
391
  if (animId) cancelAnimationFrame(animId);
414
392
  };
415
- }, [pathString, size, resolvedColor, isHovered, drawType, viewBoxSize]);
393
+ }, [pathString, size, color, isHovered, drawType, viewBoxSize]);
416
394
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
417
395
  "canvas",
418
396
  {