@nice2dev/icons 1.3.15 → 1.3.16

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 (140) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/NiceDesktopIconExporter.js +688 -599
  3. package/dist/cjs/NiceFaviconGenerator.js +603 -417
  4. package/dist/cjs/NiceIconPicker.js +788 -508
  5. package/dist/cjs/NiceIconPreview.js +246 -188
  6. package/dist/cjs/NiceIconSetCreator.js +683 -552
  7. package/dist/cjs/NiceIconStacker.js +547 -171
  8. package/dist/cjs/NiceIconValue.js +27 -35
  9. package/dist/cjs/NtdIconBadge.js +384 -360
  10. package/dist/cjs/NtdIconMorph.js +419 -354
  11. package/dist/cjs/NtdStateMorph.js +150 -147
  12. package/dist/cjs/advancedIconSearch.js +373 -510
  13. package/dist/cjs/animationControls.js +518 -642
  14. package/dist/cjs/client.js +12 -15
  15. package/dist/cjs/createIcon.js +349 -251
  16. package/dist/cjs/design-tokens.js +324 -390
  17. package/dist/cjs/figmaExport.js +162 -257
  18. package/dist/cjs/figmaSync.js +234 -316
  19. package/dist/cjs/headless-ui.js +240 -368
  20. package/dist/cjs/iconAnalytics.js +337 -393
  21. package/dist/cjs/iconHtml.js +64 -86
  22. package/dist/cjs/iconMetadata.js +392 -472
  23. package/dist/cjs/iconParts.js +120 -90
  24. package/dist/cjs/iconStack.js +136 -155
  25. package/dist/cjs/iconStyles.js +1609 -504
  26. package/dist/cjs/iconValue.js +359 -430
  27. package/dist/cjs/icons/accessibility.js +1119 -134
  28. package/dist/cjs/icons/actions.js +1290 -330
  29. package/dist/cjs/icons/ai.js +1424 -144
  30. package/dist/cjs/icons/brand.js +1344 -172
  31. package/dist/cjs/icons/business.js +903 -193
  32. package/dist/cjs/icons/devtech.js +1656 -227
  33. package/dist/cjs/icons/ecommerce.js +802 -111
  34. package/dist/cjs/icons/education.js +1345 -199
  35. package/dist/cjs/icons/files.js +1597 -328
  36. package/dist/cjs/icons/fintech.js +793 -104
  37. package/dist/cjs/icons/food.js +1507 -153
  38. package/dist/cjs/icons/fun.js +786 -109
  39. package/dist/cjs/icons/gaming.js +916 -170
  40. package/dist/cjs/icons/health.js +623 -112
  41. package/dist/cjs/icons/index.js +32 -35
  42. package/dist/cjs/icons/input.js +282 -83
  43. package/dist/cjs/icons/legal.js +1065 -122
  44. package/dist/cjs/icons/media.js +1061 -267
  45. package/dist/cjs/icons/navigation.js +387 -122
  46. package/dist/cjs/icons/omniverk.js +747 -90
  47. package/dist/cjs/icons/realestate.js +1520 -193
  48. package/dist/cjs/icons/saas.js +867 -98
  49. package/dist/cjs/icons/science.js +1451 -202
  50. package/dist/cjs/icons/shapes.js +1316 -308
  51. package/dist/cjs/icons/smarthome.js +786 -90
  52. package/dist/cjs/icons/social.js +591 -59
  53. package/dist/cjs/icons/sports.js +1225 -133
  54. package/dist/cjs/icons/sustainability.js +1211 -139
  55. package/dist/cjs/icons/travel.js +1470 -148
  56. package/dist/cjs/icons/ui.js +1508 -315
  57. package/dist/cjs/icons/weather.js +1160 -173
  58. package/dist/cjs/index.js +566 -568
  59. package/dist/cjs/lottieIntegration.js +261 -266
  60. package/dist/cjs/nicetodev-icons.css +1 -1
  61. package/dist/cjs/particleEffects.js +270 -251
  62. package/dist/cjs/resolver.js +229 -284
  63. package/dist/cjs/rsc.js +175 -193
  64. package/dist/cjs/sharpen.js +73 -130
  65. package/dist/cjs/smilAnimations.js +371 -165
  66. package/dist/cjs/stacking.js +87 -122
  67. package/dist/cjs/tailwind-plugin.js +280 -320
  68. package/dist/cjs/types.js +46 -72
  69. package/dist/cjs/utilities.js +163 -324
  70. package/dist/cjs/variantProps.js +12 -52
  71. package/dist/esm/NiceDesktopIconExporter.js +671 -598
  72. package/dist/esm/NiceFaviconGenerator.js +583 -416
  73. package/dist/esm/NiceIconPicker.js +789 -507
  74. package/dist/esm/NiceIconPreview.js +247 -187
  75. package/dist/esm/NiceIconSetCreator.js +685 -551
  76. package/dist/esm/NiceIconStacker.js +549 -170
  77. package/dist/esm/NiceIconValue.js +29 -34
  78. package/dist/esm/NtdIconBadge.js +388 -359
  79. package/dist/esm/NtdIconMorph.js +423 -353
  80. package/dist/esm/NtdStateMorph.js +152 -146
  81. package/dist/esm/advancedIconSearch.js +391 -509
  82. package/dist/esm/animationControls.js +527 -641
  83. package/dist/esm/client.js +48 -10
  84. package/dist/esm/createIcon.js +350 -250
  85. package/dist/esm/design-tokens.js +334 -387
  86. package/dist/esm/figmaExport.js +170 -256
  87. package/dist/esm/figmaSync.js +237 -315
  88. package/dist/esm/headless-ui.js +254 -365
  89. package/dist/esm/iconAnalytics.js +342 -392
  90. package/dist/esm/iconHtml.js +67 -85
  91. package/dist/esm/iconMetadata.js +404 -471
  92. package/dist/esm/iconParts.js +125 -89
  93. package/dist/esm/iconStack.js +145 -154
  94. package/dist/esm/iconStyles.js +1620 -503
  95. package/dist/esm/iconValue.js +361 -429
  96. package/dist/esm/icons/accessibility.js +1133 -133
  97. package/dist/esm/icons/actions.js +1320 -329
  98. package/dist/esm/icons/ai.js +1441 -143
  99. package/dist/esm/icons/brand.js +1351 -171
  100. package/dist/esm/icons/business.js +931 -201
  101. package/dist/esm/icons/devtech.js +1687 -226
  102. package/dist/esm/icons/ecommerce.js +816 -110
  103. package/dist/esm/icons/education.js +1364 -198
  104. package/dist/esm/icons/files.js +1628 -327
  105. package/dist/esm/icons/fintech.js +807 -103
  106. package/dist/esm/icons/food.js +1524 -152
  107. package/dist/esm/icons/fun.js +801 -108
  108. package/dist/esm/icons/gaming.js +933 -169
  109. package/dist/esm/icons/health.js +636 -111
  110. package/dist/esm/icons/index.js +596 -32
  111. package/dist/esm/icons/input.js +326 -82
  112. package/dist/esm/icons/legal.js +1079 -121
  113. package/dist/esm/icons/media.js +1086 -266
  114. package/dist/esm/icons/navigation.js +401 -121
  115. package/dist/esm/icons/omniverk.js +759 -89
  116. package/dist/esm/icons/realestate.js +1544 -198
  117. package/dist/esm/icons/saas.js +880 -97
  118. package/dist/esm/icons/science.js +1477 -208
  119. package/dist/esm/icons/shapes.js +1343 -307
  120. package/dist/esm/icons/smarthome.js +799 -89
  121. package/dist/esm/icons/social.js +599 -58
  122. package/dist/esm/icons/sports.js +1240 -132
  123. package/dist/esm/icons/sustainability.js +1226 -138
  124. package/dist/esm/icons/travel.js +1486 -147
  125. package/dist/esm/icons/ui.js +1540 -314
  126. package/dist/esm/icons/weather.js +1181 -172
  127. package/dist/esm/index.js +756 -58
  128. package/dist/esm/lottieIntegration.js +264 -265
  129. package/dist/esm/nicetodev-icons.css +1 -1
  130. package/dist/esm/particleEffects.js +271 -250
  131. package/dist/esm/resolver.js +231 -283
  132. package/dist/esm/rsc.js +182 -192
  133. package/dist/esm/sharpen.js +78 -129
  134. package/dist/esm/smilAnimations.js +376 -164
  135. package/dist/esm/stacking.js +99 -121
  136. package/dist/esm/tailwind-plugin.js +282 -319
  137. package/dist/esm/types.js +50 -71
  138. package/dist/esm/utilities.js +177 -321
  139. package/dist/esm/variantProps.js +23 -52
  140. package/package.json +15 -22
@@ -1,142 +1,120 @@
1
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { Children, cloneElement, isValidElement } from 'react';
3
-
4
- /**
5
- * Icons stacked by nesting (1.3.5): `<NtdSquare><NtdStar stackAlign="center">1</NtdStar></NtdSquare>`.
6
- * An icon draws its children inside its own `<svg>` — an icon child as a nested `<svg>` placed by
7
- * its `stackAlign` / `stackSize`, text centred on the icon, anything else as it is. So the stack
8
- * is one SVG: it exports and copies like any icon.
9
- */
10
- /** Set on every component createIcon makes, so a parent icon tells its icon children apart. */
11
- const NTD_ICON_MARK = 'ntdIcon';
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { Children, cloneElement, isValidElement } from "react";
3
+ const NTD_ICON_MARK = "ntdIcon";
12
4
  function isNtdIconElement(node) {
13
- return (isValidElement(node) &&
14
- typeof node.type !== 'string' &&
15
- Boolean(node.type[NTD_ICON_MARK]));
5
+ return isValidElement(node) && typeof node.type !== "string" && Boolean(node.type[NTD_ICON_MARK]);
16
6
  }
17
- /** Set on every component createIcon makes, next to {@link NTD_ICON_MARK}: its {@link PerfectStack}. */
18
- const PERFECT_STACK = 'perfectStack';
19
- /** The spot icon component `icon` keeps for stacked icons; `undefined` when it is not an icon. */
7
+ const PERFECT_STACK = "perfectStack";
20
8
  function perfectStackOf(icon) {
21
- return icon && (typeof icon === 'object' || typeof icon === 'function')
22
- ? icon[PERFECT_STACK]
23
- : undefined;
9
+ return icon && (typeof icon === "object" || typeof icon === "function") ? icon[PERFECT_STACK] : void 0;
24
10
  }
25
- /** A child of the spot's default size and no turn, at the box centre — `'center'`. */
26
11
  const BOX_PERFECT_STACK = { rotation: 0, size: 0.6 };
27
- /** Variants drawn with lines; every other variant is a filled shape. */
28
- const LINE_VARIANTS = new Set(['outline', 'wireframe']);
12
+ const LINE_VARIANTS = /* @__PURE__ */ new Set(["outline", "wireframe"]);
29
13
  function isFilledVariant(variant) {
30
- return !LINE_VARIANTS.has(variant);
14
+ return !LINE_VARIANTS.has(variant);
31
15
  }
32
- /** Default share of the parent: centred children larger, edge and corner badges smaller. */
33
16
  function defaultStackSize(align) {
34
- return align === 'center' ? 0.6 : 0.5;
17
+ return align === "center" ? 0.6 : 0.5;
35
18
  }
36
- /**
37
- * Top-left corner of a stacked icon `size` units big inside the 24-unit box. A `half-…` position is
38
- * halfway between the centre and the edge or corner it names (1.3.6).
39
- */
40
19
  function stackPlacement(align, size) {
41
- const far = 24 - size;
42
- const mid = far / 2;
43
- const half = align.startsWith('half-');
44
- const edge = half ? align.slice(5) : align;
45
- const x = edge.endsWith('left') ? 0 : edge.endsWith('right') ? far : mid;
46
- const y = edge.startsWith('top') ? 0 : edge.startsWith('bottom') ? far : mid;
47
- return half ? [(x + mid) / 2, (y + mid) / 2] : [x, y];
20
+ const far = 24 - size;
21
+ const mid = far / 2;
22
+ const half = align.startsWith("half-");
23
+ const edge = half ? align.slice(5) : align;
24
+ const x = edge.endsWith("left") ? 0 : edge.endsWith("right") ? far : mid;
25
+ const y = edge.startsWith("top") ? 0 : edge.startsWith("bottom") ? far : mid;
26
+ return half ? [(x + mid) / 2, (y + mid) / 2] : [x, y];
48
27
  }
49
- /**
50
- * `at` moved by `percent` of the parent (`stackOffsetX` / `stackOffsetY`, 1.3.7), in the parent's
51
- * 24 units. Rounded to a thousandth, so the markup reads 7.2, not 7.199999999999999.
52
- */
53
28
  function stackOffset(at, percent) {
54
- return percent ? Math.round(1000 * at + 240 * percent) / 1000 : at;
29
+ return percent ? Math.round(1e3 * at + 240 * percent) / 1e3 : at;
55
30
  }
56
- /** A corner badge — a full corner; `half-` corners sit inside the parent like its centre. */
57
31
  function isCornerBadge(align) {
58
- return /^(top|bottom)-(left|right)$/.test(align);
32
+ return /^(top|bottom)-(left|right)$/.test(align);
59
33
  }
60
- /**
61
- * Font size of text children by length: one character 9, two 7.5, three 6, more 5 (1.3.6 — three
62
- * quarters of the first sizes, so a number sits inside a star or a circle with room round it).
63
- * In a spot smaller or larger than the default 0.6 (`perfectStackSize`, 1.3.8) it scales with it.
64
- */
65
34
  function defaultTextSize(length, spot = BOX_PERFECT_STACK.size) {
66
- const size = length <= 1 ? 9 : length === 2 ? 7.5 : length === 3 ? 6 : 5;
67
- return spot === BOX_PERFECT_STACK.size
68
- ? size
69
- : Math.round((10 * size * spot) / BOX_PERFECT_STACK.size) / 10;
35
+ const size = length <= 1 ? 9 : length === 2 ? 7.5 : length === 3 ? 6 : 5;
36
+ return spot === BOX_PERFECT_STACK.size ? size : Math.round(10 * size * spot / BOX_PERFECT_STACK.size) / 10;
70
37
  }
71
- /** `n` rounded to a thousandth — 7.2 in the markup, not 7.199999999999999. */
72
- const thousandth = (n) => Math.round(1000 * n) / 1000;
73
- /** The cutout variant draws its shape at 80% in the tile; its stack follows the shape. */
74
- const CUTOUT_SHAPE = 'translate(12 12) scale(0.8) translate(-12 -12)';
75
- /** The gap kept round a corner badge, in the parent's units. */
38
+ const thousandth = (n) => Math.round(1e3 * n) / 1e3;
39
+ const CUTOUT_SHAPE = "translate(12 12) scale(0.8) translate(-12 -12)";
76
40
  const BADGE_GAP = 1;
77
- /**
78
- * The children of an icon, drawn into it. A child without a `stackAlign` goes to the spot the icon
79
- * keeps for it (`ctx.perfect`: its centre, size and turn), and so does text. Colours given on a
80
- * child win; otherwise:
81
- * - content inside — at that spot, centred, at an edge or halfway out — is cut out of a filled parent: an icon child takes
82
- * the parent's accent as its primary (and the parent's primary as its accent, so its own text
83
- * and details read), text the accent; on `outline` / `wireframe` it stays in the parent's
84
- * colours; in a cutout it takes the tile's colour, drawn solid in the cut;
85
- * - a corner badge keeps the parent's colours and sits on a disc of the accent colour a little
86
- * larger than itself — a gap cut into the parent where they overlap, unseen beyond it.
87
- */
88
41
  function renderStackChildren(children, ctx) {
89
- var _a, _b;
90
- const items = Children.toArray(children);
91
- if (items.length === 0) {
92
- return null;
42
+ const items = Children.toArray(children);
43
+ if (items.length === 0) {
44
+ return null;
45
+ }
46
+ const cutout = ctx.variant === "cutout";
47
+ const filled = isFilledVariant(ctx.variant);
48
+ const insidePrimary = cutout ? ctx.tileColor : filled ? ctx.accentColor : ctx.primaryColor;
49
+ const insideAccent = filled && !cutout ? ctx.primaryColor : ctx.accentColor;
50
+ const text = items.filter((c) => typeof c === "string" || typeof c === "number").join("");
51
+ const { perfect } = ctx;
52
+ const layers = items.map((child, i) => {
53
+ if (isNtdIconElement(child)) {
54
+ const p = child.props;
55
+ const align = p.stackAlign ?? "perfect";
56
+ const atSpot = align === "perfect";
57
+ const size = thousandth(
58
+ 24 * (p.stackSize ?? (atSpot ? perfect.size : defaultStackSize(align)))
59
+ );
60
+ const [alignX, alignY] = atSpot ? [thousandth(perfect.x - size / 2), thousandth(perfect.y - size / 2)] : stackPlacement(align, size);
61
+ const x = stackOffset(alignX, p.stackOffsetX);
62
+ const y = stackOffset(alignY, p.stackOffsetY);
63
+ const badge = isCornerBadge(align);
64
+ const icon = cloneElement(child, {
65
+ x,
66
+ y,
67
+ size,
68
+ variant: p.variant ?? (cutout ? "solid" : ctx.variant),
69
+ primaryColor: p.primaryColor ?? (badge ? ctx.primaryColor : insidePrimary),
70
+ accentColor: p.accentColor ?? (badge ? ctx.accentColor : insideAccent),
71
+ strokeWidth: p.strokeWidth ?? ctx.strokeWidth
72
+ });
73
+ const cx = x + size / 2;
74
+ const cy = y + size / 2;
75
+ const rotation = p.stackRotation ?? (atSpot ? perfect.rotation : 0);
76
+ const turn = rotation ? `rotate(${rotation} ${cx} ${cy})` : void 0;
77
+ if (!badge && !turn) {
78
+ return icon;
79
+ }
80
+ return /* @__PURE__ */ jsxs("g", { transform: turn, children: [
81
+ badge && /* @__PURE__ */ jsx("circle", { cx, cy, r: size / 2 + BADGE_GAP, fill: ctx.accentColor }),
82
+ icon
83
+ ] }, child.key ?? i);
93
84
  }
94
- const cutout = ctx.variant === 'cutout';
95
- const filled = isFilledVariant(ctx.variant);
96
- const insidePrimary = cutout ? ctx.tileColor : filled ? ctx.accentColor : ctx.primaryColor;
97
- const insideAccent = filled && !cutout ? ctx.primaryColor : ctx.accentColor;
98
- const text = items
99
- .filter((c) => typeof c === 'string' || typeof c === 'number')
100
- .join('');
101
- const { perfect } = ctx;
102
- const layers = items.map((child, i) => {
103
- var _a, _b, _c, _d, _e, _f, _g, _h;
104
- if (isNtdIconElement(child)) {
105
- const p = child.props;
106
- const align = (_a = p.stackAlign) !== null && _a !== void 0 ? _a : 'perfect';
107
- // the parent's own spot (1.3.8): its centre, size and turn, unless the child sets them
108
- const atSpot = align === 'perfect';
109
- const size = thousandth(24 * ((_b = p.stackSize) !== null && _b !== void 0 ? _b : (atSpot ? perfect.size : defaultStackSize(align))));
110
- const [alignX, alignY] = atSpot
111
- ? [thousandth(perfect.x - size / 2), thousandth(perfect.y - size / 2)]
112
- : stackPlacement(align, size);
113
- // nudged from the aligned spot (1.3.7) — a share of the parent, so it scales with it
114
- const x = stackOffset(alignX, p.stackOffsetX);
115
- const y = stackOffset(alignY, p.stackOffsetY);
116
- const badge = isCornerBadge(align);
117
- const icon = cloneElement(child, {
118
- x,
119
- y,
120
- size,
121
- variant: (_c = p.variant) !== null && _c !== void 0 ? _c : (cutout ? 'solid' : ctx.variant),
122
- primaryColor: (_d = p.primaryColor) !== null && _d !== void 0 ? _d : (badge ? ctx.primaryColor : insidePrimary),
123
- accentColor: (_e = p.accentColor) !== null && _e !== void 0 ? _e : (badge ? ctx.accentColor : insideAccent),
124
- strokeWidth: (_f = p.strokeWidth) !== null && _f !== void 0 ? _f : ctx.strokeWidth,
125
- });
126
- const cx = x + size / 2;
127
- const cy = y + size / 2;
128
- // turned about its own centre (1.3.6) — through a group: a nested <svg> takes no transform
129
- const rotation = (_g = p.stackRotation) !== null && _g !== void 0 ? _g : (atSpot ? perfect.rotation : 0);
130
- const turn = rotation ? `rotate(${rotation} ${cx} ${cy})` : undefined;
131
- if (!badge && !turn) {
132
- return icon;
133
- }
134
- return (jsxs("g", { transform: turn, children: [badge && jsx("circle", { cx: cx, cy: cy, r: size / 2 + BADGE_GAP, fill: ctx.accentColor }), icon] }, (_h = child.key) !== null && _h !== void 0 ? _h : i));
135
- }
136
- return isValidElement(child) ? child : null;
137
- });
138
- const content = (jsxs(Fragment, { children: [layers, text && (jsx("text", { x: perfect.x, y: perfect.y, transform: perfect.rotation ? `rotate(${perfect.rotation} ${perfect.x} ${perfect.y})` : undefined, textAnchor: "middle", dominantBaseline: "central", fontSize: (_a = ctx.textSize) !== null && _a !== void 0 ? _a : defaultTextSize(text.length, perfect.size), fontWeight: 700, fill: (_b = ctx.textColor) !== null && _b !== void 0 ? _b : insidePrimary, stroke: "none", children: text }))] }));
139
- return cutout ? jsx("g", { transform: CUTOUT_SHAPE, children: content }) : content;
85
+ return isValidElement(child) ? child : null;
86
+ });
87
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
88
+ layers,
89
+ text && /* @__PURE__ */ jsx(
90
+ "text",
91
+ {
92
+ x: perfect.x,
93
+ y: perfect.y,
94
+ transform: perfect.rotation ? `rotate(${perfect.rotation} ${perfect.x} ${perfect.y})` : void 0,
95
+ textAnchor: "middle",
96
+ dominantBaseline: "central",
97
+ fontSize: ctx.textSize ?? defaultTextSize(text.length, perfect.size),
98
+ fontWeight: 700,
99
+ fill: ctx.textColor ?? insidePrimary,
100
+ stroke: "none",
101
+ children: text
102
+ }
103
+ )
104
+ ] });
105
+ return cutout ? /* @__PURE__ */ jsx("g", { transform: CUTOUT_SHAPE, children: content }) : content;
140
106
  }
141
-
142
- export { BOX_PERFECT_STACK, NTD_ICON_MARK, PERFECT_STACK, defaultStackSize, defaultTextSize, isCornerBadge, isFilledVariant, isNtdIconElement, perfectStackOf, renderStackChildren, stackOffset, stackPlacement };
107
+ export {
108
+ BOX_PERFECT_STACK,
109
+ NTD_ICON_MARK,
110
+ PERFECT_STACK,
111
+ defaultStackSize,
112
+ defaultTextSize,
113
+ isCornerBadge,
114
+ isFilledVariant,
115
+ isNtdIconElement,
116
+ perfectStackOf,
117
+ renderStackChildren,
118
+ stackOffset,
119
+ stackPlacement
120
+ };