stickyflow 0.9.2 → 0.10.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 (58) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +1 -1
  3. package/dist/binding/index.cjs +9 -9
  4. package/dist/binding/index.d.cts +3 -3
  5. package/dist/binding/index.d.ts +3 -3
  6. package/dist/binding/index.js +3 -3
  7. package/dist/{chunk-EURX7QT3.cjs → chunk-5PJ55GPG.cjs} +883 -830
  8. package/dist/chunk-5PJ55GPG.cjs.map +1 -0
  9. package/dist/{chunk-AAP24GBG.js → chunk-EGUPN56K.js} +3 -3
  10. package/dist/chunk-EGUPN56K.js.map +1 -0
  11. package/dist/{chunk-Q6FBISNP.js → chunk-HRU6VOEC.js} +545 -331
  12. package/dist/chunk-HRU6VOEC.js.map +1 -0
  13. package/dist/{chunk-3EOG34QN.cjs → chunk-KRSX4UZ7.cjs} +308 -252
  14. package/dist/chunk-KRSX4UZ7.cjs.map +1 -0
  15. package/dist/{chunk-XNNNIOJU.js → chunk-L7CEX5JV.js} +5 -5
  16. package/dist/{chunk-XNNNIOJU.js.map → chunk-L7CEX5JV.js.map} +1 -1
  17. package/dist/{chunk-C25NWWIH.cjs → chunk-LSEMXRB5.cjs} +549 -331
  18. package/dist/chunk-LSEMXRB5.cjs.map +1 -0
  19. package/dist/{chunk-MR32IJQO.cjs → chunk-SCD3AHMY.cjs} +15 -15
  20. package/dist/chunk-SCD3AHMY.cjs.map +1 -0
  21. package/dist/{chunk-G2N3KJYJ.js → chunk-SDOHUNBW.js} +237 -184
  22. package/dist/chunk-SDOHUNBW.js.map +1 -0
  23. package/dist/{chunk-2GKXPZRL.cjs → chunk-TECWZVIM.cjs} +23 -23
  24. package/dist/chunk-TECWZVIM.cjs.map +1 -0
  25. package/dist/{chunk-C3LVKPWQ.js → chunk-VPNOVRWP.js} +279 -223
  26. package/dist/chunk-VPNOVRWP.js.map +1 -0
  27. package/dist/index.cjs +36 -36
  28. package/dist/index.d.cts +33 -28
  29. package/dist/index.d.ts +33 -28
  30. package/dist/index.js +5 -5
  31. package/dist/interaction/index.cjs +358 -337
  32. package/dist/interaction/index.cjs.map +1 -1
  33. package/dist/interaction/index.js +133 -112
  34. package/dist/interaction/index.js.map +1 -1
  35. package/dist/{runtime-DG8X3Fwf.d.cts → runtime-Bkv7QW7H.d.cts} +1 -1
  36. package/dist/{runtime-kqD1RS17.d.ts → runtime-DJ4K4_HZ.d.ts} +1 -1
  37. package/dist/{runtimeTypes-CvjlBZds.d.cts → runtimeTypes-BvJBZLkr.d.cts} +1 -1
  38. package/dist/{runtimeTypes-vRaHOIHi.d.ts → runtimeTypes-C1shzoyr.d.ts} +1 -1
  39. package/dist/stickyflow-diagram.global.js +41 -41
  40. package/dist/stickyflow-diagram.global.js.map +1 -1
  41. package/dist/viewer/index.cjs +9 -9
  42. package/dist/viewer/index.d.cts +1 -1
  43. package/dist/viewer/index.d.ts +1 -1
  44. package/dist/viewer/index.js +4 -4
  45. package/dist/web-component/index.cjs +6 -6
  46. package/dist/web-component/index.cjs.map +1 -1
  47. package/dist/web-component/index.js +4 -4
  48. package/dist/web-component/index.js.map +1 -1
  49. package/package.json +1 -1
  50. package/dist/chunk-2GKXPZRL.cjs.map +0 -1
  51. package/dist/chunk-3EOG34QN.cjs.map +0 -1
  52. package/dist/chunk-AAP24GBG.js.map +0 -1
  53. package/dist/chunk-C25NWWIH.cjs.map +0 -1
  54. package/dist/chunk-C3LVKPWQ.js.map +0 -1
  55. package/dist/chunk-EURX7QT3.cjs.map +0 -1
  56. package/dist/chunk-G2N3KJYJ.js.map +0 -1
  57. package/dist/chunk-MR32IJQO.cjs.map +0 -1
  58. package/dist/chunk-Q6FBISNP.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { componentRegistryVersion, isDimensionObject, isIsometricObject, sflToCanvasState, registerComponentDescriptor, isBuiltInComponentType, getComponentDescriptor, tag, EMPTY_BOUNDS, DOM_CONTRACT_VERSION, edgePointToward, elementCenter, VISIBLE_ISOMETRIC_FACES, isometricFaceCenter, finite, freeformPathData, rotatedBounds, DEFAULT_FONT, isGenericComponent, cleanFootprint, pointAtNormalizedPort, boxBounds, cornersRoundedRectPath, calculateLinkRoute, labelGapDash, getLineMidpoint, personLabelArea, wrapText, heuristicRichMeasure, shadeFill, extrudeFootprint, isometricFaces, roundedPolygonPath, stackSequence, stackRank, topRoundedRectPath, rightRoundedRectPath, leftRoundedRectPath, bottomRoundedRectPath, isHorizontalBar, paint, CHART_TITLE_PROP, chartText, chartTicks, mapChartValue, roundedOrthogonalPathData, localShapePath, pillCornerRadius, isometricBounds, AXIS_SIN, deriveFaceFills, labelTilt, tiltedLabelRoom, resolveChartShadow, CHART_COLORS, angleForAxisValue, horizontalRows, rowTop, categoryProp, isometricTopFaceCenter, ISOMETRIC_SIZE_ATTR, CORNER_RADIUS_ATTR, ISOMETRIC_LABEL_OFFSET_ATTR, PATH_POINTS_ATTR, PATH_TENSION_ATTR, PATH_CLOSED_ATTR, SYMBOL_BOUNDS_ATTR, SYMBOL_POINTS_ATTR, SYMBOL_TENSION_ATTR, SQUARE_CORNER_ATTR, resolvePieRadii, radarCategoryCount, radarRadius, createPieGeometry, DEFAULT_HEX_RADIUS, DEFAULT_HEATMAP_ZONES, axisBands, DEFAULT_ZONE_FILL, representativeColor, computeBoxplotStats, barCategoryCount, ruleAtProp, ruleTextProp, labelBelowFrame, seriesLabelProp, axisLabelProp, seriesColorProp, seriesValueProp, radarSeriesPath, radarRadiusForValue, createPieSlicePath, clipSegmentToRect, formatFieldValue, renderPieLabels, interpolateHexColorStops, contrastTextColor, sameHueTint, isLightColor, barShapePath, linePathData, colorWithAlpha, estimateTextWidth, segmentedBarPath, roundedBarPath, radarPointAt, gapInsetAngle, pieUsesInnerArc, maxPieCornerRadius, pieApexRadius, maxApexCornerRadius, pieArcPoint, sameHueContrastColor, zoneColorAtValue, ellipsizeToWidth, barPath, labelAboveFrame, seriesValueColorProp, stackedSegment, errorBarRange, createVerticalErrorWhiskerNode, formatBarLabel, barLabelSize, CATEGORY_LABEL_ROW, BAR_LABEL, pillPath, resolveRollingNumberStyle, formatRollingNumber } from './chunk-Q6FBISNP.js';
1
+ import { componentRegistryVersion, isDimensionObject, isIsometricObject, sflToCanvasState, registerComponentDescriptor, isBuiltInComponentType, getComponentDescriptor, tag, EMPTY_BOUNDS, DOM_CONTRACT_VERSION, edgePointToward, elementCenter, VISIBLE_ISOMETRIC_FACES, isometricFaceCenter, finite, freeformPathData, rotatedBounds, DEFAULT_FONT, isGenericComponent, cleanFootprint, pointAtNormalizedPort, boxBounds, cornersRoundedRectPath, calculateLinkRoute, labelGapDash, getLineMidpoint, personLabelArea, wrapText, heuristicRichMeasure, shadeFill, extrudeFootprint, isometricFaces, roundedPolygonPath, stackSequence, stackRank, topRoundedRectPath, rightRoundedRectPath, leftRoundedRectPath, bottomRoundedRectPath, paint, CHART_TITLE_PROP, chartText, isHorizontalBar, chartTicks, mapChartValue, roundedOrthogonalPathData, localShapePath, pillCornerRadius, isometricBounds, AXIS_SIN, deriveFaceFills, resolveChartShadow, CHART_COLORS, angleForAxisValue, horizontalRows, rowTop, categoryProp, isometricTopFaceCenter, ISOMETRIC_SIZE_ATTR, CORNER_RADIUS_ATTR, ISOMETRIC_LABEL_OFFSET_ATTR, PATH_POINTS_ATTR, PATH_TENSION_ATTR, PATH_CLOSED_ATTR, SYMBOL_BOUNDS_ATTR, SYMBOL_POINTS_ATTR, SYMBOL_TENSION_ATTR, SQUARE_CORNER_ATTR, labelTilt, tiltedLabelRoom, resolvePieRadii, radarCategoryCount, radarRadius, createPieGeometry, DEFAULT_HEX_RADIUS, DEFAULT_HEATMAP_ZONES, axisBands, DEFAULT_ZONE_FILL, representativeColor, computeBoxplotStats, barCategoryCount, ruleAtProp, ruleTextProp, labelBelowFrame, seriesLabelProp, axisLabelProp, seriesColorProp, seriesValueProp, radarSeriesPath, radarRadiusForValue, createPieSlicePath, renderPieLabels, interpolateHexColorStops, contrastTextColor, formatFieldValue, sameHueTint, isLightColor, barShapePath, linePathData, colorWithAlpha, estimateTextWidth, segmentedBarPath, roundedBarPath, radarPointAt, gapInsetAngle, pieUsesInnerArc, maxPieCornerRadius, pieApexRadius, maxApexCornerRadius, pieArcPoint, sameHueContrastColor, clipSegmentToRect, zoneColorAtValue, ellipsizeToWidth, barPath, labelAboveFrame, seriesValueColorProp, stackedSegment, errorBarRange, createVerticalErrorWhiskerNode, formatBarLabel, barLabelSize, CATEGORY_LABEL_ROW, BAR_LABEL, pillPath, resolveRollingNumberStyle, formatRollingNumber } from './chunk-HRU6VOEC.js';
2
2
 
3
3
  // src/renderInput/styleDecoding/colorToken.ts
4
4
  var COLOR_TOKEN_PATTERN = String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;
@@ -1625,21 +1625,26 @@ function readout(component, fraction) {
1625
1625
  }
1626
1626
  return display === "value" ? Number(component.value).toFixed(decimals(numberProperty2(component, "step"))) : "";
1627
1627
  }
1628
- function buildKnob(component, index) {
1629
- const box = controlBox(component, index, { width: 96, height: 96 });
1628
+ function dialOf(component, box) {
1630
1629
  const min = numberProperty2(component, "min");
1631
1630
  const max = numberProperty2(component, "max");
1632
- const fraction = Math.min(1, Math.max(0, (Number(component.value) - min) / (max - min || 1)));
1633
- const start = numberProperty2(component, "start");
1634
- const sweep = Math.min(360, Math.max(1, numberProperty2(component, "sweep")));
1635
1631
  const thickness = Math.min(numberProperty2(component, "thickness"), Math.min(box.width, box.height) / 3);
1636
- const cx = box.x + box.width / 2;
1637
- const cy = box.y + box.height / 2;
1638
1632
  const radius = Math.max(1, Math.min(box.width, box.height) / 2 - thickness / 2);
1639
- const circumference = 2 * Math.PI * radius;
1640
- const round2 = textProperty(component, "rounded") !== "false";
1641
- const angle = (start - fraction * sweep) * Math.PI / 180;
1642
- const arc = (part, order, color, length, extra = {}) => ({
1633
+ return {
1634
+ cx: box.x + box.width / 2,
1635
+ cy: box.y + box.height / 2,
1636
+ radius,
1637
+ thickness,
1638
+ fraction: Math.min(1, Math.max(0, (Number(component.value) - min) / (max - min || 1))),
1639
+ start: numberProperty2(component, "start"),
1640
+ sweep: Math.min(360, Math.max(1, numberProperty2(component, "sweep"))),
1641
+ circumference: 2 * Math.PI * radius,
1642
+ rounded: textProperty(component, "rounded") !== "false"
1643
+ };
1644
+ }
1645
+ function arcNode(component, box, dial, part, order, color, length, extra = {}) {
1646
+ const { cx, cy, radius, thickness } = dial;
1647
+ return {
1643
1648
  id: `widget-${component.id}-${part}`,
1644
1649
  type: "ellipse",
1645
1650
  order: box.order + order,
@@ -1648,59 +1653,62 @@ function buildKnob(component, index) {
1648
1653
  cy,
1649
1654
  rx: radius,
1650
1655
  ry: radius,
1651
- rotation: -start,
1656
+ rotation: -dial.start,
1652
1657
  style: fade(component, {
1653
1658
  fill: { kind: "none" },
1654
1659
  stroke: solid(color),
1655
1660
  strokeWidth: thickness,
1656
- dash: [Math.max(1e-3, length), circumference],
1657
- lineCap: round2 ? "round" : "butt",
1661
+ dash: [Math.max(1e-3, length), dial.circumference],
1662
+ lineCap: dial.rounded ? "round" : "butt",
1658
1663
  ...extra
1659
1664
  })
1660
- });
1665
+ };
1666
+ }
1667
+ function discNode(component, box, part, order, center, radius, fill2) {
1668
+ return {
1669
+ id: `widget-${component.id}-${part}`,
1670
+ type: "ellipse",
1671
+ order: box.order + order,
1672
+ bounds: rotatedBounds({ x: center.x - radius, y: center.y - radius, width: radius * 2, height: radius * 2 }, 0, 0),
1673
+ cx: center.x,
1674
+ cy: center.y,
1675
+ rx: radius,
1676
+ ry: radius,
1677
+ style: fade(component, { fill: solid(fill2), stroke: { kind: "none" } })
1678
+ };
1679
+ }
1680
+ function buildKnob(component, index) {
1681
+ const box = controlBox(component, index, { width: 96, height: 96 });
1682
+ const dial = dialOf(component, box);
1683
+ const { cx, cy, radius, thickness, fraction, sweep, circumference } = dial;
1684
+ const angle = (dial.start - fraction * sweep) * Math.PI / 180;
1661
1685
  const faceRadius = Math.max(1, radius - thickness / 2 - Math.max(2, thickness * 0.4));
1662
1686
  const dotRadius = thickness / 2 * DOT_RATIO + 1;
1663
1687
  const nodes = [
1664
1688
  hitArea(component, box),
1665
- arc("track", 0.1, textProperty(component, "track"), sweep / 360 * circumference),
1666
- arc("fill", 0.2, textProperty(component, "accent"), fraction * sweep / 360 * circumference, {
1667
- opacity: fraction > 0 ? 1 : 0
1668
- }),
1669
- {
1670
- id: `widget-${component.id}-face`,
1671
- type: "ellipse",
1672
- order: box.order + 0.3,
1673
- bounds: rotatedBounds(
1674
- { x: cx - faceRadius, y: cy - faceRadius, width: faceRadius * 2, height: faceRadius * 2 },
1675
- 0,
1676
- 0
1677
- ),
1678
- cx,
1679
- cy,
1680
- rx: faceRadius,
1681
- ry: faceRadius,
1682
- style: fade(component, { fill: solid(textProperty(component, "face")), stroke: { kind: "none" } })
1683
- },
1684
- {
1685
- id: `widget-${component.id}-dot`,
1686
- type: "ellipse",
1687
- order: box.order + 0.4,
1688
- bounds: rotatedBounds(
1689
- {
1690
- x: cx + radius * Math.cos(angle) - dotRadius,
1691
- y: cy - radius * Math.sin(angle) - dotRadius,
1692
- width: dotRadius * 2,
1693
- height: dotRadius * 2
1694
- },
1695
- 0,
1696
- 0
1697
- ),
1698
- cx: cx + radius * Math.cos(angle),
1699
- cy: cy - radius * Math.sin(angle),
1700
- rx: dotRadius,
1701
- ry: dotRadius,
1702
- style: fade(component, { fill: solid(textProperty(component, "dot")), stroke: { kind: "none" } })
1703
- }
1689
+ arcNode(component, box, dial, "track", 0.1, textProperty(component, "track"), sweep / 360 * circumference),
1690
+ arcNode(
1691
+ component,
1692
+ box,
1693
+ dial,
1694
+ "fill",
1695
+ 0.2,
1696
+ textProperty(component, "accent"),
1697
+ fraction * sweep / 360 * circumference,
1698
+ {
1699
+ opacity: fraction > 0 ? 1 : 0
1700
+ }
1701
+ ),
1702
+ discNode(component, box, "face", 0.3, { x: cx, y: cy }, faceRadius, textProperty(component, "face")),
1703
+ discNode(
1704
+ component,
1705
+ box,
1706
+ "dot",
1707
+ 0.4,
1708
+ { x: cx + radius * Math.cos(angle), y: cy - radius * Math.sin(angle) },
1709
+ dotRadius,
1710
+ textProperty(component, "dot")
1711
+ )
1704
1712
  ];
1705
1713
  const text = readout(component, fraction);
1706
1714
  if (text) {
@@ -1731,62 +1739,68 @@ function readout2(component, fraction) {
1731
1739
  }
1732
1740
  return display === "value" ? String(Number(component.value)) : "";
1733
1741
  }
1742
+ function buildRing(component, box, fraction, round2) {
1743
+ const thickness = Math.min(numberProperty2(component, "thickness"), Math.min(box.width, box.height) / 2);
1744
+ const radius = Math.max(1, Math.min(box.width, box.height) / 2 - thickness / 2);
1745
+ const circumference = 2 * Math.PI * radius;
1746
+ const cx = box.x + box.width / 2;
1747
+ const cy = box.y + box.height / 2;
1748
+ const ring = (part, order, color, extra) => ({
1749
+ id: `widget-${component.id}-${part}`,
1750
+ type: "ellipse",
1751
+ order: box.order + order,
1752
+ bounds: rotatedBounds({ x: cx - radius, y: cy - radius, width: radius * 2, height: radius * 2 }, 0, thickness),
1753
+ cx,
1754
+ cy,
1755
+ rx: radius,
1756
+ ry: radius,
1757
+ rotation: -90,
1758
+ style: fade(component, { fill: { kind: "none" }, stroke: solid(color), strokeWidth: thickness, ...extra })
1759
+ });
1760
+ return [
1761
+ ring("track", 0.1, textProperty(component, "track"), {}),
1762
+ ring("fill", 0.2, textProperty(component, "accent"), {
1763
+ dash: [Math.max(1e-3, fraction * circumference), circumference],
1764
+ lineCap: round2 ? "round" : "butt",
1765
+ opacity: fraction > 0 ? 1 : 0
1766
+ })
1767
+ ];
1768
+ }
1769
+ function buildBar(component, box, fraction, round2) {
1770
+ const vertical = textProperty(component, "direction") === "vertical";
1771
+ const radius = round2 ? (vertical ? box.width : box.height) / 2 : 0;
1772
+ const bar = (part, order, length, color, opacity) => {
1773
+ const shape = vertical ? { x: box.x, y: box.y + box.height - length, width: box.width, height: length } : { x: box.x, y: box.y, width: length, height: box.height };
1774
+ return {
1775
+ id: `widget-${component.id}-${part}`,
1776
+ type: "rect",
1777
+ order: box.order + order,
1778
+ bounds: rotatedBounds(shape, 0, 0),
1779
+ ...shape,
1780
+ rx: radius,
1781
+ style: fade(component, {
1782
+ fill: solid(color),
1783
+ stroke: { kind: "none" },
1784
+ ...opacity === void 0 ? {} : { opacity }
1785
+ })
1786
+ };
1787
+ };
1788
+ const full = vertical ? box.height : box.width;
1789
+ return [
1790
+ bar("track", 0.1, full, textProperty(component, "track")),
1791
+ bar("fill", 0.2, Math.max(0, fraction * full), textProperty(component, "accent"), fraction > 0 ? 1 : 0)
1792
+ ];
1793
+ }
1734
1794
  function buildProgress(component, index) {
1735
1795
  const box = controlBox(component, index, { width: 220, height: 12 });
1736
1796
  const min = numberProperty2(component, "min");
1737
1797
  const max = numberProperty2(component, "max");
1738
1798
  const fraction = Math.min(1, Math.max(0, (Number(component.value) - min) / (max - min || 1)));
1739
1799
  const round2 = textProperty(component, "rounded") !== "false";
1740
- const nodes = [hitArea(component, box)];
1741
- if (textProperty(component, "variant") === "ring") {
1742
- const thickness = Math.min(numberProperty2(component, "thickness"), Math.min(box.width, box.height) / 2);
1743
- const radius = Math.max(1, Math.min(box.width, box.height) / 2 - thickness / 2);
1744
- const circumference = 2 * Math.PI * radius;
1745
- const cx = box.x + box.width / 2;
1746
- const cy = box.y + box.height / 2;
1747
- const ring = (part, order, color, extra) => ({
1748
- id: `widget-${component.id}-${part}`,
1749
- type: "ellipse",
1750
- order: box.order + order,
1751
- bounds: rotatedBounds({ x: cx - radius, y: cy - radius, width: radius * 2, height: radius * 2 }, 0, thickness),
1752
- cx,
1753
- cy,
1754
- rx: radius,
1755
- ry: radius,
1756
- rotation: -90,
1757
- style: fade(component, { fill: { kind: "none" }, stroke: solid(color), strokeWidth: thickness, ...extra })
1758
- });
1759
- nodes.push(ring("track", 0.1, textProperty(component, "track"), {}));
1760
- nodes.push(
1761
- ring("fill", 0.2, textProperty(component, "accent"), {
1762
- dash: [Math.max(1e-3, fraction * circumference), circumference],
1763
- lineCap: round2 ? "round" : "butt",
1764
- opacity: fraction > 0 ? 1 : 0
1765
- })
1766
- );
1767
- } else {
1768
- const vertical = textProperty(component, "direction") === "vertical";
1769
- const radius = round2 ? (vertical ? box.width : box.height) / 2 : 0;
1770
- const bar = (part, order, length, color, opacity) => {
1771
- const shape = vertical ? { x: box.x, y: box.y + box.height - length, width: box.width, height: length } : { x: box.x, y: box.y, width: length, height: box.height };
1772
- return {
1773
- id: `widget-${component.id}-${part}`,
1774
- type: "rect",
1775
- order: box.order + order,
1776
- bounds: rotatedBounds(shape, 0, 0),
1777
- ...shape,
1778
- rx: radius,
1779
- style: fade(component, {
1780
- fill: solid(color),
1781
- stroke: { kind: "none" },
1782
- ...opacity === void 0 ? {} : { opacity }
1783
- })
1784
- };
1785
- };
1786
- const full = vertical ? box.height : box.width;
1787
- nodes.push(bar("track", 0.1, full, textProperty(component, "track")));
1788
- nodes.push(bar("fill", 0.2, Math.max(0, fraction * full), textProperty(component, "accent"), fraction > 0 ? 1 : 0));
1789
- }
1800
+ const nodes = [
1801
+ hitArea(component, box),
1802
+ ...textProperty(component, "variant") === "ring" ? buildRing(component, box, fraction, round2) : buildBar(component, box, fraction, round2)
1803
+ ];
1790
1804
  const text = readout2(component, fraction);
1791
1805
  if (text) {
1792
1806
  const label = {
@@ -1905,12 +1919,15 @@ function ticks(component, box, vertical, reach, offset) {
1905
1919
  return rect(component, box, `tick-${index}`, 0.15, shape, color);
1906
1920
  });
1907
1921
  }
1922
+ function alongOf(box, reach, vertical) {
1923
+ return (fraction) => vertical ? box.y + box.height - reach - fraction * (box.height - reach * 2) : box.x + reach + fraction * (box.width - reach * 2);
1924
+ }
1908
1925
  function buildLine(component, box, thumbs, vertical) {
1909
1926
  const reach = sliderReach("line", vertical ? box.width : box.height);
1910
1927
  const radius = reach * numberProperty2(component, "thumbSize") / 100;
1911
1928
  const thickness = Math.min(numberProperty2(component, "trackHeight"), vertical ? box.width : box.height);
1912
1929
  const mid = vertical ? box.x + box.width / 2 : box.y + box.height / 2;
1913
- const along2 = (fraction) => vertical ? box.y + box.height - reach - fraction * (box.height - reach * 2) : box.x + reach + fraction * (box.width - reach * 2);
1930
+ const along2 = alongOf(box, reach, vertical);
1914
1931
  const line = (start, end) => vertical ? {
1915
1932
  x: mid - thickness / 2,
1916
1933
  y: Math.min(start, end),
@@ -1959,69 +1976,57 @@ function buildLine(component, box, thumbs, vertical) {
1959
1976
  thumb(thumbs.two ? "thumb-end" : "thumb", thumbs.to, 0.31)
1960
1977
  ];
1961
1978
  }
1962
- function buildField(component, box, thumbs, vertical) {
1963
- const reach = sliderReach("field", vertical ? box.width : box.height);
1964
- const radius = Math.min(numberProperty2(component, "radius"), Math.min(box.width, box.height) / 2);
1965
- const whole = { x: box.x, y: box.y, width: box.width, height: box.height, rx: radius };
1966
- const along2 = (fraction) => vertical ? box.y + box.height - reach - fraction * (box.height - reach * 2) : box.x + reach + fraction * (box.width - reach * 2);
1967
- const start = thumbs.two ? along2(thumbs.from) : vertical ? box.y + box.height : box.x;
1968
- const end = along2(thumbs.to);
1979
+ function fieldFill(whole, box, thumbs, vertical, start, end) {
1969
1980
  const first = Math.min(start, end) - (thumbs.two ? HANDLE_WIDTH / 2 : 0);
1970
1981
  const last = Math.max(start, end) + HANDLE_WIDTH / 2;
1971
- const filled = vertical ? {
1982
+ return vertical ? {
1972
1983
  ...whole,
1973
1984
  y: thumbs.two ? first : end - HANDLE_WIDTH / 2,
1974
1985
  height: thumbs.two ? last - first : Math.max(0, box.y + box.height - end + HANDLE_WIDTH / 2),
1975
- rx: thumbs.two ? 0 : radius
1986
+ rx: thumbs.two ? 0 : whole.rx
1976
1987
  } : {
1977
1988
  ...whole,
1978
1989
  x: thumbs.two ? first : box.x,
1979
1990
  width: thumbs.two ? last - first : Math.max(0, end + HANDLE_WIDTH / 2 - box.x),
1980
- rx: thumbs.two ? 0 : radius
1991
+ rx: thumbs.two ? 0 : whole.rx
1981
1992
  };
1993
+ }
1994
+ function fieldHandle(component, box, vertical, part, at) {
1982
1995
  const handleLength = (vertical ? box.width : box.height) * 0.5;
1983
- const handle = (part, at) => {
1984
- const shape = vertical ? {
1985
- x: box.x + (box.width - handleLength) / 2,
1986
- y: at - HANDLE_WIDTH / 2,
1987
- width: handleLength,
1988
- height: HANDLE_WIDTH,
1989
- rx: HANDLE_WIDTH / 2
1990
- } : {
1991
- x: at - HANDLE_WIDTH / 2,
1992
- y: box.y + (box.height - handleLength) / 2,
1993
- width: HANDLE_WIDTH,
1994
- height: handleLength,
1995
- rx: HANDLE_WIDTH / 2
1996
- };
1997
- return rect(component, box, part, 0.3, shape, textProperty(component, "accent"));
1996
+ const shape = vertical ? {
1997
+ x: box.x + (box.width - handleLength) / 2,
1998
+ y: at - HANDLE_WIDTH / 2,
1999
+ width: handleLength,
2000
+ height: HANDLE_WIDTH,
2001
+ rx: HANDLE_WIDTH / 2
2002
+ } : {
2003
+ x: at - HANDLE_WIDTH / 2,
2004
+ y: box.y + (box.height - handleLength) / 2,
2005
+ width: HANDLE_WIDTH,
2006
+ height: handleLength,
2007
+ rx: HANDLE_WIDTH / 2
1998
2008
  };
1999
- const nodes = [
2000
- rect(component, box, "track", 0.1, whole, textProperty(component, "surface")),
2001
- rect(component, box, "fill", 0.2, filled, textProperty(component, "fill")),
2002
- ...thumbs.two ? [handle("handle-start", start)] : [],
2003
- handle(thumbs.two ? "handle-end" : "handle", end)
2004
- ];
2009
+ return rect(component, box, part, 0.3, shape, textProperty(component, "accent"));
2010
+ }
2011
+ function fieldTexts(component, box, thumbs, vertical) {
2005
2012
  const text = {
2006
2013
  color: ink(component, textProperty(component, "textColor")),
2007
2014
  fontSize: numberProperty2(component, "fontSize")
2008
2015
  };
2009
2016
  const value = readout3(component, thumbs);
2010
2017
  if (vertical) {
2011
- if (value) {
2012
- nodes.push(
2013
- labelText(
2014
- component,
2015
- "value",
2016
- { x: box.x, y: box.y + 6, width: box.width, height: 20 },
2017
- { ...text, text: value, align: "center" },
2018
- box.order + 0.4
2019
- )
2020
- );
2021
- }
2022
- return nodes;
2018
+ return value ? [
2019
+ labelText(
2020
+ component,
2021
+ "value",
2022
+ { x: box.x, y: box.y + 6, width: box.width, height: 20 },
2023
+ { ...text, text: value, align: "center" },
2024
+ box.order + 0.4
2025
+ )
2026
+ ] : [];
2023
2027
  }
2024
2028
  const inner = { y: box.y, height: box.height, width: Math.max(0, box.width / 2 - TEXT_PADDING) };
2029
+ const nodes = [];
2025
2030
  if (component.label) {
2026
2031
  nodes.push(
2027
2032
  labelText(
@@ -2044,9 +2049,31 @@ function buildField(component, box, thumbs, vertical) {
2044
2049
  )
2045
2050
  );
2046
2051
  }
2047
- nodes.push(...ticks(component, box, false, reach, box.height - TICK_LENGTH - 5));
2048
2052
  return nodes;
2049
2053
  }
2054
+ function buildField(component, box, thumbs, vertical) {
2055
+ const reach = sliderReach("field", vertical ? box.width : box.height);
2056
+ const radius = Math.min(numberProperty2(component, "radius"), Math.min(box.width, box.height) / 2);
2057
+ const whole = { x: box.x, y: box.y, width: box.width, height: box.height, rx: radius };
2058
+ const along2 = alongOf(box, reach, vertical);
2059
+ const start = thumbs.two ? along2(thumbs.from) : vertical ? box.y + box.height : box.x;
2060
+ const end = along2(thumbs.to);
2061
+ return [
2062
+ rect(component, box, "track", 0.1, whole, textProperty(component, "surface")),
2063
+ rect(
2064
+ component,
2065
+ box,
2066
+ "fill",
2067
+ 0.2,
2068
+ fieldFill(whole, box, thumbs, vertical, start, end),
2069
+ textProperty(component, "fill")
2070
+ ),
2071
+ ...thumbs.two ? [fieldHandle(component, box, vertical, "handle-start", start)] : [],
2072
+ fieldHandle(component, box, vertical, thumbs.two ? "handle-end" : "handle", end),
2073
+ ...fieldTexts(component, box, thumbs, vertical),
2074
+ ...vertical ? [] : ticks(component, box, false, reach, box.height - TICK_LENGTH - 5)
2075
+ ];
2076
+ }
2050
2077
  function buildSlider(component, index) {
2051
2078
  const field = textProperty(component, "variant") === "field";
2052
2079
  const vertical = textProperty(component, "direction") === "vertical";
@@ -4146,27 +4173,46 @@ function tiltedBottomRoom(chart) {
4146
4173
  const labels = chart.chartType === "bar" && !isHorizontalBar(chart) ? chart.config?.categories ?? [] : chart.chartType === "boxplot" && !isHorizontalBoxplot(chart) ? chart.series.map((series) => series.label || series.id) : [];
4147
4174
  return labels.length > 0 ? Math.max(0, tiltedLabelRoom(chart, labels, tilt) - 18) : 0;
4148
4175
  }
4149
- function decorations(chart) {
4150
- const showLabels = chart.showAxisLabels !== false;
4176
+ function legendPlaceOf(chart) {
4151
4177
  const showLegend = chart.showLegend !== false;
4152
- const legendPosition = chart.legendPosition ?? "top";
4153
- const legendAtTop = legendPosition === "top";
4154
- const hasLegendItems = showLegend && chart.series.length > 0;
4155
- const legendStacked = hasLegendItems && isStackedLegendPosition(legendPosition);
4156
- const sideColumnWidth = legendStacked ? stackedLegendColumnWidth(chart) + LEGEND_COLUMN_GAP : 0;
4157
- const treemapSide = treemapSideLegendSide(chart, showLegend);
4158
- const tickX = xLabelOffset(chart);
4159
- const tickY = yLabelOffset(chart);
4160
- const padLeft = tickY + (showLabels ? leftLabelWidth(chart) : 12) + (legendPosition === "bottomLeft" ? sideColumnWidth : 0) + (treemapSide === "left" ? TREEMAP_SIDE_LEGEND_WIDTH : 0);
4161
- const padRight = 24 + (legendPosition === "bottomRight" ? sideColumnWidth : 0) + (treemapSide === "right" ? TREEMAP_SIDE_LEGEND_WIDTH : 0);
4178
+ const position = chart.legendPosition ?? "top";
4179
+ const hasItems = showLegend && chart.series.length > 0;
4180
+ const stacked = hasItems && isStackedLegendPosition(position);
4181
+ return {
4182
+ showLegend,
4183
+ position,
4184
+ atTop: position === "top",
4185
+ hasItems,
4186
+ stacked,
4187
+ sideColumnWidth: stacked ? stackedLegendColumnWidth(chart) + LEGEND_COLUMN_GAP : 0,
4188
+ treemapSide: treemapSideLegendSide(chart, showLegend)
4189
+ };
4190
+ }
4191
+ function padLeftOf(chart, showLabels, legend) {
4192
+ return yLabelOffset(chart) + (showLabels ? leftLabelWidth(chart) : 12) + (legend.position === "bottomLeft" ? legend.sideColumnWidth : 0) + (legend.treemapSide === "left" ? TREEMAP_SIDE_LEGEND_WIDTH : 0);
4193
+ }
4194
+ function padRightOf(legend) {
4195
+ return 24 + (legend.position === "bottomRight" ? legend.sideColumnWidth : 0) + (legend.treemapSide === "right" ? TREEMAP_SIDE_LEGEND_WIDTH : 0);
4196
+ }
4197
+ function padBottomOf(chart, showLabels, legend) {
4162
4198
  const valueRow = chart.chartType === "bar" && chart.config?.showBarLabels === true && chart.config.barLabelPosition === "axis";
4163
4199
  const horizontalValueAxis = isHorizontalBar(chart) && chart.showValueAxis !== false;
4164
- const basePadBottom = showLabels ? isHorizontalBar(chart) ? horizontalValueAxis ? 34 : 12 : (chart.axisX.label ? 52 : 34) + (valueRow ? 18 : 0) : 12;
4165
- const hasColorBar = chart.chartType === "field" && showLegend && Boolean(chart.config?.scale?.stops.length);
4166
- const legendAtBottomRow = hasLegendItems && !legendAtTop && !legendStacked;
4167
- const padBottom = tickX + basePadBottom + (showLabels ? tiltedBottomRoom(chart) : 0) + (hasColorBar ? 44 : 0) + (legendAtBottomRow ? 16 + LEGEND_ROW_HEIGHT : 0);
4200
+ const base = showLabels ? isHorizontalBar(chart) ? horizontalValueAxis ? 34 : 12 : (chart.axisX.label ? 52 : 34) + (valueRow ? 18 : 0) : 12;
4201
+ const hasColorBar = chart.chartType === "field" && legend.showLegend && Boolean(chart.config?.scale?.stops.length);
4202
+ const legendInRow = legend.hasItems && !legend.atTop && !legend.stacked;
4203
+ return xLabelOffset(chart) + base + (showLabels ? tiltedBottomRoom(chart) : 0) + (hasColorBar ? 44 : 0) + (legendInRow ? 16 + LEGEND_ROW_HEIGHT : 0);
4204
+ }
4205
+ function padTopOf(chart, legend) {
4168
4206
  const titleHeight = chart.title ? Math.max(44, 20 + finite(chart.titleSize, 14) * 1.6) : 0;
4169
- const padTop = titleHeight || (legendAtTop && hasLegendItems ? 44 : 24);
4207
+ return titleHeight || (legend.atTop && legend.hasItems ? 44 : 24);
4208
+ }
4209
+ function decorations(chart) {
4210
+ const showLabels = chart.showAxisLabels !== false;
4211
+ const legend = legendPlaceOf(chart);
4212
+ const padLeft = padLeftOf(chart, showLabels, legend);
4213
+ const padRight = padRightOf(legend);
4214
+ const padBottom = padBottomOf(chart, showLabels, legend);
4215
+ const padTop = padTopOf(chart, legend);
4170
4216
  return {
4171
4217
  bounds: boxBounds(
4172
4218
  { x: chart.x, y: chart.y, width: chart.width, height: chart.height },
@@ -4179,7 +4225,7 @@ function decorations(chart) {
4179
4225
  height: Math.max(1, chart.height - padTop - padBottom)
4180
4226
  },
4181
4227
  showLabels,
4182
- showLegend,
4228
+ showLegend: legend.showLegend,
4183
4229
  padLeft
4184
4230
  };
4185
4231
  }
@@ -8084,25 +8130,23 @@ function labelPlacement2(context, geometry, angles, series, fillColor) {
8084
8130
  );
8085
8131
  return { point, color, outside, mid, tickStart };
8086
8132
  }
8087
- function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
8088
- const placement = labelPlacement2(context, geometry, angles, series, fillColor);
8089
- if (!placement) {
8090
- return [];
8091
- }
8092
- const { chart, bounds, nextOrder } = context;
8093
- const { point, color, outside, mid, tickStart } = placement;
8094
- const { nameSize, valueSize } = labelSizes(chart);
8095
- const lineHeight = Math.max(nameSize, valueSize) * 1.2;
8133
+ function labelTick(context, series, placement, lineHeight) {
8134
+ const { point, color, outside, tickStart } = placement;
8096
8135
  const tickEnd = outside ? clipSegmentToRect(tickStart, point, LABEL_WIDTH2 / 2, lineHeight) : tickStart;
8097
- const tick = {
8136
+ return {
8098
8137
  type: "path",
8099
- id: `chart-polar-area-label-tick-${chart.id}-${series.id}`,
8100
- order: nextOrder(),
8101
- bounds,
8138
+ id: `chart-polar-area-label-tick-${context.chart.id}-${series.id}`,
8139
+ order: context.nextOrder(),
8140
+ bounds: context.bounds,
8102
8141
  d: `M ${tickStart.x} ${tickStart.y} L ${tickEnd.x} ${tickEnd.y}`,
8103
8142
  detail: { of: "chartSeries", series: series.id, mark: "polar-area-label-tick" },
8104
8143
  style: outside ? { stroke: { kind: "solid", color }, strokeWidth: 1.5 } : { stroke: { kind: "none" } }
8105
8144
  };
8145
+ }
8146
+ function labelTexts(context, geometry, series, value, placement) {
8147
+ const { chart, bounds, nextOrder } = context;
8148
+ const { point, color, outside, mid } = placement;
8149
+ const { nameSize, valueSize } = labelSizes(chart);
8106
8150
  const detail = {
8107
8151
  of: "chartSeries",
8108
8152
  series: series.id,
@@ -8154,7 +8198,16 @@ function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
8154
8198
  prop: seriesValueProp(series.id, 0),
8155
8199
  propKind: "value"
8156
8200
  };
8157
- return [tick, nameText, valueText];
8201
+ return [nameText, valueText];
8202
+ }
8203
+ function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
8204
+ const placement = labelPlacement2(context, geometry, angles, series, fillColor);
8205
+ if (!placement) {
8206
+ return [];
8207
+ }
8208
+ const { nameSize, valueSize } = labelSizes(context.chart);
8209
+ const tick = labelTick(context, series, placement, Math.max(nameSize, valueSize) * 1.2);
8210
+ return [tick, ...labelTexts(context, geometry, series, value, placement)];
8158
8211
  }
8159
8212
  function addOffset(point, dx, dy) {
8160
8213
  return { x: point.x + dx, y: point.y + dy };
@@ -10340,5 +10393,5 @@ function defineComponent(definition) {
10340
10393
  }
10341
10394
 
10342
10395
  export { collectCanvasObjects, decodeColor, decodeShadow, defineComponent, render, renderCanvas, sflToRenderInput, sliderReach };
10343
- //# sourceMappingURL=chunk-G2N3KJYJ.js.map
10344
- //# sourceMappingURL=chunk-G2N3KJYJ.js.map
10396
+ //# sourceMappingURL=chunk-SDOHUNBW.js.map
10397
+ //# sourceMappingURL=chunk-SDOHUNBW.js.map