@opendata-ai/openchart-core 9.4.0 → 9.6.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 +57 -12
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
- package/schema/chart.schema.json +36 -8
- package/schema/table.schema.json +19 -0
- package/schema/vizspec.schema.json +71 -16
package/dist/index.d.ts
CHANGED
|
@@ -571,6 +571,8 @@ interface CellStyle {
|
|
|
571
571
|
}
|
|
572
572
|
/** A single resolved chrome text element with computed position and style. */
|
|
573
573
|
interface ResolvedChromeElement {
|
|
574
|
+
/** Makes the text a link. http, https and mailto only; opens in a new tab. */
|
|
575
|
+
href?: string;
|
|
574
576
|
/** The text content. */
|
|
575
577
|
text: string;
|
|
576
578
|
/** X position in the layout coordinate system. */
|
|
@@ -1560,6 +1562,8 @@ interface SizeLegendLayout extends BaseLegendLayout {
|
|
|
1560
1562
|
type LegendLayout = CategoricalLegendLayout | GradientLegendLayout | ContinuousLegendLayout | SizeLegendLayout;
|
|
1561
1563
|
/** A single resolved endpoint-label entry, fully positioned. */
|
|
1562
1564
|
interface EndpointLabelEntry {
|
|
1565
|
+
/** Set on a series that `highlight` mutes; its name, value and date draw in `EndpointLabelsLayout.mutedTextColor`. */
|
|
1566
|
+
muted?: true;
|
|
1563
1567
|
/** Actual observation x in pixels; leaders must not imply a shared final date. */
|
|
1564
1568
|
dataX?: number;
|
|
1565
1569
|
/** Source observation retained without parsing display text. */
|
|
@@ -1601,6 +1605,8 @@ interface EndpointLabelEntry {
|
|
|
1601
1605
|
}
|
|
1602
1606
|
/** Resolved layout for the endpoint labels column. */
|
|
1603
1607
|
interface EndpointLabelsLayout {
|
|
1608
|
+
/** Ink for muted entries' text: the theme's axis tick-label color (4.8:1 on the light canvas, 7.8:1 on dark). */
|
|
1609
|
+
mutedTextColor: string;
|
|
1604
1610
|
/** Fit-tested, series-name-only labels in stacked bands. */
|
|
1605
1611
|
interior?: Array<{
|
|
1606
1612
|
seriesKey: string;
|
|
@@ -2169,6 +2175,7 @@ interface TableLayout {
|
|
|
2169
2175
|
a11y: {
|
|
2170
2176
|
caption: string;
|
|
2171
2177
|
summary: string;
|
|
2178
|
+
description: string | null;
|
|
2172
2179
|
};
|
|
2173
2180
|
/** The resolved theme. */
|
|
2174
2181
|
theme: ResolvedTheme;
|
|
@@ -3785,7 +3792,7 @@ interface EncodingChannel<TData extends DataRow = DataRow> {
|
|
|
3785
3792
|
* - 'ascending': sort domain values ascending (default VL behavior)
|
|
3786
3793
|
* - 'descending': sort domain values descending
|
|
3787
3794
|
* - null: use data order (no sorting)
|
|
3788
|
-
* - undefined:
|
|
3795
|
+
* - undefined: keep data order
|
|
3789
3796
|
* - 'x' | '-x' | 'y' | '-y': sort by another channel's values ('-' prefix
|
|
3790
3797
|
* for descending). The VL ranked-bar idiom: `sort: '-y'` orders categories
|
|
3791
3798
|
* by value, largest first. Resolved into an explicit domain during the
|
|
@@ -3793,6 +3800,8 @@ interface EncodingChannel<TData extends DataRow = DataRow> {
|
|
|
3793
3800
|
* - string[]: explicit value order. Listed values come first (in the given
|
|
3794
3801
|
* order); unlisted data values follow in data order.
|
|
3795
3802
|
* - SortByField: sort by the aggregated values of another field.
|
|
3803
|
+
* On a categorical (band or point) `y`, the first domain value is drawn at the top, so data order and
|
|
3804
|
+
* `sort: '-x'` (largest first) read top to bottom. `scale.reverse` flips it.
|
|
3796
3805
|
*/
|
|
3797
3806
|
sort?: 'ascending' | 'descending' | null | 'x' | '-x' | 'y' | '-y' | string[] | SortByField;
|
|
3798
3807
|
/**
|
|
@@ -4090,6 +4099,8 @@ interface ChromeTextStyle {
|
|
|
4090
4099
|
}
|
|
4091
4100
|
/** A chrome text element with optional style overrides. */
|
|
4092
4101
|
interface ChromeText {
|
|
4102
|
+
/** Makes the text a link. http, https and mailto only; opens in a new tab. */
|
|
4103
|
+
href?: string;
|
|
4093
4104
|
/** The text content to display. */
|
|
4094
4105
|
text: string;
|
|
4095
4106
|
/** Optional style overrides. Theme defaults are used for any omitted property. */
|
|
@@ -4174,8 +4185,9 @@ interface AnnotationBase {
|
|
|
4174
4185
|
opacity?: number;
|
|
4175
4186
|
/** Z-index for render ordering. Higher values render on top. */
|
|
4176
4187
|
zIndex?: number;
|
|
4177
|
-
/**
|
|
4178
|
-
|
|
4188
|
+
/** At compact widths (below 400 px): true (default) thins or demotes the note to a footnote,
|
|
4189
|
+
* false always shows it, 'hide' leaves it out entirely. */
|
|
4190
|
+
responsive?: boolean | 'hide';
|
|
4179
4191
|
}
|
|
4180
4192
|
/**
|
|
4181
4193
|
* Text annotation positioned at a data coordinate.
|
|
@@ -4544,7 +4556,8 @@ interface LabelConfig {
|
|
|
4544
4556
|
prefix?: string;
|
|
4545
4557
|
/** Literal string appended to each formatted label value (e.g. "%" or "x"). Applies to bar, column and arc (pie, donut) labels. */
|
|
4546
4558
|
suffix?: string;
|
|
4547
|
-
/**
|
|
4559
|
+
/** Label only the series or values named in `encoding.color.highlight`: bar and column value labels, and the
|
|
4560
|
+
* endpoint labels of line and area charts, which otherwise also name muted series in a quieter ink. */
|
|
4548
4561
|
highlightedOnly?: boolean;
|
|
4549
4562
|
/** Fixed CSS color for all labels. Overrides the default fill-derived color. */
|
|
4550
4563
|
color?: string;
|
|
@@ -5078,13 +5091,8 @@ interface RectEncoding<TData extends DataRow = DataRow> extends Encoding<TData>
|
|
|
5078
5091
|
x: EncodingChannel<TData>;
|
|
5079
5092
|
y: EncodingChannel<TData>;
|
|
5080
5093
|
}
|
|
5081
|
-
/**
|
|
5082
|
-
|
|
5083
|
-
*
|
|
5084
|
-
* Everything here is optional; when omitted, openchart auto-generates alt
|
|
5085
|
-
* text, ARIA labels, and a screen-reader data table from the spec and data.
|
|
5086
|
-
*/
|
|
5087
|
-
interface A11yConfig {
|
|
5094
|
+
/** An author-written description for assistive technology. */
|
|
5095
|
+
interface A11yDescriptionConfig {
|
|
5088
5096
|
/**
|
|
5089
5097
|
* Alt text announced by screen readers for the chart as a whole. Replaces
|
|
5090
5098
|
* the auto-generated description. Also settable via the top-level
|
|
@@ -5092,6 +5100,14 @@ interface A11yConfig {
|
|
|
5092
5100
|
* are present.
|
|
5093
5101
|
*/
|
|
5094
5102
|
description?: string;
|
|
5103
|
+
}
|
|
5104
|
+
/**
|
|
5105
|
+
* Author-facing accessibility overrides.
|
|
5106
|
+
*
|
|
5107
|
+
* Everything here is optional; when omitted, openchart auto-generates alt
|
|
5108
|
+
* text, ARIA labels, and a screen-reader data table from the spec and data.
|
|
5109
|
+
*/
|
|
5110
|
+
interface A11yConfig extends A11yDescriptionConfig {
|
|
5095
5111
|
/** Render the hidden screen-reader data table. Defaults to true; navigation stays enabled. */
|
|
5096
5112
|
table?: boolean;
|
|
5097
5113
|
/**
|
|
@@ -5434,6 +5450,8 @@ type TableDensity = 'condensed' | 'regular' | 'relaxed';
|
|
|
5434
5450
|
* heatmap coloring, inline sparklines, sorted columns, search, and pagination.
|
|
5435
5451
|
*/
|
|
5436
5452
|
interface TableSpec {
|
|
5453
|
+
/** An author-written description for assistive technology. */
|
|
5454
|
+
a11y?: A11yDescriptionConfig;
|
|
5437
5455
|
/** Compact layout. v8 defaults to cards; priority retains comparable columns with expandable details. */
|
|
5438
5456
|
mobileLayout?: 'cards' | 'priority' | 'scroll';
|
|
5439
5457
|
/** Optional authored measure, unit, provenance, and supplied interval metadata. */
|
|
@@ -6119,6 +6137,8 @@ interface GeoMapPointsLayer {
|
|
|
6119
6137
|
time?: EncodingChannel;
|
|
6120
6138
|
}
|
|
6121
6139
|
interface GeoMapSpec {
|
|
6140
|
+
/** An author-written description for assistive technology. */
|
|
6141
|
+
a11y?: A11yDescriptionConfig;
|
|
6122
6142
|
/** Optional authored measure, unit, provenance, and supplied interval metadata. */
|
|
6123
6143
|
fields?: Record<string, FieldMetadata>;
|
|
6124
6144
|
/** Discriminant: always "map". */
|
|
@@ -6760,6 +6780,17 @@ type ElementRef = {
|
|
|
6760
6780
|
index: number;
|
|
6761
6781
|
/** `/columns/<index>` */
|
|
6762
6782
|
path?: string;
|
|
6783
|
+
} | {
|
|
6784
|
+
type: 'axis';
|
|
6785
|
+
axis: 'x' | 'y' | 'y2';
|
|
6786
|
+
/** `/encoding/x/axis` or `/encoding/y/axis`; absent for y2 */
|
|
6787
|
+
path?: string;
|
|
6788
|
+
} | {
|
|
6789
|
+
type: 'series';
|
|
6790
|
+
/** The series key; null on a chart with one unnamed series. */
|
|
6791
|
+
series: string | null;
|
|
6792
|
+
/** `/encoding/color` when color is encoded, else `/mark` */
|
|
6793
|
+
path?: string;
|
|
6763
6794
|
};
|
|
6764
6795
|
/** Helper constructors for ergonomic ElementRef creation. */
|
|
6765
6796
|
declare const elementRef: {
|
|
@@ -6770,7 +6801,16 @@ declare const elementRef: {
|
|
|
6770
6801
|
readonly legend: (path?: string) => ElementRef;
|
|
6771
6802
|
readonly legendEntry: (series: string, index: number, path?: string) => ElementRef;
|
|
6772
6803
|
readonly column: (key: string, index: number, path?: string) => ElementRef;
|
|
6804
|
+
readonly axis: (axis: "x" | "y" | "y2", path?: string) => ElementRef;
|
|
6805
|
+
readonly series: (series: string | null, path?: string) => ElementRef;
|
|
6773
6806
|
};
|
|
6807
|
+
/** An annotation tool the host arms in edit mode. `axis` fixes a range's or line's direction. */
|
|
6808
|
+
interface AnnotationPlacementTool {
|
|
6809
|
+
type: 'text' | 'range' | 'refline';
|
|
6810
|
+
/** range: absent means the drag direction decides. refline: absent means 'y' when the y scale
|
|
6811
|
+
* is continuous, else 'x'. Ignored for text. */
|
|
6812
|
+
axis?: 'x' | 'y';
|
|
6813
|
+
}
|
|
6774
6814
|
/**
|
|
6775
6815
|
* Event fired when a user interacts with a data mark (bar, point, line segment, etc.).
|
|
6776
6816
|
*
|
|
@@ -6806,6 +6846,9 @@ interface MarkFocusEvent {
|
|
|
6806
6846
|
* or ChartProps (React component) to receive interaction callbacks.
|
|
6807
6847
|
*/
|
|
6808
6848
|
interface ChartEventHandlers {
|
|
6849
|
+
/** The engine disarmed or changed the placement tool (Escape, a finished placement, or leaving
|
|
6850
|
+
* edit mode). Not called for the host's own setPlacementTool calls. */
|
|
6851
|
+
onPlacementToolChange?: (tool: AnnotationPlacementTool | null) => void;
|
|
6809
6852
|
/** Called when a data mark is clicked. */
|
|
6810
6853
|
onMarkClick?: (event: MarkEvent) => void;
|
|
6811
6854
|
/** Called when the mouse enters a data mark. */
|
|
@@ -7669,6 +7712,8 @@ declare function resolveTheme(userTheme?: ThemeConfig, base?: ThemeBase): Resolv
|
|
|
7669
7712
|
* chrome proportional to the container.
|
|
7670
7713
|
*/
|
|
7671
7714
|
|
|
7715
|
+
/** Whether a chrome link is an absolute http, https or mailto URL. */
|
|
7716
|
+
declare function isSafeLink(href: string): boolean;
|
|
7672
7717
|
/**
|
|
7673
7718
|
* Line-height multiplier for the auto-thinning footnote list.
|
|
7674
7719
|
*
|
|
@@ -9312,4 +9357,4 @@ declare const CSS_TOKEN_ROOT_SELECTORS: readonly string[];
|
|
|
9312
9357
|
declare const CSS_TOKENS: readonly CssTokenDef[];
|
|
9313
9358
|
declare function cssTokenDefault(name: string, mode: 'light' | 'dark'): string;
|
|
9314
9359
|
|
|
9315
|
-
export { type A11yConfig, type A11yMetadata, ACHROMATIC_RAMP, AXIS_TITLE_GAP, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationPreset, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPosition, type ArcEncoding, type ArcMark, type AreaEncoding, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarEncoding, type BarListEncoding, type BarListLayout, type BarListRowMark, type BarListSpec, type BarListSpecWithoutData, type BarTableCell, type BaseLegendLayout, type BeeswarmEncoding, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_EXTENDED_PALETTE, CATEGORICAL_FILL_PALETTE, CATEGORICAL_FILL_PALETTE_DARK, CATEGORICAL_PALETTE, CATEGORICAL_PALETTE_DARK, CELL_SWEEP_BUDGET_MS, COMPACT_MAX_X_TICKS, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, CURVE_NAMES, type CalculateExpression, type CalculateTransform, type CalendarEncoding, type CategoricalLegendLayout, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type Chrome, type ChromeDefaults, type ChromeEconomy, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ChromeThemeOverride, type CircleEncoding, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type CompileWarning, type CompositionRecommendation, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, type CurveInput, type CurveName, type CurveStop, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DatasetBinding, type DateGranularity, type DelayAnchor, type DelayRule, type DeltaColumnConfig, type DeltaTableCell, type DensityEncoding, type DensityTransform, type DescriptionEncoding, type DesignDiagnostic, type DesignQuestion, type Display, type DivergingPalette, type DurationRule, ENTRANCE_ROLES, EXIT_CURVE, EXIT_FADE_MS, EXTENDED_OFFSET_STRATEGIES, type EditOp, type EditTransaction, type EditTransactionResult, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, type EnterPhaseConfig, type EntranceEndContext, type EntranceRole, type EntranceRoleDef, type EntranceRoleExtent, type EntranceRoleRow, type EntranceTiming, type EntranceTimingContext, type ErrorbarEncoding, FADE_CURVE, FLUID_SPRING, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldMetadata, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, type FrameConfig, GRAPH_ENCODING_RULES, type GeoAnchor, type GeoCallout, type GeoCalloutNoteSlot, type GeoColorKeyDescriptor, type GeoColorKeyLayout, type GeoDetailLayer, type GeoDetailLayerLayout, type GeoEntityRef, type GeoInset, type GeoLabelAffine, type GeoLabelCandidate, type GeoLabelComponent, type GeoLabelGeometry, type GeoLabelInventoryEntry, type GeoLabelOverlay, type GeoLabelVisibility, type GeoLabelsBundle, type GeoLabelsInput, type GeoMapBorders, type GeoMapEncoding, type GeoMapFeatureMark, type GeoMapFocus, type GeoMapFocusLayout, type GeoMapGeo, type GeoMapLayout, type GeoMapPointMark, type GeoMapPointsLayer, type GeoMapProjection, type GeoMapSpec, type GeoMapSpecWithoutData, type GeoMapZoomConfig, type GeoPlacedLabel, type GeoProjectionContext, type GeoReaderObservation, type GeoReaderSelection, type GeoTextBlock, type GeoViewLayout, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphAnimationConfig, type GraphAnimationSpec, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphEnterPhaseConfig, type GraphInteractionConfig, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphPhaseConfig, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_MINIMAL_MAX, HEIGHT_NO_GRID_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type HistogramEncoding, type ImageColumnConfig, type ImageTableCell, type JoinAggregateTransform, KEYFRAMES, type KeyframeDef, type KeyframeName, type KeyframeProperty, type KeyframeStop, type KeyframeValue, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LINE_POINT_CASCADE_MS, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendChannel, type LegendConfig, type LegendEntry, type LegendEntryPosition, type LegendLayout, type LegendPosition, type LineEncoding, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, type LollipopEncoding, MAP_FEATURE_MAX_DURATION_MS, MAP_POINT_STAGGER_FALLBACK_MS, MAP_SWEEP_BUDGET_MS, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, MAX_SPRING_DURATION, MAX_SR_TABLE_ROWS, MAX_TOTAL_STAGGER_MS, MOTION_REST_THRESHOLD, type MapSweepTiming, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkFocusEvent, type MarkMetadata, type MarkType, type MeasureTextFn, type Metric, type MonotoneCurveName, type MotionPhase, type MotionSample, NARROW_VIEWPORT_MAX, type NeutralRamp, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type ObservationIdentity, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type PlaybackConfig, type PlaybackPeriodPosition, type PlaybackTimingConfig, type Point, type PointEncoding, type PointMark, type RaceBarGeometry, type RaceBarMarkDef, type RaceBarRow, type RaceBarStatic, type RaceConfig, type RaceEncoding, type RaceFrame, type RaceGeometry, type RaceItem, type RaceLayout, type RaceLineGeometry, type RaceLineMarkDef, type RaceLineStatic, type RaceMarkDef, type RaceMarkType, type RacePlayback, type RaceSpec, type RaceSpecWithoutData, type RaceTableCell, type RaceTableColumn, type RaceTableGeometry, type RaceTableMarkDef, type RaceTableStatic, type RaceTick, type RadialGradient, type RangeAnnotation, type RangeEncoding, type ReaderBindingScope, type ReaderChangeMeta, type ReaderComparisonOperand, type ReaderComparisonResult, type ReaderComparisonScope, type ReaderDomainValue, type ReaderObservation, type ReaderPanelScope, type ReaderSelection, type ReaderSeries, type ReaderSlice, type ReaderSliceIndexOptions, type ReaderSliceMember, type ReaderSliceSelection, type Rect, type RectEncoding, type RectMark, type RefLineAnnotation, type RelativeTimeRef, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnimationPhase, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedChromeRule, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedThemeColors, type ResolvedYouDrawIt, type ResponsiveConfig, type RoleTiming, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecOverride, type SankeySpecWithoutData, type ScaleConfig, type ScaleInvert, type ScaleType, type SequentialPalette, type SeriesSearchConfig, type SeriesStrategy, type SeriesStyle, type SizeLegendCircle, type SizeLegendLayout, type SortByField, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type SpecPatch, type SpringConfig, type StaggerRule, type StoredVizSpec, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, type TableBuilderOptions, type TableCell, type TableCellBase, type TableDensity, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TableTotalRow, type TextAnnotation, type TextEncoding, type TextMarkLayout, type TextStyle, type TextTableCell, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeRule, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeTickInterval, type TimeTickStep, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, UPDATE_ENTER_START, type UpdatePhaseConfig, type UpdateTimeline, type ValueDef, type VizSpec, type WaffleEncoding, type WindowFieldDef, type WindowOp, type WindowSortField, type WindowTransform, type XAxisExtentInput, X_AXIS_BAND_HEIGHT, X_AXIS_ROTATED_EXTENT_CAP, X_AXIS_TITLE_BAND, X_AXIS_TITLE_BAND_ROTATED, type YouDrawItConfig, type YouDrawItSample, type YouDrawItYInvert, abbreviateNumber, adaptColorForDarkMode, adaptForLightLineStroke, adaptTheme, anchorMs, annotationSource, applyEditTransaction, areaChart, axisTitleOffset, barChart, broadsheet, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, clampStaggerDelay, clarity, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeNoteBandHeight, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, curveStops, curveToCSSLinear, dataTable, deepMergeSpec, defaultNumberFormatter, deriveNeutralRamp, detectCollision, donutChart, dotChart, elementRef, encodePointerToken, entranceAnchorVars, entranceEndMs, entranceRole, entranceTiming, essay, estimateTextWidth, evalCubicBezier, evalCurve, evalKeyframes, evalRoleEase, evalValueCurve, findAccessibleColor, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, invertCurve, invertRoleEase, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGeoMapSpec, isGradientDef, isGraphSpec, isLayerSpec, isMonotoneCurve, isOpaqueColor, isRaceSpec, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, jsonPointer, keyframeProperties, keyframeValueToCSS, legacyEditorial, lineChart, mapFeatureDuration, mapSweepTiming, maxRotatedLabelWidth, meetsAA, mergeThemeConfig, motionCSS, overlapArea, pickLabelColor, pieChart, progressTimeMs, resolveChromeEconomy, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, roleBaseDuration, roleVars, sampleMotion, scatterChart, shuffledSweepDelays, simulateColorBlindness, springDuration, terminal, textAscent, tileMap, tilemapTileDelays, truncateRotatedLabel, truncateToWidth, updateTimeline, wire, wrapText };
|
|
9360
|
+
export { type A11yConfig, type A11yDescriptionConfig, type A11yMetadata, ACHROMATIC_RAMP, AXIS_TITLE_GAP, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationPreset, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPlacementTool, type AnnotationPosition, type ArcEncoding, type ArcMark, type AreaEncoding, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarEncoding, type BarListEncoding, type BarListLayout, type BarListRowMark, type BarListSpec, type BarListSpecWithoutData, type BarTableCell, type BaseLegendLayout, type BeeswarmEncoding, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_EXTENDED_PALETTE, CATEGORICAL_FILL_PALETTE, CATEGORICAL_FILL_PALETTE_DARK, CATEGORICAL_PALETTE, CATEGORICAL_PALETTE_DARK, CELL_SWEEP_BUDGET_MS, COMPACT_MAX_X_TICKS, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, CURVE_NAMES, type CalculateExpression, type CalculateTransform, type CalendarEncoding, type CategoricalLegendLayout, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type Chrome, type ChromeDefaults, type ChromeEconomy, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ChromeThemeOverride, type CircleEncoding, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type CompileWarning, type CompositionRecommendation, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, type CurveInput, type CurveName, type CurveStop, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DatasetBinding, type DateGranularity, type DelayAnchor, type DelayRule, type DeltaColumnConfig, type DeltaTableCell, type DensityEncoding, type DensityTransform, type DescriptionEncoding, type DesignDiagnostic, type DesignQuestion, type Display, type DivergingPalette, type DurationRule, ENTRANCE_ROLES, EXIT_CURVE, EXIT_FADE_MS, EXTENDED_OFFSET_STRATEGIES, type EditOp, type EditTransaction, type EditTransactionResult, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, type EnterPhaseConfig, type EntranceEndContext, type EntranceRole, type EntranceRoleDef, type EntranceRoleExtent, type EntranceRoleRow, type EntranceTiming, type EntranceTimingContext, type ErrorbarEncoding, FADE_CURVE, FLUID_SPRING, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldMetadata, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, type FrameConfig, GRAPH_ENCODING_RULES, type GeoAnchor, type GeoCallout, type GeoCalloutNoteSlot, type GeoColorKeyDescriptor, type GeoColorKeyLayout, type GeoDetailLayer, type GeoDetailLayerLayout, type GeoEntityRef, type GeoInset, type GeoLabelAffine, type GeoLabelCandidate, type GeoLabelComponent, type GeoLabelGeometry, type GeoLabelInventoryEntry, type GeoLabelOverlay, type GeoLabelVisibility, type GeoLabelsBundle, type GeoLabelsInput, type GeoMapBorders, type GeoMapEncoding, type GeoMapFeatureMark, type GeoMapFocus, type GeoMapFocusLayout, type GeoMapGeo, type GeoMapLayout, type GeoMapPointMark, type GeoMapPointsLayer, type GeoMapProjection, type GeoMapSpec, type GeoMapSpecWithoutData, type GeoMapZoomConfig, type GeoPlacedLabel, type GeoProjectionContext, type GeoReaderObservation, type GeoReaderSelection, type GeoTextBlock, type GeoViewLayout, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphAnimationConfig, type GraphAnimationSpec, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphEnterPhaseConfig, type GraphInteractionConfig, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphPhaseConfig, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_MINIMAL_MAX, HEIGHT_NO_GRID_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type HistogramEncoding, type ImageColumnConfig, type ImageTableCell, type JoinAggregateTransform, KEYFRAMES, type KeyframeDef, type KeyframeName, type KeyframeProperty, type KeyframeStop, type KeyframeValue, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LINE_POINT_CASCADE_MS, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendChannel, type LegendConfig, type LegendEntry, type LegendEntryPosition, type LegendLayout, type LegendPosition, type LineEncoding, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, type LollipopEncoding, MAP_FEATURE_MAX_DURATION_MS, MAP_POINT_STAGGER_FALLBACK_MS, MAP_SWEEP_BUDGET_MS, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, MAX_SPRING_DURATION, MAX_SR_TABLE_ROWS, MAX_TOTAL_STAGGER_MS, MOTION_REST_THRESHOLD, type MapSweepTiming, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkFocusEvent, type MarkMetadata, type MarkType, type MeasureTextFn, type Metric, type MonotoneCurveName, type MotionPhase, type MotionSample, NARROW_VIEWPORT_MAX, type NeutralRamp, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type ObservationIdentity, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type PlaybackConfig, type PlaybackPeriodPosition, type PlaybackTimingConfig, type Point, type PointEncoding, type PointMark, type RaceBarGeometry, type RaceBarMarkDef, type RaceBarRow, type RaceBarStatic, type RaceConfig, type RaceEncoding, type RaceFrame, type RaceGeometry, type RaceItem, type RaceLayout, type RaceLineGeometry, type RaceLineMarkDef, type RaceLineStatic, type RaceMarkDef, type RaceMarkType, type RacePlayback, type RaceSpec, type RaceSpecWithoutData, type RaceTableCell, type RaceTableColumn, type RaceTableGeometry, type RaceTableMarkDef, type RaceTableStatic, type RaceTick, type RadialGradient, type RangeAnnotation, type RangeEncoding, type ReaderBindingScope, type ReaderChangeMeta, type ReaderComparisonOperand, type ReaderComparisonResult, type ReaderComparisonScope, type ReaderDomainValue, type ReaderObservation, type ReaderPanelScope, type ReaderSelection, type ReaderSeries, type ReaderSlice, type ReaderSliceIndexOptions, type ReaderSliceMember, type ReaderSliceSelection, type Rect, type RectEncoding, type RectMark, type RefLineAnnotation, type RelativeTimeRef, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnimationPhase, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedChromeRule, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedThemeColors, type ResolvedYouDrawIt, type ResponsiveConfig, type RoleTiming, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecOverride, type SankeySpecWithoutData, type ScaleConfig, type ScaleInvert, type ScaleType, type SequentialPalette, type SeriesSearchConfig, type SeriesStrategy, type SeriesStyle, type SizeLegendCircle, type SizeLegendLayout, type SortByField, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type SpecPatch, type SpringConfig, type StaggerRule, type StoredVizSpec, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, type TableBuilderOptions, type TableCell, type TableCellBase, type TableDensity, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TableTotalRow, type TextAnnotation, type TextEncoding, type TextMarkLayout, type TextStyle, type TextTableCell, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeRule, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeTickInterval, type TimeTickStep, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, UPDATE_ENTER_START, type UpdatePhaseConfig, type UpdateTimeline, type ValueDef, type VizSpec, type WaffleEncoding, type WindowFieldDef, type WindowOp, type WindowSortField, type WindowTransform, type XAxisExtentInput, X_AXIS_BAND_HEIGHT, X_AXIS_ROTATED_EXTENT_CAP, X_AXIS_TITLE_BAND, X_AXIS_TITLE_BAND_ROTATED, type YouDrawItConfig, type YouDrawItSample, type YouDrawItYInvert, abbreviateNumber, adaptColorForDarkMode, adaptForLightLineStroke, adaptTheme, anchorMs, annotationSource, applyEditTransaction, areaChart, axisTitleOffset, barChart, broadsheet, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, clampStaggerDelay, clarity, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeNoteBandHeight, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, curveStops, curveToCSSLinear, dataTable, deepMergeSpec, defaultNumberFormatter, deriveNeutralRamp, detectCollision, donutChart, dotChart, elementRef, encodePointerToken, entranceAnchorVars, entranceEndMs, entranceRole, entranceTiming, essay, estimateTextWidth, evalCubicBezier, evalCurve, evalKeyframes, evalRoleEase, evalValueCurve, findAccessibleColor, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, invertCurve, invertRoleEase, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGeoMapSpec, isGradientDef, isGraphSpec, isLayerSpec, isMonotoneCurve, isOpaqueColor, isRaceSpec, isRangeAnnotation, isRefLineAnnotation, isSafeLink, isSankeySpec, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, jsonPointer, keyframeProperties, keyframeValueToCSS, legacyEditorial, lineChart, mapFeatureDuration, mapSweepTiming, maxRotatedLabelWidth, meetsAA, mergeThemeConfig, motionCSS, overlapArea, pickLabelColor, pieChart, progressTimeMs, resolveChromeEconomy, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, roleBaseDuration, roleVars, sampleMotion, scatterChart, shuffledSweepDelays, simulateColorBlindness, springDuration, terminal, textAscent, tileMap, tilemapTileDelays, truncateRotatedLabel, truncateToWidth, updateTimeline, wire, wrapText };
|
package/dist/index.js
CHANGED
|
@@ -397,6 +397,16 @@ var elementRef = {
|
|
|
397
397
|
key,
|
|
398
398
|
index,
|
|
399
399
|
...path !== void 0 ? { path } : {}
|
|
400
|
+
}),
|
|
401
|
+
axis: (axis, path) => ({
|
|
402
|
+
type: "axis",
|
|
403
|
+
axis,
|
|
404
|
+
...path !== void 0 ? { path } : {}
|
|
405
|
+
}),
|
|
406
|
+
series: (series, path) => ({
|
|
407
|
+
type: "series",
|
|
408
|
+
series,
|
|
409
|
+
...path !== void 0 ? { path } : {}
|
|
400
410
|
})
|
|
401
411
|
};
|
|
402
412
|
|
|
@@ -2650,10 +2660,24 @@ function resolveTheme(userTheme, base2 = DEFAULT_THEME) {
|
|
|
2650
2660
|
}
|
|
2651
2661
|
|
|
2652
2662
|
// src/layout/chrome.ts
|
|
2663
|
+
function isSafeLink(href) {
|
|
2664
|
+
try {
|
|
2665
|
+
const { protocol } = new URL(href);
|
|
2666
|
+
return protocol === "http:" || protocol === "https:" || protocol === "mailto:";
|
|
2667
|
+
} catch (error) {
|
|
2668
|
+
if (error instanceof TypeError) return false;
|
|
2669
|
+
throw error;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2653
2672
|
function normalizeChromeText(value) {
|
|
2654
2673
|
if (value === void 0) return null;
|
|
2655
2674
|
if (typeof value === "string") return { text: value };
|
|
2656
|
-
return {
|
|
2675
|
+
return {
|
|
2676
|
+
text: value.text,
|
|
2677
|
+
style: value.style,
|
|
2678
|
+
offset: value.offset,
|
|
2679
|
+
...value.href && isSafeLink(value.href) ? { href: value.href } : {}
|
|
2680
|
+
};
|
|
2657
2681
|
}
|
|
2658
2682
|
function scaleFontSize(baseFontSize, width) {
|
|
2659
2683
|
if (width >= 500) return baseFontSize;
|
|
@@ -2799,6 +2823,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
2799
2823
|
const lineCount = estimateLineCount(eyebrowNorm.text, style, maxWidth, measureText, maxLines);
|
|
2800
2824
|
const element = {
|
|
2801
2825
|
text: eyebrowNorm.text,
|
|
2826
|
+
...eyebrowNorm.href ? { href: eyebrowNorm.href } : {},
|
|
2802
2827
|
x: pad + (eyebrowNorm.offset?.dx ?? 0),
|
|
2803
2828
|
y: topY + (eyebrowNorm.offset?.dy ?? 0),
|
|
2804
2829
|
maxWidth,
|
|
@@ -2822,6 +2847,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
2822
2847
|
const lineCount = estimateLineCount(titleNorm.text, style, maxWidth, measureText, maxLines);
|
|
2823
2848
|
const element = {
|
|
2824
2849
|
text: titleNorm.text,
|
|
2850
|
+
...titleNorm.href ? { href: titleNorm.href } : {},
|
|
2825
2851
|
x: pad + (titleNorm.offset?.dx ?? 0),
|
|
2826
2852
|
y: topY + (titleNorm.offset?.dy ?? 0),
|
|
2827
2853
|
maxWidth,
|
|
@@ -2844,6 +2870,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
2844
2870
|
const lineCount = estimateLineCount(subtitleNorm.text, style, maxWidth, measureText, maxLines);
|
|
2845
2871
|
const element = {
|
|
2846
2872
|
text: subtitleNorm.text,
|
|
2873
|
+
...subtitleNorm.href ? { href: subtitleNorm.href } : {},
|
|
2847
2874
|
x: pad + (subtitleNorm.offset?.dx ?? 0),
|
|
2848
2875
|
y: topY + (subtitleNorm.offset?.dy ?? 0),
|
|
2849
2876
|
maxWidth,
|
|
@@ -2900,6 +2927,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
2900
2927
|
);
|
|
2901
2928
|
brandElement = {
|
|
2902
2929
|
text: brandNorm.text,
|
|
2930
|
+
...brandNorm.href ? { href: brandNorm.href } : {},
|
|
2903
2931
|
x: width - pad + (brandNorm.offset?.dx ?? 0),
|
|
2904
2932
|
y: startY + (brandNorm.offset?.dy ?? 0),
|
|
2905
2933
|
maxWidth: Math.max(1, Math.min(maxWidth, naturalWidth)),
|
|
@@ -2948,6 +2976,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
2948
2976
|
const itemY = y + (norm.offset?.dy ?? 0);
|
|
2949
2977
|
elements[key] = {
|
|
2950
2978
|
text: norm.text,
|
|
2979
|
+
...norm.href ? { href: norm.href } : {},
|
|
2951
2980
|
x: pad + (norm.offset?.dx ?? 0),
|
|
2952
2981
|
y: itemY,
|
|
2953
2982
|
maxWidth: available,
|
|
@@ -4977,6 +5006,7 @@ export {
|
|
|
4977
5006
|
isRaceSpec,
|
|
4978
5007
|
isRangeAnnotation,
|
|
4979
5008
|
isRefLineAnnotation,
|
|
5009
|
+
isSafeLink,
|
|
4980
5010
|
isSankeySpec,
|
|
4981
5011
|
isTableSpec,
|
|
4982
5012
|
isTextAnnotation,
|