dsh-design-studio 0.19.1 → 0.21.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/README.en.md CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
  </div>
17
17
 
18
- **Design Studio** is a DeepSeek Harness (DSH) plugin. Say what you want to make, and the model's web pages, app screens, mini programs, desktop apps, posters and slides appear one by one on a canvas in the right sidebar, inside phone, browser or app-window frames. Click the direction you like, or click whatever looks off and add a sentence, and the model edits it.
18
+ **Design Studio** is a DeepSeek Harness (DSH) plugin. Say what you want to make, and the model's web pages, app screens, mini programs, desktop apps, posters, slides, mind maps and roadmaps appear one by one on a canvas in the right sidebar, inside phone, browser or app-window frames. Click the direction you like, or click whatever looks off and add a sentence, and the model edits it.
19
19
 
20
20
  ![Demo: one sentence → three directions → pick one for the full set → click to edit](assets/demo.gif)
21
21
 
@@ -43,6 +43,7 @@ If DSH can't reach the npm registry, it falls back to a mirror in China. To upda
43
43
  - **Design check:** one click finds overflowing text, low contrast, small tap targets and tiny text, marked right on the page. In Design mode the model also checks its own work and fixes what it finds.
44
44
  - **Versions and compare:** every turn is saved; drag a slider to compare, and go back to any version.
45
45
  - **Export and phone preview:** showcase images, PDF and PowerPoint (links between screens still work); scan a QR code to see it on your phone at real size. Slides and posters larger than the default canvas now use the page's real size. You can also set it by adding `WIDTHxHEIGHT` after the type, for example `<meta name="dsh-design" content="slides 1440x810">`. Export options let you pick the page size (16:9, 4:3, A3 landscape or custom), what each page shows (one screen, full page or a set height) and two screens per page. If anything would be cut off, you get a checklist first, with a one-click fix that fits the canvas to the content.
46
+ - **Diagrams:** mind maps, technical route charts (the kind in grant proposals and theses), product roadmaps and system architecture diagrams. Lines, branches and arrows are laid out for you and re-flow when you change text or add nodes; colors follow the design style, and a high-resolution PNG or PDF export drops straight into Word or PowerPoint. For grant-proposal and final-report frameworks, the model first lists how the parts relate (which problem maps to which task) for you to confirm, then draws labelled arrows between the blocks, in a bold 3D-gradient "proposal" style by default or after a reference image you give it.
46
47
  - **Design library and gallery:** everything you've designed, plus saved references and styles, lives in the Library. Browse templates, design systems and style cards others shared, and "Start from this" copies one for you to keep editing. Share your own with "Share to the gallery": it's checked, zipped and submitted on a web page, and listed once reviewed. The gallery catalog comes from npm mirrors and is used only when its signature and checksums match; to keep it offline, turn on "Design library offline" on the Plugins page.
47
48
  - **Your brand, and real code:** give a site URL to extract a brand design system and design with it from then on; turn a finished design into React / Vue / HTML (mini programs straight into uni-app or native WeChat code, HBuilderX projects included), compared screen by screen against the design.
48
49
  - **Built-in photo library:** for designs that rely on photos (hotels, food, cafes, fitness, beauty, fashion, education, travel), the model uses real-looking photos instead of only drawing illustrations. About 8 MB is downloaded the first time it is needed. All of them are AI-generated placeholders, so replace them with real photos before launch.
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
  </div>
17
17
 
18
- **设计工作台**是 DeepSeek Harness(DSH)的插件:说一句要做什么,模型做的网页、App 界面、小程序、桌面软件、海报、幻灯片在右边画布上一屏屏长出来,套着手机、浏览器或软件窗口外框。看中哪个方向点一下,哪里不对点一下说一句,模型就照着改。
18
+ **设计工作台**是 DeepSeek Harness(DSH)的插件:说一句要做什么,模型做的网页、App 界面、小程序、桌面软件、海报、幻灯片、思维导图和路线图在右边画布上一屏屏长出来,套着手机、浏览器或软件窗口外框。看中哪个方向点一下,哪里不对点一下说一句,模型就照着改。
19
19
 
20
20
  ![演示:一句话 → 三个方向 → 挑一个做全套 → 点一下改](assets/demo.gif)
21
21
 
@@ -43,6 +43,7 @@
43
43
  - **设计体检**:一键查文字溢出、对比度不够、按钮太小、字太小,问题直接标在页面上;模型做完也会自己查一遍再改。
44
44
  - **版本和对比**:每轮自动存一版,左右拖动对比,随时回到任意一版。
45
45
  - **导出和手机上看**:导出展示图、PDF、PPT(屏和屏之间的跳转照样能点);扫码在手机上按真机尺寸看。页面比默认画幅大的幻灯片、海报,画幅自动跟页面走;也可以在类型后面跟 `宽x高` 指定,比如 `<meta name="dsh-design" content="slides 1440x810">`。导出选项里可以选版面(16:9、4:3、A3 横向、自定义)、每页取景(一屏、整页、指定高度)和每页拼 2 屏;有内容会被裁时,导出前先给一张清单,可以一键按内容改画幅。
46
+ - **图表**:思维导图、技术路线图(申报书、开题报告那种)、产品路线图、系统架构图。连线、分叉、箭头自动排好,改字、加节点自己重排;配色跟着设计风格走,导出高清 PNG 或 PDF 贴进 Word / PPT。申报书、结题报告的框架图先帮你理清「哪个问题对应哪项内容」请你确认再画,版块之间画出带关系词的箭头;默认是立体渐变的「申报书炫酷样式」,也能照你给的参考图画。
46
47
  - **设计库和设计市场**:以前做过的设计、收的参考图和风格都在「设计库」里;市场里逛大家分享的模板、设计系统和风格卡,点「用这个开始」复制一份接着改。自己做的点「分享到设计市场」,查过打成 zip,在网页里交上去,审过就上架。市场目录从 npm 镜像取,签了名、核对过才用;不想让它联网,在插件页打开「设计库不联网」。
47
48
  - **照品牌风格做、转成代码**:给官网地址,提一套品牌设计系统,以后都照它做;做好的设计转成 React / Vue / HTML,小程序直接转成 uni-app 或原生小程序代码(HBuilderX 建的项目也认得出),逐屏和设计稿比对。
48
49
  - **自带照片库**:民宿酒店、餐饮、奶茶咖啡、健身、美妆、服饰、教育、旅行风景这些靠照片说话的设计,模型会直接用上照片,不再只画插画。第一次用到时下载约 8 MB。都是 AI 生成的示意图,上线前请换成真实照片。
package/cordis.patch.yml CHANGED
@@ -29,14 +29,14 @@
29
29
  config:
30
30
  id: design
31
31
  name: 设计模式
32
- description: 做网页、App 界面、小程序、海报、幻灯片:标准模式的全部工具,加上设计技能和右侧「设计工作台」实时预览。
32
+ description: 做网页、App 界面、小程序、海报、幻灯片、图表(思维导图、路线图、架构图):标准模式的全部工具,加上设计技能和右侧「设计工作台」实时预览。
33
33
  order: 1.5
34
34
  plugins:
35
35
  - id: persona
36
36
  name: '@deepseek-ai/dsh-persona'
37
37
  config:
38
38
  prefix: |-
39
- You are a design agent powered by the {{model}} model. You design user interfaces and visuals — web pages, app and tablet screens, WeChat mini programs, posters and social images, slides, emails, components — and build them as real HTML/CSS, or inside the user's front-end project.
39
+ You are a design agent powered by the {{model}} model. You design user interfaces and visuals — web pages, app and tablet screens, WeChat mini programs, posters and social images, slides, emails, components, and diagrams (mind maps, technical routes, roadmaps, architecture) — and build them as real HTML/CSS, or inside the user's front-end project.
40
40
  Before designing, load the ui-design skill and follow its process and self-check list. For a new design, first ask the two or three questions that matter and show three clearly different directions of one key screen, as the skill describes, unless the user asked you to just build it. Once the first HTML file is written, or a dev server is up, call preview_page so the user can watch the design live in the Design Studio sidebar; later edits refresh on their own. After writing or changing screens, call check_design to measure them at real sizes and fix what it lists, and call look_design to see real screenshots for the visual pass; do not build your own inspection pages, servers or browser screenshots. Stop after at most three measure-and-fix rounds and tell the user what is left. When a message starts with an element or region the user selected in the preview, or with a design-check list, change exactly those parts in the source. If the user points you at their own website or project as the brand to follow, call extract_design_system; when the ui-design skill names a default design system, build new designs on its tokens.css and components.css. When a message asks to turn the design into real code, call handoff_design, follow its HANDOFF.md, and after each screen call compare_design until it matches. If the user only wants an answer shown as a page (a comparison, table, checklist, chart or calculator) and the show_page tool is available, call show_page instead of this design process.
41
41
  - id: agent-instructions
42
42
  name: '@deepseek-ai/dsh-agent-instructions'
package/lib/client.js CHANGED
@@ -60,6 +60,7 @@ window.__ModuleLoader__.load({
60
60
  exPoster: '周末城市夜跑活动的海报,清爽运动风',
61
61
  exSlides: '新品发布会的五页幻灯片:问题、方案、数字、价格、下一步',
62
62
  exEmail: '会员生日月的优惠邮件:一张大图、一段祝福、一个按钮',
63
+ exDiagram: '「产品经理入门」的思维导图:用户研究、需求分析、原型、数据、项目管理',
63
64
  askKindLine: '类型:{k}',
64
65
  askMore: '更多开始方式',
65
66
  askMoreD: '打开已有的 HTML、用自己的品牌、从设计库打开',
@@ -145,12 +146,14 @@ window.__ModuleLoader__.load({
145
146
  refJoin: '、',
146
147
  refAsk: '照这张参考图的风格改现在的设计:先把配色、圆角、阴影和字体气质更新到 tokens.css,再让各屏跟着变;布局和文案先不动。',
147
148
  refAskNew: '照这张参考图的风格来做:先把配色、圆角、阴影和字体气质定在 tokens.css 里,再出页面。',
149
+ refAskDg: '照这张参考图画:先打开参考图看清它的版式和画法(分几层几栏、层名和标题怎么标、卡片和标签的样子、箭头怎么连、编号、字号比例),照着画,配色定在 tokens.css 里;版块之间谁支撑谁、谁对应谁也照它用箭头和标注画出来。内容用我的,别抄图里的字;字要大,贴进 Word 也看得清。',
150
+ refAskDgRe: '照这张参考图重画现在的图表:先打开参考图看清它的版式和画法(分几层几栏、层名和标题怎么标、卡片和标签的样子、箭头怎么连、编号、字号比例),版式、画法和配色都照它改,配色更新到 tokens.css;版块之间谁支撑谁、谁对应谁也照它用箭头和标注画出来。内容不变,别抄图里的字;字要大,贴进 Word 也看得清。',
148
151
  textOne: '点页面里的文字直接改 · 回车保存 · Esc 退出',
149
152
  picking: '选择中…',
150
153
  canvas: '画布:几屏并排看',
151
154
  single: '单页:只看一屏',
152
155
  sizes: '多尺寸:同一屏在手机 / 平板 / 电脑上并排看',
153
- sizesNo: '海报、幻灯片、邮件是固定画幅,没有多尺寸',
156
+ sizesNo: '海报、幻灯片、邮件、图表是固定画幅,没有多尺寸',
154
157
  szPhone: '手机',
155
158
  szTablet: '平板',
156
159
  szDesktop: '电脑',
@@ -166,6 +169,7 @@ window.__ModuleLoader__.load({
166
169
  kindPoster: '海报',
167
170
  kindSlides: '幻灯片',
168
171
  kindEmail: '邮件',
172
+ kindDiagram: '图表',
169
173
  tokens: '设计规范',
170
174
  tokensTip: '点一个放进输入框,补一句怎么改;改它所有屏一起变',
171
175
  tokensEmpty: '这套设计还没有设计变量(:root 上的 CSS 变量),颜色字号散在各处,改起来不统一。',
@@ -264,6 +268,13 @@ window.__ModuleLoader__.load({
264
268
  ck_tabbar: '标签栏项太多',
265
269
  ck_navbar: '没有导航栏',
266
270
  ck_winctl: '被窗口按钮挡住',
271
+ ck_dgsize: '图比画幅大',
272
+ ck_dgli: '导图节点写法不对',
273
+ ck_dgmany: '一层放太多',
274
+ ck_dgbar: '横条超出时间轴',
275
+ ck_dgtext: '节点字太多',
276
+ ck_dgsmall: '字偏小',
277
+ ck_dglink: '箭头没对着模块',
267
278
  cd_hscroll: '伸出屏幕 {px}px',
268
279
  cd_clipped: '被切掉 {px}px',
269
280
  cd_overflow: '伸出框 {px}px',
@@ -286,6 +297,13 @@ window.__ModuleLoader__.load({
286
297
  cd_tabbar: '标签栏有 {n} 项(最多 5 项)',
287
298
  cd_navbar: '顶上 y {t}–{b}(导航栏)是空的:一级页放标题或品牌,二级页标题居中加返回',
288
299
  cd_winctl: '伸进{osName}窗口按钮 {px}px(外框画的、盖在页面上面:{zone}空着)',
300
+ cd_dgsize: '图有 {w}×{h},画幅只有 {vw}×{vh}:把画幅改大,或者删减节点',
301
+ cd_dgli: '字要包在 <span class="mm-node"> 里,不然连线对不上',
302
+ cd_dgmany: '{n} 个(最多 {max} 个):合并几个或拆开',
303
+ cd_dgbar: '从第 {from} 段起占 {span} 段,时间轴只有 {cols} 段',
304
+ cd_dgtext: '{chars} 个字(最好 ≤ {max}):写关键词,补充放小字',
305
+ cd_dglink: '这排箭头和上下两层的模块对不上:个数要一样,层里的递进改用不占位的箭头',
306
+ cd_dgsmall: '正文约 {px}px、画幅 {vw} 宽:贴进 Word 只有约 {pt} 磅。把字放大到 {need}px 左右,或把画幅改窄',
289
307
  ckOs_mac: ' Mac ',
290
308
  ckOs_win: ' Windows ',
291
309
  ckZone_mac: '左上角 x 80、y 40 以内',
@@ -927,6 +945,7 @@ window.__ModuleLoader__.load({
927
945
  exPoster: 'Poster for a weekend night run in the city, fresh sporty style',
928
946
  exSlides: 'Five-slide launch deck: problem, solution, numbers, pricing, next steps',
929
947
  exEmail: 'Birthday-month offer email for members: one big image, a short note, one button',
948
+ exDiagram: 'A mind map for "Product management 101": user research, requirements, prototyping, data, project management',
930
949
  askKindLine: 'Type: {k}',
931
950
  askMore: 'More ways to start',
932
951
  askMoreD: 'Open existing HTML, use your own brand, open from the library',
@@ -1012,12 +1031,14 @@ window.__ModuleLoader__.load({
1012
1031
  refJoin: ', ',
1013
1032
  refAsk: 'Restyle the current design after this reference: update colors, radii, shadows and type feel in tokens.css first, then let every screen follow. Keep layout and copy for now.',
1014
1033
  refAskNew: 'Design in the style of this reference: set colors, radii, shadows and type feel in tokens.css first, then build the pages.',
1034
+ refAskDg: 'Draw this diagram after the reference: open the reference first and study its layout and drawing (how many layers and columns, how layer names and headings are marked, the look of cards and tags, how arrows connect, numbering, type sizes), then follow it; set the colors in tokens.css. Show which block supports or corresponds to which with arrows and labels, as the reference does. Use my content, not the text in the image; keep the text large enough to read in a Word document.',
1035
+ refAskDgRe: 'Redraw the current diagram after the reference: open the reference first and study its layout and drawing (how many layers and columns, how layer names and headings are marked, the look of cards and tags, how arrows connect, numbering, type sizes), then change the layout, drawing and colors to match, updating tokens.css. Show which block supports or corresponds to which with arrows and labels, as the reference does. Keep the content, not the text in the image; keep the text large enough to read in a Word document.',
1015
1036
  textOne: 'Click any text in the page to edit · Enter to save · Esc to stop',
1016
1037
  picking: 'Selecting…',
1017
1038
  canvas: 'Canvas: screens side by side',
1018
1039
  single: 'Single: one screen',
1019
1040
  sizes: 'Sizes: the same screen on phone, tablet and desktop side by side',
1020
- sizesNo: 'Posters, slides and emails have a fixed size',
1041
+ sizesNo: 'Posters, slides, emails and diagrams have a fixed size',
1021
1042
  szPhone: 'Phone',
1022
1043
  szTablet: 'Tablet',
1023
1044
  szDesktop: 'Desktop',
@@ -1033,6 +1054,7 @@ window.__ModuleLoader__.load({
1033
1054
  kindPoster: 'Poster',
1034
1055
  kindSlides: 'Slides',
1035
1056
  kindEmail: 'Email',
1057
+ kindDiagram: 'Diagram',
1036
1058
  tokens: 'Design tokens',
1037
1059
  tokensTip: 'Click one to put it in the input, then say how to change it. All screens follow',
1038
1060
  tokensEmpty: 'This design has no tokens yet (CSS variables on :root), so colors and sizes are scattered.',
@@ -1131,6 +1153,13 @@ window.__ModuleLoader__.load({
1131
1153
  ck_tabbar: 'Too many tabs',
1132
1154
  ck_navbar: 'No navigation bar',
1133
1155
  ck_winctl: 'Under the window buttons',
1156
+ ck_dgsize: 'Diagram bigger than the canvas',
1157
+ ck_dgli: 'Mind map node written wrong',
1158
+ ck_dgmany: 'Too many in one level',
1159
+ ck_dgbar: 'Bar runs past the timeline',
1160
+ ck_dgtext: 'Node text too long',
1161
+ ck_dgsmall: 'Text too small',
1162
+ ck_dglink: 'Arrows miss the modules',
1134
1163
  cd_hscroll: 'sticks out {px}px',
1135
1164
  cd_clipped: '{px}px cut off',
1136
1165
  cd_overflow: 'sticks out {px}px',
@@ -1153,6 +1182,13 @@ window.__ModuleLoader__.load({
1153
1182
  cd_tabbar: 'the tab bar has {n} items (5 at most)',
1154
1183
  cd_navbar: 'nothing at y {t}–{b} (the navigation bar): top-level pages show a title or brand, other pages a centered title and a back button',
1155
1184
  cd_winctl: '{px}px under the{osName}window buttons (the frame draws them on top: keep {zone} clear)',
1185
+ cd_dgsize: 'the diagram is {w}×{h} but the canvas is {vw}×{vh}: make the canvas bigger or trim nodes',
1186
+ cd_dgli: 'wrap the text in <span class="mm-node">, or the lines will not meet it',
1187
+ cd_dgmany: '{n} of them ({max} at most): merge some or split them up',
1188
+ cd_dgbar: 'starts at period {from} and spans {span}, but the timeline has only {cols}',
1189
+ cd_dgtext: '{chars} characters ({max} at most): use keywords, put details in small text',
1190
+ cd_dglink: 'this row of arrows does not line up with the modules above and below: use as many arrows as modules, and arrows that take no space inside a layer',
1191
+ cd_dgsmall: 'body text is about {px}px on a {vw}px-wide canvas: about {pt}pt once placed in a Word page. Enlarge it to about {need}px or make the canvas narrower',
1156
1192
  ckOs_mac: ' Mac ',
1157
1193
  ckOs_win: ' Windows ',
1158
1194
  ckZone_mac: 'the top-left 80×40',
@@ -2103,6 +2139,7 @@ window.__ModuleLoader__.load({
2103
2139
  .ddp-wait .card.k-poster{width:auto;height:min(62%,560px);aspect-ratio:3/4}
2104
2140
  .ddp-wait .card.k-slides{aspect-ratio:16/9}
2105
2141
  .ddp-wait .card.k-email{width:min(60%,380px);aspect-ratio:3/4}
2142
+ .ddp-wait .card.k-diagram{aspect-ratio:16/10}
2106
2143
  .ddp-wait .card:has(.ddp-gd){animation:none}
2107
2144
  .ddp-wait p{margin:0;color:var(--dsw-alias-label-tertiary);text-align:center;line-height:1.6}
2108
2145
  .ddp-toast{position:absolute;left:12px;right:12px;top:14px;width:fit-content;max-width:calc(100% - 24px);margin-inline:auto;z-index:7;padding:7px 14px;border-radius:14px;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-1);font-size:12px;line-height:1.5;text-align:center;overflow-wrap:anywhere;box-shadow:0 6px 20px rgba(0,0,0,.2);animation:ddp-in .2s ease}
@@ -2788,6 +2825,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
2788
2825
  poster: () => svg([h('rect', { key: 1, x: 5, y: 3, width: 14, height: 18, rx: 1.8 }), h('path', { key: 2, d: 'M5 16l4-4 3 3 2-2 5 5' }), h('circle', { key: 3, cx: 14.5, cy: 8, r: 1.6 })]),
2789
2826
  slides: () => svg([h('rect', { key: 1, x: 2.5, y: 4, width: 19, height: 12, rx: 1.8 }), h('path', { key: 2, d: 'M12 16v3M8.5 20.5h7' }), h('path', { key: 3, d: 'M6.5 8h6M6.5 11h4' })]),
2790
2827
  email: () => svg([h('rect', { key: 1, x: 3, y: 5, width: 18, height: 14, rx: 2.2 }), h('path', { key: 2, d: 'M3.5 6.5l8.5 6.5 8.5-6.5' })]),
2828
+ diagram: () => svg([h('rect', { key: 1, x: 2.5, y: 9.5, width: 6, height: 5, rx: 1.4 }), h('rect', { key: 2, x: 15.5, y: 3.5, width: 6, height: 4, rx: 1.2 }), h('rect', { key: 3, x: 15.5, y: 10, width: 6, height: 4, rx: 1.2 }), h('rect', { key: 4, x: 15.5, y: 16.5, width: 6, height: 4, rx: 1.2 }), h('path', { key: 5, d: 'M8.5 12h3.5M12 5.5v13M12 5.5h3.5M12 12h3.5M12 18.5h3.5' })]),
2791
2829
  caret: () => svg([h('path', { key: 1, d: 'M6 9.5l6 6 6-6', strokeWidth: 2.4 })], { className: 'cr' }),
2792
2830
  palette: () => svg([h('path', { key: 1, d: 'M12 3a9 9 0 1 0 0 18c1.1 0 1.7-.8 1.7-1.6 0-.9-.8-1.3-.8-2.1 0-.9.8-1.6 1.7-1.6H17a4 4 0 0 0 4-4C21 6.8 17 3 12 3z' }),
2793
2831
  h('circle', { key: 2, cx: 7.6, cy: 11.2, r: 1.25, fill: 'currentColor', stroke: 'none' }), h('circle', { key: 3, cx: 10.2, cy: 7.4, r: 1.25, fill: 'currentColor', stroke: 'none' }),
@@ -3180,7 +3218,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
3180
3218
  card: (v, t, s) => { const it = s.split('\n').filter((l) => /^\d+\. /.test(l)); return [['b', t('chipCheck', { n: v.n })], ...it.slice(0, 4).map((l) => ['span', l.replace(/ — .*$/, '')]), it.length > 4 ? ['span', '…'] : null] } },
3181
3219
  { i: 'code', label: (v, t) => t('chipCode'), alts: both('hoText', { only: '(?:,screens: [^\\n]*)?' }),
3182
3220
  card: (v, t) => [['b', t('chipCode')], ['code', v.fw], ['span', v.dest], ['span', v.scope]] },
3183
- { i: 'image', label: (v, t) => t('chipRef'), alts: L.map((x) => tplSrc(x.refText, { ask: lit(['refAsk', 'refAskNew']), w: '\\d+', h: '\\d+' })),
3221
+ { i: 'image', label: (v, t) => t('chipRef'), alts: L.map((x) => tplSrc(x.refText, { ask: lit(['refAsk', 'refAskNew', 'refAskDg', 'refAskDgRe']), w: '\\d+', h: '\\d+' })),
3184
3222
  card: (v, t) => [['b', t('chipRef')], ['img', chipThumbs.get(v.path)], ['sw', hexes(v.colors)], ['span', `${v.w}×${v.h} · ${v.tone}`], ['span', baseName(v.path)]] },
3185
3223
  { i: 'style', label: (v, t) => t('chipTweak'), alts: L.map((x) => ({ src: `${tplSrc(x.twAskHead).src}(?:\\n- [^\\n]*)+\\n${tplSrc(x.twAskTail).src}`, keys: [] })),
3186
3224
  card: (v, t, s) => [['b', t('chipTweak')], ...s.split('\n').filter((l) => l.startsWith('- ')).slice(0, 5).map((l) => ['span', l.slice(2)])] },
@@ -3735,7 +3773,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
3735
3773
  ['editorial', /新闻|杂志|博客|阅读|读书|书店|媒体|播客|\b(news|magazine|blog|reading|books?|media|newsletter)\b/i],
3736
3774
  ['swiss', /设计工作室|建筑|展览|美术馆|画廊|作品集|\b(agency|studio|architecture|exhibition|gallery|museum|portfolio)\b/i],
3737
3775
  ]
3738
- const AUTO_BY_KIND = { slides: 'swiss', web: 'minimal', desktop: 'tech', email: 'minimal', poster: 'playful', tablet: 'minimal' }
3776
+ const AUTO_BY_KIND = { slides: 'swiss', web: 'minimal', desktop: 'tech', email: 'minimal', poster: 'playful', tablet: 'minimal', diagram: 'tech' }
3739
3777
  const AUTO_SPREAD = ['minimal', 'editorial', 'playful', 'fresh', 'tech', 'glass', 'dark', 'sport']
3740
3778
  // 「北欧风」「清新风:首页…」「中国风的界面」算说了风格;先去掉「通风」「台风」「新风系统」「风控」「风景」这类不是风格的词
3741
3779
  const NOT_STYLE_FENG = /通风|台风|新风(系统|机|量)|风险|风控|风景|风扇|风味|风暴|风光|风速|风向|风筝|风铃|风车|吹风|防风|挡风|避风|屏风|旋风|狂风|微风|寒风|疾风|顺风|逆风|作风|中风|风湿|风水/g
@@ -4040,7 +4078,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
4040
4078
 
4041
4079
  // ── 导出图片:设备外框、整套展示图 ───────────────────────────────────────
4042
4080
 
4043
- const SHOW_COLS = { app: 4, miniprogram: 4, tablet: 3, desktop: 2, web: 2, poster: 3, slides: 2, email: 3 }
4081
+ const SHOW_COLS = { app: 4, miniprogram: 4, tablet: 3, desktop: 2, web: 2, poster: 3, slides: 2, email: 3, diagram: 2 }
4044
4082
  const CANVAS_FONT = '-apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif'
4045
4083
  const FRAMED = { app: 1, miniprogram: 1, tablet: 1, desktop: 1, web: 1 }
4046
4084
 
@@ -4332,9 +4370,11 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
4332
4370
  }
4333
4371
 
4334
4372
  /** 参考图 → 输入框里的一段字:路径、尺寸、深浅、主要颜色,加一句怎么用 */
4335
- function formatRef(t, { path, w, h, palette, hasDesign }) {
4373
+ // 图表(kind 'diagram'):不光照配色,版式、画法、版块之间怎么连也照参考图
4374
+ function formatRef(t, { path, w, h, palette, hasDesign, kind }) {
4336
4375
  const colors = palette.colors.map((c) => `${c.hex} ${Math.max(1, Math.round(c.share * 100))}%${c.accent ? t('refAccent') : ''}`).join(t('refJoin'))
4337
- return t('refText', { path, w, h, tone: t(palette.light ? 'refLight' : 'refDark'), colors: colors || '—', ask: t(hasDesign ? 'refAsk' : 'refAskNew') })
4376
+ const ask = kind === 'diagram' ? (hasDesign ? 'refAskDgRe' : 'refAskDg') : hasDesign ? 'refAsk' : 'refAskNew'
4377
+ return t('refText', { path, w, h, tone: t(palette.light ? 'refLight' : 'refDark'), colors: colors || '—', ask: t(ask) })
4338
4378
  }
4339
4379
 
4340
4380
  /** 读参考图:缩小了取颜色;文件本身原样送去存(太大或不是常见格式就重新编成 PNG) */
@@ -4521,12 +4561,12 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
4521
4561
 
4522
4562
  // ── 设计类型:画幅和外框 ─────────────────────────────────────────────────
4523
4563
 
4524
- const KIND_LIST = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email']
4525
- const KIND_KEY = { web: 'kindWeb', app: 'kindApp', miniprogram: 'kindMini', tablet: 'kindTablet', desktop: 'kindDesktop', poster: 'kindPoster', slides: 'kindSlides', email: 'kindEmail' }
4564
+ const KIND_LIST = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email', 'diagram']
4565
+ const KIND_KEY = { web: 'kindWeb', app: 'kindApp', miniprogram: 'kindMini', tablet: 'kindTablet', desktop: 'kindDesktop', poster: 'kindPoster', slides: 'kindSlides', email: 'kindEmail', diagram: 'kindDiagram' }
4526
4566
  const GHOST_MS = 90000 // 这么久没出新屏就撤掉「生成中…」占位
4527
4567
  const HOLD_MAX = 15000 // 草稿放到一半真文件就落地了:最多再放这么久(一般几秒放完自己说一声)
4528
4568
  const EDIT_GRACE_MS = 3000 // 退出改字后这么久里,页面交上来的最后一处改动还收
4529
- const KIND_SIZE = { web: [1280, 800], app: [390, 844], miniprogram: [375, 812], tablet: [820, 1180], desktop: [1280, 800], poster: [1080, 1350], slides: [1280, 720], email: [640, 960] }
4569
+ const KIND_SIZE = { web: [1280, 800], app: [390, 844], miniprogram: [375, 812], tablet: [820, 1180], desktop: [1280, 800], poster: [1080, 1350], slides: [1280, 720], email: [640, 960], diagram: [1600, 1000] }
4530
4570
  // 外框:pad 边框厚度、top 顶上一条(浏览器栏)、r 外圆角、ir 屏幕圆角、island 灵动岛离顶的距离、capsule 小程序右上角的胶囊、win 桌面软件的窗口按钮
4531
4571
  const FRAME = {
4532
4572
  web: { pad: 0, top: 34, r: 10, ir: 0 },
@@ -4537,6 +4577,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
4537
4577
  poster: { pad: 0, top: 0, r: 6, ir: 6 },
4538
4578
  slides: { pad: 0, top: 0, r: 8, ir: 8 },
4539
4579
  email: { pad: 0, top: 0, r: 10, ir: 10 },
4580
+ diagram: { pad: 0, top: 0, r: 8, ir: 8 },
4540
4581
  }
4541
4582
 
4542
4583
  /** 某个大小的外框:矮的手机(SE 那种,高不到宽的 1.9 倍)没有灵动岛,不然压住页面最上面 */
@@ -4549,7 +4590,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
4549
4590
  // 桌面软件的窗口按钮(和 picker.js 的一样):Mac 红绿灯在左上 x 20、y 20 起,三个 12px 圆点隔 8;Windows 最小化 / 最大化 / 关闭在右上角,各 46×32
4550
4591
  const LIGHTS = { x: 20, y: 20, d: 12, gap: 8 }
4551
4592
  const WINBTN = { w: 46, h: 32 }
4552
- const META_ALIAS = { phone: 'app', mobile: 'app', ios: 'app', android: 'app', mini: 'miniprogram', miniapp: 'miniprogram', weapp: 'miniprogram', wechat: 'miniprogram', 小程序: 'miniprogram', pad: 'tablet', ipad: 'tablet', pc: 'desktop', electron: 'desktop', tauri: 'desktop', mac: 'desktop', macos: 'desktop', windows: 'desktop', win: 'desktop', 桌面: 'desktop', 桌面软件: 'desktop', social: 'poster', image: 'poster', slide: 'slides', deck: 'slides', ppt: 'slides', mail: 'email' }
4593
+ const META_ALIAS = { phone: 'app', mobile: 'app', ios: 'app', android: 'app', mini: 'miniprogram', miniapp: 'miniprogram', weapp: 'miniprogram', wechat: 'miniprogram', 小程序: 'miniprogram', pad: 'tablet', ipad: 'tablet', pc: 'desktop', electron: 'desktop', tauri: 'desktop', mac: 'desktop', macos: 'desktop', windows: 'desktop', win: 'desktop', 桌面: 'desktop', 桌面软件: 'desktop', social: 'poster', image: 'poster', slide: 'slides', deck: 'slides', ppt: 'slides', mail: 'email', mindmap: 'diagram', roadmap: 'diagram', architecture: 'diagram', flowchart: 'diagram', 思维导图: 'diagram', 导图: 'diagram', 路线图: 'diagram', 架构图: 'diagram', 图表: 'diagram' }
4553
4594
 
4554
4595
  /** 页面里 <meta name="dsh-design" content="app"> / "poster 1080x1920" / "desktop windows" → { kind, size, os }(os:win,不写是 Mac) */
4555
4596
  function parseMeta(content) {
@@ -4571,7 +4612,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
4571
4612
  }
4572
4613
 
4573
4614
  // 定死画面的类型:页面比默认画幅大(写死了 1440×810 又没写进 meta)就按页面实际大小。比例不像一页的(几页竖着堆的)不算
4574
- const AUTO_RATIO = { slides: [1.2, 2.4], poster: [0.45, 2.5] }
4615
+ const AUTO_RATIO = { slides: [1.2, 2.4], poster: [0.45, 2.5], diagram: [0.3, 4] }
4575
4616
 
4576
4617
  /** 各屏量到的实际大小 → 'WxH'(都没比默认大:'')。和 look.js 的 autoSize 一样 */
4577
4618
  function autoSize(list, kind) {
@@ -5029,6 +5070,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
5029
5070
  poster: [[8, 6, 84, 50], [8, 61, 70, 8], [8, 72, 50, 4], [8, 84, 36, 7]],
5030
5071
  slides: [[6, 10, 60, 13], [6, 32, 40, 52], [52, 32, 42, 52]],
5031
5072
  email: [[10, 4, 80, 7], [10, 14, 80, 30], [10, 48, 60, 5], [10, 56, 80, 14], [10, 75, 30, 6]],
5073
+ diagram: [[38, 40, 24, 18], [6, 14, 22, 10], [6, 45, 22, 10], [6, 76, 22, 10], [72, 14, 22, 10], [72, 45, 22, 10], [72, 76, 22, 10]],
5032
5074
  }
5033
5075
  const GD_C = ['#4d6bfe', '#e8590c', '#0ca678']
5034
5076
  /** 占位里的鼠标什么时候动:换了在做的事、或者又写了 15 行就加一;不在生成就不动 */
@@ -7001,7 +7043,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7001
7043
  const n = { name: name || t('exThisName') } // 写出是哪一屏,别只说「这一屏」
7002
7044
  if (FRAMED[kind]) items.push(['frame', I.single, t('exFrame', n)])
7003
7045
  items.push(['raw', I.image, t('exRaw', n)])
7004
- if (kind !== 'poster' && kind !== 'slides') items.push(['long', I.long, t('exLong', n)]) // 海报、幻灯片画幅是定的,没有「整页」
7046
+ if (kind !== 'poster' && kind !== 'slides' && kind !== 'diagram') items.push(['long', I.long, t('exLong', n)]) // 海报、幻灯片、图表画幅是定的,没有「整页」
7005
7047
  if (count > 1) items.push(['show', I.canvas, t('exShow')])
7006
7048
  items.push(['pdf', I.pdf, t('exPdf')], ['pptx', I.deck, t('exPptx')], ['opts', I.sliders, t('exOpts')])
7007
7049
  return items
@@ -7364,7 +7406,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7364
7406
 
7365
7407
  // ── 设计库 › 市场 ──
7366
7408
  const GALLERY_REPO = 'https://github.com/OrderG-X/dsh-design-gallery'
7367
- const MK_KINDS = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email']
7409
+ const MK_KINDS = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email', 'diagram']
7368
7410
  const mkPick = (t, x) => { const o = x || {}; return String((t('lang') === 'en' ? o.en || o.zh : o.zh || o.en) || '') }
7369
7411
  const mkUrl = (e) => e.submission || `${GALLERY_REPO}/tree/main/${e.type === 'system' ? 'systems' : e.type === 'style' ? 'styles' : 'templates'}/${e.id}`
7370
7412
  const mkErr = (t, e) => { const k = String((e && e.message) || e || ''); const m = t('mkErr_' + k); return m && m !== 'mkErr_' + k ? m : k }
@@ -7428,8 +7470,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7428
7470
  }
7429
7471
 
7430
7472
  // 首页大输入框:说一句 + 类型 + 风格 → onSend(发给模型)。没写字时 Tab 用占位里的例子
7431
- const ASK_KINDS = ['app', 'miniprogram', 'web', 'poster', 'slides', 'tablet', 'desktop', 'email']
7432
- const ASK_EX = { web: 'exWeb', app: 'exApp', miniprogram: 'exMini', tablet: 'exTablet', desktop: 'exDesktop', poster: 'exPoster', slides: 'exSlides', email: 'exEmail' }
7473
+ const ASK_KINDS = ['app', 'miniprogram', 'web', 'poster', 'slides', 'diagram', 'tablet', 'desktop', 'email']
7474
+ const ASK_EX = { web: 'exWeb', app: 'exApp', miniprogram: 'exMini', tablet: 'exTablet', desktop: 'exDesktop', poster: 'exPoster', slides: 'exSlides', email: 'exEmail', diagram: 'exDiagram' }
7433
7475
  function HomeAsk({ t, onSend, onRef, plus, draft, note, autoFocus }) {
7434
7476
  const d0 = (draft && draft.current) || {}
7435
7477
  const [text, setText] = useState(d0.text || '')
@@ -7646,8 +7688,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7646
7688
  h('div', { className: 'acts' },
7647
7689
  isTpl ? h('button', { className: 'ddp-pbtn', disabled: busy, title: t('mkUseTip'), onClick: use }, t('mkUse')) : null,
7648
7690
  e.type === 'system' ? h('button', { className: 'ddp-pbtn', disabled: busy, onClick: install }, t('mkInstall')) : null,
7649
- // 海报、幻灯片是定尺寸的画面、没什么可点的:只看截图(实时看会按原尺寸撑出框)
7650
- !err && e.type !== 'style' && e.kind !== 'poster' && e.kind !== 'slides' ? h('button', { className: 'ddp-sbtn', disabled: busy, title: t('mkLiveTip'), onClick: () => (live ? setLive(null) : goLive()) }, live ? t('mkShotsBack') : t('mkLive')) : null,
7691
+ // 海报、幻灯片、图表是定尺寸的画面、没什么可点的:只看截图(实时看会按原尺寸撑出框)
7692
+ !err && e.type !== 'style' && e.kind !== 'poster' && e.kind !== 'slides' && e.kind !== 'diagram' ? h('button', { className: 'ddp-sbtn', disabled: busy, title: t('mkLiveTip'), onClick: () => (live ? setLive(null) : goLive()) }, live ? t('mkShotsBack') : t('mkLive')) : null,
7651
7693
  e.type !== 'style' ? h('button', { className: 'ddp-sbtn' + (fav ? ' on' : ''), title: t('mkFavTip'), 'aria-pressed': !!fav, onClick: toggleFav }, fav ? '★ ' + t('mkFaved') : '☆ ' + t('mkFav')) : null),
7652
7694
  h('ul', { className: 'facts' },
7653
7695
  h('li', null, t('mkSafe')),
@@ -7686,7 +7728,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7686
7728
  * over 比画幅大(横向永远会被裁;幻灯片、海报竖向也算);long 长页只截到一部分;dead 点了没反应的链接
7687
7729
  */
7688
7730
  function precheckOf(list, kind, limit) {
7689
- const fixed = kind === 'slides' || kind === 'poster'
7731
+ const fixed = kind === 'slides' || kind === 'poster' || kind === 'diagram'
7690
7732
  const r = { over: 0, long: 0, moved: 0, dead: 0, fail: 0, ai: new Set(list.flatMap((m) => (Array.isArray(m.aiPhotos) ? m.aiPhotos : []))).size }
7691
7733
  for (const m of list) {
7692
7734
  if (m.failed) { r.fail++; continue }
@@ -7702,7 +7744,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7702
7744
 
7703
7745
  /** 「按内容改画幅」改成多大:'宽x高',不用改或改不了返回 ''。幻灯片、海报按量到的版面,别的只把宽度加上去;竖着堆了好几页的不改高 */
7704
7746
  function fitCanvas(list, kind, size) {
7705
- const fixed = kind === 'slides' || kind === 'poster'
7747
+ const fixed = kind === 'slides' || kind === 'poster' || kind === 'diagram'
7706
7748
  let [W, H] = size
7707
7749
  for (const m of list) {
7708
7750
  if (m.failed) continue
@@ -9925,7 +9967,10 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
9925
9967
  const r = await readRef(file)
9926
9968
  const saved = await post('ref', { session: sid, name: file.name || 'ref', data: r.data })
9927
9969
  keepThumb(saved.path, r.img)
9928
- insert(formatRef(t, { path: saved.path, w: r.w, h: r.h, palette: r.palette, hasDesign: !!url }), 'insertedSend')
9970
+ // 首页开着:按首页选的类型(新做);不然按开着的设计
9971
+ const home = !url || homeAt === 'on'
9972
+ const rk = home ? (homeDraft.current && homeDraft.current.kind) || '' : kind
9973
+ insert(formatRef(t, { path: saved.path, w: r.w, h: r.h, palette: r.palette, hasDesign: !home, kind: rk }), 'insertedSend')
9929
9974
  } catch (e) {
9930
9975
  say(t('refFail', { msg: e.message }))
9931
9976
  }
package/lib/core.js CHANGED
@@ -34,8 +34,8 @@ const BG_JOB = /\bbackground job\s+`?([\w.:-]{3,})/i
34
34
  const MAX_SCREENS = 60 // 右侧最多显示几屏,再多的收起来并提示(画布同时只挂 24 屏,见 client.js 的 LIVE_MAX)
35
35
  const MAX_ROUTES = 300 // 开发服务器的路由先都记着(只为算出收起了几屏);再多就是写飞了
36
36
 
37
- // 设计类型:决定右侧用什么画幅显示(网页框、手机、小程序、平板、桌面软件窗口、海报、幻灯片、邮件)
38
- export const KINDS = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email']
37
+ // 设计类型:决定右侧用什么画幅显示(网页框、手机、小程序、平板、桌面软件窗口、海报、幻灯片、邮件、图表)
38
+ export const KINDS = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email', 'diagram']
39
39
  const KIND_ALIAS = {
40
40
  website: 'web', site: 'web', page: 'web', landing: 'web', dashboard: 'web',
41
41
  phone: 'app', mobile: 'app', ios: 'app', android: 'app',
@@ -45,6 +45,7 @@ const KIND_ALIAS = {
45
45
  social: 'poster', image: 'poster', banner: 'poster', card: 'poster', flyer: 'poster', cover: 'poster',
46
46
  slide: 'slides', deck: 'slides', ppt: 'slides', presentation: 'slides',
47
47
  mail: 'email', newsletter: 'email', edm: 'email',
48
+ mindmap: 'diagram', 'mind-map': 'diagram', roadmap: 'diagram', architecture: 'diagram', arch: 'diagram', flowchart: 'diagram', 思维导图: 'diagram', 导图: 'diagram', 脑图: 'diagram', 路线图: 'diagram', 技术路线图: 'diagram', 架构图: 'diagram', 图表: 'diagram',
48
49
  }
49
50
 
50
51
  /** 类型名(含常见别名)→ KINDS 里的一个;认不出返回 '' */
@@ -38,10 +38,10 @@ export const capsOf = (mode) => (mode === 'share' || mode === 'ci'
38
38
  : { files: LIMITS.localFiles, screens: LIMITS.localScreens, total: LIMITS.localTotal })
39
39
  export const TYPES = ['template', 'system', 'style']
40
40
  export const LICENSES = ['CC0-1.0', 'CC-BY-4.0']
41
- export const KINDS = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email']
41
+ export const KINDS = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email', 'diagram']
42
42
  export const STYLE_IDS = ['minimal', 'warm', 'editorial', 'dark', 'playful', 'fresh', 'tech', 'glass', 'soft', 'guochao', 'ink', 'cyber', 'cute', 'retro', 'sale', 'japandi', 'swiss', 'brutal', 'cream', 'sport']
43
43
  export const HEADS = ['SANS', 'SERIF', 'ROUND', 'MONO', 'GROTESK'] // 风格卡的字体只能是这几种系统字体栈
44
- const META_ALIAS = { phone: 'app', mobile: 'app', ios: 'app', android: 'app', mini: 'miniprogram', miniapp: 'miniprogram', weapp: 'miniprogram', wechat: 'miniprogram', 小程序: 'miniprogram', pad: 'tablet', ipad: 'tablet', pc: 'desktop', electron: 'desktop', tauri: 'desktop', mac: 'desktop', macos: 'desktop', windows: 'desktop', win: 'desktop', 桌面: 'desktop', 桌面软件: 'desktop', social: 'poster', image: 'poster', slide: 'slides', deck: 'slides', ppt: 'slides', mail: 'email' }
44
+ const META_ALIAS = { phone: 'app', mobile: 'app', ios: 'app', android: 'app', mini: 'miniprogram', miniapp: 'miniprogram', weapp: 'miniprogram', wechat: 'miniprogram', 小程序: 'miniprogram', pad: 'tablet', ipad: 'tablet', pc: 'desktop', electron: 'desktop', tauri: 'desktop', mac: 'desktop', macos: 'desktop', windows: 'desktop', win: 'desktop', 桌面: 'desktop', 桌面软件: 'desktop', social: 'poster', image: 'poster', slide: 'slides', deck: 'slides', ppt: 'slides', mail: 'email', mindmap: 'diagram', roadmap: 'diagram', architecture: 'diagram', flowchart: 'diagram', 思维导图: 'diagram', 导图: 'diagram', 路线图: 'diagram', 架构图: 'diagram', 图表: 'diagram' }
45
45
 
46
46
  const EXT = { html: 'html', css: 'css', svg: 'svg', png: 'image', jpg: 'image', jpeg: 'image', webp: 'image', gif: 'image', avif: 'image', json: 'json', md: 'md' }
47
47
  const DATA_IMAGE = /^data:image\/(png|jpe?g|webp|gif|avif)(;[a-z0-9=._-]+)*(;base64)?,/i
package/lib/index.js CHANGED
@@ -99,10 +99,11 @@ export const studio = { tracker: null, autoOpen: 0, offline: 0, annotations: 0,
99
99
  export const designSkill = {
100
100
  name: 'ui-design',
101
101
  description:
102
- '做网页、App 界面、平板界面、海报 / 社媒图、幻灯片、邮件、组件这类界面设计之前先加载:' +
102
+ '做网页、App 界面、小程序、平板界面、桌面软件、海报 / 社媒图、幻灯片、邮件、图表(思维导图、技术路线图、产品路线图、架构图)、组件这类设计之前先加载:' +
103
103
  '配合右侧「设计工作台」画布的做法(一屏一个文件、设计变量、类型标记)、现代设计原则、中文排版、各类型画幅要点、避免 AI 味、设计自查清单。' +
104
- '只是把回答做成一页给用户看或用(对比、表格、清单、图表、计算器这类)不算界面设计:有 show_page 工具就直接用它,不加载这个技能。',
105
- whenToUse: '用户要做或改网站 / App / 海报 / 幻灯片这类界面或视觉设计时(把回答做成一页、有 show_page 工具时用 show_page)',
104
+ '只是把回答做成一页给用户看或用(对比、表格、清单、数据图表、计算器这类,或者在对话里随手看一张导图)不算设计:有 show_page 工具就直接用它,不加载这个技能;' +
105
+ '要「设计」、做好看的、要导出成图片 / PDF / PPT 的思维导图、路线图、架构图才用这个技能。',
106
+ whenToUse: '用户要做或改网站 / App / 海报 / 幻灯片 / 思维导图 / 路线图 / 架构图这类界面或视觉设计时(把回答做成一页、有 show_page 工具时用 show_page)',
106
107
  invocation: { modelInvocable: true, userInvocable: true },
107
108
  provider: 'dsh-design-studio',
108
109
  source: 'bundled',
@@ -129,8 +130,8 @@ export const previewTool = {
129
130
  name: 'preview_page',
130
131
  description:
131
132
  '在右侧栏「设计工作台」里实时打开一个页面,用户能边看边点选要改的地方。' +
132
- '做网页、App 界面、小程序、海报、幻灯片、邮件这类界面设计时用:写好第一个 HTML 文件、或启动开发服务器后调一次就行,之后改文件会自动刷新,不用再调。' +
133
- '只是把回答做成一页(对比、表格、清单、图表、计算器)给用户看或用时,有 show_page 工具就用它,不用这里。' +
133
+ '做网页、App 界面、小程序、海报、幻灯片、邮件、图表(思维导图、路线图、架构图)这类设计时用:写好第一个 HTML 文件、或启动开发服务器后调一次就行,之后改文件会自动刷新,不用再调。' +
134
+ '只是把回答做成一页(对比、表格、清单、数据图表、计算器)给用户看或用时,有 show_page 工具就用它,不用这里。' +
134
135
  '本地 HTML 写文件路径;开发服务器写地址或端口(如 http://localhost:5173)。只能预览本机页面。' +
135
136
  'kind 说明是哪类设计,右侧按它的画幅显示(App 套手机外框、幻灯片 16:9 …)。' +
136
137
  '动手设计前先加载 ui-design 技能(设计流程、规范和自查清单)。' +
@@ -142,7 +143,7 @@ export const previewTool = {
142
143
  kind: {
143
144
  type: 'string',
144
145
  enum: KINDS,
145
- description: '设计类型:web 网页(默认)、app 手机 App 界面(390×844)、miniprogram 微信小程序(375×812,外框带右上角胶囊)、tablet 平板、desktop 桌面软件(1280×800 的 Mac 窗口;Windows 软件在页面 meta 写 desktop windows)、poster 海报 / 社媒图(1080×1350)、slides 幻灯片(16:9)、email 邮件',
146
+ description: '设计类型:web 网页(默认)、app 手机 App 界面(390×844)、miniprogram 微信小程序(375×812,外框带右上角胶囊)、tablet 平板、desktop 桌面软件(1280×800 的 Mac 窗口;Windows 软件在页面 meta 写 desktop windows)、poster 海报 / 社媒图(1080×1350)、slides 幻灯片(16:9)、email 邮件、diagram 图表(思维导图、技术路线图、产品路线图、架构图,默认 1600×1000,图多大画幅跟着多大)',
146
147
  },
147
148
  size: { type: 'string', description: '画幅尺寸,可选,如 1080x1920;不填按类型的默认尺寸' },
148
149
  screens: {
@@ -611,7 +612,7 @@ export const styleTool = {
611
612
  '用户点了风格卡(消息里有〔风格〕)、自己定了具体的风格或配色、或有默认的品牌设计系统时不用调;只说「你定」「帮我推荐一个」「出几个风格挑」算没定,要调。',
612
613
  parameters: specToJsonSchema({
613
614
  subject: { type: 'string', required: true, description: '这次要做什么,直接写用户的原话' },
614
- kind: { type: 'string', enum: ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email'], description: '设计类型' },
615
+ kind: { type: 'string', enum: ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email', 'diagram'], description: '设计类型' },
615
616
  count: { type: 'number', description: '要几个方向,1–3,默认 1;要先出三个方向时填 3,每个方向一张不同的卡' },
616
617
  }),
617
618
  output: {
package/lib/look.js CHANGED
@@ -9,9 +9,9 @@
9
9
  import fs from 'node:fs'
10
10
  import path from 'node:path'
11
11
 
12
- export const KIND_SIZE = { web: [1280, 800], app: [390, 844], miniprogram: [375, 812], tablet: [820, 1180], desktop: [1280, 800], poster: [1080, 1350], slides: [1280, 720], email: [640, 960] }
12
+ export const KIND_SIZE = { web: [1280, 800], app: [390, 844], miniprogram: [375, 812], tablet: [820, 1180], desktop: [1280, 800], poster: [1080, 1350], slides: [1280, 720], email: [640, 960], diagram: [1600, 1000] }
13
13
  const KIND_LIST = Object.keys(KIND_SIZE)
14
- const META_ALIAS = { phone: 'app', mobile: 'app', ios: 'app', android: 'app', mini: 'miniprogram', miniapp: 'miniprogram', weapp: 'miniprogram', wechat: 'miniprogram', 小程序: 'miniprogram', pad: 'tablet', ipad: 'tablet', pc: 'desktop', electron: 'desktop', tauri: 'desktop', mac: 'desktop', macos: 'desktop', windows: 'desktop', win: 'desktop', 桌面: 'desktop', 桌面软件: 'desktop', social: 'poster', image: 'poster', slide: 'slides', deck: 'slides', ppt: 'slides', mail: 'email' }
14
+ const META_ALIAS = { phone: 'app', mobile: 'app', ios: 'app', android: 'app', mini: 'miniprogram', miniapp: 'miniprogram', weapp: 'miniprogram', wechat: 'miniprogram', 小程序: 'miniprogram', pad: 'tablet', ipad: 'tablet', pc: 'desktop', electron: 'desktop', tauri: 'desktop', mac: 'desktop', macos: 'desktop', windows: 'desktop', win: 'desktop', 桌面: 'desktop', 桌面软件: 'desktop', social: 'poster', image: 'poster', slide: 'slides', deck: 'slides', ppt: 'slides', mail: 'email', mindmap: 'diagram', roadmap: 'diagram', architecture: 'diagram', flowchart: 'diagram', 思维导图: 'diagram', 导图: 'diagram', 路线图: 'diagram', 架构图: 'diagram', 图表: 'diagram' }
15
15
  // 只给宽度时的高:常见真机的屏幕高;别的宽度按这一类默认的宽高比
16
16
  const PHONE_H = { 320: 568, 360: 780, 375: 667, 390: 844, 393: 852, 402: 874, 412: 915, 414: 896, 428: 926, 430: 932, 440: 956 }
17
17
  const TABLET_H = { 744: 1133, 768: 1024, 810: 1080, 820: 1180, 834: 1194, 1024: 1366, 1032: 1376 }
@@ -51,8 +51,8 @@ export function sizeOf(v, kind) {
51
51
  return [w, dh]
52
52
  }
53
53
 
54
- // 定死画面的类型:页面比默认画幅大(写死了 1440×810 又没写进 meta)就按页面实际大小。比例不像一页的(几页竖着堆的)不算
55
- const AUTO_RATIO = { slides: [1.2, 2.4], poster: [0.45, 2.5] }
54
+ // 定死画面的类型:页面比默认画幅大(写死了 1440×810 又没写进 meta)就按页面实际大小。比例不像一页的(几页竖着堆的)不算。图表:图多大画幅多大
55
+ const AUTO_RATIO = { slides: [1.2, 2.4], poster: [0.45, 2.5], diagram: [0.3, 4] }
56
56
 
57
57
  /** 各屏量到的实际大小 → 'WxH'(都没比默认大:'')。和右侧栏 client.js 的 autoSize 一样 */
58
58
  export function autoSize(list, kind) {
@@ -403,7 +403,7 @@ const TYPE = {
403
403
  tiny: '字太小', img: '图片没加载出来', fonts: '字号太杂', distort: '图片被拉变形', long: '一行太长', wrap: '文字被挤断行',
404
404
  covered: '被固定栏压住', tight: '离固定栏太近', jserr: '页面脚本报错', missing: '文件没载出来', deadlink: '跳到的页面不存在',
405
405
  capsule: '被小程序胶囊挡住', island: '被灵动岛挡住', homebar: '伸进底部横条区', tabbar: '标签栏项太多', navbar: '没有导航栏',
406
- winctl: '被窗口按钮挡住',
406
+ winctl: '被窗口按钮挡住', dgsize: '图比画幅大', dgli: '导图节点写法不对', dgmany: '一层放太多', dgbar: '横条超出时间轴', dgtext: '节点字太多', dgsmall: '字偏小', dglink: '箭头没对着模块',
407
407
  }
408
408
  const EDGE = { top: '顶栏', bottom: '底栏' }
409
409
  const WHAT = { css: '样式表', script: '脚本', font: '字体', link: '文件', video: '视频', audio: '音频', source: '媒体', iframe: '内嵌页' }
@@ -455,6 +455,13 @@ export function detailOf(it) {
455
455
  : `伸进左上角红绿灯 ${it.px}px(外框画的、盖在页面上面,在 x 20–72、y 20–32:工具栏 / 侧栏顶上左边空出 80px,标题、按钮从 x 80 以后放)`
456
456
  case 'jserr': return `${it.msg}${it.src ? `(${it.src}${it.line ? `:${it.line}` : ''})` : ''}`
457
457
  case 'missing': return `${WHAT[it.what] || '文件'} ${it.src} 载不出来(路径写错了,或者文件不在)`
458
+ case 'dgsize': return `图有 ${it.w}×${it.h},画幅只有 ${it.vw}×${it.vh}:把 meta 改成 diagram ${it.w}x${it.h}(preview_page 的 size 也改),或者删减节点、改小间距`
459
+ case 'dgli': return '字直接写在 li 里,或者 li 的第一个孩子不是 <span class="mm-node">:连线会对不上,改成 <li><span class="mm-node">…</span><ul>…</ul></li>'
460
+ case 'dgmany': return it.what === 'box' ? `一行 ${it.n} 个框(最多 ${it.max} 个):拆成两行,或者合并几个` : `这一层 ${it.n} 个分支(最多 ${it.max} 个):合并几个、往下多分一层,或者拆成两张图`
461
+ case 'dgbar': return `从第 ${it.from} 段起占 ${it.span} 段,可时间轴只有 ${it.cols} 段(--cols):改小 --span / --from,或者加大 --cols 并补上表头`
462
+ case 'dgtext': return `${it.chars} 个字(最好 ≤ ${it.max}):节点写关键词,补充放 <small>,或者拆成下一级`
463
+ case 'dglink': return '这排箭头和上下两层的模块对不上:箭头个数和模块个数一样(空栏放 <i></i>);层里的递进别插 dg-link,改成 <div class="ar-mods seq">(箭头画在空隙里);挨着箭头的层别用 ar-group'
464
+ case 'dgsmall': return `正文约 ${it.px}px,画幅 ${it.vw} 宽:贴进 Word(16 厘米宽)只有约 ${it.pt} 磅,看不清。正文放大到 ${it.need}px 左右(diagram.css 的字整体放大:.dg-page { --dg-scale: … }),或者把画幅改窄;放不下就删减、拆成两张图——加大画幅字一样小`
458
465
  default: return ''
459
466
  }
460
467
  }