foliko 1.0.87 → 1.1.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/.agent/data/default.json +3 -108
- package/.agent/data/plugins-state.json +34 -1
- package/.agent/mcp_config.json +0 -1
- package/.agent/memory/core.md +1 -0
- package/.agent/memory/project/mnn93ogy-ypjn27.md +9 -0
- package/.agent/memory/project/mnn98fqy-5nhc1u.md +25 -0
- package/.agent/memory/user/mnm67t9m-x8rekk.md +9 -0
- package/.agent/memory/user/mnn5mmqh-w6aktx.md +11 -0
- package/.agent/memory/user/mnnbfhhn-dk1bd1.md +22 -0
- package/.agent/plugins/__pycache__/file_writer.cpython-312.pyc +0 -0
- package/.agent/plugins/poster-plugin/README.md +304 -0
- package/.agent/plugins/poster-plugin/fonts/PatuaOne-Regular.ttf +0 -0
- package/.agent/plugins/poster-plugin/fonts//345/276/256/350/275/257/351/233/205/351/273/221.ttf +0 -0
- 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
- package/.agent/plugins/poster-plugin/index.js +13 -0
- package/.agent/plugins/poster-plugin/package.json +28 -0
- package/.agent/plugins/poster-plugin/src/canvas.js +161 -0
- package/.agent/plugins/poster-plugin/src/components/arrow.js +84 -0
- package/.agent/plugins/poster-plugin/src/components/avatar.js +71 -0
- package/.agent/plugins/poster-plugin/src/components/badge.js +85 -0
- package/.agent/plugins/poster-plugin/src/components/card.js +88 -0
- package/.agent/plugins/poster-plugin/src/components/chart.js +127 -0
- package/.agent/plugins/poster-plugin/src/components/chip.js +88 -0
- package/.agent/plugins/poster-plugin/src/components/columns.js +107 -0
- package/.agent/plugins/poster-plugin/src/components/cta.js +85 -0
- package/.agent/plugins/poster-plugin/src/components/divider.js +55 -0
- package/.agent/plugins/poster-plugin/src/components/feature.js +85 -0
- package/.agent/plugins/poster-plugin/src/components/featureGrid.js +112 -0
- package/.agent/plugins/poster-plugin/src/components/grid.js +118 -0
- package/.agent/plugins/poster-plugin/src/components/imageFrame.js +155 -0
- package/.agent/plugins/poster-plugin/src/components/index.js +62 -0
- package/.agent/plugins/poster-plugin/src/components/listItem.js +146 -0
- package/.agent/plugins/poster-plugin/src/components/notification.js +123 -0
- package/.agent/plugins/poster-plugin/src/components/progress.js +79 -0
- package/.agent/plugins/poster-plugin/src/components/progressCircle.js +117 -0
- package/.agent/plugins/poster-plugin/src/components/quote.js +97 -0
- package/.agent/plugins/poster-plugin/src/components/rating.js +85 -0
- package/.agent/plugins/poster-plugin/src/components/star.js +70 -0
- package/.agent/plugins/poster-plugin/src/components/statCard.js +105 -0
- package/.agent/plugins/poster-plugin/src/components/stepper.js +118 -0
- package/.agent/plugins/poster-plugin/src/components/table.js +159 -0
- package/.agent/plugins/poster-plugin/src/components/tagCloud.js +78 -0
- package/.agent/plugins/poster-plugin/src/components/timeline.js +105 -0
- package/.agent/plugins/poster-plugin/src/components/watermark.js +52 -0
- package/.agent/plugins/poster-plugin/src/composer.js +1904 -0
- package/.agent/plugins/poster-plugin/src/elements/artText.js +60 -0
- package/.agent/plugins/poster-plugin/src/elements/background.js +52 -0
- package/.agent/plugins/poster-plugin/src/elements/circle.js +31 -0
- package/.agent/plugins/poster-plugin/src/elements/image.js +71 -0
- package/.agent/plugins/poster-plugin/src/elements/index.js +26 -0
- package/.agent/plugins/poster-plugin/src/elements/line.js +23 -0
- package/.agent/plugins/poster-plugin/src/elements/polygon.js +32 -0
- package/.agent/plugins/poster-plugin/src/elements/rectangle.js +32 -0
- package/.agent/plugins/poster-plugin/src/elements/svg.js +92 -0
- package/.agent/plugins/poster-plugin/src/elements/text.js +38 -0
- package/.agent/plugins/poster-plugin/src/fonts.js +118 -0
- package/.agent/plugins/poster-plugin/src/index.js +1659 -0
- package/.agent/plugins/poster-plugin/src/presets.js +36 -0
- package/.agent/plugins/poster-plugin/src/templates/business.js +60 -0
- package/.agent/plugins/poster-plugin/src/templates/gradient.js +64 -0
- package/.agent/plugins/poster-plugin/src/templates/index.js +43 -0
- package/.agent/plugins/poster-plugin/src/templates/modern.js +69 -0
- package/.agent/plugins/poster-plugin/src/templates/simple.js +58 -0
- package/.agent/plugins/poster-plugin/src/templates/social.js +62 -0
- package/.agent/plugins/poster-plugin/src/templates/tech.js +84 -0
- package/.agent/sessions/cli_default.json +24265 -0
- package/.agent/weixin.json +6 -0
- package/.claude/settings.local.json +5 -8
- package/CLAUDE.md +144 -108
- package/docs/CONTEXT_DESIGN.md +1596 -0
- package/examples/test-concurrent-chat.js +60 -60
- package/output/beef-love-poster.png +0 -0
- package/package.json +2 -2
- package/plugins/default-plugins.js +2 -1
- package/plugins/extension-executor-plugin.js +11 -0
- package/plugins/memory-plugin.js +984 -0
- package/plugins/session-plugin.js +57 -1
- package/plugins/weixin-plugin.js +24 -22
- package/skills/poster-guide/SKILL.md +743 -0
- package/skills/python-plugin-dev/SKILL.md +238 -238
- package/skills/skill-guide/SKILL.md +130 -108
- package/src/capabilities/skill-manager.js +99 -0
- package/src/core/agent-chat.js +538 -138
- package/src/core/agent-context.js +188 -0
- package/src/core/agent.js +6 -2
- package/src/core/context-manager.js +283 -0
- package/src/core/framework.js +264 -3
- package/src/core/plugin-manager.js +79 -2
- package/src/core/request-context.js +98 -0
- package/src/core/session-context.js +341 -0
- package/src/core/session-storage.js +274 -0
- package/src/executors/mcp-executor.js +2 -2
- package/src/utils/index.js +239 -67
- package/src/utils/plugin-helpers.js +17 -0
- package//346/265/267/346/212/245/346/217/222/344/273/266.md +621 -0
- package/.agent/plugins/__pycache__/test_plugin.cpython-312.pyc +0 -0
- package/.agent/plugins/temp-repo/LICENSE +0 -201
- package/.agent/plugins/temp-repo/puppeteer-plugin/README.md +0 -147
- package/.agent/plugins/temp-repo/puppeteer-plugin/index.js +0 -1418
- package/.agent/plugins/temp-repo/puppeteer-plugin/package.json +0 -9
- package/.agent/plugins/test_plugin.py +0 -304
- package/examples/test-chat-debug.js +0 -102
- package/examples/test-chat-result.js +0 -76
- package/examples/test-chat-stream-diff.js +0 -63
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 预设尺寸配置
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const PRESETS = {
|
|
6
|
+
// 海报
|
|
7
|
+
poster_a4: { width: 2480, height: 3508, name: 'A4海报 (300dpi)' },
|
|
8
|
+
poster_square: { width: 2000, height: 2000, name: '方形海报' },
|
|
9
|
+
poster_16_9: { width: 1920, height: 1080, name: '16:9海报' },
|
|
10
|
+
poster_4_3: { width: 1600, height: 1200, name: '4:3海报' },
|
|
11
|
+
poster_9_16: { width: 1080, height: 1920, name: '9:16竖版海报' },
|
|
12
|
+
|
|
13
|
+
// Banner
|
|
14
|
+
banner_1920x500: { width: 1920, height: 500, name: '网站Banner' },
|
|
15
|
+
banner_1200x400: { width: 1200, height: 400, name: '电商Banner' },
|
|
16
|
+
banner_750x300: { width: 750, height: 300, name: '移动端Banner' },
|
|
17
|
+
banner_468x60: { width: 468, height: 60, name: '小横幅' },
|
|
18
|
+
banner_twitter: { width: 1500, height: 500, name: 'Twitter封面' },
|
|
19
|
+
|
|
20
|
+
// 社交媒体
|
|
21
|
+
social_instagram: { width: 1080, height: 1080, name: 'Instagram正方形' },
|
|
22
|
+
social_story: { width: 1080, height: 1920, name: 'Instagram Story' },
|
|
23
|
+
social_facebook: { width: 1200, height: 630, name: 'Facebook封面' },
|
|
24
|
+
social_linkedin: { width: 1200, height: 627, name: 'LinkedIn封面' },
|
|
25
|
+
social_youtube: { width: 2560, height: 1440, name: 'YouTube封面' },
|
|
26
|
+
|
|
27
|
+
// 宣传图
|
|
28
|
+
promo_900x500: { width: 900, height: 500, name: '宣传图' },
|
|
29
|
+
promo_500x500: { width: 500, height: 500, name: '正方宣传图' },
|
|
30
|
+
promo_300x250: { width: 300, height: 250, name: '矩形广告' },
|
|
31
|
+
|
|
32
|
+
// 名片
|
|
33
|
+
card_standard: { width: 1058, height: 640, name: '标准名片 (300dpi)' },
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = PRESETS
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Business(商务专业风格)模板
|
|
3
|
+
* 使用组件化方式实现
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const { createFromConfig } = require('../composer')
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 应用商务风格模板
|
|
10
|
+
*/
|
|
11
|
+
async function applyBusinessTemplate(project, canvas, args) {
|
|
12
|
+
const { title, subtitle, background, accentColor } = args
|
|
13
|
+
const cx = canvas.width / 2
|
|
14
|
+
|
|
15
|
+
const bg = background || '#1e3a5f'
|
|
16
|
+
const accent = accentColor || '#c9a227'
|
|
17
|
+
|
|
18
|
+
const titleFontSize = Math.min(100, canvas.width / 12)
|
|
19
|
+
const subtitleFontSize = Math.min(36, canvas.width / 28)
|
|
20
|
+
|
|
21
|
+
const components = [
|
|
22
|
+
// 背景
|
|
23
|
+
{ type: 'background', color: bg },
|
|
24
|
+
|
|
25
|
+
// 顶部装饰线
|
|
26
|
+
{ type: 'line', x1: 100, y1: 150, x2: canvas.width - 100, y2: 150, stroke: accent, strokeWidth: 4 },
|
|
27
|
+
|
|
28
|
+
// 左侧装饰条
|
|
29
|
+
{ type: 'rectangle', x: 80, y: 150, width: 8, height: canvas.height - 300, fill: accent },
|
|
30
|
+
|
|
31
|
+
// 主标题
|
|
32
|
+
{
|
|
33
|
+
type: 'artText',
|
|
34
|
+
text: title,
|
|
35
|
+
x: cx,
|
|
36
|
+
y: canvas.height / 2 - 20,
|
|
37
|
+
fontSize: titleFontSize,
|
|
38
|
+
gradient: { colors: ['#ffffff', '#e0e0e0'] },
|
|
39
|
+
shadow: { color: 'rgba(0,0,0,0.3)', blur: 10 }
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// 副标题
|
|
43
|
+
...(subtitle ? [{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: subtitle,
|
|
46
|
+
x: cx,
|
|
47
|
+
y: canvas.height / 2 + 60,
|
|
48
|
+
fontSize: subtitleFontSize,
|
|
49
|
+
color: '#cccccc',
|
|
50
|
+
align: 'center'
|
|
51
|
+
}] : []),
|
|
52
|
+
|
|
53
|
+
// 底部装饰线
|
|
54
|
+
{ type: 'line', x1: 100, y1: canvas.height - 150, x2: canvas.width - 100, y2: canvas.height - 150, stroke: accent, strokeWidth: 4 }
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
return await createFromConfig(project, canvas, { components })
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = applyBusinessTemplate
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gradient(渐变风格)模板
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const { createFromConfig } = require('../composer')
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 应用渐变风格模板
|
|
9
|
+
*/
|
|
10
|
+
async function applyGradientTemplate(project, canvas, args) {
|
|
11
|
+
const { title, subtitle, background, accentColor } = args
|
|
12
|
+
const cx = canvas.width / 2
|
|
13
|
+
const cy = canvas.height / 2
|
|
14
|
+
|
|
15
|
+
const bg = background || '#667eea'
|
|
16
|
+
const accent = accentColor || '#764ba2'
|
|
17
|
+
|
|
18
|
+
const titleFontSize = Math.min(120, canvas.width / 10)
|
|
19
|
+
|
|
20
|
+
const components = [
|
|
21
|
+
// 渐变背景
|
|
22
|
+
{
|
|
23
|
+
type: 'background',
|
|
24
|
+
gradient: {
|
|
25
|
+
type: 'radial',
|
|
26
|
+
colors: [bg, accent, '#1a1a2e']
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
// 装饰圆形
|
|
31
|
+
{ type: 'circle', cx: canvas.width * 0.2, cy: canvas.height * 0.2, rx: 100, fill: '#ffffff', opacity: 0.1 },
|
|
32
|
+
{ type: 'circle', cx: canvas.width * 0.8, cy: canvas.height * 0.7, rx: 150, fill: '#ffffff', opacity: 0.08 },
|
|
33
|
+
{ type: 'circle', cx: canvas.width * 0.5, cy: canvas.height * 0.9, rx: 200, fill: '#000000', opacity: 0.2 },
|
|
34
|
+
|
|
35
|
+
// 主标题
|
|
36
|
+
{
|
|
37
|
+
type: 'artText',
|
|
38
|
+
text: title,
|
|
39
|
+
x: cx,
|
|
40
|
+
y: cy - 20,
|
|
41
|
+
fontSize: titleFontSize,
|
|
42
|
+
gradient: { colors: ['#ffffff', '#e0e0e0'] },
|
|
43
|
+
shadow: { color: 'rgba(0,0,0,0.5)', blur: 20 }
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
// 副标题
|
|
47
|
+
...(subtitle ? [{
|
|
48
|
+
type: 'text',
|
|
49
|
+
text: subtitle,
|
|
50
|
+
x: cx,
|
|
51
|
+
y: cy + 80,
|
|
52
|
+
fontSize: 36,
|
|
53
|
+
color: '#ffffff',
|
|
54
|
+
align: 'center'
|
|
55
|
+
}] : []),
|
|
56
|
+
|
|
57
|
+
// 底部装饰线
|
|
58
|
+
{ type: 'line', x1: cx - 150, y1: cy + 150, x2: cx + 150, y2: cy + 150, stroke: '#ffffff', strokeWidth: 2, opacity: 0.5 }
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
return await createFromConfig(project, canvas, { components })
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = applyGradientTemplate
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 模板模块导出
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const applyModernTemplate = require('./modern')
|
|
6
|
+
const applyBusinessTemplate = require('./business')
|
|
7
|
+
const applySocialTemplate = require('./social')
|
|
8
|
+
const applySimpleTemplate = require('./simple')
|
|
9
|
+
const applyTechTemplate = require('./tech')
|
|
10
|
+
const applyGradientTemplate = require('./gradient')
|
|
11
|
+
|
|
12
|
+
const TEMPLATES = {
|
|
13
|
+
modern: applyModernTemplate,
|
|
14
|
+
business: applyBusinessTemplate,
|
|
15
|
+
social: applySocialTemplate,
|
|
16
|
+
simple: applySimpleTemplate,
|
|
17
|
+
tech: applyTechTemplate,
|
|
18
|
+
gradient: applyGradientTemplate,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 应用模板
|
|
23
|
+
*/
|
|
24
|
+
async function applyTemplate(project, canvas, templateName, args) {
|
|
25
|
+
const templateFn = TEMPLATES[templateName]
|
|
26
|
+
if (!templateFn) {
|
|
27
|
+
throw new Error(`Unknown template: ${templateName}. Available: ${Object.keys(TEMPLATES).join(', ')}`)
|
|
28
|
+
}
|
|
29
|
+
return await templateFn(project, canvas, args)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 获取可用模板列表
|
|
34
|
+
*/
|
|
35
|
+
function getAvailableTemplates() {
|
|
36
|
+
return Object.keys(TEMPLATES)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = {
|
|
40
|
+
applyTemplate,
|
|
41
|
+
getAvailableTemplates,
|
|
42
|
+
TEMPLATES,
|
|
43
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modern(现代科技风格)模板
|
|
3
|
+
* 使用组件化方式实现
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const { createFromConfig } = require('../composer')
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 应用现代风格模板
|
|
10
|
+
*/
|
|
11
|
+
async function applyModernTemplate(project, canvas, args) {
|
|
12
|
+
const { title, subtitle, background, accentColor } = args
|
|
13
|
+
const cx = canvas.width / 2
|
|
14
|
+
const cy = canvas.height / 2
|
|
15
|
+
|
|
16
|
+
const bg = background || '#1a1a2e'
|
|
17
|
+
const accent = accentColor || '#00d9ff'
|
|
18
|
+
|
|
19
|
+
// 计算装饰圆形位置
|
|
20
|
+
const circle1X = canvas.width * 0.85
|
|
21
|
+
const circle1Y = canvas.height * 0.15
|
|
22
|
+
const circle2X = canvas.width * 0.1
|
|
23
|
+
const circle2Y = canvas.height * 0.85
|
|
24
|
+
const circle3X = canvas.width * 0.9
|
|
25
|
+
const circle3Y = canvas.height * 0.8
|
|
26
|
+
|
|
27
|
+
// 计算字体大小
|
|
28
|
+
const titleFontSize = Math.min(120, canvas.width / 10)
|
|
29
|
+
const subtitleFontSize = Math.min(40, canvas.width / 25)
|
|
30
|
+
|
|
31
|
+
const components = [
|
|
32
|
+
// 背景
|
|
33
|
+
{ type: 'background', color: bg },
|
|
34
|
+
|
|
35
|
+
// 装饰圆形
|
|
36
|
+
{ type: 'circle', cx: circle1X, cy: circle1Y, rx: 200, fill: accent, opacity: 0.2 },
|
|
37
|
+
{ type: 'circle', cx: circle2X, cy: circle2Y, rx: 150, fill: accent, opacity: 0.15 },
|
|
38
|
+
{ type: 'circle', cx: circle3X, cy: circle3Y, rx: 100, fill: '#00ff88', opacity: 0.1 },
|
|
39
|
+
|
|
40
|
+
// 艺术标题
|
|
41
|
+
{
|
|
42
|
+
type: 'artText',
|
|
43
|
+
text: title,
|
|
44
|
+
x: cx,
|
|
45
|
+
y: cy - 30,
|
|
46
|
+
fontSize: titleFontSize,
|
|
47
|
+
gradient: { colors: [accent, '#00ff88'] },
|
|
48
|
+
shadow: { color: accent, blur: 20 }
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
// 副标题
|
|
52
|
+
...(subtitle ? [{
|
|
53
|
+
type: 'text',
|
|
54
|
+
text: subtitle,
|
|
55
|
+
x: cx,
|
|
56
|
+
y: cy + 80,
|
|
57
|
+
fontSize: subtitleFontSize,
|
|
58
|
+
color: '#aaaaaa',
|
|
59
|
+
align: 'center'
|
|
60
|
+
}] : []),
|
|
61
|
+
|
|
62
|
+
// 分隔线
|
|
63
|
+
{ type: 'line', x1: cx - 200, y1: cy + 50, x2: cx + 200, y2: cy + 50, stroke: accent, strokeWidth: 2 }
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
return await createFromConfig(project, canvas, { components })
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = applyModernTemplate
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple(简约留白风格)模板
|
|
3
|
+
* 使用组件化方式实现
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const { createFromConfig } = require('../composer')
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 应用简约风格模板
|
|
10
|
+
*/
|
|
11
|
+
async function applySimpleTemplate(project, canvas, args) {
|
|
12
|
+
const { title, subtitle, background, accentColor } = args
|
|
13
|
+
const cx = canvas.width / 2
|
|
14
|
+
const cy = canvas.height / 2
|
|
15
|
+
|
|
16
|
+
const bg = background || '#f5f5f5'
|
|
17
|
+
const accent = accentColor || '#333333'
|
|
18
|
+
|
|
19
|
+
const titleFontSize = Math.min(100, canvas.width / 12)
|
|
20
|
+
const subtitleFontSize = Math.min(36, canvas.width / 28)
|
|
21
|
+
|
|
22
|
+
const components = [
|
|
23
|
+
// 背景
|
|
24
|
+
{ type: 'background', color: bg },
|
|
25
|
+
|
|
26
|
+
// 装饰线条
|
|
27
|
+
{ type: 'line', x1: cx - 100, y1: cy - 80, x2: cx + 100, y2: cy - 80, stroke: accent, strokeWidth: 1 },
|
|
28
|
+
|
|
29
|
+
// 主标题
|
|
30
|
+
{
|
|
31
|
+
type: 'artText',
|
|
32
|
+
text: title,
|
|
33
|
+
x: cx,
|
|
34
|
+
y: cy - 20,
|
|
35
|
+
fontSize: titleFontSize,
|
|
36
|
+
gradient: { colors: [accent, '#666666'] },
|
|
37
|
+
shadow: { color: 'rgba(0,0,0,0.1)', blur: 5 }
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
// 副标题
|
|
41
|
+
...(subtitle ? [{
|
|
42
|
+
type: 'text',
|
|
43
|
+
text: subtitle,
|
|
44
|
+
x: cx,
|
|
45
|
+
y: cy + 60,
|
|
46
|
+
fontSize: subtitleFontSize,
|
|
47
|
+
color: '#666666',
|
|
48
|
+
align: 'center'
|
|
49
|
+
}] : []),
|
|
50
|
+
|
|
51
|
+
// 装饰线条
|
|
52
|
+
{ type: 'line', x1: cx - 100, y1: cy + 100, x2: cx + 100, y2: cy + 100, stroke: accent, strokeWidth: 1 }
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
return await createFromConfig(project, canvas, { components })
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = applySimpleTemplate
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Social(社交媒体风格)模板
|
|
3
|
+
* 使用组件化方式实现
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const { createFromConfig } = require('../composer')
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 应用社交媒体风格模板
|
|
10
|
+
*/
|
|
11
|
+
async function applySocialTemplate(project, canvas, args) {
|
|
12
|
+
const { title, subtitle, background, accentColor } = args
|
|
13
|
+
const cx = canvas.width / 2
|
|
14
|
+
const cy = canvas.height / 2
|
|
15
|
+
|
|
16
|
+
const bg = background || '#2d3436'
|
|
17
|
+
const accent = accentColor || '#e84393'
|
|
18
|
+
|
|
19
|
+
const titleFontSize = Math.min(72, canvas.width / 14)
|
|
20
|
+
const subtitleFontSize = Math.min(32, canvas.width / 30)
|
|
21
|
+
const frameRadius = Math.min(250, canvas.width / 3)
|
|
22
|
+
|
|
23
|
+
const components = [
|
|
24
|
+
// 背景
|
|
25
|
+
{ type: 'background', color: bg },
|
|
26
|
+
|
|
27
|
+
// 中心圆形边框
|
|
28
|
+
{ type: 'circle', cx: cx, cy: cy - 50, rx: frameRadius, stroke: accent, strokeWidth: 6, fill: 'transparent' },
|
|
29
|
+
{ type: 'circle', cx: cx, cy: cy - 50, rx: frameRadius - 20, stroke: accent, strokeWidth: 1, opacity: 0.5, fill: 'transparent' },
|
|
30
|
+
|
|
31
|
+
// 主标题
|
|
32
|
+
{
|
|
33
|
+
type: 'artText',
|
|
34
|
+
text: title,
|
|
35
|
+
x: cx,
|
|
36
|
+
y: cy - 30,
|
|
37
|
+
fontSize: titleFontSize,
|
|
38
|
+
gradient: { colors: ['#ffffff', '#e0e0e0'] },
|
|
39
|
+
shadow: { color: accent, blur: 15 }
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// 副标题
|
|
43
|
+
...(subtitle ? [{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: subtitle,
|
|
46
|
+
x: cx,
|
|
47
|
+
y: cy + 40,
|
|
48
|
+
fontSize: subtitleFontSize,
|
|
49
|
+
color: '#dddddd',
|
|
50
|
+
align: 'center'
|
|
51
|
+
}] : []),
|
|
52
|
+
|
|
53
|
+
// 底部装饰点
|
|
54
|
+
{ type: 'circle', cx: cx - 30, cy: cy + 120, rx: 5, fill: accent, opacity: 0.5 },
|
|
55
|
+
{ type: 'circle', cx: cx, cy: cy + 120, rx: 5, fill: accent, opacity: 0.7 },
|
|
56
|
+
{ type: 'circle', cx: cx + 30, cy: cy + 120, rx: 5, fill: accent, opacity: 0.9 }
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
return await createFromConfig(project, canvas, { components })
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = applySocialTemplate
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tech(科技感)模板
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const { createFromConfig } = require('../composer')
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 应用科技风格模板
|
|
9
|
+
*/
|
|
10
|
+
async function applyTechTemplate(project, canvas, args) {
|
|
11
|
+
const { title, subtitle, background, accentColor } = args
|
|
12
|
+
const cx = canvas.width / 2
|
|
13
|
+
const cy = canvas.height / 2
|
|
14
|
+
|
|
15
|
+
const bg = background || '#0a0a0a'
|
|
16
|
+
const accent = accentColor || '#00ff00'
|
|
17
|
+
|
|
18
|
+
const titleFontSize = Math.min(100, canvas.width / 12)
|
|
19
|
+
const subtitleFontSize = Math.min(32, canvas.width / 28)
|
|
20
|
+
|
|
21
|
+
// 计算网格位置
|
|
22
|
+
const gridItems = []
|
|
23
|
+
const cols = 5
|
|
24
|
+
const rows = 3
|
|
25
|
+
const gridWidth = canvas.width * 0.8
|
|
26
|
+
const gridHeight = canvas.height * 0.3
|
|
27
|
+
const cellWidth = gridWidth / cols
|
|
28
|
+
const cellHeight = gridHeight / rows
|
|
29
|
+
const gridX = (canvas.width - gridWidth) / 2
|
|
30
|
+
const gridY = canvas.height * 0.7
|
|
31
|
+
|
|
32
|
+
for (let i = 0; i < cols; i++) {
|
|
33
|
+
for (let j = 0; j < rows; j++) {
|
|
34
|
+
gridItems.push({
|
|
35
|
+
type: 'rectangle',
|
|
36
|
+
x: gridX + i * cellWidth,
|
|
37
|
+
y: gridY + j * cellHeight,
|
|
38
|
+
width: cellWidth - 10,
|
|
39
|
+
height: cellHeight - 10,
|
|
40
|
+
stroke: accent,
|
|
41
|
+
strokeWidth: 0.5,
|
|
42
|
+
opacity: 0.3
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const components = [
|
|
48
|
+
// 背景
|
|
49
|
+
{ type: 'background', color: bg },
|
|
50
|
+
|
|
51
|
+
// 顶部装饰线
|
|
52
|
+
{ type: 'line', x1: 0, y1: 50, x2: canvas.width * 0.3, y2: 50, stroke: accent, strokeWidth: 2 },
|
|
53
|
+
{ type: 'line', x1: canvas.width * 0.7, y1: 50, x2: canvas.width, y2: 50, stroke: accent, strokeWidth: 2 },
|
|
54
|
+
|
|
55
|
+
// 主标题(霓虹效果)
|
|
56
|
+
{
|
|
57
|
+
type: 'artText',
|
|
58
|
+
text: title,
|
|
59
|
+
x: cx,
|
|
60
|
+
y: cy,
|
|
61
|
+
fontSize: titleFontSize,
|
|
62
|
+
gradient: { colors: [accent, '#00ffff'] },
|
|
63
|
+
shadow: { color: accent, blur: 30 }
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
// 副标题
|
|
67
|
+
...(subtitle ? [{
|
|
68
|
+
type: 'text',
|
|
69
|
+
text: subtitle,
|
|
70
|
+
x: cx,
|
|
71
|
+
y: cy + 80,
|
|
72
|
+
fontSize: subtitleFontSize,
|
|
73
|
+
color: '#888888',
|
|
74
|
+
align: 'center'
|
|
75
|
+
}] : []),
|
|
76
|
+
|
|
77
|
+
// 网格装饰
|
|
78
|
+
...gridItems
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
return await createFromConfig(project, canvas, { components })
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = applyTechTemplate
|