iconflow 1.1.0 → 1.2.1

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
@@ -1,10 +1,9 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __esm = (fn, res) => function __init() {
6
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
7
- };
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -17,77 +16,77 @@ var __copyProps = (to, from, except, desc) => {
17
16
  }
18
17
  return to;
19
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
20
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
28
 
22
- // src/styles.css
23
- var init_styles = __esm({
24
- "src/styles.css"() {
25
- }
29
+ // src/index.js
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ AnimatedIcon: () => AnimatedIcon_default,
33
+ IconFlow: () => IconFlow,
34
+ default: () => index_default
26
35
  });
36
+ module.exports = __toCommonJS(index_exports);
27
37
 
28
38
  // src/AnimatedIcon.jsx
29
- var AnimatedIcon_exports = {};
30
- __export(AnimatedIcon_exports, {
31
- default: () => AnimatedIcon_default
32
- });
33
- var import_react, ANIMATION_TYPES, TRIGGERS, AnimatedIcon, AnimatedIcon_default;
34
- var init_AnimatedIcon = __esm({
35
- "src/AnimatedIcon.jsx"() {
36
- import_react = require("react");
37
- init_styles();
38
- ANIMATION_TYPES = [
39
- "shake",
40
- "spin",
41
- "bounce",
42
- "swing",
43
- "pulse",
44
- "heartbeat"
45
- ];
46
- TRIGGERS = ["hover", "click", "mount", "loop"];
47
- AnimatedIcon = ({
48
- icon: Icon,
49
- animation,
50
- trigger,
51
- size = 24,
52
- color = "currentColor",
53
- speed = 1,
54
- strokeWidth = 2,
55
- className = ""
56
- }) => {
57
- const animationType = ANIMATION_TYPES.includes(animation) ? animation : "shake";
58
- const triggerType = TRIGGERS.includes(trigger) ? trigger : "hover";
59
- const [isTriggered, setIsTriggered] = (0, import_react.useState)(
60
- triggerType === "mount" || triggerType === "loop"
61
- );
62
- (0, import_react.useEffect)(() => {
63
- if (triggerType === "mount") {
64
- setIsTriggered(true);
65
- }
66
- }, [triggerType]);
67
- const handlers = {
68
- hover: {
69
- onMouseEnter: () => setIsTriggered(true),
70
- onMouseLeave: () => setIsTriggered(false)
71
- },
72
- click: { onClick: () => setIsTriggered((prev) => !prev) },
73
- mount: {}
74
- };
75
- return /* @__PURE__ */ React.createElement(
76
- "span",
77
- {
78
- className: `iconflow-${animationType} ${isTriggered ? "iconflow-active" : ""} ${className}`.trim(),
79
- style: { "--iconflow-speed": `${speed}s` },
80
- ...handlers[triggerType]
81
- },
82
- /* @__PURE__ */ React.createElement(Icon, { size, color, strokeWidth })
83
- );
84
- };
85
- AnimatedIcon_default = AnimatedIcon;
86
- }
87
- });
39
+ var import_react = __toESM(require("react"));
40
+ var ANIMATION_TYPES = [
41
+ "shake",
42
+ "spin",
43
+ "bounce",
44
+ "swing",
45
+ "pulse",
46
+ "heartbeat"
47
+ ];
48
+ var TRIGGERS = ["hover", "click", "mount", "loop"];
49
+ var AnimatedIcon = ({
50
+ icon: Icon,
51
+ animation,
52
+ trigger,
53
+ size = 24,
54
+ color = "currentColor",
55
+ speed = 1,
56
+ strokeWidth = 2,
57
+ className = ""
58
+ }) => {
59
+ const animationType = ANIMATION_TYPES.includes(animation) ? animation : "shake";
60
+ const triggerType = TRIGGERS.includes(trigger) ? trigger : "hover";
61
+ const [isTriggered, setIsTriggered] = (0, import_react.useState)(
62
+ triggerType === "mount" || triggerType === "loop"
63
+ );
64
+ (0, import_react.useEffect)(() => {
65
+ if (triggerType === "mount") {
66
+ setIsTriggered(true);
67
+ }
68
+ }, [triggerType]);
69
+ const handlers = {
70
+ hover: {
71
+ onMouseEnter: () => setIsTriggered(true),
72
+ onMouseLeave: () => setIsTriggered(false)
73
+ },
74
+ click: { onClick: () => setIsTriggered((prev) => !prev) },
75
+ mount: {}
76
+ };
77
+ return /* @__PURE__ */ import_react.default.createElement(
78
+ "span",
79
+ {
80
+ className: `iconflow-${animationType} ${isTriggered ? "iconflow-active" : ""} ${className}`.trim(),
81
+ style: { "--iconflow-speed": `${speed}s` },
82
+ ...handlers[triggerType]
83
+ },
84
+ /* @__PURE__ */ import_react.default.createElement(Icon, { size, color, strokeWidth })
85
+ );
86
+ };
87
+ var AnimatedIcon_default = AnimatedIcon;
88
88
 
89
89
  // src/index.js
90
- var AnimatedIcon2 = (init_AnimatedIcon(), __toCommonJS(AnimatedIcon_exports));
91
90
  var IconFlow = class {
92
91
  constructor(options = {}) {
93
92
  this.defaultSize = options.size ?? 24;
@@ -109,6 +108,9 @@ var IconFlow = class {
109
108
  };
110
109
  }
111
110
  };
112
- module.exports = IconFlow;
113
- module.exports.AnimatedIcon = AnimatedIcon2;
114
- module.exports.default = IconFlow;
111
+ var index_default = AnimatedIcon_default;
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ AnimatedIcon,
115
+ IconFlow
116
+ });
package/dist/index.mjs CHANGED
@@ -1,122 +1,79 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __esm = (fn, res) => function __init() {
6
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
7
- };
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __export = (target, all) => {
12
- for (var name in all)
13
- __defProp(target, name, { get: all[name], enumerable: true });
14
- };
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
- }
21
- return to;
22
- };
23
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
-
25
- // src/styles.css
26
- var init_styles = __esm({
27
- "src/styles.css"() {
28
- }
29
- });
30
-
31
1
  // src/AnimatedIcon.jsx
32
- var AnimatedIcon_exports = {};
33
- __export(AnimatedIcon_exports, {
34
- default: () => AnimatedIcon_default
35
- });
36
- import { useEffect, useState } from "react";
37
- var ANIMATION_TYPES, TRIGGERS, AnimatedIcon, AnimatedIcon_default;
38
- var init_AnimatedIcon = __esm({
39
- "src/AnimatedIcon.jsx"() {
40
- init_styles();
41
- ANIMATION_TYPES = [
42
- "shake",
43
- "spin",
44
- "bounce",
45
- "swing",
46
- "pulse",
47
- "heartbeat"
48
- ];
49
- TRIGGERS = ["hover", "click", "mount", "loop"];
50
- AnimatedIcon = ({
51
- icon: Icon,
52
- animation,
53
- trigger,
54
- size = 24,
55
- color = "currentColor",
56
- speed = 1,
57
- strokeWidth = 2,
58
- className = ""
59
- }) => {
60
- const animationType = ANIMATION_TYPES.includes(animation) ? animation : "shake";
61
- const triggerType = TRIGGERS.includes(trigger) ? trigger : "hover";
62
- const [isTriggered, setIsTriggered] = useState(
63
- triggerType === "mount" || triggerType === "loop"
64
- );
65
- useEffect(() => {
66
- if (triggerType === "mount") {
67
- setIsTriggered(true);
68
- }
69
- }, [triggerType]);
70
- const handlers = {
71
- hover: {
72
- onMouseEnter: () => setIsTriggered(true),
73
- onMouseLeave: () => setIsTriggered(false)
74
- },
75
- click: { onClick: () => setIsTriggered((prev) => !prev) },
76
- mount: {}
77
- };
78
- return /* @__PURE__ */ React.createElement(
79
- "span",
80
- {
81
- className: `iconflow-${animationType} ${isTriggered ? "iconflow-active" : ""} ${className}`.trim(),
82
- style: { "--iconflow-speed": `${speed}s` },
83
- ...handlers[triggerType]
84
- },
85
- /* @__PURE__ */ React.createElement(Icon, { size, color, strokeWidth })
86
- );
87
- };
88
- AnimatedIcon_default = AnimatedIcon;
89
- }
90
- });
2
+ import React, { useEffect, useState } from "react";
3
+ var ANIMATION_TYPES = [
4
+ "shake",
5
+ "spin",
6
+ "bounce",
7
+ "swing",
8
+ "pulse",
9
+ "heartbeat"
10
+ ];
11
+ var TRIGGERS = ["hover", "click", "mount", "loop"];
12
+ var AnimatedIcon = ({
13
+ icon: Icon,
14
+ animation,
15
+ trigger,
16
+ size = 24,
17
+ color = "currentColor",
18
+ speed = 1,
19
+ strokeWidth = 2,
20
+ className = ""
21
+ }) => {
22
+ const animationType = ANIMATION_TYPES.includes(animation) ? animation : "shake";
23
+ const triggerType = TRIGGERS.includes(trigger) ? trigger : "hover";
24
+ const [isTriggered, setIsTriggered] = useState(
25
+ triggerType === "mount" || triggerType === "loop"
26
+ );
27
+ useEffect(() => {
28
+ if (triggerType === "mount") {
29
+ setIsTriggered(true);
30
+ }
31
+ }, [triggerType]);
32
+ const handlers = {
33
+ hover: {
34
+ onMouseEnter: () => setIsTriggered(true),
35
+ onMouseLeave: () => setIsTriggered(false)
36
+ },
37
+ click: { onClick: () => setIsTriggered((prev) => !prev) },
38
+ mount: {}
39
+ };
40
+ return /* @__PURE__ */ React.createElement(
41
+ "span",
42
+ {
43
+ className: `iconflow-${animationType} ${isTriggered ? "iconflow-active" : ""} ${className}`.trim(),
44
+ style: { "--iconflow-speed": `${speed}s` },
45
+ ...handlers[triggerType]
46
+ },
47
+ /* @__PURE__ */ React.createElement(Icon, { size, color, strokeWidth })
48
+ );
49
+ };
50
+ var AnimatedIcon_default = AnimatedIcon;
91
51
 
92
52
  // src/index.js
93
- var require_index = __commonJS({
94
- "src/index.js"(exports, module) {
95
- var AnimatedIcon2 = (init_AnimatedIcon(), __toCommonJS(AnimatedIcon_exports));
96
- var IconFlow = class {
97
- constructor(options = {}) {
98
- this.defaultSize = options.size ?? 24;
99
- this.defaultColor = options.color ?? "currentColor";
100
- this.defaultSpeed = options.speed ?? 1;
101
- this.defaultStrokeWidth = options.strokeWidth ?? 2;
102
- this.defaultAnimation = options.animation ?? "shake";
103
- this.defaultTrigger = options.trigger ?? "hover";
104
- }
105
- getDefaults(overrides = {}) {
106
- return {
107
- size: this.defaultSize,
108
- color: this.defaultColor,
109
- speed: this.defaultSpeed,
110
- strokeWidth: this.defaultStrokeWidth,
111
- animation: this.defaultAnimation,
112
- trigger: this.defaultTrigger,
113
- ...overrides
114
- };
115
- }
53
+ var IconFlow = class {
54
+ constructor(options = {}) {
55
+ this.defaultSize = options.size ?? 24;
56
+ this.defaultColor = options.color ?? "currentColor";
57
+ this.defaultSpeed = options.speed ?? 1;
58
+ this.defaultStrokeWidth = options.strokeWidth ?? 2;
59
+ this.defaultAnimation = options.animation ?? "shake";
60
+ this.defaultTrigger = options.trigger ?? "hover";
61
+ }
62
+ getDefaults(overrides = {}) {
63
+ return {
64
+ size: this.defaultSize,
65
+ color: this.defaultColor,
66
+ speed: this.defaultSpeed,
67
+ strokeWidth: this.defaultStrokeWidth,
68
+ animation: this.defaultAnimation,
69
+ trigger: this.defaultTrigger,
70
+ ...overrides
116
71
  };
117
- module.exports = IconFlow;
118
- module.exports.AnimatedIcon = AnimatedIcon2;
119
- module.exports.default = IconFlow;
120
72
  }
121
- });
122
- export default require_index();
73
+ };
74
+ var index_default = AnimatedIcon_default;
75
+ export {
76
+ AnimatedIcon_default as AnimatedIcon,
77
+ IconFlow,
78
+ index_default as default
79
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iconflow",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Animated icon wrapper for Lucide React icons",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",