@supermousejs/text 2.2.0 → 2.3.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @supermousejs/text
2
2
 
3
- Displays a contextual text label next to the cursor when hovering interactive elements.
3
+ Injects contextual text bubbles near the cursor on interaction. Works like a tooltip.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,27 +8,26 @@ Displays a contextual text label next to the cursor when hovering interactive el
8
8
  pnpm add @supermousejs/text
9
9
  ```
10
10
 
11
- ## Usage
11
+ ## Text
12
+
13
+ Injects contextual text bubbles near the cursor on interaction. Works like a tooltip.
14
+
15
+ ### Usage
12
16
 
13
17
  ```ts
14
18
  import { Supermouse } from "@supermousejs/core";
15
19
  import { Text } from "@supermousejs/text";
16
-
17
20
  const app = new Supermouse();
18
-
19
- app.use(
20
- Text({
21
- offset: [20, 20], // X, Y offset from cursor
22
- duration: 200 // Fade duration
23
- })
24
- );
21
+ app.use(Text({ duration: 200 }));
25
22
  ```
26
23
 
27
- **HTML:**
24
+ ### Options
28
25
 
29
- ```html
30
- <button data-supermouse-text="Click Me">Hover Here</button>
31
- ```
26
+ | Name | Type | Default | Description |
27
+ | --- | --- | --- | --- |
28
+ | className | string | 'supermouse-text' | CSS class added to container. |
29
+ | offset | [number, number] | [0, 24] | X/Y offset from cursor. |
30
+ | duration | number | 200 | Fade transition time in ms. |
32
31
 
33
32
  ## Documentation
34
33
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SupermousePlugin } from '../../core/src';
1
+ import { SupermousePlugin } from '../packages/core/src';
2
2
 
3
3
  declare const Text_2: (options?: TextOptions) => SupermousePlugin;
4
4
  export { Text_2 as Text }
package/package.json CHANGED
@@ -1,20 +1,24 @@
1
1
  {
2
2
  "name": "@supermousejs/text",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "author": "O.S David",
5
5
  "url": "https://github.com/Whitestar14/supermouse-js",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
- "@supermousejs/utils": "2.2.0"
8
+ "@supermousejs/utils": "2.3.1"
9
9
  },
10
10
  "main": "dist/index.umd.js",
11
11
  "module": "dist/index.mjs",
12
12
  "types": "dist/index.d.ts",
13
+ "files": [
14
+ "dist",
15
+ "README.md"
16
+ ],
13
17
  "peerDependencies": {
14
- "@supermousejs/core": "2.1.0"
18
+ "@supermousejs/core": "2.3.0"
15
19
  },
16
20
  "devDependencies": {
17
- "@supermousejs/core": "2.1.0"
21
+ "@supermousejs/core": "2.3.0"
18
22
  },
19
23
  "repository": {
20
24
  "type": "git",
package/CHANGELOG.md DELETED
@@ -1,82 +0,0 @@
1
- # @supermousejs/text
2
-
3
- ## 2.2.0
4
-
5
- ### Patch Changes
6
-
7
- - 6d70c18: remove legacy package and update supermouse domain in readme
8
- - 14fb5b6: Updated tsconfig to be reference-compliant with core, utils and zoetrope when required
9
- - Updated dependencies [6d70c18]
10
- - Updated dependencies [2590af3]
11
- - Updated dependencies [14fb5b6]
12
- - Updated dependencies [9fe1a7b]
13
- - Updated dependencies [9fa6ece]
14
- - @supermousejs/core@2.1.0
15
- - @supermousejs/utils@2.2.0
16
-
17
- ## 2.1.1
18
-
19
- ### Patch Changes
20
-
21
- - 67f771b: Add relevant npm metadata to package.json file
22
- - Updated dependencies [67f771b]
23
- - @supermousejs/utils@2.1.1
24
- - @supermousejs/core@2.0.5
25
-
26
- ## 2.1.0
27
-
28
- ### Minor Changes
29
-
30
- - 0a1652d: fixed build architecture and updated plugin metadata
31
-
32
- ### Patch Changes
33
-
34
- - Updated dependencies [0a1652d]
35
- - @supermousejs/utils@2.1.0
36
-
37
- ## 2.0.4
38
-
39
- ### Patch Changes
40
-
41
- - 993dc67: Updated supemousejs packages with proper author, license and url descriptors to repo
42
- - Updated dependencies [993dc67]
43
- - @supermousejs/utils@2.0.4
44
- - @supermousejs/core@2.0.4
45
-
46
- ## 2.0.3
47
-
48
- ### Patch Changes
49
-
50
- - Updated dependencies
51
- - @supermousejs/core@2.0.3
52
- - @supermousejs/utils@2.0.3
53
-
54
- ## 2.0.2
55
-
56
- ### Patch Changes
57
-
58
- - ae219a0: Update READMEs with correct link to documentation
59
- - Updated dependencies [ae219a0]
60
- - @supermousejs/utils@2.0.2
61
- - @supermousejs/core@2.0.2
62
-
63
- ## 2.0.1
64
-
65
- ### Patch Changes
66
-
67
- - Add minimal README.md files to packages
68
- - Updated dependencies
69
- - @supermousejs/utils@2.0.1
70
- - @supermousejs/core@2.0.1
71
-
72
- ## 2.0.0
73
-
74
- ### Major Changes
75
-
76
- - Initial v2.0.0 release
77
-
78
- ### Patch Changes
79
-
80
- - Updated dependencies
81
- - @supermousejs/utils@2.0.0
82
- - @supermousejs/core@2.0.0
package/meta.json DELETED
@@ -1,32 +0,0 @@
1
- {
2
- "id": "text",
3
- "name": "Text",
4
- "package": "@supermousejs/text",
5
- "description": "Injects contextual text bubbles near the cursor on interaction.",
6
- "code": "app.use(Text({ font: 'Mono' }));",
7
- "recipeId": "text-cursor",
8
- "icon": "text",
9
- "options": [
10
- {
11
- "name": "className",
12
- "type": "string",
13
- "default": "'supermouse-text'",
14
- "description": "CSS class added to container.",
15
- "reactive": false
16
- },
17
- {
18
- "name": "offset",
19
- "type": "[number, number]",
20
- "default": "[0, 24]",
21
- "description": "X/Y offset from cursor.",
22
- "reactive": false
23
- },
24
- {
25
- "name": "duration",
26
- "type": "number",
27
- "default": "200",
28
- "description": "Fade transition time in ms.",
29
- "reactive": false
30
- }
31
- ]
32
- }
package/src/index.ts DELETED
@@ -1,62 +0,0 @@
1
- import type { Supermouse } from "@supermousejs/core";
2
- import { definePlugin, dom, Layers, Easings } from "@supermousejs/utils";
3
-
4
- export interface TextOptions {
5
- name?: string;
6
- isEnabled?: boolean;
7
- className?: string;
8
- offset?: [number, number];
9
- duration?: number;
10
- }
11
-
12
- export const Text = (options: TextOptions = {}) => {
13
- const className = options.className || "supermouse-text";
14
- const [offX, offY] = options.offset || [0, 24];
15
- const duration = options.duration || 200;
16
-
17
- let textNode: HTMLSpanElement;
18
-
19
- return definePlugin<HTMLDivElement, TextOptions>(
20
- {
21
- name: "text",
22
- selector: "[data-supermouse-text]",
23
-
24
- create: () => {
25
- const el = dom.createActor("div") as HTMLDivElement;
26
-
27
- dom.applyStyles(el, {
28
- zIndex: Layers.OVERLAY,
29
- opacity: "0",
30
- transition: `opacity ${duration}ms ${Easings.SMOOTH}`,
31
- whiteSpace: "nowrap",
32
- pointerEvents: "none"
33
- });
34
-
35
- if (className) {
36
- el.classList.add(...className.split(" ").filter(Boolean));
37
- }
38
-
39
- textNode = document.createElement("span");
40
- el.appendChild(textNode);
41
-
42
- dom.setTransform(el, -100, -100);
43
- return el;
44
- },
45
-
46
- update: (app: Supermouse, el: HTMLDivElement) => {
47
- const text = app.state.interaction.text;
48
-
49
- if (app.state.isHover && text) {
50
- textNode.innerText = text;
51
- dom.setStyle(el, "opacity", "1");
52
-
53
- const { x, y } = app.state.smooth;
54
- dom.setTransform(el, x + offX, y + offY);
55
- } else {
56
- dom.setStyle(el, "opacity", "0");
57
- }
58
- }
59
- },
60
- options
61
- );
62
- };
package/tsconfig.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.plugin.json",
3
- "include": ["src"]
4
- }
package/vite.config.ts DELETED
@@ -1,23 +0,0 @@
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: "SupermouseText",
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
- });