@supermousejs/trail 2.0.1 → 2.1.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,42 @@
1
1
  # @supermousejs/trail
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0a1652d: fixed build architecture and updated plugin metadata
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [0a1652d]
12
+ - @supermousejs/utils@2.1.0
13
+
14
+ ## 2.0.4
15
+
16
+ ### Patch Changes
17
+
18
+ - 993dc67: Updated supemousejs packages with proper author, license and url descriptors to repo
19
+ - Updated dependencies [993dc67]
20
+ - @supermousejs/utils@2.0.4
21
+ - @supermousejs/core@2.0.4
22
+
23
+ ## 2.0.3
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies
28
+ - @supermousejs/core@2.0.3
29
+ - @supermousejs/utils@2.0.3
30
+
31
+ ## 2.0.2
32
+
33
+ ### Patch Changes
34
+
35
+ - ae219a0: Update READMEs with correct link to documentation
36
+ - Updated dependencies [ae219a0]
37
+ - @supermousejs/utils@2.0.2
38
+ - @supermousejs/core@2.0.2
39
+
3
40
  ## 2.0.1
4
41
 
5
42
  ### Patch Changes
package/README.md CHANGED
@@ -22,3 +22,7 @@ app.use(Trail({
22
22
  color: '#ff00ff'
23
23
  }));
24
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).
package/package.json CHANGED
@@ -1,15 +1,21 @@
1
1
  {
2
2
  "name": "@supermousejs/trail",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "main": "dist/index.umd.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
7
+ "author": "O.S David",
8
+ "url": "https://github.com/Whitestar14/supermouse-js",
9
+ "license": "MIT",
7
10
  "dependencies": {
8
- "@supermousejs/core": "2.0.1",
9
- "@supermousejs/utils": "2.0.1"
11
+ "@supermousejs/utils": "2.1.0"
12
+ },
13
+ "devDependencies": {
14
+ "@supermousejs/core": "2.0.4"
15
+ },
16
+ "peerDependencies": {
17
+ "@supermousejs/core": "2.0.4"
10
18
  },
11
- "devDependencies": {},
12
- "peerDependencies": {},
13
19
  "exports": {
14
20
  ".": {
15
21
  "types": "./dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,61 +1,61 @@
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);
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
61
  };
package/tsconfig.json CHANGED
@@ -1,18 +1,18 @@
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
- }
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
18
  }
package/vite.config.ts CHANGED
@@ -1,22 +1,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
- plugins: [dts({ rollupTypes: true })]
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
22
  });