@supermousejs/stick 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 CHANGED
@@ -1,5 +1,4 @@
1
1
  import { SupermousePlugin } from '../packages/core/src';
2
- import { ValueOrGetter } from '../packages/core/src';
3
2
 
4
3
  export declare const Stick: (options?: StickOptions) => SupermousePlugin;
5
4
 
@@ -7,7 +6,7 @@ export declare interface StickOptions {
7
6
  name?: string;
8
7
  isEnabled?: boolean;
9
8
  /** Extra padding around the element when calculating shape. Default 10. */
10
- padding?: ValueOrGetter<number>;
9
+ padding?: number;
11
10
  }
12
11
 
13
12
  export { }
package/dist/index.mjs CHANGED
@@ -4,8 +4,7 @@ const m = (a = {}) => {
4
4
  let s = null, e = null;
5
5
  return h(
6
6
  {
7
- name: a.name || "stick",
8
- // Logic plugin: must run before visuals to set the shape state
7
+ name: a.name ?? "stick",
9
8
  priority: -10,
10
9
  install(t) {
11
10
  t.registerHoverTarget("[data-supermouse-stick]");
@@ -24,11 +23,11 @@ const m = (a = {}) => {
24
23
  y: i.top + i.height / 2
25
24
  };
26
25
  }
27
- e && (t.state.target.x = e.x, t.state.target.y = e.y, t.state.shape = {
26
+ t.state.target.x = e.x, t.state.target.y = e.y, t.state.shape = {
28
27
  width: e.width,
29
28
  height: e.height,
30
29
  borderRadius: e.radius
31
- });
30
+ };
32
31
  } else
33
32
  s && (s = null, e = null), t.state.shape = null;
34
33
  }
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(i,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@supermousejs/utils")):typeof define=="function"&&define.amd?define(["exports","@supermousejs/utils"],s):(i=typeof globalThis<"u"?globalThis:i||self,s(i.SupermouseStick={},i.SupermouseUtils))})(this,(function(i,s){"use strict";const a=(u={})=>{const c=s.normalize(u.padding,10);let o=null,t=null;return s.definePlugin({name:u.name||"stick",priority:-10,install(e){e.registerHoverTarget("[data-supermouse-stick]")},update(e){const r=e.state.hoverTarget,l=e.state.interaction.stick===!0||e.state.interaction.stick==="true";if(r&&l){if(r!==o||!t){o=r;const n=s.dom.projectRect(r,e.container),h=window.getComputedStyle(r),d=c(e.state);t={width:n.width+d,height:n.height+d,radius:parseFloat(h.borderRadius)||0,x:n.left+n.width/2,y:n.top+n.height/2}}t&&(e.state.target.x=t.x,e.state.target.y=t.y,e.state.shape={width:t.width,height:t.height,borderRadius:t.radius})}else o&&(o=null,t=null),e.state.shape=null}},u)};i.Stick=a,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(i,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@supermousejs/utils")):typeof define=="function"&&define.amd?define(["exports","@supermousejs/utils"],s):(i=typeof globalThis<"u"?globalThis:i||self,s(i.SupermouseStick={},i.SupermouseUtils))})(this,(function(i,s){"use strict";const a=(u={})=>{const c=s.normalize(u.padding,10);let o=null,t=null;return s.definePlugin({name:u.name??"stick",priority:-10,install(e){e.registerHoverTarget("[data-supermouse-stick]")},update(e){const r=e.state.hoverTarget,l=e.state.interaction.stick===!0||e.state.interaction.stick==="true";if(r&&l){if(r!==o||!t){o=r;const n=s.dom.projectRect(r,e.container),h=window.getComputedStyle(r),d=c(e.state);t={width:n.width+d,height:n.height+d,radius:parseFloat(h.borderRadius)||0,x:n.left+n.width/2,y:n.top+n.height/2}}e.state.target.x=t.x,e.state.target.y=t.y,e.state.shape={width:t.width,height:t.height,borderRadius:t.radius}}else o&&(o=null,t=null),e.state.shape=null}},u)};i.Stick=a,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@supermousejs/stick",
3
- "version": "2.3.1",
3
+ "version": "2.4.1",
4
4
  "main": "dist/index.umd.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
7
+ "description": "Morphs the cursor shape to match the bounding box of hovered elements.",
7
8
  "files": [
8
9
  "dist",
9
10
  "README.md"
@@ -12,18 +13,18 @@
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.1"
16
17
  },
17
18
  "devDependencies": {
18
- "@supermousejs/core": "2.3.0"
19
+ "@supermousejs/core": "2.4.1"
19
20
  },
20
21
  "peerDependencies": {
21
- "@supermousejs/core": "2.3.0"
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/core"
27
+ "directory": "packages/stick"
27
28
  },
28
29
  "bugs": {
29
30
  "url": "https://github.com/Whitestar14/supermouse-js/issues"