@supermousejs/icon 2.1.0 → 2.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/CHANGELOG.md +87 -59
- package/LICENSE.md +21 -21
- package/README.md +30 -29
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +32 -19
- package/dist/index.umd.js +1 -1
- package/meta.json +45 -16
- package/package.json +13 -4
- package/src/index.ts +63 -52
- package/tsconfig.json +3 -17
- package/vite.config.ts +23 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,59 +1,87 @@
|
|
|
1
|
-
# @supermousejs/icon
|
|
2
|
-
|
|
3
|
-
## 2.
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
- @supermousejs/utils@2.0
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- Updated dependencies
|
|
28
|
-
- @supermousejs/
|
|
29
|
-
- @supermousejs/
|
|
30
|
-
|
|
31
|
-
## 2.0
|
|
32
|
-
|
|
33
|
-
###
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
# @supermousejs/icon
|
|
2
|
+
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9fe1a7b: - Implemented idiomatic approach to using supermouse/utils
|
|
8
|
+
- Rewrote `applyStyles`, `setTransform` and `setStyles` to share a global cache registry
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 6d70c18: remove legacy package and update supermouse domain in readme
|
|
13
|
+
- 14fb5b6: Updated tsconfig to be reference-compliant with core, utils and zoetrope when required
|
|
14
|
+
- Updated dependencies [6d70c18]
|
|
15
|
+
- Updated dependencies [2590af3]
|
|
16
|
+
- Updated dependencies [14fb5b6]
|
|
17
|
+
- Updated dependencies [9fe1a7b]
|
|
18
|
+
- Updated dependencies [9fa6ece]
|
|
19
|
+
- @supermousejs/core@2.1.0
|
|
20
|
+
- @supermousejs/utils@2.2.0
|
|
21
|
+
|
|
22
|
+
## 2.1.1
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 67f771b: Add relevant npm metadata to package.json file
|
|
27
|
+
- Updated dependencies [67f771b]
|
|
28
|
+
- @supermousejs/utils@2.1.1
|
|
29
|
+
- @supermousejs/core@2.0.5
|
|
30
|
+
|
|
31
|
+
## 2.1.0
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- 0a1652d: fixed build architecture and updated plugin metadata
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [0a1652d]
|
|
40
|
+
- @supermousejs/utils@2.1.0
|
|
41
|
+
|
|
42
|
+
## 2.0.4
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- 993dc67: Updated supemousejs packages with proper author, license and url descriptors to repo
|
|
47
|
+
- Updated dependencies [993dc67]
|
|
48
|
+
- @supermousejs/utils@2.0.4
|
|
49
|
+
- @supermousejs/core@2.0.4
|
|
50
|
+
|
|
51
|
+
## 2.0.3
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Updated dependencies
|
|
56
|
+
- @supermousejs/core@2.0.3
|
|
57
|
+
- @supermousejs/utils@2.0.3
|
|
58
|
+
|
|
59
|
+
## 2.0.2
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- ae219a0: Update READMEs with correct link to documentation
|
|
64
|
+
- Updated dependencies [ae219a0]
|
|
65
|
+
- @supermousejs/utils@2.0.2
|
|
66
|
+
- @supermousejs/core@2.0.2
|
|
67
|
+
|
|
68
|
+
## 2.0.1
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- Add minimal README.md files to packages
|
|
73
|
+
- Updated dependencies
|
|
74
|
+
- @supermousejs/utils@2.0.1
|
|
75
|
+
- @supermousejs/core@2.0.1
|
|
76
|
+
|
|
77
|
+
## 2.0.0
|
|
78
|
+
|
|
79
|
+
### Major Changes
|
|
80
|
+
|
|
81
|
+
- Initial v2.0.0 release
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- Updated dependencies
|
|
86
|
+
- @supermousejs/utils@2.0.0
|
|
87
|
+
- @supermousejs/core@2.0.0
|
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Sijibomi Olusunmbola
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sijibomi Olusunmbola
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
# @supermousejs/icon
|
|
2
|
+
|
|
3
|
+
Renders a static SVG icon at the cursor position. Useful for custom pointers.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @supermousejs/icon
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Supermouse } from "@supermousejs/core";
|
|
15
|
+
import { Icon } from "@supermousejs/icon";
|
|
16
|
+
|
|
17
|
+
const app = new Supermouse();
|
|
18
|
+
|
|
19
|
+
app.use(
|
|
20
|
+
Icon({
|
|
21
|
+
svg: "<svg>...</svg>", // Your SVG string
|
|
22
|
+
size: 24,
|
|
23
|
+
color: "black"
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Documentation
|
|
29
|
+
|
|
30
|
+
Full documentation and interactive playground available at [supermouse](https://supermouse.js.org) or [check out the repo](https://github.com/Whitestar14/supermouse-js).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SupermousePlugin } from '../../core/src
|
|
2
|
-
import { ValueOrGetter } from '../../core/src
|
|
1
|
+
import { SupermousePlugin } from '../../core/src';
|
|
2
|
+
import { ValueOrGetter } from '../../core/src';
|
|
3
3
|
|
|
4
4
|
export declare const Icon: (options: IconOptions) => SupermousePlugin;
|
|
5
5
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
import { normalize as
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { normalize as r, definePlugin as d, dom as o, Layers as p } from "@supermousejs/utils";
|
|
2
|
+
const S = (e) => {
|
|
3
|
+
const a = r(e.size, 24), l = r(e.opacity, 1), i = r(e.color, "black"), [y, f] = e.offset || [0, 0];
|
|
4
|
+
return d(
|
|
5
|
+
{
|
|
6
|
+
name: e.name || "icon",
|
|
7
|
+
create: () => {
|
|
8
|
+
const t = o.createActor("div");
|
|
9
|
+
return o.applyStyles(t, {
|
|
10
|
+
zIndex: String(p.CURSOR),
|
|
11
|
+
display: "flex",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
justifyContent: "center"
|
|
14
|
+
}), t.innerHTML = e.svg, t;
|
|
15
|
+
},
|
|
16
|
+
styles: {
|
|
17
|
+
color: "color"
|
|
18
|
+
},
|
|
19
|
+
update: (t, n) => {
|
|
20
|
+
const c = t.state, s = a(c);
|
|
21
|
+
o.applyStyles(n, {
|
|
22
|
+
width: `${s}px`,
|
|
23
|
+
height: `${s}px`,
|
|
24
|
+
opacity: String(l(c)),
|
|
25
|
+
color: i(c)
|
|
26
|
+
});
|
|
27
|
+
const { x: g, y: m } = c.smooth;
|
|
28
|
+
o.setTransform(n, g + y, m + f, 0);
|
|
29
|
+
}
|
|
9
30
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
update: (t, c) => {
|
|
14
|
-
const r = n(t.state);
|
|
15
|
-
s.setStyle(c, "width", `${r}px`), s.setStyle(c, "height", `${r}px`), s.setStyle(c, "opacity", String(l(t.state))), s.setStyle(c, "color", y(t.state));
|
|
16
|
-
const { x: f, y: m } = t.state.smooth;
|
|
17
|
-
s.setTransform(c, f + a, m + i, 0);
|
|
18
|
-
}
|
|
19
|
-
}, e);
|
|
31
|
+
e
|
|
32
|
+
);
|
|
20
33
|
};
|
|
21
34
|
export {
|
|
22
|
-
|
|
35
|
+
S as Icon
|
|
23
36
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("@supermousejs/utils")):typeof define=="function"&&define.amd?define(["exports","@supermousejs/utils"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.SupermouseIcon={},t.SupermouseUtils))})(this,(function(t,e){"use strict";const i=o=>{const f=e.normalize(o.size,24),d=e.normalize(o.opacity,1),a=e.normalize(o.color,"black"),[m,u]=o.offset||[0,0];return e.definePlugin({name:o.name||"icon",create:()=>{const n=e.dom.createActor("div");return e.dom.applyStyles(n,{zIndex:String(e.Layers.CURSOR),display:"flex",alignItems:"center",justifyContent:"center"}),n.innerHTML=o.svg,n},styles:{color:"color"},update:(n,s)=>{const r=n.state,c=f(r);e.dom.applyStyles(s,{width:`${c}px`,height:`${c}px`,opacity:String(d(r)),color:a(r)});const{x:l,y:p}=r.smooth;e.dom.setTransform(s,l+m,p+u,0)}},o)};t.Icon=i,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
package/meta.json
CHANGED
|
@@ -1,16 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
{
|
|
2
|
+
"id": "icon",
|
|
3
|
+
"name": "Icon",
|
|
4
|
+
"package": "@supermousejs/icon",
|
|
5
|
+
"description": "Renders a static SVG icon at the cursor position.",
|
|
6
|
+
"code": "app.use(Icon({ svg: '<svg>...</svg>', size: 24 }));",
|
|
7
|
+
"icon": "context",
|
|
8
|
+
"options": [
|
|
9
|
+
{
|
|
10
|
+
"name": "svg",
|
|
11
|
+
"type": "string",
|
|
12
|
+
"default": "undefined",
|
|
13
|
+
"description": "SVG content string. (Required)",
|
|
14
|
+
"reactive": false
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "size",
|
|
18
|
+
"type": "number",
|
|
19
|
+
"default": "24",
|
|
20
|
+
"description": "Size of the icon container.",
|
|
21
|
+
"reactive": true
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "color",
|
|
25
|
+
"type": "string",
|
|
26
|
+
"default": "'black'",
|
|
27
|
+
"description": "CSS color (currentColor).",
|
|
28
|
+
"reactive": true
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "opacity",
|
|
32
|
+
"type": "number",
|
|
33
|
+
"default": "1",
|
|
34
|
+
"description": "Opacity level (0-1).",
|
|
35
|
+
"reactive": true
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "offset",
|
|
39
|
+
"type": "[number, number]",
|
|
40
|
+
"default": "[0, 0]",
|
|
41
|
+
"description": "Fixed [x, y] offset from cursor center.",
|
|
42
|
+
"reactive": false
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supermousejs/icon",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"main": "dist/index.umd.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,14 +8,23 @@
|
|
|
8
8
|
"url": "https://github.com/Whitestar14/supermouse-js",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@supermousejs/utils": "2.
|
|
11
|
+
"@supermousejs/utils": "2.2.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@supermousejs/core": "2.0
|
|
14
|
+
"@supermousejs/core": "2.1.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@supermousejs/core": "2.0
|
|
17
|
+
"@supermousejs/core": "2.1.0"
|
|
18
18
|
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/Whitestar14/supermouse-js.git",
|
|
22
|
+
"directory": "packages/core"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/Whitestar14/supermouse-js/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/Whitestar14/supermouse-js/tree/main/packages/icon#readme",
|
|
19
28
|
"exports": {
|
|
20
29
|
".": {
|
|
21
30
|
"types": "./dist/index.d.ts",
|
package/src/index.ts
CHANGED
|
@@ -1,52 +1,63 @@
|
|
|
1
|
-
import type { ValueOrGetter } from
|
|
2
|
-
import { definePlugin, normalize, dom, Layers } from
|
|
3
|
-
|
|
4
|
-
export interface IconOptions {
|
|
5
|
-
name?: string;
|
|
6
|
-
isEnabled?: boolean;
|
|
7
|
-
/** SVG Content String */
|
|
8
|
-
svg: string;
|
|
9
|
-
/** Size in pixels (default 24) */
|
|
10
|
-
size?: ValueOrGetter<number>;
|
|
11
|
-
/** CSS Color (default black) */
|
|
12
|
-
color?: ValueOrGetter<string>;
|
|
13
|
-
opacity?: ValueOrGetter<number>;
|
|
14
|
-
/** Offset [x, y] from cursor center */
|
|
15
|
-
offset?: [number, number];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Icon = (options: IconOptions) => {
|
|
19
|
-
const getSize = normalize(options.size, 24);
|
|
20
|
-
const getOpacity = normalize(options.opacity, 1);
|
|
21
|
-
const getColor = normalize(options.color,
|
|
22
|
-
const [offX, offY] = options.offset || [0, 0];
|
|
23
|
-
|
|
24
|
-
return definePlugin<HTMLDivElement, IconOptions>(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
1
|
+
import type { ValueOrGetter, Supermouse } from "@supermousejs/core";
|
|
2
|
+
import { definePlugin, normalize, dom, Layers } from "@supermousejs/utils";
|
|
3
|
+
|
|
4
|
+
export interface IconOptions {
|
|
5
|
+
name?: string;
|
|
6
|
+
isEnabled?: boolean;
|
|
7
|
+
/** SVG Content String */
|
|
8
|
+
svg: string;
|
|
9
|
+
/** Size in pixels (default 24) */
|
|
10
|
+
size?: ValueOrGetter<number>;
|
|
11
|
+
/** CSS Color (default black) */
|
|
12
|
+
color?: ValueOrGetter<string>;
|
|
13
|
+
opacity?: ValueOrGetter<number>;
|
|
14
|
+
/** Offset [x, y] from cursor center */
|
|
15
|
+
offset?: [number, number];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const Icon = (options: IconOptions) => {
|
|
19
|
+
const getSize = normalize(options.size, 24);
|
|
20
|
+
const getOpacity = normalize(options.opacity, 1);
|
|
21
|
+
const getColor = normalize(options.color, "black");
|
|
22
|
+
const [offX, offY] = options.offset || [0, 0];
|
|
23
|
+
|
|
24
|
+
return definePlugin<HTMLDivElement, IconOptions>(
|
|
25
|
+
{
|
|
26
|
+
name: options.name || "icon",
|
|
27
|
+
|
|
28
|
+
create: () => {
|
|
29
|
+
const el = dom.createActor("div") as HTMLDivElement;
|
|
30
|
+
|
|
31
|
+
dom.applyStyles(el, {
|
|
32
|
+
zIndex: String(Layers.CURSOR),
|
|
33
|
+
display: "flex",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
justifyContent: "center"
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
el.innerHTML = options.svg;
|
|
39
|
+
return el;
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
styles: {
|
|
43
|
+
color: "color"
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
update: (app: Supermouse, el: HTMLDivElement) => {
|
|
47
|
+
const state = app.state;
|
|
48
|
+
const size = getSize(state);
|
|
49
|
+
|
|
50
|
+
dom.applyStyles(el, {
|
|
51
|
+
width: `${size}px`,
|
|
52
|
+
height: `${size}px`,
|
|
53
|
+
opacity: String(getOpacity(state)),
|
|
54
|
+
color: getColor(state)
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const { x, y } = state.smooth;
|
|
58
|
+
dom.setTransform(el, x + offX, y + offY, 0);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
options
|
|
62
|
+
);
|
|
63
|
+
};
|
package/tsconfig.json
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../tsconfig.
|
|
3
|
-
"include": [
|
|
4
|
-
|
|
5
|
-
],
|
|
6
|
-
"compilerOptions": {
|
|
7
|
-
"outDir": "dist",
|
|
8
|
-
"baseUrl": ".",
|
|
9
|
-
"paths": {
|
|
10
|
-
"@supermousejs/core": [
|
|
11
|
-
"../core/src/index.ts"
|
|
12
|
-
],
|
|
13
|
-
"@supermousejs/utils": [
|
|
14
|
-
"../utils/src/index.ts"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
2
|
+
"extends": "../../tsconfig.plugin.json",
|
|
3
|
+
"include": ["src"]
|
|
4
|
+
}
|
package/vite.config.ts
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import { defineConfig } from
|
|
2
|
-
import dts from
|
|
3
|
-
import path from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
plugins: [dts({ rollupTypes: true })]
|
|
26
|
-
});
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import dts from "vite-plugin-dts";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
build: {
|
|
7
|
+
lib: {
|
|
8
|
+
entry: path.resolve(__dirname, "src/index.ts"),
|
|
9
|
+
name: "SupermouseIcon",
|
|
10
|
+
fileName: (format) => (format === "es" ? "index.mjs" : "index.umd.js")
|
|
11
|
+
},
|
|
12
|
+
rollupOptions: {
|
|
13
|
+
external: ["@supermousejs/core", "@supermousejs/utils"],
|
|
14
|
+
output: {
|
|
15
|
+
globals: {
|
|
16
|
+
"@supermousejs/core": "SupermouseCore",
|
|
17
|
+
"@supermousejs/utils": "SupermouseUtils"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
plugins: [dts({ rollupTypes: true })]
|
|
23
|
+
});
|