@hugeicons/svelte 1.0.3 → 1.1.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/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # @hugeicons/svelte
2
2
 
3
3
 
4
+ ## 1.1.0
5
+
6
+ ### Minor Changes
7
+
8
+ - Added full SVG props support - component now accepts all standard SVG attributes and event handlers
9
+ - Added support for accessibility attributes (aria-label, aria-hidden, role, etc.)
10
+ - Added support for event handlers (onclick, onmouseenter, etc.)
11
+ - Props interface now extends SVGAttributes<SVGSVGElement> for full TypeScript support
12
+ - Added `prepare` script to auto-generate .svelte-kit/ directory after install
13
+
14
+ ### Deprecations
15
+
16
+ - `className` prop is deprecated - use `class` instead (both work for backward compatibility)
17
+
4
18
  ## 1.0.3
5
19
 
6
20
  ### Patch Changes
@@ -2,8 +2,9 @@
2
2
  import { onMount } from 'svelte';
3
3
  import type { IconSvgElement, HugeiconsProps } from '../create-hugeicon-singleton';
4
4
  import { createHugeiconSingleton } from '../create-hugeicon-singleton';
5
+ import type { SVGAttributes } from 'svelte/elements';
5
6
 
6
- interface Props {
7
+ interface Props extends SVGAttributes<SVGSVGElement> {
7
8
  icon: IconSvgElement;
8
9
  altIcon?: IconSvgElement;
9
10
  size?: string | number;
@@ -11,6 +12,10 @@
11
12
  absoluteStrokeWidth?: boolean;
12
13
  color?: string;
13
14
  showAlt?: boolean;
15
+ class?: string;
16
+ /**
17
+ * @deprecated Use `class` prop instead. This prop will be removed in a future version.
18
+ */
14
19
  className?: string;
15
20
  }
16
21
 
@@ -22,9 +27,14 @@
22
27
  absoluteStrokeWidth = false,
23
28
  color = 'currentColor',
24
29
  showAlt = false,
25
- className = ''
30
+ class: className = '',
31
+ className: legacyClassName = '',
32
+ ...restProps
26
33
  }: Props = $props();
27
34
 
35
+ // merge class and className for backward compatibility
36
+ const finalClassName = $derived(className || legacyClassName);
37
+
28
38
  let svgElement: SVGSVGElement;
29
39
  let hugeiconAction = $state<ReturnType<typeof createHugeiconSingleton>>();
30
40
  let cleanup = $state<{ update: (props: HugeiconsProps) => void; destroy: () => void }>();
@@ -36,7 +46,7 @@
36
46
  color,
37
47
  altIcon,
38
48
  showAlt,
39
- class: className
49
+ class: finalClassName
40
50
  });
41
51
 
42
52
  onMount(() => {
@@ -57,14 +67,15 @@
57
67
  });
58
68
  </script>
59
69
 
60
- <svg
70
+ <svg
61
71
  bind:this={svgElement}
62
72
  xmlns="http://www.w3.org/2000/svg"
63
73
  width={size}
64
74
  height={size}
65
75
  viewBox="0 0 24 24"
66
76
  fill="none"
67
- class={className}
77
+ class={finalClassName}
78
+ {...restProps}
68
79
  >
69
80
  <!-- SVG content will be managed by the action -->
70
81
  </svg>
@@ -1,5 +1,6 @@
1
1
  import type { IconSvgElement } from '../create-hugeicon-singleton';
2
- interface Props {
2
+ import type { SVGAttributes } from 'svelte/elements';
3
+ interface Props extends SVGAttributes<SVGSVGElement> {
3
4
  icon: IconSvgElement;
4
5
  altIcon?: IconSvgElement;
5
6
  size?: string | number;
@@ -7,6 +8,10 @@ interface Props {
7
8
  absoluteStrokeWidth?: boolean;
8
9
  color?: string;
9
10
  showAlt?: boolean;
11
+ class?: string;
12
+ /**
13
+ * @deprecated Use `class` prop instead. This prop will be removed in a future version.
14
+ */
10
15
  className?: string;
11
16
  }
12
17
  declare const HugeiconsIcon: import("svelte").Component<Props, {}, "">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hugeicons/svelte",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Hugeicons Svelte Component Library https://hugeicons.com",
5
5
  "homepage": "https://hugeicons.com",
6
6
  "license": "MIT",
@@ -33,6 +33,7 @@
33
33
  "url": "https://github.com/hugeicons/svelte/issues"
34
34
  },
35
35
  "scripts": {
36
+ "prepare": "svelte-kit sync",
36
37
  "build": "vite build && pnpm run package",
37
38
  "package": "svelte-kit sync && svelte-package",
38
39
  "check": "svelte-check --tsconfig ./tsconfig.json",