foliko 1.0.87 → 1.1.1

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 (259) hide show
  1. package/.agent/.shared/ui-ux-pro-max/data/charts.csv +26 -0
  2. package/.agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
  3. package/.agent/.shared/ui-ux-pro-max/data/icons.csv +101 -0
  4. package/.agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
  5. package/.agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
  6. package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
  7. package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
  8. package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  9. package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  10. package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  11. package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  12. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  13. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  14. package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  15. package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
  16. package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  17. package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  18. package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  19. package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  20. package/.agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
  21. package/.agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
  22. package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  23. package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  24. package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
  25. package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
  26. package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-313.pyc +0 -0
  27. package/.agent/.shared/ui-ux-pro-max/scripts/core.py +258 -0
  28. package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +1067 -0
  29. package/.agent/.shared/ui-ux-pro-max/scripts/search.py +106 -0
  30. package/.agent/ARCHITECTURE.md +288 -0
  31. package/.agent/agents/ambient-agent.md +57 -0
  32. package/.agent/agents/debugger.md +55 -0
  33. package/.agent/agents/email-assistant.md +49 -0
  34. package/.agent/agents/file-manager.md +42 -0
  35. package/.agent/agents/python-developer.md +60 -0
  36. package/.agent/agents/scheduler.md +59 -0
  37. package/.agent/agents/web-developer.md +45 -0
  38. package/.agent/data/default.json +325 -21
  39. package/.agent/data/plugins-state.json +194 -162
  40. package/.agent/data/puppeteer-sessions/undefined.json +6 -0
  41. package/.agent/mcp_config.json +0 -1
  42. package/.agent/mcp_config_updated.json +12 -0
  43. package/.agent/plugins/poster-plugin/README.md +304 -0
  44. package/.agent/plugins/poster-plugin/fonts/NotoColorEmoji-Regular.ttf +0 -0
  45. package/.agent/plugins/poster-plugin/fonts/PatuaOne-Regular.ttf +0 -0
  46. package/.agent/plugins/poster-plugin/fonts//345/276/256/350/275/257/351/233/205/351/273/221.ttf +0 -0
  47. package/.agent/plugins/poster-plugin/fonts//345/276/256/350/275/257/351/233/205/351/273/221/347/262/227/344/275/223.ttf +0 -0
  48. package/.agent/plugins/poster-plugin/index.js +13 -0
  49. package/.agent/plugins/poster-plugin/package.json +28 -0
  50. package/.agent/plugins/poster-plugin/src/canvas.js +161 -0
  51. package/.agent/plugins/poster-plugin/src/components/arrow.js +84 -0
  52. package/.agent/plugins/poster-plugin/src/components/avatar.js +71 -0
  53. package/.agent/plugins/poster-plugin/src/components/badge.js +85 -0
  54. package/.agent/plugins/poster-plugin/src/components/card.js +88 -0
  55. package/.agent/plugins/poster-plugin/src/components/chart.js +127 -0
  56. package/.agent/plugins/poster-plugin/src/components/chip.js +88 -0
  57. package/.agent/plugins/poster-plugin/src/components/columns.js +107 -0
  58. package/.agent/plugins/poster-plugin/src/components/cta.js +85 -0
  59. package/.agent/plugins/poster-plugin/src/components/divider.js +55 -0
  60. package/.agent/plugins/poster-plugin/src/components/feature.js +85 -0
  61. package/.agent/plugins/poster-plugin/src/components/featureGrid.js +112 -0
  62. package/.agent/plugins/poster-plugin/src/components/grid.js +118 -0
  63. package/.agent/plugins/poster-plugin/src/components/imageFrame.js +155 -0
  64. package/.agent/plugins/poster-plugin/src/components/index.js +62 -0
  65. package/.agent/plugins/poster-plugin/src/components/listItem.js +146 -0
  66. package/.agent/plugins/poster-plugin/src/components/notification.js +123 -0
  67. package/.agent/plugins/poster-plugin/src/components/progress.js +79 -0
  68. package/.agent/plugins/poster-plugin/src/components/progressCircle.js +117 -0
  69. package/.agent/plugins/poster-plugin/src/components/quote.js +97 -0
  70. package/.agent/plugins/poster-plugin/src/components/rating.js +85 -0
  71. package/.agent/plugins/poster-plugin/src/components/star.js +70 -0
  72. package/.agent/plugins/poster-plugin/src/components/statCard.js +105 -0
  73. package/.agent/plugins/poster-plugin/src/components/stepper.js +118 -0
  74. package/.agent/plugins/poster-plugin/src/components/table.js +159 -0
  75. package/.agent/plugins/poster-plugin/src/components/tagCloud.js +78 -0
  76. package/.agent/plugins/poster-plugin/src/components/timeline.js +105 -0
  77. package/.agent/plugins/poster-plugin/src/components/watermark.js +52 -0
  78. package/.agent/plugins/poster-plugin/src/composer.js +1904 -0
  79. package/.agent/plugins/poster-plugin/src/elements/artText.js +60 -0
  80. package/.agent/plugins/poster-plugin/src/elements/background.js +52 -0
  81. package/.agent/plugins/poster-plugin/src/elements/circle.js +31 -0
  82. package/.agent/plugins/poster-plugin/src/elements/image.js +71 -0
  83. package/.agent/plugins/poster-plugin/src/elements/index.js +26 -0
  84. package/.agent/plugins/poster-plugin/src/elements/line.js +23 -0
  85. package/.agent/plugins/poster-plugin/src/elements/polygon.js +63 -0
  86. package/.agent/plugins/poster-plugin/src/elements/rectangle.js +32 -0
  87. package/.agent/plugins/poster-plugin/src/elements/svg.js +92 -0
  88. package/.agent/plugins/poster-plugin/src/elements/text.js +107 -0
  89. package/.agent/plugins/poster-plugin/src/fonts.js +233 -0
  90. package/.agent/plugins/poster-plugin/src/index.js +1658 -0
  91. package/.agent/plugins/poster-plugin/src/presets.js +36 -0
  92. package/.agent/plugins/poster-plugin/src/templates/business.js +60 -0
  93. package/.agent/plugins/poster-plugin/src/templates/gradient.js +64 -0
  94. package/.agent/plugins/poster-plugin/src/templates/index.js +43 -0
  95. package/.agent/plugins/poster-plugin/src/templates/modern.js +69 -0
  96. package/.agent/plugins/poster-plugin/src/templates/simple.js +58 -0
  97. package/.agent/plugins/poster-plugin/src/templates/social.js +62 -0
  98. package/.agent/plugins/poster-plugin/src/templates/tech.js +84 -0
  99. package/.agent/plugins/{temp-repo/puppeteer-plugin → puppeteer-plugin}/index.js +1 -1
  100. package/.agent/plugins.json +5 -11
  101. package/.agent/rules/GEMINI.md +273 -0
  102. package/.agent/rules/allow-rule.md +77 -0
  103. package/.agent/rules/log-rule.md +83 -0
  104. package/.agent/rules/security-rule.md +93 -0
  105. package/.agent/scripts/auto_preview.py +148 -0
  106. package/.agent/scripts/checklist.py +217 -0
  107. package/.agent/scripts/session_manager.py +120 -0
  108. package/.agent/scripts/verify_all.py +327 -0
  109. package/.agent/sessions/cli_default.json +419 -0
  110. package/.agent/sessions/weixin_o9cq80zgZqKPA2-s59PN43GdDy1w@im.wechat.json +2195 -0
  111. package/.agent/skills/api-patterns/SKILL.md +81 -0
  112. package/.agent/skills/api-patterns/api-style.md +42 -0
  113. package/.agent/skills/api-patterns/auth.md +24 -0
  114. package/.agent/skills/api-patterns/documentation.md +26 -0
  115. package/.agent/skills/api-patterns/graphql.md +41 -0
  116. package/.agent/skills/api-patterns/rate-limiting.md +31 -0
  117. package/.agent/skills/api-patterns/response.md +37 -0
  118. package/.agent/skills/api-patterns/rest.md +40 -0
  119. package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
  120. package/.agent/skills/api-patterns/security-testing.md +122 -0
  121. package/.agent/skills/api-patterns/trpc.md +41 -0
  122. package/.agent/skills/api-patterns/versioning.md +22 -0
  123. package/.agent/skills/app-builder/SKILL.md +75 -0
  124. package/.agent/skills/app-builder/agent-coordination.md +71 -0
  125. package/.agent/skills/app-builder/feature-building.md +53 -0
  126. package/.agent/skills/app-builder/project-detection.md +34 -0
  127. package/.agent/skills/app-builder/scaffolding.md +118 -0
  128. package/.agent/skills/app-builder/tech-stack.md +40 -0
  129. package/.agent/skills/app-builder/templates/SKILL.md +39 -0
  130. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  131. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  132. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  133. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  134. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
  135. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  136. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  137. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
  138. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
  139. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
  140. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
  141. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
  142. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
  143. package/.agent/skills/architecture/SKILL.md +55 -0
  144. package/.agent/skills/architecture/context-discovery.md +43 -0
  145. package/.agent/skills/architecture/examples.md +94 -0
  146. package/.agent/skills/architecture/pattern-selection.md +68 -0
  147. package/.agent/skills/architecture/patterns-reference.md +50 -0
  148. package/.agent/skills/architecture/trade-off-analysis.md +77 -0
  149. package/.agent/skills/clean-code/SKILL.md +201 -0
  150. package/.agent/skills/doc.md +177 -0
  151. package/.agent/skills/frontend-design/SKILL.md +418 -0
  152. package/.agent/skills/frontend-design/animation-guide.md +331 -0
  153. package/.agent/skills/frontend-design/color-system.md +311 -0
  154. package/.agent/skills/frontend-design/decision-trees.md +418 -0
  155. package/.agent/skills/frontend-design/motion-graphics.md +306 -0
  156. package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  157. package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
  158. package/.agent/skills/frontend-design/typography-system.md +345 -0
  159. package/.agent/skills/frontend-design/ux-psychology.md +1116 -0
  160. package/.agent/skills/frontend-design/visual-effects.md +383 -0
  161. package/.agent/skills/i18n-localization/SKILL.md +154 -0
  162. package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
  163. package/.agent/skills/mcp-builder/SKILL.md +176 -0
  164. package/.agent/skills/web-design-guidelines/SKILL.md +57 -0
  165. package/.agent/workflows/brainstorm.md +113 -0
  166. package/.agent/workflows/create.md +59 -0
  167. package/.agent/workflows/debug.md +103 -0
  168. package/.agent/workflows/deploy.md +176 -0
  169. package/.agent/workflows/enhance.md +63 -0
  170. package/.agent/workflows/orchestrate.md +237 -0
  171. package/.agent/workflows/plan.md +89 -0
  172. package/.agent/workflows/preview.md +81 -0
  173. package/.agent/workflows/simple-test.md +42 -0
  174. package/.agent/workflows/status.md +86 -0
  175. package/.agent/workflows/structured-orchestrate.md +180 -0
  176. package/.agent/workflows/test.md +144 -0
  177. package/.agent/workflows/ui-ux-pro-max.md +296 -0
  178. package/.claude/settings.local.json +20 -8
  179. package/.env.example +56 -56
  180. package/CLAUDE.md +144 -108
  181. package/README.md +441 -441
  182. package/calc_tokens_weixin.js +81 -0
  183. package/cli/src/commands/chat.js +2 -1
  184. package/docs/CONTEXT_DESIGN.md +1596 -0
  185. package/examples/test-concurrent-chat.js +60 -60
  186. package/foliko-creative-3.png +0 -0
  187. package/foliko-creative-4.png +0 -0
  188. package/foliko-creative-5.png +0 -0
  189. package/package.json +2 -2
  190. package/plugins/default-plugins.js +2 -1
  191. package/plugins/extension-executor-plugin.js +91 -2
  192. package/plugins/file-system-plugin.js +2 -2
  193. package/plugins/memory-plugin.js +984 -0
  194. package/plugins/session-plugin.js +57 -1
  195. package/plugins/weixin-plugin.js +33 -23
  196. package/skills/find-skills/AGENTS.md +162 -162
  197. package/skills/find-skills/SKILL.md +133 -133
  198. package/skills/poster-guide/SKILL.md +1059 -0
  199. package/skills/python-plugin-dev/SKILL.md +238 -238
  200. package/skills/skill-guide/SKILL.md +130 -108
  201. package/src/capabilities/skill-manager.js +99 -0
  202. package/src/core/agent-chat.js +620 -141
  203. package/src/core/agent-context.js +188 -0
  204. package/src/core/agent.js +6 -2
  205. package/src/core/context-manager.js +283 -0
  206. package/src/core/framework.js +264 -3
  207. package/src/core/plugin-manager.js +79 -2
  208. package/src/core/request-context.js +98 -0
  209. package/src/core/session-context.js +341 -0
  210. package/src/core/session-storage.js +274 -0
  211. package/src/executors/mcp-executor.js +2 -2
  212. package/src/utils/index.js +239 -67
  213. package/src/utils/plugin-helpers.js +17 -0
  214. package/story-cover-book-v2.png +0 -0
  215. package/story-cover-japanese-1.png +0 -0
  216. package/story-cover-japanese-2.png +0 -0
  217. package/story-cover-japanese-3.png +0 -0
  218. package/story-cover-moran.png +0 -0
  219. package/undefined.png +0 -0
  220. package//346/265/267/346/212/245/346/217/222/344/273/266.md +621 -0
  221. package/.agent/agents/code-assistant.json +0 -14
  222. package/.agent/agents/email-assistant.json +0 -14
  223. package/.agent/agents/file-assistant.json +0 -15
  224. package/.agent/agents/system-assistant.json +0 -15
  225. package/.agent/agents/web-assistant.json +0 -12
  226. package/.agent/data/ambient/goals.json +0 -50
  227. package/.agent/data/ambient/memories.json +0 -7
  228. package/.agent/data/scheduler/tasks.json +0 -1
  229. package/.agent/package.json +0 -8
  230. package/.agent/plugins/__pycache__/test_plugin.cpython-312.pyc +0 -0
  231. package/.agent/plugins/daytona/README.md +0 -89
  232. package/.agent/plugins/daytona/index.js +0 -377
  233. package/.agent/plugins/daytona/package.json +0 -12
  234. package/.agent/plugins/marknative/README.md +0 -134
  235. package/.agent/plugins/marknative/index.js +0 -228
  236. package/.agent/plugins/marknative/package.json +0 -12
  237. package/.agent/plugins/marknative/update-readme.js +0 -134
  238. package/.agent/plugins/system-info/index.js +0 -387
  239. package/.agent/plugins/system-info/package.json +0 -4
  240. package/.agent/plugins/system-info/test.js +0 -40
  241. package/.agent/plugins/temp-repo/LICENSE +0 -201
  242. package/.agent/plugins/test_plugin.py +0 -304
  243. package/.agent/python-scripts/test_sample.py +0 -24
  244. package/.agent/skills/agent-browser/SKILL.md +0 -311
  245. package/.agent/skills/agent-browser/TEST_PLAN.md +0 -200
  246. package/.agent/skills/sysinfo/SKILL.md +0 -38
  247. package/.agent/skills/sysinfo/system-info.sh +0 -130
  248. package/.agent/skills/workflow/SKILL.md +0 -324
  249. package/.agent/workflows/email-digest.json +0 -50
  250. package/.agent/workflows/file-backup.json +0 -21
  251. package/.agent/workflows/get-ip-notify.json +0 -32
  252. package/.agent/workflows/news-aggregator.json +0 -93
  253. package/.agent/workflows/news-dashboard-v2.json +0 -94
  254. package/.agent/workflows/notification-batch.json +0 -32
  255. package/examples/test-chat-debug.js +0 -102
  256. package/examples/test-chat-result.js +0 -76
  257. package/examples/test-chat-stream-diff.js +0 -63
  258. /package/.agent/plugins/{temp-repo/puppeteer-plugin → puppeteer-plugin}/README.md +0 -0
  259. /package/.agent/plugins/{temp-repo/puppeteer-plugin → puppeteer-plugin}/package.json +0 -0
@@ -0,0 +1,304 @@
1
+ # Poster Plugin - 海报制作插件
2
+
3
+ 基于 Paper.js 的海报/Banner 设计插件,支持**组件化**海报生成。
4
+
5
+ ## 功能特性
6
+
7
+ - **预设尺寸**:20+ 常用尺寸(海报、Banner、社交媒体)
8
+ - **基础元素**:矩形、圆形、线条、多边形、图片、文字、艺术文字、图片框
9
+ - **布局组件**:分栏布局、网格布局
10
+ - **装饰组件**:星形、箭头、环形进度条、标签、图表、水印、表格
11
+ - **高级组件**:卡片、徽章、CTA按钮、特性展示、特性网格、分隔线、头像、进度条、评分、引用、统计卡、标签云、步骤条、时间线、列表项、通知
12
+ - **组件化生成**:通过 JSON 配置一次性生成完整海报
13
+ - **模板系统**:modern、business、social、simple、tech、gradient 六种预设模板
14
+
15
+ ## 工具列表(共 35 个组件)
16
+
17
+ ### 画布管理
18
+ | 工具 | 描述 |
19
+ |------|------|
20
+ | `list_poster_presets` | 列出所有预设尺寸 |
21
+ | `create_poster_canvas` | 创建新画布 |
22
+ | `get_poster_canvas_info` | 获取画布信息 |
23
+ | `clear_poster_canvas` | 清除画布 |
24
+ | `export_poster_canvas` | 导出为 PNG 文件 |
25
+ | `export_poster_svg` | 导出为 SVG 矢量图 |
26
+ | `export_poster_base64` | 导出为 Base64 |
27
+
28
+ ### 基础元素 (10)
29
+ | 工具 | 描述 |
30
+ |------|------|
31
+ | `add_poster_background` | 添加纯色/渐变背景 |
32
+ | `add_poster_rectangle` | 添加矩形 |
33
+ | `add_poster_circle` | 添加圆形/椭圆 |
34
+ | `add_poster_line` | 添加线条 |
35
+ | `add_poster_polygon` | 添加多边形 |
36
+ | `add_poster_text` | 添加文字 |
37
+ | `add_poster_art_text` | 添加艺术文字(渐变/描边) |
38
+ | `add_poster_image` | 添加图片 |
39
+ | `add_poster_svg` | 添加 SVG 矢量图 |
40
+ | `add_poster_image_frame` | 添加图片框(带装饰边框) |
41
+
42
+ ### 布局组件 (2)
43
+ | 工具 | 描述 |
44
+ |------|------|
45
+ | `add_poster_columns` | 分栏布局(左右分栏、多栏) |
46
+ | `add_poster_grid` | 网格布局(任意行列) |
47
+
48
+ ### 装饰组件 (7)
49
+ | 工具 | 描述 |
50
+ |------|------|
51
+ | `add_poster_star` | 星形/多角形装饰 |
52
+ | `add_poster_arrow` | 箭头指示 |
53
+ | `add_poster_progress_circle` | 环形进度条 |
54
+ | `add_poster_chip` | 小型标签 |
55
+ | `add_poster_chart` | 图表(柱状图、饼图) |
56
+ | `add_poster_watermark` | 水印文字 |
57
+ | `add_poster_table` | 数据表格 |
58
+
59
+ ### 高级组件 (16)
60
+ | 工具 | 描述 |
61
+ |------|------|
62
+ | `add_poster_card` | 卡片组件 |
63
+ | `add_poster_badge` | 徽章/标签 |
64
+ | `add_poster_cta` | CTA 行动号召按钮 |
65
+ | `add_poster_feature` | 特性展示块 |
66
+ | `add_poster_feature_grid` | 特性网格布局 |
67
+ | `add_poster_divider` | 分隔线 |
68
+ | `add_poster_avatar` | 用户头像 |
69
+ | `add_poster_progress` | 线性进度条 |
70
+ | `add_poster_rating` | 星级评分 |
71
+ | `add_poster_quote` | 引用块 |
72
+ | `add_poster_stat_card` | 统计卡片 |
73
+ | `add_poster_tag_cloud` | 标签云 |
74
+ | `add_poster_stepper` | 步骤指示器 |
75
+ | `add_poster_timeline` | 时间线 |
76
+ | `add_poster_list_item` | 列表项 |
77
+ | `add_poster_notification` | 通知提示 |
78
+
79
+ ### 组件化生成 & 模板
80
+ | 工具 | 描述 |
81
+ |------|------|
82
+ | `compose_poster` | 使用组件配置生成海报 |
83
+ | `list_poster_components` | 列出可用组件类型 |
84
+ | `generate_poster` | 一键生成海报(6种模板) |
85
+ | `list_poster_templates` | 列出可用模板 |
86
+
87
+ ## 预设尺寸
88
+
89
+ | Key | 尺寸 | 名称 |
90
+ |-----|------|------|
91
+ | `poster_a4` | 2480×3508 | A4海报 (300dpi) |
92
+ | `poster_square` | 2000×2000 | 方形海报 |
93
+ | `poster_16_9` | 1920×1080 | 16:9海报 |
94
+ | `poster_9_16` | 1080×1920 | 9:16竖版海报 |
95
+ | `banner_1920x500` | 1920×500 | 网站Banner |
96
+ | `banner_twitter` | 1500×500 | Twitter封面 |
97
+ | `social_instagram` | 1080×1080 | Instagram正方形 |
98
+ | `social_story` | 1080×1920 | Instagram Story |
99
+ | `social_facebook` | 1200×630 | Facebook封面 |
100
+ | `social_linkedin` | 1200×627 | LinkedIn封面 |
101
+ | `social_youtube` | 2560×1440 | YouTube封面 |
102
+
103
+ ## 使用示例
104
+
105
+ ### 1. 组件化生成(推荐)
106
+
107
+ ```javascript
108
+ compose_poster({
109
+ components: [
110
+ // 背景
111
+ { type: 'background', color: '#1a1a2e' },
112
+
113
+ // 装饰圆形
114
+ { type: 'circle', cx: 1600, cy: 200, rx: 200, fill: '#00d9ff', opacity: 0.3 },
115
+
116
+ // 星形装饰
117
+ { type: 'star', cx: 200, cy: 200, points: 5, outerRadius: 60, fill: '#fbbf24' },
118
+
119
+ // 主标题
120
+ { type: 'artText', text: 'VB-Agent', x: 960, y: 400, fontSize: 120,
121
+ gradient: { colors: ['#00d9ff', '#00ff88'] } },
122
+
123
+ // 环形进度条
124
+ { type: 'progressCircle', cx: 400, cy: 600, radius: 80, value: 85,
125
+ strokeWidth: 15, fillColor: '#3b82f6', showLabel: true },
126
+ { type: 'progressCircle', cx: 700, cy: 600, radius: 80, value: 92,
127
+ strokeWidth: 15, fillColor: '#10b981', showLabel: true },
128
+
129
+ // 图表
130
+ { type: 'chart', type: 'bar', x: 1100, y: 450, width: 400, height: 250,
131
+ data: [
132
+ { label: '一月', value: 120, color: '#3b82f6' },
133
+ { label: '二月', value: 90, color: '#10b981' },
134
+ { label: '三月', value: 150, color: '#f59e0b' }
135
+ ],
136
+ showLabels: true, showValues: true },
137
+
138
+ // 数据表格
139
+ { type: 'table', x: 100, y: 700, width: 800,
140
+ columns: [
141
+ { title: '功能', width: 300, align: 'left' },
142
+ { title: '状态', width: 200 },
143
+ { title: '价格', width: 150 }
144
+ ],
145
+ rows: [
146
+ ['智能对话', '可用', '免费'],
147
+ ['图片生成', '可用', '$29'],
148
+ ['代码助手', 'Beta', '免费']
149
+ ],
150
+ headerBg: '#1e293b', headerColor: '#ffffff', striped: true },
151
+
152
+ // 标签
153
+ { type: 'chip', x: 400, y: 850, text: 'AI驱动', background: '#3b82f6', color: '#ffffff' },
154
+ { type: 'chip', x: 550, y: 850, text: '开源', background: '#10b981', color: '#ffffff' },
155
+
156
+ // 水印
157
+ { type: 'watermark', text: 'VB-Agent', cx: 960, cy: 1000, fontSize: 200,
158
+ color: 'rgba(255,255,255,0.03)', rotation: -15 },
159
+
160
+ // CTA 按钮
161
+ { type: 'cta', x: 960, y: 950, text: '立即体验 →',
162
+ background: '#00d9ff', color: '#0a0a0f', fontSize: 24, radius: 30 }
163
+ ]
164
+ })
165
+ export_poster_canvas({ filename: 'my-poster', outputDir: '.' })
166
+ ```
167
+
168
+ ### 2. 基础使用
169
+
170
+ ```javascript
171
+ // 创建画布
172
+ create_poster_canvas({ preset: 'poster_square', background: '#1a1a2e' })
173
+
174
+ // 添加元素
175
+ add_poster_circle({ cx: 500, cy: 500, rx: 100, fill: '#00d9ff' })
176
+ add_poster_text({ text: 'Hello Foliko', x: 500, y: 600, fontSize: 48, color: '#ffffff', align: 'center' })
177
+
178
+ // 导出
179
+ export_poster_canvas({ filename: 'my-poster' })
180
+ ```
181
+
182
+ ## 新增组件详解
183
+
184
+ ### 星形 (star)
185
+ ```javascript
186
+ add_poster_star({
187
+ cx: 200, cy: 200, // 中心坐标
188
+ points: 5, // 星形点数
189
+ outerRadius: 60, // 外半径
190
+ fill: '#fbbf24', // 填充颜色
191
+ rotation: 0 // 旋转角度
192
+ })
193
+ ```
194
+
195
+ ### 环形进度条 (progressCircle)
196
+ ```javascript
197
+ add_poster_progress_circle({
198
+ cx: 200, cy: 200, // 圆心坐标
199
+ radius: 80, // 圆环半径
200
+ value: 75, // 进度值 0-100
201
+ strokeWidth: 15, // 环宽度
202
+ trackColor: '#e5e7eb', // 轨道颜色
203
+ fillColor: '#3b82f6', // 进度颜色
204
+ backgroundColor: '#ffffff', // 背景填充
205
+ showLabel: true // 显示百分比
206
+ })
207
+ ```
208
+
209
+ ### 图表 (chart)
210
+ ```javascript
211
+ // 柱状图
212
+ add_poster_chart({
213
+ type: 'bar', // bar 或 pie
214
+ x: 100, y: 300,
215
+ width: 500, height: 250,
216
+ data: [
217
+ { label: '一月', value: 120, color: '#3b82f6' },
218
+ { label: '二月', value: 90, color: '#10b981' }
219
+ ],
220
+ showLabels: true,
221
+ showValues: true
222
+ })
223
+
224
+ // 饼图
225
+ add_poster_chart({
226
+ type: 'pie',
227
+ x: 700, y: 300,
228
+ width: 250, height: 250,
229
+ data: [
230
+ { label: 'A', value: 45, color: '#3b82f6' },
231
+ { label: 'B', value: 35, color: '#10b981' },
232
+ { label: 'C', value: 20, color: '#f59e0b' }
233
+ ],
234
+ showLabels: true
235
+ })
236
+ ```
237
+
238
+ ### 表格 (table)
239
+ ```javascript
240
+ add_poster_table({
241
+ x: 100, y: 400,
242
+ width: 800,
243
+ columns: [
244
+ { title: '功能', width: 300, align: 'left' },
245
+ { title: '状态', width: 200 }
246
+ ],
247
+ rows: [
248
+ ['智能对话', '可用'],
249
+ ['代码助手', 'Beta']
250
+ ],
251
+ headerBg: '#1e293b',
252
+ headerColor: '#ffffff',
253
+ striped: true
254
+ })
255
+ ```
256
+
257
+ ### 标签 (chip)
258
+ ```javascript
259
+ add_poster_chip({
260
+ x: 200, y: 300,
261
+ text: 'NEW', // 标签文字
262
+ background: '#ef4444', // 背景色
263
+ color: '#ffffff', // 文字颜色
264
+ fontSize: 14,
265
+ radius: 16, // 圆角
266
+ icon: '⭐' // 前置图标(可选)
267
+ })
268
+ ```
269
+
270
+ ## 项目结构
271
+
272
+ ```
273
+ poster-plugin/
274
+ ├── index.js # 插件入口
275
+ ├── package.json # 包配置
276
+ ├── README.md # 文档
277
+ ├── src/
278
+ │ ├── index.js # 主模块
279
+ │ ├── canvas.js # 画布管理器
280
+ │ ├── presets.js # 预设尺寸
281
+ │ ├── fonts.js # 字体管理
282
+ │ ├── composer.js # 组件化生成器
283
+ │ ├── elements/ # 基础元素
284
+ │ ├── components/ # 高级组件
285
+ │ └── templates/ # 模板
286
+ └── fonts/ # 字体文件
287
+ ```
288
+
289
+ ## 更新日志
290
+
291
+ ### v1.2.0
292
+ - 新增布局组件:columns(分栏)、grid(网格)
293
+ - 新增装饰组件:star(星形)、arrow(箭头)、progressCircle(环形进度条)
294
+ - 新增 chip(标签)、chart(图表)、watermark(水印)、table(表格)
295
+ - 新增 imageFrame(图片框)
296
+ - 组件总数达到 **35 个**
297
+ - 模板新增 tech(科技)、gradient(渐变)
298
+ - 修复环形进度条绘制逻辑
299
+
300
+ ### v1.1.0
301
+ - 重构为模块化架构
302
+ - 新增组件化海报生成(compose_poster)
303
+ - 新增高级组件:card, badge, cta, feature, featureGrid, divider
304
+ - 新增组件:avatar, progress, rating, quote, statCard, tagCloud, stepper, timeline, listItem, notification
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Poster Plugin - 海报制作插件
3
+ *
4
+ * 模块化架构,支持组件化海报生成
5
+ *
6
+ * 使用方法:
7
+ * 1. 基础元素:add_poster_rectangle, add_poster_circle, add_poster_text 等
8
+ * 2. 高级组件:add_poster_card, add_poster_badge, add_poster_cta 等
9
+ * 3. 组件化生成:compose_poster - 通过配置 JSON 一次性生成海报
10
+ * 4. 模板生成:generate_poster - 一键使用预设模板
11
+ */
12
+
13
+ module.exports = require('./src/index.js')
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "poster-plugin",
3
+ "version": "1.2.0",
4
+ "description": "海报/Banner 设计插件 - 基于 Paper.js 实现,支持 35 个组件",
5
+ "main": "index.js",
6
+ "dependencies": {
7
+ "canvas": "^3.2.0",
8
+ "fontkit": "^2.0.4",
9
+ "jsdom": "^16.2.2",
10
+ "paper": "^0.12.18"
11
+ },
12
+ "overrides": {
13
+ "canvas": "^3.2.0"
14
+ },
15
+ "resolutions": {
16
+ "**/canvas": "^3.2.0"
17
+ },
18
+ "author": "",
19
+ "license": "MIT",
20
+ "keywords": [
21
+ "poster",
22
+ "banner",
23
+ "design",
24
+ "canvas",
25
+ "paper.js",
26
+ "foliko"
27
+ ]
28
+ }
@@ -0,0 +1,161 @@
1
+ /**
2
+ * 画布管理模块
3
+ */
4
+
5
+ const paper = require('paper')
6
+ const PRESETS = require('./presets')
7
+
8
+ /**
9
+ * 画布管理器类
10
+ */
11
+ class CanvasManager {
12
+ constructor() {
13
+ this._canvas = null
14
+ this._project = null
15
+ this._paper = null
16
+ this._width = 0
17
+ this._height = 0
18
+ }
19
+
20
+ /**
21
+ * 创建画布
22
+ */
23
+ create({ preset, width, height, background }) {
24
+ let w, h
25
+
26
+ if (preset) {
27
+ const presetConfig = PRESETS[preset]
28
+ if (!presetConfig) {
29
+ throw new Error(`Unknown preset: ${preset}. Available: ${Object.keys(PRESETS).join(', ')}`)
30
+ }
31
+ w = presetConfig.width
32
+ h = presetConfig.height
33
+ } else if (width && height) {
34
+ w = width
35
+ h = height
36
+ } else {
37
+ throw new Error('Must provide preset or width/height')
38
+ }
39
+
40
+ this._canvas = paper.createCanvas(w, h)
41
+ this._project = new paper.Project(this._canvas)
42
+ // 确保活动层存在
43
+ if (!paper.project || !paper.project.activeLayer) {
44
+ paper.setup(this._canvas)
45
+ }
46
+ this._paper = paper
47
+ this._width = w
48
+ this._height = h
49
+
50
+ // 添加背景
51
+ if (background) {
52
+ const bg = new paper.Path.Rectangle({
53
+ point: [0, 0],
54
+ size: [w, h],
55
+ fillColor: background,
56
+ })
57
+ bg.sendToBack()
58
+ }
59
+
60
+ return {
61
+ width: w,
62
+ height: h,
63
+ preset: preset || 'custom',
64
+ background: background || null,
65
+ }
66
+ }
67
+
68
+ /**
69
+ * 获取画布
70
+ */
71
+ getCanvas() {
72
+ return this._canvas
73
+ }
74
+
75
+ /**
76
+ * 获取 Paper.js 项目
77
+ */
78
+ getProject() {
79
+ return this._project
80
+ }
81
+
82
+ /**
83
+ * 获取画布尺寸
84
+ */
85
+ getSize() {
86
+ return { width: this._width, height: this._height }
87
+ }
88
+
89
+ /**
90
+ * 获取中心点
91
+ */
92
+ getCenter() {
93
+ return { x: this._width / 2, y: this._height / 2 }
94
+ }
95
+
96
+ /**
97
+ * 清除画布
98
+ */
99
+ clear() {
100
+ if (this._project) {
101
+ this._project.activeLayer.removeChildren()
102
+ }
103
+ }
104
+
105
+ /**
106
+ * 获取元素数量
107
+ */
108
+ getElementCount() {
109
+ return this._project ? this._project.activeLayer.children.length : 0
110
+ }
111
+
112
+ /**
113
+ * 导出为 Buffer
114
+ */
115
+ toBuffer(format = 'png', quality) {
116
+ if (!this._canvas) {
117
+ throw new Error('No canvas created')
118
+ }
119
+
120
+ this._project.view.update()
121
+ this._project.view.draw()
122
+
123
+ const mimeType = format === 'jpg' ? 'image/jpeg' : 'image/png'
124
+ return this._canvas.toBuffer(mimeType, quality)
125
+ }
126
+
127
+ /**
128
+ * 导出为 Base64
129
+ */
130
+ toBase64(format = 'png', quality) {
131
+ if (!this._canvas) {
132
+ throw new Error('No canvas created')
133
+ }
134
+
135
+ this._project.view.update()
136
+ this._project.view.draw()
137
+
138
+ const mimeType = format === 'jpg' ? 'image/jpeg' : 'image/png'
139
+ return this._canvas.toDataURL(mimeType, quality)
140
+ }
141
+
142
+ /**
143
+ * 检查画布是否已创建
144
+ */
145
+ isCreated() {
146
+ return this._canvas !== null
147
+ }
148
+
149
+ /**
150
+ * 重置画布
151
+ */
152
+ reset() {
153
+ this._canvas = null
154
+ this._project = null
155
+ this._paper = null
156
+ this._width = 0
157
+ this._height = 0
158
+ }
159
+ }
160
+
161
+ module.exports = CanvasManager
@@ -0,0 +1,84 @@
1
+ /**
2
+ * 箭头组件
3
+ */
4
+
5
+ const paper = require('paper')
6
+
7
+ /**
8
+ * 创建箭头组件
9
+ */
10
+ function createArrow(project, canvas, params) {
11
+ const {
12
+ x1, y1, x2, y2,
13
+ color = '#333333',
14
+ strokeWidth = 2,
15
+ headSize = 12,
16
+ style = 'solid',
17
+ direction = 'end'
18
+ } = params
19
+
20
+ const elements = []
21
+
22
+ // 创建主线
23
+ const line = new paper.Path.Line({
24
+ from: [x1, y1],
25
+ to: [x2, y2]
26
+ })
27
+ line.strokeColor = new paper.Color(color)
28
+ line.strokeWidth = strokeWidth
29
+ if (style === 'dashed') {
30
+ line.dashArray = [10, 5]
31
+ }
32
+
33
+ if (project && project.activeLayer) {
34
+ project.activeLayer.addChild(line)
35
+ }
36
+ elements.push({ type: 'line', id: line.id })
37
+
38
+ // 创建箭头头部
39
+ function createArrowHead(x, y, angle) {
40
+ const path = new paper.Path()
41
+ const angle1 = angle + Math.PI * 0.8
42
+ const angle2 = angle - Math.PI * 0.8
43
+
44
+ path.moveTo(x, y)
45
+ path.lineTo(
46
+ x + headSize * Math.cos(angle1),
47
+ y + headSize * Math.sin(angle1)
48
+ )
49
+ path.moveTo(x, y)
50
+ path.lineTo(
51
+ x + headSize * Math.cos(angle2),
52
+ y + headSize * Math.sin(angle2)
53
+ )
54
+
55
+ path.strokeColor = new paper.Color(color)
56
+ path.strokeWidth = strokeWidth
57
+ path.strokeCap = 'round'
58
+
59
+ if (project && project.activeLayer) {
60
+ project.activeLayer.addChild(path)
61
+ }
62
+ return path
63
+ }
64
+
65
+ const angle = Math.atan2(y2 - y1, x2 - x1)
66
+
67
+ if (direction === 'end' || direction === 'both') {
68
+ const head = createArrowHead(x2, y2, angle)
69
+ elements.push({ type: 'path', id: head.id })
70
+ }
71
+
72
+ if (direction === 'start' || direction === 'both') {
73
+ const head = createArrowHead(x1, y1, angle + Math.PI)
74
+ elements.push({ type: 'path', id: head.id })
75
+ }
76
+
77
+ return {
78
+ success: true,
79
+ elements,
80
+ type: 'arrow'
81
+ }
82
+ }
83
+
84
+ module.exports = createArrow
@@ -0,0 +1,71 @@
1
+ /**
2
+ * 头像组件
3
+ */
4
+
5
+ const paper = require('paper')
6
+
7
+ /**
8
+ * 创建头像
9
+ *
10
+ * @param {Object} project - Paper.js 项目
11
+ * @param {Object} canvas - 画布对象
12
+ * @param {Object} args - 组件参数
13
+ * @param {number} args.x - 圆心X坐标
14
+ * @param {number} args.y - 圆心Y坐标
15
+ * @param {number} args.size - 头像大小
16
+ * @param {string} args.src - 图片路径(可选,不提供则显示首字母)
17
+ * @param {string} args.initials - 首字母(无图片时显示)
18
+ * @param {string} args.background - 背景色
19
+ * @param {string} args.border - 边框颜色
20
+ * @param {number} args.borderWidth - 边框宽度
21
+ * @param {string} args.color - 文字颜色
22
+ */
23
+ function createAvatar(project, canvas, args) {
24
+ const {
25
+ x, y,
26
+ size = 80,
27
+ src,
28
+ initials,
29
+ background = '#6366f1',
30
+ border,
31
+ borderWidth = 0,
32
+ color = '#ffffff',
33
+ } = args
34
+
35
+ const elements = []
36
+ const radius = size / 2
37
+
38
+ // 绘制圆形背景
39
+ const circle = new paper.Path.Circle({
40
+ center: [x, y],
41
+ radius: radius,
42
+ })
43
+ circle.fillColor = new paper.Color(background)
44
+
45
+ if (border) {
46
+ circle.strokeColor = new paper.Color(border)
47
+ circle.strokeWidth = borderWidth
48
+ }
49
+
50
+ elements.push({ type: 'circle', id: circle.id })
51
+
52
+ // 如果没有图片,显示首字母
53
+ if (!src && initials) {
54
+ const text = new paper.PointText({
55
+ point: [x, y + size / 6],
56
+ content: initials.charAt(0).toUpperCase(),
57
+ fontSize: size * 0.4,
58
+ fillColor: new paper.Color(color),
59
+ justification: 'center',
60
+ })
61
+ elements.push({ type: 'text', id: text.id })
62
+ }
63
+
64
+ return {
65
+ success: true,
66
+ elements,
67
+ size,
68
+ }
69
+ }
70
+
71
+ module.exports = createAvatar