@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.
- package/dist/auto-init.cjs +13 -5
- package/dist/auto-init.cjs.map +1 -1
- package/dist/auto-init.js +13 -5
- package/dist/auto-init.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 +13 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/{types-DVerJ9cl.d.cts → types-C0b4MPtI.d.cts} +2 -2
- package/dist/{types-DVerJ9cl.d.ts → types-C0b4MPtI.d.ts} +2 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
R as RendererOptions,
|
|
7
7
|
P as Point,
|
|
8
8
|
a as SarmalOptions,
|
|
9
|
-
} from "./types-
|
|
9
|
+
} from "./types-C0b4MPtI.cjs";
|
|
10
10
|
export {
|
|
11
11
|
J as JumpOptions,
|
|
12
12
|
b as RuntimeRenderOptions,
|
|
13
13
|
c as SeekOptions,
|
|
14
14
|
T as TrailColor,
|
|
15
15
|
d as TrailStyle,
|
|
16
|
-
} from "./types-
|
|
16
|
+
} from "./types-C0b4MPtI.cjs";
|
|
17
17
|
export { CurveName, curves } from "./curves/index.cjs";
|
|
18
18
|
export { artemis2 } from "./curves/artemis2.cjs";
|
|
19
19
|
export { astroid } from "./curves/astroid.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
R as RendererOptions,
|
|
7
7
|
P as Point,
|
|
8
8
|
a as SarmalOptions,
|
|
9
|
-
} from "./types-
|
|
9
|
+
} from "./types-C0b4MPtI.js";
|
|
10
10
|
export {
|
|
11
11
|
J as JumpOptions,
|
|
12
12
|
b as RuntimeRenderOptions,
|
|
13
13
|
c as SeekOptions,
|
|
14
14
|
T as TrailColor,
|
|
15
15
|
d as TrailStyle,
|
|
16
|
-
} from "./types-
|
|
16
|
+
} from "./types-C0b4MPtI.js";
|
|
17
17
|
export { CurveName, curves } from "./curves/index.js";
|
|
18
18
|
export { artemis2 } from "./curves/artemis2.js";
|
|
19
19
|
export { astroid } from "./curves/astroid.js";
|
package/dist/index.js
CHANGED
|
@@ -546,9 +546,9 @@ function warnIfTrailColorMismatch(trailColor, trailStyle) {
|
|
|
546
546
|
);
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
var getHeadDotRadius = (w, h) => Math.max(1, 3 * Math.sqrt(Math.min(w, h) / 160));
|
|
550
549
|
|
|
551
550
|
// src/renderer.ts
|
|
551
|
+
var getHeadDotRadius = (w, h) => Math.max(1, 3 * Math.sqrt(Math.min(w, h) / 160));
|
|
552
552
|
var WHITE_HEX = "#ffffff";
|
|
553
553
|
function hexToRgbComponents(hex) {
|
|
554
554
|
const n = parseInt(hex.slice(1), 16);
|
|
@@ -852,6 +852,8 @@ function createRenderer(options) {
|
|
|
852
852
|
|
|
853
853
|
// src/renderer-svg.ts
|
|
854
854
|
var EMPTY_PARAMS2 = {};
|
|
855
|
+
var SVG_DEFAULT_HEAD_RADIUS = 0.5;
|
|
856
|
+
var SKELETON_STROKE_WIDTH_PX = 1.5;
|
|
855
857
|
var HIGH_TRAIL_LENGTH_THRESHOLD = 5e3;
|
|
856
858
|
function pointsToPathString(pts, scale, offsetX, offsetY) {
|
|
857
859
|
if (pts.length < 2) {
|
|
@@ -891,15 +893,21 @@ function createSVGRenderer(options) {
|
|
|
891
893
|
let skeletonColor = options.skeletonColor ?? "#ffffff";
|
|
892
894
|
let userHeadColor = options.headColor ?? null;
|
|
893
895
|
let headColor = userHeadColor ?? resolveHeadColor(trailColor, trailStyle);
|
|
894
|
-
let headRadius
|
|
896
|
+
let headRadius;
|
|
895
897
|
let trailSolid = resolveTrailMainColor(trailColor);
|
|
896
898
|
let trailPalette = resolveTrailPalette(trailColor);
|
|
897
899
|
const ariaLabel = options.ariaLabel ?? "Loading";
|
|
898
900
|
warnIfTrailColorMismatch(trailColor, trailStyle);
|
|
899
901
|
const viewSize = 100;
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
902
|
+
function getContainerPixelSize() {
|
|
903
|
+
const rect = container.getBoundingClientRect();
|
|
904
|
+
return rect.width && rect.height ? Math.min(rect.width, rect.height) : 200;
|
|
905
|
+
}
|
|
906
|
+
const containerPx = getContainerPixelSize();
|
|
907
|
+
const svgTrailMinWidth = (TRAIL_MIN_WIDTH * viewSize) / containerPx;
|
|
908
|
+
const svgTrailMaxWidth = (TRAIL_MAX_WIDTH * viewSize) / containerPx;
|
|
909
|
+
const svgSkeletonStrokeWidth = String((SKELETON_STROKE_WIDTH_PX * viewSize) / containerPx);
|
|
910
|
+
headRadius = options.headRadius ?? SVG_DEFAULT_HEAD_RADIUS;
|
|
903
911
|
container.setAttribute("viewBox", `0 0 ${viewSize} ${viewSize}`);
|
|
904
912
|
container.setAttribute("role", "img");
|
|
905
913
|
container.setAttribute("aria-label", ariaLabel);
|