iconflow 1.1.0 → 1.2.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.
package/dist/index.js CHANGED
@@ -2,9 +2,6 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
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
5
  var __export = (target, all) => {
9
6
  for (var name in all)
10
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -19,75 +16,67 @@ var __copyProps = (to, from, except, desc) => {
19
16
  };
20
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
18
 
22
- // src/styles.css
23
- var init_styles = __esm({
24
- "src/styles.css"() {
25
- }
19
+ // src/index.js
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
+ AnimatedIcon: () => AnimatedIcon_default,
23
+ IconFlow: () => IconFlow,
24
+ default: () => index_default
26
25
  });
26
+ module.exports = __toCommonJS(index_exports);
27
27
 
28
28
  // 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
- });
29
+ var import_react = require("react");
30
+ var ANIMATION_TYPES = [
31
+ "shake",
32
+ "spin",
33
+ "bounce",
34
+ "swing",
35
+ "pulse",
36
+ "heartbeat"
37
+ ];
38
+ var TRIGGERS = ["hover", "click", "mount", "loop"];
39
+ var AnimatedIcon = ({
40
+ icon: Icon,
41
+ animation,
42
+ trigger,
43
+ size = 24,
44
+ color = "currentColor",
45
+ speed = 1,
46
+ strokeWidth = 2,
47
+ className = ""
48
+ }) => {
49
+ const animationType = ANIMATION_TYPES.includes(animation) ? animation : "shake";
50
+ const triggerType = TRIGGERS.includes(trigger) ? trigger : "hover";
51
+ const [isTriggered, setIsTriggered] = (0, import_react.useState)(
52
+ triggerType === "mount" || triggerType === "loop"
53
+ );
54
+ (0, import_react.useEffect)(() => {
55
+ if (triggerType === "mount") {
56
+ setIsTriggered(true);
57
+ }
58
+ }, [triggerType]);
59
+ const handlers = {
60
+ hover: {
61
+ onMouseEnter: () => setIsTriggered(true),
62
+ onMouseLeave: () => setIsTriggered(false)
63
+ },
64
+ click: { onClick: () => setIsTriggered((prev) => !prev) },
65
+ mount: {}
66
+ };
67
+ return /* @__PURE__ */ React.createElement(
68
+ "span",
69
+ {
70
+ className: `iconflow-${animationType} ${isTriggered ? "iconflow-active" : ""} ${className}`.trim(),
71
+ style: { "--iconflow-speed": `${speed}s` },
72
+ ...handlers[triggerType]
73
+ },
74
+ /* @__PURE__ */ React.createElement(Icon, { size, color, strokeWidth })
75
+ );
76
+ };
77
+ var AnimatedIcon_default = AnimatedIcon;
88
78
 
89
79
  // src/index.js
90
- var AnimatedIcon2 = (init_AnimatedIcon(), __toCommonJS(AnimatedIcon_exports));
91
80
  var IconFlow = class {
92
81
  constructor(options = {}) {
93
82
  this.defaultSize = options.size ?? 24;
@@ -109,6 +98,9 @@ var IconFlow = class {
109
98
  };
110
99
  }
111
100
  };
112
- module.exports = IconFlow;
113
- module.exports.AnimatedIcon = AnimatedIcon2;
114
- module.exports.default = IconFlow;
101
+ var index_default = AnimatedIcon_default;
102
+ // Annotate the CommonJS export names for ESM import in node:
103
+ 0 && (module.exports = {
104
+ AnimatedIcon,
105
+ IconFlow
106
+ });
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
2
  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
- });
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.0",
4
4
  "description": "Animated icon wrapper for Lucide React icons",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",