@supermousejs/ring 2.3.0 → 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/README.md +17 -11
- package/dist/index.mjs +25 -20
- package/dist/index.umd.js +1 -1
- package/package.json +9 -4
- package/CHANGELOG.md +0 -95
- package/meta.json +0 -46
- package/src/index.ts +0 -56
- package/tsconfig.json +0 -4
- package/vite.config.ts +0 -23
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @supermousejs/ring
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Adds a lagging outer ring
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,23 +8,29 @@ The standard Ring cursor plugin for **Supermouse v2**. Supports morphing when us
|
|
|
8
8
|
pnpm add @supermousejs/ring
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Ring
|
|
12
|
+
|
|
13
|
+
Adds a lagging outer ring. Simple and performant.
|
|
14
|
+
|
|
15
|
+
### Usage
|
|
12
16
|
|
|
13
17
|
```ts
|
|
14
18
|
import { Supermouse } from "@supermousejs/core";
|
|
15
19
|
import { Ring } from "@supermousejs/ring";
|
|
16
|
-
|
|
17
20
|
const app = new Supermouse();
|
|
18
|
-
|
|
19
|
-
app.use(
|
|
20
|
-
Ring({
|
|
21
|
-
size: 20,
|
|
22
|
-
color: "black",
|
|
23
|
-
borderWidth: 2
|
|
24
|
-
})
|
|
25
|
-
);
|
|
21
|
+
app.use(Ring({ size: 32, color: '#000' }));
|
|
26
22
|
```
|
|
27
23
|
|
|
24
|
+
### Options
|
|
25
|
+
|
|
26
|
+
| Name | Type | Default | Description |
|
|
27
|
+
| --- | --- | --- | --- |
|
|
28
|
+
| size | number | 20 | Diameter of the ring in pixels. |
|
|
29
|
+
| color | string | '#ffffff' | Border color. |
|
|
30
|
+
| borderWidth | number | 2 | Stroke width in pixels. |
|
|
31
|
+
| opacity | number | 1 | Opacity level (0-1). |
|
|
32
|
+
| mixBlendMode | string | 'difference' | CSS blend mode. |
|
|
33
|
+
|
|
28
34
|
## Documentation
|
|
29
35
|
|
|
30
36
|
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.mjs
CHANGED
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
import { normalizeAll as a, definePlugin as l, dom as s, Layers as f } from "@supermousejs/utils";
|
|
2
|
+
const x = (o = {}) => {
|
|
3
|
+
const t = a(o, {
|
|
4
|
+
size: 20,
|
|
5
|
+
color: "#ffffff",
|
|
6
|
+
borderWidth: 2,
|
|
7
|
+
opacity: 1
|
|
8
|
+
});
|
|
9
|
+
return l(
|
|
5
10
|
{
|
|
6
|
-
name:
|
|
11
|
+
name: o.name || "ring",
|
|
7
12
|
selector: "[data-supermouse-color]",
|
|
8
13
|
create: (e) => {
|
|
9
|
-
const r = s.createCircle(
|
|
10
|
-
return s.
|
|
11
|
-
zIndex:
|
|
12
|
-
mixBlendMode:
|
|
14
|
+
const r = s.createCircle(t.size(e.state), "transparent");
|
|
15
|
+
return s.css(r, {
|
|
16
|
+
zIndex: f.FOLLOWER,
|
|
17
|
+
mixBlendMode: o.mixBlendMode || "difference",
|
|
13
18
|
borderStyle: "solid",
|
|
14
19
|
transition: "opacity 0.2s ease",
|
|
15
20
|
boxSizing: "border-box"
|
|
16
21
|
}), r;
|
|
17
22
|
},
|
|
18
23
|
update: (e, r) => {
|
|
19
|
-
const
|
|
20
|
-
s.
|
|
21
|
-
width: `${
|
|
22
|
-
height: `${
|
|
23
|
-
borderColor:
|
|
24
|
-
borderWidth: `${
|
|
25
|
-
opacity: String(
|
|
24
|
+
const i = t.size(e.state), n = e.state.interaction.color || t.color(e.state);
|
|
25
|
+
s.css(r, {
|
|
26
|
+
width: `${i}px`,
|
|
27
|
+
height: `${i}px`,
|
|
28
|
+
borderColor: n,
|
|
29
|
+
borderWidth: `${t.borderWidth(e.state)}px`,
|
|
30
|
+
opacity: String(t.opacity(e.state)),
|
|
26
31
|
borderRadius: "50%"
|
|
27
32
|
});
|
|
28
|
-
const { x:
|
|
29
|
-
s.setTransform(r,
|
|
33
|
+
const { x: c, y: d } = e.state.smooth;
|
|
34
|
+
s.setTransform(r, c, d);
|
|
30
35
|
}
|
|
31
36
|
},
|
|
32
|
-
|
|
37
|
+
o
|
|
33
38
|
);
|
|
34
39
|
};
|
|
35
40
|
export {
|
|
36
|
-
|
|
41
|
+
x as Ring
|
|
37
42
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
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.SupermouseRing={},t.SupermouseUtils))})(this,(function(t,e){"use strict";const d=(i={})=>{const r=e.normalizeAll(i,{size:20,color:"#ffffff",borderWidth:2,opacity:1});return e.definePlugin({name:i.name||"ring",selector:"[data-supermouse-color]",create:o=>{const s=e.dom.createCircle(r.size(o.state),"transparent");return e.dom.css(s,{zIndex:e.Layers.FOLLOWER,mixBlendMode:i.mixBlendMode||"difference",borderStyle:"solid",transition:"opacity 0.2s ease",boxSizing:"border-box"}),s},update:(o,s)=>{const n=r.size(o.state),c=o.state.interaction.color||r.color(o.state);e.dom.css(s,{width:`${n}px`,height:`${n}px`,borderColor:c,borderWidth:`${r.borderWidth(o.state)}px`,opacity:String(r.opacity(o.state)),borderRadius:"50%"});const{x:f,y:a}=o.state.smooth;e.dom.setTransform(s,f,a)}},i)};t.Ring=d,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supermousejs/ring",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"main": "dist/index.umd.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"description": "Adds a lagging outer ring",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
7
12
|
"author": "O.S David",
|
|
8
13
|
"url": "https://github.com/Whitestar14/supermouse-js",
|
|
9
14
|
"license": "MIT",
|
|
10
15
|
"dependencies": {
|
|
11
|
-
"@supermousejs/utils": "2.
|
|
16
|
+
"@supermousejs/utils": "2.4.0"
|
|
12
17
|
},
|
|
13
18
|
"devDependencies": {
|
|
14
|
-
"@supermousejs/core": "2.
|
|
19
|
+
"@supermousejs/core": "2.4.0"
|
|
15
20
|
},
|
|
16
21
|
"peerDependencies": {
|
|
17
|
-
"@supermousejs/core": "2.
|
|
22
|
+
"@supermousejs/core": "2.4.0"
|
|
18
23
|
},
|
|
19
24
|
"repository": {
|
|
20
25
|
"type": "git",
|
package/CHANGELOG.md
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# @supermousejs/ring
|
|
2
|
-
|
|
3
|
-
## 2.3.0
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [f6f44b2]
|
|
8
|
-
- @supermousejs/core@2.2.0
|
|
9
|
-
- @supermousejs/utils@2.3.0
|
|
10
|
-
|
|
11
|
-
## 2.2.0
|
|
12
|
-
|
|
13
|
-
### Minor Changes
|
|
14
|
-
|
|
15
|
-
- 9fe1a7b: - Implemented idiomatic approach to using supermouse/utils
|
|
16
|
-
- Rewrote `applyStyles`, `setTransform` and `setStyles` to share a global cache registry
|
|
17
|
-
|
|
18
|
-
### Patch Changes
|
|
19
|
-
|
|
20
|
-
- 6d70c18: remove legacy package and update supermouse domain in readme
|
|
21
|
-
- 14fb5b6: Updated tsconfig to be reference-compliant with core, utils and zoetrope when required
|
|
22
|
-
- Updated dependencies [6d70c18]
|
|
23
|
-
- Updated dependencies [2590af3]
|
|
24
|
-
- Updated dependencies [14fb5b6]
|
|
25
|
-
- Updated dependencies [9fe1a7b]
|
|
26
|
-
- Updated dependencies [9fa6ece]
|
|
27
|
-
- @supermousejs/core@2.1.0
|
|
28
|
-
- @supermousejs/utils@2.2.0
|
|
29
|
-
|
|
30
|
-
## 2.1.1
|
|
31
|
-
|
|
32
|
-
### Patch Changes
|
|
33
|
-
|
|
34
|
-
- 67f771b: Add relevant npm metadata to package.json file
|
|
35
|
-
- Updated dependencies [67f771b]
|
|
36
|
-
- @supermousejs/utils@2.1.1
|
|
37
|
-
- @supermousejs/core@2.0.5
|
|
38
|
-
|
|
39
|
-
## 2.1.0
|
|
40
|
-
|
|
41
|
-
### Minor Changes
|
|
42
|
-
|
|
43
|
-
- 0a1652d: fixed build architecture and updated plugin metadata
|
|
44
|
-
|
|
45
|
-
### Patch Changes
|
|
46
|
-
|
|
47
|
-
- Updated dependencies [0a1652d]
|
|
48
|
-
- @supermousejs/utils@2.1.0
|
|
49
|
-
|
|
50
|
-
## 2.0.4
|
|
51
|
-
|
|
52
|
-
### Patch Changes
|
|
53
|
-
|
|
54
|
-
- 993dc67: Updated supemousejs packages with proper author, license and url descriptors to repo
|
|
55
|
-
- Updated dependencies [993dc67]
|
|
56
|
-
- @supermousejs/utils@2.0.4
|
|
57
|
-
- @supermousejs/core@2.0.4
|
|
58
|
-
|
|
59
|
-
## 2.0.3
|
|
60
|
-
|
|
61
|
-
### Patch Changes
|
|
62
|
-
|
|
63
|
-
- Updated dependencies
|
|
64
|
-
- @supermousejs/core@2.0.3
|
|
65
|
-
- @supermousejs/utils@2.0.3
|
|
66
|
-
|
|
67
|
-
## 2.0.2
|
|
68
|
-
|
|
69
|
-
### Patch Changes
|
|
70
|
-
|
|
71
|
-
- ae219a0: Update READMEs with correct link to documentation
|
|
72
|
-
- Updated dependencies [ae219a0]
|
|
73
|
-
- @supermousejs/utils@2.0.2
|
|
74
|
-
- @supermousejs/core@2.0.2
|
|
75
|
-
|
|
76
|
-
## 2.0.1
|
|
77
|
-
|
|
78
|
-
### Patch Changes
|
|
79
|
-
|
|
80
|
-
- Add minimal README.md files to packages
|
|
81
|
-
- Updated dependencies
|
|
82
|
-
- @supermousejs/utils@2.0.1
|
|
83
|
-
- @supermousejs/core@2.0.1
|
|
84
|
-
|
|
85
|
-
## 2.0.0
|
|
86
|
-
|
|
87
|
-
### Major Changes
|
|
88
|
-
|
|
89
|
-
- Initial v2.0.0 release
|
|
90
|
-
|
|
91
|
-
### Patch Changes
|
|
92
|
-
|
|
93
|
-
- Updated dependencies
|
|
94
|
-
- @supermousejs/utils@2.0.0
|
|
95
|
-
- @supermousejs/core@2.0.0
|
package/meta.json
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "ring",
|
|
3
|
-
"name": "Ring",
|
|
4
|
-
"package": "@supermousejs/ring",
|
|
5
|
-
"description": "Adds a lagging outer ring. Simple and performant.",
|
|
6
|
-
"code": "app.use(Ring({ size: 32, color: '#000' }));",
|
|
7
|
-
"recipeId": "magnetic-button",
|
|
8
|
-
"icon": "ring",
|
|
9
|
-
"options": [
|
|
10
|
-
{
|
|
11
|
-
"name": "size",
|
|
12
|
-
"type": "number",
|
|
13
|
-
"default": "20",
|
|
14
|
-
"description": "Diameter of the ring in pixels.",
|
|
15
|
-
"reactive": true
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"name": "color",
|
|
19
|
-
"type": "string",
|
|
20
|
-
"default": "'#ffffff'",
|
|
21
|
-
"description": "Border color.",
|
|
22
|
-
"reactive": true
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "borderWidth",
|
|
26
|
-
"type": "number",
|
|
27
|
-
"default": "2",
|
|
28
|
-
"description": "Stroke width in pixels.",
|
|
29
|
-
"reactive": true
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"name": "opacity",
|
|
33
|
-
"type": "number",
|
|
34
|
-
"default": "1",
|
|
35
|
-
"description": "Opacity level (0-1).",
|
|
36
|
-
"reactive": true
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"name": "mixBlendMode",
|
|
40
|
-
"type": "string",
|
|
41
|
-
"default": "'difference'",
|
|
42
|
-
"description": "CSS blend mode.",
|
|
43
|
-
"reactive": false
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { ValueOrGetter, Supermouse } from "@supermousejs/core";
|
|
2
|
-
import { definePlugin, normalize, dom, Layers } from "@supermousejs/utils";
|
|
3
|
-
|
|
4
|
-
export interface RingOptions {
|
|
5
|
-
name?: string;
|
|
6
|
-
isEnabled?: boolean;
|
|
7
|
-
size?: ValueOrGetter<number>;
|
|
8
|
-
color?: ValueOrGetter<string>;
|
|
9
|
-
borderWidth?: ValueOrGetter<number>;
|
|
10
|
-
opacity?: ValueOrGetter<number>;
|
|
11
|
-
mixBlendMode?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const Ring = (options: RingOptions = {}) => {
|
|
15
|
-
const getSize = normalize(options.size, 20);
|
|
16
|
-
const getColor = normalize(options.color, "#ffffff");
|
|
17
|
-
const getBorder = normalize(options.borderWidth, 2);
|
|
18
|
-
const getOpacity = normalize(options.opacity, 1);
|
|
19
|
-
|
|
20
|
-
return definePlugin<HTMLDivElement, RingOptions>(
|
|
21
|
-
{
|
|
22
|
-
name: options.name || "ring",
|
|
23
|
-
selector: "[data-supermouse-color]",
|
|
24
|
-
|
|
25
|
-
create: (app: Supermouse) => {
|
|
26
|
-
const el = dom.createCircle(getSize(app.state), "transparent");
|
|
27
|
-
dom.applyStyles(el, {
|
|
28
|
-
zIndex: Layers.FOLLOWER,
|
|
29
|
-
mixBlendMode: options.mixBlendMode || "difference",
|
|
30
|
-
borderStyle: "solid",
|
|
31
|
-
transition: "opacity 0.2s ease",
|
|
32
|
-
boxSizing: "border-box"
|
|
33
|
-
});
|
|
34
|
-
return el;
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
update: (app: Supermouse, el: HTMLDivElement) => {
|
|
38
|
-
const size = getSize(app.state);
|
|
39
|
-
const color = app.state.interaction.color || getColor(app.state);
|
|
40
|
-
|
|
41
|
-
dom.applyStyles(el, {
|
|
42
|
-
width: `${size}px`,
|
|
43
|
-
height: `${size}px`,
|
|
44
|
-
borderColor: color,
|
|
45
|
-
borderWidth: `${getBorder(app.state)}px`,
|
|
46
|
-
opacity: String(getOpacity(app.state)),
|
|
47
|
-
borderRadius: "50%"
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const { x, y } = app.state.smooth;
|
|
51
|
-
dom.setTransform(el, x, y);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
options
|
|
55
|
-
);
|
|
56
|
-
};
|
package/tsconfig.json
DELETED
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: "SupermouseRing",
|
|
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
|
-
});
|