constant.ts•3.55 kB
import type { AntVLibrary } from './types';
// AntV Libraries Metadata
export const ANTV_LIBRARY_META = {
g2: {
id: 'g2' as AntVLibrary,
name: 'G2',
description:
'Statistical charts, data visualization, business intelligence charts',
keywords: `
- 图表 (Chart)
- 标记 (Mark)
- 比例尺 (Scale)
- 转换 (Transform)
- 坐标系 (Coordinate)
- 动画 (Animate)
- 交互 (Interaction)
- 复合 (Composition)
- 组件 (Component)
- 编码 (Encode)
- 通道 (Channel)
- 提示信息 (Tooltip)
- 坐标轴 (Axis)
- 数据标签 (Label)
- 标注(Annotation)
- 配置项 (Options)
`,
codeStyle: `
<convention>
- Prioritize using options() method to configure charts
</convention>
`,
},
g6: {
id: 'g6' as AntVLibrary,
name: 'G6',
description: 'Graph analysis, network diagrams, node-link relationships',
keywords: '',
codeStyle: '',
},
l7: {
id: 'l7' as AntVLibrary,
name: 'L7',
description: 'Geospatial visualization, maps, geographic data analysis',
keywords: '',
codeStyle: '',
},
x6: {
id: 'x6' as AntVLibrary,
name: 'X6',
description: 'Graph editing, flowcharts, diagram creation tools',
keywords: '',
codeStyle: '',
},
f2: {
id: 'f2' as AntVLibrary,
name: 'F2',
description: 'Mobile-optimized charts, lightweight visualization',
keywords: `
<components>
- 文本/图片/点/标签/矩形标注 (TextGuide、ImageGuide、PointGuide、TagGuide、RectGuide)
- 自定义标注/图例 (withGuide、withLegend)
- 时间轴 (Timeline)
- 坐标轴 (Axis)
- 组件 (Component)
- 提示信息/交互 (Tooltip)
- 饼图标签 (PieLabel)
- 象形柱图 (PictorialBar)
<components>
`,
codeStyle: `
<convention>
- Use F2's components directly in JSX. If TypeScript errors occur, add @ts-ignore above the component
- Code examples are for Node environment. For React framework, import ReactCanvas from '@antv/f2-react' and use <ReactCanvas/> component instead of <Canvas/> component
- In F2's canvas coordinate system, Y coordinates increase from top to bottom, and X coordinates increase from left to right by default. Therefore, all values for offsetY, offsetX, x, y and similar properties are relative to the top-left corner of the canvas.
</convention>
`,
},
s2: {
id: 's2' as AntVLibrary,
name: 'S2',
description: 'Table analysis, spreadsheet-like interactions, data grids',
keywords: '',
codeStyle: '',
},
g: {
id: 'g' as AntVLibrary,
name: 'G',
description: 'AntV Grammar of Graphics runtime and specification',
keywords: '',
codeStyle: '',
},
ava: {
id: 'ava' as AntVLibrary,
name: 'AVA',
description:
'Automated Visual Analytics: chart advisor, insight, narrative',
keywords: '',
codeStyle: '',
},
adc: {
id: 'adc' as AntVLibrary,
name: 'ADC',
description:
'Ant Design Charts built on G2 for React and modern frameworks',
keywords: '',
codeStyle: '',
},
};
export const CONTEXT7_TOKENS = {
default: 5000,
max: 20000,
min: 1000,
};
// Convenience functions
export function getLibraryConfig(library: AntVLibrary) {
return ANTV_LIBRARY_META[library];
}
export function getLibraryDescription(library: AntVLibrary): string {
return (
ANTV_LIBRARY_META[library]?.description || 'AntV visualization library'
);
}
export function getLibraryKeywords(library: AntVLibrary) {
return ANTV_LIBRARY_META[library]?.keywords || '';
}