svelte-animated-icon 1.0.2 → 1.0.3

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.
@@ -1,5 +1,7 @@
1
1
  <script lang="ts" module>
2
- export interface Props {
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+
4
+ export interface Props extends HTMLAttributes<HTMLDivElement> {
3
5
  /** Pre-stripped SVG inner content (no <svg> wrapper, no bounding rect) */
4
6
  svg: string;
5
7
  /** SVG coordinate space of `svg`. Phosphor is 256; Remix/Lucide are 24. */
@@ -22,13 +24,27 @@
22
24
  /** Override the timing easing (any CSS easing string); null = keep the template's own. */
23
25
  easing?: string | null;
24
26
  class?: string;
27
+ color?: string;
25
28
  }
26
29
  </script>
27
30
 
28
31
  <script lang="ts">
29
32
  import { getTemplate, clearProps } from './templates.svelte';
30
33
 
31
- let { svg, viewBox = '0 0 256 256', template = 'draw', size = 24, trigger = 'hover', active = false, loop = false, speed = 1, easing = null, class: className = ''}: Props = $props();
34
+ let {
35
+ svg,
36
+ viewBox = '0 0 256 256',
37
+ template = 'draw',
38
+ size = 24,
39
+ trigger = 'hover',
40
+ active = false,
41
+ loop = false,
42
+ speed = 1,
43
+ easing = null,
44
+ class: className = '',
45
+ color,
46
+ ...rest
47
+ }: Props = $props();
32
48
 
33
49
  let svgEl = $state<SVGSVGElement | null>(null);
34
50
  let anims: Animation[] = [];
@@ -80,10 +96,18 @@
80
96
  </script>
81
97
 
82
98
  <div
99
+ {...rest}
83
100
  class="animated-icon {className}"
84
101
  role="img"
85
- onmouseenter={() => trigger === 'hover' && startAnimation()}
86
- onmouseleave={() => trigger === 'hover' && stopAnimation()}
102
+ onmouseenter={(e) => {
103
+ if (trigger === 'hover') startAnimation();
104
+ if (typeof rest.onmouseenter === 'function') rest.onmouseenter(e);
105
+ }}
106
+ onmouseleave={(e) => {
107
+ if (trigger === 'hover') stopAnimation();
108
+ if (typeof rest.onmouseleave === 'function') rest.onmouseleave(e);
109
+ }}
110
+ style:color={color}
87
111
  >
88
112
  <svg
89
113
  bind:this={svgEl}
@@ -96,3 +120,4 @@
96
120
  {@html svg}
97
121
  </svg>
98
122
  </div>
123
+
@@ -1,4 +1,5 @@
1
- export interface Props {
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ export interface Props extends HTMLAttributes<HTMLDivElement> {
2
3
  /** Pre-stripped SVG inner content (no <svg> wrapper, no bounding rect) */
3
4
  svg: string;
4
5
  /** SVG coordinate space of `svg`. Phosphor is 256; Remix/Lucide are 24. */
@@ -21,6 +22,7 @@ export interface Props {
21
22
  /** Override the timing easing (any CSS easing string); null = keep the template's own. */
22
23
  easing?: string | null;
23
24
  class?: string;
25
+ color?: string;
24
26
  }
25
27
  declare const AnimatedIcon: import("svelte").Component<Props, {
26
28
  startAnimation: () => void;
@@ -1,8 +1,8 @@
1
1
  .dark .animated-icon
2
- color: var(--text10)
2
+ color: inherit
3
3
 
4
4
  .light .animated-icon
5
- color: var(--text10)
5
+ color: inherit
6
6
 
7
7
  .tabs-row
8
8
  display: flex
@@ -8,23 +8,54 @@
8
8
  &.xleft
9
9
  align-items: flex-start
10
10
  text-align: left
11
+ &.xright
12
+ align-items: flex-end
13
+ text-align: right
11
14
  &.ycenter
12
15
  justify-content: center
16
+ &.ytop
17
+ justify-content: flex-start
18
+ &.ybot
19
+ justify-content: flex-end
20
+ @media (max-width: 1024px)
21
+ &.xright.mleft
22
+ align-items: flex-start
23
+ text-align: left
13
24
 
14
25
  .row
15
26
  flex-direction: row
27
+ &.wrap
28
+ flex-wrap: wrap
16
29
  &.ycenter
17
30
  align-items: center
18
31
  &.ytop
19
32
  align-items: flex-start
33
+ &.ybot
34
+ align-items: flex-end
20
35
  &.xbetween
21
36
  justify-content: space-between
22
- &.xend
37
+ &.xright
23
38
  justify-content: flex-end
39
+ &.xleft
40
+ justify-content: flex-start
41
+ @media (max-width: 1024px)
42
+ &.mwrap
43
+ flex-wrap: wrap
24
44
 
25
45
  .grid
26
46
  display: grid
27
47
  grid-auto-flow: row
48
+ @media (min-width: 1025px)
49
+ &.grid-cols-2
50
+ grid-template-columns: repeat(2, minmax(0, 1fr))
51
+ &.grid-cols-3
52
+ grid-template-columns: repeat(3, minmax(0, 1fr))
53
+ &.grid-cols-4
54
+ grid-template-columns: repeat(4, minmax(0, 1fr))
55
+ &.grid-cols-5
56
+ grid-template-columns: repeat(5, minmax(0, 1fr))
57
+ &.grid-cols-6
58
+ grid-template-columns: repeat(6, minmax(0, 1fr))
28
59
 
29
60
  .animated-icon
30
- color: var(--text10)
61
+ color: inherit
@@ -42,10 +42,29 @@
42
42
  font-size: var(--text-4xl)
43
43
  .text-5xl
44
44
  font-size: var(--text-5xl)
45
-
46
45
  .tt-u
47
46
  text-transform: uppercase
47
+ .tt-c
48
+ text-transform: capitalize
49
+ .w400
50
+ font-weight: 400
51
+ .w500
52
+ font-weight: 500
53
+ .w600
54
+ font-weight: 600
55
+ .bold
56
+ font-weight: bold
57
+ .lh11
58
+ line-height: 1.1
59
+ .lh125
60
+ line-height: 1.25
61
+ .lh15
62
+ line-height: 1.5
63
+ .lh16
64
+ line-height: 1.6
48
65
 
66
+ .col1
67
+ color: var(--text10)
49
68
  .col2
50
69
  color: var(--text20)
51
70
  .col3
@@ -53,13 +72,6 @@
53
72
  .col-theme
54
73
  color: var(--text100)
55
74
 
56
- .w400
57
- font-weight: 400
58
- .w500
59
- font-weight: 500
60
- .w600, .bold
61
- font-weight: 600
62
-
63
75
  .ls-tight
64
76
  letter-spacing: var(--ls-tight)
65
77
  .ls-tightx
@@ -69,15 +81,6 @@
69
81
  .ls-widex
70
82
  letter-spacing: var(--ls-widex)
71
83
 
72
- .lh11
73
- line-height: 1.1
74
- .lh125
75
- line-height: 1.25
76
- .lh15
77
- line-height: 1.5
78
- .lh16
79
- line-height: 1.6
80
-
81
84
  .sidebar-accordion
82
85
  span
83
86
  font-weight: 500
package/package.json CHANGED
@@ -1,87 +1,89 @@
1
1
  {
2
- "name": "svelte-animated-icon",
3
- "version": "1.0.2",
4
- "repository": {
5
- "type": "git",
6
- "url": "git+https://github.com/fractalmandala/svelte-animated-icon.git"
7
- },
8
- "homepage": "https://svelte-animated-icon.vercel.app",
9
- "bugs": {
10
- "url": "https://github.com/fractalmandala/svelte-animated-icon/issues"
11
- },
12
- "files": [
13
- "dist",
14
- "!dist/**/*.test.*",
15
- "!dist/**/*.spec.*"
16
- ],
17
- "sideEffects": [
18
- "**/*.css"
19
- ],
20
- "svelte": "./dist/index.js",
21
- "types": "./dist/index.d.ts",
22
- "type": "module",
23
- "exports": {
24
- ".": {
25
- "types": "./dist/index.d.ts",
26
- "svelte": "./dist/index.js"
27
- },
28
- "./phosphor": {
29
- "types": "./dist/phosphor/index.d.ts",
30
- "svelte": "./dist/phosphor/index.js"
31
- },
32
- "./remix": {
33
- "types": "./dist/remix/index.d.ts",
34
- "svelte": "./dist/remix/index.js"
35
- },
36
- "./flowbite": {
37
- "types": "./dist/flowbite/index.d.ts",
38
- "svelte": "./dist/flowbite/index.js"
39
- },
40
- "./hero": {
41
- "types": "./dist/hero/index.d.ts",
42
- "svelte": "./dist/hero/index.js"
43
- },
44
- "./ion": {
45
- "types": "./dist/ion/index.d.ts",
46
- "svelte": "./dist/ion/index.js"
47
- }
48
- },
49
- "peerDependencies": {
50
- "svelte": "^5.0.0"
51
- },
52
- "devDependencies": {
53
- "@eslint/js": "^10.0.1",
54
- "@formkit/auto-animate": "^0.9.0",
55
- "@sveltejs/adapter-vercel": "^6.3.3",
56
- "@sveltejs/kit": "^2.63.0",
57
- "@sveltejs/package": "^2.5.8",
58
- "@sveltejs/vite-plugin-svelte": "^7.1.2",
59
- "@types/node": "^24",
60
- "eslint": "^10.4.1",
61
- "eslint-config-prettier": "^10.1.8",
62
- "eslint-plugin-svelte": "^3.19.0",
63
- "globals": "^17.6.0",
64
- "mdsvex": "^0.12.7",
65
- "prettier": "^3.8.3",
66
- "prettier-plugin-svelte": "^4.1.0",
67
- "publint": "^0.3.21",
68
- "sass": "^1.100.0",
69
- "svelte": "^5.56.1",
70
- "svelte-check": "^4.6.0",
71
- "typescript": "^6.0.3",
72
- "typescript-eslint": "^8.60.1",
73
- "vite": "^8.0.16"
74
- },
75
- "keywords": [
76
- "svelte"
77
- ],
78
- "scripts": {
79
- "dev": "vite dev",
80
- "build": "vite build && npm run prepack",
81
- "preview": "vite preview",
82
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
83
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
84
- "lint": "prettier --check . && eslint .",
85
- "format": "prettier --write ."
86
- }
87
- }
2
+ "name": "svelte-animated-icon",
3
+ "version": "1.0.3",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/fractalmandala/svelte-animated-icon.git"
7
+ },
8
+ "homepage": "https://svelte-animated-icon.vercel.app",
9
+ "bugs": {
10
+ "url": "https://github.com/fractalmandala/svelte-animated-icon/issues"
11
+ },
12
+ "scripts": {
13
+ "dev": "vite dev",
14
+ "build": "vite build && npm run prepack",
15
+ "preview": "vite preview",
16
+ "prepare": "svelte-kit sync || echo ''",
17
+ "prepack": "svelte-kit sync && svelte-package && publint",
18
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
19
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
20
+ "lint": "prettier --check . && eslint .",
21
+ "format": "prettier --write ."
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "!dist/**/*.test.*",
26
+ "!dist/**/*.spec.*"
27
+ ],
28
+ "sideEffects": [
29
+ "**/*.css"
30
+ ],
31
+ "svelte": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
+ "type": "module",
34
+ "exports": {
35
+ ".": {
36
+ "types": "./dist/index.d.ts",
37
+ "svelte": "./dist/index.js"
38
+ },
39
+ "./phosphor": {
40
+ "types": "./dist/phosphor/index.d.ts",
41
+ "svelte": "./dist/phosphor/index.js"
42
+ },
43
+ "./remix": {
44
+ "types": "./dist/remix/index.d.ts",
45
+ "svelte": "./dist/remix/index.js"
46
+ },
47
+ "./flowbite": {
48
+ "types": "./dist/flowbite/index.d.ts",
49
+ "svelte": "./dist/flowbite/index.js"
50
+ },
51
+ "./hero": {
52
+ "types": "./dist/hero/index.d.ts",
53
+ "svelte": "./dist/hero/index.js"
54
+ },
55
+ "./ion": {
56
+ "types": "./dist/ion/index.d.ts",
57
+ "svelte": "./dist/ion/index.js"
58
+ }
59
+ },
60
+ "peerDependencies": {
61
+ "svelte": "^5.0.0"
62
+ },
63
+ "devDependencies": {
64
+ "@eslint/js": "^10.0.1",
65
+ "@formkit/auto-animate": "^0.9.0",
66
+ "@sveltejs/adapter-vercel": "^6.3.3",
67
+ "@sveltejs/kit": "^2.63.0",
68
+ "@sveltejs/package": "^2.5.8",
69
+ "@sveltejs/vite-plugin-svelte": "^7.1.2",
70
+ "@types/node": "^24",
71
+ "eslint": "^10.4.1",
72
+ "eslint-config-prettier": "^10.1.8",
73
+ "eslint-plugin-svelte": "^3.19.0",
74
+ "globals": "^17.6.0",
75
+ "mdsvex": "^0.12.7",
76
+ "prettier": "^3.8.3",
77
+ "prettier-plugin-svelte": "^4.1.0",
78
+ "publint": "^0.3.21",
79
+ "sass": "^1.100.0",
80
+ "svelte": "^5.56.1",
81
+ "svelte-check": "^4.6.0",
82
+ "typescript": "^6.0.3",
83
+ "typescript-eslint": "^8.60.1",
84
+ "vite": "^8.0.16"
85
+ },
86
+ "keywords": [
87
+ "svelte"
88
+ ]
89
+ }