@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.
- package/dist/auto-init.cjs +42 -4
- package/dist/auto-init.cjs.map +1 -1
- package/dist/auto-init.js +42 -4
- package/dist/auto-init.js.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/curves/artemis2.d.cts +1 -1
- package/dist/curves/artemis2.d.ts +1 -1
- package/dist/curves/astroid.d.cts +1 -1
- package/dist/curves/astroid.d.ts +1 -1
- package/dist/curves/deltoid.d.cts +1 -1
- package/dist/curves/deltoid.d.ts +1 -1
- package/dist/curves/epicycloid3.d.cts +1 -1
- package/dist/curves/epicycloid3.d.ts +1 -1
- package/dist/curves/epitrochoid7.d.cts +1 -1
- package/dist/curves/epitrochoid7.d.ts +1 -1
- package/dist/curves/index.d.cts +1 -1
- package/dist/curves/index.d.ts +1 -1
- package/dist/curves/lame.d.cts +1 -1
- package/dist/curves/lame.d.ts +1 -1
- package/dist/curves/lissajous32.d.cts +1 -1
- package/dist/curves/lissajous32.d.ts +1 -1
- package/dist/curves/lissajous43.d.cts +1 -1
- package/dist/curves/lissajous43.d.ts +1 -1
- package/dist/curves/rose3.d.cts +1 -1
- package/dist/curves/rose3.d.ts +1 -1
- package/dist/curves/rose5.d.cts +1 -1
- package/dist/curves/rose5.d.ts +1 -1
- package/dist/curves/rose52.d.cts +1 -1
- package/dist/curves/rose52.d.ts +1 -1
- package/dist/curves/star.d.cts +1 -1
- package/dist/curves/star.d.ts +1 -1
- package/dist/curves/star4.d.cts +1 -1
- package/dist/curves/star4.d.ts +1 -1
- package/dist/curves/star7.d.cts +1 -1
- package/dist/curves/star7.d.ts +1 -1
- package/dist/index.cjs +49 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +49 -7
- package/dist/index.js.map +1 -1
- package/dist/{renderer-shared-OR--cv-t.d.ts → renderer-shared-Bdca4O4G.d.ts} +8 -4
- package/dist/{renderer-shared-jqw_Q1WO.d.cts → renderer-shared-Ke9BeK1P.d.cts} +8 -4
- package/dist/terminal.cjs.map +1 -1
- package/dist/terminal.d.cts +2 -2
- package/dist/terminal.d.ts +2 -2
- package/dist/terminal.js.map +1 -1
- package/dist/{types-zbxUgcmZ.d.cts → types-BBuUk6nn.d.cts} +9 -0
- package/dist/{types-zbxUgcmZ.d.ts → types-BBuUk6nn.d.ts} +9 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as BaseRendererOptions, E as Engine, S as SarmalInstance, C as CurveDef, R as RendererOptions, a as ControlPoint, P as Point, b as SarmalOptions } from './types-
|
|
2
|
-
export { J as JumpOptions, c as RuntimeRenderOptions, d as SeekOptions, T as TrailColor, e as TrailStyle } from './types-
|
|
1
|
+
import { B as BaseRendererOptions, E as Engine, S as SarmalInstance, C as CurveDef, R as RendererOptions, a as ControlPoint, P as Point, b as SarmalOptions } from './types-BBuUk6nn.cjs';
|
|
2
|
+
export { J as JumpOptions, c as RuntimeRenderOptions, d as SeekOptions, T as TrailColor, e as TrailStyle } from './types-BBuUk6nn.cjs';
|
|
3
3
|
export { CurveName, curves } from './curves/index.cjs';
|
|
4
|
-
export { B as BoundaryResult, S as SarmalPalette, c as computeBoundaries, p as palettes } from './renderer-shared-
|
|
4
|
+
export { B as BoundaryResult, S as SarmalPalette, c as computeBoundaries, p as palettes } from './renderer-shared-Ke9BeK1P.cjs';
|
|
5
5
|
export { artemis2 } from './curves/artemis2.cjs';
|
|
6
6
|
export { astroid } from './curves/astroid.cjs';
|
|
7
7
|
export { deltoid } from './curves/deltoid.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as BaseRendererOptions, E as Engine, S as SarmalInstance, C as CurveDef, R as RendererOptions, a as ControlPoint, P as Point, b as SarmalOptions } from './types-
|
|
2
|
-
export { J as JumpOptions, c as RuntimeRenderOptions, d as SeekOptions, T as TrailColor, e as TrailStyle } from './types-
|
|
1
|
+
import { B as BaseRendererOptions, E as Engine, S as SarmalInstance, C as CurveDef, R as RendererOptions, a as ControlPoint, P as Point, b as SarmalOptions } from './types-BBuUk6nn.js';
|
|
2
|
+
export { J as JumpOptions, c as RuntimeRenderOptions, d as SeekOptions, T as TrailColor, e as TrailStyle } from './types-BBuUk6nn.js';
|
|
3
3
|
export { CurveName, curves } from './curves/index.js';
|
|
4
|
-
export { B as BoundaryResult, S as SarmalPalette, c as computeBoundaries, p as palettes } from './renderer-shared-
|
|
4
|
+
export { B as BoundaryResult, S as SarmalPalette, c as computeBoundaries, p as palettes } from './renderer-shared-Bdca4O4G.js';
|
|
5
5
|
export { artemis2 } from './curves/artemis2.js';
|
|
6
6
|
export { astroid } from './curves/astroid.js';
|
|
7
7
|
export { deltoid } from './curves/deltoid.js';
|
package/dist/index.js
CHANGED
|
@@ -373,11 +373,15 @@ function enginePassthroughs(engine) {
|
|
|
373
373
|
}
|
|
374
374
|
var palettes = {
|
|
375
375
|
bard: ["#a855f7", "#3b82f6", "#14b8a6", "#ec4899"],
|
|
376
|
-
|
|
376
|
+
carnival: ["#ff6b6b", "#4ecdc4", "#ffe66d"],
|
|
377
377
|
ocean: ["#1e3a8a", "#06b6d4", "#22d3ee", "#e0f2fe"],
|
|
378
|
+
sunset: ["#f97316", "#dc2626", "#9333ea", "#f472b6"],
|
|
378
379
|
ice: ["#1e3a8a", "#67e8f9"],
|
|
379
|
-
|
|
380
|
-
|
|
380
|
+
rocketpop: ["#08b8cd", "#ffffff", "#ff001f"],
|
|
381
|
+
neon: ["#00e5ff", "#7c3aed", "#e040fb"],
|
|
382
|
+
vaporwave: ["#ff71ce", "#01cdfe", "#b967ff"],
|
|
383
|
+
pastel: ["#c4b5fd", "#fbcfe8", "#bae6fd"],
|
|
384
|
+
sakura: ["#fff1f2", "#fda4af", "#fb7185"]
|
|
381
385
|
};
|
|
382
386
|
function hexToRgb(hex) {
|
|
383
387
|
const n = parseInt(hex.slice(1), 16);
|
|
@@ -519,7 +523,8 @@ var RENDER_OPTION_KEYS = /* @__PURE__ */ new Set([
|
|
|
519
523
|
"headColor",
|
|
520
524
|
"skeletonColor",
|
|
521
525
|
"trailStyle",
|
|
522
|
-
"headRadius"
|
|
526
|
+
"headRadius",
|
|
527
|
+
"trailWidth"
|
|
523
528
|
]);
|
|
524
529
|
function validateRenderOptions(partial) {
|
|
525
530
|
for (const key of Object.keys(partial)) {
|
|
@@ -542,6 +547,9 @@ function validateRenderOptions(partial) {
|
|
|
542
547
|
if (partial.headRadius !== void 0) {
|
|
543
548
|
assertHeadRadius(partial.headRadius);
|
|
544
549
|
}
|
|
550
|
+
if (partial.trailWidth !== void 0) {
|
|
551
|
+
assertTrailWidth(partial.trailWidth);
|
|
552
|
+
}
|
|
545
553
|
}
|
|
546
554
|
function assertTrailColor(value) {
|
|
547
555
|
if (typeof value === "string") {
|
|
@@ -611,6 +619,18 @@ function assertHeadRadius(value) {
|
|
|
611
619
|
);
|
|
612
620
|
}
|
|
613
621
|
}
|
|
622
|
+
function assertTrailWidth(value) {
|
|
623
|
+
if (typeof value !== "number") {
|
|
624
|
+
throw new TypeError(
|
|
625
|
+
`[sarmal] setRenderOptions: trailWidth must be a number, got ${JSON.stringify(value)}`
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
629
|
+
throw new TypeError(
|
|
630
|
+
`[sarmal] setRenderOptions: trailWidth must be a finite positive number, got ${value}`
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
614
634
|
function resolveTrailMainColor(trailColor) {
|
|
615
635
|
return typeof trailColor === "string" ? trailColor : trailColor[0];
|
|
616
636
|
}
|
|
@@ -679,7 +699,14 @@ function createRenderer(options) {
|
|
|
679
699
|
setupCanvas();
|
|
680
700
|
let logicalWidth = canvas.width / dpr;
|
|
681
701
|
let logicalHeight = canvas.height / dpr;
|
|
702
|
+
if (options.headRadius !== void 0) {
|
|
703
|
+
validateRenderOptions({ headRadius: options.headRadius });
|
|
704
|
+
}
|
|
705
|
+
if (options.trailWidth !== void 0) {
|
|
706
|
+
validateRenderOptions({ trailWidth: options.trailWidth });
|
|
707
|
+
}
|
|
682
708
|
let headRadius = options.headRadius ?? getHeadDotRadius(logicalWidth, logicalHeight);
|
|
709
|
+
let trailWidth = options.trailWidth ?? 1;
|
|
683
710
|
let skeleton = [];
|
|
684
711
|
let skeletonCanvas = null;
|
|
685
712
|
let trail = [];
|
|
@@ -773,7 +800,9 @@ function createRenderer(options) {
|
|
|
773
800
|
i,
|
|
774
801
|
trailCount,
|
|
775
802
|
toX,
|
|
776
|
-
toY
|
|
803
|
+
toY,
|
|
804
|
+
TRAIL_MIN_WIDTH * trailWidth,
|
|
805
|
+
TRAIL_MAX_WIDTH * trailWidth
|
|
777
806
|
);
|
|
778
807
|
if (trailStyle === "default") {
|
|
779
808
|
ctx.fillStyle = `rgba(${trailSolidRgb},${opacity})`;
|
|
@@ -931,6 +960,9 @@ function createRenderer(options) {
|
|
|
931
960
|
if (partial.headRadius !== void 0) {
|
|
932
961
|
headRadius = partial.headRadius;
|
|
933
962
|
}
|
|
963
|
+
if (partial.trailWidth !== void 0) {
|
|
964
|
+
trailWidth = partial.trailWidth;
|
|
965
|
+
}
|
|
934
966
|
if (userHeadColor === null) {
|
|
935
967
|
headColor = resolveHeadColor(trailColor, trailStyle);
|
|
936
968
|
} else {
|
|
@@ -1029,7 +1061,14 @@ function createSVGRenderer(options) {
|
|
|
1029
1061
|
const svgTrailMinWidth = TRAIL_MIN_WIDTH * viewSize / containerPx;
|
|
1030
1062
|
const svgTrailMaxWidth = TRAIL_MAX_WIDTH * viewSize / containerPx;
|
|
1031
1063
|
const svgSkeletonStrokeWidth = String(SKELETON_STROKE_WIDTH_PX * viewSize / containerPx);
|
|
1064
|
+
if (options.headRadius !== void 0) {
|
|
1065
|
+
validateRenderOptions({ headRadius: options.headRadius });
|
|
1066
|
+
}
|
|
1067
|
+
if (options.trailWidth !== void 0) {
|
|
1068
|
+
validateRenderOptions({ trailWidth: options.trailWidth });
|
|
1069
|
+
}
|
|
1032
1070
|
headRadius = options.headRadius ?? SVG_DEFAULT_HEAD_RADIUS;
|
|
1071
|
+
let trailWidth = options.trailWidth ?? 1;
|
|
1033
1072
|
container.setAttribute("viewBox", `0 0 ${viewSize} ${viewSize}`);
|
|
1034
1073
|
container.setAttribute("role", "img");
|
|
1035
1074
|
container.setAttribute("aria-label", ariaLabel);
|
|
@@ -1124,8 +1163,8 @@ function createSVGRenderer(options) {
|
|
|
1124
1163
|
trailCount,
|
|
1125
1164
|
px,
|
|
1126
1165
|
py,
|
|
1127
|
-
svgTrailMinWidth,
|
|
1128
|
-
svgTrailMaxWidth
|
|
1166
|
+
svgTrailMinWidth * trailWidth,
|
|
1167
|
+
svgTrailMaxWidth * trailWidth
|
|
1129
1168
|
);
|
|
1130
1169
|
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`;
|
|
1131
1170
|
trailPaths[i].setAttribute("d", d);
|
|
@@ -1317,6 +1356,9 @@ function createSVGRenderer(options) {
|
|
|
1317
1356
|
headRadius = partial.headRadius;
|
|
1318
1357
|
headCircle.setAttribute("r", String(headRadius));
|
|
1319
1358
|
}
|
|
1359
|
+
if (partial.trailWidth !== void 0) {
|
|
1360
|
+
trailWidth = partial.trailWidth;
|
|
1361
|
+
}
|
|
1320
1362
|
if (userHeadColor === null) {
|
|
1321
1363
|
headColor = resolveHeadColor(trailColor, trailStyle);
|
|
1322
1364
|
} else {
|