@opendata-ai/openchart-engine 8.4.0 → 8.5.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 CHANGED
@@ -208,7 +208,23 @@ interface GraphCompilation {
208
208
  seedNodeIds: string[];
209
209
  /** Edge legend entries (nominal edgeColor with >1 category), or undefined. */
210
210
  edgeLegend?: LegendEntry[];
211
+ /**
212
+ * Resolved render dimensionality. `3` only when the spec asked for it AND the
213
+ * node count is within {@link MAX_3D_NODES}; otherwise `2`.
214
+ */
215
+ numDimensions: 2 | 3;
211
216
  }
217
+ /**
218
+ * Node ceiling for 3D rendering. The 3D simulation runs on the main thread, so
219
+ * a spec above this falls back to 2D with a warning rather than freezing the
220
+ * page.
221
+ *
222
+ * The number is measured, not guessed. On the RFC 27 gate rig (headed Chromium,
223
+ * ANGLE/Metal, 900x600, DPR 2) an idle 3,000-node / ~6,000-edge scene held
224
+ * 22-27fps against a 30fps floor, while 2,000 held 38-44fps. Every edge is a
225
+ * separate draw call, which is what the ceiling is really made of.
226
+ */
227
+ declare const MAX_3D_NODES = 2000;
212
228
 
213
229
  /**
214
230
  * Compile a chart spec into a ChartLayout.
@@ -645,6 +661,8 @@ interface NormalizedGraphSpec {
645
661
  interactive?: boolean;
646
662
  counts?: boolean;
647
663
  };
664
+ /** Requested render dimensionality. Validated (and gated) in compileGraph. */
665
+ dimensions?: 2 | 3;
648
666
  }
649
667
  /** Discriminated union of all normalized spec types. */
650
668
  type NormalizedSpec = NormalizedChartSpec | NormalizedTableSpec | NormalizedGraphSpec | NormalizedSankeySpec | NormalizedTileMapSpec | NormalizedGeoMapSpec | NormalizedBarListSpec;
@@ -801,7 +819,7 @@ declare function computeArrowheadPoints(tipX: number, tipY: number, tangentX: nu
801
819
  * scored search, and two-pass deterministic placement.
802
820
  */
803
821
 
804
- type ObstacleKind = 'mark' | 'line' | 'area-fill' | 'legend' | 'data-label' | 'endpoint-label' | 'watermark' | 'axis-band' | 'annotation';
822
+ type ObstacleKind = 'mark' | 'line' | 'area-fill' | 'legend' | 'data-label' | 'endpoint-label' | 'watermark' | 'axis-band' | 'annotation' | 'chrome';
805
823
  interface PlacementObstacle extends Rect {
806
824
  kind: ObstacleKind;
807
825
  }
@@ -835,6 +853,12 @@ interface AnnotationContext {
835
853
  debugPlacement?: boolean;
836
854
  /** When true, annotations that overlap are demoted to footnote markers instead of being hidden. */
837
855
  autoThin?: boolean;
856
+ /**
857
+ * First y an annotation label may occupy, in SVG coordinates. Callers pass
858
+ * the bottom of the top chrome block so hand-placed callouts stay clear of
859
+ * the title/subtitle. Defaults to the plain SVG clamp margin.
860
+ */
861
+ topBound?: number;
838
862
  }
839
863
 
840
864
  /**
@@ -1118,4 +1142,4 @@ declare function runTimeUnit(data: DataRow[], transform: TimeUnitTransform): Dat
1118
1142
  */
1119
1143
  declare function runTransforms(data: DataRow[], transforms: Transform[]): DataRow[];
1120
1144
 
1121
- export { ARROWHEAD_LENGTH, AUTO_CANVAS_THRESHOLD, type AnnotationContext, type AnnotationMeasureTextFn, type ArrowheadPoints, BOLD_SPAN_FONT_WEIGHT, type ChartRenderer, type CompileResult, type CompiledGraphEdge, type CompiledGraphNode, DEFAULT_ANNOTATION_FONT_SIZE, DEFAULT_LINE_HEIGHT, ENTER_DEFAULTS, EXIT_DEFAULTS, type GraphCompilation, type NormalizedBarListSpec, type NormalizedChartSpec, type NormalizedChrome, type NormalizedGeoMapSpec, type NormalizedGraphSpec, type NormalizedSankeySpec, type NormalizedSpec, type NormalizedTableSpec, type NormalizedTileMapSpec, type ObstacleKind, type PlacementObstacle, type RichSpan, type SimulationConfig, UPDATE_DEFAULTS, type ValidationError, type ValidationErrorCode, type ValidationResult, buildArcPath, buildAreaPath, buildEdgeTooltip, buildLinePath, clampStaggerDelay, clearRenderers, compile, compileBarList, compileChart, compileGeoMap, compileGraph, compileLayer, compileSankey, compileTable, compileTileMap, computeArrowheadPoints, dedupeKeys, evaluatePredicate, facetMinHeight, getChartRenderer, heuristicMeasure, isConditionalValueDef, legendGap, normalizeSpec, parseAnnotationSpans, registerChartRenderer, resolveAnimation, resolveConditionalValue, runBin, runCalculate, runFilter, runTimeUnit, runTransforms, serializeKeyValue, validateSpec };
1145
+ export { ARROWHEAD_LENGTH, AUTO_CANVAS_THRESHOLD, type AnnotationContext, type AnnotationMeasureTextFn, type ArrowheadPoints, BOLD_SPAN_FONT_WEIGHT, type ChartRenderer, type CompileResult, type CompiledGraphEdge, type CompiledGraphNode, DEFAULT_ANNOTATION_FONT_SIZE, DEFAULT_LINE_HEIGHT, ENTER_DEFAULTS, EXIT_DEFAULTS, type GraphCompilation, MAX_3D_NODES, type NormalizedBarListSpec, type NormalizedChartSpec, type NormalizedChrome, type NormalizedGeoMapSpec, type NormalizedGraphSpec, type NormalizedSankeySpec, type NormalizedSpec, type NormalizedTableSpec, type NormalizedTileMapSpec, type ObstacleKind, type PlacementObstacle, type RichSpan, type SimulationConfig, UPDATE_DEFAULTS, type ValidationError, type ValidationErrorCode, type ValidationResult, buildArcPath, buildAreaPath, buildEdgeTooltip, buildLinePath, clampStaggerDelay, clearRenderers, compile, compileBarList, compileChart, compileGeoMap, compileGraph, compileLayer, compileSankey, compileTable, compileTileMap, computeArrowheadPoints, dedupeKeys, evaluatePredicate, facetMinHeight, getChartRenderer, heuristicMeasure, isConditionalValueDef, legendGap, normalizeSpec, parseAnnotationSpans, registerChartRenderer, resolveAnimation, resolveConditionalValue, runBin, runCalculate, runFilter, runTimeUnit, runTransforms, serializeKeyValue, validateSpec };