@sarmal/core 0.17.3 → 0.19.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/README.md +1 -12
- package/dist/auto-init.cjs +124 -92
- package/dist/auto-init.cjs.map +1 -1
- package/dist/auto-init.js +123 -91
- package/dist/auto-init.js.map +1 -1
- package/dist/curves/artemis2.cjs +10 -7
- package/dist/curves/artemis2.d.cts +1 -1
- package/dist/curves/artemis2.d.ts +1 -1
- package/dist/curves/artemis2.js +9 -6
- package/dist/curves/astroid.cjs +4 -4
- package/dist/curves/astroid.d.cts +1 -1
- package/dist/curves/astroid.d.ts +1 -1
- package/dist/curves/astroid.js +3 -3
- package/dist/curves/deltoid.cjs +4 -4
- package/dist/curves/deltoid.d.cts +1 -1
- package/dist/curves/deltoid.d.ts +1 -1
- package/dist/curves/deltoid.js +3 -3
- package/dist/curves/epicycloid3.cjs +4 -4
- package/dist/curves/epicycloid3.d.cts +1 -1
- package/dist/curves/epicycloid3.d.ts +1 -1
- package/dist/curves/epicycloid3.js +3 -3
- package/dist/curves/epitrochoid7.cjs +5 -5
- package/dist/curves/epitrochoid7.d.cts +1 -1
- package/dist/curves/epitrochoid7.d.ts +1 -1
- package/dist/curves/epitrochoid7.js +4 -4
- package/dist/curves/index.cjs +53 -40
- package/dist/curves/index.d.cts +29 -29
- package/dist/curves/index.d.ts +29 -29
- package/dist/curves/index.js +69 -40
- package/dist/curves/lame.cjs +6 -5
- package/dist/curves/lame.d.cts +1 -1
- package/dist/curves/lame.d.ts +1 -1
- package/dist/curves/lame.js +5 -4
- package/dist/curves/lissajous32.cjs +4 -4
- package/dist/curves/lissajous32.d.cts +1 -1
- package/dist/curves/lissajous32.d.ts +1 -1
- package/dist/curves/lissajous32.js +3 -3
- package/dist/curves/lissajous43.cjs +4 -4
- package/dist/curves/lissajous43.d.cts +1 -1
- package/dist/curves/lissajous43.d.ts +1 -1
- package/dist/curves/lissajous43.js +3 -3
- package/dist/curves/rose3.cjs +4 -4
- package/dist/curves/rose3.d.cts +1 -1
- package/dist/curves/rose3.d.ts +1 -1
- package/dist/curves/rose3.js +3 -3
- package/dist/curves/rose5.cjs +4 -4
- package/dist/curves/rose5.d.cts +1 -1
- package/dist/curves/rose5.d.ts +1 -1
- package/dist/curves/rose5.js +3 -3
- package/dist/curves/rose52.cjs +5 -5
- package/dist/curves/rose52.d.cts +1 -1
- package/dist/curves/rose52.d.ts +1 -1
- package/dist/curves/rose52.js +4 -4
- package/dist/curves/star.cjs +8 -5
- package/dist/curves/star.d.cts +1 -1
- package/dist/curves/star.d.ts +1 -1
- package/dist/curves/star.js +7 -4
- package/dist/curves/star4.cjs +8 -5
- package/dist/curves/star4.d.cts +1 -1
- package/dist/curves/star4.d.ts +1 -1
- package/dist/curves/star4.js +7 -4
- package/dist/curves/star7.cjs +8 -5
- package/dist/curves/star7.d.cts +1 -1
- package/dist/curves/star7.d.ts +1 -1
- package/dist/curves/star7.js +7 -4
- package/dist/index.cjs +159 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -37
- package/dist/index.d.ts +78 -37
- package/dist/index.js +177 -118
- package/dist/index.js.map +1 -1
- package/dist/types-frtEoAq6.d.cts +317 -0
- package/dist/types-frtEoAq6.d.ts +317 -0
- package/package.json +1 -1
- package/dist/types-BL9HhEmk.d.cts +0 -299
- package/dist/types-BL9HhEmk.d.ts +0 -299
package/dist/index.d.cts
CHANGED
|
@@ -1,31 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import {
|
|
2
|
+
B as BaseRendererOptions,
|
|
3
|
+
E as Engine,
|
|
4
|
+
S as SarmalInstance,
|
|
5
|
+
C as CurveDef,
|
|
6
|
+
R as RendererOptions,
|
|
7
|
+
a as SarmalOptions,
|
|
8
|
+
} from "./types-frtEoAq6.cjs";
|
|
9
|
+
export {
|
|
10
|
+
J as JumpOptions,
|
|
11
|
+
P as Point,
|
|
12
|
+
b as RuntimeRenderOptions,
|
|
13
|
+
c as SeekOptions,
|
|
14
|
+
T as TrailColor,
|
|
15
|
+
d as TrailStyle,
|
|
16
|
+
} from "./types-frtEoAq6.cjs";
|
|
17
|
+
export { CurveName, curves } from "./curves/index.cjs";
|
|
18
|
+
export { artemis2 } from "./curves/artemis2.cjs";
|
|
19
|
+
export { astroid } from "./curves/astroid.cjs";
|
|
20
|
+
export { deltoid } from "./curves/deltoid.cjs";
|
|
21
|
+
export { epicycloid3 } from "./curves/epicycloid3.cjs";
|
|
22
|
+
export { epitrochoid7 } from "./curves/epitrochoid7.cjs";
|
|
23
|
+
export { lame } from "./curves/lame.cjs";
|
|
24
|
+
export { lissajous32 } from "./curves/lissajous32.cjs";
|
|
25
|
+
export { lissajous43 } from "./curves/lissajous43.cjs";
|
|
26
|
+
export { rose3 } from "./curves/rose3.cjs";
|
|
27
|
+
export { rose5 } from "./curves/rose5.cjs";
|
|
28
|
+
import "./curves/rose52.cjs";
|
|
29
|
+
import "./curves/star.cjs";
|
|
30
|
+
import "./curves/star4.cjs";
|
|
31
|
+
import "./curves/star7.cjs";
|
|
18
32
|
|
|
19
33
|
interface SVGRendererOptions extends BaseRendererOptions {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
/** SVG element the renderer draws into directly */
|
|
35
|
+
container: SVGSVGElement;
|
|
36
|
+
engine: Engine;
|
|
37
|
+
/** @default 'Loading' */
|
|
38
|
+
ariaLabel?: string;
|
|
25
39
|
}
|
|
26
40
|
interface SVGSarmalOptions extends Omit<SVGRendererOptions, "container" | "engine"> {
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
/** @default 120 */
|
|
42
|
+
trailLength?: number;
|
|
29
43
|
}
|
|
30
44
|
/**
|
|
31
45
|
* Creates a live SVG renderer for sarmal animations
|
|
@@ -33,33 +47,40 @@ interface SVGSarmalOptions extends Omit<SVGRendererOptions, "container" | "engin
|
|
|
33
47
|
*/
|
|
34
48
|
declare function createSVGRenderer(options: SVGRendererOptions): SarmalInstance;
|
|
35
49
|
/**
|
|
36
|
-
* Creates a sarmal animation inside
|
|
37
|
-
* The
|
|
50
|
+
* Creates a sarmal animation directly inside an `<svg>` element using an SVG renderer.
|
|
51
|
+
* The passed `<svg>` element is set to `viewBox="0 0 100 100"` and animated via requestAnimationFrame
|
|
38
52
|
*
|
|
39
53
|
* @example
|
|
40
54
|
* ```ts
|
|
41
55
|
* import { createSarmalSVG, epitrochoid7 } from '@sarmal/core'
|
|
42
|
-
*
|
|
56
|
+
*
|
|
57
|
+
* // <svg id="spinner"></svg> in your HTML
|
|
58
|
+
* const svg = document.getElementById('spinner')
|
|
59
|
+
* const sarmal = createSarmalSVG(svg, epitrochoid7)
|
|
43
60
|
*
|
|
44
61
|
* // To control manually, use autoStart: false
|
|
45
|
-
* const controlled = createSarmalSVG(
|
|
62
|
+
* const controlled = createSarmalSVG(svg, rose5, { autoStart: false })
|
|
46
63
|
* controlled.play() // Start when ready
|
|
47
64
|
* controlled.pause() // Pause later
|
|
48
65
|
* ```
|
|
49
66
|
*/
|
|
50
|
-
declare function createSarmalSVG(
|
|
67
|
+
declare function createSarmalSVG(
|
|
68
|
+
container: SVGSVGElement,
|
|
69
|
+
curveDef: CurveDef,
|
|
70
|
+
options?: SVGSarmalOptions,
|
|
71
|
+
): SarmalInstance;
|
|
51
72
|
|
|
52
73
|
/**
|
|
53
74
|
* Can be passed directly to `trailColor`,
|
|
54
75
|
* or can be mixed/sliced before passing as a prop.
|
|
55
76
|
*/
|
|
56
77
|
declare const palettes: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
78
|
+
readonly bard: ["#a855f7", "#3b82f6", "#14b8a6", "#ec4899"];
|
|
79
|
+
readonly sunset: ["#f97316", "#dc2626", "#9333ea", "#f472b6"];
|
|
80
|
+
readonly ocean: ["#1e3a8a", "#06b6d4", "#22d3ee", "#e0f2fe"];
|
|
81
|
+
readonly ice: ["#1e3a8a", "#67e8f9"];
|
|
82
|
+
readonly fire: ["#7f1d1d", "#fbbf24"];
|
|
83
|
+
readonly forest: ["#14532d", "#86efac"];
|
|
63
84
|
};
|
|
64
85
|
type SarmalPalette = keyof typeof palettes;
|
|
65
86
|
|
|
@@ -85,6 +106,26 @@ declare function createRenderer(options: RendererOptions): SarmalInstance;
|
|
|
85
106
|
* controlled.pause() // Pause later
|
|
86
107
|
* ```
|
|
87
108
|
*/
|
|
88
|
-
declare function createSarmal(
|
|
109
|
+
declare function createSarmal(
|
|
110
|
+
canvas: HTMLCanvasElement,
|
|
111
|
+
curveDef: CurveDef,
|
|
112
|
+
options?: SarmalOptions,
|
|
113
|
+
): SarmalInstance;
|
|
89
114
|
|
|
90
|
-
export {
|
|
115
|
+
export {
|
|
116
|
+
BaseRendererOptions,
|
|
117
|
+
CurveDef,
|
|
118
|
+
Engine,
|
|
119
|
+
RendererOptions,
|
|
120
|
+
type SVGRendererOptions,
|
|
121
|
+
type SVGSarmalOptions,
|
|
122
|
+
SarmalInstance,
|
|
123
|
+
SarmalOptions,
|
|
124
|
+
type SarmalPalette,
|
|
125
|
+
createEngine,
|
|
126
|
+
createRenderer,
|
|
127
|
+
createSVGRenderer,
|
|
128
|
+
createSarmal,
|
|
129
|
+
createSarmalSVG,
|
|
130
|
+
palettes,
|
|
131
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,31 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import {
|
|
2
|
+
B as BaseRendererOptions,
|
|
3
|
+
E as Engine,
|
|
4
|
+
S as SarmalInstance,
|
|
5
|
+
C as CurveDef,
|
|
6
|
+
R as RendererOptions,
|
|
7
|
+
a as SarmalOptions,
|
|
8
|
+
} from "./types-frtEoAq6.js";
|
|
9
|
+
export {
|
|
10
|
+
J as JumpOptions,
|
|
11
|
+
P as Point,
|
|
12
|
+
b as RuntimeRenderOptions,
|
|
13
|
+
c as SeekOptions,
|
|
14
|
+
T as TrailColor,
|
|
15
|
+
d as TrailStyle,
|
|
16
|
+
} from "./types-frtEoAq6.js";
|
|
17
|
+
export { CurveName, curves } from "./curves/index.js";
|
|
18
|
+
export { artemis2 } from "./curves/artemis2.js";
|
|
19
|
+
export { astroid } from "./curves/astroid.js";
|
|
20
|
+
export { deltoid } from "./curves/deltoid.js";
|
|
21
|
+
export { epicycloid3 } from "./curves/epicycloid3.js";
|
|
22
|
+
export { epitrochoid7 } from "./curves/epitrochoid7.js";
|
|
23
|
+
export { lame } from "./curves/lame.js";
|
|
24
|
+
export { lissajous32 } from "./curves/lissajous32.js";
|
|
25
|
+
export { lissajous43 } from "./curves/lissajous43.js";
|
|
26
|
+
export { rose3 } from "./curves/rose3.js";
|
|
27
|
+
export { rose5 } from "./curves/rose5.js";
|
|
28
|
+
import "./curves/rose52.js";
|
|
29
|
+
import "./curves/star.js";
|
|
30
|
+
import "./curves/star4.js";
|
|
31
|
+
import "./curves/star7.js";
|
|
18
32
|
|
|
19
33
|
interface SVGRendererOptions extends BaseRendererOptions {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
/** SVG element the renderer draws into directly */
|
|
35
|
+
container: SVGSVGElement;
|
|
36
|
+
engine: Engine;
|
|
37
|
+
/** @default 'Loading' */
|
|
38
|
+
ariaLabel?: string;
|
|
25
39
|
}
|
|
26
40
|
interface SVGSarmalOptions extends Omit<SVGRendererOptions, "container" | "engine"> {
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
/** @default 120 */
|
|
42
|
+
trailLength?: number;
|
|
29
43
|
}
|
|
30
44
|
/**
|
|
31
45
|
* Creates a live SVG renderer for sarmal animations
|
|
@@ -33,33 +47,40 @@ interface SVGSarmalOptions extends Omit<SVGRendererOptions, "container" | "engin
|
|
|
33
47
|
*/
|
|
34
48
|
declare function createSVGRenderer(options: SVGRendererOptions): SarmalInstance;
|
|
35
49
|
/**
|
|
36
|
-
* Creates a sarmal animation inside
|
|
37
|
-
* The
|
|
50
|
+
* Creates a sarmal animation directly inside an `<svg>` element using an SVG renderer.
|
|
51
|
+
* The passed `<svg>` element is set to `viewBox="0 0 100 100"` and animated via requestAnimationFrame
|
|
38
52
|
*
|
|
39
53
|
* @example
|
|
40
54
|
* ```ts
|
|
41
55
|
* import { createSarmalSVG, epitrochoid7 } from '@sarmal/core'
|
|
42
|
-
*
|
|
56
|
+
*
|
|
57
|
+
* // <svg id="spinner"></svg> in your HTML
|
|
58
|
+
* const svg = document.getElementById('spinner')
|
|
59
|
+
* const sarmal = createSarmalSVG(svg, epitrochoid7)
|
|
43
60
|
*
|
|
44
61
|
* // To control manually, use autoStart: false
|
|
45
|
-
* const controlled = createSarmalSVG(
|
|
62
|
+
* const controlled = createSarmalSVG(svg, rose5, { autoStart: false })
|
|
46
63
|
* controlled.play() // Start when ready
|
|
47
64
|
* controlled.pause() // Pause later
|
|
48
65
|
* ```
|
|
49
66
|
*/
|
|
50
|
-
declare function createSarmalSVG(
|
|
67
|
+
declare function createSarmalSVG(
|
|
68
|
+
container: SVGSVGElement,
|
|
69
|
+
curveDef: CurveDef,
|
|
70
|
+
options?: SVGSarmalOptions,
|
|
71
|
+
): SarmalInstance;
|
|
51
72
|
|
|
52
73
|
/**
|
|
53
74
|
* Can be passed directly to `trailColor`,
|
|
54
75
|
* or can be mixed/sliced before passing as a prop.
|
|
55
76
|
*/
|
|
56
77
|
declare const palettes: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
78
|
+
readonly bard: ["#a855f7", "#3b82f6", "#14b8a6", "#ec4899"];
|
|
79
|
+
readonly sunset: ["#f97316", "#dc2626", "#9333ea", "#f472b6"];
|
|
80
|
+
readonly ocean: ["#1e3a8a", "#06b6d4", "#22d3ee", "#e0f2fe"];
|
|
81
|
+
readonly ice: ["#1e3a8a", "#67e8f9"];
|
|
82
|
+
readonly fire: ["#7f1d1d", "#fbbf24"];
|
|
83
|
+
readonly forest: ["#14532d", "#86efac"];
|
|
63
84
|
};
|
|
64
85
|
type SarmalPalette = keyof typeof palettes;
|
|
65
86
|
|
|
@@ -85,6 +106,26 @@ declare function createRenderer(options: RendererOptions): SarmalInstance;
|
|
|
85
106
|
* controlled.pause() // Pause later
|
|
86
107
|
* ```
|
|
87
108
|
*/
|
|
88
|
-
declare function createSarmal(
|
|
109
|
+
declare function createSarmal(
|
|
110
|
+
canvas: HTMLCanvasElement,
|
|
111
|
+
curveDef: CurveDef,
|
|
112
|
+
options?: SarmalOptions,
|
|
113
|
+
): SarmalInstance;
|
|
89
114
|
|
|
90
|
-
export {
|
|
115
|
+
export {
|
|
116
|
+
BaseRendererOptions,
|
|
117
|
+
CurveDef,
|
|
118
|
+
Engine,
|
|
119
|
+
RendererOptions,
|
|
120
|
+
type SVGRendererOptions,
|
|
121
|
+
type SVGSarmalOptions,
|
|
122
|
+
SarmalInstance,
|
|
123
|
+
SarmalOptions,
|
|
124
|
+
type SarmalPalette,
|
|
125
|
+
createEngine,
|
|
126
|
+
createRenderer,
|
|
127
|
+
createSVGRenderer,
|
|
128
|
+
createSarmal,
|
|
129
|
+
createSarmalSVG,
|
|
130
|
+
palettes,
|
|
131
|
+
};
|