@sarmal/core 0.22.0 → 0.23.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 (43) hide show
  1. package/dist/auto-init.cjs +13 -5
  2. package/dist/auto-init.cjs.map +1 -1
  3. package/dist/auto-init.js +13 -5
  4. package/dist/auto-init.js.map +1 -1
  5. package/dist/curves/artemis2.d.cts +1 -1
  6. package/dist/curves/artemis2.d.ts +1 -1
  7. package/dist/curves/astroid.d.cts +1 -1
  8. package/dist/curves/astroid.d.ts +1 -1
  9. package/dist/curves/deltoid.d.cts +1 -1
  10. package/dist/curves/deltoid.d.ts +1 -1
  11. package/dist/curves/epicycloid3.d.cts +1 -1
  12. package/dist/curves/epicycloid3.d.ts +1 -1
  13. package/dist/curves/epitrochoid7.d.cts +1 -1
  14. package/dist/curves/epitrochoid7.d.ts +1 -1
  15. package/dist/curves/index.d.cts +1 -1
  16. package/dist/curves/index.d.ts +1 -1
  17. package/dist/curves/lame.d.cts +1 -1
  18. package/dist/curves/lame.d.ts +1 -1
  19. package/dist/curves/lissajous32.d.cts +1 -1
  20. package/dist/curves/lissajous32.d.ts +1 -1
  21. package/dist/curves/lissajous43.d.cts +1 -1
  22. package/dist/curves/lissajous43.d.ts +1 -1
  23. package/dist/curves/rose3.d.cts +1 -1
  24. package/dist/curves/rose3.d.ts +1 -1
  25. package/dist/curves/rose5.d.cts +1 -1
  26. package/dist/curves/rose5.d.ts +1 -1
  27. package/dist/curves/rose52.d.cts +1 -1
  28. package/dist/curves/rose52.d.ts +1 -1
  29. package/dist/curves/star.d.cts +1 -1
  30. package/dist/curves/star.d.ts +1 -1
  31. package/dist/curves/star4.d.cts +1 -1
  32. package/dist/curves/star4.d.ts +1 -1
  33. package/dist/curves/star7.d.cts +1 -1
  34. package/dist/curves/star7.d.ts +1 -1
  35. package/dist/index.cjs +13 -5
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +2 -2
  38. package/dist/index.d.ts +2 -2
  39. package/dist/index.js +13 -5
  40. package/dist/index.js.map +1 -1
  41. package/dist/{types-DVerJ9cl.d.cts → types-C0b4MPtI.d.cts} +2 -2
  42. package/dist/{types-DVerJ9cl.d.ts → types-C0b4MPtI.d.ts} +2 -2
  43. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.cjs";
2
2
 
3
3
  /**
4
4
  * Astroid curve - a 4-cusped hypocycloid
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.js";
2
2
 
3
3
  /**
4
4
  * Astroid curve - a 4-cusped hypocycloid
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.cjs";
2
2
 
3
3
  /**
4
4
  * Deltoid curve - a 3-cusped hypocycloid
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.js";
2
2
 
3
3
  /**
4
4
  * Deltoid curve - a 3-cusped hypocycloid
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.cjs";
2
2
 
3
3
  /**
4
4
  * Epicycloid with 3 cusps
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.js";
2
2
 
3
3
  /**
4
4
  * Epicycloid with 3 cusps
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.cjs";
2
2
 
3
3
  /**
4
4
  * Rose curve with 3 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.js";
2
2
 
3
3
  /**
4
4
  * Rose curve with 3 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.cjs";
2
2
 
3
3
  /**
4
4
  * Rose curve with 5 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.js";
2
2
 
3
3
  /**
4
4
  * Rose curve with 5 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.cjs";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.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-DVerJ9cl.js";
1
+ import { C as CurveDef } from "../types-C0b4MPtI.js";
2
2
 
3
3
  /**
4
4
  * 7-pointed star based on Fourier harmonics.
package/dist/index.cjs CHANGED
@@ -548,9 +548,9 @@ function warnIfTrailColorMismatch(trailColor, trailStyle) {
548
548
  );
549
549
  }
550
550
  }
551
- var getHeadDotRadius = (w, h) => Math.max(1, 3 * Math.sqrt(Math.min(w, h) / 160));
552
551
 
553
552
  // src/renderer.ts
553
+ var getHeadDotRadius = (w, h) => Math.max(1, 3 * Math.sqrt(Math.min(w, h) / 160));
554
554
  var WHITE_HEX = "#ffffff";
555
555
  function hexToRgbComponents(hex) {
556
556
  const n = parseInt(hex.slice(1), 16);
@@ -854,6 +854,8 @@ function createRenderer(options) {
854
854
 
855
855
  // src/renderer-svg.ts
856
856
  var EMPTY_PARAMS2 = {};
857
+ var SVG_DEFAULT_HEAD_RADIUS = 0.5;
858
+ var SKELETON_STROKE_WIDTH_PX = 1.5;
857
859
  var HIGH_TRAIL_LENGTH_THRESHOLD = 5e3;
858
860
  function pointsToPathString(pts, scale, offsetX, offsetY) {
859
861
  if (pts.length < 2) {
@@ -893,15 +895,21 @@ function createSVGRenderer(options) {
893
895
  let skeletonColor = options.skeletonColor ?? "#ffffff";
894
896
  let userHeadColor = options.headColor ?? null;
895
897
  let headColor = userHeadColor ?? resolveHeadColor(trailColor, trailStyle);
896
- let headRadius = options.headRadius ?? 1.5;
898
+ let headRadius;
897
899
  let trailSolid = resolveTrailMainColor(trailColor);
898
900
  let trailPalette = resolveTrailPalette(trailColor);
899
901
  const ariaLabel = options.ariaLabel ?? "Loading";
900
902
  warnIfTrailColorMismatch(trailColor, trailStyle);
901
903
  const viewSize = 100;
902
- const svgTrailMinWidth = 0.25;
903
- const svgTrailMaxWidth = 1.25;
904
- const svgSkeletonStrokeWidth = "0.75";
904
+ function getContainerPixelSize() {
905
+ const rect = container.getBoundingClientRect();
906
+ return rect.width && rect.height ? Math.min(rect.width, rect.height) : 200;
907
+ }
908
+ const containerPx = getContainerPixelSize();
909
+ const svgTrailMinWidth = (TRAIL_MIN_WIDTH * viewSize) / containerPx;
910
+ const svgTrailMaxWidth = (TRAIL_MAX_WIDTH * viewSize) / containerPx;
911
+ const svgSkeletonStrokeWidth = String((SKELETON_STROKE_WIDTH_PX * viewSize) / containerPx);
912
+ headRadius = options.headRadius ?? SVG_DEFAULT_HEAD_RADIUS;
905
913
  container.setAttribute("viewBox", `0 0 ${viewSize} ${viewSize}`);
906
914
  container.setAttribute("role", "img");
907
915
  container.setAttribute("aria-label", ariaLabel);