@sarmal/core 0.17.0 → 0.17.3

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