@supermousejs/text 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.mjs CHANGED
@@ -1,29 +1,29 @@
1
- import { definePlugin as f, dom as e, Easings as p, Layers as u } from "@supermousejs/utils";
1
+ import { definePlugin as l, dom as e, Easings as u, Layers as x } from "@supermousejs/utils";
2
2
  const y = (s = {}) => {
3
- const r = s.className || "supermouse-text", [c, i] = s.offset || [0, 24], l = s.duration || 200;
4
- let a;
5
- return f(
3
+ const r = s.className || "supermouse-text", [c, i] = s.offset || [0, 24], d = s.duration || 200;
4
+ let o;
5
+ return l(
6
6
  {
7
7
  name: "text",
8
8
  selector: "[data-supermouse-text]",
9
9
  create: () => {
10
10
  const t = e.createActor("div");
11
- return e.applyStyles(t, {
12
- zIndex: u.OVERLAY,
11
+ return e.css(t, {
12
+ zIndex: x.OVERLAY,
13
13
  opacity: "0",
14
- transition: `opacity ${l}ms ${p.SMOOTH}`,
14
+ transition: `opacity ${d}ms ${u.SMOOTH}`,
15
15
  whiteSpace: "nowrap",
16
16
  pointerEvents: "none"
17
- }), t.classList.add(...r.split(" ").filter(Boolean)), a = document.createElement("span"), t.appendChild(a), e.setTransform(t, -100, -100), t;
17
+ }), t.classList.add(...r.split(" ").filter(Boolean)), o = document.createElement("span"), t.appendChild(o), e.setTransform(t, -100, -100), t;
18
18
  },
19
- update: (t, o) => {
19
+ update: (t, a) => {
20
20
  const n = t.state.interaction.text;
21
21
  if (t.state.isHover && n) {
22
- a.innerText = n, e.setStyle(o, "opacity", "1");
23
- const { x: d, y: m } = t.state.smooth;
24
- e.setTransform(o, d + c, m + i);
22
+ o.innerText = n, e.css(a, { opacity: "1" });
23
+ const { x: m, y: f } = t.state.smooth;
24
+ e.setTransform(a, m + c, f + i);
25
25
  } else
26
- e.setStyle(o, "opacity", "0");
26
+ e.css(a, { opacity: "0" });
27
27
  }
28
28
  },
29
29
  s
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("@supermousejs/utils")):typeof define=="function"&&define.amd?define(["exports","@supermousejs/utils"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.SupermouseText={},o.SupermouseUtils))})(this,(function(o,e){"use strict";const d=(s={})=>{const i=s.className||"supermouse-text",[c,m]=s.offset||[0,24],f=s.duration||200;let n;return e.definePlugin({name:"text",selector:"[data-supermouse-text]",create:()=>{const t=e.dom.createActor("div");return e.dom.applyStyles(t,{zIndex:e.Layers.OVERLAY,opacity:"0",transition:`opacity ${f}ms ${e.Easings.SMOOTH}`,whiteSpace:"nowrap",pointerEvents:"none"}),t.classList.add(...i.split(" ").filter(Boolean)),n=document.createElement("span"),t.appendChild(n),e.dom.setTransform(t,-100,-100),t},update:(t,r)=>{const a=t.state.interaction.text;if(t.state.isHover&&a){n.innerText=a,e.dom.setStyle(r,"opacity","1");const{x:u,y:p}=t.state.smooth;e.dom.setTransform(r,u+c,p+m)}else e.dom.setStyle(r,"opacity","0")}},s)};o.Text=d,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("@supermousejs/utils")):typeof define=="function"&&define.amd?define(["exports","@supermousejs/utils"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.SupermouseText={},s.SupermouseUtils))})(this,(function(s,e){"use strict";const d=(o={})=>{const i=o.className||"supermouse-text",[c,m]=o.offset||[0,24],f=o.duration||200;let n;return e.definePlugin({name:"text",selector:"[data-supermouse-text]",create:()=>{const t=e.dom.createActor("div");return e.dom.css(t,{zIndex:e.Layers.OVERLAY,opacity:"0",transition:`opacity ${f}ms ${e.Easings.SMOOTH}`,whiteSpace:"nowrap",pointerEvents:"none"}),t.classList.add(...i.split(" ").filter(Boolean)),n=document.createElement("span"),t.appendChild(n),e.dom.setTransform(t,-100,-100),t},update:(t,r)=>{const a=t.state.interaction.text;if(t.state.isHover&&a){n.innerText=a,e.dom.css(r,{opacity:"1"});const{x:u,y:p}=t.state.smooth;e.dom.setTransform(r,u+c,p+m)}else e.dom.css(r,{opacity:"0"})}},o)};s.Text=d,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@supermousejs/text",
3
- "version": "2.3.1",
3
+ "version": "2.4.1",
4
4
  "author": "O.S David",
5
5
  "url": "https://github.com/Whitestar14/supermouse-js",
6
+ "description": "Injects contextual text bubbles near the cursor on interaction. Works like a tooltip.",
6
7
  "license": "MIT",
7
8
  "dependencies": {
8
- "@supermousejs/utils": "2.3.1"
9
+ "@supermousejs/utils": "2.4.1"
9
10
  },
10
11
  "main": "dist/index.umd.js",
11
12
  "module": "dist/index.mjs",
@@ -15,15 +16,15 @@
15
16
  "README.md"
16
17
  ],
17
18
  "peerDependencies": {
18
- "@supermousejs/core": "2.3.0"
19
+ "@supermousejs/core": "2.4.1"
19
20
  },
20
21
  "devDependencies": {
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/text"
27
28
  },
28
29
  "bugs": {
29
30
  "url": "https://github.com/Whitestar14/supermouse-js/issues"