dsh-ppt 0.22.1 → 0.23.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.
- package/CHANGELOG.md +14 -0
- package/README.en.md +33 -19
- package/README.md +34 -19
- package/docs/REFERENCE.en.md +3 -3
- package/docs/REFERENCE.zh.md +3 -3
- package/docs/USAGE.en.md +3 -3
- package/docs/USAGE.md +3 -3
- package/docs/WORKBENCH.md +2 -2
- package/docs/assets/intro/screen-en.webp +0 -0
- package/docs/assets/intro/screen-zh.webp +0 -0
- package/lib/client.js +543 -76
- package/lib/config.d.ts +1 -1
- package/lib/config.js +6 -0
- package/lib/tools.js +17 -9
- package/lib/types.d.ts +10 -3
- package/lib/workbench-language.js +4 -0
- package/lib/workbench.js +132 -17
- package/package.json +2 -2
- package/skills/dsh-ppt/SKILL.md +6 -6
- package/skills/dsh-ppt/package.json +17 -5
- package/skills/dsh-ppt/references/advanced.md +4 -3
- package/skills/dsh-ppt/references/syntax.md +1 -1
- package/skills/dsh-ppt/references/themes.md +10 -4
- package/skills/dsh-ppt/scripts/build-deck.mjs +4 -4
- package/skills/dsh-ppt/scripts/deck-absorb.mjs +419 -110
- package/skills/dsh-ppt/scripts/deck-advanced.mjs +22 -12
- package/skills/dsh-ppt/scripts/deck-core.mjs +4 -0
- package/skills/dsh-ppt/scripts/deck-director.mjs +343 -3
- package/skills/dsh-ppt/scripts/deck-layouts.mjs +116 -0
- package/skills/dsh-ppt/scripts/deck-themes.mjs +364 -13
|
@@ -1026,6 +1026,314 @@ export const THEMES = {
|
|
|
1026
1026
|
},
|
|
1027
1027
|
fonts: { heading: SERIF_HEADING_STACK, body: SANS_STACK },
|
|
1028
1028
|
}),
|
|
1029
|
+
|
|
1030
|
+
// 18..23: 6 Absorbed World-Class Benchmark Themes (BCG, Economist, Venture Daylight, Stripe Craft, Aurora, Terminal)
|
|
1031
|
+
'bcg-emerald': makeTheme({
|
|
1032
|
+
id: 'bcg-emerald',
|
|
1033
|
+
name: { zh: '翡翠战略', en: 'Emerald Strategy' },
|
|
1034
|
+
mood: { zh: '顶级绿金咨询、增长转型、锋利高管矩阵', en: 'BCG-grade emerald authority, growth & sustainability' },
|
|
1035
|
+
bestFor: { zh: '增长战略、业务转型、ESG双碳、OKR季度复盘', en: 'Growth strategy, ESG transformation, quarterly OKR reviews' },
|
|
1036
|
+
persona: 'consulting',
|
|
1037
|
+
dark: false,
|
|
1038
|
+
radiusPx: 4,
|
|
1039
|
+
shadow: false,
|
|
1040
|
+
defaultTableStyle: 'consulting',
|
|
1041
|
+
chromeStyle: 'consulting-classic',
|
|
1042
|
+
palette: {
|
|
1043
|
+
bg: '#FFFFFF',
|
|
1044
|
+
panel: '#F1F7F4',
|
|
1045
|
+
fg: '#0D1F18',
|
|
1046
|
+
muted: '#4A6157',
|
|
1047
|
+
accent: '#006B54',
|
|
1048
|
+
accent2: '#0F4C81',
|
|
1049
|
+
},
|
|
1050
|
+
tokens: {
|
|
1051
|
+
canvas: '#FFFFFF',
|
|
1052
|
+
surface1: '#F1F7F4',
|
|
1053
|
+
surface2: '#E3EFE9',
|
|
1054
|
+
hairline: '#C8DDD3',
|
|
1055
|
+
inkPrimary: '#0D1F18',
|
|
1056
|
+
inkSecondary: '#2C4239',
|
|
1057
|
+
inkMuted: '#4A6157',
|
|
1058
|
+
accentPrimary: '#006B54',
|
|
1059
|
+
accentText: '#005A46',
|
|
1060
|
+
accentSecondary: '#0F4C81',
|
|
1061
|
+
accent2Text: '#0D416E',
|
|
1062
|
+
chartNeutral: '#C9D8D0',
|
|
1063
|
+
chartSeries: ['#006B54', '#0F4C81', '#1F2937', '#0D9488', '#B45309', '#64748B'],
|
|
1064
|
+
},
|
|
1065
|
+
fonts: { heading: SANS_STACK, body: SANS_STACK },
|
|
1066
|
+
}),
|
|
1067
|
+
'economist-brief': makeTheme({
|
|
1068
|
+
id: 'economist-brief',
|
|
1069
|
+
name: { zh: '社论红标', en: 'Economist Briefing' },
|
|
1070
|
+
mood: { zh: '经济学人红标书脊、智库级图表、衬线洞察', en: 'Economist red-tab folio, think-tank rigor, editorial serif' },
|
|
1071
|
+
bestFor: { zh: '行业研究、宏观洞察、智库白皮书、并购尽调', en: 'Macro briefings, industry research, think-tank & M&A memos' },
|
|
1072
|
+
persona: 'consulting',
|
|
1073
|
+
dark: false,
|
|
1074
|
+
radiusPx: 0,
|
|
1075
|
+
shadow: false,
|
|
1076
|
+
defaultTableStyle: 'booktabs',
|
|
1077
|
+
chromeStyle: 'editorial-folio',
|
|
1078
|
+
palette: {
|
|
1079
|
+
bg: '#F9F8F5',
|
|
1080
|
+
panel: '#F0EDE6',
|
|
1081
|
+
fg: '#141413',
|
|
1082
|
+
muted: '#57534B',
|
|
1083
|
+
accent: '#C8102E',
|
|
1084
|
+
accent2: '#1D3557',
|
|
1085
|
+
},
|
|
1086
|
+
tokens: {
|
|
1087
|
+
canvas: '#F9F8F5',
|
|
1088
|
+
surface1: '#F0EDE6',
|
|
1089
|
+
surface2: '#E5E0D6',
|
|
1090
|
+
hairline: '#CFC8BA',
|
|
1091
|
+
inkPrimary: '#141413',
|
|
1092
|
+
inkSecondary: '#383631',
|
|
1093
|
+
inkMuted: '#57534B',
|
|
1094
|
+
accentPrimary: '#C8102E',
|
|
1095
|
+
accentText: '#A60D25',
|
|
1096
|
+
accentSecondary: '#1D3557',
|
|
1097
|
+
accent2Text: '#1D3557',
|
|
1098
|
+
chartNeutral: '#CCC5B7',
|
|
1099
|
+
chartSeries: ['#C8102E', '#1D3557', '#0F766E', '#6D4C3D', '#3B5998', '#6B665E'],
|
|
1100
|
+
},
|
|
1101
|
+
fonts: { heading: SERIF_HEADING_STACK, body: SANS_STACK },
|
|
1102
|
+
}),
|
|
1103
|
+
'venture-daylight': makeTheme({
|
|
1104
|
+
id: 'venture-daylight',
|
|
1105
|
+
name: { zh: '硅谷创投白', en: 'Venture Daylight' },
|
|
1106
|
+
mood: { zh: '红杉/YC日间阅读风、清爽高锐度、数据抓手', en: 'Sequoia/YC partner-memo clarity, crisp daylight pitch' },
|
|
1107
|
+
bestFor: { zh: '创投BP(邮件/iPad阅读版)、商业计划书、新业务立项', en: 'Daylight investor decks, partner memos, venture proposals' },
|
|
1108
|
+
persona: 'tech-pitch',
|
|
1109
|
+
dark: false,
|
|
1110
|
+
radiusPx: 12,
|
|
1111
|
+
shadow: false,
|
|
1112
|
+
defaultTableStyle: 'consulting',
|
|
1113
|
+
chromeStyle: 'keynote-spatial',
|
|
1114
|
+
palette: {
|
|
1115
|
+
bg: '#FFFFFF',
|
|
1116
|
+
panel: '#F6F7F9',
|
|
1117
|
+
fg: '#111827',
|
|
1118
|
+
muted: '#525B66',
|
|
1119
|
+
accent: '#C2410C',
|
|
1120
|
+
accent2: '#0F766E',
|
|
1121
|
+
},
|
|
1122
|
+
tokens: {
|
|
1123
|
+
canvas: '#FFFFFF',
|
|
1124
|
+
surface1: '#F6F7F9',
|
|
1125
|
+
surface2: '#ECEEF2',
|
|
1126
|
+
hairline: '#D8DEE4',
|
|
1127
|
+
inkPrimary: '#111827',
|
|
1128
|
+
inkSecondary: '#374151',
|
|
1129
|
+
inkMuted: '#525B66',
|
|
1130
|
+
accentPrimary: '#C2410C',
|
|
1131
|
+
accentText: '#9A3412',
|
|
1132
|
+
accentSecondary: '#0F766E',
|
|
1133
|
+
accent2Text: '#0D655E',
|
|
1134
|
+
chartNeutral: '#CBD5E1',
|
|
1135
|
+
chartSeries: ['#C2410C', '#0F766E', '#1E3A8A', '#7C3AED', '#B45309', '#64748B'],
|
|
1136
|
+
},
|
|
1137
|
+
fonts: { heading: GEOMETRIC_SANS_STACK, body: SANS_STACK },
|
|
1138
|
+
}),
|
|
1139
|
+
'stripe-craft': makeTheme({
|
|
1140
|
+
id: 'stripe-craft',
|
|
1141
|
+
name: { zh: '极光产研', en: 'Product Indigo' },
|
|
1142
|
+
mood: { zh: 'Stripe/Vercel工程美学、1px精密Bento、清透靛蓝', en: 'Stripe/Vercel product craft, crisp 1px Bento hairlines' },
|
|
1143
|
+
bestFor: { zh: 'PRD产品评审、SaaS方案、开发者平台、AI工程复盘', en: 'Product reviews, SaaS roadmaps, developer platforms, AI eng' },
|
|
1144
|
+
persona: 'tech-pitch',
|
|
1145
|
+
dark: false,
|
|
1146
|
+
radiusPx: 10,
|
|
1147
|
+
shadow: false,
|
|
1148
|
+
defaultTableStyle: 'consulting',
|
|
1149
|
+
chromeStyle: 'saas-bento',
|
|
1150
|
+
palette: {
|
|
1151
|
+
bg: '#F8FAFC',
|
|
1152
|
+
panel: '#EFF3F9',
|
|
1153
|
+
fg: '#0F172A',
|
|
1154
|
+
muted: '#4E5D73',
|
|
1155
|
+
accent: '#4F46E5',
|
|
1156
|
+
accent2: '#0284C7',
|
|
1157
|
+
},
|
|
1158
|
+
tokens: {
|
|
1159
|
+
canvas: '#F8FAFC',
|
|
1160
|
+
surface1: '#EFF3F9',
|
|
1161
|
+
surface2: '#E2E9F3',
|
|
1162
|
+
hairline: '#CBD5E1',
|
|
1163
|
+
inkPrimary: '#0F172A',
|
|
1164
|
+
inkSecondary: '#334155',
|
|
1165
|
+
inkMuted: '#4E5D73',
|
|
1166
|
+
accentPrimary: '#4F46E5',
|
|
1167
|
+
accentText: '#3730A3',
|
|
1168
|
+
accentSecondary: '#0284C7',
|
|
1169
|
+
accent2Text: '#0369A1',
|
|
1170
|
+
chartNeutral: '#CBD5E1',
|
|
1171
|
+
chartSeries: ['#4F46E5', '#0284C7', '#0D9488', '#7C3AED', '#D97706', '#64748B'],
|
|
1172
|
+
},
|
|
1173
|
+
fonts: { heading: SANS_STACK, body: SANS_STACK },
|
|
1174
|
+
}),
|
|
1175
|
+
'aurora-stage': makeTheme({
|
|
1176
|
+
id: 'aurora-stage',
|
|
1177
|
+
name: { zh: '极光发布会', en: 'Aurora Keynote' },
|
|
1178
|
+
mood: { zh: '深海极光青紫、无框空间悬浮、算力与硬件大秀', en: 'Deep midnight aurora teal & indigo, spatial keynote stage' },
|
|
1179
|
+
bestFor: { zh: 'AI基础设施发布、大模型演进、芯片/硬件主题演讲', en: 'AI infra keynotes, foundation model launches, hardware talks' },
|
|
1180
|
+
persona: 'tech-pitch',
|
|
1181
|
+
dark: true,
|
|
1182
|
+
radiusPx: 16,
|
|
1183
|
+
shadow: false,
|
|
1184
|
+
chromeStyle: 'keynote-spatial',
|
|
1185
|
+
palette: {
|
|
1186
|
+
bg: '#070B14',
|
|
1187
|
+
panel: '#101726',
|
|
1188
|
+
fg: '#F1F5F9',
|
|
1189
|
+
muted: '#94A3B8',
|
|
1190
|
+
accent: '#2DD4BF',
|
|
1191
|
+
accent2: '#818CF8',
|
|
1192
|
+
},
|
|
1193
|
+
tokens: {
|
|
1194
|
+
canvas: '#070B14',
|
|
1195
|
+
surface1: '#101726',
|
|
1196
|
+
surface2: '#192338',
|
|
1197
|
+
hairline: '#26344E',
|
|
1198
|
+
inkPrimary: '#F1F5F9',
|
|
1199
|
+
inkSecondary: '#CBD5E1',
|
|
1200
|
+
inkMuted: '#94A3B8',
|
|
1201
|
+
accentPrimary: '#2DD4BF',
|
|
1202
|
+
accentText: '#2DD4BF',
|
|
1203
|
+
accentSecondary: '#818CF8',
|
|
1204
|
+
accent2Text: '#A5B4FC',
|
|
1205
|
+
chartNeutral: '#293856',
|
|
1206
|
+
chartSeries: ['#2DD4BF', '#818CF8', '#38BDF8', '#F472B6', '#FBBF24', '#64748B'],
|
|
1207
|
+
},
|
|
1208
|
+
fonts: { heading: GEOMETRIC_SANS_STACK, body: SANS_STACK },
|
|
1209
|
+
}),
|
|
1210
|
+
'obsidian-amber': makeTheme({
|
|
1211
|
+
id: 'obsidian-amber',
|
|
1212
|
+
name: { zh: '黑曜终端', en: 'Terminal Amber' },
|
|
1213
|
+
mood: { zh: '彭博终端琥珀金、0px锋利栅格、高密风控与量化', en: 'Bloomberg-inspired carbon & amber, sharp analytical grid' },
|
|
1214
|
+
bestFor: { zh: '量化金融、网络安全态势、SRE作战室、实时监控复盘', en: 'Quant finance, security operations, SRE war-room, telemetry' },
|
|
1215
|
+
persona: 'consulting',
|
|
1216
|
+
dark: true,
|
|
1217
|
+
radiusPx: 0,
|
|
1218
|
+
shadow: false,
|
|
1219
|
+
defaultTableStyle: 'consulting',
|
|
1220
|
+
chromeStyle: 'consulting-classic',
|
|
1221
|
+
palette: {
|
|
1222
|
+
bg: '#0C0D10',
|
|
1223
|
+
panel: '#151820',
|
|
1224
|
+
fg: '#F3F4F6',
|
|
1225
|
+
muted: '#9CA3AF',
|
|
1226
|
+
accent: '#F59E0B',
|
|
1227
|
+
accent2: '#38BDF8',
|
|
1228
|
+
},
|
|
1229
|
+
tokens: {
|
|
1230
|
+
canvas: '#0C0D10',
|
|
1231
|
+
surface1: '#151820',
|
|
1232
|
+
surface2: '#1F2430',
|
|
1233
|
+
hairline: '#2E3545',
|
|
1234
|
+
inkPrimary: '#F3F4F6',
|
|
1235
|
+
inkSecondary: '#D1D5DB',
|
|
1236
|
+
inkMuted: '#9CA3AF',
|
|
1237
|
+
accentPrimary: '#F59E0B',
|
|
1238
|
+
accentText: '#FBBF24',
|
|
1239
|
+
accentSecondary: '#38BDF8',
|
|
1240
|
+
accent2Text: '#38BDF8',
|
|
1241
|
+
chartNeutral: '#2A303E',
|
|
1242
|
+
chartSeries: ['#F59E0B', '#38BDF8', '#34D399', '#F87171', '#A78BFA', '#6B7280'],
|
|
1243
|
+
},
|
|
1244
|
+
fonts: { heading: SANS_STACK, body: SANS_STACK },
|
|
1245
|
+
}),
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* 8 套内置名家参考文稿直吸预设(无需外部 .pptx 文件,一键套用大师级配色、母版骨架与叙事节奏建议)。
|
|
1250
|
+
*/
|
|
1251
|
+
export const CURATED_MASTER_PRESETS = Object.freeze([
|
|
1252
|
+
{
|
|
1253
|
+
id: 'mckinsey-board',
|
|
1254
|
+
name: { zh: '麦肯锡董事会简报', en: 'McKinsey Board Brief' },
|
|
1255
|
+
sourceStyle: { zh: '0px 直角卡片 · 结论先行 · 深海蓝主调', en: '0px sharp cards · Action titles · Deep navy' },
|
|
1256
|
+
theme: 'consulting',
|
|
1257
|
+
chromeStyle: 'consulting-classic',
|
|
1258
|
+
brand: { primaryColor: '#0057B8', secondaryColor: '#0E7490', backgroundColor: '#FFFFFF', textColor: '#0F172A', chromeStyle: 'consulting-classic' },
|
|
1259
|
+
rhythm: ['cover', 'cards', 'kpi', 'waterfall', 'matrix', 'gantt', 'closing'],
|
|
1260
|
+
},
|
|
1261
|
+
{
|
|
1262
|
+
id: 'bcg-growth',
|
|
1263
|
+
name: { zh: 'BCG 增长与双碳战略', en: 'BCG Growth & Sustainability' },
|
|
1264
|
+
sourceStyle: { zh: '翡翠绿主色 · 价值链五边形箭头 · 哈维球矩阵', en: 'Emerald accent · Value-chain chevrons · Harvey matrix' },
|
|
1265
|
+
theme: 'bcg-emerald',
|
|
1266
|
+
chromeStyle: 'consulting-classic',
|
|
1267
|
+
brand: { primaryColor: '#006B54', secondaryColor: '#0F4C81', backgroundColor: '#FFFFFF', textColor: '#0D1F18', chromeStyle: 'consulting-classic' },
|
|
1268
|
+
rhythm: ['cover', 'kpi', 'process', 'harvey', 'gantt', 'closing'],
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
id: 'sequoia-memo',
|
|
1272
|
+
name: { zh: '红杉 / YC 创投融资简报(明亮版)', en: 'Sequoia / YC Partner Deck' },
|
|
1273
|
+
sourceStyle: { zh: '适合邮件与平板阅读 · TAM 同心圆 · 增长指标', en: 'Screen-first daylight · TAM sizing · Traction KPIs' },
|
|
1274
|
+
theme: 'venture-daylight',
|
|
1275
|
+
chromeStyle: 'keynote-spatial',
|
|
1276
|
+
brand: { primaryColor: '#C2410C', secondaryColor: '#0F766E', backgroundColor: '#FFFFFF', textColor: '#111827', chromeStyle: 'keynote-spatial' },
|
|
1277
|
+
rhythm: ['cover', 'comparison', 'kpi', 'tam', 'harvey', 'org', 'closing'],
|
|
1278
|
+
},
|
|
1279
|
+
{
|
|
1280
|
+
id: 'apple-cupertino',
|
|
1281
|
+
name: { zh: 'Cupertino 旗舰产品发布', en: 'Cupertino Spatial Keynote' },
|
|
1282
|
+
sourceStyle: { zh: '无顶部分隔线 · 16pt 呼吸感浮卡 · 大数字聚焦', en: 'Divider-free canvas · 16pt airy Bento · Hero metrics' },
|
|
1283
|
+
theme: 'keynote-light',
|
|
1284
|
+
chromeStyle: 'keynote-spatial',
|
|
1285
|
+
brand: { primaryColor: '#0066CC', secondaryColor: '#5E5CE6', backgroundColor: '#FFFFFF', textColor: '#1D1D1F', chromeStyle: 'keynote-spatial' },
|
|
1286
|
+
rhythm: ['cover', 'statement', 'cards', 'kpi', 'architecture', 'closing'],
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
id: 'stripe-product',
|
|
1290
|
+
name: { zh: 'Stripe / Vercel 产研方案评审', en: 'Stripe / Vercel Product Craft' },
|
|
1291
|
+
sourceStyle: { zh: '1px 精密 Bento 网格 · 系统分层架构 · 路线图', en: '1px Bento grid · Layered architecture · Roadmap' },
|
|
1292
|
+
theme: 'stripe-craft',
|
|
1293
|
+
chromeStyle: 'saas-bento',
|
|
1294
|
+
brand: { primaryColor: '#4F46E5', secondaryColor: '#0284C7', backgroundColor: '#F8FAFC', textColor: '#0F172A', chromeStyle: 'saas-bento' },
|
|
1295
|
+
rhythm: ['cover', 'comparison', 'architecture', 'cards', 'gantt', 'closing'],
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
id: 'economist-macro',
|
|
1299
|
+
name: { zh: '经济学人 / FT 宏观与财报洞察', en: 'Economist & FT Macro Briefing' },
|
|
1300
|
+
sourceStyle: { zh: '暖纸底色 · 红标书脊 · 衬线标题 + 瀑布利润桥', en: 'Warm paper · Editorial folio · Serif title & waterfall' },
|
|
1301
|
+
theme: 'economist-brief',
|
|
1302
|
+
chromeStyle: 'editorial-folio',
|
|
1303
|
+
brand: { primaryColor: '#C8102E', secondaryColor: '#1D3557', backgroundColor: '#F9F8F5', textColor: '#141413', headingFont: 'Georgia', chromeStyle: 'editorial-folio' },
|
|
1304
|
+
rhythm: ['cover', 'statement', 'waterfall', 'chart-split', 'table', 'closing'],
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
id: 'nature-defense',
|
|
1308
|
+
name: { zh: 'Nature / ETH 学术答辩与临床研究', en: 'Nature & Beamer Academic Defense' },
|
|
1309
|
+
sourceStyle: { zh: 'Beamer 通栏页眉 · 无竖线学术三线表 · 严谨对比', en: 'Beamer header band · Booktabs 3-line tables · Rigor' },
|
|
1310
|
+
theme: 'academic',
|
|
1311
|
+
chromeStyle: 'academic-minimal',
|
|
1312
|
+
brand: { primaryColor: '#006980', secondaryColor: '#C8430E', backgroundColor: '#FFFFFF', textColor: '#111827', chromeStyle: 'academic-minimal' },
|
|
1313
|
+
rhythm: ['cover', 'cards', 'process', 'table', 'kpi', 'closing'],
|
|
1314
|
+
},
|
|
1315
|
+
{
|
|
1316
|
+
id: 'imperial-gov',
|
|
1317
|
+
name: { zh: '现代东方政务述职与规划', en: 'Modern Institutional Briefing' },
|
|
1318
|
+
sourceStyle: { zh: '深霁蓝庄重封面 + 宣纸浅底正文 · 双线页眉', en: 'Inverted slate cover + warm paper body · Double rule' },
|
|
1319
|
+
theme: 'exec-jilan',
|
|
1320
|
+
chromeStyle: 'gov-ceremonial',
|
|
1321
|
+
brand: { primaryColor: '#1A2B4C', secondaryColor: '#9E1B1E', chromeStyle: 'gov-ceremonial' },
|
|
1322
|
+
rhythm: ['cover', 'kpi', 'cards', 'comparison', 'org', 'gantt', 'closing'],
|
|
1323
|
+
},
|
|
1324
|
+
])
|
|
1325
|
+
|
|
1326
|
+
export function listMasterPresets(lang = 'zh') {
|
|
1327
|
+
const pick = (pair) => (lang === 'en' ? pair.en : pair.zh)
|
|
1328
|
+
return CURATED_MASTER_PRESETS.map((preset) => ({
|
|
1329
|
+
id: preset.id,
|
|
1330
|
+
name: pick(preset.name),
|
|
1331
|
+
sourceStyle: pick(preset.sourceStyle),
|
|
1332
|
+
theme: preset.theme,
|
|
1333
|
+
chromeStyle: preset.chromeStyle,
|
|
1334
|
+
brand: { ...preset.brand },
|
|
1335
|
+
rhythm: [...preset.rhythm],
|
|
1336
|
+
}))
|
|
1029
1337
|
}
|
|
1030
1338
|
|
|
1031
1339
|
export const THEME_IDS = Object.keys(THEMES)
|
|
@@ -1099,6 +1407,13 @@ export function sanitizeAbsorbedTheme(raw = {}) {
|
|
|
1099
1407
|
} else if (bgLum >= 0.42) {
|
|
1100
1408
|
dark = false
|
|
1101
1409
|
canvas = clampHslColor(rawBg, { minL: 0.88, maxL: 1.0, maxS: 0.18 })
|
|
1410
|
+
if (raw.coverSlideBg) {
|
|
1411
|
+
const rawCover = normalizeHex(raw.coverSlideBg, '')
|
|
1412
|
+
if (rawCover && relativeLuminance(rawCover) < 0.30) {
|
|
1413
|
+
coverMode = 'inverted-accent'
|
|
1414
|
+
coverBg = clampHslColor(rawCover, { minL: 0.06, maxL: 0.25, maxS: 0.78 })
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1102
1417
|
} else {
|
|
1103
1418
|
dark = true
|
|
1104
1419
|
canvas = clampHslColor(rawBg, { minL: 0.008, maxL: 0.055, maxS: 0.35 })
|
|
@@ -1148,6 +1463,8 @@ export function sanitizeAbsorbedTheme(raw = {}) {
|
|
|
1148
1463
|
const inkOnAccent = relativeLuminance(accentPrimary) > 0.36 ? '#0F172A' : '#FFFFFF'
|
|
1149
1464
|
|
|
1150
1465
|
const secondaryPool = [
|
|
1466
|
+
raw.brandSecondary,
|
|
1467
|
+
raw.secondaryColor,
|
|
1151
1468
|
srcPalette.accent2,
|
|
1152
1469
|
srcPalette.accent3,
|
|
1153
1470
|
srcPalette.accent4,
|
|
@@ -1156,7 +1473,7 @@ export function sanitizeAbsorbedTheme(raw = {}) {
|
|
|
1156
1473
|
]
|
|
1157
1474
|
.filter(Boolean)
|
|
1158
1475
|
.map((c) => normalizeHex(c, ''))
|
|
1159
|
-
.filter((c) => c.length === 7 && hueDelta(c, accentPrimary) >=
|
|
1476
|
+
.filter((c) => c.length === 7 && hueDelta(c, accentPrimary) >= 24 && colorDistance(c, canvas) > 32)
|
|
1160
1477
|
|
|
1161
1478
|
const rawSecondary = secondaryPool[0] ?? hslToHex((hexToHsl(accentPrimary).h + 36) % 360, Math.max(0.45, hexToHsl(accentPrimary).s * 0.85), dark ? 0.62 : 0.38)
|
|
1162
1479
|
const accentSecondary = ensureContrast(rawSecondary, canvas, 3.2, 0.80)
|
|
@@ -1201,14 +1518,16 @@ export function sanitizeAbsorbedTheme(raw = {}) {
|
|
|
1201
1518
|
return trimmed
|
|
1202
1519
|
}
|
|
1203
1520
|
|
|
1521
|
+
const isSafeSingleFont = (f) => Boolean(f && /^[\p{L}\p{N} _-]+$/u.test(f) && f.length <= 80 && !/^\+mn-|^\+mj-/i.test(f))
|
|
1204
1522
|
const majorLatin = sanitizeExtractedFont(srcFonts.majorLatin)
|
|
1205
1523
|
const majorEA = sanitizeExtractedFont(srcFonts.majorEastAsian)
|
|
1206
1524
|
const minorLatin = sanitizeExtractedFont(srcFonts.minorLatin)
|
|
1207
1525
|
const minorEA = sanitizeExtractedFont(srcFonts.minorEastAsian)
|
|
1208
1526
|
const headingStack = [majorLatin, majorEA, SANS_STACK].filter(Boolean).join(', ')
|
|
1209
1527
|
const bodyStack = [minorLatin || majorLatin, minorEA || majorEA, SANS_STACK].filter(Boolean).join(', ')
|
|
1210
|
-
const safeBrandFont = [majorEA,
|
|
1211
|
-
|
|
1528
|
+
const safeBrandFont = [minorEA, majorEA, minorLatin, majorLatin].find(isSafeSingleFont)
|
|
1529
|
+
const safeHeadingCandidate = [majorEA, majorLatin].find(isSafeSingleFont)
|
|
1530
|
+
const safeHeadingFont = safeHeadingCandidate && safeHeadingCandidate !== safeBrandFont ? safeHeadingCandidate : ''
|
|
1212
1531
|
|
|
1213
1532
|
// 匹配最接近的内置大师主题 ID
|
|
1214
1533
|
let recommendedTheme = dark ? 'linear-dark' : 'consulting'
|
|
@@ -1264,9 +1583,12 @@ export function sanitizeAbsorbedTheme(raw = {}) {
|
|
|
1264
1583
|
}
|
|
1265
1584
|
const sanitizedBrand = {
|
|
1266
1585
|
primaryColor: accentPrimary,
|
|
1586
|
+
secondaryColor: accentSecondary,
|
|
1267
1587
|
backgroundColor: canvas,
|
|
1268
1588
|
textColor: inkPrimary,
|
|
1269
1589
|
...(safeBrandFont ? { fontFamily: safeBrandFont } : {}),
|
|
1590
|
+
...(safeHeadingFont ? { headingFont: safeHeadingFont } : {}),
|
|
1591
|
+
...(coverMode === 'inverted-accent' ? { coverMode: 'inverted-accent', coverBg } : {}),
|
|
1270
1592
|
}
|
|
1271
1593
|
|
|
1272
1594
|
return {
|
|
@@ -1295,7 +1617,7 @@ export function deriveBrandedTheme(themeOrId, brand) {
|
|
|
1295
1617
|
}
|
|
1296
1618
|
if (!brand || typeof brand !== 'object') return cloned
|
|
1297
1619
|
|
|
1298
|
-
const hasColorOverride = Boolean(brand.backgroundColor || brand.textColor || brand.primaryColor)
|
|
1620
|
+
const hasColorOverride = Boolean(brand.backgroundColor || brand.textColor || brand.primaryColor || brand.secondaryColor || brand.coverMode || brand.coverBg)
|
|
1299
1621
|
if (hasColorOverride) {
|
|
1300
1622
|
const nextBg = brand.backgroundColor ? normalizeHex(brand.backgroundColor, base.palette.bg) : base.palette.bg
|
|
1301
1623
|
const nextDark = relativeLuminance(nextBg) < 0.42
|
|
@@ -1318,10 +1640,27 @@ export function deriveBrandedTheme(themeOrId, brand) {
|
|
|
1318
1640
|
const nextInkSecondary = ensureContrast(mixHex(safeInkForDerived, nextSurface1, 0.25), nextSurface1, 7.0)
|
|
1319
1641
|
const nextMuted = ensureContrast(mixHex(safeInkForDerived, nextSurface1, 0.46), nextSurface1, 4.6)
|
|
1320
1642
|
const nextAccentText = ensureContrast(nextAccent, nextSurface1, 4.6)
|
|
1321
|
-
const
|
|
1643
|
+
const rawSecondary = brand.secondaryColor ? normalizeHex(brand.secondaryColor, base.palette.accent2) : base.palette.accent2
|
|
1644
|
+
const nextAccent2 = ensureContrast(rawSecondary, nextBg, 3.0)
|
|
1322
1645
|
const nextAccent2Text = ensureContrast(nextAccent2, nextSurface1, 4.6)
|
|
1323
1646
|
const nextChartNeutral = mixHex(nextBg, safeInkForDerived, nextDark ? 0.24 : 0.18)
|
|
1324
|
-
const
|
|
1647
|
+
const seedTail = brand.secondaryColor
|
|
1648
|
+
? [nextAccent2, ...base.tokens.chartSeries.slice(1).filter((c) => colorDistance(c, nextAccent2) >= 28)]
|
|
1649
|
+
: base.tokens.chartSeries.slice(1)
|
|
1650
|
+
const nextSeries = [nextAccent, ...seedTail.slice(0, 5).map((c) => ensureContrast(c, nextBg, 2.8))]
|
|
1651
|
+
while (nextSeries.length < 6) {
|
|
1652
|
+
nextSeries.push(ensureContrast(OKABE_ITO_FALLBACKS[nextSeries.length % OKABE_ITO_FALLBACKS.length], nextBg, 2.8))
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
const explicitInverted = brand.coverMode === 'inverted-accent'
|
|
1656
|
+
const resolvedCoverMode = explicitInverted
|
|
1657
|
+
? 'inverted-accent'
|
|
1658
|
+
: brand.coverMode === 'standard'
|
|
1659
|
+
? 'standard'
|
|
1660
|
+
: (brand.backgroundColor ? 'standard' : cloned.tokens.coverMode)
|
|
1661
|
+
const resolvedCoverBg = resolvedCoverMode === 'inverted-accent'
|
|
1662
|
+
? (brand.coverBg ? normalizeHex(brand.coverBg, nextAccent) : (cloned.tokens.coverMode === 'inverted-accent' ? cloned.tokens.coverBg : nextAccent))
|
|
1663
|
+
: nextBg
|
|
1325
1664
|
|
|
1326
1665
|
cloned.dark = nextDark
|
|
1327
1666
|
cloned.shadow = !nextDark && base.shadow
|
|
@@ -1354,8 +1693,8 @@ export function deriveBrandedTheme(themeOrId, brand) {
|
|
|
1354
1693
|
chartFocal: nextAccent,
|
|
1355
1694
|
chartNeutral: nextChartNeutral,
|
|
1356
1695
|
chartSeries: nextSeries,
|
|
1357
|
-
coverMode:
|
|
1358
|
-
coverBg:
|
|
1696
|
+
coverMode: resolvedCoverMode,
|
|
1697
|
+
coverBg: resolvedCoverBg,
|
|
1359
1698
|
}
|
|
1360
1699
|
}
|
|
1361
1700
|
|
|
@@ -1363,12 +1702,24 @@ export function deriveBrandedTheme(themeOrId, brand) {
|
|
|
1363
1702
|
cloned.chromeStyle = String(brand.chromeStyle).trim()
|
|
1364
1703
|
}
|
|
1365
1704
|
|
|
1705
|
+
const normalizeBrandFontStack = (raw, fallbackStack) => {
|
|
1706
|
+
const trimmed = String(raw).trim()
|
|
1707
|
+
if (!trimmed) return fallbackStack
|
|
1708
|
+
if (BITMAP_SERIF_FONT_RE.test(trimmed) || NOVELTY_FONT_RE.test(trimmed) || /^微软雅黑$/i.test(trimmed)) {
|
|
1709
|
+
return [pptxEastAsianFont(trimmed), SANS_STACK].join(', ')
|
|
1710
|
+
}
|
|
1711
|
+
return trimmed
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1366
1714
|
if (brand.fontFamily) {
|
|
1367
|
-
const
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
cloned.fonts = {
|
|
1715
|
+
const cleanBody = normalizeBrandFontStack(brand.fontFamily, cloned.fonts.body)
|
|
1716
|
+
cloned.fonts = { heading: cleanBody, body: cleanBody }
|
|
1717
|
+
}
|
|
1718
|
+
if (brand.headingFont) {
|
|
1719
|
+
cloned.fonts = {
|
|
1720
|
+
...cloned.fonts,
|
|
1721
|
+
heading: normalizeBrandFontStack(brand.headingFont, cloned.fonts.heading),
|
|
1722
|
+
}
|
|
1372
1723
|
}
|
|
1373
1724
|
return cloned
|
|
1374
1725
|
}
|