@supermousejs/icon 2.3.1 → 2.4.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/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 Content String */
9
+ /** Raw SVG markup. */
10
10
  svg: string;
11
- /** Size in pixels (default 24) */
11
+ /** Size in pixels. */
12
12
  size?: ValueOrGetter<number>;
13
- /** CSS Color (default black) */
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 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];
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 || "icon",
6
+ name: e.name ?? "icon",
7
7
  create: () => {
8
- const t = o.createActor("div");
9
- return o.applyStyles(t, {
10
- zIndex: String(p.CURSOR),
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
- styles: {
17
- color: "color"
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(l(c)),
25
- color: i(c)
21
+ opacity: String(a(t.state)),
22
+ color: i(t.state)
26
23
  });
27
- const { x: g, y: m } = c.smooth;
28
- o.setTransform(n, g + y, m + f, 0);
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
- S as Icon
32
+ u as Icon
36
33
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
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"})}));
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.1",
3
+ "version": "2.4.0",
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,13 +13,13 @@
12
13
  "url": "https://github.com/Whitestar14/supermouse-js",
13
14
  "license": "MIT",
14
15
  "dependencies": {
15
- "@supermousejs/utils": "2.3.1"
16
+ "@supermousejs/utils": "2.4.0"
16
17
  },
17
18
  "devDependencies": {
18
- "@supermousejs/core": "2.3.0"
19
+ "@supermousejs/core": "2.4.0"
19
20
  },
20
21
  "peerDependencies": {
21
- "@supermousejs/core": "2.3.0"
22
+ "@supermousejs/core": "2.4.0"
22
23
  },
23
24
  "repository": {
24
25
  "type": "git",