@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.
Files changed (76) hide show
  1. package/README.md +1 -12
  2. package/dist/auto-init.cjs +124 -92
  3. package/dist/auto-init.cjs.map +1 -1
  4. package/dist/auto-init.js +123 -91
  5. package/dist/auto-init.js.map +1 -1
  6. package/dist/curves/artemis2.cjs +10 -7
  7. package/dist/curves/artemis2.d.cts +1 -1
  8. package/dist/curves/artemis2.d.ts +1 -1
  9. package/dist/curves/artemis2.js +9 -6
  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 +53 -40
  27. package/dist/curves/index.d.cts +29 -29
  28. package/dist/curves/index.d.ts +29 -29
  29. package/dist/curves/index.js +69 -40
  30. package/dist/curves/lame.cjs +6 -5
  31. package/dist/curves/lame.d.cts +1 -1
  32. package/dist/curves/lame.d.ts +1 -1
  33. package/dist/curves/lame.js +5 -4
  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 +8 -5
  55. package/dist/curves/star.d.cts +1 -1
  56. package/dist/curves/star.d.ts +1 -1
  57. package/dist/curves/star.js +7 -4
  58. package/dist/curves/star4.cjs +8 -5
  59. package/dist/curves/star4.d.cts +1 -1
  60. package/dist/curves/star4.d.ts +1 -1
  61. package/dist/curves/star4.js +7 -4
  62. package/dist/curves/star7.cjs +8 -5
  63. package/dist/curves/star7.d.cts +1 -1
  64. package/dist/curves/star7.d.ts +1 -1
  65. package/dist/curves/star7.js +7 -4
  66. package/dist/index.cjs +159 -118
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.d.cts +78 -37
  69. package/dist/index.d.ts +78 -37
  70. package/dist/index.js +177 -118
  71. package/dist/index.js.map +1 -1
  72. package/dist/types-frtEoAq6.d.cts +317 -0
  73. package/dist/types-frtEoAq6.d.ts +317 -0
  74. package/package.json +1 -1
  75. package/dist/types-BL9HhEmk.d.cts +0 -299
  76. package/dist/types-BL9HhEmk.d.ts +0 -299
package/dist/index.d.cts CHANGED
@@ -1,31 +1,45 @@
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';
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
- /** Container element that will contain the SVG */
21
- container: Element;
22
- engine: Engine;
23
- /** @default 'Loading' */
24
- ariaLabel?: string;
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
- /** @default 120 */
28
- trailLength?: number;
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 a container element using an SVG renderer
37
- * The SVG is appended to the container and animated via requestAnimationFrame
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
- * const sarmal = createSarmalSVG(document.getElementById('spinner'), epitrochoid7)
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(container, rose5, { autoStart: false })
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(container: Element, curveDef: CurveDef, options?: SVGSarmalOptions): SarmalInstance;
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
- 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"];
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(canvas: HTMLCanvasElement, curveDef: CurveDef, options?: SarmalOptions): SarmalInstance;
109
+ declare function createSarmal(
110
+ canvas: HTMLCanvasElement,
111
+ curveDef: CurveDef,
112
+ options?: SarmalOptions,
113
+ ): SarmalInstance;
89
114
 
90
- export { BaseRendererOptions, CurveDef, Engine, RendererOptions, type SVGRendererOptions, type SVGSarmalOptions, SarmalInstance, SarmalOptions, type SarmalPalette, createEngine, createRenderer, createSVGRenderer, createSarmal, createSarmalSVG, palettes };
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 { 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';
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
- /** Container element that will contain the SVG */
21
- container: Element;
22
- engine: Engine;
23
- /** @default 'Loading' */
24
- ariaLabel?: string;
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
- /** @default 120 */
28
- trailLength?: number;
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 a container element using an SVG renderer
37
- * The SVG is appended to the container and animated via requestAnimationFrame
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
- * const sarmal = createSarmalSVG(document.getElementById('spinner'), epitrochoid7)
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(container, rose5, { autoStart: false })
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(container: Element, curveDef: CurveDef, options?: SVGSarmalOptions): SarmalInstance;
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
- 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"];
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(canvas: HTMLCanvasElement, curveDef: CurveDef, options?: SarmalOptions): SarmalInstance;
109
+ declare function createSarmal(
110
+ canvas: HTMLCanvasElement,
111
+ curveDef: CurveDef,
112
+ options?: SarmalOptions,
113
+ ): SarmalInstance;
89
114
 
90
- export { BaseRendererOptions, CurveDef, Engine, RendererOptions, type SVGRendererOptions, type SVGSarmalOptions, SarmalInstance, SarmalOptions, type SarmalPalette, createEngine, createRenderer, createSVGRenderer, createSarmal, createSarmalSVG, palettes };
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
+ };