@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.
- package/frameworks/astro/icon.astro +16 -5
- package/package.json +1 -1
|
@@ -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
|
|
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
|
-
/**
|
|
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 {
|
|
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>}
|