@sarmal/core 0.31.0 → 0.33.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 (50) hide show
  1. package/dist/auto-init.cjs +42 -4
  2. package/dist/auto-init.cjs.map +1 -1
  3. package/dist/auto-init.js +42 -4
  4. package/dist/auto-init.js.map +1 -1
  5. package/dist/cli.js.map +1 -1
  6. package/dist/curves/artemis2.d.cts +1 -1
  7. package/dist/curves/artemis2.d.ts +1 -1
  8. package/dist/curves/astroid.d.cts +1 -1
  9. package/dist/curves/astroid.d.ts +1 -1
  10. package/dist/curves/deltoid.d.cts +1 -1
  11. package/dist/curves/deltoid.d.ts +1 -1
  12. package/dist/curves/epicycloid3.d.cts +1 -1
  13. package/dist/curves/epicycloid3.d.ts +1 -1
  14. package/dist/curves/epitrochoid7.d.cts +1 -1
  15. package/dist/curves/epitrochoid7.d.ts +1 -1
  16. package/dist/curves/index.d.cts +1 -1
  17. package/dist/curves/index.d.ts +1 -1
  18. package/dist/curves/lame.d.cts +1 -1
  19. package/dist/curves/lame.d.ts +1 -1
  20. package/dist/curves/lissajous32.d.cts +1 -1
  21. package/dist/curves/lissajous32.d.ts +1 -1
  22. package/dist/curves/lissajous43.d.cts +1 -1
  23. package/dist/curves/lissajous43.d.ts +1 -1
  24. package/dist/curves/rose3.d.cts +1 -1
  25. package/dist/curves/rose3.d.ts +1 -1
  26. package/dist/curves/rose5.d.cts +1 -1
  27. package/dist/curves/rose5.d.ts +1 -1
  28. package/dist/curves/rose52.d.cts +1 -1
  29. package/dist/curves/rose52.d.ts +1 -1
  30. package/dist/curves/star.d.cts +1 -1
  31. package/dist/curves/star.d.ts +1 -1
  32. package/dist/curves/star4.d.cts +1 -1
  33. package/dist/curves/star4.d.ts +1 -1
  34. package/dist/curves/star7.d.cts +1 -1
  35. package/dist/curves/star7.d.ts +1 -1
  36. package/dist/index.cjs +49 -7
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +3 -3
  39. package/dist/index.d.ts +3 -3
  40. package/dist/index.js +49 -7
  41. package/dist/index.js.map +1 -1
  42. package/dist/{renderer-shared-OR--cv-t.d.ts → renderer-shared-Bdca4O4G.d.ts} +8 -4
  43. package/dist/{renderer-shared-jqw_Q1WO.d.cts → renderer-shared-Ke9BeK1P.d.cts} +8 -4
  44. package/dist/terminal.cjs.map +1 -1
  45. package/dist/terminal.d.cts +2 -2
  46. package/dist/terminal.d.ts +2 -2
  47. package/dist/terminal.js.map +1 -1
  48. package/dist/{types-zbxUgcmZ.d.cts → types-BBuUk6nn.d.cts} +9 -0
  49. package/dist/{types-zbxUgcmZ.d.ts → types-BBuUk6nn.d.ts} +9 -0
  50. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from '../types-zbxUgcmZ.js';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.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-zbxUgcmZ.cjs';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.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-zbxUgcmZ.js';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.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-zbxUgcmZ.cjs';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.cjs';
2
2
 
3
3
  /**
4
4
  * Rose curve with 3 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from '../types-zbxUgcmZ.js';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.js';
2
2
 
3
3
  /**
4
4
  * Rose curve with 3 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from '../types-zbxUgcmZ.cjs';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.cjs';
2
2
 
3
3
  /**
4
4
  * Rose curve with 5 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from '../types-zbxUgcmZ.js';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.js';
2
2
 
3
3
  /**
4
4
  * Rose curve with 5 petals
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from '../types-zbxUgcmZ.cjs';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.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-zbxUgcmZ.js';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.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-zbxUgcmZ.cjs';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.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-zbxUgcmZ.js';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.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-zbxUgcmZ.cjs';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.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-zbxUgcmZ.js';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.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-zbxUgcmZ.cjs';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.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-zbxUgcmZ.js';
1
+ import { C as CurveDef } from '../types-BBuUk6nn.js';
2
2
 
3
3
  /**
4
4
  * 7-pointed star based on Fourier harmonics.
package/dist/index.cjs CHANGED
@@ -375,11 +375,15 @@ function enginePassthroughs(engine) {
375
375
  }
376
376
  var palettes = {
377
377
  bard: ["#a855f7", "#3b82f6", "#14b8a6", "#ec4899"],
378
- sunset: ["#f97316", "#dc2626", "#9333ea", "#f472b6"],
378
+ carnival: ["#ff6b6b", "#4ecdc4", "#ffe66d"],
379
379
  ocean: ["#1e3a8a", "#06b6d4", "#22d3ee", "#e0f2fe"],
380
+ sunset: ["#f97316", "#dc2626", "#9333ea", "#f472b6"],
380
381
  ice: ["#1e3a8a", "#67e8f9"],
381
- fire: ["#7f1d1d", "#fbbf24"],
382
- forest: ["#14532d", "#86efac"]
382
+ rocketpop: ["#08b8cd", "#ffffff", "#ff001f"],
383
+ neon: ["#00e5ff", "#7c3aed", "#e040fb"],
384
+ vaporwave: ["#ff71ce", "#01cdfe", "#b967ff"],
385
+ pastel: ["#c4b5fd", "#fbcfe8", "#bae6fd"],
386
+ sakura: ["#fff1f2", "#fda4af", "#fb7185"]
383
387
  };
384
388
  function hexToRgb(hex) {
385
389
  const n = parseInt(hex.slice(1), 16);
@@ -521,7 +525,8 @@ var RENDER_OPTION_KEYS = /* @__PURE__ */ new Set([
521
525
  "headColor",
522
526
  "skeletonColor",
523
527
  "trailStyle",
524
- "headRadius"
528
+ "headRadius",
529
+ "trailWidth"
525
530
  ]);
526
531
  function validateRenderOptions(partial) {
527
532
  for (const key of Object.keys(partial)) {
@@ -544,6 +549,9 @@ function validateRenderOptions(partial) {
544
549
  if (partial.headRadius !== void 0) {
545
550
  assertHeadRadius(partial.headRadius);
546
551
  }
552
+ if (partial.trailWidth !== void 0) {
553
+ assertTrailWidth(partial.trailWidth);
554
+ }
547
555
  }
548
556
  function assertTrailColor(value) {
549
557
  if (typeof value === "string") {
@@ -613,6 +621,18 @@ function assertHeadRadius(value) {
613
621
  );
614
622
  }
615
623
  }
624
+ function assertTrailWidth(value) {
625
+ if (typeof value !== "number") {
626
+ throw new TypeError(
627
+ `[sarmal] setRenderOptions: trailWidth must be a number, got ${JSON.stringify(value)}`
628
+ );
629
+ }
630
+ if (!Number.isFinite(value) || value <= 0) {
631
+ throw new TypeError(
632
+ `[sarmal] setRenderOptions: trailWidth must be a finite positive number, got ${value}`
633
+ );
634
+ }
635
+ }
616
636
  function resolveTrailMainColor(trailColor) {
617
637
  return typeof trailColor === "string" ? trailColor : trailColor[0];
618
638
  }
@@ -681,7 +701,14 @@ function createRenderer(options) {
681
701
  setupCanvas();
682
702
  let logicalWidth = canvas.width / dpr;
683
703
  let logicalHeight = canvas.height / dpr;
704
+ if (options.headRadius !== void 0) {
705
+ validateRenderOptions({ headRadius: options.headRadius });
706
+ }
707
+ if (options.trailWidth !== void 0) {
708
+ validateRenderOptions({ trailWidth: options.trailWidth });
709
+ }
684
710
  let headRadius = options.headRadius ?? getHeadDotRadius(logicalWidth, logicalHeight);
711
+ let trailWidth = options.trailWidth ?? 1;
685
712
  let skeleton = [];
686
713
  let skeletonCanvas = null;
687
714
  let trail = [];
@@ -775,7 +802,9 @@ function createRenderer(options) {
775
802
  i,
776
803
  trailCount,
777
804
  toX,
778
- toY
805
+ toY,
806
+ TRAIL_MIN_WIDTH * trailWidth,
807
+ TRAIL_MAX_WIDTH * trailWidth
779
808
  );
780
809
  if (trailStyle === "default") {
781
810
  ctx.fillStyle = `rgba(${trailSolidRgb},${opacity})`;
@@ -933,6 +962,9 @@ function createRenderer(options) {
933
962
  if (partial.headRadius !== void 0) {
934
963
  headRadius = partial.headRadius;
935
964
  }
965
+ if (partial.trailWidth !== void 0) {
966
+ trailWidth = partial.trailWidth;
967
+ }
936
968
  if (userHeadColor === null) {
937
969
  headColor = resolveHeadColor(trailColor, trailStyle);
938
970
  } else {
@@ -1031,7 +1063,14 @@ function createSVGRenderer(options) {
1031
1063
  const svgTrailMinWidth = TRAIL_MIN_WIDTH * viewSize / containerPx;
1032
1064
  const svgTrailMaxWidth = TRAIL_MAX_WIDTH * viewSize / containerPx;
1033
1065
  const svgSkeletonStrokeWidth = String(SKELETON_STROKE_WIDTH_PX * viewSize / containerPx);
1066
+ if (options.headRadius !== void 0) {
1067
+ validateRenderOptions({ headRadius: options.headRadius });
1068
+ }
1069
+ if (options.trailWidth !== void 0) {
1070
+ validateRenderOptions({ trailWidth: options.trailWidth });
1071
+ }
1034
1072
  headRadius = options.headRadius ?? SVG_DEFAULT_HEAD_RADIUS;
1073
+ let trailWidth = options.trailWidth ?? 1;
1035
1074
  container.setAttribute("viewBox", `0 0 ${viewSize} ${viewSize}`);
1036
1075
  container.setAttribute("role", "img");
1037
1076
  container.setAttribute("aria-label", ariaLabel);
@@ -1126,8 +1165,8 @@ function createSVGRenderer(options) {
1126
1165
  trailCount,
1127
1166
  px,
1128
1167
  py,
1129
- svgTrailMinWidth,
1130
- svgTrailMaxWidth
1168
+ svgTrailMinWidth * trailWidth,
1169
+ svgTrailMaxWidth * trailWidth
1131
1170
  );
1132
1171
  const d = `M${l0x.toFixed(2)} ${l0y.toFixed(2)} L${l1x.toFixed(2)} ${l1y.toFixed(2)} L${r1x.toFixed(2)} ${r1y.toFixed(2)} L${r0x.toFixed(2)} ${r0y.toFixed(2)} Z`;
1133
1172
  trailPaths[i].setAttribute("d", d);
@@ -1319,6 +1358,9 @@ function createSVGRenderer(options) {
1319
1358
  headRadius = partial.headRadius;
1320
1359
  headCircle.setAttribute("r", String(headRadius));
1321
1360
  }
1361
+ if (partial.trailWidth !== void 0) {
1362
+ trailWidth = partial.trailWidth;
1363
+ }
1322
1364
  if (userHeadColor === null) {
1323
1365
  headColor = resolveHeadColor(trailColor, trailStyle);
1324
1366
  } else {