@supermousejs/zoetrope 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 +29 -0
- package/README.md +4 -1
- package/package.json +9 -4
- package/src/index.ts +37 -37
- package/tsconfig.json +14 -14
- package/vite.config.ts +21 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @supermousejs/zoetrope
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0a1652d: fixed build architecture and updated plugin metadata
|
|
8
|
+
|
|
9
|
+
## 2.0.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 993dc67: Updated supemousejs packages with proper author, license and url descriptors to repo
|
|
14
|
+
- Updated dependencies [993dc67]
|
|
15
|
+
- @supermousejs/core@2.0.4
|
|
16
|
+
|
|
17
|
+
## 2.0.3
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @supermousejs/core@2.0.3
|
|
23
|
+
|
|
24
|
+
## 2.0.2
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- ae219a0: Update READMEs with correct link to documentation
|
|
29
|
+
- Updated dependencies [ae219a0]
|
|
30
|
+
- @supermousejs/core@2.0.2
|
|
31
|
+
|
|
3
32
|
## 2.0.1
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
1
|
# @supermousejs/zoetrope
|
|
3
2
|
|
|
4
3
|
Internal SVG path math library used by `@supermousejs/labs` (TextRing).
|
|
5
4
|
Calculates circular paths and circumferences.
|
|
5
|
+
|
|
6
|
+
## Documentation
|
|
7
|
+
|
|
8
|
+
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,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supermousejs/zoetrope",
|
|
3
|
-
"version": "2.0
|
|
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
|
-
"
|
|
8
|
-
|
|
7
|
+
"author": "O.S David",
|
|
8
|
+
"url": "https://github.com/Whitestar14/supermouse-js",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@supermousejs/core": "2.0.4"
|
|
9
12
|
},
|
|
10
|
-
"devDependencies": {},
|
|
11
13
|
"exports": {
|
|
12
14
|
".": {
|
|
13
15
|
"types": "./dist/index.d.ts",
|
|
@@ -18,6 +20,9 @@
|
|
|
18
20
|
"publishConfig": {
|
|
19
21
|
"access": "public"
|
|
20
22
|
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@supermousejs/core": "2.0.4"
|
|
25
|
+
},
|
|
21
26
|
"scripts": {
|
|
22
27
|
"build": "vite build"
|
|
23
28
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the SVG Path data for a perfect circle starting at the top center (12 o'clock).
|
|
3
|
-
*
|
|
4
|
-
* Path moves to (0, -r), then draws two semi-circles.
|
|
5
|
-
* @param r Radius in pixels
|
|
6
|
-
*/
|
|
7
|
-
export function getCirclePath(r: number): string {
|
|
8
|
-
// Fix floating point precision slightly to avoid rendering artifacts
|
|
9
|
-
const rClean = Math.round(r * 100) / 100;
|
|
10
|
-
|
|
11
|
-
return `
|
|
12
|
-
M 0, -${rClean}
|
|
13
|
-
A ${rClean},${rClean} 0 1,1 0,${rClean}
|
|
14
|
-
A ${rClean},${rClean} 0 1,1 0,-${rClean}
|
|
15
|
-
`.replace(/\s+/g, ' ').trim();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Calculates the circumference of a circle.
|
|
20
|
-
* @param r Radius in pixels
|
|
21
|
-
*/
|
|
22
|
-
export function getCircumference(r: number): number {
|
|
23
|
-
return 2 * Math.PI * r;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Prepares text for a seamless loop by optionally appending a non-breaking space.
|
|
28
|
-
* This prevents the last character from touching the first character when spread is active.
|
|
29
|
-
*
|
|
30
|
-
* @param text The source text
|
|
31
|
-
* @param spread Whether auto-fit spreading is enabled
|
|
32
|
-
*/
|
|
33
|
-
export function formatLoopText(text: string, spread: boolean): string {
|
|
34
|
-
if (!spread) return text;
|
|
35
|
-
// \u00A0 is
|
|
36
|
-
return text + '\u00A0';
|
|
37
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the SVG Path data for a perfect circle starting at the top center (12 o'clock).
|
|
3
|
+
*
|
|
4
|
+
* Path moves to (0, -r), then draws two semi-circles.
|
|
5
|
+
* @param r Radius in pixels
|
|
6
|
+
*/
|
|
7
|
+
export function getCirclePath(r: number): string {
|
|
8
|
+
// Fix floating point precision slightly to avoid rendering artifacts
|
|
9
|
+
const rClean = Math.round(r * 100) / 100;
|
|
10
|
+
|
|
11
|
+
return `
|
|
12
|
+
M 0, -${rClean}
|
|
13
|
+
A ${rClean},${rClean} 0 1,1 0,${rClean}
|
|
14
|
+
A ${rClean},${rClean} 0 1,1 0,-${rClean}
|
|
15
|
+
`.replace(/\s+/g, ' ').trim();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Calculates the circumference of a circle.
|
|
20
|
+
* @param r Radius in pixels
|
|
21
|
+
*/
|
|
22
|
+
export function getCircumference(r: number): number {
|
|
23
|
+
return 2 * Math.PI * r;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Prepares text for a seamless loop by optionally appending a non-breaking space.
|
|
28
|
+
* This prevents the last character from touching the first character when spread is active.
|
|
29
|
+
*
|
|
30
|
+
* @param text The source text
|
|
31
|
+
* @param spread Whether auto-fit spreading is enabled
|
|
32
|
+
*/
|
|
33
|
+
export function formatLoopText(text: string, spread: boolean): string {
|
|
34
|
+
if (!spread) return text;
|
|
35
|
+
// \u00A0 is
|
|
36
|
+
return text + '\u00A0';
|
|
37
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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
|
-
}
|
|
14
|
-
}
|
|
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
|
+
}
|
|
14
|
+
}
|
|
15
15
|
}
|
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: 'SupermouseZoetrope',
|
|
10
|
-
fileName: (format) => format === 'es' ? 'index.mjs' : 'index.umd.js',
|
|
11
|
-
},
|
|
12
|
-
rollupOptions: {
|
|
13
|
-
external: ['@supermousejs/core'],
|
|
14
|
-
output: {
|
|
15
|
-
globals: {
|
|
16
|
-
'@supermousejs/core': 'SupermouseCore'
|
|
17
|
-
}
|
|
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: 'SupermouseZoetrope',
|
|
10
|
+
fileName: (format) => format === 'es' ? 'index.mjs' : 'index.umd.js',
|
|
11
|
+
},
|
|
12
|
+
rollupOptions: {
|
|
13
|
+
external: ['@supermousejs/core'],
|
|
14
|
+
output: {
|
|
15
|
+
globals: {
|
|
16
|
+
'@supermousejs/core': 'SupermouseCore'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
plugins: [dts({ rollupTypes: true })]
|
|
22
22
|
});
|