@supermousejs/trail 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,33 @@
1
1
  # @supermousejs/trail
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.1
12
+
13
+ ### Patch Changes
14
+
15
+ - a72f5a3: bugfix: fixed a type declaration issue from missing `return` keyword with the Trail package export
16
+
17
+ ## 2.2.0
18
+
19
+ ### Patch Changes
20
+
21
+ - 6d70c18: remove legacy package and update supermouse domain in readme
22
+ - 14fb5b6: Updated tsconfig to be reference-compliant with core, utils and zoetrope when required
23
+ - Updated dependencies [6d70c18]
24
+ - Updated dependencies [2590af3]
25
+ - Updated dependencies [14fb5b6]
26
+ - Updated dependencies [9fe1a7b]
27
+ - Updated dependencies [9fa6ece]
28
+ - @supermousejs/core@2.1.0
29
+ - @supermousejs/utils@2.2.0
30
+
3
31
  ## 2.1.1
4
32
 
5
33
  ### 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,28 +1,30 @@
1
- # @supermousejs/trail
2
-
3
- Generates a procedural particle trail that follows the cursor.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- pnpm add @supermousejs/trail
9
- ```
10
-
11
- ## Usage
12
-
13
- ```ts
14
- import { Supermouse } from '@supermousejs/core';
15
- import { Trail } from '@supermousejs/trail';
16
-
17
- const app = new Supermouse();
18
-
19
- app.use(Trail({
20
- length: 10, // Number of segments
21
- size: 6, // Particle size
22
- color: '#ff00ff'
23
- }));
24
- ```
25
-
26
- ## Documentation
27
-
28
- 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/trail
2
+
3
+ Generates a procedural particle trail that follows the cursor.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @supermousejs/trail
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { Supermouse } from "@supermousejs/core";
15
+ import { Trail } from "@supermousejs/trail";
16
+
17
+ const app = new Supermouse();
18
+
19
+ app.use(
20
+ Trail({
21
+ length: 10, // Number of segments
22
+ size: 6, // Particle size
23
+ color: "#ff00ff"
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 Trail: (options?: TrailOptions) => SupermousePlugin;
5
5
 
package/dist/index.mjs CHANGED
@@ -1,27 +1,31 @@
1
1
  import { normalize as d, definePlugin as p, dom as o, Layers as z } from "@supermousejs/utils";
2
2
  const C = (s = {}) => {
3
- const l = s.length || 10, f = d(s.size, 6), m = d(s.color, "#ff00ff"), a = [], r = [];
4
- return p({
5
- name: s.name || "trail",
6
- create: () => {
7
- const t = o.createActor("div");
8
- t.style.zIndex = z.TRACE;
9
- for (let n = 0; n < l; n++) {
10
- const e = o.createCircle(0, "#000");
11
- e.style.position = "absolute", e.style.opacity = String(1 - n / l), t.appendChild(e), a.push(e), r.push({ x: -100, y: -100 });
3
+ const l = s.length || 10, f = d(s.size, 6), m = d(s.color, "#ff00ff"), a = [], n = [];
4
+ return p(
5
+ {
6
+ name: s.name || "trail",
7
+ create: () => {
8
+ a.length = 0, n.length = 0;
9
+ const t = o.createActor("div");
10
+ t.style.zIndex = z.TRACE;
11
+ for (let r = 0; r < l; r++) {
12
+ const e = o.createCircle(0, "#000");
13
+ e.style.position = "absolute", e.style.opacity = String(1 - r / l), t.appendChild(e), a.push(e), n.push({ x: -100, y: -100 });
14
+ }
15
+ return t;
16
+ },
17
+ update: (t) => {
18
+ const { x: r, y: e } = t.state.smooth;
19
+ n.pop(), n.unshift({ x: r, y: e });
20
+ const u = f(t.state), g = m(t.state);
21
+ a.forEach((c, i) => {
22
+ const h = n[i], x = 1 - i / l, y = u * x;
23
+ o.setStyle(c, "width", `${y}px`), o.setStyle(c, "height", `${y}px`), o.setStyle(c, "backgroundColor", g), o.setTransform(c, h.x, h.y);
24
+ });
12
25
  }
13
- return t;
14
26
  },
15
- update: (t) => {
16
- const { x: n, y: e } = t.state.smooth;
17
- r.pop(), r.unshift({ x: n, y: e });
18
- const u = f(t.state), x = m(t.state);
19
- a.forEach((c, i) => {
20
- const h = r[i], g = 1 - i / l, y = u * g;
21
- o.setStyle(c, "width", `${y}px`), o.setStyle(c, "height", `${y}px`), o.setStyle(c, "backgroundColor", x), o.setTransform(c, h.x, h.y);
22
- });
23
- }
24
- }, s);
27
+ s
28
+ );
25
29
  };
26
30
  export {
27
31
  C as Trail
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
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.SupermouseTrail={},t.SupermouseUtils))})(this,(function(t,e){"use strict";const u=(s={})=>{const d=s.length||10,y=e.normalize(s.size,6),h=e.normalize(s.color,"#ff00ff"),a=[],c=[];return e.definePlugin({name:s.name||"trail",create:()=>{const o=e.dom.createActor("div");o.style.zIndex=e.Layers.TRACE;for(let r=0;r<d;r++){const n=e.dom.createCircle(0,"#000");n.style.position="absolute",n.style.opacity=String(1-r/d),o.appendChild(n),a.push(n),c.push({x:-100,y:-100})}return o},update:o=>{const{x:r,y:n}=o.state.smooth;c.pop(),c.unshift({x:r,y:n});const p=y(o.state),S=h(o.state);a.forEach((i,f)=>{const l=c[f],x=1-f/d,m=p*x;e.dom.setStyle(i,"width",`${m}px`),e.dom.setStyle(i,"height",`${m}px`),e.dom.setStyle(i,"backgroundColor",S),e.dom.setTransform(i,l.x,l.y)})}},s)};t.Trail=u,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
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.SupermouseTrail={},t.SupermouseUtils))})(this,(function(t,e){"use strict";const u=(s={})=>{const d=s.length||10,h=e.normalize(s.size,6),y=e.normalize(s.color,"#ff00ff"),a=[],r=[];return e.definePlugin({name:s.name||"trail",create:()=>{a.length=0,r.length=0;const o=e.dom.createActor("div");o.style.zIndex=e.Layers.TRACE;for(let c=0;c<d;c++){const n=e.dom.createCircle(0,"#000");n.style.position="absolute",n.style.opacity=String(1-c/d),o.appendChild(n),a.push(n),r.push({x:-100,y:-100})}return o},update:o=>{const{x:c,y:n}=o.state.smooth;r.pop(),r.unshift({x:c,y:n});const p=h(o.state),S=y(o.state);a.forEach((i,l)=>{const f=r[l],g=1-l/d,m=p*g;e.dom.setStyle(i,"width",`${m}px`),e.dom.setStyle(i,"height",`${m}px`),e.dom.setStyle(i,"backgroundColor",S),e.dom.setTransform(i,f.x,f.y)})}},s)};t.Trail=u,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
package/meta.json CHANGED
@@ -1,15 +1,32 @@
1
-
2
- {
3
- "id": "trail",
4
- "name": "Trail",
5
- "package": "@supermousejs/trail",
6
- "description": "Generates procedural particles that trail behind your motion.",
7
- "code": "app.use(Trail({ length: 12, color: '#f0f' }));",
8
- "recipeId": "ghost-trail",
9
- "icon": "trail",
10
- "options": [
11
- { "name": "length", "type": "number", "default": "10", "description": "Number of trail segments.", "reactive": false },
12
- { "name": "size", "type": "number", "default": "6", "description": "Size of trail particles.", "reactive": true },
13
- { "name": "color", "type": "string", "default": "'#ff00ff'", "description": "Color of segments.", "reactive": true }
14
- ]
15
- }
1
+ {
2
+ "id": "trail",
3
+ "name": "Trail",
4
+ "package": "@supermousejs/trail",
5
+ "description": "Generates procedural particles that trail behind your motion.",
6
+ "code": "app.use(Trail({ length: 12, color: '#f0f' }));",
7
+ "recipeId": "ghost-trail",
8
+ "icon": "trail",
9
+ "options": [
10
+ {
11
+ "name": "length",
12
+ "type": "number",
13
+ "default": "10",
14
+ "description": "Number of trail segments.",
15
+ "reactive": false
16
+ },
17
+ {
18
+ "name": "size",
19
+ "type": "number",
20
+ "default": "6",
21
+ "description": "Size of trail particles.",
22
+ "reactive": true
23
+ },
24
+ {
25
+ "name": "color",
26
+ "type": "string",
27
+ "default": "'#ff00ff'",
28
+ "description": "Color of segments.",
29
+ "reactive": true
30
+ }
31
+ ]
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supermousejs/trail",
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,61 +1,66 @@
1
- import type { ValueOrGetter } from '@supermousejs/core';
2
- import { definePlugin, normalize, dom, Layers } from '@supermousejs/utils';
3
-
4
- export interface TrailOptions {
5
- name?: string;
6
- isEnabled?: boolean;
7
- length?: number;
8
- size?: ValueOrGetter<number>;
9
- color?: ValueOrGetter<string>;
10
- }
11
-
12
- export const Trail = (options: TrailOptions = {}) => {
13
- const length = options.length || 10;
14
- const getSize = normalize(options.size, 6);
15
- const getColor = normalize(options.color, '#ff00ff');
16
-
17
- const segments: HTMLDivElement[] = [];
18
- const history: { x: number, y: number }[] = [];
19
-
20
- return definePlugin<HTMLDivElement, TrailOptions>({
21
- name: options.name || 'trail',
22
-
23
- create: () => {
24
- const container = dom.createActor('div') as HTMLDivElement;
25
- container.style.zIndex = Layers.TRACE;
26
-
27
- for(let i=0; i<length; i++) {
28
- const d = dom.createCircle(0, '#000');
29
- d.style.position = 'absolute';
30
- d.style.opacity = String(1 - (i / length));
31
- container.appendChild(d);
32
- segments.push(d);
33
- history.push({ x: -100, y: -100 });
34
- }
35
- return container;
36
- },
37
-
38
- update: (app) => {
39
- const { x, y } = app.state.smooth;
40
-
41
- // Shift history
42
- history.pop();
43
- history.unshift({ x, y });
44
-
45
- const baseSize = getSize(app.state);
46
- const color = getColor(app.state);
47
-
48
- segments.forEach((seg, i) => {
49
- const pos = history[i];
50
- const scale = 1 - (i / length);
51
- const size = baseSize * scale;
52
-
53
- dom.setStyle(seg, 'width', `${size}px`);
54
- dom.setStyle(seg, 'height', `${size}px`);
55
- dom.setStyle(seg, 'backgroundColor', color);
56
-
57
- dom.setTransform(seg, pos.x, pos.y);
58
- });
59
- }
60
- }, options);
61
- };
1
+ import type { ValueOrGetter, Supermouse } from "@supermousejs/core";
2
+ import { definePlugin, normalize, dom, Layers } from "@supermousejs/utils";
3
+
4
+ export interface TrailOptions {
5
+ name?: string;
6
+ isEnabled?: boolean;
7
+ length?: number;
8
+ size?: ValueOrGetter<number>;
9
+ color?: ValueOrGetter<string>;
10
+ }
11
+
12
+ export const Trail = (options: TrailOptions = {}) => {
13
+ const length = options.length || 10;
14
+ const getSize = normalize(options.size, 6);
15
+ const getColor = normalize(options.color, "#ff00ff");
16
+
17
+ const segments: HTMLDivElement[] = [];
18
+ const history: { x: number; y: number }[] = [];
19
+
20
+ return definePlugin<HTMLDivElement, TrailOptions>(
21
+ {
22
+ name: options.name || "trail",
23
+
24
+ create: () => {
25
+ segments.length = 0;
26
+ history.length = 0;
27
+ const container = dom.createActor("div") as HTMLDivElement;
28
+ container.style.zIndex = Layers.TRACE;
29
+
30
+ for (let i = 0; i < length; i++) {
31
+ const d = dom.createCircle(0, "#000");
32
+ d.style.position = "absolute";
33
+ d.style.opacity = String(1 - i / length);
34
+ container.appendChild(d);
35
+ segments.push(d);
36
+ history.push({ x: -100, y: -100 });
37
+ }
38
+ return container;
39
+ },
40
+
41
+ update: (app: Supermouse) => {
42
+ const { x, y } = app.state.smooth;
43
+
44
+ // Shift history
45
+ history.pop();
46
+ history.unshift({ x, y });
47
+
48
+ const baseSize = getSize(app.state);
49
+ const color = getColor(app.state);
50
+
51
+ segments.forEach((seg, i) => {
52
+ const pos = history[i];
53
+ const scale = 1 - i / length;
54
+ const size = baseSize * scale;
55
+
56
+ dom.setStyle(seg, "width", `${size}px`);
57
+ dom.setStyle(seg, "height", `${size}px`);
58
+ dom.setStyle(seg, "backgroundColor", color);
59
+
60
+ dom.setTransform(seg, pos.x, pos.y);
61
+ });
62
+ }
63
+ },
64
+ options
65
+ );
66
+ };
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: 'SupermouseTrail',
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: "SupermouseTrail",
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
+ });