@antv/infographic 0.1.0 → 0.1.2

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 (110) hide show
  1. package/README.md +8 -12
  2. package/README.zh-CN.md +8 -9
  3. package/dist/infographic.min.js +45 -34
  4. package/dist/infographic.min.js.map +1 -1
  5. package/esm/designs/components/BtnsGroup.js +1 -1
  6. package/esm/designs/structures/hierarchy-tree.js +13 -6
  7. package/esm/exporter/font.d.ts +18 -0
  8. package/esm/exporter/font.js +202 -0
  9. package/esm/exporter/index.d.ts +3 -0
  10. package/esm/exporter/index.js +2 -0
  11. package/esm/exporter/png.d.ts +2 -0
  12. package/esm/exporter/png.js +42 -0
  13. package/esm/exporter/svg.d.ts +3 -0
  14. package/esm/exporter/svg.js +72 -0
  15. package/esm/exporter/types.d.ts +17 -0
  16. package/esm/index.d.ts +2 -2
  17. package/esm/renderer/composites/text.js +1 -3
  18. package/esm/renderer/fonts/built-in.d.ts +1 -1
  19. package/esm/renderer/fonts/index.d.ts +0 -2
  20. package/esm/renderer/fonts/index.js +0 -1
  21. package/esm/renderer/fonts/loader.js +1 -2
  22. package/esm/renderer/fonts/registry.d.ts +1 -1
  23. package/esm/renderer/fonts/registry.js +1 -1
  24. package/esm/renderer/renderer.js +1 -50
  25. package/esm/resource/utils/ref.js +1 -1
  26. package/esm/runtime/Infographic.d.ts +10 -0
  27. package/esm/runtime/Infographic.js +23 -2
  28. package/esm/types/font.js +1 -0
  29. package/esm/types/index.d.ts +1 -0
  30. package/{lib/renderer/fonts/utils.d.ts → esm/utils/font.d.ts} +1 -1
  31. package/esm/utils/index.d.ts +2 -0
  32. package/esm/utils/index.js +2 -0
  33. package/esm/utils/is-node.d.ts +4 -0
  34. package/esm/utils/is-node.js +6 -0
  35. package/esm/utils/padding.d.ts +1 -0
  36. package/esm/utils/padding.js +70 -0
  37. package/esm/utils/svg.d.ts +0 -1
  38. package/esm/utils/svg.js +3 -18
  39. package/esm/utils/text.js +1 -1
  40. package/esm/utils/viewbox.d.ts +6 -0
  41. package/esm/utils/viewbox.js +12 -0
  42. package/lib/designs/components/BtnsGroup.js +1 -1
  43. package/lib/designs/structures/hierarchy-tree.js +31 -24
  44. package/lib/exporter/font.d.ts +18 -0
  45. package/lib/exporter/font.js +210 -0
  46. package/lib/exporter/index.d.ts +3 -0
  47. package/lib/exporter/index.js +7 -0
  48. package/lib/exporter/png.d.ts +2 -0
  49. package/lib/exporter/png.js +45 -0
  50. package/lib/exporter/svg.d.ts +3 -0
  51. package/lib/exporter/svg.js +76 -0
  52. package/lib/exporter/types.d.ts +17 -0
  53. package/lib/index.d.ts +2 -2
  54. package/lib/renderer/composites/text.js +1 -3
  55. package/lib/renderer/fonts/built-in.d.ts +1 -1
  56. package/lib/renderer/fonts/index.d.ts +0 -2
  57. package/lib/renderer/fonts/index.js +1 -4
  58. package/lib/renderer/fonts/loader.js +1 -2
  59. package/lib/renderer/fonts/registry.d.ts +1 -1
  60. package/lib/renderer/fonts/registry.js +1 -1
  61. package/lib/renderer/renderer.js +1 -50
  62. package/lib/resource/utils/ref.js +1 -1
  63. package/lib/runtime/Infographic.d.ts +10 -0
  64. package/lib/runtime/Infographic.js +23 -2
  65. package/lib/types/font.js +2 -0
  66. package/lib/types/index.d.ts +1 -0
  67. package/{esm/renderer/fonts/utils.d.ts → lib/utils/font.d.ts} +1 -1
  68. package/lib/utils/index.d.ts +2 -0
  69. package/lib/utils/index.js +2 -0
  70. package/lib/utils/is-node.d.ts +4 -0
  71. package/lib/utils/is-node.js +9 -0
  72. package/lib/utils/padding.d.ts +1 -0
  73. package/lib/utils/padding.js +71 -0
  74. package/lib/utils/svg.d.ts +0 -1
  75. package/lib/utils/svg.js +3 -19
  76. package/lib/utils/text.js +2 -2
  77. package/lib/utils/viewbox.d.ts +6 -0
  78. package/lib/utils/viewbox.js +15 -0
  79. package/package.json +5 -2
  80. package/src/designs/components/BtnsGroup.tsx +7 -1
  81. package/src/designs/structures/hierarchy-tree.tsx +14 -8
  82. package/src/exporter/font.ts +273 -0
  83. package/src/exporter/index.ts +7 -0
  84. package/src/exporter/png.ts +58 -0
  85. package/src/exporter/svg.ts +94 -0
  86. package/src/exporter/types.ts +19 -0
  87. package/src/index.ts +7 -3
  88. package/src/renderer/composites/text.ts +1 -2
  89. package/src/renderer/fonts/built-in.ts +1 -1
  90. package/src/renderer/fonts/index.ts +1 -3
  91. package/src/renderer/fonts/loader.ts +1 -2
  92. package/src/renderer/fonts/registry.ts +2 -2
  93. package/src/renderer/renderer.ts +1 -69
  94. package/src/resource/utils/ref.ts +1 -1
  95. package/src/runtime/Infographic.tsx +30 -2
  96. package/src/types/index.ts +1 -0
  97. package/src/{renderer/fonts/utils.ts → utils/font.ts} +1 -1
  98. package/src/utils/index.ts +2 -0
  99. package/src/utils/is-node.ts +8 -0
  100. package/src/utils/padding.ts +79 -0
  101. package/src/utils/svg.ts +5 -19
  102. package/src/utils/text.ts +2 -2
  103. package/src/utils/viewbox.ts +12 -0
  104. /package/esm/{renderer/fonts → exporter}/types.js +0 -0
  105. /package/esm/{renderer/fonts/types.d.ts → types/font.d.ts} +0 -0
  106. /package/esm/{renderer/fonts/utils.js → utils/font.js} +0 -0
  107. /package/lib/{renderer/fonts → exporter}/types.js +0 -0
  108. /package/lib/{renderer/fonts/types.d.ts → types/font.d.ts} +0 -0
  109. /package/lib/{renderer/fonts/utils.js → utils/font.js} +0 -0
  110. /package/src/{renderer/fonts/types.ts → types/font.ts} +0 -0
package/README.md CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  <img src="https://gw.alipayobjects.com/zos/antfincdn/R8sN%24GNdh6/language.svg" width="18"> [中文](./README.zh-CN.md) | English
3
2
 
4
3
  <div align="center">
@@ -11,7 +10,6 @@
11
10
  [![build status](https://img.shields.io/github/actions/workflow/status/antvis/infographic/build.yml)](https://github.com/antvis/infographic/actions)
12
11
  [![license](https://img.shields.io/npm/l/@antv/infographic.svg)](./LICENSE)
13
12
 
14
-
15
13
  <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*EdkXSojOxqsAAAAAQHAAAAgAemJ7AQ/original" width="256">
16
14
 
17
15
  </div>
@@ -23,18 +21,19 @@ With unified syntax and component architecture, you can render structured data i
23
21
 
24
22
  [Website](https://infographic.antv.vision) · [GitHub](https://github.com/antvis/infographic) · [Document](https://infographic.antv.vision/learn) · [Gallery](https://infographic.antv.vision/examples) · [AI Agent](https://infographic.antv.vision/ai)
25
23
 
26
- </div>
24
+ <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*ZdeISZWHuyIAAAAAbEAAAAgAemJ7AQ/fmt.webp" width="768" alt="AntV Infographic Preview">
27
25
 
26
+ </div>
28
27
 
29
28
  ## ✨ Features
30
29
 
31
- - 📦 **Ready to Use**: Built-in 100+ infographic templates, data item components, and layouts for quickly building professional infographics
32
- - 🎨 **Theme System**: Supports hand-drawn (rough) style, gradients, patterns, multiple preset themes, and deep customization
33
- - 🧩 **Component Architecture**: Data items, structural layouts, and rendering units are fully componentized for flexible composition and extension
34
- - 📐 **High-Quality SVG Output**: SVG-based rendering by default, ensuring visual quality and editability
30
+ - 📦 **Ready to use**: 100+ built-in templates, data-item components, and layouts to assemble infographics in minutes
31
+ - 🎨 **Themeable**: Hand-drawn (rough), gradients, patterns, multiple presets, and deep customization
32
+ - 🧩 **Composable**: Structures, items, and render units are fully componentized for flexible extension
35
33
  - 🎯 **Declarative Configuration**: Simple and clear configuration approach, ideal for AI generation, machine understanding, and automated workflows
36
- - 🤖 **AI-Friendly**: Complete JSON Schema definitions enable large language models to automatically generate usable configurations
37
34
 
35
+ - 🤖 **AI-friendly**: Declarative config with JSON Schema, ideal for AI generation and automated workflows
36
+ - 📐 **High-quality SVG**: Default SVG output for crisp visuals and easy editing/export
38
37
 
39
38
  ## 🚀 Installation
40
39
 
@@ -42,7 +41,6 @@ With unified syntax and component architecture, you can render structured data i
42
41
  npm install @antv/infographic
43
42
  ```
44
43
 
45
-
46
44
  ## 📝 Quick Start
47
45
 
48
46
  ```ts
@@ -65,13 +63,12 @@ const infographic = new Infographic({
65
63
  infographic.render();
66
64
  ```
67
65
 
68
- Then you can see the infographic rendered in the container.
66
+ Render the infographic in the target container.
69
67
 
70
68
  ![](https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*uvj8Qb26F1MAAAAARAAAAAgAemJ7AQ/fmt.webp)
71
69
 
72
70
  For more examples, please refer to the [documentation](https://infographic.antv.vision/examples) site.
73
71
 
74
-
75
72
  ## 💬 Community & Communication
76
73
 
77
74
  - Submit your questions or suggestions on GitHub
@@ -84,7 +81,6 @@ If you have any suggestions, feel free to communicate with us on GitHub! Star
84
81
  - [GitHub Repository](https://github.com/antvis/infographic)
85
82
  - [Issue Tracker](https://github.com/antvis/infographic/issues)
86
83
 
87
-
88
84
  ## 📄 License
89
85
 
90
86
  This project is open source under the **MIT** license. See [LICENSE](./LICENSE) for details.
package/README.zh-CN.md CHANGED
@@ -1,17 +1,17 @@
1
1
  <img src="https://gw.alipayobjects.com/zos/antfincdn/R8sN%24GNdh6/language.svg" width="18"> 简体中文 | [English](/README.md)
2
2
 
3
- <div align="center">
3
+ <div align="center">
4
4
 
5
5
  # Infographic, bring words to life!
6
6
 
7
7
  🦋 新一代信息图可视化引擎,让文字信息栩栩如生!
8
8
 
9
- <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*EdkXSojOxqsAAAAAQHAAAAgAemJ7AQ/original" width="256">
10
-
11
9
  [![npm version](https://img.shields.io/npm/v/@antv/infographic.svg)](https://www.npmjs.com/package/@antv/infographic)
12
10
  [![build status](https://img.shields.io/github/actions/workflow/status/antvis/infographic/build.yml)](https://github.com/antvis/infographic/actions)
13
11
  [![license](https://img.shields.io/npm/l/@antv/infographic.svg)](./LICENSE)
14
12
 
13
+ <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*EdkXSojOxqsAAAAAQHAAAAgAemJ7AQ/original" width="256">
14
+
15
15
  </div>
16
16
 
17
17
  **AntV Infographic** 是 AntV 推出的新一代**声明式信息图可视化引擎**。
@@ -19,19 +19,20 @@
19
19
 
20
20
  <div align="center">
21
21
 
22
- [Website](https://infographic.antv.vision) · [GitHub](https://github.com/antvis/infographic) · [Document](https://infographic.antv.vision/learn) · [Gallery](https://infographic.antv.vision/examples) · [AI Agent](https://infographic.antv.vision/ai)
22
+ [官网](https://infographic.antv.vision) · [GitHub](https://github.com/antvis/infographic) · [文档](https://infographic.antv.vision/learn) · [示例](https://infographic.antv.vision/examples) · [AI 生成](https://infographic.antv.vision/ai)
23
23
 
24
- </div>
24
+ <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*ZdeISZWHuyIAAAAAbEAAAAgAemJ7AQ/fmt.webp" width="768" alt="AntV Infographic 预览">
25
25
 
26
+ </div>
26
27
 
27
28
  ## ✨ 特性
28
29
 
29
30
  - 📦 **开箱即用**:内置 100+ 信息图模板、数据项组件与布局,快速构建专业信息图
30
31
  - 🎨 **主题系统**:支持手绘(rough)、渐变、图案、多套预设主题,并支持深度自定义
31
32
  - 🧩 **组件化架构**:数据项、结构布局、渲染单元完全组件化,可灵活组合与扩展
32
- - 📐 **高质量 SVG 输出**:默认基于 SVG 渲染,保证视觉品质与可编辑性
33
33
  - 🎯 **声明式配置**:简单清晰的配置方式,更适合 AI 生成、机器理解与自动化流程
34
34
  - 🤖 **AI 友好**:完善的 JSON Schema 定义,使大模型可自动生成可用配置
35
+ - 📐 **高质量 SVG 输出**:默认基于 SVG 渲染,保证视觉品质与可编辑性
35
36
 
36
37
  ## 🚀 安装
37
38
 
@@ -67,7 +68,6 @@ infographic.render();
67
68
 
68
69
  更多示例请参考[文档站点](https://infographic.antv.vision/examples)。
69
70
 
70
-
71
71
  ## 💬 社区与交流
72
72
 
73
73
  - 在 GitHub 提交你的问题或建议
@@ -78,8 +78,7 @@ infographic.render();
78
78
 
79
79
  - [AntV 官网](https://antv.antgroup.com/)
80
80
  - [GitHub 仓库](https://github.com/antvis/infographic)
81
- - [问题反馈 Issues](https://github.com/antvis/infographic/issues)
82
-
81
+ - [问题反馈](https://github.com/antvis/infographic/issues)
83
82
 
84
83
  ## 📄 许可证
85
84