@sarmal/core 0.25.0 → 0.25.1

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 (79) hide show
  1. package/dist/auto-init.cjs +140 -105
  2. package/dist/auto-init.cjs.map +1 -1
  3. package/dist/auto-init.js +139 -104
  4. package/dist/auto-init.js.map +1 -1
  5. package/dist/curves/artemis2.cjs +15 -10
  6. package/dist/curves/artemis2.cjs.map +1 -1
  7. package/dist/curves/artemis2.d.cts +1 -1
  8. package/dist/curves/artemis2.d.ts +1 -1
  9. package/dist/curves/artemis2.js +14 -9
  10. package/dist/curves/artemis2.js.map +1 -1
  11. package/dist/curves/astroid.cjs +4 -4
  12. package/dist/curves/astroid.d.cts +1 -1
  13. package/dist/curves/astroid.d.ts +1 -1
  14. package/dist/curves/astroid.js +3 -3
  15. package/dist/curves/deltoid.cjs +4 -4
  16. package/dist/curves/deltoid.d.cts +1 -1
  17. package/dist/curves/deltoid.d.ts +1 -1
  18. package/dist/curves/deltoid.js +3 -3
  19. package/dist/curves/epicycloid3.cjs +4 -4
  20. package/dist/curves/epicycloid3.d.cts +1 -1
  21. package/dist/curves/epicycloid3.d.ts +1 -1
  22. package/dist/curves/epicycloid3.js +3 -3
  23. package/dist/curves/epitrochoid7.cjs +5 -5
  24. package/dist/curves/epitrochoid7.d.cts +1 -1
  25. package/dist/curves/epitrochoid7.d.ts +1 -1
  26. package/dist/curves/epitrochoid7.js +4 -4
  27. package/dist/curves/index.cjs +58 -43
  28. package/dist/curves/index.cjs.map +1 -1
  29. package/dist/curves/index.d.cts +29 -29
  30. package/dist/curves/index.d.ts +29 -29
  31. package/dist/curves/index.js +74 -43
  32. package/dist/curves/index.js.map +1 -1
  33. package/dist/curves/lame.cjs +6 -5
  34. package/dist/curves/lame.d.cts +1 -1
  35. package/dist/curves/lame.d.ts +1 -1
  36. package/dist/curves/lame.js +5 -4
  37. package/dist/curves/lissajous32.cjs +4 -4
  38. package/dist/curves/lissajous32.d.cts +1 -1
  39. package/dist/curves/lissajous32.d.ts +1 -1
  40. package/dist/curves/lissajous32.js +3 -3
  41. package/dist/curves/lissajous43.cjs +4 -4
  42. package/dist/curves/lissajous43.d.cts +1 -1
  43. package/dist/curves/lissajous43.d.ts +1 -1
  44. package/dist/curves/lissajous43.js +3 -3
  45. package/dist/curves/rose3.cjs +4 -4
  46. package/dist/curves/rose3.d.cts +1 -1
  47. package/dist/curves/rose3.d.ts +1 -1
  48. package/dist/curves/rose3.js +3 -3
  49. package/dist/curves/rose5.cjs +4 -4
  50. package/dist/curves/rose5.d.cts +1 -1
  51. package/dist/curves/rose5.d.ts +1 -1
  52. package/dist/curves/rose5.js +3 -3
  53. package/dist/curves/rose52.cjs +5 -5
  54. package/dist/curves/rose52.d.cts +1 -1
  55. package/dist/curves/rose52.d.ts +1 -1
  56. package/dist/curves/rose52.js +4 -4
  57. package/dist/curves/star.cjs +8 -5
  58. package/dist/curves/star.d.cts +1 -1
  59. package/dist/curves/star.d.ts +1 -1
  60. package/dist/curves/star.js +7 -4
  61. package/dist/curves/star4.cjs +8 -5
  62. package/dist/curves/star4.d.cts +1 -1
  63. package/dist/curves/star4.d.ts +1 -1
  64. package/dist/curves/star4.js +7 -4
  65. package/dist/curves/star7.cjs +8 -5
  66. package/dist/curves/star7.d.cts +1 -1
  67. package/dist/curves/star7.d.ts +1 -1
  68. package/dist/curves/star7.js +7 -4
  69. package/dist/index.cjs +126 -93
  70. package/dist/index.cjs.map +1 -1
  71. package/dist/index.d.cts +92 -40
  72. package/dist/index.d.ts +92 -40
  73. package/dist/index.js +147 -93
  74. package/dist/index.js.map +1 -1
  75. package/dist/types-Z9i1_AQZ.d.cts +339 -0
  76. package/dist/types-Z9i1_AQZ.d.ts +339 -0
  77. package/package.json +1 -1
  78. package/dist/types-BZpzgNau.d.cts +0 -332
  79. package/dist/types-BZpzgNau.d.ts +0 -332
package/dist/index.d.cts CHANGED
@@ -1,31 +1,46 @@
1
- import { B as BaseRendererOptions, E as Engine, S as SarmalInstance, C as CurveDef, P as Point, R as RendererOptions, a as ControlPoint, b as SarmalOptions } from './types-BZpzgNau.cjs';
2
- export { J as JumpOptions, c as RuntimeRenderOptions, d as SeekOptions, T as TrailColor, e as TrailStyle } from './types-BZpzgNau.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
+ P as Point,
7
+ R as RendererOptions,
8
+ a as ControlPoint,
9
+ b as SarmalOptions,
10
+ } from "./types-Z9i1_AQZ.cjs";
11
+ export {
12
+ J as JumpOptions,
13
+ c as RuntimeRenderOptions,
14
+ d as SeekOptions,
15
+ T as TrailColor,
16
+ e as TrailStyle,
17
+ } from "./types-Z9i1_AQZ.cjs";
18
+ export { CurveName, curves } from "./curves/index.cjs";
19
+ export { artemis2 } from "./curves/artemis2.cjs";
20
+ export { astroid } from "./curves/astroid.cjs";
21
+ export { deltoid } from "./curves/deltoid.cjs";
22
+ export { epicycloid3 } from "./curves/epicycloid3.cjs";
23
+ export { epitrochoid7 } from "./curves/epitrochoid7.cjs";
24
+ export { lame } from "./curves/lame.cjs";
25
+ export { lissajous32 } from "./curves/lissajous32.cjs";
26
+ export { lissajous43 } from "./curves/lissajous43.cjs";
27
+ export { rose3 } from "./curves/rose3.cjs";
28
+ export { rose5 } from "./curves/rose5.cjs";
29
+ import "./curves/rose52.cjs";
30
+ import "./curves/star.cjs";
31
+ import "./curves/star4.cjs";
32
+ import "./curves/star7.cjs";
18
33
 
19
34
  interface SVGRendererOptions extends BaseRendererOptions {
20
- /** SVG element the renderer draws into directly */
21
- container: SVGSVGElement;
22
- engine: Engine;
23
- /** @default 'Loading' */
24
- ariaLabel?: string;
35
+ /** SVG element the renderer draws into directly */
36
+ container: SVGSVGElement;
37
+ engine: Engine;
38
+ /** @default 'Loading' */
39
+ ariaLabel?: string;
25
40
  }
26
41
  interface SVGSarmalOptions extends Omit<SVGRendererOptions, "container" | "engine"> {
27
- /** @default 120 */
28
- trailLength?: number;
42
+ /** @default 120 */
43
+ trailLength?: number;
29
44
  }
30
45
  /**
31
46
  * Creates a live SVG renderer for sarmal animations
@@ -50,12 +65,16 @@ declare function createSVGRenderer(options: SVGRendererOptions): SarmalInstance;
50
65
  * controlled.pause() // Pause later
51
66
  * ```
52
67
  */
53
- declare function createSarmalSVG(container: SVGSVGElement, curveDef: CurveDef, options?: SVGSarmalOptions): SarmalInstance;
68
+ declare function createSarmalSVG(
69
+ container: SVGSVGElement,
70
+ curveDef: CurveDef,
71
+ options?: SVGSarmalOptions,
72
+ ): SarmalInstance;
54
73
 
55
74
  interface BoundaryResult {
56
- scale: number;
57
- offsetX: number;
58
- offsetY: number;
75
+ scale: number;
76
+ offsetX: number;
77
+ offsetY: number;
59
78
  }
60
79
  /**
61
80
  * Computes how to map engine coordinates into a viewport of the given logical size.
@@ -66,18 +85,23 @@ interface BoundaryResult {
66
85
  * `minPaddingPx` defaults to `FIT_PADDING_MIN` (4px) for pixel-space callers.
67
86
  * Pass `0` when the logical space is itself a normalized viewBox (e.g. SVG export).
68
87
  */
69
- declare function computeBoundaries(pts: Point[], logicalWidth: number, logicalHeight: number, minPaddingPx?: number): BoundaryResult | null;
88
+ declare function computeBoundaries(
89
+ pts: Point[],
90
+ logicalWidth: number,
91
+ logicalHeight: number,
92
+ minPaddingPx?: number,
93
+ ): BoundaryResult | null;
70
94
  /**
71
95
  * Can be passed directly to `trailColor`,
72
96
  * or can be mixed/sliced before passing as a prop.
73
97
  */
74
98
  declare const palettes: {
75
- readonly bard: ["#a855f7", "#3b82f6", "#14b8a6", "#ec4899"];
76
- readonly sunset: ["#f97316", "#dc2626", "#9333ea", "#f472b6"];
77
- readonly ocean: ["#1e3a8a", "#06b6d4", "#22d3ee", "#e0f2fe"];
78
- readonly ice: ["#1e3a8a", "#67e8f9"];
79
- readonly fire: ["#7f1d1d", "#fbbf24"];
80
- readonly forest: ["#14532d", "#86efac"];
99
+ readonly bard: ["#a855f7", "#3b82f6", "#14b8a6", "#ec4899"];
100
+ readonly sunset: ["#f97316", "#dc2626", "#9333ea", "#f472b6"];
101
+ readonly ocean: ["#1e3a8a", "#06b6d4", "#22d3ee", "#e0f2fe"];
102
+ readonly ice: ["#1e3a8a", "#67e8f9"];
103
+ readonly fire: ["#7f1d1d", "#fbbf24"];
104
+ readonly forest: ["#14532d", "#86efac"];
81
105
  };
82
106
  type SarmalPalette = keyof typeof palettes;
83
107
 
@@ -111,7 +135,7 @@ declare function evaluateCatmullRom(points: Array<ControlPoint>, t: number): Poi
111
135
  * ! Must contain at least 3 points.
112
136
  * @param opts Optional overrides for the returned `CurveDef`.
113
137
  * @param opts.name Display name for the curve. Defaults to `"drawn"`.
114
- * @returns A `CurveDef` with `period: 2π`, `kind: "drawn"`, and the spline evaluator as its `fn`.
138
+ * @returns A `CurveDef` with `period: 2π` and the spline evaluator as its `fn`.
115
139
  * @throws If `points` has fewer than 3 entries.
116
140
  *
117
141
  * @example
@@ -127,9 +151,12 @@ declare function evaluateCatmullRom(points: Array<ControlPoint>, t: number): Poi
127
151
  * createSarmal(canvas, curve)
128
152
  * ```
129
153
  */
130
- declare function drawCurve(points: Array<ControlPoint>, opts?: {
154
+ declare function drawCurve(
155
+ points: Array<ControlPoint>,
156
+ opts?: {
131
157
  name?: string;
132
- }): CurveDef;
158
+ },
159
+ ): CurveDef;
133
160
 
134
161
  /**
135
162
  * Creates a sarmal animation on a canvas element
@@ -145,6 +172,31 @@ declare function drawCurve(points: Array<ControlPoint>, opts?: {
145
172
  * controlled.pause() // Pause later
146
173
  * ```
147
174
  */
148
- declare function createSarmal(canvas: HTMLCanvasElement, curveDef: CurveDef, options?: SarmalOptions): SarmalInstance;
175
+ declare function createSarmal(
176
+ canvas: HTMLCanvasElement,
177
+ curveDef: CurveDef,
178
+ options?: SarmalOptions,
179
+ ): SarmalInstance;
149
180
 
150
- export { BaseRendererOptions, type BoundaryResult, CurveDef, Engine, Point, RendererOptions, type SVGRendererOptions, type SVGSarmalOptions, SarmalInstance, SarmalOptions, type SarmalPalette, computeBoundaries, createEngine, createRenderer, createSVGRenderer, createSarmal, createSarmalSVG, drawCurve, evaluateCatmullRom, palettes };
181
+ export {
182
+ BaseRendererOptions,
183
+ type BoundaryResult,
184
+ CurveDef,
185
+ Engine,
186
+ Point,
187
+ RendererOptions,
188
+ type SVGRendererOptions,
189
+ type SVGSarmalOptions,
190
+ SarmalInstance,
191
+ SarmalOptions,
192
+ type SarmalPalette,
193
+ computeBoundaries,
194
+ createEngine,
195
+ createRenderer,
196
+ createSVGRenderer,
197
+ createSarmal,
198
+ createSarmalSVG,
199
+ drawCurve,
200
+ evaluateCatmullRom,
201
+ palettes,
202
+ };
package/dist/index.d.ts CHANGED
@@ -1,31 +1,46 @@
1
- import { B as BaseRendererOptions, E as Engine, S as SarmalInstance, C as CurveDef, P as Point, R as RendererOptions, a as ControlPoint, b as SarmalOptions } from './types-BZpzgNau.js';
2
- export { J as JumpOptions, c as RuntimeRenderOptions, d as SeekOptions, T as TrailColor, e as TrailStyle } from './types-BZpzgNau.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
+ P as Point,
7
+ R as RendererOptions,
8
+ a as ControlPoint,
9
+ b as SarmalOptions,
10
+ } from "./types-Z9i1_AQZ.js";
11
+ export {
12
+ J as JumpOptions,
13
+ c as RuntimeRenderOptions,
14
+ d as SeekOptions,
15
+ T as TrailColor,
16
+ e as TrailStyle,
17
+ } from "./types-Z9i1_AQZ.js";
18
+ export { CurveName, curves } from "./curves/index.js";
19
+ export { artemis2 } from "./curves/artemis2.js";
20
+ export { astroid } from "./curves/astroid.js";
21
+ export { deltoid } from "./curves/deltoid.js";
22
+ export { epicycloid3 } from "./curves/epicycloid3.js";
23
+ export { epitrochoid7 } from "./curves/epitrochoid7.js";
24
+ export { lame } from "./curves/lame.js";
25
+ export { lissajous32 } from "./curves/lissajous32.js";
26
+ export { lissajous43 } from "./curves/lissajous43.js";
27
+ export { rose3 } from "./curves/rose3.js";
28
+ export { rose5 } from "./curves/rose5.js";
29
+ import "./curves/rose52.js";
30
+ import "./curves/star.js";
31
+ import "./curves/star4.js";
32
+ import "./curves/star7.js";
18
33
 
19
34
  interface SVGRendererOptions extends BaseRendererOptions {
20
- /** SVG element the renderer draws into directly */
21
- container: SVGSVGElement;
22
- engine: Engine;
23
- /** @default 'Loading' */
24
- ariaLabel?: string;
35
+ /** SVG element the renderer draws into directly */
36
+ container: SVGSVGElement;
37
+ engine: Engine;
38
+ /** @default 'Loading' */
39
+ ariaLabel?: string;
25
40
  }
26
41
  interface SVGSarmalOptions extends Omit<SVGRendererOptions, "container" | "engine"> {
27
- /** @default 120 */
28
- trailLength?: number;
42
+ /** @default 120 */
43
+ trailLength?: number;
29
44
  }
30
45
  /**
31
46
  * Creates a live SVG renderer for sarmal animations
@@ -50,12 +65,16 @@ declare function createSVGRenderer(options: SVGRendererOptions): SarmalInstance;
50
65
  * controlled.pause() // Pause later
51
66
  * ```
52
67
  */
53
- declare function createSarmalSVG(container: SVGSVGElement, curveDef: CurveDef, options?: SVGSarmalOptions): SarmalInstance;
68
+ declare function createSarmalSVG(
69
+ container: SVGSVGElement,
70
+ curveDef: CurveDef,
71
+ options?: SVGSarmalOptions,
72
+ ): SarmalInstance;
54
73
 
55
74
  interface BoundaryResult {
56
- scale: number;
57
- offsetX: number;
58
- offsetY: number;
75
+ scale: number;
76
+ offsetX: number;
77
+ offsetY: number;
59
78
  }
60
79
  /**
61
80
  * Computes how to map engine coordinates into a viewport of the given logical size.
@@ -66,18 +85,23 @@ interface BoundaryResult {
66
85
  * `minPaddingPx` defaults to `FIT_PADDING_MIN` (4px) for pixel-space callers.
67
86
  * Pass `0` when the logical space is itself a normalized viewBox (e.g. SVG export).
68
87
  */
69
- declare function computeBoundaries(pts: Point[], logicalWidth: number, logicalHeight: number, minPaddingPx?: number): BoundaryResult | null;
88
+ declare function computeBoundaries(
89
+ pts: Point[],
90
+ logicalWidth: number,
91
+ logicalHeight: number,
92
+ minPaddingPx?: number,
93
+ ): BoundaryResult | null;
70
94
  /**
71
95
  * Can be passed directly to `trailColor`,
72
96
  * or can be mixed/sliced before passing as a prop.
73
97
  */
74
98
  declare const palettes: {
75
- readonly bard: ["#a855f7", "#3b82f6", "#14b8a6", "#ec4899"];
76
- readonly sunset: ["#f97316", "#dc2626", "#9333ea", "#f472b6"];
77
- readonly ocean: ["#1e3a8a", "#06b6d4", "#22d3ee", "#e0f2fe"];
78
- readonly ice: ["#1e3a8a", "#67e8f9"];
79
- readonly fire: ["#7f1d1d", "#fbbf24"];
80
- readonly forest: ["#14532d", "#86efac"];
99
+ readonly bard: ["#a855f7", "#3b82f6", "#14b8a6", "#ec4899"];
100
+ readonly sunset: ["#f97316", "#dc2626", "#9333ea", "#f472b6"];
101
+ readonly ocean: ["#1e3a8a", "#06b6d4", "#22d3ee", "#e0f2fe"];
102
+ readonly ice: ["#1e3a8a", "#67e8f9"];
103
+ readonly fire: ["#7f1d1d", "#fbbf24"];
104
+ readonly forest: ["#14532d", "#86efac"];
81
105
  };
82
106
  type SarmalPalette = keyof typeof palettes;
83
107
 
@@ -111,7 +135,7 @@ declare function evaluateCatmullRom(points: Array<ControlPoint>, t: number): Poi
111
135
  * ! Must contain at least 3 points.
112
136
  * @param opts Optional overrides for the returned `CurveDef`.
113
137
  * @param opts.name Display name for the curve. Defaults to `"drawn"`.
114
- * @returns A `CurveDef` with `period: 2π`, `kind: "drawn"`, and the spline evaluator as its `fn`.
138
+ * @returns A `CurveDef` with `period: 2π` and the spline evaluator as its `fn`.
115
139
  * @throws If `points` has fewer than 3 entries.
116
140
  *
117
141
  * @example
@@ -127,9 +151,12 @@ declare function evaluateCatmullRom(points: Array<ControlPoint>, t: number): Poi
127
151
  * createSarmal(canvas, curve)
128
152
  * ```
129
153
  */
130
- declare function drawCurve(points: Array<ControlPoint>, opts?: {
154
+ declare function drawCurve(
155
+ points: Array<ControlPoint>,
156
+ opts?: {
131
157
  name?: string;
132
- }): CurveDef;
158
+ },
159
+ ): CurveDef;
133
160
 
134
161
  /**
135
162
  * Creates a sarmal animation on a canvas element
@@ -145,6 +172,31 @@ declare function drawCurve(points: Array<ControlPoint>, opts?: {
145
172
  * controlled.pause() // Pause later
146
173
  * ```
147
174
  */
148
- declare function createSarmal(canvas: HTMLCanvasElement, curveDef: CurveDef, options?: SarmalOptions): SarmalInstance;
175
+ declare function createSarmal(
176
+ canvas: HTMLCanvasElement,
177
+ curveDef: CurveDef,
178
+ options?: SarmalOptions,
179
+ ): SarmalInstance;
149
180
 
150
- export { BaseRendererOptions, type BoundaryResult, CurveDef, Engine, Point, RendererOptions, type SVGRendererOptions, type SVGSarmalOptions, SarmalInstance, SarmalOptions, type SarmalPalette, computeBoundaries, createEngine, createRenderer, createSVGRenderer, createSarmal, createSarmalSVG, drawCurve, evaluateCatmullRom, palettes };
181
+ export {
182
+ BaseRendererOptions,
183
+ type BoundaryResult,
184
+ CurveDef,
185
+ Engine,
186
+ Point,
187
+ RendererOptions,
188
+ type SVGRendererOptions,
189
+ type SVGSarmalOptions,
190
+ SarmalInstance,
191
+ SarmalOptions,
192
+ type SarmalPalette,
193
+ computeBoundaries,
194
+ createEngine,
195
+ createRenderer,
196
+ createSVGRenderer,
197
+ createSarmal,
198
+ createSarmalSVG,
199
+ drawCurve,
200
+ evaluateCatmullRom,
201
+ palettes,
202
+ };