@supermousejs/text 2.1.0 → 2.2.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/CHANGELOG.md +82 -59
- package/LICENSE.md +21 -21
- package/README.md +35 -33
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +25 -22
- package/meta.json +32 -15
- package/package.json +13 -4
- package/src/index.ts +45 -43
- package/tsconfig.json +3 -17
- package/vite.config.ts +23 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,59 +1,82 @@
|
|
|
1
|
-
# @supermousejs/text
|
|
2
|
-
|
|
3
|
-
## 2.
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- Updated dependencies [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Sijibomi Olusunmbola
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sijibomi Olusunmbola
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
# @supermousejs/text
|
|
2
|
+
|
|
3
|
+
Displays a contextual text label next to the cursor when hovering interactive elements.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @supermousejs/text
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Supermouse } from "@supermousejs/core";
|
|
15
|
+
import { Text } from "@supermousejs/text";
|
|
16
|
+
|
|
17
|
+
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
|
+
);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**HTML:**
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<button data-supermouse-text="Click Me">Hover Here</button>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Documentation
|
|
34
|
+
|
|
35
|
+
Full documentation and interactive playground available at [supermouse](https://supermouse.js.org) or [check out the repo](https://github.com/Whitestar14/supermouse-js).
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -2,29 +2,32 @@ import { definePlugin as f, dom as e, Easings as p, Layers as u } from "@supermo
|
|
|
2
2
|
const y = (s = {}) => {
|
|
3
3
|
const r = s.className || "supermouse-text", [c, i] = s.offset || [0, 24], l = s.duration || 200;
|
|
4
4
|
let a;
|
|
5
|
-
return f(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
return f(
|
|
6
|
+
{
|
|
7
|
+
name: "text",
|
|
8
|
+
selector: "[data-supermouse-text]",
|
|
9
|
+
create: () => {
|
|
10
|
+
const t = e.createActor("div");
|
|
11
|
+
return e.applyStyles(t, {
|
|
12
|
+
zIndex: u.OVERLAY,
|
|
13
|
+
opacity: "0",
|
|
14
|
+
transition: `opacity ${l}ms ${p.SMOOTH}`,
|
|
15
|
+
whiteSpace: "nowrap",
|
|
16
|
+
pointerEvents: "none"
|
|
17
|
+
}), t.classList.add(...r.split(" ").filter(Boolean)), a = document.createElement("span"), t.appendChild(a), e.setTransform(t, -100, -100), t;
|
|
18
|
+
},
|
|
19
|
+
update: (t, o) => {
|
|
20
|
+
const n = t.state.interaction.text;
|
|
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);
|
|
25
|
+
} else
|
|
26
|
+
e.setStyle(o, "opacity", "0");
|
|
27
|
+
}
|
|
17
28
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (t.state.isHover && n) {
|
|
21
|
-
a.innerText = n, e.setStyle(o, "opacity", "1");
|
|
22
|
-
const { x: d, y: m } = t.state.smooth;
|
|
23
|
-
e.setTransform(o, d + c, m + i);
|
|
24
|
-
} else
|
|
25
|
-
e.setStyle(o, "opacity", "0");
|
|
26
|
-
}
|
|
27
|
-
}, s);
|
|
29
|
+
s
|
|
30
|
+
);
|
|
28
31
|
};
|
|
29
32
|
export {
|
|
30
33
|
y as Text
|
package/meta.json
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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/package.json
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supermousejs/text",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
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.
|
|
8
|
+
"@supermousejs/utils": "2.2.0"
|
|
9
9
|
},
|
|
10
10
|
"main": "dist/index.umd.js",
|
|
11
11
|
"module": "dist/index.mjs",
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@supermousejs/core": "2.0
|
|
14
|
+
"@supermousejs/core": "2.1.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@supermousejs/core": "2.0
|
|
17
|
+
"@supermousejs/core": "2.1.0"
|
|
18
18
|
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/Whitestar14/supermouse-js.git",
|
|
22
|
+
"directory": "packages/core"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/Whitestar14/supermouse-js/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/Whitestar14/supermouse-js/tree/main/packages/text#readme",
|
|
19
28
|
"exports": {
|
|
20
29
|
".": {
|
|
21
30
|
"types": "./dist/index.d.ts",
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Supermouse } from "@supermousejs/core";
|
|
2
|
+
import { definePlugin, dom, Layers, Easings } from "@supermousejs/utils";
|
|
2
3
|
|
|
3
4
|
export interface TextOptions {
|
|
4
5
|
name?: string;
|
|
@@ -9,52 +10,53 @@ export interface TextOptions {
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const Text = (options: TextOptions = {}) => {
|
|
12
|
-
const className = options.className ||
|
|
13
|
+
const className = options.className || "supermouse-text";
|
|
13
14
|
const [offX, offY] = options.offset || [0, 24];
|
|
14
15
|
const duration = options.duration || 200;
|
|
15
|
-
|
|
16
|
+
|
|
16
17
|
let textNode: HTMLSpanElement;
|
|
17
18
|
|
|
18
|
-
return definePlugin<HTMLDivElement, TextOptions>(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
}
|
|
35
58
|
}
|
|
36
|
-
|
|
37
|
-
textNode = document.createElement('span');
|
|
38
|
-
el.appendChild(textNode);
|
|
39
|
-
|
|
40
|
-
dom.setTransform(el, -100, -100);
|
|
41
|
-
return el;
|
|
42
59
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// Use pre-parsed interaction data instead of querying DOM
|
|
46
|
-
const text = app.state.interaction.text;
|
|
47
|
-
|
|
48
|
-
if (app.state.isHover && text) {
|
|
49
|
-
textNode.innerText = text;
|
|
50
|
-
dom.setStyle(el, 'opacity', '1');
|
|
51
|
-
|
|
52
|
-
// Dynamic position based on pointer
|
|
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
|
-
}, options);
|
|
60
|
+
options
|
|
61
|
+
);
|
|
60
62
|
};
|
package/tsconfig.json
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../tsconfig.
|
|
3
|
-
"include": [
|
|
4
|
-
|
|
5
|
-
],
|
|
6
|
-
"compilerOptions": {
|
|
7
|
-
"outDir": "dist",
|
|
8
|
-
"baseUrl": ".",
|
|
9
|
-
"paths": {
|
|
10
|
-
"@supermousejs/core": [
|
|
11
|
-
"../core/src/index.ts"
|
|
12
|
-
],
|
|
13
|
-
"@supermousejs/utils": [
|
|
14
|
-
"../utils/src/index.ts"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
2
|
+
"extends": "../../tsconfig.plugin.json",
|
|
3
|
+
"include": ["src"]
|
|
4
|
+
}
|
package/vite.config.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { defineConfig } from
|
|
2
|
-
import dts from
|
|
3
|
-
import path from
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
build: {
|
|
7
|
-
lib: {
|
|
8
|
-
entry: path.resolve(__dirname,
|
|
9
|
-
name:
|
|
10
|
-
fileName: (format) => format ===
|
|
11
|
-
},
|
|
12
|
-
rollupOptions: {
|
|
13
|
-
external: [
|
|
14
|
-
output: {
|
|
15
|
-
globals: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
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
|
+
});
|