@constela/core 0.21.0 → 0.21.2

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 (2) hide show
  1. package/dist/index.js +20 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3585,18 +3585,18 @@ function getActivityRingLayout(data, valueKey, cx, cy, outerRadius, ringWidth, r
3585
3585
  return typeof v === "number" ? v : 0;
3586
3586
  });
3587
3587
  const max = Math.max(...values);
3588
- if (max === 0) {
3589
- return data.map((_, i) => ({
3590
- radius: numOuterRadius - numRingWidth / 2 - i * (numRingWidth + numRingGap),
3591
- angle: 0,
3588
+ const minRadius = numRingWidth / 2;
3589
+ const rings = [];
3590
+ for (let i = 0; i < data.length; i++) {
3591
+ const radius = numOuterRadius - numRingWidth / 2 - i * (numRingWidth + numRingGap);
3592
+ if (radius < minRadius) break;
3593
+ rings.push({
3594
+ radius,
3595
+ angle: max === 0 ? 0 : (values[i] ?? 0) / max * 2 * Math.PI,
3592
3596
  maxAngle: 2 * Math.PI
3593
- }));
3597
+ });
3594
3598
  }
3595
- return data.map((_, i) => ({
3596
- radius: numOuterRadius - numRingWidth / 2 - i * (numRingWidth + numRingGap),
3597
- angle: (values[i] ?? 0) / max * 2 * Math.PI,
3598
- maxAngle: 2 * Math.PI
3599
- }));
3599
+ return rings;
3600
3600
  }
3601
3601
  function getChartDefaultColors(palette) {
3602
3602
  const palettes = {
@@ -3655,7 +3655,16 @@ var GLOBAL_FUNCTIONS = {
3655
3655
  // Chart helpers - Activity Ring
3656
3656
  getActivityRingArcPath: (cx, cy, radius, startAngle, endAngle) => getActivityRingArcPath(cx, cy, radius, startAngle, endAngle),
3657
3657
  getActivityRingLayout: (data, valueKey, cx, cy, outerRadius, ringWidth, ringGap) => getActivityRingLayout(data, valueKey, cx, cy, outerRadius, ringWidth, ringGap),
3658
- getChartDefaultColors: (palette) => getChartDefaultColors(palette)
3658
+ getChartDefaultColors: (palette) => getChartDefaultColors(palette),
3659
+ // Math utility functions
3660
+ min: (...args) => {
3661
+ const nums = args.filter((a) => typeof a === "number");
3662
+ return nums.length > 0 ? Math.min(...nums) : void 0;
3663
+ },
3664
+ max: (...args) => {
3665
+ const nums = args.filter((a) => typeof a === "number");
3666
+ return nums.length > 0 ? Math.max(...nums) : void 0;
3667
+ }
3659
3668
  };
3660
3669
  function callGlobalFunction(method, args) {
3661
3670
  const fn = GLOBAL_FUNCTIONS[method];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/core",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "description": "Core types, schema, and validator for Constela UI framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",