@stephansama/vite-iconify-svgmap 0.1.0 → 0.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.
@@ -4,26 +4,37 @@ import type { HTMLAttributes } from "astro/types";
4
4
 
5
5
  import { getIcon } from "virtual:iconify-svgmap";
6
6
 
7
- interface Props extends Omit<HTMLAttributes<"svg">, "height" | "width"> {
7
+ interface Props extends HTMLAttributes<"svg"> {
8
8
  /** Icon name inside the pack, e.g. `astro` */
9
9
  name: string;
10
10
  /** Iconify pack, e.g. `logos` for `@iconify-json/logos` */
11
11
  pack: string;
12
- /** Width and height of the icon @default "1em" */
12
+ /**
13
+ * Fallback width and height when neither `width` nor `height` is set @default
14
+ * "1em"
15
+ */
13
16
  size?: number | string;
14
17
  /** Accessible label; without it the icon is hidden from assistive tech */
15
18
  title?: string;
16
19
  }
17
20
 
18
- const { name, pack, size = "1em", title, ...attributes } = Astro.props;
21
+ const {
22
+ height,
23
+ name,
24
+ pack,
25
+ size = "1em",
26
+ title,
27
+ width,
28
+ ...attributes
29
+ } = Astro.props;
19
30
  const href = getIcon(pack, name);
20
31
  ---
21
32
 
22
33
  <svg
23
34
  aria-hidden={title ? undefined : "true"}
24
- height={size}
35
+ height={height ?? size}
25
36
  role={title ? "img" : undefined}
26
- width={size}
37
+ width={width ?? size}
27
38
  {...attributes}
28
39
  >
29
40
  {title && <title>{title}</title>}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stephansama/vite-iconify-svgmap",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Vite plugin for generating iconify svg sprite maps in memory",
5
5
  "keywords": [
6
6
  "vite",