@opendata-ai/openchart-core 7.2.3 → 7.3.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/index.d.ts +60 -11
- package/dist/index.js +440 -132
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +8 -0
- package/src/labels/collision.ts +7 -1
- package/src/labels/index.ts +1 -0
- package/src/layout/__tests__/text-measure.test.ts +7 -8
- package/src/layout/index.ts +2 -0
- package/src/layout/text-measure.ts +331 -38
- package/src/responsive/index.ts +5 -0
- package/src/responsive/metrics.ts +37 -0
- package/src/theme/defaults.ts +2 -1
- package/src/types/index.ts +1 -0
- package/src/types/layout.ts +24 -0
package/src/types/layout.ts
CHANGED
|
@@ -109,6 +109,8 @@ export interface ResolvedChrome {
|
|
|
109
109
|
byline?: ResolvedChromeElement;
|
|
110
110
|
footer?: ResolvedChromeElement;
|
|
111
111
|
brand?: ResolvedChromeElement;
|
|
112
|
+
/** Absolute y at which bottom-chrome relative offsets are anchored: area.y + area.height + x-axis extent. */
|
|
113
|
+
bottomAnchorY?: number;
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
// ---------------------------------------------------------------------------
|
|
@@ -176,6 +178,10 @@ export interface AxisLayout {
|
|
|
176
178
|
* classic outside-the-area placement.
|
|
177
179
|
*/
|
|
178
180
|
tickPosition?: 'inline' | 'gutter';
|
|
181
|
+
/** Extent in px beyond the chart-area edge occupied by tick labels + title. Engine-resolved from the final (post-thinning) tick set. */
|
|
182
|
+
extent?: number;
|
|
183
|
+
/** Absolute anchor for the axis title. Replaces renderer-side offset math. */
|
|
184
|
+
titlePosition?: { x: number; y: number; angle?: number };
|
|
179
185
|
}
|
|
180
186
|
|
|
181
187
|
// ---------------------------------------------------------------------------
|
|
@@ -546,6 +552,8 @@ export interface ResolvedLabel {
|
|
|
546
552
|
background?: string;
|
|
547
553
|
/** Whether to show the paint-order stroke halo. Default true. */
|
|
548
554
|
halo?: boolean;
|
|
555
|
+
/** Engine-measured text-block bounds. Renderers should use this for background rects instead of re-estimating. */
|
|
556
|
+
bounds?: Rect;
|
|
549
557
|
}
|
|
550
558
|
|
|
551
559
|
// ---------------------------------------------------------------------------
|
|
@@ -598,6 +606,8 @@ export interface ResolvedAnnotation {
|
|
|
598
606
|
y: number;
|
|
599
607
|
style: TextStyle;
|
|
600
608
|
};
|
|
609
|
+
/** Full placed extent: label bounds unioned with subtitle bounds. Collision and placement source of truth. */
|
|
610
|
+
bounds?: Rect;
|
|
601
611
|
}
|
|
602
612
|
|
|
603
613
|
// ---------------------------------------------------------------------------
|
|
@@ -628,6 +638,16 @@ export interface BaseLegendLayout {
|
|
|
628
638
|
labelStyle: TextStyle;
|
|
629
639
|
}
|
|
630
640
|
|
|
641
|
+
/** Engine-resolved absolute position for a single legend entry. */
|
|
642
|
+
export interface LegendEntryPosition {
|
|
643
|
+
x: number;
|
|
644
|
+
y: number;
|
|
645
|
+
labelX: number;
|
|
646
|
+
labelY: number;
|
|
647
|
+
width: number;
|
|
648
|
+
row: number;
|
|
649
|
+
}
|
|
650
|
+
|
|
631
651
|
/** Categorical legend with discrete swatch entries. */
|
|
632
652
|
export interface CategoricalLegendLayout extends BaseLegendLayout {
|
|
633
653
|
/** Discriminant for legend type. Omitted means categorical (backwards compat). */
|
|
@@ -642,6 +662,10 @@ export interface CategoricalLegendLayout extends BaseLegendLayout {
|
|
|
642
662
|
entryGap: number;
|
|
643
663
|
/** Fill color for the rounded chip background behind the colored bar. */
|
|
644
664
|
swatchChipFill: string;
|
|
665
|
+
/** Engine-resolved absolute positions, parallel to `entries`. */
|
|
666
|
+
entryPositions?: LegendEntryPosition[];
|
|
667
|
+
/** Row advance used to build entryPositions (single source of truth). */
|
|
668
|
+
rowHeight?: number;
|
|
645
669
|
}
|
|
646
670
|
|
|
647
671
|
/** A color stop in a gradient legend. */
|