@supermousejs/ring 2.1.1 → 2.3.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 CHANGED
@@ -1,5 +1,32 @@
1
1
  # @supermousejs/ring
2
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
+
3
30
  ## 2.1.1
4
31
 
5
32
  ### Patch Changes
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,29 +1,30 @@
1
-
2
- # @supermousejs/ring
3
-
4
- The standard Ring cursor plugin for **Supermouse v2**. Supports morphing when used with the Stick logic plugin.
5
-
6
- ## Installation
7
-
8
- ```bash
9
- pnpm add @supermousejs/ring
10
- ```
11
-
12
- ## Usage
13
-
14
- ```ts
15
- import { Supermouse } from '@supermousejs/core';
16
- import { Ring } from '@supermousejs/ring';
17
-
18
- const app = new Supermouse();
19
-
20
- app.use(Ring({
21
- size: 20,
22
- color: 'black',
23
- borderWidth: 2
24
- }));
25
- ```
26
-
27
- ## Documentation
28
-
29
- Full documentation and interactive playground available at [supermouse](https://supermouse.vercel.app) or [check out the repo](https://github.com/Whitestar14/supermouse-js).
1
+ # @supermousejs/ring
2
+
3
+ The standard Ring cursor plugin for **Supermouse v2**. Supports morphing when used with the Stick logic plugin.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @supermousejs/ring
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { Supermouse } from "@supermousejs/core";
15
+ import { Ring } from "@supermousejs/ring";
16
+
17
+ const app = new Supermouse();
18
+
19
+ app.use(
20
+ Ring({
21
+ size: 20,
22
+ color: "black",
23
+ borderWidth: 2
24
+ })
25
+ );
26
+ ```
27
+
28
+ ## Documentation
29
+
30
+ 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
@@ -1,5 +1,5 @@
1
- import { SupermousePlugin } from '../../core/src/index.ts';
2
- import { ValueOrGetter } from '../../core/src/index.ts';
1
+ import { SupermousePlugin } from '../packages/core/src';
2
+ import { ValueOrGetter } from '../packages/core/src';
3
3
 
4
4
  export declare const Ring: (options?: RingOptions) => SupermousePlugin;
5
5
 
package/dist/index.mjs CHANGED
@@ -1,28 +1,37 @@
1
- import { normalize as s, definePlugin as m, dom as r, Layers as S } from "@supermousejs/utils";
2
- const x = (o = {}) => {
3
- const i = s(o.size, 20), c = s(o.color, "#ffffff"), d = s(o.borderWidth, 2), l = s(o.opacity, 1);
4
- return m({
5
- name: o.name || "ring",
6
- selector: "[data-supermouse-color]",
7
- create: (t) => {
8
- const e = r.createCircle(i(t.state), "transparent");
9
- return r.applyStyles(e, {
10
- zIndex: S.FOLLOWER,
11
- mixBlendMode: o.mixBlendMode || "difference",
12
- borderStyle: "solid",
13
- transition: "opacity 0.2s ease",
14
- boxSizing: "border-box"
15
- }), e;
1
+ import { normalize as o, definePlugin as y, dom as s, Layers as g } from "@supermousejs/utils";
2
+ const b = (t = {}) => {
3
+ const n = o(t.size, 20), i = o(t.color, "#ffffff"), c = o(t.borderWidth, 2), d = o(t.opacity, 1);
4
+ return y(
5
+ {
6
+ name: t.name || "ring",
7
+ selector: "[data-supermouse-color]",
8
+ create: (e) => {
9
+ const r = s.createCircle(n(e.state), "transparent");
10
+ return s.applyStyles(r, {
11
+ zIndex: g.FOLLOWER,
12
+ mixBlendMode: t.mixBlendMode || "difference",
13
+ borderStyle: "solid",
14
+ transition: "opacity 0.2s ease",
15
+ boxSizing: "border-box"
16
+ }), r;
17
+ },
18
+ update: (e, r) => {
19
+ const a = n(e.state), l = e.state.interaction.color || i(e.state);
20
+ s.applyStyles(r, {
21
+ width: `${a}px`,
22
+ height: `${a}px`,
23
+ borderColor: l,
24
+ borderWidth: `${c(e.state)}px`,
25
+ opacity: String(d(e.state)),
26
+ borderRadius: "50%"
27
+ });
28
+ const { x: f, y: m } = e.state.smooth;
29
+ s.setTransform(r, f, m);
30
+ }
16
31
  },
17
- update: (t, e) => {
18
- const n = i(t.state);
19
- let a = c(t.state);
20
- t.state.interaction.color && (a = t.state.interaction.color), r.setStyle(e, "width", `${n}px`), r.setStyle(e, "height", `${n}px`), r.setStyle(e, "borderRadius", "50%"), r.setStyle(e, "borderColor", a), r.setStyle(e, "borderWidth", `${d(t.state)}px`), r.setStyle(e, "opacity", String(l(t.state)));
21
- const { x: y, y: f } = t.state.smooth;
22
- r.setTransform(e, y, f);
23
- }
24
- }, o);
32
+ t
33
+ );
25
34
  };
26
35
  export {
27
- x as Ring
36
+ b as Ring
28
37
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("@supermousejs/utils")):typeof define=="function"&&define.amd?define(["exports","@supermousejs/utils"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.SupermouseRing={},r.SupermouseUtils))})(this,(function(r,e){"use strict";const c=(n={})=>{const d=e.normalize(n.size,20),a=e.normalize(n.color,"#ffffff"),m=e.normalize(n.borderWidth,2),f=e.normalize(n.opacity,1);return e.definePlugin({name:n.name||"ring",selector:"[data-supermouse-color]",create:o=>{const t=e.dom.createCircle(d(o.state),"transparent");return e.dom.applyStyles(t,{zIndex:e.Layers.FOLLOWER,mixBlendMode:n.mixBlendMode||"difference",borderStyle:"solid",transition:"opacity 0.2s ease",boxSizing:"border-box"}),t},update:(o,t)=>{const s=d(o.state);let i=a(o.state);o.state.interaction.color&&(i=o.state.interaction.color),e.dom.setStyle(t,"width",`${s}px`),e.dom.setStyle(t,"height",`${s}px`),e.dom.setStyle(t,"borderRadius","50%"),e.dom.setStyle(t,"borderColor",i),e.dom.setStyle(t,"borderWidth",`${m(o.state)}px`),e.dom.setStyle(t,"opacity",String(f(o.state)));const{x:y,y:S}=o.state.smooth;e.dom.setTransform(t,y,S)}},n)};r.Ring=c,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
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.SupermouseRing={},o.SupermouseUtils))})(this,(function(o,e){"use strict";const d=(r={})=>{const i=e.normalize(r.size,20),a=e.normalize(r.color,"#ffffff"),c=e.normalize(r.borderWidth,2),f=e.normalize(r.opacity,1);return e.definePlugin({name:r.name||"ring",selector:"[data-supermouse-color]",create:t=>{const n=e.dom.createCircle(i(t.state),"transparent");return e.dom.applyStyles(n,{zIndex:e.Layers.FOLLOWER,mixBlendMode:r.mixBlendMode||"difference",borderStyle:"solid",transition:"opacity 0.2s ease",boxSizing:"border-box"}),n},update:(t,n)=>{const s=i(t.state),m=t.state.interaction.color||a(t.state);e.dom.applyStyles(n,{width:`${s}px`,height:`${s}px`,borderColor:m,borderWidth:`${c(t.state)}px`,opacity:String(f(t.state)),borderRadius:"50%"});const{x:l,y:u}=t.state.smooth;e.dom.setTransform(n,l,u)}},r)};o.Ring=d,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}));
package/meta.json CHANGED
@@ -1,17 +1,46 @@
1
-
2
- {
3
- "id": "ring",
4
- "name": "Ring",
5
- "package": "@supermousejs/ring",
6
- "description": "Adds a lagging outer ring. Simple and performant.",
7
- "code": "app.use(Ring({ size: 32, color: '#000' }));",
8
- "recipeId": "magnetic-button",
9
- "icon": "ring",
10
- "options": [
11
- { "name": "size", "type": "number", "default": "20", "description": "Diameter of the ring in pixels.", "reactive": true },
12
- { "name": "color", "type": "string", "default": "'#ffffff'", "description": "Border color.", "reactive": true },
13
- { "name": "borderWidth", "type": "number", "default": "2", "description": "Stroke width in pixels.", "reactive": true },
14
- { "name": "opacity", "type": "number", "default": "1", "description": "Opacity level (0-1).", "reactive": true },
15
- { "name": "mixBlendMode", "type": "string", "default": "'difference'", "description": "CSS blend mode.", "reactive": false }
16
- ]
17
- }
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supermousejs/ring",
3
- "version": "2.1.1",
3
+ "version": "2.3.0",
4
4
  "main": "dist/index.umd.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -8,13 +8,13 @@
8
8
  "url": "https://github.com/Whitestar14/supermouse-js",
9
9
  "license": "MIT",
10
10
  "dependencies": {
11
- "@supermousejs/utils": "2.1.1"
11
+ "@supermousejs/utils": "2.3.0"
12
12
  },
13
13
  "devDependencies": {
14
- "@supermousejs/core": "2.0.5"
14
+ "@supermousejs/core": "2.2.0"
15
15
  },
16
16
  "peerDependencies": {
17
- "@supermousejs/core": "2.0.5"
17
+ "@supermousejs/core": "2.2.0"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
package/src/index.ts CHANGED
@@ -1,56 +1,56 @@
1
- import type { ValueOrGetter } 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
- name: options.name || 'ring',
22
- selector: '[data-supermouse-color]',
23
-
24
- create: (app) => {
25
- const el = dom.createCircle(getSize(app.state), 'transparent');
26
- dom.applyStyles(el, {
27
- zIndex: Layers.FOLLOWER,
28
- mixBlendMode: options.mixBlendMode || 'difference',
29
- borderStyle: 'solid',
30
- transition: 'opacity 0.2s ease',
31
- boxSizing: 'border-box'
32
- });
33
- return el;
34
- },
35
-
36
- update: (app, el) => {
37
- const size = getSize(app.state);
38
- let color = getColor(app.state);
39
-
40
- // Basic interaction override for color only
41
- if (app.state.interaction.color) {
42
- color = app.state.interaction.color;
43
- }
44
-
45
- dom.setStyle(el, 'width', `${size}px`);
46
- dom.setStyle(el, 'height', `${size}px`);
47
- dom.setStyle(el, 'borderRadius', '50%');
48
- dom.setStyle(el, 'borderColor', color);
49
- dom.setStyle(el, 'borderWidth', `${getBorder(app.state)}px`);
50
- dom.setStyle(el, 'opacity', String(getOpacity(app.state)));
51
-
52
- const { x, y } = app.state.smooth;
53
- dom.setTransform(el, x, y);
54
- }
55
- }, options);
56
- };
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 CHANGED
@@ -1,18 +1,4 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "include": [
4
- "src"
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
- }
1
+ {
2
+ "extends": "../../tsconfig.plugin.json",
3
+ "include": ["src"]
4
+ }
package/vite.config.ts CHANGED
@@ -1,22 +1,23 @@
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
- plugins: [dts({ rollupTypes: true })]
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: "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
+ });