vadivam-astro 0.0.80 → 0.0.81

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/README.md CHANGED
@@ -8,7 +8,7 @@ Tree-shakeable 24px outline and solid SVG icons for Astro.
8
8
  [![downloads](https://img.shields.io/npm/dw/vadivam-astro?style=flat-square&color=666)](https://www.npmjs.com/package/vadivam-astro)
9
9
  [![license](https://img.shields.io/npm/l/vadivam-astro?style=flat-square&color=111)](https://github.com/praveenjuge/vadivam/blob/main/LICENSE)
10
10
 
11
- ![All Vadivam icons](https://raw.githubusercontent.com/praveenjuge/vadivam/main/apps/docs/public/preview.png?v=0.0.80)
11
+ ![All Vadivam icons](https://raw.githubusercontent.com/praveenjuge/vadivam/main/apps/docs/public/preview.png?v=0.0.81)
12
12
 
13
13
  ```sh
14
14
  npm install vadivam-astro
@@ -31,6 +31,8 @@ Every icon also has a solid twin with the same name in `vadivam-astro/solid`. So
31
31
  import { Activity } from "vadivam-astro/solid";
32
32
  ```
33
33
 
34
- Package family: [SVG and JavaScript](https://www.npmjs.com/package/vadivam) · [React](https://www.npmjs.com/package/vadivam-react) · [React Native](https://www.npmjs.com/package/vadivam-react-native) · [Vue](https://www.npmjs.com/package/vadivam-vue) · [Svelte](https://www.npmjs.com/package/vadivam-svelte) · [Solid](https://www.npmjs.com/package/vadivam-solid) · [Angular](https://www.npmjs.com/package/vadivam-angular) · [Preact](https://www.npmjs.com/package/vadivam-preact) · [Qwik](https://www.npmjs.com/package/vadivam-qwik) · [Lit](https://www.npmjs.com/package/vadivam-lit) · [Flutter](https://pub.dev/packages/vadivam) · [Jetpack Compose](https://central.sonatype.com/artifact/com.praveenjuge/vadivam-compose) · [MCP server](https://www.npmjs.com/package/vadivam-mcp)
34
+ <!-- vadivam-packages:start -->
35
+ Package family: [SVG and JavaScript](https://www.npmjs.com/package/vadivam) · [React](https://www.npmjs.com/package/vadivam-react) · [React Native](https://www.npmjs.com/package/vadivam-react-native) · [Vue](https://www.npmjs.com/package/vadivam-vue) · [Svelte](https://www.npmjs.com/package/vadivam-svelte) · [Solid](https://www.npmjs.com/package/vadivam-solid) · [Preact](https://www.npmjs.com/package/vadivam-preact) · [Angular](https://www.npmjs.com/package/vadivam-angular) · [Qwik](https://www.npmjs.com/package/vadivam-qwik) · [Lit](https://www.npmjs.com/package/vadivam-lit) · [Flutter](https://pub.dev/packages/vadivam) · [Compose](https://central.sonatype.com/artifact/com.praveenjuge/vadivam-compose) · [MCP server](https://www.npmjs.com/package/vadivam-mcp)
36
+ <!-- vadivam-packages:end -->
35
37
 
36
38
  [Issues](https://github.com/praveenjuge/vadivam/issues)
package/dist/Icon.astro CHANGED
@@ -4,15 +4,14 @@ import { sanitizeIconNode, sanitizePaint, sanitizeRootAttributes } from "./runti
4
4
  import { trustedIconNodes } from "./trustedIconNodes.js";
5
5
  import type { VadivamProps } from "./types.js";
6
6
  const { name, size = 24, color = "currentColor", strokeWidth, "stroke-width": kebabStrokeWidth, absoluteStrokeWidth = false, title, iconNode = [], class: className, ...rest } = Astro.props as VadivamProps;
7
- const resolvedStroke = strokeWidth ?? kebabStrokeWidth ?? 2;
8
- const numericSize = Number(size);
9
- const numericStroke = Number(resolvedStroke);
10
- const calculatedStroke = absoluteStrokeWidth && Number.isFinite(numericSize) && numericSize !== 0 && Number.isFinite(numericStroke) ? numericStroke * 24 / numericSize : resolvedStroke;
7
+ function mergeClasses(...values: unknown[]): string { return values.flatMap((value) => typeof value === "string" ? value.split(/\s+/) : []).filter((value, index, all) => value && all.indexOf(value) === index).join(" "); }
8
+ function isLabelled(title: unknown, attributeNames: string[]): boolean { return Boolean(title) || attributeNames.some((name) => name.startsWith("aria-") || name === "role" || name === "title"); }
9
+ function scaledStrokeWidth(strokeWidth: string | number, size: string | number, absolute: unknown): string | number { const numericSize = Number(size); const numericStroke = Number(strokeWidth); return absolute && Number.isFinite(numericSize) && numericSize !== 0 && Number.isFinite(numericStroke) ? numericStroke * 24 / numericSize : strokeWidth; }
11
10
  const safeRest = sanitizeRootAttributes(rest);
12
11
  const safeIconNode = trustedIconNodes.has(iconNode) ? iconNode : sanitizeIconNode(iconNode);
13
- const labelled = Boolean(title) || Object.keys(safeRest).some((key) => key.startsWith("aria-") || key === "role");
14
- const mergedClass = Array.from(new Set(["vadivam", name && `vadivam-${name}`, className].flatMap((value) => typeof value === "string" ? value.split(/\s+/) : []).filter(Boolean))).join(" ");
15
- const svgAttributes = { ...defaultAttributes, width: size, height: size, stroke: sanitizePaint(color), "stroke-width": calculatedStroke, class: mergedClass, ...(!labelled ? { "aria-hidden": "true" } : {}), ...(title ? { role: "img" } : {}), ...safeRest };
12
+ const labelled = isLabelled(title, Object.keys(safeRest));
13
+ const mergedClass = mergeClasses("vadivam", name && `vadivam-${name}`, className);
14
+ const svgAttributes = { ...defaultAttributes, width: size, height: size, stroke: sanitizePaint(color), "stroke-width": scaledStrokeWidth(strokeWidth ?? kebabStrokeWidth ?? 2, size, absoluteStrokeWidth), class: mergedClass, ...(!labelled ? { "aria-hidden": "true" } : {}), ...(title ? { role: "img" } : {}), ...safeRest };
16
15
  ---
17
16
  <svg {...svgAttributes}>
18
17
  {title && <title>{title}</title>}