@supermousejs/icon 2.3.1 → 2.4.1
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/dist/index.d.ts +4 -4
- package/dist/index.mjs +15 -18
- package/dist/index.umd.js +1 -1
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ export declare const Icon: (options: IconOptions) => SupermousePlugin;
|
|
|
6
6
|
export declare interface IconOptions {
|
|
7
7
|
name?: string;
|
|
8
8
|
isEnabled?: boolean;
|
|
9
|
-
/** SVG
|
|
9
|
+
/** Raw SVG markup. */
|
|
10
10
|
svg: string;
|
|
11
|
-
/** Size in pixels
|
|
11
|
+
/** Size in pixels. */
|
|
12
12
|
size?: ValueOrGetter<number>;
|
|
13
|
-
/** CSS
|
|
13
|
+
/** CSS color. */
|
|
14
14
|
color?: ValueOrGetter<string>;
|
|
15
15
|
opacity?: ValueOrGetter<number>;
|
|
16
|
-
/** Offset [x, y] from cursor center */
|
|
16
|
+
/** Offset [x, y] from cursor center. */
|
|
17
17
|
offset?: [number, number];
|
|
18
18
|
}
|
|
19
19
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
|
-
import { normalize as
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
import { normalize as n, definePlugin as d, dom as c, Layers as y } from "@supermousejs/utils";
|
|
2
|
+
const u = (e) => {
|
|
3
|
+
const o = n(e.size, 24), a = n(e.opacity, 1), i = n(e.color, "black"), [f, g] = e.offset ?? [0, 0];
|
|
4
4
|
return d(
|
|
5
5
|
{
|
|
6
|
-
name: e.name
|
|
6
|
+
name: e.name ?? "icon",
|
|
7
7
|
create: () => {
|
|
8
|
-
const t =
|
|
9
|
-
return
|
|
10
|
-
zIndex: String(
|
|
8
|
+
const t = c.createActor("div");
|
|
9
|
+
return c.css(t, {
|
|
10
|
+
zIndex: String(y.CURSOR),
|
|
11
11
|
display: "flex",
|
|
12
12
|
alignItems: "center",
|
|
13
13
|
justifyContent: "center"
|
|
14
14
|
}), t.innerHTML = e.svg, t;
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
update: (t, n) => {
|
|
20
|
-
const c = t.state, s = a(c);
|
|
21
|
-
o.applyStyles(n, {
|
|
16
|
+
update: (t, r) => {
|
|
17
|
+
const s = o(t.state);
|
|
18
|
+
c.css(r, {
|
|
22
19
|
width: `${s}px`,
|
|
23
20
|
height: `${s}px`,
|
|
24
|
-
opacity: String(
|
|
25
|
-
color: i(
|
|
21
|
+
opacity: String(a(t.state)),
|
|
22
|
+
color: i(t.state)
|
|
26
23
|
});
|
|
27
|
-
const { x:
|
|
28
|
-
|
|
24
|
+
const { x: l, y: m } = t.state.smooth;
|
|
25
|
+
c.setTransform(r, l + f, m + g);
|
|
29
26
|
}
|
|
30
27
|
},
|
|
31
28
|
e
|
|
32
29
|
);
|
|
33
30
|
};
|
|
34
31
|
export {
|
|
35
|
-
|
|
32
|
+
u as Icon
|
|
36
33
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("@supermousejs/utils")):typeof define=="function"&&define.amd?define(["exports","@supermousejs/utils"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.SupermouseIcon={},n.SupermouseUtils))})(this,(function(n,e){"use strict";const c=o=>{const i=e.normalize(o.size,24),f=e.normalize(o.opacity,1),d=e.normalize(o.color,"black"),[m,a]=o.offset??[0,0];return e.definePlugin({name:o.name??"icon",create:()=>{const t=e.dom.createActor("div");return e.dom.css(t,{zIndex:String(e.Layers.CURSOR),display:"flex",alignItems:"center",justifyContent:"center"}),t.innerHTML=o.svg,t},update:(t,s)=>{const r=i(t.state);e.dom.css(s,{width:`${r}px`,height:`${r}px`,opacity:String(f(t.state)),color:d(t.state)});const{x:u,y}=t.state.smooth;e.dom.setTransform(s,u+m,y+a)}},o)};n.Icon=c,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supermousejs/icon",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"main": "dist/index.umd.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
|
+
"description": "Renders a static SVG icon at the cursor position.",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
7
8
|
"files": [
|
|
8
9
|
"dist",
|
|
@@ -12,18 +13,18 @@
|
|
|
12
13
|
"url": "https://github.com/Whitestar14/supermouse-js",
|
|
13
14
|
"license": "MIT",
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"@supermousejs/utils": "2.
|
|
16
|
+
"@supermousejs/utils": "2.4.1"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
|
-
"@supermousejs/core": "2.
|
|
19
|
+
"@supermousejs/core": "2.4.1"
|
|
19
20
|
},
|
|
20
21
|
"peerDependencies": {
|
|
21
|
-
"@supermousejs/core": "2.
|
|
22
|
+
"@supermousejs/core": "2.4.1"
|
|
22
23
|
},
|
|
23
24
|
"repository": {
|
|
24
25
|
"type": "git",
|
|
25
26
|
"url": "git+https://github.com/Whitestar14/supermouse-js.git",
|
|
26
|
-
"directory": "packages/
|
|
27
|
+
"directory": "packages/icon"
|
|
27
28
|
},
|
|
28
29
|
"bugs": {
|
|
29
30
|
"url": "https://github.com/Whitestar14/supermouse-js/issues"
|