dsh-design-studio 0.21.0 → 0.23.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/lib/client.js CHANGED
@@ -61,6 +61,7 @@ window.__ModuleLoader__.load({
61
61
  exSlides: '新品发布会的五页幻灯片:问题、方案、数字、价格、下一步',
62
62
  exEmail: '会员生日月的优惠邮件:一张大图、一段祝福、一个按钮',
63
63
  exDiagram: '「产品经理入门」的思维导图:用户研究、需求分析、原型、数据、项目管理',
64
+ exDshplugin: "做一个 DSH 插件「番茄钟」:会话标签页里放计时器和今日记录",
64
65
  askKindLine: '类型:{k}',
65
66
  askMore: '更多开始方式',
66
67
  askMoreD: '打开已有的 HTML、用自己的品牌、从设计库打开',
@@ -79,7 +80,6 @@ window.__ModuleLoader__.load({
79
80
  homeRecent: '接着做',
80
81
  homeRecentAll: '全部作品 →',
81
82
  waysHtml: '打开已有的 HTML',
82
- moreWays: '其他开始方式',
83
83
  emptyHint: '输入文件路径,或本地端口(比如 5173)',
84
84
  emptyHintPick: '点「浏览…」选一个、直接拖进来,或输入文件路径 / 本地端口(比如 5173)',
85
85
  browse: '浏览…',
@@ -106,7 +106,6 @@ window.__ModuleLoader__.load({
106
106
  placeholder: '/路径/index.html 或 5173',
107
107
  go: '打开',
108
108
  pick: '选择',
109
- pickTip: '点选元素或框选区域,发给模型(Esc 取消)',
110
109
  pickAny: '点选任意一屏里的元素,或拖出一块区域 · Esc 取消',
111
110
  pickOne: '点选一个元素,或拖出一块区域 · Esc 取消',
112
111
  pickArea: '选中区域',
@@ -131,10 +130,7 @@ window.__ModuleLoader__.load({
131
130
  chipTokens: '建设计变量',
132
131
  pickElems: '{n} 个元素',
133
132
  textAny: '点任意一屏里的文字直接改 · 回车保存 · Esc 退出',
134
- refPick: '照参考图改风格…',
135
- refChoose: '选一张',
136
133
  refPickTip: '选一张参考图,照它的风格改(也可以把图片拖进预览区,或在这里粘贴)',
137
- refEmpty: '照参考图做:拖进来、粘贴,或',
138
134
  refDrop: '松开,作为参考图',
139
135
  refDropSub: '存进设计目录的 refs/,提取配色放进输入框',
140
136
  refNotImage: '只认图片(PNG / JPG / WebP / GIF)',
@@ -153,7 +149,7 @@ window.__ModuleLoader__.load({
153
149
  canvas: '画布:几屏并排看',
154
150
  single: '单页:只看一屏',
155
151
  sizes: '多尺寸:同一屏在手机 / 平板 / 电脑上并排看',
156
- sizesNo: '海报、幻灯片、邮件、图表是固定画幅,没有多尺寸',
152
+ sizesNo: '海报、幻灯片、邮件、图表、DSH 插件是固定画幅,没有多尺寸',
157
153
  szPhone: '手机',
158
154
  szTablet: '平板',
159
155
  szDesktop: '电脑',
@@ -170,8 +166,8 @@ window.__ModuleLoader__.load({
170
166
  kindSlides: '幻灯片',
171
167
  kindEmail: '邮件',
172
168
  kindDiagram: '图表',
169
+ kindDshplugin: "DSH 插件",
173
170
  tokens: '设计规范',
174
- tokensTip: '点一个放进输入框,补一句怎么改;改它所有屏一起变',
175
171
  tokensEmpty: '这套设计还没有设计变量(:root 上的 CSS 变量),颜色字号散在各处,改起来不统一。',
176
172
  tokensAsk: '让模型建一份',
177
173
  tokensAskText: '按 ui-design 技能给这套设计建一份 tokens.css(颜色、字体、字号、间距、圆角、阴影),所有屏都改成用这些变量。',
@@ -182,7 +178,6 @@ window.__ModuleLoader__.load({
182
178
  gRadius: '圆角',
183
179
  gShadow: '阴影',
184
180
  gOther: '其他',
185
- exportT: '导出',
186
181
  exFrame: '{name} · 带外框',
187
182
  exRaw: '{name} · 纯画面',
188
183
  exLong: '{name} · 整页长图',
@@ -229,7 +224,6 @@ window.__ModuleLoader__.load({
229
224
  exWhere: '存到设计目录的 exports/;图片还会复制到剪贴板',
230
225
  exportedDoc: '已导出 {name}({n} 页)',
231
226
  check: '设计体检',
232
- checkTip: '设计体检:量一量文字溢出、重叠、对比度、点击区、字号',
233
227
  checking: '正在体检…',
234
228
  checkNone: '没发现问题',
235
229
  checkSum: '{s} 屏 · {n} 个问题',
@@ -239,7 +233,6 @@ window.__ModuleLoader__.load({
239
233
  checkFail: '没查成:{msg}',
240
234
  checkLayout: '页面还没排好版,这次没量成,过一会儿再查一次',
241
235
  checkNote: '只量得出排版上的硬伤,好不好看还得你看',
242
- checkCount: '设计体检:上次量出 {n} 个问题,点开看',
243
236
  checkAsk: '〔设计体检〕发现 {n} 个问题:',
244
237
  checkTail: '请逐个修好:改源文件,只动有问题的地方;颜色、字号能改设计变量就改设计变量。',
245
238
  ckToolHead: '量了 {s} 屏,发现 {n} 个问题。逐个改源文件,只动有问题的地方;颜色、字号能改设计变量就改设计变量:',
@@ -275,6 +268,7 @@ window.__ModuleLoader__.load({
275
268
  ck_dgtext: '节点字太多',
276
269
  ck_dgsmall: '字偏小',
277
270
  ck_dglink: '箭头没对着模块',
271
+ ck_frame: '外框被改动',
278
272
  cd_hscroll: '伸出屏幕 {px}px',
279
273
  cd_clipped: '被切掉 {px}px',
280
274
  cd_overflow: '伸出框 {px}px',
@@ -303,6 +297,7 @@ window.__ModuleLoader__.load({
303
297
  cd_dgbar: '从第 {from} 段起占 {span} 段,时间轴只有 {cols} 段',
304
298
  cd_dgtext: '{chars} 个字(最好 ≤ {max}):写关键词,补充放小字',
305
299
  cd_dglink: '这排箭头和上下两层的模块对不上:个数要一样,层里的递进改用不占位的箭头',
300
+ cd_frame: 'DSH 的外框和模板对不上:外框要原样复制,插件只写在 data-slot 里面,样式都从 [data-slot="main"] 开头',
306
301
  cd_dgsmall: '正文约 {px}px、画幅 {vw} 宽:贴进 Word 只有约 {pt} 磅。把字放大到 {need}px 左右,或把画幅改窄',
307
302
  ckOs_mac: ' Mac ',
308
303
  ckOs_win: ' Windows ',
@@ -375,7 +370,6 @@ window.__ModuleLoader__.load({
375
370
  mkUndo: '撤销',
376
371
  mkRedo: '重做',
377
372
  mkClear: '全部清掉',
378
- mkHint: '在页面上画,画完点「发到对话」',
379
373
  mkHow_pen: '按住拖动,随手画',
380
374
  mkHow_hl: '按住拖过去,把要改的地方涂亮',
381
375
  mkHow_arrow: '从起点按住,拖到要指的地方',
@@ -445,12 +439,8 @@ window.__ModuleLoader__.load({
445
439
  styleArrow: '{prop} {from} → {to}',
446
440
  styleJoin: ';',
447
441
  lang: 'zh',
448
- stylesHead: '或者先挑个风格',
449
- stylesTip: '点开看样板,满意了点「用这个风格」,再说要做什么',
450
442
  stylesMore: '更多风格({n})',
451
443
  stylesLess: '收起',
452
- stylesOpen: '换个风格…',
453
- stylesTitle: '换个风格',
454
444
  stylesSwap: '点一个看样板;「用这个风格」让模型把现在的设计换成它(只换配色、字体、圆角,布局和文字不动)',
455
445
  stylesAll: '全部风格',
456
446
  stylePrev: '上一个(←)',
@@ -514,7 +504,6 @@ window.__ModuleLoader__.load({
514
504
  dStyle: '点一个元素,拖滑块调字号、颜色、圆角和间距',
515
505
  dMark: '画圈、画箭头、写字,拼成一张图发给模型',
516
506
  dPlay: '像真的 App 一样点,按钮会跳到对应的屏',
517
- dLib: '存过的设计、风格和模板,也能逛设计市场',
518
507
  dLook: '改配色、字体,或整套换个风格',
519
508
  dCheck: '找出文字溢出、重叠、看不清、按钮太小',
520
509
  dCheckN: '上次找到 {n} 个问题,点开看',
@@ -546,18 +535,15 @@ window.__ModuleLoader__.load({
546
535
  dScreen: '换一屏、看全部、多尺寸、换类型',
547
536
  dCanvas: '回到画布,看全部的屏',
548
537
  toolsT: '工具',
549
- editAddr: '换一个地址',
550
538
  textShort: '改字',
551
539
  styleShort: '样式',
552
540
  markShort: '画笔',
553
- viewT: '视图',
554
541
  canvasShort: '画布',
555
- singleShort: '单页',
556
542
  sizesShort: '多尺寸',
543
+ fitShort: "按画幅显示",
544
+ fitTip: "网页单看、演示、对比时按画幅整屏缩放显示(写了画幅默认就是这样);关掉就铺满右侧栏,宽度跟着侧栏变",
557
545
  look: '外观',
558
- lookTip: '外观:配色、字体、整套风格',
559
546
  deliver: '导出',
560
- deliverTip: '导出:转成代码、存成图片 / PDF / PPT、打包分享',
561
547
  exFiles: '存成文件',
562
548
  checkShort: '体检',
563
549
  zoomT: '缩放',
@@ -627,10 +613,6 @@ window.__ModuleLoader__.load({
627
613
  updated: '已更新{file}',
628
614
  updatedN: '已更新{file} · {n} 处改动',
629
615
  updatedWhole: '已更新{file} · 整页重排',
630
- tryHead: '试试这样说',
631
- try1: '帮我设计一个社区健身房的会员 App',
632
- try2: '做一个精品咖啡店的落地页',
633
- try3: '做一张周末市集的活动海报',
634
616
  inserted: '已放进输入框,补一句要怎么改',
635
617
  insertedSend: '已放进输入框,发出去就行',
636
618
  copied: '已复制,粘贴到输入框里',
@@ -638,8 +620,6 @@ window.__ModuleLoader__.load({
638
620
  openFailed: '打不开:{msg}',
639
621
  headerTip: '设计台',
640
622
  tweaks: '调节滑块',
641
- twTip: '模型给这套设计做的几个维度:拖的时候所有屏一起变,还没写进文件。',
642
- twEmpty: '这套设计还没有专属滑块。让模型挑几个最值得试的维度(留白、圆角、主色、排法……),做成滑块放在这里。',
643
623
  twMake: '让模型做几个',
644
624
  twFix: '让模型修好',
645
625
  twMakeText: '〔调节滑块〕给这套设计做 3–5 个调节滑块:挑最值得试的维度(比如留白、圆角、主色、卡片排法),照 ui-design 技能「调节滑块」一节写进设计目录的 tweaks.json,把样式接上,做完用 check_design 查一遍。',
@@ -650,15 +630,12 @@ window.__ModuleLoader__.load({
650
630
  twAskHead: '〔调节〕我在右侧调节滑块里调成了下面这样:',
651
631
  twAskTail: '照这个改设计(改样式源文件,tweaks.json 里对应的 value 也改成新值)。',
652
632
  twAskTip: '让模型照这几个值改设计(可以顺手调整相关的地方)',
653
- twSaveTip: 'CSS 变量写进 tokens.css 的默认值,属性写到每屏的 <html> 上(改前改后各存一版)',
654
633
  twNoWrite: '开发服务器的页面不能直接保存,发到对话让模型改',
655
634
  twVer: '正在看旧版本:回到当前版本再保存',
656
635
  twMoved: '设计已经换了,没写回;再拖一次',
657
636
  twSaved: '已保存 {n} 项',
658
637
  twMissed: '{names} 在样式里没找到默认值,没保存:发到对话让模型改',
659
638
  systems: '品牌设计系统',
660
- sysOpen: '品牌设计系统…',
661
- sysEmptyLine: '用自己的品牌:',
662
639
  sysTip: '从你的网站或项目里提取的颜色、字体、圆角和组件。设为默认后,做新设计都照它来。',
663
640
  sysEmpty: '还没有。在上面填你的网站地址或项目文件夹,让模型提一套。',
664
641
  sysDefault: '默认',
@@ -704,11 +681,9 @@ window.__ModuleLoader__.load({
704
681
  libMarket: '市场',
705
682
  libWorks: '我的作品',
706
683
  libInspire: '灵感',
707
- libLine: '以前做的设计、存下的灵感、朋友给的设计包:',
708
684
  libOpen: '打开设计库',
709
685
  libClose: '返回',
710
686
  libFail: '没办成:{msg}',
711
- mkSoon: '设计市场正在准备:下一版就能在这里逛别人做的模板、风格和设计系统。',
712
687
  mkZip: '朋友给你的设计 zip,直接拖进右侧栏就能用。',
713
688
  mkLoading: '正在读市场…',
714
689
  tplStartHead: '从模板开始',
@@ -738,7 +713,6 @@ window.__ModuleLoader__.load({
738
713
  mkBack: '返回市场',
739
714
  mkStaging: '正在下载这一套…',
740
715
  mkStageFail: '没下载下来:{msg}',
741
- mkShots: '截图',
742
716
  mkLive: '实时看',
743
717
  mkLiveTip: '在关死的沙盒里打开(不跑脚本、不联网)',
744
718
  mkShotsBack: '看截图',
@@ -813,7 +787,6 @@ window.__ModuleLoader__.load({
813
787
  inUrlAdd: '存下',
814
788
  inUrlDo: '提取设计系统',
815
789
  inDel: '删除',
816
- inNone: '还没有',
817
790
  inLocal: '灵感只存在你电脑上,不上传。',
818
791
  inSaved: '已存进灵感',
819
792
  zipDrop: '用这个设计包开始',
@@ -946,6 +919,7 @@ window.__ModuleLoader__.load({
946
919
  exSlides: 'Five-slide launch deck: problem, solution, numbers, pricing, next steps',
947
920
  exEmail: 'Birthday-month offer email for members: one big image, a short note, one button',
948
921
  exDiagram: 'A mind map for "Product management 101": user research, requirements, prototyping, data, project management',
922
+ exDshplugin: "A DSH plugin \"Pomodoro\": a timer and today's log in a session tab",
949
923
  askKindLine: 'Type: {k}',
950
924
  askMore: 'More ways to start',
951
925
  askMoreD: 'Open existing HTML, use your own brand, open from the library',
@@ -964,7 +938,6 @@ window.__ModuleLoader__.load({
964
938
  homeRecent: 'Continue',
965
939
  homeRecentAll: 'All designs →',
966
940
  waysHtml: 'Open existing HTML',
967
- moreWays: 'Other ways to start',
968
941
  emptyHint: 'Enter a file path or a local port (like 5173)',
969
942
  emptyHintPick: 'Click "Browse…", drop it here, or enter a file path / local port (like 5173)',
970
943
  browse: 'Browse…',
@@ -991,7 +964,6 @@ window.__ModuleLoader__.load({
991
964
  placeholder: '/path/index.html or 5173',
992
965
  go: 'Open',
993
966
  pick: 'Select',
994
- pickTip: 'Click an element or drag a region to send it to the model (Esc to cancel)',
995
967
  pickAny: 'Click an element in any screen, or drag a region · Esc to cancel',
996
968
  pickOne: 'Click an element or drag a region · Esc to cancel',
997
969
  pickArea: 'Selected region',
@@ -1016,10 +988,7 @@ window.__ModuleLoader__.load({
1016
988
  chipTokens: 'Create design tokens',
1017
989
  pickElems: '{n} elements',
1018
990
  textAny: 'Click text in any screen to edit · Enter to save · Esc to stop',
1019
- refPick: 'Restyle from a reference…',
1020
- refChoose: 'Choose one',
1021
991
  refPickTip: 'Pick a reference image to restyle after (or drop / paste an image into the preview)',
1022
- refEmpty: 'Design from a reference image: drop it, paste it, or',
1023
992
  refDrop: 'Drop to use as a reference',
1024
993
  refDropSub: 'Saved to refs/ in the design folder; its colors go into the input',
1025
994
  refNotImage: 'Images only (PNG / JPG / WebP / GIF)',
@@ -1038,7 +1007,7 @@ window.__ModuleLoader__.load({
1038
1007
  canvas: 'Canvas: screens side by side',
1039
1008
  single: 'Single: one screen',
1040
1009
  sizes: 'Sizes: the same screen on phone, tablet and desktop side by side',
1041
- sizesNo: 'Posters, slides, emails and diagrams have a fixed size',
1010
+ sizesNo: 'Posters, slides, emails, diagrams and DSH plugins have a fixed size',
1042
1011
  szPhone: 'Phone',
1043
1012
  szTablet: 'Tablet',
1044
1013
  szDesktop: 'Desktop',
@@ -1055,8 +1024,8 @@ window.__ModuleLoader__.load({
1055
1024
  kindSlides: 'Slides',
1056
1025
  kindEmail: 'Email',
1057
1026
  kindDiagram: 'Diagram',
1027
+ kindDshplugin: "DSH plugin",
1058
1028
  tokens: 'Design tokens',
1059
- tokensTip: 'Click one to put it in the input, then say how to change it. All screens follow',
1060
1029
  tokensEmpty: 'This design has no tokens yet (CSS variables on :root), so colors and sizes are scattered.',
1061
1030
  tokensAsk: 'Ask the model for one',
1062
1031
  tokensAskText: 'Following the ui-design skill, create a tokens.css for this design (colors, fonts, type sizes, spacing, radii, shadows) and make every screen use those variables.',
@@ -1067,7 +1036,6 @@ window.__ModuleLoader__.load({
1067
1036
  gRadius: 'Radii',
1068
1037
  gShadow: 'Shadows',
1069
1038
  gOther: 'Other',
1070
- exportT: 'Export',
1071
1039
  exFrame: '{name} · in frame',
1072
1040
  exRaw: '{name} · plain',
1073
1041
  exLong: '{name} · full page',
@@ -1114,7 +1082,6 @@ window.__ModuleLoader__.load({
1114
1082
  exWhere: 'Saved to exports/ in the design folder; images are also copied to the clipboard',
1115
1083
  exportedDoc: 'Exported {name} ({n} pages)',
1116
1084
  check: 'Design check',
1117
- checkTip: 'Design check: measure overflowing or overlapping text, contrast, tap targets and type sizes',
1118
1085
  checking: 'Checking…',
1119
1086
  checkNone: 'No problems found',
1120
1087
  checkSum: '{s} screens · {n} problems',
@@ -1124,7 +1091,6 @@ window.__ModuleLoader__.load({
1124
1091
  checkFail: 'Check failed: {msg}',
1125
1092
  checkLayout: 'The page was not laid out yet, so it was not measured. Check again in a moment.',
1126
1093
  checkNote: 'Only measurable layout problems; whether it looks good is still up to you',
1127
- checkCount: 'Design check: {n} problems last time. Click to see them',
1128
1094
  checkAsk: '[Design check] Found {n} problems:',
1129
1095
  checkTail: 'Please fix each one in the source files, touching only what is listed; for colors and type sizes, change the design tokens where possible.',
1130
1096
  ckToolHead: 'Measured {s} screens and found {n} problems. Fix each one in the source files, touching only what is listed; for colors and type sizes, change the design tokens where possible:',
@@ -1160,6 +1126,7 @@ window.__ModuleLoader__.load({
1160
1126
  ck_dgtext: 'Node text too long',
1161
1127
  ck_dgsmall: 'Text too small',
1162
1128
  ck_dglink: 'Arrows miss the modules',
1129
+ ck_frame: 'Frame was changed',
1163
1130
  cd_hscroll: 'sticks out {px}px',
1164
1131
  cd_clipped: '{px}px cut off',
1165
1132
  cd_overflow: 'sticks out {px}px',
@@ -1188,6 +1155,7 @@ window.__ModuleLoader__.load({
1188
1155
  cd_dgbar: 'starts at period {from} and spans {span}, but the timeline has only {cols}',
1189
1156
  cd_dgtext: '{chars} characters ({max} at most): use keywords, put details in small text',
1190
1157
  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',
1158
+ cd_frame: 'the DSH frame no longer matches its template: copy the frame as is, write the plugin only inside data-slot, and start every style rule with [data-slot="main"]',
1191
1159
  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',
1192
1160
  ckOs_mac: ' Mac ',
1193
1161
  ckOs_win: ' Windows ',
@@ -1260,7 +1228,6 @@ window.__ModuleLoader__.load({
1260
1228
  mkUndo: 'Undo',
1261
1229
  mkRedo: 'Redo',
1262
1230
  mkClear: 'Clear all',
1263
- mkHint: 'Draw on the page, then click Send to chat',
1264
1231
  mkHow_pen: 'Press and drag to draw freehand',
1265
1232
  mkHow_hl: 'Drag over what needs changing to highlight it',
1266
1233
  mkHow_arrow: 'Press at the start and drag to what you mean',
@@ -1330,12 +1297,8 @@ window.__ModuleLoader__.load({
1330
1297
  styleArrow: '{prop} {from} → {to}',
1331
1298
  styleJoin: '; ',
1332
1299
  lang: 'en',
1333
- stylesHead: 'Or pick a style first',
1334
- stylesTip: 'Open one to preview, click "Use this style", then say what to make',
1335
1300
  stylesMore: 'More styles ({n})',
1336
1301
  stylesLess: 'Show less',
1337
- stylesOpen: 'Try another style…',
1338
- stylesTitle: 'Change the style',
1339
1302
  stylesSwap: 'Pick one to see a sample; "Use this style" has the model restyle the current design (colors, fonts and corners only; layout and copy stay)',
1340
1303
  stylesAll: 'All styles',
1341
1304
  stylePrev: 'Previous (←)',
@@ -1398,7 +1361,6 @@ window.__ModuleLoader__.load({
1398
1361
  dStyle: 'Click an element, then drag sliders for size, colors, radius and spacing',
1399
1362
  dMark: 'Draw circles, arrows and notes, sent to the model as one image',
1400
1363
  dPlay: 'Click through it like a real app; buttons jump to their screens',
1401
- dLib: 'Saved designs, styles and templates, plus the design market',
1402
1364
  dLook: 'Change colors and fonts, or switch the whole style',
1403
1365
  dCheck: 'Find overflowing or overlapping text, low contrast and tiny tap targets',
1404
1366
  dCheckN: '{n} problems last time. Click to see them',
@@ -1430,18 +1392,15 @@ window.__ModuleLoader__.load({
1430
1392
  dScreen: 'Switch screens, see all, sizes or type',
1431
1393
  dCanvas: 'Back to the canvas to see every screen',
1432
1394
  toolsT: 'Tools',
1433
- editAddr: 'Change address',
1434
1395
  textShort: 'Text',
1435
1396
  styleShort: 'Style',
1436
1397
  markShort: 'Draw',
1437
- viewT: 'View',
1438
1398
  canvasShort: 'Canvas',
1439
- singleShort: 'Single',
1440
1399
  sizesShort: 'Sizes',
1400
+ fitShort: "Fit to canvas size",
1401
+ fitTip: "Show the whole screen at its canvas size, scaled to fit, in single view, demo and compare (the default when a size is set); turn off to fill the side panel width",
1441
1402
  look: 'Look',
1442
- lookTip: 'Look: colors, fonts and overall style',
1443
1403
  deliver: 'Export',
1444
- deliverTip: 'Export: build as code, save images / PDF / PPT, pack and share',
1445
1404
  exFiles: 'Save as file',
1446
1405
  checkShort: 'Check',
1447
1406
  zoomT: 'Zoom',
@@ -1511,10 +1470,6 @@ window.__ModuleLoader__.load({
1511
1470
  updated: 'Updated{file}',
1512
1471
  updatedN: 'Updated{file} · {n} changes',
1513
1472
  updatedWhole: 'Updated{file} · whole page',
1514
- tryHead: 'Try saying',
1515
- try1: 'Design a member app for a neighborhood gym',
1516
- try2: 'Make a landing page for a specialty coffee shop',
1517
- try3: 'Make a poster for a weekend street market',
1518
1473
  inserted: 'Added to the input. Say what to change',
1519
1474
  insertedSend: 'Added to the input. Just send it',
1520
1475
  copied: 'Copied. Paste it into the input',
@@ -1522,8 +1477,6 @@ window.__ModuleLoader__.load({
1522
1477
  openFailed: 'Could not open: {msg}',
1523
1478
  headerTip: 'Design Studio',
1524
1479
  tweaks: 'Tweaks',
1525
- twTip: 'Knobs the model made for this design. Every screen follows as you drag; nothing is written yet.',
1526
- twEmpty: 'This design has no tweaks yet. Ask the model to pick the dimensions most worth trying (spacing, radius, brand color, layout…) and put them here as knobs.',
1527
1480
  twMake: 'Ask the model',
1528
1481
  twFix: 'Ask the model to fix it',
1529
1482
  twMakeText: '[Tweaks] Make 3–5 tweaks for this design: pick the dimensions most worth trying (spacing, radius, brand color, card layout…), write them to tweaks.json in the design folder as the ui-design skill describes under "Tweaks", wire up the styles, then run check_design.',
@@ -1534,15 +1487,12 @@ window.__ModuleLoader__.load({
1534
1487
  twAskHead: '[Tweaks] I set the tweaks in the sidebar to these values:',
1535
1488
  twAskTail: 'Change the design to match (edit the style sources and update the matching values in tweaks.json).',
1536
1489
  twAskTip: 'Let the model apply these values (and adjust related details)',
1537
- twSaveTip: 'CSS variables go into the defaults in tokens.css, attributes onto each screen\'s <html> (a version is kept before and after)',
1538
1490
  twNoWrite: 'Dev-server pages cannot be saved here. Send it to the chat instead',
1539
1491
  twVer: 'Viewing an old version. Go back to the current one to save',
1540
1492
  twMoved: 'The design changed, so nothing was written. Try again',
1541
1493
  twSaved: 'Saved {n}',
1542
1494
  twMissed: 'No default found in the styles for {names}, not saved. Send it to the chat instead',
1543
1495
  systems: 'Brand design systems',
1544
- sysOpen: 'Brand design systems…',
1545
- sysEmptyLine: 'Use your own brand:',
1546
1496
  sysTip: 'Colors, fonts, radii and components pulled from your site or project. The default one is used for every new design.',
1547
1497
  sysEmpty: 'None yet. Enter your website or project folder above and let the model extract one.',
1548
1498
  sysDefault: 'Default',
@@ -1587,11 +1537,9 @@ window.__ModuleLoader__.load({
1587
1537
  libMarket: 'Gallery',
1588
1538
  libWorks: 'My designs',
1589
1539
  libInspire: 'Inspiration',
1590
- libLine: 'Past designs, saved inspiration, design packs from friends:',
1591
1540
  libOpen: 'Open the library',
1592
1541
  libClose: 'Back',
1593
1542
  libFail: 'That did not work: {msg}',
1594
- mkSoon: 'The design gallery is on its way: the next version lets you browse templates, styles and design systems made by others.',
1595
1543
  mkZip: 'Got a design zip from a friend? Drop it on the sidebar to use it.',
1596
1544
  mkLoading: 'Loading the gallery…',
1597
1545
  tplStartHead: 'Start from a template',
@@ -1621,7 +1569,6 @@ window.__ModuleLoader__.load({
1621
1569
  mkBack: 'Back to gallery',
1622
1570
  mkStaging: 'Downloading this design…',
1623
1571
  mkStageFail: 'Could not download it: {msg}',
1624
- mkShots: 'Screenshots',
1625
1572
  mkLive: 'Live view',
1626
1573
  mkLiveTip: 'Opens in a locked sandbox (no scripts, no network)',
1627
1574
  mkShotsBack: 'Screenshots',
@@ -1696,7 +1643,6 @@ window.__ModuleLoader__.load({
1696
1643
  inUrlAdd: 'Save',
1697
1644
  inUrlDo: 'Extract design system',
1698
1645
  inDel: 'Delete',
1699
- inNone: 'Nothing yet',
1700
1646
  inLocal: 'Inspiration stays on your computer and is never uploaded.',
1701
1647
  inSaved: 'Saved to inspiration',
1702
1648
  zipDrop: 'Start from this design pack',
@@ -1926,9 +1872,6 @@ window.__ModuleLoader__.load({
1926
1872
  .ddp-btn.sel{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.14));color:var(--dsw-alias-label-primary)}
1927
1873
  .ddp-btn.pick{padding:0 9px}
1928
1874
  .ddp-btn .cr{width:10px;height:10px;margin-left:-2px;opacity:.6}
1929
- .ddp-seg{display:inline-flex;padding:2px;border-radius:7px;background:var(--dsw-alias-bg-layer-2);flex:none}
1930
- .ddp-seg .ddp-btn{height:24px;min-width:26px;border-radius:5px}
1931
- .ddp-seg .ddp-btn.sel{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-shadow:0 1px 2px rgba(0,0,0,.12)}
1932
1875
  .ddp-sep{width:.5px;height:16px;background:var(--dsw-alias-border-l3);margin:0 2px;flex:none}
1933
1876
  .ddp-kind{position:relative;flex:none}
1934
1877
  .ddp-kind>.ddp-btn.sel{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12));color:var(--dsw-alias-label-primary)}
@@ -2140,6 +2083,7 @@ window.__ModuleLoader__.load({
2140
2083
  .ddp-wait .card.k-slides{aspect-ratio:16/9}
2141
2084
  .ddp-wait .card.k-email{width:min(60%,380px);aspect-ratio:3/4}
2142
2085
  .ddp-wait .card.k-diagram{aspect-ratio:16/10}
2086
+ .ddp-wait .card.k-dshplugin{aspect-ratio:16/10}
2143
2087
  .ddp-wait .card:has(.ddp-gd){animation:none}
2144
2088
  .ddp-wait p{margin:0;color:var(--dsw-alias-label-tertiary);text-align:center;line-height:1.6}
2145
2089
  .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}
@@ -2270,7 +2214,7 @@ window.__ModuleLoader__.load({
2270
2214
  .ddp-sc:hover,.ddp-sc:focus-visible{color:var(--dsw-alias-label-primary)}
2271
2215
  .ddp-sc .pv .ddp-sam{width:calc(100cqw / .32);min-height:calc(100% / .32);transform:scale(.32);transform-origin:0 0;pointer-events:none}
2272
2216
  .ddp-sam{display:flex;flex-direction:column;gap:7px;padding:12px 14px 14px;font-size:11px;line-height:1.45;text-align:left;overflow:hidden;box-sizing:border-box}
2273
- .ddp-sam b{font-weight:600;color:inherit} /* 空白页的 .ddp-empty b 会把字染成界面色 */
2217
+ .ddp-sam b{font-weight:600;color:inherit}
2274
2218
  .ddp-sam .top{display:flex;align-items:center;gap:6px;margin-bottom:3px}
2275
2219
  .ddp-sam .top b{font-size:12px}
2276
2220
  .ddp-sam .lg{width:14px;height:14px;flex:none}
@@ -2509,7 +2453,6 @@ window.__ModuleLoader__.load({
2509
2453
  /* 屏头的小按钮:屏够宽就带字(导出 / 再出两版 / 单看),窄了只剩图标,悬停看说明 */
2510
2454
  .ddp-act .lb{display:none;font-size:11px}
2511
2455
  @container (min-width:300px){.ddp-act .lb{display:inline}.ddp-act{gap:4px}}
2512
- .ddp-tw .row:first-child{border-top:0}
2513
2456
  .ddp-sys .bd{display:flex;flex-direction:column;gap:8px;padding:2px 10px 10px}
2514
2457
  .ddp-sys.bare{flex:1;min-height:0;display:flex;flex-direction:column}
2515
2458
  .ddp-sys>form{display:flex;gap:6px;flex:none;padding:0 10px 10px}
@@ -2826,6 +2769,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
2826
2769
  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' })]),
2827
2770
  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
2771
  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' })]),
2772
+ dshplugin: () => svg([h('rect', { key: 1, x: 2.5, y: 4, width: 19, height: 16, rx: 2 }), h('path', { key: 2, d: 'M8 4v16' }), h('rect', { key: 3, x: 11, y: 8, width: 7.5, height: 8, rx: 1.4, strokeDasharray: '2 1.6' })]),
2829
2773
  caret: () => svg([h('path', { key: 1, d: 'M6 9.5l6 6 6-6', strokeWidth: 2.4 })], { className: 'cr' }),
2830
2774
  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' }),
2831
2775
  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' }),
@@ -2897,10 +2841,24 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
2897
2841
  for (const set of strictBy.values()) if (set.has(u)) return true
2898
2842
  return false
2899
2843
  }
2844
+ // 问后台状态的间隔:模型在跑 0.7 秒;平常 1.5 秒;只有标题栏按钮在等(设计台从没打开过)、这个会话也没做过设计:5 秒(#21)。
2845
+ // 设计台一打开就按 1.5 秒,并马上补问一次(见 usePreview)
2846
+ const pollGap = (p) => {
2847
+ const s = p.state
2848
+ if (s && s.turn) return 700
2849
+ if (p.heavy > 0 || (s && (s.target || (Array.isArray(s.screens) && s.screens.length)))) return 1500
2850
+ return 5000
2851
+ }
2852
+ /** 网页单看要不要按画幅缩放(#20):用户在屏名菜单切过(pref = 'fit' / 'fill')听用户的;没切过看这套设计写没写画幅 */
2853
+ const webFitOf = (kind, pref, sized) => kind === 'web' && (pref ? pref === 'fit' : !!sized)
2854
+ const pageHidden = () => { try { return document.visibilityState === 'hidden' } catch { return false } }
2855
+ try {
2856
+ document.addEventListener('visibilitychange', () => { if (!pageHidden()) for (const p of pollers.values()) if (p.refs > 0) { p.stop(); p.start() } })
2857
+ } catch { /* 没有 document(测试) */ }
2900
2858
  function poller(sid) {
2901
2859
  let p = pollers.get(sid)
2902
2860
  if (p) return p
2903
- p = { state: null, subs: new Set(), timer: null, refs: 0, inflight: false, gen: 0 }
2861
+ p = { state: null, subs: new Set(), timer: null, refs: 0, heavy: 0, inflight: false, gen: 0 }
2904
2862
  const tick = async () => {
2905
2863
  p.timer = null
2906
2864
  if (!p.inflight) {
@@ -2922,7 +2880,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
2922
2880
  } catch { /* 下一轮再试 */ }
2923
2881
  p.inflight = false
2924
2882
  }
2925
- if (p.refs > 0) p.timer = setTimeout(tick, p.state && p.state.turn ? 700 : 1500)
2883
+ if (p.refs > 0 && !pageHidden()) p.timer = setTimeout(tick, pollGap(p)) // 窗口在后台:停,回到前台马上补一次(见下面 visibilitychange)
2926
2884
  }
2927
2885
  p.set = (s) => { p.gen++; p.apply(s) }
2928
2886
  p.apply = (s) => {
@@ -2936,17 +2894,20 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
2936
2894
  pollers.set(sid, p)
2937
2895
  return p
2938
2896
  }
2939
- function usePreview(sid) {
2897
+ // light:只是标题栏按钮在等(看要不要弹出右侧栏),没人看设计台时可以问得慢一点
2898
+ function usePreview(sid, light = false) {
2940
2899
  const p = sid ? poller(sid) : null
2941
2900
  const [s, setS] = useState(p ? p.state : null)
2942
2901
  useEffect(() => {
2943
2902
  if (!p) return undefined
2944
2903
  p.subs.add(setS)
2945
2904
  p.refs++
2905
+ if (!light) { p.heavy++; p.stop() } // 设计台打开了:别等原来排的慢的那次,马上问
2946
2906
  p.start()
2947
2907
  setS(p.state)
2948
2908
  return () => {
2949
2909
  p.subs.delete(setS)
2910
+ if (!light) p.heavy--
2950
2911
  if (--p.refs <= 0) p.stop()
2951
2912
  }
2952
2913
  }, [sid])
@@ -3781,6 +3742,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
3781
3742
  function autoStyle(text, kind) {
3782
3743
  const s = String(text || '')
3783
3744
  if (!s.trim()) return null
3745
+ if (kind === 'dshplugin') return null // DSH 插件默认用 DSH 自己的样子(外框的 --dsh-* 变量),不替它挑风格卡
3784
3746
  const said = s.replace(NOT_STYLE_FENG, ' ')
3785
3747
  if (SAID_STYLE.test(said) || STYLES.some((x) => said.includes(x.zh) || new RegExp(`\\b${x.en}\\s+(style|look|theme|aesthetic|vibe)\\b`, 'i').test(said))) return null
3786
3748
  const by = (id) => STYLES.find((x) => x.id === id) || null
@@ -4078,7 +4040,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
4078
4040
 
4079
4041
  // ── 导出图片:设备外框、整套展示图 ───────────────────────────────────────
4080
4042
 
4081
- const SHOW_COLS = { app: 4, miniprogram: 4, tablet: 3, desktop: 2, web: 2, poster: 3, slides: 2, email: 3, diagram: 2 }
4043
+ const SHOW_COLS = { app: 4, miniprogram: 4, tablet: 3, desktop: 2, web: 2, poster: 3, slides: 2, email: 3, diagram: 2, dshplugin: 2 }
4082
4044
  const CANVAS_FONT = '-apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif'
4083
4045
  const FRAMED = { app: 1, miniprogram: 1, tablet: 1, desktop: 1, web: 1 }
4084
4046
 
@@ -4561,12 +4523,13 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
4561
4523
 
4562
4524
  // ── 设计类型:画幅和外框 ─────────────────────────────────────────────────
4563
4525
 
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
+ const KIND_LIST = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email', 'diagram', 'dshplugin']
4527
+ const KIND_KEY = { web: 'kindWeb', app: 'kindApp', miniprogram: 'kindMini', tablet: 'kindTablet', desktop: 'kindDesktop', poster: 'kindPoster', slides: 'kindSlides', email: 'kindEmail', diagram: 'kindDiagram', dshplugin: 'kindDshplugin' }
4566
4528
  const GHOST_MS = 90000 // 这么久没出新屏就撤掉「生成中…」占位
4567
4529
  const HOLD_MAX = 15000 // 草稿放到一半真文件就落地了:最多再放这么久(一般几秒放完自己说一声)
4568
4530
  const EDIT_GRACE_MS = 3000 // 退出改字后这么久里,页面交上来的最后一处改动还收
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] }
4531
+ 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], dshplugin: [1280, 800] }
4532
+ const FIXED = { poster: 1, slides: 1, diagram: 1, dshplugin: 1 } // 画幅是定的(没有「整页」、不按内容加高、市场里只看截图)
4570
4533
  // 外框:pad 边框厚度、top 顶上一条(浏览器栏)、r 外圆角、ir 屏幕圆角、island 灵动岛离顶的距离、capsule 小程序右上角的胶囊、win 桌面软件的窗口按钮
4571
4534
  const FRAME = {
4572
4535
  web: { pad: 0, top: 34, r: 10, ir: 0 },
@@ -4578,6 +4541,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
4578
4541
  slides: { pad: 0, top: 0, r: 8, ir: 8 },
4579
4542
  email: { pad: 0, top: 0, r: 10, ir: 10 },
4580
4543
  diagram: { pad: 0, top: 0, r: 8, ir: 8 },
4544
+ dshplugin: { pad: 0, top: 0, r: 10, ir: 10 },
4581
4545
  }
4582
4546
 
4583
4547
  /** 某个大小的外框:矮的手机(SE 那种,高不到宽的 1.9 倍)没有灵动岛,不然压住页面最上面 */
@@ -4590,7 +4554,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
4590
4554
  // 桌面软件的窗口按钮(和 picker.js 的一样):Mac 红绿灯在左上 x 20、y 20 起,三个 12px 圆点隔 8;Windows 最小化 / 最大化 / 关闭在右上角,各 46×32
4591
4555
  const LIGHTS = { x: 20, y: 20, d: 12, gap: 8 }
4592
4556
  const WINBTN = { w: 46, h: 32 }
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' }
4557
+ 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', dsh: 'dshplugin', 'dsh-plugin': 'dshplugin', dsh插件: 'dshplugin' }
4594
4558
 
4595
4559
  /** 页面里 <meta name="dsh-design" content="app"> / "poster 1080x1920" / "desktop windows" → { kind, size, os }(os:win,不写是 Mac) */
4596
4560
  function parseMeta(content) {
@@ -5071,6 +5035,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
5071
5035
  slides: [[6, 10, 60, 13], [6, 32, 40, 52], [52, 32, 42, 52]],
5072
5036
  email: [[10, 4, 80, 7], [10, 14, 80, 30], [10, 48, 60, 5], [10, 56, 80, 14], [10, 75, 30, 6]],
5073
5037
  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]],
5038
+ dshplugin: [[0, 0, 22, 100], [26, 6, 40, 8], [26, 20, 70, 74]],
5074
5039
  }
5075
5040
  const GD_C = ['#4d6bfe', '#e8590c', '#0ca678']
5076
5041
  /** 占位里的鼠标什么时候动:换了在做的事、或者又写了 15 行就加一;不在生成就不动 */
@@ -7043,7 +7008,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7043
7008
  const n = { name: name || t('exThisName') } // 写出是哪一屏,别只说「这一屏」
7044
7009
  if (FRAMED[kind]) items.push(['frame', I.single, t('exFrame', n)])
7045
7010
  items.push(['raw', I.image, t('exRaw', n)])
7046
- if (kind !== 'poster' && kind !== 'slides' && kind !== 'diagram') items.push(['long', I.long, t('exLong', n)]) // 海报、幻灯片、图表画幅是定的,没有「整页」
7011
+ if (!FIXED[kind]) items.push(['long', I.long, t('exLong', n)]) // 海报、幻灯片、图表画幅是定的,没有「整页」
7047
7012
  if (count > 1) items.push(['show', I.canvas, t('exShow')])
7048
7013
  items.push(['pdf', I.pdf, t('exPdf')], ['pptx', I.deck, t('exPptx')], ['opts', I.sliders, t('exOpts')])
7049
7014
  return items
@@ -7149,7 +7114,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7149
7114
  }
7150
7115
 
7151
7116
  // 左上屏名 ▾:换屏(画布 / 某一屏)、多尺寸、类型、打开别的页面——「在看什么、怎么看」都在这一个菜单里
7152
- function ScreenMenu({ t, label, title, tip, src, busy, list, cur, canvas, open, setOpen, onPick, onAll, onOther, sizes, kind, onKind, hidden, hiddenText }) {
7117
+ function ScreenMenu({ t, label, title, tip, src, busy, list, cur, canvas, open, setOpen, onPick, onAll, onOther, sizes, fit, kind, onKind, hidden, hiddenText }) {
7153
7118
  const ref = useRef(null)
7154
7119
  useDismiss(open, setOpen, ref)
7155
7120
  const n = list.length
@@ -7168,6 +7133,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7168
7133
  hidden ? h('div', { className: 'nt' }, hiddenText) : null,
7169
7134
  sizes ? h('div', { className: 'sp', role: 'separator' }) : null,
7170
7135
  sizes ? h('button', { className: sizes.on ? 'sel' : '', role: 'menuitemcheckbox', 'aria-checked': !!sizes.on, disabled: !!sizes.off, title: sizes.tip, onClick: close(sizes.run) }, h(I.sizes), h('span', null, t('sizesShort')), sizes.note ? h('em', null, sizes.note) : null) : null,
7136
+ fit ? h('button', { className: fit.on ? 'sel' : '', role: 'menuitemcheckbox', 'aria-checked': !!fit.on, title: t('fitTip'), onClick: close(fit.run) }, h(I.single), h('span', null, t('fitShort')), h('em', null, fit.note)) : null,
7171
7137
  onKind ? h('div', { className: 'hd' }, t('kind')) : null,
7172
7138
  onKind ? h('div', { className: 'ddp-kinds', role: 'group', 'aria-label': t('kind') }, ...KIND_LIST.map((k) => h('button', { key: k, role: 'menuitemradio', 'aria-checked': k === kind, className: k === kind ? 'sel' : '', title: KIND_SIZE[k].join('×'), onClick: close(() => onKind(k)) },
7173
7139
  h(I[k]), h('span', null, t(KIND_KEY[k]))))) : null,
@@ -7406,7 +7372,6 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7406
7372
 
7407
7373
  // ── 设计库 › 市场 ──
7408
7374
  const GALLERY_REPO = 'https://github.com/OrderG-X/dsh-design-gallery'
7409
- const MK_KINDS = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email', 'diagram']
7410
7375
  const mkPick = (t, x) => { const o = x || {}; return String((t('lang') === 'en' ? o.en || o.zh : o.zh || o.en) || '') }
7411
7376
  const mkUrl = (e) => e.submission || `${GALLERY_REPO}/tree/main/${e.type === 'system' ? 'systems' : e.type === 'style' ? 'styles' : 'templates'}/${e.id}`
7412
7377
  const mkErr = (t, e) => { const k = String((e && e.message) || e || ''); const m = t('mkErr_' + k); return m && m !== 'mkErr_' + k ? m : k }
@@ -7470,8 +7435,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7470
7435
  }
7471
7436
 
7472
7437
  // 首页大输入框:说一句 + 类型 + 风格 → onSend(发给模型)。没写字时 Tab 用占位里的例子
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' }
7438
+ const ASK_KINDS = ['app', 'miniprogram', 'web', 'poster', 'slides', 'diagram', 'dshplugin', 'tablet', 'desktop', 'email']
7439
+ const ASK_EX = { web: 'exWeb', app: 'exApp', miniprogram: 'exMini', tablet: 'exTablet', desktop: 'exDesktop', poster: 'exPoster', slides: 'exSlides', email: 'exEmail', diagram: 'exDiagram', dshplugin: 'exDshplugin' }
7475
7440
  function HomeAsk({ t, onSend, onRef, plus, draft, note, autoFocus }) {
7476
7441
  const d0 = (draft && draft.current) || {}
7477
7442
  const [text, setText] = useState(d0.text || '')
@@ -7590,7 +7555,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7590
7555
  .filter((e) => !kind || type !== 'template' || e.kind === kind)
7591
7556
  .filter((e) => { const x = hay(e); return words.every((w) => x.includes(w)) })
7592
7557
  .sort((a, b) => (sort === 'featured' ? (b.featured - a.featured) || time(b.updated) - time(a.updated) : sort === 'new' ? time(b.added) - time(a.added) : time(b.updated) - time(a.updated)))
7593
- const kinds = MK_KINDS.filter((k) => d.designs.some((e) => e.kind === k))
7558
+ const kinds = KIND_LIST.filter((k) => d.designs.some((e) => e.kind === k))
7594
7559
  const card = (e) => {
7595
7560
  const by = e.author && !/^orderg-x$/i.test(e.author.login || '') ? e.author.name || e.author.login : '' // 官方做的不写作者(每张都一样)
7596
7561
  const meta = [e.type === 'template' ? t(KIND_KEY[e.kind] || 'kindWeb') : '', e.screens && e.screens.length ? t('wkScreens', { n: e.screens.length }) : '', t(e.license === 'CC-BY-4.0' ? 'mkUseBY' : 'mkUse0'), by ? '@' + by : ''].filter(Boolean).join(' · ')
@@ -7689,7 +7654,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7689
7654
  isTpl ? h('button', { className: 'ddp-pbtn', disabled: busy, title: t('mkUseTip'), onClick: use }, t('mkUse')) : null,
7690
7655
  e.type === 'system' ? h('button', { className: 'ddp-pbtn', disabled: busy, onClick: install }, t('mkInstall')) : null,
7691
7656
  // 海报、幻灯片、图表是定尺寸的画面、没什么可点的:只看截图(实时看会按原尺寸撑出框)
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,
7657
+ !err && e.type !== 'style' && !FIXED[e.kind] ? h('button', { className: 'ddp-sbtn', disabled: busy, title: t('mkLiveTip'), onClick: () => (live ? setLive(null) : goLive()) }, live ? t('mkShotsBack') : t('mkLive')) : null,
7693
7658
  e.type !== 'style' ? h('button', { className: 'ddp-sbtn' + (fav ? ' on' : ''), title: t('mkFavTip'), 'aria-pressed': !!fav, onClick: toggleFav }, fav ? '★ ' + t('mkFaved') : '☆ ' + t('mkFav')) : null),
7694
7659
  h('ul', { className: 'facts' },
7695
7660
  h('li', null, t('mkSafe')),
@@ -7728,7 +7693,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7728
7693
  * over 比画幅大(横向永远会被裁;幻灯片、海报竖向也算);long 长页只截到一部分;dead 点了没反应的链接
7729
7694
  */
7730
7695
  function precheckOf(list, kind, limit) {
7731
- const fixed = kind === 'slides' || kind === 'poster' || kind === 'diagram'
7696
+ const fixed = !!FIXED[kind]
7732
7697
  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 }
7733
7698
  for (const m of list) {
7734
7699
  if (m.failed) { r.fail++; continue }
@@ -7744,7 +7709,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
7744
7709
 
7745
7710
  /** 「按内容改画幅」改成多大:'宽x高',不用改或改不了返回 ''。幻灯片、海报按量到的版面,别的只把宽度加上去;竖着堆了好几页的不改高 */
7746
7711
  function fitCanvas(list, kind, size) {
7747
- const fixed = kind === 'slides' || kind === 'poster' || kind === 'diagram'
7712
+ const fixed = !!FIXED[kind]
7748
7713
  let [W, H] = size
7749
7714
  for (const m of list) {
7750
7715
  if (m.failed) continue
@@ -8674,6 +8639,10 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
8674
8639
  const tokens = main.tokens || []
8675
8640
  const kind = (st && st.kind) || meta.kind || 'web'
8676
8641
  const size = sizeOf((st && st.size) || meta.size || autoSize(screens.map((sc) => (infoOf(ik(sc)) || {}).natural), kind), kind)
8642
+ // 网页单看、演示、对比(#20):写了画幅(meta 或 preview_page 的 size)就按画幅整屏缩放,没写就铺满右侧栏;用户在屏名菜单里切过就听用户的
8643
+ const [fitPref, setFitPref] = useState(() => { try { return localStorage.getItem('ddp-web-fit') || '' } catch { return '' } })
8644
+ const webFit = webFitOf(kind, fitPref, !!((st && st.size) || meta.size))
8645
+ const toggleFit = () => { const v = webFit ? 'fill' : 'fit'; setFitPref(v); try { localStorage.setItem('ddp-web-fit', v) } catch { /* 记不住就这次有效 */ } }
8677
8646
  const view = (st && st.view) || (screens.length >= 2 && screens.length <= 12 ? 'canvas' : 'single')
8678
8647
  const canvas = view === 'canvas'
8679
8648
  const writingNew = !!(st && st.writing) && /\.html?$/i.test(st.writing) && !screens.some((s) => s.key === st.writing)
@@ -9260,7 +9229,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
9260
9229
  // 单看时只挂着正在看的那屏;要所有屏(PDF、PPT、拼图、预检)时按画幅大小在背后挂上,用完就撤
9261
9230
  const withFrames = async (fn, only) => {
9262
9231
  if (!only && ((canvas && shown.length <= LIVE_MAX) || shown.length < 2)) return fn(apis.current)
9263
- // 网页单看时铺满右侧栏,和画幅不一样宽,都在背后重挂;别的类型正在看的那屏直接用(滚动位置、打开的弹窗都还在)
9232
+ // 网页单看时铺满右侧栏,和画幅不一样宽,都在背后重挂(开了「按画幅显示」也照这样挂,只是多挂一次、慢一点,结果一样);别的类型正在看的那屏直接用(滚动位置、打开的弹窗都还在)
9264
9233
  // 画布屏多的时候镜头一动画布上的屏就会撤,也都在背后挂
9265
9234
  const stamp = designSeq.current
9266
9235
  const run = async () => {
@@ -9478,7 +9447,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
9478
9447
  const sizeSet = SIZE_SETS[kind] || null
9479
9448
  const inMulti = multi && !!sizeSet && !ver
9480
9449
  // 单页看手机 / 平板时,选择、改字的提示条放在设备上方,给它让出一条(不然压住设备顶边)
9481
- const hintTop = (picking || textEdit) && !canvas && !inMulti && !ver && !demo && kind !== 'web'
9450
+ const hintTop = (picking || textEdit) && !canvas && !inMulti && !ver && !demo && (kind !== 'web' || webFit) // 网页按画幅缩放时也和设备一样让出一条(#20)
9482
9451
  const flows = canvas && !inMulti && !picking && !textEdit ? flowsOf(shown, (sc) => (infoOf(ik(sc)) || {}).links, fileTarget) : []
9483
9452
 
9484
9453
  // ── 设计体检:画布上量所有屏,单页量这一屏;问题标在页面上,列在面板里 ──
@@ -9923,6 +9892,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
9923
9892
  h(ScreenMenu, { t, hidden: hiddenN, hiddenText, label: scrLabel, tip: [scrLabel || stLabel, t('dScreen')], src: stLabel, busy, list: screens.map((x) => { const L = takeTag(x); return { key: x.key, label: dropBrand(shortOf(x)) + (L ? ' · ' + L : '') } }), cur: curKey, canvas: canvas && !inMulti && !demo, open: scrMenu, setOpen: setScrMenu,
9924
9893
  onPick: pickScreen, onAll: toCanvas, onOther: () => setEditing(true),
9925
9894
  sizes: mark ? null : { on: inMulti, off: !sizeSet || !!ver, tip: sizeSet ? t('sizes') : t('sizesNo'), note: sizeSet ? '' : t('sizesNoShort'), run: () => setMulti(!inMulti) },
9895
+ fit: kind === 'web' && !mark ? { on: webFit, note: size.join('×'), run: toggleFit } : null,
9926
9896
  kind, onKind: mark ? null : (k) => change({ kind: k }) })),
9927
9897
  h('div', { className: 'ddp-isl tr' },
9928
9898
  h('button', { className: 'ddp-btn lab' + (panel ? ' sel' : ''), ...tipA(t('look'), t('dLook')), onClick: () => (panel ? setPanel(false) : openLook()) }, h(I.palette), h('span', { className: 'lb' }, t('look'))),
@@ -10309,9 +10279,10 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10309
10279
  const cvBody = !demo && (inMulti || (canvas && !(ver && cmp)))
10310
10280
  let body
10311
10281
  let busyGap = false
10282
+ // 单看、演示、对比共用:网页铺满右侧栏(没开「按画幅显示」时),别的按画幅整屏缩放
10283
+ const fill = kind === 'web' && !webFit
10284
+ const [dw, dh] = deviceBox(kind, size)
10312
10285
  if (demo) {
10313
- const fill = kind === 'web'
10314
- const [dw, dh] = deviceBox(kind, size)
10315
10286
  const z = fill ? 1 : Math.max(0.05, Math.min(1, (box.w - 32) / dw, (ah - 16 - 46) / dh))
10316
10287
  const top = demo.layers[demo.layers.length - 1]
10317
10288
  body = h('div', { className: 'ddp-demo' }, ...demo.layers.map((l) => {
@@ -10386,8 +10357,6 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10386
10357
  const now = screens.find((x) => x.key === k) || screens[0]
10387
10358
  const has = now && ver.screens.includes(now.key)
10388
10359
  const old = now ? { key: now.key, id: `v${ver.n}|${now.key}`, v: ver.n, url: vbase + encodeURIComponent(now.key), label: now.label } : null
10389
- const fill = kind === 'web'
10390
- const [dw, dh] = deviceBox(kind, size)
10391
10360
  // 右边开着版本面板:手机这类有外框的让到面板左边(和单看时一样)
10392
10361
  const aside = !fill && !!(ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240 ? 296 : 0
10393
10362
  const z = fill ? 1 : Math.max(0.05, Math.min(1, (box.w - aside - 32) / dw, (ah - 16 - (ver ? 46 : 0)) / dh))
@@ -10436,8 +10405,6 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10436
10405
  onOpen: (key) => openByUser(key),
10437
10406
  })
10438
10407
  } else {
10439
- const fill = kind === 'web'
10440
- const [dw, dh] = deviceBox(kind, size)
10441
10408
  // 右边开着面板(体检、调样式、设计规范、换风格):手机这类有外框的让到面板左边(侧栏够宽时),别被挡住
10442
10409
  const sideOn = !!(anUp || ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240
10443
10410
  const aside = !fill && sideOn ? 296 : 0
@@ -10570,7 +10537,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10570
10537
  function HeaderButton(props) {
10571
10538
  const t = props.t
10572
10539
  const sid = props.sid || props.sessionId
10573
- const [st] = usePreview(sid)
10540
+ const [st] = usePreview(sid, true)
10574
10541
  const seen = useRef(null)
10575
10542
  useEffect(() => {
10576
10543
  if (!st) return
@@ -10688,7 +10655,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10688
10655
  // 注意:这里是客户端**服务名**(短的),不是包名
10689
10656
  exports.inject = INJECT
10690
10657
  // 测试用
10691
- exports._test = { precheckOf, fitCanvas, layoutOk, fitHOk, autoSize, pulseStep, MarketDetail, dragKind, droppedOf, pickInfo, pickLabel, pickRanges, pickRule, chipOf, chipRanges, makeT, ZH, EN, formatCheck, formatTweaks, markHit, markPath, STYLES, formatStyle, accentUse, autoStyle, styleLook, padInsert, pageOf, pxOf, styleChanges, formatStyleAsk, takesOf, formatCheckTool, poller, frameOf, paletteOf, formatRef, layoutRow, keyOfPath, flowsOf, flowLines, flowMarks, formatPick, whereOf, parseMeta, sizeOf, layoutGrid, fitCam, nearestLive, LIVE_MAX, tokenKind, formatToken, splitTitles, pickColors, hhmm, formatTpl, formatPrep, styleFromTokens, myStyleOf, isZipFile }
10658
+ exports._test = { KIND_LIST, KIND_KEY, KIND_SIZE, META_ALIAS, FIXED, SHOW_COLS, FRAME, ASK_EX, ASK_KINDS, KIND_ICON: I, pollGap, webFitOf, precheckOf, fitCanvas, layoutOk, fitHOk, autoSize, pulseStep, MarketDetail, dragKind, droppedOf, pickInfo, pickLabel, pickRanges, pickRule, chipOf, chipRanges, makeT, ZH, EN, formatCheck, formatTweaks, markHit, markPath, STYLES, formatStyle, accentUse, autoStyle, styleLook, padInsert, pageOf, pxOf, styleChanges, formatStyleAsk, takesOf, formatCheckTool, poller, frameOf, paletteOf, formatRef, layoutRow, keyOfPath, flowsOf, flowLines, flowMarks, formatPick, whereOf, parseMeta, sizeOf, layoutGrid, fitCam, nearestLive, LIVE_MAX, tokenKind, formatToken, splitTitles, pickColors, hhmm, formatTpl, formatPrep, styleFromTokens, myStyleOf, isZipFile }
10692
10659
  return module.exports
10693
10660
  },
10694
10661
  })