@supermousejs/trail 2.3.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/trail
2
2
 
3
- Generates a procedural particle trail that follows the cursor.
3
+ Generates procedural particles that trail behind your motion.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,23 +8,27 @@ Generates a procedural particle trail that follows the cursor.
8
8
  pnpm add @supermousejs/trail
9
9
  ```
10
10
 
11
- ## Usage
11
+ ## Trail
12
+
13
+ Generates procedural particles that trail behind your motion.
14
+
15
+ ### Usage
12
16
 
13
17
  ```ts
14
18
  import { Supermouse } from "@supermousejs/core";
15
19
  import { Trail } from "@supermousejs/trail";
16
-
17
20
  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
- );
21
+ app.use(Trail({ length: 12, color: '#f0f' }));
26
22
  ```
27
23
 
24
+ ### Options
25
+
26
+ | Name | Type | Default | Description |
27
+ | --- | --- | --- | --- |
28
+ | length | number | 10 | Number of trail segments. |
29
+ | size | number | 6 | Size of trail particles. |
30
+ | color | string | '#ff00ff' | Color of segments. |
31
+
28
32
  ## Documentation
29
33
 
30
34
  Full documentation and interactive playground available at [supermouse](https://supermouse.js.org) or [check out the repo](https://github.com/Whitestar14/supermouse-js).
package/package.json CHANGED
@@ -1,20 +1,24 @@
1
1
  {
2
2
  "name": "@supermousejs/trail",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "main": "dist/index.umd.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
7
11
  "author": "O.S David",
8
12
  "url": "https://github.com/Whitestar14/supermouse-js",
9
13
  "license": "MIT",
10
14
  "dependencies": {
11
- "@supermousejs/utils": "2.3.0"
15
+ "@supermousejs/utils": "2.3.1"
12
16
  },
13
17
  "devDependencies": {
14
- "@supermousejs/core": "2.2.0"
18
+ "@supermousejs/core": "2.3.0"
15
19
  },
16
20
  "peerDependencies": {
17
- "@supermousejs/core": "2.2.0"
21
+ "@supermousejs/core": "2.3.0"
18
22
  },
19
23
  "repository": {
20
24
  "type": "git",
package/CHANGELOG.md DELETED
@@ -1,96 +0,0 @@
1
- # @supermousejs/trail
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
-
31
- ## 2.1.1
32
-
33
- ### Patch Changes
34
-
35
- - 67f771b: Add relevant npm metadata to package.json file
36
- - Updated dependencies [67f771b]
37
- - @supermousejs/utils@2.1.1
38
- - @supermousejs/core@2.0.5
39
-
40
- ## 2.1.0
41
-
42
- ### Minor Changes
43
-
44
- - 0a1652d: fixed build architecture and updated plugin metadata
45
-
46
- ### Patch Changes
47
-
48
- - Updated dependencies [0a1652d]
49
- - @supermousejs/utils@2.1.0
50
-
51
- ## 2.0.4
52
-
53
- ### Patch Changes
54
-
55
- - 993dc67: Updated supemousejs packages with proper author, license and url descriptors to repo
56
- - Updated dependencies [993dc67]
57
- - @supermousejs/utils@2.0.4
58
- - @supermousejs/core@2.0.4
59
-
60
- ## 2.0.3
61
-
62
- ### Patch Changes
63
-
64
- - Updated dependencies
65
- - @supermousejs/core@2.0.3
66
- - @supermousejs/utils@2.0.3
67
-
68
- ## 2.0.2
69
-
70
- ### Patch Changes
71
-
72
- - ae219a0: Update READMEs with correct link to documentation
73
- - Updated dependencies [ae219a0]
74
- - @supermousejs/utils@2.0.2
75
- - @supermousejs/core@2.0.2
76
-
77
- ## 2.0.1
78
-
79
- ### Patch Changes
80
-
81
- - Add minimal README.md files to packages
82
- - Updated dependencies
83
- - @supermousejs/utils@2.0.1
84
- - @supermousejs/core@2.0.1
85
-
86
- ## 2.0.0
87
-
88
- ### Major Changes
89
-
90
- - Initial v2.0.0 release
91
-
92
- ### Patch Changes
93
-
94
- - Updated dependencies
95
- - @supermousejs/utils@2.0.0
96
- - @supermousejs/core@2.0.0
package/meta.json DELETED
@@ -1,32 +0,0 @@
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/src/index.ts DELETED
@@ -1,66 +0,0 @@
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 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: "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
- });