@nice2dev/icons 1.3.15 → 1.3.17

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 (153) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/NiceDesktopIconExporter.js +688 -599
  4. package/dist/cjs/NiceFaviconGenerator.js +603 -417
  5. package/dist/cjs/NiceIconPicker.js +788 -508
  6. package/dist/cjs/NiceIconPreview.js +246 -188
  7. package/dist/cjs/NiceIconSetCreator.js +683 -552
  8. package/dist/cjs/NiceIconStacker.js +547 -171
  9. package/dist/cjs/NiceIconValue.js +27 -35
  10. package/dist/cjs/NtdIconBadge.js +384 -360
  11. package/dist/cjs/NtdIconMorph.js +419 -354
  12. package/dist/cjs/NtdStateMorph.js +150 -147
  13. package/dist/cjs/advancedIconSearch.js +373 -510
  14. package/dist/cjs/animationControls.js +518 -642
  15. package/dist/cjs/animationSpeed.js +69 -0
  16. package/dist/cjs/client.js +12 -15
  17. package/dist/cjs/createIcon.js +374 -252
  18. package/dist/cjs/design-tokens.js +324 -390
  19. package/dist/cjs/figmaExport.js +162 -257
  20. package/dist/cjs/figmaSync.js +234 -316
  21. package/dist/cjs/headless-ui.js +240 -368
  22. package/dist/cjs/iconAnalytics.js +337 -393
  23. package/dist/cjs/iconHtml.js +64 -86
  24. package/dist/cjs/iconMetadata.js +392 -472
  25. package/dist/cjs/iconParts.js +120 -90
  26. package/dist/cjs/iconStack.js +136 -155
  27. package/dist/cjs/iconStyles.js +1670 -509
  28. package/dist/cjs/iconValue.js +359 -430
  29. package/dist/cjs/icons/accessibility.js +1119 -134
  30. package/dist/cjs/icons/actions.js +1290 -330
  31. package/dist/cjs/icons/ai.js +1424 -144
  32. package/dist/cjs/icons/brand.js +613 -184
  33. package/dist/cjs/icons/business.js +938 -192
  34. package/dist/cjs/icons/devtech.js +1656 -227
  35. package/dist/cjs/icons/ecommerce.js +802 -111
  36. package/dist/cjs/icons/education.js +1345 -199
  37. package/dist/cjs/icons/files.js +1597 -328
  38. package/dist/cjs/icons/fintech.js +793 -104
  39. package/dist/cjs/icons/food.js +1028 -156
  40. package/dist/cjs/icons/fun.js +804 -109
  41. package/dist/cjs/icons/gaming.js +916 -170
  42. package/dist/cjs/icons/health.js +623 -112
  43. package/dist/cjs/icons/index.js +32 -42
  44. package/dist/cjs/icons/input.js +282 -83
  45. package/dist/cjs/icons/legal.js +1065 -122
  46. package/dist/cjs/icons/media.js +1061 -267
  47. package/dist/cjs/icons/navigation.js +407 -123
  48. package/dist/cjs/icons/omniverk.js +523 -93
  49. package/dist/cjs/icons/realestate.js +1520 -193
  50. package/dist/cjs/icons/saas.js +867 -98
  51. package/dist/cjs/icons/science.js +1344 -202
  52. package/dist/cjs/icons/shapes.js +1316 -308
  53. package/dist/cjs/icons/smarthome.js +786 -90
  54. package/dist/cjs/icons/social.js +591 -59
  55. package/dist/cjs/icons/sports.js +1133 -133
  56. package/dist/cjs/icons/sustainability.js +1211 -139
  57. package/dist/cjs/icons/travel.js +1470 -148
  58. package/dist/cjs/icons/ui.js +1508 -315
  59. package/dist/cjs/icons/weather.js +1160 -173
  60. package/dist/cjs/index.js +559 -568
  61. package/dist/cjs/lottieIntegration.js +261 -266
  62. package/dist/cjs/nicetodev-icons.css +1 -1
  63. package/dist/cjs/particleEffects.js +270 -251
  64. package/dist/cjs/resolver.js +229 -284
  65. package/dist/cjs/rsc.js +175 -193
  66. package/dist/cjs/sharpen.js +73 -130
  67. package/dist/cjs/smilAnimations.js +380 -165
  68. package/dist/cjs/stacking.js +87 -122
  69. package/dist/cjs/tailwind-plugin.js +280 -320
  70. package/dist/cjs/types.js +46 -72
  71. package/dist/cjs/utilities.js +163 -324
  72. package/dist/cjs/variantProps.js +12 -52
  73. package/dist/esm/NiceDesktopIconExporter.js +671 -598
  74. package/dist/esm/NiceFaviconGenerator.js +583 -416
  75. package/dist/esm/NiceIconPicker.js +789 -507
  76. package/dist/esm/NiceIconPreview.js +247 -187
  77. package/dist/esm/NiceIconSetCreator.js +685 -551
  78. package/dist/esm/NiceIconStacker.js +549 -170
  79. package/dist/esm/NiceIconValue.js +29 -34
  80. package/dist/esm/NtdIconBadge.js +388 -359
  81. package/dist/esm/NtdIconMorph.js +423 -353
  82. package/dist/esm/NtdStateMorph.js +152 -146
  83. package/dist/esm/advancedIconSearch.js +391 -509
  84. package/dist/esm/animationControls.js +527 -641
  85. package/dist/esm/animationSpeed.js +69 -0
  86. package/dist/esm/client.js +48 -10
  87. package/dist/esm/createIcon.js +375 -251
  88. package/dist/esm/design-tokens.js +334 -387
  89. package/dist/esm/figmaExport.js +170 -256
  90. package/dist/esm/figmaSync.js +237 -315
  91. package/dist/esm/headless-ui.js +254 -365
  92. package/dist/esm/iconAnalytics.js +342 -392
  93. package/dist/esm/iconHtml.js +67 -85
  94. package/dist/esm/iconMetadata.js +404 -471
  95. package/dist/esm/iconParts.js +125 -89
  96. package/dist/esm/iconStack.js +145 -154
  97. package/dist/esm/iconStyles.js +1681 -508
  98. package/dist/esm/iconValue.js +361 -429
  99. package/dist/esm/icons/accessibility.js +1133 -133
  100. package/dist/esm/icons/actions.js +1320 -329
  101. package/dist/esm/icons/ai.js +1441 -143
  102. package/dist/esm/icons/brand.js +616 -179
  103. package/dist/esm/icons/business.js +957 -191
  104. package/dist/esm/icons/devtech.js +1687 -226
  105. package/dist/esm/icons/ecommerce.js +816 -110
  106. package/dist/esm/icons/education.js +1364 -198
  107. package/dist/esm/icons/files.js +1628 -327
  108. package/dist/esm/icons/fintech.js +807 -103
  109. package/dist/esm/icons/food.js +1043 -153
  110. package/dist/esm/icons/fun.js +819 -108
  111. package/dist/esm/icons/gaming.js +933 -169
  112. package/dist/esm/icons/health.js +636 -111
  113. package/dist/esm/icons/index.js +589 -32
  114. package/dist/esm/icons/input.js +326 -82
  115. package/dist/esm/icons/legal.js +1079 -121
  116. package/dist/esm/icons/media.js +1086 -266
  117. package/dist/esm/icons/navigation.js +421 -122
  118. package/dist/esm/icons/omniverk.js +534 -91
  119. package/dist/esm/icons/realestate.js +1544 -198
  120. package/dist/esm/icons/saas.js +880 -97
  121. package/dist/esm/icons/science.js +1370 -208
  122. package/dist/esm/icons/shapes.js +1343 -307
  123. package/dist/esm/icons/smarthome.js +799 -89
  124. package/dist/esm/icons/social.js +599 -58
  125. package/dist/esm/icons/sports.js +1148 -132
  126. package/dist/esm/icons/sustainability.js +1226 -138
  127. package/dist/esm/icons/travel.js +1486 -147
  128. package/dist/esm/icons/ui.js +1540 -314
  129. package/dist/esm/icons/weather.js +1181 -172
  130. package/dist/esm/index.js +749 -58
  131. package/dist/esm/lottieIntegration.js +264 -265
  132. package/dist/esm/nicetodev-icons.css +1 -1
  133. package/dist/esm/particleEffects.js +271 -250
  134. package/dist/esm/resolver.js +231 -283
  135. package/dist/esm/rsc.js +182 -192
  136. package/dist/esm/sharpen.js +78 -129
  137. package/dist/esm/smilAnimations.js +385 -164
  138. package/dist/esm/stacking.js +99 -121
  139. package/dist/esm/tailwind-plugin.js +282 -319
  140. package/dist/esm/types.js +50 -71
  141. package/dist/esm/utilities.js +177 -321
  142. package/dist/esm/variantProps.js +23 -52
  143. package/dist/types/animationSpeed.d.ts +19 -0
  144. package/dist/types/createIcon.d.ts +6 -0
  145. package/dist/types/iconStyles.d.ts +6 -1
  146. package/dist/types/icons/brand.d.ts +0 -4
  147. package/dist/types/icons/food.d.ts +0 -3
  148. package/dist/types/icons/index.d.ts +3 -3
  149. package/dist/types/icons/omniverk.d.ts +0 -3
  150. package/dist/types/icons/science.d.ts +1 -1
  151. package/dist/types/smilAnimations.d.ts +4 -2
  152. package/dist/types/types.d.ts +7 -0
  153. package/package.json +15 -22
package/dist/cjs/rsc.js CHANGED
@@ -1,205 +1,187 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var sharpen = require('./sharpen.js');
5
- var types = require('./types.js');
6
-
7
- /* ────────────────────────────────────────────────────────────────────────────
8
- RSC-COMPATIBLE ICON FACTORY
9
- ───────────────────────────────────────────────────────────────────────────── */
10
- /**
11
- * Creates a React Server Component compatible icon.
12
- *
13
- * Unlike the standard `createIcon`, this version:
14
- * - Does NOT use React hooks (useId, useSyncExternalStore, etc.)
15
- * - Does NOT support animations
16
- * - Does NOT support automatic dark/light mode detection
17
- * - IS fully streamable and SSR-safe
18
- *
19
- * @param options - Icon configuration
20
- * @returns A React function component (not using forwardRef)
21
- *
22
- * @example
23
- * ```tsx
24
- * export const NtdHomeRSC = createIconRSC({
25
- * displayName: 'NtdHomeRSC',
26
- * paths: {
27
- * solid: ({ primaryColor }) => <path d="..." fill={primaryColor} />,
28
- * outline: ({ primaryColor, strokeWidth }) => <path d="..." stroke={primaryColor} />,
29
- * duotone: ({ primaryColor, secondaryColor }) => <path d="..." />,
30
- * },
31
- * });
32
- * ```
33
- */
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const sharpen = require("./sharpen.js");
5
+ const types = require("./types.js");
34
6
  function createIconRSC(options) {
35
- const { displayName, viewBox = '0 0 24 24', paths } = options;
36
- function IconRSC(props) {
37
- var _a;
38
- const { size = 'md', variant = 'solid', cutoutShape = 'rounded-square', primaryColor: primaryColorProp, secondaryColor: secondaryColorProp, accentColor: accentColorProp, secondaryOpacity = 0.35, strokeWidth = 1, gradient, gradientDirection = 135, color, rotate, flipX, flipY, scale, className, style, 'aria-label': ariaLabel, 'aria-hidden': ariaHidden, title, role = ariaLabel ? 'img' : 'presentation', 'data-testid': testId, } = props;
39
- // Resolve size
40
- const resolvedSize = typeof size === 'number' ? size : types.SIZE_MAP[size] || types.SIZE_MAP.md;
41
- // Resolve colors with semantic color support
42
- let primaryColor = primaryColorProp !== null && primaryColorProp !== void 0 ? primaryColorProp : 'currentColor';
43
- const secondaryColor = secondaryColorProp !== null && secondaryColorProp !== void 0 ? secondaryColorProp : 'currentColor';
44
- const accentColor = accentColorProp !== null && accentColorProp !== void 0 ? accentColorProp : primaryColor;
45
- if (color && types.SEMANTIC_COLOR_DEFAULTS[color]) {
46
- if (!primaryColorProp) {
47
- primaryColor = types.SEMANTIC_COLOR_DEFAULTS[color];
48
- }
49
- }
50
- // Resolve variant with fallback. `wireframe` always starts from `solid`
51
- // (the full construction) — it is re-drawn mechanically, not authored.
52
- const isCutout = variant === 'cutout';
53
- const pathRenderer = isCutout || variant === 'wireframe' ? paths.solid : ((_a = paths[variant]) !== null && _a !== void 0 ? _a : paths.solid);
54
- // Build render props
55
- const renderProps = {
56
- primaryColor,
57
- secondaryColor,
58
- accentColor,
59
- secondaryOpacity,
60
- strokeWidth,
61
- };
62
- // Build transforms
63
- const transforms = [];
64
- if (rotate) {
65
- transforms.push(`rotate(${rotate}deg)`);
66
- }
67
- if (flipX) {
68
- transforms.push('scaleX(-1)');
69
- }
70
- if (flipY) {
71
- transforms.push('scaleY(-1)');
72
- }
73
- if (scale && scale !== 1) {
74
- transforms.push(`scale(${scale})`);
75
- }
76
- // Build gradient defs if needed
77
- let gradientDefs = null;
78
- let gradientId = null;
79
- if (gradient && types.GRADIENT_PRESETS[gradient]) {
80
- const colors = types.GRADIENT_PRESETS[gradient];
81
- // Generate a deterministic ID based on displayName and gradient
82
- gradientId = `${displayName}-${gradient}-grad`;
83
- const x1 = Math.round(50 - 50 * Math.cos((gradientDirection * Math.PI) / 180));
84
- const y1 = Math.round(50 - 50 * Math.sin((gradientDirection * Math.PI) / 180));
85
- const x2 = Math.round(50 + 50 * Math.cos((gradientDirection * Math.PI) / 180));
86
- const y2 = Math.round(50 + 50 * Math.sin((gradientDirection * Math.PI) / 180));
87
- gradientDefs = (jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("linearGradient", { id: gradientId, x1: `${x1}%`, y1: `${y1}%`, x2: `${x2}%`, y2: `${y2}%`, children: colors.map((color, i) => (jsxRuntime.jsx("stop", { offset: `${(i / (colors.length - 1)) * 100}%`, stopColor: color }, i))) }) }));
88
- // Override primary color with gradient reference
89
- renderProps.primaryColor = `url(#${gradientId})`;
90
- }
91
- // Final styles
92
- const finalStyle = {
93
- width: resolvedSize,
94
- height: resolvedSize,
95
- ...style,
96
- ...(transforms.length > 0 && { transform: transforms.join(' ') }),
97
- };
98
- // Cutout mask ID (deterministic for SSR)
99
- const cutoutMaskId = isCutout ? `${displayName}-cutout-mask` : null;
100
- // Cutout shape renderer
101
- const cutoutBg = isCutout
102
- ? (() => {
103
- const fill = renderProps.primaryColor !== 'currentColor'
104
- ? renderProps.secondaryColor
105
- : renderProps.primaryColor;
106
- const mask = `url(#${cutoutMaskId})`;
107
- switch (cutoutShape) {
108
- case 'circle':
109
- return jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "11", fill: fill, mask: mask });
110
- case 'square':
111
- return jsxRuntime.jsx("rect", { x: "1", y: "1", width: "22", height: "22", fill: fill, mask: mask });
112
- case 'hexagon':
113
- return (jsxRuntime.jsx("polygon", { points: "12,1 22.39,6.5 22.39,17.5 12,23 1.61,17.5 1.61,6.5", fill: fill, mask: mask }));
114
- case 'diamond':
115
- return jsxRuntime.jsx("polygon", { points: "12,1 23,12 12,23 1,12", fill: fill, mask: mask });
116
- case 'shield':
117
- return (jsxRuntime.jsx("path", { d: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5L12 1z", fill: fill, mask: mask }));
118
- case 'squircle':
119
- return (jsxRuntime.jsx("path", { d: "M12 1C5.5 1 1 5.5 1 8.5v7C1 18.5 5.5 23 12 23s11-4.5 11-7.5v-7C23 5.5 18.5 1 12 1z", fill: fill, mask: mask }));
120
- default:
121
- return jsxRuntime.jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "4", fill: fill, mask: mask });
122
- }
123
- })()
124
- : null;
125
- // Mirrors the client renderer in createIcon.tsx: `sharp` / `rounded` /
126
- // `wireframe` / `mini` all reuse `paths.solid`, so each needs its own pass
127
- // to be distinguishable.
128
- const rendered = isCutout
129
- ? cutoutBg
130
- : variant === 'sharp'
131
- ? sharpen.sharpenTree(pathRenderer(renderProps))
132
- : variant === 'rounded'
133
- ? sharpen.roundTree(pathRenderer(renderProps))
134
- : variant === 'wireframe'
135
- ? sharpen.wireTree(pathRenderer(renderProps), renderProps.primaryColor)
136
- : pathRenderer(renderProps);
137
- const iconContent = variant === 'mini' ? (jsxRuntime.jsx("g", { transform: `translate(12 12) scale(${sharpen.MINI_SCALE}) translate(-12 -12)`, children: rendered })) : (rendered);
138
- return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: viewBox, width: resolvedSize, height: resolvedSize, fill: "none", className: className, style: finalStyle, role: role, "aria-label": ariaLabel, "aria-hidden": ariaHidden !== null && ariaHidden !== void 0 ? ariaHidden : !ariaLabel, "data-testid": testId, children: [title && jsxRuntime.jsx("title", { children: title }), gradientDefs, isCutout && (jsxRuntime.jsx("defs", { children: jsxRuntime.jsxs("mask", { id: cutoutMaskId, children: [jsxRuntime.jsx("rect", { x: "0", y: "0", width: "24", height: "24", fill: "white" }), jsxRuntime.jsx("g", { transform: "translate(12,12) scale(0.8) translate(-12,-12)", children: paths.solid({
139
- ...renderProps,
140
- primaryColor: 'black',
141
- secondaryColor: 'black',
142
- accentColor: 'white',
143
- }) })] }) })), iconContent] }));
7
+ const { displayName, viewBox = "0 0 24 24", paths } = options;
8
+ function IconRSC(props) {
9
+ const {
10
+ size = "md",
11
+ variant = "solid",
12
+ cutoutShape = "rounded-square",
13
+ primaryColor: primaryColorProp,
14
+ secondaryColor: secondaryColorProp,
15
+ accentColor: accentColorProp,
16
+ secondaryOpacity = 0.35,
17
+ strokeWidth = 1,
18
+ gradient,
19
+ gradientDirection = 135,
20
+ color,
21
+ rotate,
22
+ flipX,
23
+ flipY,
24
+ scale,
25
+ className,
26
+ style,
27
+ "aria-label": ariaLabel,
28
+ "aria-hidden": ariaHidden,
29
+ title,
30
+ role = ariaLabel ? "img" : "presentation",
31
+ "data-testid": testId
32
+ } = props;
33
+ const resolvedSize = typeof size === "number" ? size : types.SIZE_MAP[size] || types.SIZE_MAP.md;
34
+ let primaryColor = primaryColorProp ?? "currentColor";
35
+ const secondaryColor = secondaryColorProp ?? "currentColor";
36
+ const accentColor = accentColorProp ?? primaryColor;
37
+ if (color && types.SEMANTIC_COLOR_DEFAULTS[color]) {
38
+ if (!primaryColorProp) {
39
+ primaryColor = types.SEMANTIC_COLOR_DEFAULTS[color];
40
+ }
144
41
  }
145
- IconRSC.displayName = displayName;
146
- return IconRSC;
147
- }
148
- /* ────────────────────────────────────────────────────────────────────────────
149
- STREAMING-FRIENDLY UTILITIES
150
- ───────────────────────────────────────────────────────────────────────────── */
151
- /**
152
- * Renders an icon to a static SVG string (for streaming/SSR).
153
- * Useful for generating static assets or email templates.
154
- */
155
- function renderIconToString(Icon, props = {}) {
156
- var _a;
157
- try {
158
- // Import react-dom/server for SSR rendering
159
- // eslint-disable-next-line @typescript-eslint/no-require-imports
160
- const { renderToStaticMarkup } = require('react-dom/server');
161
- const element = Icon(props);
162
- return renderToStaticMarkup(element);
42
+ const isCutout = variant === "cutout";
43
+ const pathRenderer = isCutout || variant === "wireframe" ? paths.solid : paths[variant] ?? paths.solid;
44
+ const renderProps = {
45
+ primaryColor,
46
+ secondaryColor,
47
+ accentColor,
48
+ secondaryOpacity,
49
+ strokeWidth
50
+ };
51
+ const transforms = [];
52
+ if (rotate) {
53
+ transforms.push(`rotate(${rotate}deg)`);
54
+ }
55
+ if (flipX) {
56
+ transforms.push("scaleX(-1)");
57
+ }
58
+ if (flipY) {
59
+ transforms.push("scaleY(-1)");
60
+ }
61
+ if (scale && scale !== 1) {
62
+ transforms.push(`scale(${scale})`);
163
63
  }
164
- catch (_b) {
165
- // Fallback: construct SVG manually
166
- const { size = 'md', primaryColor = 'currentColor', variant: _variant = 'solid', className = '', } = props;
167
- const sizeValue = (_a = types.SIZE_MAP[size]) !== null && _a !== void 0 ? _a : (typeof size === 'number' ? size : 24);
168
- return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="${sizeValue}" height="${sizeValue}" class="${className}" fill="${primaryColor}"><path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" fill="${primaryColor}"></path></svg>`;
64
+ let gradientDefs = null;
65
+ let gradientId = null;
66
+ if (gradient && types.GRADIENT_PRESETS[gradient]) {
67
+ const colors = types.GRADIENT_PRESETS[gradient];
68
+ gradientId = `${displayName}-${gradient}-grad`;
69
+ const x1 = Math.round(50 - 50 * Math.cos(gradientDirection * Math.PI / 180));
70
+ const y1 = Math.round(50 - 50 * Math.sin(gradientDirection * Math.PI / 180));
71
+ const x2 = Math.round(50 + 50 * Math.cos(gradientDirection * Math.PI / 180));
72
+ const y2 = Math.round(50 + 50 * Math.sin(gradientDirection * Math.PI / 180));
73
+ gradientDefs = /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("linearGradient", { id: gradientId, x1: `${x1}%`, y1: `${y1}%`, x2: `${x2}%`, y2: `${y2}%`, children: colors.map((color2, i) => /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: `${i / (colors.length - 1) * 100}%`, stopColor: color2 }, i)) }) });
74
+ renderProps.primaryColor = `url(#${gradientId})`;
169
75
  }
76
+ const finalStyle = {
77
+ width: resolvedSize,
78
+ height: resolvedSize,
79
+ ...style,
80
+ ...transforms.length > 0 && { transform: transforms.join(" ") }
81
+ };
82
+ const cutoutMaskId = isCutout ? `${displayName}-cutout-mask` : null;
83
+ const cutoutBg = isCutout ? (() => {
84
+ const fill = renderProps.primaryColor !== "currentColor" ? renderProps.secondaryColor : renderProps.primaryColor;
85
+ const mask = `url(#${cutoutMaskId})`;
86
+ switch (cutoutShape) {
87
+ case "circle":
88
+ return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "11", fill, mask });
89
+ case "square":
90
+ return /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1", y: "1", width: "22", height: "22", fill, mask });
91
+ case "hexagon":
92
+ return /* @__PURE__ */ jsxRuntime.jsx(
93
+ "polygon",
94
+ {
95
+ points: "12,1 22.39,6.5 22.39,17.5 12,23 1.61,17.5 1.61,6.5",
96
+ fill,
97
+ mask
98
+ }
99
+ );
100
+ case "diamond":
101
+ return /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: "12,1 23,12 12,23 1,12", fill, mask });
102
+ case "shield":
103
+ return /* @__PURE__ */ jsxRuntime.jsx(
104
+ "path",
105
+ {
106
+ d: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5L12 1z",
107
+ fill,
108
+ mask
109
+ }
110
+ );
111
+ case "squircle":
112
+ return /* @__PURE__ */ jsxRuntime.jsx(
113
+ "path",
114
+ {
115
+ d: "M12 1C5.5 1 1 5.5 1 8.5v7C1 18.5 5.5 23 12 23s11-4.5 11-7.5v-7C23 5.5 18.5 1 12 1z",
116
+ fill,
117
+ mask
118
+ }
119
+ );
120
+ default:
121
+ return /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "4", fill, mask });
122
+ }
123
+ })() : null;
124
+ const rendered = isCutout ? cutoutBg : variant === "sharp" ? sharpen.sharpenTree(pathRenderer(renderProps)) : variant === "rounded" ? sharpen.roundTree(pathRenderer(renderProps)) : variant === "wireframe" ? sharpen.wireTree(pathRenderer(renderProps), renderProps.primaryColor) : pathRenderer(renderProps);
125
+ const iconContent = variant === "mini" ? /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `translate(12 12) scale(${sharpen.MINI_SCALE}) translate(-12 -12)`, children: rendered }) : rendered;
126
+ return /* @__PURE__ */ jsxRuntime.jsxs(
127
+ "svg",
128
+ {
129
+ xmlns: "http://www.w3.org/2000/svg",
130
+ viewBox,
131
+ width: resolvedSize,
132
+ height: resolvedSize,
133
+ fill: "none",
134
+ className,
135
+ style: finalStyle,
136
+ role,
137
+ "aria-label": ariaLabel,
138
+ "aria-hidden": ariaHidden ?? !ariaLabel,
139
+ "data-testid": testId,
140
+ children: [
141
+ title && /* @__PURE__ */ jsxRuntime.jsx("title", { children: title }),
142
+ gradientDefs,
143
+ isCutout && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("mask", { id: cutoutMaskId, children: [
144
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "0", y: "0", width: "24", height: "24", fill: "white" }),
145
+ /* @__PURE__ */ jsxRuntime.jsx("g", { transform: "translate(12,12) scale(0.8) translate(-12,-12)", children: paths.solid({
146
+ ...renderProps,
147
+ primaryColor: "black",
148
+ secondaryColor: "black",
149
+ accentColor: "white"
150
+ }) })
151
+ ] }) }),
152
+ iconContent
153
+ ]
154
+ }
155
+ );
156
+ }
157
+ IconRSC.displayName = displayName;
158
+ return IconRSC;
159
+ }
160
+ function renderIconToString(Icon, props = {}) {
161
+ try {
162
+ const { renderToStaticMarkup } = require("react-dom/server");
163
+ const element = Icon(props);
164
+ return renderToStaticMarkup(element);
165
+ } catch {
166
+ const {
167
+ size = "md",
168
+ primaryColor = "currentColor",
169
+ variant: _variant = "solid",
170
+ className = ""
171
+ } = props;
172
+ const sizeValue = types.SIZE_MAP[size] ?? (typeof size === "number" ? size : 24);
173
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="${sizeValue}" height="${sizeValue}" class="${className}" fill="${primaryColor}"><path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" fill="${primaryColor}"></path></svg>`;
174
+ }
170
175
  }
171
- /**
172
- * Type guard to check if a component is an RSC-compatible icon
173
- */
174
176
  function isRSCIcon(component) {
175
- return (typeof component === 'function' &&
176
- 'displayName' in component &&
177
- typeof component.displayName === 'string' &&
178
- component.displayName.endsWith('RSC'));
177
+ return typeof component === "function" && "displayName" in component && typeof component.displayName === "string" && component.displayName.endsWith("RSC");
179
178
  }
180
- /* ────────────────────────────────────────────────────────────────────────────
181
- RSC ICON WRAPPER
182
- ───────────────────────────────────────────────────────────────────────────── */
183
- /**
184
- * Creates an RSC version from an existing icon's path config.
185
- * This allows creating RSC-compatible versions from standard icons.
186
- *
187
- * @example
188
- * ```tsx
189
- * import { NtdHome } from '@nice2dev/icons';
190
- * import { wrapAsRSC } from '@nice2dev/icons/rsc';
191
- *
192
- * // Note: This requires access to the original path config
193
- * const NtdHomeRSC = wrapAsRSC(NtdHome);
194
- * ```
195
- */
196
179
  function wrapAsRSC(originalPaths, displayName) {
197
- return createIconRSC({
198
- displayName: `${displayName}RSC`,
199
- paths: originalPaths,
200
- });
180
+ return createIconRSC({
181
+ displayName: `${displayName}RSC`,
182
+ paths: originalPaths
183
+ });
201
184
  }
202
-
203
185
  exports.GRADIENT_PRESETS = types.GRADIENT_PRESETS;
204
186
  exports.SEMANTIC_COLOR_DEFAULTS = types.SEMANTIC_COLOR_DEFAULTS;
205
187
  exports.SIZE_MAP = types.SIZE_MAP;
@@ -1,145 +1,88 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
-
5
- /**
6
- * Tags whose `rx`/`ry` express a *corner rounding* rather than the shape
7
- * itself. `circle` / `ellipse` are deliberately absent — a circle has to stay
8
- * a circle in every variant.
9
- */
10
- const ROUNDED_CORNER_TAGS = new Set(['rect']);
11
- /**
12
- * Scale factor of the `mini` variant, about the icon centre. Shared by the
13
- * client (`createIcon`) and RSC (`rsc`) renderers so the two stay identical.
14
- *
15
- * Thinning the stroke — what `mini` did on its own — is invisible on a filled
16
- * shape, which left `mini` indistinguishable from `solid` for most of the set.
17
- */
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const React = require("react");
4
+ const ROUNDED_CORNER_TAGS = /* @__PURE__ */ new Set(["rect"]);
18
5
  const MINI_SCALE = 0.875;
19
- /**
20
- * Corner radius `rounded` gives a `<rect>`, as a fraction of its shorter side.
21
- * Relative rather than absolute so it reads the same on a 16-unit detail rect
22
- * and on a full-bleed 22-unit background.
23
- */
24
6
  const ROUND_RADIUS_RATIO = 0.25;
25
- /** SVG lengths arrive as numbers or numeric strings; anything else is unusable. */
26
7
  function toNumber(value) {
27
- const n = typeof value === 'number' ? value : typeof value === 'string' ? Number(value) : NaN;
28
- return Number.isFinite(n) ? n : undefined;
8
+ const n = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
9
+ return Number.isFinite(n) ? n : void 0;
29
10
  }
30
- /**
31
- * Turns a rendered `solid` tree into its `sharp` equivalent: square line caps,
32
- * mitered joins and zeroed corner radii, applied recursively.
33
- *
34
- * The `sharp` variant has no per-icon path data — it reuses `paths.solid` — so
35
- * without this pass it would be pixel-identical to `solid` for every fill-based
36
- * icon. Overriding rather than defaulting matters: some icons hardcode their
37
- * own `strokeLinecap` / `strokeLinejoin`, and those must not survive here.
38
- *
39
- * Intrinsic (string-typed) elements only — fragments are traversed but never
40
- * receive SVG attributes.
41
- */
42
11
  function sharpenTree(node) {
43
- return React.Children.map(node, (child) => {
44
- if (!React.isValidElement(child)) {
45
- return child;
46
- }
47
- const el = child;
48
- const next = {};
49
- if (typeof el.type === 'string') {
50
- next.strokeLinecap = 'square';
51
- next.strokeLinejoin = 'miter';
52
- if (ROUNDED_CORNER_TAGS.has(el.type)) {
53
- next.rx = 0;
54
- next.ry = 0;
55
- }
56
- }
57
- const { children } = el.props;
58
- if (children != null) {
59
- next.children = sharpenTree(children);
60
- }
61
- return React.cloneElement(el, next);
62
- });
12
+ return React.Children.map(node, (child) => {
13
+ if (!React.isValidElement(child)) {
14
+ return child;
15
+ }
16
+ const el = child;
17
+ const next = {};
18
+ if (typeof el.type === "string") {
19
+ next.strokeLinecap = "square";
20
+ next.strokeLinejoin = "miter";
21
+ if (ROUNDED_CORNER_TAGS.has(el.type)) {
22
+ next.rx = 0;
23
+ next.ry = 0;
24
+ }
25
+ }
26
+ const { children } = el.props;
27
+ if (children != null) {
28
+ next.children = sharpenTree(children);
29
+ }
30
+ return React.cloneElement(el, next);
31
+ });
63
32
  }
64
- /**
65
- * The mirror of {@link sharpenTree}: round line caps and joins, and `<rect>`
66
- * corners rounded to {@link ROUND_RADIUS_RATIO} of the shorter side.
67
- *
68
- * `rounded` reuses `paths.solid` exactly like `sharp` does, so without this pass
69
- * it is indistinguishable from `solid`. Same override-don't-default rule — icons
70
- * that hardcode square caps have to lose them here.
71
- *
72
- * A rect whose `width`/`height` cannot be read keeps whatever radius it had:
73
- * guessing a radius without knowing the box would deform the shape. Rectangles
74
- * drawn as `<path>` are out of reach either way — the same limitation
75
- * `sharpenTree` documents above.
76
- */
77
33
  function roundTree(node) {
78
- return React.Children.map(node, (child) => {
79
- var _a;
80
- if (!React.isValidElement(child)) {
81
- return child;
82
- }
83
- const el = child;
84
- const next = {};
85
- if (typeof el.type === 'string') {
86
- next.strokeLinecap = 'round';
87
- next.strokeLinejoin = 'round';
88
- if (ROUNDED_CORNER_TAGS.has(el.type)) {
89
- const width = toNumber(el.props.width);
90
- const height = toNumber(el.props.height);
91
- if (width !== undefined && height !== undefined) {
92
- const radius = Math.max((_a = toNumber(el.props.rx)) !== null && _a !== void 0 ? _a : 0, Math.min(width, height) * ROUND_RADIUS_RATIO);
93
- next.rx = radius;
94
- next.ry = radius;
95
- }
96
- }
34
+ return React.Children.map(node, (child) => {
35
+ if (!React.isValidElement(child)) {
36
+ return child;
37
+ }
38
+ const el = child;
39
+ const next = {};
40
+ if (typeof el.type === "string") {
41
+ next.strokeLinecap = "round";
42
+ next.strokeLinejoin = "round";
43
+ if (ROUNDED_CORNER_TAGS.has(el.type)) {
44
+ const width = toNumber(el.props.width);
45
+ const height = toNumber(el.props.height);
46
+ if (width !== void 0 && height !== void 0) {
47
+ const radius = Math.max(
48
+ toNumber(el.props.rx) ?? 0,
49
+ Math.min(width, height) * ROUND_RADIUS_RATIO
50
+ );
51
+ next.rx = radius;
52
+ next.ry = radius;
97
53
  }
98
- const { children } = el.props;
99
- if (children != null) {
100
- next.children = roundTree(children);
101
- }
102
- return React.cloneElement(el, next);
103
- });
54
+ }
55
+ }
56
+ const { children } = el.props;
57
+ if (children != null) {
58
+ next.children = roundTree(children);
59
+ }
60
+ return React.cloneElement(el, next);
61
+ });
104
62
  }
105
- /**
106
- * Stroke width of the `wireframe` variant — a thin, uniform construction line,
107
- * deliberately independent of the caller's `strokeWidth` so a wireframe grid
108
- * draws at one consistent weight.
109
- */
110
63
  const WIREFRAME_STROKE = 1;
111
- /**
112
- * Turns a rendered tree into its `wireframe` equivalent: every shape becomes an
113
- * unfilled thin outline in the primary colour, keeping the interior construction
114
- * that `outline` drops (creases, inner discs, duotone underlays).
115
- *
116
- * Fed from `paths.solid`, because that layer carries the whole construction —
117
- * `outline` is the silhouette only. Per-shape `opacity` is cleared as well, so a
118
- * faint duotone wash does not survive as a ghost line.
119
- */
120
64
  function wireTree(node, color) {
121
- return React.Children.map(node, (child) => {
122
- if (!React.isValidElement(child)) {
123
- return child;
124
- }
125
- const el = child;
126
- const next = {};
127
- if (typeof el.type === 'string') {
128
- next.fill = 'none';
129
- next.stroke = color;
130
- next.strokeWidth = WIREFRAME_STROKE;
131
- next.strokeLinecap = 'round';
132
- next.strokeLinejoin = 'round';
133
- next.opacity = undefined;
134
- }
135
- const { children } = el.props;
136
- if (children != null) {
137
- next.children = wireTree(children, color);
138
- }
139
- return React.cloneElement(el, next);
140
- });
65
+ return React.Children.map(node, (child) => {
66
+ if (!React.isValidElement(child)) {
67
+ return child;
68
+ }
69
+ const el = child;
70
+ const next = {};
71
+ if (typeof el.type === "string") {
72
+ next.fill = "none";
73
+ next.stroke = color;
74
+ next.strokeWidth = WIREFRAME_STROKE;
75
+ next.strokeLinecap = "round";
76
+ next.strokeLinejoin = "round";
77
+ next.opacity = void 0;
78
+ }
79
+ const { children } = el.props;
80
+ if (children != null) {
81
+ next.children = wireTree(children, color);
82
+ }
83
+ return React.cloneElement(el, next);
84
+ });
141
85
  }
142
-
143
86
  exports.MINI_SCALE = MINI_SCALE;
144
87
  exports.WIREFRAME_STROKE = WIREFRAME_STROKE;
145
88
  exports.roundTree = roundTree;