@sarmal/core 0.20.0 → 0.22.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 (45) hide show
  1. package/dist/auto-init.cjs +26 -2
  2. package/dist/auto-init.cjs.map +1 -1
  3. package/dist/auto-init.d.cts +1 -1
  4. package/dist/auto-init.d.ts +1 -1
  5. package/dist/auto-init.js +26 -2
  6. package/dist/auto-init.js.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/astroid.d.cts +1 -1
  10. package/dist/curves/astroid.d.ts +1 -1
  11. package/dist/curves/deltoid.d.cts +1 -1
  12. package/dist/curves/deltoid.d.ts +1 -1
  13. package/dist/curves/epicycloid3.d.cts +1 -1
  14. package/dist/curves/epicycloid3.d.ts +1 -1
  15. package/dist/curves/epitrochoid7.d.cts +1 -1
  16. package/dist/curves/epitrochoid7.d.ts +1 -1
  17. package/dist/curves/index.d.cts +1 -1
  18. package/dist/curves/index.d.ts +1 -1
  19. package/dist/curves/lame.d.cts +1 -1
  20. package/dist/curves/lame.d.ts +1 -1
  21. package/dist/curves/lissajous32.d.cts +1 -1
  22. package/dist/curves/lissajous32.d.ts +1 -1
  23. package/dist/curves/lissajous43.d.cts +1 -1
  24. package/dist/curves/lissajous43.d.ts +1 -1
  25. package/dist/curves/rose3.d.cts +1 -1
  26. package/dist/curves/rose3.d.ts +1 -1
  27. package/dist/curves/rose5.d.cts +1 -1
  28. package/dist/curves/rose5.d.ts +1 -1
  29. package/dist/curves/rose52.d.cts +1 -1
  30. package/dist/curves/rose52.d.ts +1 -1
  31. package/dist/curves/star.d.cts +1 -1
  32. package/dist/curves/star.d.ts +1 -1
  33. package/dist/curves/star4.d.cts +1 -1
  34. package/dist/curves/star4.d.ts +1 -1
  35. package/dist/curves/star7.d.cts +1 -1
  36. package/dist/curves/star7.d.ts +1 -1
  37. package/dist/index.cjs +26 -2
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.cts +2 -2
  40. package/dist/index.d.ts +2 -2
  41. package/dist/index.js +26 -2
  42. package/dist/index.js.map +1 -1
  43. package/dist/{types-frtEoAq6.d.cts → types-DVerJ9cl.d.cts} +4 -0
  44. package/dist/{types-frtEoAq6.d.ts → types-DVerJ9cl.d.ts} +4 -0
  45. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * Artemis II free-return lunar trajectory curve
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * Artemis II free-return lunar trajectory curve
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * Astroid curve - a 4-cusped hypocycloid
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * Astroid curve - a 4-cusped hypocycloid
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * Deltoid curve - a 3-cusped hypocycloid
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * Deltoid curve - a 3-cusped hypocycloid
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * Epicycloid with 3 cusps
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * Epicycloid with 3 cusps
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * Epitrochoid with 7 lobes and dynamic variation
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * Epitrochoid with 7 lobes and dynamic variation
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
  export { artemis2 } from "./artemis2.cjs";
3
3
  export { astroid } from "./astroid.cjs";
4
4
  export { deltoid } from "./deltoid.cjs";
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
  export { artemis2 } from "./artemis2.js";
3
3
  export { astroid } from "./astroid.js";
4
4
  export { deltoid } from "./deltoid.js";
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * Lamé curve (superellipse) with time-varying exponent
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * Lamé curve (superellipse) with time-varying exponent
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * Lissajous curve with frequency ratio 3:2
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * Lissajous curve with frequency ratio 3:2
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * Lissajous curve with frequency ratio 4:3
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * Lissajous curve with frequency ratio 4:3
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * Rose curve with 3 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * Rose curve with 3 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * Rose curve with 5 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * Rose curve with 5 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * Rose curve with n=5/2 that traces 5 petals over two full revolutions
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * Rose curve with n=5/2 that traces 5 petals over two full revolutions
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * 5-pointed star based on Fourier harmonics.
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * 5-pointed star based on Fourier harmonics.
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * 4-pointed star based on Fourier harmonics.
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * 4-pointed star based on Fourier harmonics.
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.cjs";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.cjs";
2
2
 
3
3
  /**
4
4
  * 7-pointed star based on Fourier harmonics.
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-frtEoAq6.js";
1
+ import { C as CurveDef } from "../types-DVerJ9cl.js";
2
2
 
3
3
  /**
4
4
  * 7-pointed star based on Fourier harmonics.
package/dist/index.cjs CHANGED
@@ -428,6 +428,7 @@ var RENDER_OPTION_KEYS = /* @__PURE__ */ new Set([
428
428
  "headColor",
429
429
  "skeletonColor",
430
430
  "trailStyle",
431
+ "headRadius",
431
432
  ]);
432
433
  function validateRenderOptions(partial) {
433
434
  for (const key of Object.keys(partial)) {
@@ -447,6 +448,9 @@ function validateRenderOptions(partial) {
447
448
  if (partial.trailStyle !== void 0) {
448
449
  assertTrailStyle(partial.trailStyle);
449
450
  }
451
+ if (partial.headRadius !== void 0) {
452
+ assertHeadRadius(partial.headRadius);
453
+ }
450
454
  }
451
455
  function assertTrailColor(value) {
452
456
  if (typeof value === "string") {
@@ -504,6 +508,18 @@ function assertTrailStyle(value) {
504
508
  );
505
509
  }
506
510
  }
511
+ function assertHeadRadius(value) {
512
+ if (typeof value !== "number") {
513
+ throw new TypeError(
514
+ `[sarmal] setRenderOptions: headRadius must be a number, got ${JSON.stringify(value)}`,
515
+ );
516
+ }
517
+ if (!Number.isFinite(value) || value <= 0) {
518
+ throw new TypeError(
519
+ `[sarmal] setRenderOptions: headRadius must be a finite positive number, got ${value}`,
520
+ );
521
+ }
522
+ }
507
523
  function resolveTrailMainColor(trailColor) {
508
524
  return typeof trailColor === "string" ? trailColor : trailColor[0];
509
525
  }
@@ -571,6 +587,7 @@ function createRenderer(options) {
571
587
  setupCanvas();
572
588
  let logicalWidth = canvas.width / dpr;
573
589
  let logicalHeight = canvas.height / dpr;
590
+ let headRadius = options.headRadius ?? getHeadDotRadius(logicalWidth, logicalHeight);
574
591
  let skeleton = [];
575
592
  let skeletonCanvas = null;
576
593
  let trail = [];
@@ -687,7 +704,7 @@ function createRenderer(options) {
687
704
  }
688
705
  const x = head.x * scale + offsetX;
689
706
  const y = head.y * scale + offsetY;
690
- const r = options.headRadius ?? getHeadDotRadius(logicalWidth, logicalHeight);
707
+ const r = headRadius;
691
708
  ctx.fillStyle = headColor;
692
709
  ctx.beginPath();
693
710
  ctx.arc(x, y, r, 0, Math.PI * 2);
@@ -816,6 +833,9 @@ function createRenderer(options) {
816
833
  if (partial.headColor !== void 0) {
817
834
  userHeadColor = partial.headColor;
818
835
  }
836
+ if (partial.headRadius !== void 0) {
837
+ headRadius = partial.headRadius;
838
+ }
819
839
  if (userHeadColor === null) {
820
840
  headColor = resolveHeadColor(trailColor, trailStyle);
821
841
  } else {
@@ -873,12 +893,12 @@ function createSVGRenderer(options) {
873
893
  let skeletonColor = options.skeletonColor ?? "#ffffff";
874
894
  let userHeadColor = options.headColor ?? null;
875
895
  let headColor = userHeadColor ?? resolveHeadColor(trailColor, trailStyle);
896
+ let headRadius = options.headRadius ?? 1.5;
876
897
  let trailSolid = resolveTrailMainColor(trailColor);
877
898
  let trailPalette = resolveTrailPalette(trailColor);
878
899
  const ariaLabel = options.ariaLabel ?? "Loading";
879
900
  warnIfTrailColorMismatch(trailColor, trailStyle);
880
901
  const viewSize = 100;
881
- const headRadius = options.headRadius ?? 1.5;
882
902
  const svgTrailMinWidth = 0.25;
883
903
  const svgTrailMaxWidth = 1.25;
884
904
  const svgSkeletonStrokeWidth = "0.75";
@@ -1154,6 +1174,10 @@ function createSVGRenderer(options) {
1154
1174
  if (partial.headColor !== void 0) {
1155
1175
  userHeadColor = partial.headColor;
1156
1176
  }
1177
+ if (partial.headRadius !== void 0) {
1178
+ headRadius = partial.headRadius;
1179
+ headCircle.setAttribute("r", String(headRadius));
1180
+ }
1157
1181
  if (userHeadColor === null) {
1158
1182
  headColor = resolveHeadColor(trailColor, trailStyle);
1159
1183
  } else {