dsh-design-studio 0.16.1 → 0.17.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 +3 -1
- package/README.md +3 -1
- package/cordis.patch.yml +4 -0
- package/lib/annotations-row.js +14 -0
- package/lib/annotations.js +214 -0
- package/lib/client.js +320 -27
- package/lib/handoff.js +7 -3
- package/lib/index.js +81 -10
- package/lib/look.js +3 -1
- package/lib/photos.js +9 -0
- package/lib/picker.js +253 -0
- package/lib/serve.js +3 -2
- package/lib/styles.js +203 -0
- package/lib/tool.js +3 -2
- package/locale/annotations/en.json +6 -0
- package/locale/annotations/zh.json +6 -0
- package/package.json +4 -1
- package/skills/ui-design/SKILL.md +5 -3
- package/skills/ui-design/references/annotations.md +64 -0
package/lib/client.js
CHANGED
|
@@ -121,6 +121,9 @@ window.__ModuleLoader__.load({
|
|
|
121
121
|
chipTweak: '滑块调整',
|
|
122
122
|
chipTwMake: '做调节滑块',
|
|
123
123
|
chipTwFix: '修调节滑块',
|
|
124
|
+
chipAnMake: '写业务标注',
|
|
125
|
+
chipAnFix: '修业务标注',
|
|
126
|
+
chipAn: '标注 {id}',
|
|
124
127
|
chipSysEx: '提取设计系统',
|
|
125
128
|
chipSysAp: '套用设计系统',
|
|
126
129
|
chipLook: '风格 · {name}',
|
|
@@ -230,6 +233,7 @@ window.__ModuleLoader__.load({
|
|
|
230
233
|
checkFixTip: '把这些问题发到对话,让模型修',
|
|
231
234
|
checkAgain: '再查一次',
|
|
232
235
|
checkFail: '没查成:{msg}',
|
|
236
|
+
checkLayout: '页面还没排好版,这次没量成,过一会儿再查一次',
|
|
233
237
|
checkNote: '只量得出排版上的硬伤,好不好看还得你看',
|
|
234
238
|
checkCount: '设计体检:上次量出 {n} 个问题,点开看',
|
|
235
239
|
checkAsk: '〔设计体检〕发现 {n} 个问题:',
|
|
@@ -496,6 +500,28 @@ window.__ModuleLoader__.load({
|
|
|
496
500
|
dLook: '改配色、字体,或整套换个风格',
|
|
497
501
|
dCheck: '找出文字溢出、重叠、看不清、按钮太小',
|
|
498
502
|
dCheckN: '上次找到 {n} 个问题,点开看',
|
|
503
|
+
an: '业务标注',
|
|
504
|
+
dAn: '界面上看不出来的规则:页面上出编号,右边列卡片,两边能互相定位',
|
|
505
|
+
dAnN: '{n} 条业务规则,点开看',
|
|
506
|
+
anEmpty: '这套设计还没有业务标注。新做的设计模型会自动写,已有的设计可以让它补上。',
|
|
507
|
+
anMake: '让模型标注',
|
|
508
|
+
anFix: '让模型修',
|
|
509
|
+
anBad: '标注文件有 {n} 处问题:',
|
|
510
|
+
anLost: '{n} 条未定位',
|
|
511
|
+
anLostTag: '未定位',
|
|
512
|
+
anOpenTag: '待确认',
|
|
513
|
+
anUpdated: '共 {n} 条 · 文件 {time} 更新',
|
|
514
|
+
anWhole: '整屏说明',
|
|
515
|
+
anSend: '发到对话',
|
|
516
|
+
anSendTip: '放进输入框,接着说这条要怎么改',
|
|
517
|
+
anGone: '不在这套设计里',
|
|
518
|
+
anT_rule: '业务规则',
|
|
519
|
+
anT_state: '状态边界',
|
|
520
|
+
anT_logic: '逻辑',
|
|
521
|
+
anT_flow: '流程',
|
|
522
|
+
anT_metric: '口径',
|
|
523
|
+
anT_data: '口径',
|
|
524
|
+
anMore: '另有 {n} 条',
|
|
499
525
|
dExport: '转成代码、存图片 / PDF / PPT、打包分享',
|
|
500
526
|
dMore: '版本、在手机上看、刷新、在浏览器里打开',
|
|
501
527
|
dZoom: '按住 {mod} 滚动也能缩放',
|
|
@@ -572,6 +598,7 @@ window.__ModuleLoader__.load({
|
|
|
572
598
|
stCode: '正在转成代码',
|
|
573
599
|
stCompare: '正在逐像素对比',
|
|
574
600
|
stPhotos: '正在挑照片',
|
|
601
|
+
stStyle: '正在挑风格',
|
|
575
602
|
stShell: '正在跑命令',
|
|
576
603
|
stRead: '正在看文件',
|
|
577
604
|
stWeb: '正在查资料',
|
|
@@ -599,6 +626,9 @@ window.__ModuleLoader__.load({
|
|
|
599
626
|
twFix: '让模型修好',
|
|
600
627
|
twMakeText: '〔调节滑块〕给这套设计做 3–5 个调节滑块:挑最值得试的维度(比如留白、圆角、主色、卡片排法),照 ui-design 技能「调节滑块」一节写进设计目录的 tweaks.json,把样式接上,做完用 check_design 查一遍。',
|
|
601
628
|
twFixText: '〔调节滑块〕tweaks.json 有问题:{errs}。照 ui-design 技能「调节滑块」一节改好。',
|
|
629
|
+
anMakeText: '〔业务标注〕给这套设计写业务标注:照 ui-design 技能「业务标注」一节写进设计目录的 annotations.json,只写界面上看不出来的规则、状态、边界和口径。',
|
|
630
|
+
anFixText: '〔业务标注〕annotations.json 要修:{errs}。照 ui-design 技能的 references/annotations.md 改好:定位不到的把 selector 和 fallbackText 改对,元素没了就删掉这条。',
|
|
631
|
+
anOneText: '〔业务标注 {id}〕{page} 里的「{title}」这条,改成:',
|
|
602
632
|
twAskHead: '〔调节〕我在右侧调节滑块里调成了下面这样:',
|
|
603
633
|
twAskTail: '照这个改设计(改样式源文件,tweaks.json 里对应的 value 也改成新值)。',
|
|
604
634
|
twAskTip: '让模型照这几个值改设计(可以顺手调整相关的地方)',
|
|
@@ -931,6 +961,9 @@ window.__ModuleLoader__.load({
|
|
|
931
961
|
chipTweak: 'Tweaked values',
|
|
932
962
|
chipTwMake: 'Make tweaks',
|
|
933
963
|
chipTwFix: 'Fix tweaks',
|
|
964
|
+
chipAnMake: 'Write business notes',
|
|
965
|
+
chipAnFix: 'Fix business notes',
|
|
966
|
+
chipAn: 'Note {id}',
|
|
934
967
|
chipSysEx: 'Extract design system',
|
|
935
968
|
chipSysAp: 'Apply design system',
|
|
936
969
|
chipLook: 'Style · {name}',
|
|
@@ -1040,6 +1073,7 @@ window.__ModuleLoader__.load({
|
|
|
1040
1073
|
checkFixTip: 'Send these issues to the chat for the model to fix',
|
|
1041
1074
|
checkAgain: 'Check again',
|
|
1042
1075
|
checkFail: 'Check failed: {msg}',
|
|
1076
|
+
checkLayout: 'The page was not laid out yet, so it was not measured. Check again in a moment.',
|
|
1043
1077
|
checkNote: 'Only measurable layout problems; whether it looks good is still up to you',
|
|
1044
1078
|
checkCount: 'Design check: {n} problems last time. Click to see them',
|
|
1045
1079
|
checkAsk: '[Design check] Found {n} problems:',
|
|
@@ -1305,6 +1339,28 @@ window.__ModuleLoader__.load({
|
|
|
1305
1339
|
dLook: 'Change colors and fonts, or switch the whole style',
|
|
1306
1340
|
dCheck: 'Find overflowing or overlapping text, low contrast and tiny tap targets',
|
|
1307
1341
|
dCheckN: '{n} problems last time. Click to see them',
|
|
1342
|
+
an: 'Notes',
|
|
1343
|
+
dAn: 'Rules the UI does not show: numbered markers on the page, cards on the right, each locating the other',
|
|
1344
|
+
dAnN: '{n} business notes. Click to see them',
|
|
1345
|
+
anEmpty: 'This design has no business notes yet. The model writes them for new designs; for an existing one, ask it to add them.',
|
|
1346
|
+
anMake: 'Ask the model',
|
|
1347
|
+
anFix: 'Ask the model to fix',
|
|
1348
|
+
anBad: 'The notes file has {n} problems:',
|
|
1349
|
+
anLost: '{n} not located',
|
|
1350
|
+
anLostTag: 'Not located',
|
|
1351
|
+
anOpenTag: 'To confirm',
|
|
1352
|
+
anUpdated: '{n} notes · file updated {time}',
|
|
1353
|
+
anWhole: 'Whole screen',
|
|
1354
|
+
anSend: 'Send to chat',
|
|
1355
|
+
anSendTip: 'Put it in the message box, then say what to change',
|
|
1356
|
+
anGone: 'Not in this design',
|
|
1357
|
+
anT_rule: 'Rule',
|
|
1358
|
+
anT_state: 'State',
|
|
1359
|
+
anT_logic: 'Logic',
|
|
1360
|
+
anT_flow: 'Flow',
|
|
1361
|
+
anT_metric: 'Metric',
|
|
1362
|
+
anT_data: 'Metric',
|
|
1363
|
+
anMore: '{n} more',
|
|
1308
1364
|
dExport: 'Build as code, save images / PDF / PPT, or pack and share',
|
|
1309
1365
|
dMore: 'Versions, view on phone, refresh, open in browser',
|
|
1310
1366
|
dZoom: 'Hold {mod} and scroll to zoom too',
|
|
@@ -1381,6 +1437,7 @@ window.__ModuleLoader__.load({
|
|
|
1381
1437
|
stCode: 'Turning it into code',
|
|
1382
1438
|
stCompare: 'Comparing pixel by pixel',
|
|
1383
1439
|
stPhotos: 'Picking photos',
|
|
1440
|
+
stStyle: 'Picking a style',
|
|
1384
1441
|
stShell: 'Running a command',
|
|
1385
1442
|
stRead: 'Reading files',
|
|
1386
1443
|
stWeb: 'Looking things up',
|
|
@@ -1408,6 +1465,9 @@ window.__ModuleLoader__.load({
|
|
|
1408
1465
|
twFix: 'Ask the model to fix it',
|
|
1409
1466
|
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.',
|
|
1410
1467
|
twFixText: '[Tweaks] tweaks.json has problems: {errs}. Fix it as the ui-design skill describes under "Tweaks".',
|
|
1468
|
+
anMakeText: '[Business notes] Write business notes for this design: put them in annotations.json in the design folder as the ui-design skill describes under "Business annotations". Only the rules, states, edge cases and metrics the UI does not show.',
|
|
1469
|
+
anFixText: '[Business notes] annotations.json needs fixing: {errs}. Fix it following references/annotations.md in the ui-design skill: correct the selector and fallbackText of anything that cannot be located, and delete the note if its element is gone.',
|
|
1470
|
+
anOneText: '[Business note {id}] "{title}" on {page}. Change it to:',
|
|
1411
1471
|
twAskHead: '[Tweaks] I set the tweaks in the sidebar to these values:',
|
|
1412
1472
|
twAskTail: 'Change the design to match (edit the style sources and update the matching values in tweaks.json).',
|
|
1413
1473
|
twAskTip: 'Let the model apply these values (and adjust related details)',
|
|
@@ -1683,6 +1743,7 @@ window.__ModuleLoader__.load({
|
|
|
1683
1743
|
mark: 'M4 20l4.5-1L19 8.5a2.1 2.1 0 0 0-3-3L5.5 16z M14 7.5l3 3',
|
|
1684
1744
|
text: 'M5 7V5h14v2 M12 5v14 M9 19h6',
|
|
1685
1745
|
style: 'M4 7h9 M17 7h3 M4 17h3 M11 17h9 M13 7a2 2 0 1 0 4 0a2 2 0 1 0-4 0 M7 17a2 2 0 1 0 4 0a2 2 0 1 0-4 0',
|
|
1746
|
+
note: 'M4 5h16v11H10l-4 4v-4H4z M8 9h8 M8 12h5',
|
|
1686
1747
|
layers: 'M12 3l9 5-9 5-9-5z M3 13l9 5 9-5',
|
|
1687
1748
|
check: 'M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0 M8 12.5l2.7 2.7L16 10',
|
|
1688
1749
|
code: 'M8 7l-5 5 5 5 M16 7l5 5-5 5',
|
|
@@ -2045,6 +2106,31 @@ window.__ModuleLoader__.load({
|
|
|
2045
2106
|
.ddp-drop .in b{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500}
|
|
2046
2107
|
.ddp-home .lk{border:0;padding:0;background:transparent;color:${ACCENT};font:inherit;cursor:pointer}
|
|
2047
2108
|
.ddp-home .lk:hover{text-decoration:underline;text-underline-offset:2px}
|
|
2109
|
+
.ddp-ancard{position:relative;margin:0 0 6px;padding:8px 10px;border-radius:9px;box-shadow:inset 0 0 0 1px var(--dsw-alias-separator-primary,rgba(127,127,127,.2));cursor:pointer;font-size:12px;line-height:18px}
|
|
2110
|
+
.ddp-ancard:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08))}
|
|
2111
|
+
.ddp-ancard.sel{box-shadow:inset 0 0 0 1.5px #4d6bfe;background:rgba(77,107,254,.06)}
|
|
2112
|
+
.ddp-ancard.lost{opacity:.78}
|
|
2113
|
+
.ddp-ancard .hd{display:flex;align-items:center;gap:6px;min-height:20px;font-size:11px;color:var(--dsw-alias-label-secondary)}
|
|
2114
|
+
.ddp-ancard .no{min-width:18px;height:18px;padding:0 4px;box-sizing:border-box;border-radius:9px;border:1.5px solid #4d6bfe;color:#4d6bfe;font:700 11px/15px system-ui,sans-serif;text-align:center;flex:none}
|
|
2115
|
+
.ddp-ancard.sel .no{background:#4d6bfe;color:#fff}
|
|
2116
|
+
.ddp-ancard .id{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary)}
|
|
2117
|
+
.ddp-ancard .tag{flex:none;padding:0 5px;border-radius:4px;font-size:10px;line-height:16px;background:rgba(245,158,11,.16);color:#b45309}
|
|
2118
|
+
.ddp-ancard .tag.lost{background:rgba(229,72,77,.14);color:#e5484d}
|
|
2119
|
+
.ddp-ancard .ti{margin-top:4px;font-weight:600;color:var(--dsw-alias-label-primary);overflow-wrap:anywhere}
|
|
2120
|
+
.ddp-ancard .md{margin-top:2px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}
|
|
2121
|
+
.ddp-ancard .md p{margin:2px 0}
|
|
2122
|
+
.ddp-ancard .md ul{margin:2px 0;padding-left:16px}
|
|
2123
|
+
.ddp-ancard code{padding:0 3px;border-radius:3px;background:rgba(127,127,127,.14);font:11px/16px ui-monospace,SFMono-Regular,Menlo,monospace;overflow-wrap:anywhere}
|
|
2124
|
+
.ddp-ancard .ft{margin-top:6px;padding-top:6px;border-top:1px dashed var(--dsw-alias-separator-primary,rgba(127,127,127,.25));display:flex;flex-wrap:wrap;gap:6px;align-items:baseline;font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}
|
|
2125
|
+
.ddp-ancard .ft.sm{margin-top:3px;padding-top:0;border-top:0}
|
|
2126
|
+
.ddp-ancard .send{display:none;position:absolute;right:6px;bottom:6px;height:22px;padding:0 8px;border:0;border-radius:6px;background:var(--dsw-alias-bg-layer1,#fff);box-shadow:0 0 0 1px var(--dsw-alias-separator-primary,rgba(127,127,127,.25));color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;cursor:pointer}
|
|
2127
|
+
.ddp-ancard:hover .send,.ddp-ancard:focus-within .send,.ddp-ancard.sel .send{display:block}
|
|
2128
|
+
.ddp-ancard .send:hover{color:var(--dsw-alias-label-primary)}
|
|
2129
|
+
.ddp-anerr{margin:0 8px 8px;padding:7px 9px;border-radius:8px;background:rgba(229,72,77,.09);font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;max-height:30%;overflow:auto;flex:none}
|
|
2130
|
+
.ddp-anerr b{font-weight:600;color:#e5484d}
|
|
2131
|
+
.ddp-anerr p{margin:3px 0 0}
|
|
2132
|
+
.ddp-anp footer.row{align-items:center}
|
|
2133
|
+
.ddp-anp footer .lostn{flex:none;padding:0 4px;font-size:11px;color:var(--dsw-alias-label-tertiary);white-space:nowrap}
|
|
2048
2134
|
.ddp-ck{align-items:flex-start}
|
|
2049
2135
|
.ddp-ck .no{width:18px;height:18px;flex:none;margin-top:1px;border-radius:9px;background:#f59e0b;color:#fff;font:700 10px/18px system-ui,sans-serif;text-align:center}
|
|
2050
2136
|
.ddp-ck .no.hi{background:#e5484d}
|
|
@@ -2579,6 +2665,10 @@ window.__ModuleLoader__.load({
|
|
|
2579
2665
|
/* 浮块窄了:先截屏名,到 440 再收按钮上的字,400 收工具坞里的演示(演示时横幅上能退出) */
|
|
2580
2666
|
@container (max-width:560px){.ddp-top>.tl .lab .lb{display:none}.ddp-top>.tl .ddp-btn.lab{padding:0 6px}}
|
|
2581
2667
|
@container (max-width:490px){.ddp-top .lab .lb,.ddp-top .pri .lb{display:none}.ddp-top .ddp-btn.lab{padding:0 6px}}
|
|
2668
|
+
@container (min-width:860px){.ddp-stage.isl.an3>.ddp-busy:not(.side){top:58px;max-width:calc(100% - 24px)}.ddp-stage.isl.an3.bz:has(>.ddp-busy:not(.side))>.ddp-hint,.ddp-stage.isl.an3.bz:has(>.ddp-busy:not(.side))>.ddp-toast:not(.mk),.ddp-stage.isl.an3.bz:has(>.ddp-busy:not(.side))>.ddp-banner,.ddp-stage.isl.an3.bz:has(>.ddp-busy:not(.side))>.ddp-tokens{top:100px}.ddp-stage.isl.an3.bz:has(>.ddp-busy:not(.side))>.ddp-toast.low{top:146px}}
|
|
2669
|
+
@container (max-width:640px){.ddp-top.an3>.tl .lab .lb{display:none}.ddp-top.an3>.tl .ddp-btn.lab{padding:0 6px}}
|
|
2670
|
+
@container (max-width:570px){.ddp-top.an3 .lab .lb,.ddp-top.an3 .pri .lb{display:none}.ddp-top.an3 .ddp-btn.lab{padding:0 6px}}
|
|
2671
|
+
@container (max-width:380px){.ddp-top.an3 .ddp-kind.ddp-where{min-width:30px}.ddp-top.an3 .ddp-addr>span,.ddp-top.an3 .ddp-addr>.ddp-dot{display:none}.ddp-top.an3 .ddp-addr{padding:0 6px;justify-content:center}.ddp-top.an3>.tl .ddp-sep{display:none}}
|
|
2582
2672
|
@container (max-width:440px){.ddp-isl .lab .lb,.ddp-isl .pri .lb{display:none}.ddp-isl .ddp-btn.lab{padding:0 6px}.ddp-tool{width:36px;height:36px}.ddp-tool span{display:none}.ddp-dock .ddp-sep{height:20px}}
|
|
2583
2673
|
@container (max-width:380px){.ddp-tool{width:32px}.ddp-kind.ddp-where{min-width:64px}}
|
|
2584
2674
|
/* 标注底栏:右侧栏窄时「这支笔怎么用」折成两行,不被三个按钮挤成省略号 */
|
|
@@ -2664,6 +2754,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
2664
2754
|
refresh: () => svg([h('path', { key: 1, d: 'M20 11a8 8 0 1 0-2.3 5.7' }), h('path', { key: 2, d: 'M20 5v6h-6' })]),
|
|
2665
2755
|
external: () => svg([h('path', { key: 1, d: 'M14 4h6v6' }), h('path', { key: 2, d: 'M20 4l-9 9' }), h('path', { key: 3, d: 'M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5' })]),
|
|
2666
2756
|
check: () => svg([h('path', { key: 1, d: 'M5 12.5l4.5 4.5L19 7.5', strokeWidth: 2.4 })]),
|
|
2757
|
+
note: () => svg([h('path', { key: 1, d: 'M4 5h16v11H10l-4 4v-4H4z' }), h('path', { key: 2, d: 'M8 9h8' }), h('path', { key: 3, d: 'M8 12h5' })]),
|
|
2667
2758
|
stetho: () => svg([h('path', { key: 1, d: 'M6 3.5H5a1 1 0 0 0-1 1V9a5 5 0 0 0 10 0V4.5a1 1 0 0 0-1-1h-1' }), h('path', { key: 2, d: 'M9 14v1.5a4.5 4.5 0 0 0 9 0V13' }), h('circle', { key: 3, cx: 18, cy: 11, r: 2 })]),
|
|
2668
2759
|
pdf: () => svg([h('path', { key: 1, d: 'M14 3.5H7a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8.5z' }), h('path', { key: 2, d: 'M14 3.5v5h5' }), h('path', { key: 3, d: 'M8.5 13h7M8.5 16.5h4.5' })]),
|
|
2669
2760
|
deck: () => svg([h('rect', { key: 1, x: 3, y: 4, width: 18, height: 12.5, rx: 1.8 }), h('path', { key: 2, d: 'M12 16.5V20M8.5 20.5h7' }), h('path', { key: 3, d: 'M7 12.5l3-3 2.5 2 4-4' })]),
|
|
@@ -2708,20 +2799,32 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
2708
2799
|
function poller(sid) {
|
|
2709
2800
|
let p = pollers.get(sid)
|
|
2710
2801
|
if (p) return p
|
|
2711
|
-
p = { state: null, subs: new Set(), timer: null, refs: 0, inflight: false }
|
|
2802
|
+
p = { state: null, subs: new Set(), timer: null, refs: 0, inflight: false, gen: 0 }
|
|
2712
2803
|
const tick = async () => {
|
|
2713
2804
|
p.timer = null
|
|
2714
2805
|
if (!p.inflight) {
|
|
2715
2806
|
p.inflight = true
|
|
2807
|
+
const gen = p.gen
|
|
2716
2808
|
try {
|
|
2717
|
-
const
|
|
2718
|
-
|
|
2809
|
+
const anSig = p.state && p.state.annotations && p.state.annotations.sig // 业务标注没变就不用再传一遍
|
|
2810
|
+
const r = await fetch(`${API}state?session=${encodeURIComponent(sid)}${anSig ? `&an=${encodeURIComponent(anSig)}` : ''}`, { credentials: 'same-origin', cache: 'no-store' })
|
|
2811
|
+
if (r.ok) {
|
|
2812
|
+
const s = await r.json()
|
|
2813
|
+
// 等回包时别处已经换了状态(换屏、打开):这一份过期了,下一轮再取
|
|
2814
|
+
if (gen === p.gen) {
|
|
2815
|
+
const had = p.state && p.state.annotations
|
|
2816
|
+
const same = s.annotations && s.annotations.same
|
|
2817
|
+
if (same && had && had.sig === s.annotations.sig) s.annotations = had
|
|
2818
|
+
if (!same || s.annotations === had) p.apply(s)
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2719
2821
|
} catch { /* 下一轮再试 */ }
|
|
2720
2822
|
p.inflight = false
|
|
2721
2823
|
}
|
|
2722
2824
|
if (p.refs > 0) p.timer = setTimeout(tick, p.state && p.state.turn ? 700 : 1500)
|
|
2723
2825
|
}
|
|
2724
|
-
p.set = (s) => {
|
|
2826
|
+
p.set = (s) => { p.gen++; p.apply(s) }
|
|
2827
|
+
p.apply = (s) => {
|
|
2725
2828
|
if (JSON.stringify(s) === JSON.stringify(p.state)) return
|
|
2726
2829
|
strictBy.set(sid, new Set(s && Array.isArray(s.strict) ? s.strict : []))
|
|
2727
2830
|
p.state = s
|
|
@@ -3020,6 +3123,9 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
3020
3123
|
card: (v, t, s) => [['b', t('chipTweak')], ...s.split('\n').filter((l) => l.startsWith('- ')).slice(0, 5).map((l) => ['span', l.slice(2)])] },
|
|
3021
3124
|
{ i: 'style', label: (v, t) => t('chipTwMake'), alts: both('twMakeText'), card: (v, t) => [['b', t('chipTwMake')], ['span', 'tweaks.json']] },
|
|
3022
3125
|
{ i: 'style', label: (v, t) => t('chipTwFix'), alts: both('twFixText'), card: (v, t) => [['b', t('chipTwFix')], ['p', v.errs]] },
|
|
3126
|
+
{ i: 'note', label: (v, t) => t('chipAnMake'), alts: both('anMakeText'), card: (v, t) => [['b', t('chipAnMake')], ['span', 'annotations.json']] },
|
|
3127
|
+
{ i: 'note', label: (v, t) => t('chipAnFix'), alts: both('anFixText'), card: (v, t) => [['b', t('chipAnFix')], ['p', v.errs]] },
|
|
3128
|
+
{ i: 'note', label: (v, t) => t('chipAn', { id: v.id }), alts: both('anOneText', { id: '[^\\n〕\\]]*' }), card: (v, t) => [['b', t('chipAn', { id: v.id })], ['p', v.title], ['span', v.page]] },
|
|
3023
3129
|
{ i: 'look', label: (v, t) => t('chipSysEx'), alts: both('sysExtractText'), card: (v, t) => [['b', t('chipSysEx')], ['code', v.src]] },
|
|
3024
3130
|
{ i: 'look', label: (v, t) => t('chipSysAp'), alts: both('sysApplyText'), card: (v, t) => [['b', t('chipSysAp')], ['code', v.name], ['span', v.dir]] },
|
|
3025
3131
|
{ i: 'look', label: (v, t) => t('chipLook', { name: v.name }), alts: L.map((x) => tplSrc(x.styleText, { name: '[^\\n]*?', ask: lit(['styleStart', 'styleRestyle', 'styleAuto']) })),
|
|
@@ -3570,13 +3676,11 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
3570
3676
|
const AUTO_SPREAD = ['minimal', 'editorial', 'playful', 'fresh', 'tech', 'glass', 'dark', 'sport']
|
|
3571
3677
|
// 「北欧风」「清新风:首页…」「中国风的界面」算说了风格;先去掉「通风」「台风」「新风系统」「风控」「风景」这类不是风格的词
|
|
3572
3678
|
const NOT_STYLE_FENG = /通风|台风|新风(系统|机|量)|风险|风控|风景|风扇|风味|风暴|风光|风速|风向|风筝|风铃|风车|吹风|防风|挡风|避风|屏风|旋风|狂风|微风|寒风|疾风|顺风|逆风|作风|中风|风湿|风水/g
|
|
3573
|
-
const SAID_STYLE = /风格|配色|色调|主色|色系|[^\s。,,、::;;((]风|\b(style|styled|aesthetic|vibe|palette|colou?r scheme|look and feel)\b/i
|
|
3574
|
-
// 「风格你定」「配色:随意」「any style」:等于没说(「配色定为蓝白」是说了)
|
|
3575
|
-
const STYLE_FREE = /(风格|配色|色调|主色)\s*(?:[::]\s*)?(你定|您定|你来定|您来定|你决定|你看着办|随意|随便|不限|都行|无所谓|自由发挥)|\b(any|whatever)\s(style|colou?rs?|palette)\b|\b(style|colou?rs?|palette)\s(is\s)?up\sto\syou\b/gi
|
|
3679
|
+
const SAID_STYLE = /风格|配色|色调|主色|色系|[红橙黄绿青蓝紫粉黑白灰棕金银米]色|蓝白|黑白|黑金|红白|绿白|深色|浅色|暗色|亮色|[^\s。,,、::;;((]风|\b(style|styled|aesthetic|vibe|palette|colou?r scheme|look and feel|dark|light)\b/i
|
|
3576
3680
|
function autoStyle(text, kind) {
|
|
3577
3681
|
const s = String(text || '')
|
|
3578
3682
|
if (!s.trim()) return null
|
|
3579
|
-
const said = s.replace(
|
|
3683
|
+
const said = s.replace(NOT_STYLE_FENG, ' ')
|
|
3580
3684
|
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
|
|
3581
3685
|
const by = (id) => STYLES.find((x) => x.id === id) || null
|
|
3582
3686
|
for (const [id, re] of AUTO_STYLE) if (re.test(s)) return by(id)
|
|
@@ -3831,7 +3935,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
3831
3935
|
const n = list.reduce((m, x) => m + x.issues.length, 0)
|
|
3832
3936
|
const lines = [t(head, { n, s: list.length })]
|
|
3833
3937
|
for (const sc of list) {
|
|
3834
|
-
if (sc.error && head !== 'checkAsk') lines.push('', t('ckToolErr', { label: sc.label, msg: sc.error }))
|
|
3938
|
+
if (sc.error && head !== 'checkAsk') lines.push('', t('ckToolErr', { label: sc.label, msg: sc.error === 'layout' ? t('checkLayout') : sc.error }))
|
|
3835
3939
|
if (!sc.issues.length) continue
|
|
3836
3940
|
const sz = head === 'checkAsk' ? '' : sizeLine(t, sc.metrics)
|
|
3837
3941
|
lines.push('', t('ckScreen', { label: sc.label, where: whereOf(sc.url, st) }) + (sz ? ` · ${sz}` : ''))
|
|
@@ -4827,7 +4931,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
4827
4931
|
// 模型在做什么:按它调的工具说人话(写文件另算,见 busyPhase)
|
|
4828
4932
|
const TOOL_PHASE = [
|
|
4829
4933
|
[/^check_design$/, 'stCheck'], [/^look_design$/, 'stLook'], [/^preview_page$/, 'stPreview'], [/^extract_design_system$/, 'stBrand'],
|
|
4830
|
-
[/^handoff_design$/, 'stCode'], [/^compare_design$/, 'stCompare'], [/^find_photos$/, 'stPhotos'], [/^ask_user_question$/, 'asking'],
|
|
4934
|
+
[/^handoff_design$/, 'stCode'], [/^compare_design$/, 'stCompare'], [/^find_photos$/, 'stPhotos'], [/^pick_style$/, 'stStyle'], [/^ask_user_question$/, 'asking'],
|
|
4831
4935
|
[/^(bash|shell|sh|zsh|powershell|pwsh|exec|run_command|terminal)$/i, 'stShell'],
|
|
4832
4936
|
[/^skill$/i, 'stSkill'],
|
|
4833
4937
|
[/web|fetch|browse|http/i, 'stWeb'],
|
|
@@ -5171,7 +5275,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5171
5275
|
const rem = remOf(props)
|
|
5172
5276
|
const wins = useRef(new Map())
|
|
5173
5277
|
const life = useRef(null)
|
|
5174
|
-
if (!life.current) life.current = { next: 1, loading: 0, again: false, file: '', seeds: new Map(), seedOf: new Map(), readied: new Set(), tops: new Map(), snapTimer: null, gen: 0, at: '', deps: null }
|
|
5278
|
+
if (!life.current) life.current = { next: 1, loading: 0, again: false, file: '', seeds: new Map(), seedOf: new Map(), readied: new Set(), tops: new Map(), anStates: new Map(), pageOf: new Map(), snapTimer: null, gen: 0, at: '', deps: null }
|
|
5175
5279
|
const curRef = useRef(0)
|
|
5176
5280
|
const P = useRef(props)
|
|
5177
5281
|
P.current = props
|
|
@@ -5208,6 +5312,10 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5208
5312
|
}),
|
|
5209
5313
|
checkFocus: (i) => { if (curRef.current) postTo(curRef.current, { type: 'checkFocus', i }) },
|
|
5210
5314
|
checkClear: () => { if (curRef.current) postTo(curRef.current, { type: 'checkClear' }) },
|
|
5315
|
+
annotFocus: (id) => { if (curRef.current) postTo(curRef.current, { type: 'annotFocus', id }) },
|
|
5316
|
+
annotPage: () => life.current.pageOf.get(curRef.current) || '', // 这一帧实际显示的屏(设计里的链接能带走)
|
|
5317
|
+
annotHome: (id) => { if (P.current.annotGo) P.current.annotGo.current = id; life.current.at = ''; load(null) }, // 走开了:重新载回这一屏,载好再定位
|
|
5318
|
+
annotHit: (x, y) => { if (curRef.current) postTo(curRef.current, { type: 'annotHit', x, y }) },
|
|
5211
5319
|
unpin: () => { if (curRef.current) postTo(curRef.current, { type: 'unpin' }) }, // 去掉「已选」虚线框
|
|
5212
5320
|
holdScroll: () => { if (curRef.current) postTo(curRef.current, { type: 'holdScroll' }) }, // 用户要在这个位置上画:闪改动别再滚回去
|
|
5213
5321
|
// 画笔标注:这一屏的页面(iframe)现在摆在哪,拼图时按它的位置放截图
|
|
@@ -5282,6 +5390,11 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5282
5390
|
}
|
|
5283
5391
|
|
|
5284
5392
|
// 一帧好了:淡入换上来
|
|
5393
|
+
/** 这一帧该标哪些(设计里的链接能把这一帧带到别的屏,按它实际显示的那屏取) */
|
|
5394
|
+
const annotsOf = (p, id) => {
|
|
5395
|
+
const k = life.current.pageOf.get(id)
|
|
5396
|
+
return p.annotsFor && k && k !== p.annotKey ? p.annotsFor(k) : p.annots
|
|
5397
|
+
}
|
|
5285
5398
|
const swap = (id, changes) => {
|
|
5286
5399
|
const L = life.current
|
|
5287
5400
|
if (L.loading === id) L.loading = 0
|
|
@@ -5298,11 +5411,14 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5298
5411
|
if (p.textEdit) postTo(id, { type: 'edit', on: true, hint: false })
|
|
5299
5412
|
if (p.styleEdit) styleTo(id, p)
|
|
5300
5413
|
if (L.tops.has(id) && p.onTop) p.onTop(L.tops.get(id))
|
|
5414
|
+
if (L.anStates.has(id) && p.onAnnotState) p.onAnnotState(L.anStates.get(id))
|
|
5301
5415
|
if (first && p.onShown) p.onShown()
|
|
5302
5416
|
if (first) { if (build && p.onBuilt) p.onBuilt(L.title || '') } else if (p.onNote) p.onNote({ changes, file: L.file, build })
|
|
5303
5417
|
L.file = ''
|
|
5304
5418
|
setTimeout(() => setFrames((fs) => fs.filter((f) => f.id >= curRef.current || f.id > id)), 450)
|
|
5305
5419
|
for (const k of [...L.tops.keys()]) if (k < id) L.tops.delete(k)
|
|
5420
|
+
for (const k of [...L.anStates.keys()]) if (k < id) L.anStates.delete(k)
|
|
5421
|
+
for (const k of [...L.pageOf.keys()]) if (k < id) L.pageOf.delete(k)
|
|
5306
5422
|
if (L.again) {
|
|
5307
5423
|
L.again = false
|
|
5308
5424
|
postTo(id, { type: 'snapshot' })
|
|
@@ -5353,6 +5469,15 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5353
5469
|
L.title = d.title || ''
|
|
5354
5470
|
if (p.dark) postTo(id, { type: 'theme', dark: true })
|
|
5355
5471
|
if (p.tweak) postTo(id, { type: 'tweak', vars: p.tweak.vars, attrs: p.tweak.attrs })
|
|
5472
|
+
try { if (d.href) L.pageOf.set(id, keyOfPath(decodeURIComponent(new URL(d.href).pathname), true)) } catch { /* 地址不认识:当没跳 */ }
|
|
5473
|
+
{
|
|
5474
|
+
const list = annotsOf(p, id)
|
|
5475
|
+
if (list) {
|
|
5476
|
+
postTo(id, { type: 'annots', list, sel: p.annotSel || '' })
|
|
5477
|
+
// 单页时点了别的屏的卡片:这一屏载好了再滚过去
|
|
5478
|
+
if (p.annotGo && list.some((x) => x.id === p.annotGo.current)) { postTo(id, { type: 'annotFocus', id: p.annotGo.current }); p.annotGo.current = '' }
|
|
5479
|
+
}
|
|
5480
|
+
}
|
|
5356
5481
|
if (p.onMeta) p.onMeta(d.meta || '', d.title || '', Array.isArray(d.tokens) ? d.tokens : [], !!d.dark, Array.isArray(d.links) ? d.links : [], d.natural)
|
|
5357
5482
|
if (p.onHref && d.href) p.onHref(d.href)
|
|
5358
5483
|
if (isCur) {
|
|
@@ -5377,6 +5502,16 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5377
5502
|
case 'dropIn':
|
|
5378
5503
|
if (p.onPageDrag) p.onPageDrag(d)
|
|
5379
5504
|
break
|
|
5505
|
+
case 'annotPick':
|
|
5506
|
+
if (isCur && p.onAnnotPick) p.onAnnotPick(String(d.id || ''))
|
|
5507
|
+
break
|
|
5508
|
+
case 'annotState':
|
|
5509
|
+
// 每帧记着自己的;只有正显示的那帧算数(预载的换上来时再用,旧帧晚到的不管)
|
|
5510
|
+
if (Array.isArray(d.list)) {
|
|
5511
|
+
L.anStates.set(id, d.list)
|
|
5512
|
+
if (isCur && p.onAnnotState) p.onAnnotState(d.list)
|
|
5513
|
+
}
|
|
5514
|
+
break
|
|
5380
5515
|
case 'top':
|
|
5381
5516
|
// 每帧记着自己的;只有正显示的那帧算数(预载的换上来时再用,旧帧晚到的不管)
|
|
5382
5517
|
L.tops.set(id, !!d.dark)
|
|
@@ -5448,6 +5583,10 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5448
5583
|
// 调节滑块:拖的时候改页面上的 CSS 变量 / <html> 属性(新载的一帧在 ready 时套上)
|
|
5449
5584
|
const twSig = JSON.stringify(props.tweak || null)
|
|
5450
5585
|
useEffect(() => { if (cur) postTo(cur, { type: 'tweak', vars: (props.tweak || {}).vars || {}, attrs: (props.tweak || {}).attrs || {} }) }, [twSig])
|
|
5586
|
+
// 业务标注:编号画在页面里(新载的一帧在 ready 时再发一次);点选、改字这些模式下 annots 是 null,编号收起
|
|
5587
|
+
const anSig = JSON.stringify(props.annots || null)
|
|
5588
|
+
useEffect(() => { if (cur) postTo(cur, { type: 'annots', list: annotsOf(props, cur) || [], sel: props.annotSel || '' }) }, [anSig, props.annotVer])
|
|
5589
|
+
useEffect(() => { if (cur && props.annots) postTo(cur, { type: 'annotSel', id: props.annotSel || '' }) }, [props.annotSel || ''])
|
|
5451
5590
|
useEffect(() => {
|
|
5452
5591
|
// 刚退出改字(点按钮、Esc、模型开始干活):页面会把正在改的那一处交上来,这一小会儿还收
|
|
5453
5592
|
if (editWas.current && !props.textEdit) editOffAt.current = Date.now()
|
|
@@ -6163,19 +6302,86 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
6163
6302
|
h('div', { className: 'bd' },
|
|
6164
6303
|
...list.filter((sc) => sc.issues.length || sc.error).map((sc) => h('div', { key: sc.key },
|
|
6165
6304
|
multi ? h('h4', null, sc.label) : null,
|
|
6166
|
-
sc.error ? h('div', { className: 'none' }, t('checkFail', { msg: sc.error })) : null,
|
|
6305
|
+
sc.error ? h('div', { className: 'none' }, sc.error === 'layout' ? t('checkLayout') : t('checkFail', { msg: sc.error })) : null,
|
|
6167
6306
|
...sc.issues.map((it, i) => h('button', { key: i, className: 'ddp-tok ddp-ck', title: it.sel || '', onClick: () => onFocus(sc.key, i) },
|
|
6168
6307
|
h('span', { className: 'no' + (it.sev > 1 ? ' hi' : '') }, String(i + 1)),
|
|
6169
6308
|
h('span', { className: 'tx' },
|
|
6170
6309
|
h('span', { className: 'nm' }, t('ck_' + it.type) + (it.text ? ` · ${it.text}` : '')),
|
|
6171
6310
|
h('span', { className: 'vl' }, checkDetail(t, it))))))),
|
|
6172
|
-
!ck.running && !n ? h('div', { className: 'ok' }, h(I.check), h('span', null, t('checkNone'))) : null),
|
|
6311
|
+
!ck.running && !n && !list.some((sc) => sc.error) ? h('div', { className: 'ok' }, h(I.check), h('span', null, t('checkNone'))) : null),
|
|
6173
6312
|
n ? h('p', { className: 'tip' }, t('checkNote')) : null,
|
|
6174
6313
|
h('footer', { className: 'row' },
|
|
6175
6314
|
h('button', { onClick: onAgain, disabled: ck.running }, h(I.refresh), h('span', null, t('checkAgain'))),
|
|
6176
6315
|
n ? h('button', { className: 'go', onClick: onFix, disabled: ck.running, title: t('checkFixTip') }, h(I.sparkle), h('span', null, t('checkFix'))) : null))
|
|
6177
6316
|
}
|
|
6178
6317
|
|
|
6318
|
+
/** 业务标注的正文:换行、**加粗**、`行内代码`、- 列表,别的原样显示(全走文字节点,不拼 HTML) */
|
|
6319
|
+
const anInline = (s) => String(s).split(/(\*\*[^*\n]+\*\*|`[^`\n]+`)/).map((x, i) => (
|
|
6320
|
+
/^\*\*[^*\n]+\*\*$/.test(x) ? h('b', { key: i }, x.slice(2, -2)) : /^`[^`\n]+`$/.test(x) ? h('code', { key: i }, x.slice(1, -1)) : x))
|
|
6321
|
+
function anBody(text) {
|
|
6322
|
+
const out = []
|
|
6323
|
+
let items = null
|
|
6324
|
+
String(text || '').split('\n').forEach((raw, i) => {
|
|
6325
|
+
const line = raw.trim()
|
|
6326
|
+
const m = /^[-*]\s+(.*)$/.exec(line)
|
|
6327
|
+
if (m) {
|
|
6328
|
+
if (!items) { items = []; out.push(h('ul', { key: i }, items)) }
|
|
6329
|
+
items.push(h('li', { key: i }, anInline(m[1])))
|
|
6330
|
+
return
|
|
6331
|
+
}
|
|
6332
|
+
items = null
|
|
6333
|
+
if (line) out.push(h('p', { key: i }, anInline(line)))
|
|
6334
|
+
})
|
|
6335
|
+
return out
|
|
6336
|
+
}
|
|
6337
|
+
|
|
6338
|
+
/** 业务标注面板:按屏分组,每条一张卡片;定位不到的排在这一屏最后 */
|
|
6339
|
+
function AnnotPanel({ t, file, screens, labelOfKey, states, sel, onFocus, onSend, onMake, onFix, onClose }) {
|
|
6340
|
+
const ref = useRef(null)
|
|
6341
|
+
useEffect(() => {
|
|
6342
|
+
if (!sel || !ref.current) return
|
|
6343
|
+
const el = [...ref.current.querySelectorAll('[data-an]')].find((x) => x.getAttribute('data-an') === sel)
|
|
6344
|
+
if (el) el.scrollIntoView({ block: 'nearest', behavior: 'smooth' })
|
|
6345
|
+
}, [sel])
|
|
6346
|
+
const list = (file && file.list) || []
|
|
6347
|
+
const errors = (file && file.errors) || []
|
|
6348
|
+
const blank = !list.length && !errors.length // 没有文件,或者文件里一条都没有
|
|
6349
|
+
const known = new Set(screens)
|
|
6350
|
+
const isLost = (a) => !known.has(a.page) || !!(states[a.id] && states[a.id].how === '')
|
|
6351
|
+
const lost = list.filter(isLost)
|
|
6352
|
+
const pages = [...screens.filter((k) => list.some((a) => a.page === k)), ...new Set(list.filter((a) => !known.has(a.page)).map((a) => a.page))]
|
|
6353
|
+
const card = (a) => {
|
|
6354
|
+
const gone = isLost(a)
|
|
6355
|
+
const whole = !a.selector && !a.fallbackText
|
|
6356
|
+
const typeName = a.type ? (['rule', 'state', 'logic', 'flow', 'metric', 'data'].includes(a.type) ? t('anT_' + a.type) : a.type) : ''
|
|
6357
|
+
const go = () => onFocus(a)
|
|
6358
|
+
return h('div', { key: a.id, 'data-an': a.id, role: 'button', tabIndex: 0, className: 'ddp-ancard' + (sel === a.id ? ' sel' : '') + (gone ? ' lost' : ''), onClick: go, onKeyDown: (e) => { if (e.key === 'Enter' && e.target === e.currentTarget) go() } },
|
|
6359
|
+
h('div', { className: 'hd' },
|
|
6360
|
+
h('span', { className: 'no' }, String(a.n)),
|
|
6361
|
+
typeName ? h('span', { className: 'ty' }, typeName) : null,
|
|
6362
|
+
h('span', { className: 'id' }, a.id),
|
|
6363
|
+
a.status === 'open' ? h('span', { className: 'tag' }, t('anOpenTag')) : null,
|
|
6364
|
+
gone ? h('span', { className: 'tag lost' }, t('anLostTag')) : null),
|
|
6365
|
+
h('div', { className: 'ti' }, a.title),
|
|
6366
|
+
a.detail ? h('div', { className: 'md' }, anBody(a.detail)) : null,
|
|
6367
|
+
a.anchorLabel || a.selector || whole ? h('div', { className: 'ft' }, whole ? t('anWhole') : a.anchorLabel, a.selector ? h('code', null, a.selector) : null) : null,
|
|
6368
|
+
a.source || a.tags.length || a.related.length ? h('div', { className: 'ft sm' }, [a.source, a.tags.join(' · '), a.related.length ? '→ ' + a.related.join(', ') : ''].filter(Boolean).join(' · ')) : null,
|
|
6369
|
+
h('button', { className: 'send', title: t('anSendTip'), onClick: (e) => { e.stopPropagation(); onSend(a) } }, t('anSend')))
|
|
6370
|
+
}
|
|
6371
|
+
return h('div', { className: 'ddp-tokens ddp-check ddp-anp', ref, onPointerDown: (e) => e.stopPropagation() },
|
|
6372
|
+
h('header', null, h(I.note), h('b', null, t('an')), h('button', { className: 'ddp-btn', title: '×', onClick: onClose }, h(I.close))),
|
|
6373
|
+
list.length ? h('p', { className: 'tip' }, t('anUpdated', { n: list.length, time: hhmm(file.mtime) })) : null,
|
|
6374
|
+
blank ? h('div', { className: 'bd' }, h('div', { className: 'none' }, t('anEmpty'))) : null,
|
|
6375
|
+
errors.length ? h('div', { className: 'ddp-anerr' }, h('b', null, t('anBad', { n: errors.length })), errors.slice(0, 6).map((x, i) => h('p', { key: i }, x)), errors.length > 6 ? h('p', null, t('anMore', { n: errors.length - 6 })) : null) : null,
|
|
6376
|
+
list.length ? h('div', { className: 'bd' }, pages.map((k) => h('div', { key: k },
|
|
6377
|
+
h('h4', null, known.has(k) ? labelOfKey(k) : `${k} · ${t('anGone')}`),
|
|
6378
|
+
[...list.filter((a) => a.page === k && !isLost(a)), ...list.filter((a) => a.page === k && isLost(a))].map(card)))) : null,
|
|
6379
|
+
blank ? h('footer', { className: 'row' }, h('button', { className: 'go', onClick: onMake }, h(I.sparkle), h('span', null, t('anMake')))) : null,
|
|
6380
|
+
file && (errors.length || lost.length) ? h('footer', { className: 'row' },
|
|
6381
|
+
lost.length ? h('span', { className: 'lostn' }, t('anLost', { n: lost.length })) : null,
|
|
6382
|
+
h('button', { className: 'go', onClick: () => onFix(lost) }, h(I.sparkle), h('span', null, t('anFix')))) : null)
|
|
6383
|
+
}
|
|
6384
|
+
|
|
6179
6385
|
/**
|
|
6180
6386
|
* 调样式面板:选中的元素的字号、字重、颜色、背景、圆角、内边距、间距。
|
|
6181
6387
|
* 拖的时候页面上先看效果(还没写进文件);设计变量列成小块,点一个就用 var(--x)。
|
|
@@ -7772,12 +7978,13 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
7772
7978
|
}
|
|
7773
7979
|
setCam({ ...d.cam, x: d.cam.x + dx, y: d.cam.y + dy })
|
|
7774
7980
|
}
|
|
7775
|
-
const up = () => {
|
|
7981
|
+
const up = (ev) => {
|
|
7776
7982
|
window.removeEventListener('pointermove', move)
|
|
7777
7983
|
window.removeEventListener('pointerup', up)
|
|
7778
7984
|
setDrag(false)
|
|
7779
7985
|
if (d.moved) return
|
|
7780
7986
|
if (props.onSelect) props.onSelect(d.key)
|
|
7987
|
+
if (props.onHit && d.key) props.onHit(d.key, ev.clientX, ev.clientY) // 挡板盖着页面:点的是不是业务标注的编号,让页面自己判断
|
|
7781
7988
|
const now = Date.now()
|
|
7782
7989
|
if (d.key && props.onOpen && lastTap.current.key === d.key && now - lastTap.current.at < 380) props.onOpen(d.key)
|
|
7783
7990
|
lastTap.current = { key: d.key, at: now }
|
|
@@ -7902,7 +8109,13 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
7902
8109
|
const [dark, setDark] = useState(false)
|
|
7903
8110
|
const [phone, setPhone] = useState(false) // 手机上看的面板
|
|
7904
8111
|
const [multi, setMulti] = useState(false) // 多尺寸并排
|
|
8112
|
+
const ckGen = useRef(0) // 每量一次、每关一次面板 +1:量完发现不是最新的一次就不算数
|
|
8113
|
+
const ckOpen = useRef(false) // 面板开着(或正在量):过期的一次结果回来时别清掉新一轮的标记
|
|
7905
8114
|
const [ck, setCk] = useState(null) // 设计体检:null = 面板关着;{ running, list: [{ key, label, url, issues, error }] }
|
|
8115
|
+
const [an, setAn] = useState(false) // 业务标注:面板开着(页面上同时出编号)
|
|
8116
|
+
const [anSel, setAnSel] = useState('') // 选中的那条(id)
|
|
8117
|
+
const [anStates, setAnStates] = useState({}) // id → { how, count }:页面里定位的结果
|
|
8118
|
+
const anGo = useRef('') // 单页时点了别的屏的卡片:那一屏载好后滚到这条
|
|
7906
8119
|
const [ckCount, setCkCount] = useState(0) // 最近一次体检(模型干完活会悄悄查一次)有几个问题:面板关着时标在按钮上
|
|
7907
8120
|
const [reveal, setReveal] = useState(null) // 画布上要露出来的那一屏 { key, n }(体检里点了一条)
|
|
7908
8121
|
const [demo, setDemo] = useState(null) // 演示:{ stack: [屏…], layers: [{ id, key, dir, shown }] }
|
|
@@ -8114,6 +8327,20 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8114
8327
|
useEffect(() => { twGen.current++; setTw({}); setTv({}) }, [site])
|
|
8115
8328
|
// 拖的滑块 + 外观面板里直接改的颜色:一起发给页面先看效果
|
|
8116
8329
|
const tweak = Object.keys(tw).length || Object.keys(tv).length ? (() => { const m = tweakMsg(tlist, tw); return { vars: { ...m.vars, ...tv }, attrs: m.attrs } })() : null
|
|
8330
|
+
// 业务标注:开关开着才有 st.annotations 这个键(null = 还没有文件)
|
|
8331
|
+
const anOn = !!st && Object.prototype.hasOwnProperty.call(st, 'annotations')
|
|
8332
|
+
const anFile = anOn ? st.annotations : null
|
|
8333
|
+
const anCount = anFile ? anFile.list.length : 0
|
|
8334
|
+
const anUp = an && anOn && !styleEdit && !mark // 面板在右边显示着(调样式、画笔占着那个位置时让开)
|
|
8335
|
+
const anShowsMarks = anUp && !picking && !textEdit // 页面上出编号
|
|
8336
|
+
const anByPage = useMemo(() => {
|
|
8337
|
+
const out = new Map()
|
|
8338
|
+
for (const a of (anFile && anFile.list) || []) {
|
|
8339
|
+
if (!out.has(a.page)) out.set(a.page, [])
|
|
8340
|
+
out.get(a.page).push({ id: a.id, n: a.n, selector: a.selector, fallbackText: a.fallbackText })
|
|
8341
|
+
}
|
|
8342
|
+
return out
|
|
8343
|
+
}, [anFile ? anFile.sig : ''])
|
|
8117
8344
|
|
|
8118
8345
|
// 看旧版本:画布上换成那一版的几屏(按现在的顺序,那一版独有的接在后面)
|
|
8119
8346
|
const vbase = ver ? `${origin}/__dsh_design__/v/${ver.n}/` : ''
|
|
@@ -8261,7 +8488,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8261
8488
|
return () => ro.disconnect()
|
|
8262
8489
|
}, [!!url])
|
|
8263
8490
|
|
|
8264
|
-
useEffect(() => { setPicking(false); setTextEdit(false); setStyleEdit(false); setSel(''); setVer(null); setCmp(false) }, [site])
|
|
8491
|
+
useEffect(() => { setPicking(false); setTextEdit(false); setStyleEdit(false); setSel(''); setVer(null); setCmp(false); setAn(false); setAnSel(''); setAnStates({}) }, [site])
|
|
8265
8492
|
|
|
8266
8493
|
// 版本列表:面板开着时拉一次,存了新版本(vrev 变了)再拉
|
|
8267
8494
|
const vrev = st ? st.vrev : 0
|
|
@@ -8506,6 +8733,14 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8506
8733
|
styleSel: sty && sty.key === sc.key ? sty.selector : '',
|
|
8507
8734
|
styleCss: sty && sty.key === sc.key ? sty.live : null,
|
|
8508
8735
|
tweak: sc.v ? null : tweak,
|
|
8736
|
+
annots: sc.v || !anShowsMarks ? null : anByPage.get(sc.key) || null,
|
|
8737
|
+
annotKey: sc.key,
|
|
8738
|
+
annotsFor: sc.v || !anShowsMarks ? null : (k) => anByPage.get(k) || [],
|
|
8739
|
+
annotVer: anShowsMarks && anFile ? anFile.sig : '',
|
|
8740
|
+
annotSel: anSel,
|
|
8741
|
+
annotGo: anGo,
|
|
8742
|
+
onAnnotPick: (id) => { setAnSel(id); if (canvas) setSel(sc.key) },
|
|
8743
|
+
onAnnotState: (list) => setAnStates((m) => ({ ...m, ...Object.fromEntries(list.map((x) => [x.id, x])) })),
|
|
8509
8744
|
onStylePick: (p) => onStylePick(sc, p),
|
|
8510
8745
|
onStyleCancel: () => setStyleEdit(false),
|
|
8511
8746
|
dark,
|
|
@@ -8789,6 +9024,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8789
9024
|
|
|
8790
9025
|
// ── 设计体检:画布上量所有屏,单页量这一屏;问题标在页面上,列在面板里 ──
|
|
8791
9026
|
const closeCheck = () => {
|
|
9027
|
+
ckGen.current++
|
|
9028
|
+
ckOpen.current = false
|
|
8792
9029
|
if (ck) for (const sc of ck.list || []) { const a = apis.current.get(ik(sc)); if (a) a.checkClear() }
|
|
8793
9030
|
setCk(null)
|
|
8794
9031
|
}
|
|
@@ -8806,9 +9043,15 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8806
9043
|
}))
|
|
8807
9044
|
const total = (list) => list.reduce((m, x) => m + x.issues.length, 0)
|
|
8808
9045
|
const runCheck = async () => {
|
|
8809
|
-
setPanel(false); setHist(false); setPhone(false)
|
|
9046
|
+
setPanel(false); setHist(false); setPhone(false); setAn(false)
|
|
8810
9047
|
setCk({ running: true, list: [] })
|
|
9048
|
+
const g = ++ckGen.current
|
|
9049
|
+
ckOpen.current = true
|
|
8811
9050
|
const out = await measure(checkList(), false)
|
|
9051
|
+
if (g !== ckGen.current) { // 量的时候面板关了 / 又量了一轮:这份结果作废;面板关着的话,这一轮画上的标记也清掉
|
|
9052
|
+
if (!ckOpen.current) for (const sc of out) { const a = apis.current.get(ik(sc)); if (a) a.checkClear() }
|
|
9053
|
+
return out
|
|
9054
|
+
}
|
|
8812
9055
|
if (canvas && shown.length > LIVE_MAX) say(t('checkPartial', { n: out.length }))
|
|
8813
9056
|
setCk({ running: false, list: out })
|
|
8814
9057
|
setCkCount(total(out))
|
|
@@ -8872,6 +9115,39 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8872
9115
|
closeCheck()
|
|
8873
9116
|
}
|
|
8874
9117
|
const checkOff = !url || !!ver || !!demo || inMulti
|
|
9118
|
+
|
|
9119
|
+
// ── 业务标注(插件页的试验开关开着才有 st.annotations 这个键):面板和体检、版本共用右边那个位置;点选、改字、调样式、画笔时编号收起,退出后回来 ──
|
|
9120
|
+
useEffect(() => { setAnStates({}) }, [anFile ? anFile.sig : '']) // 文件变了(模型改过选择器):别的屏的旧结果作废,等页面重新报
|
|
9121
|
+
const toggleAn = () => {
|
|
9122
|
+
if (an) { setAn(false); setAnSel(''); return }
|
|
9123
|
+
setPanel(false); setHist(false); setPhone(false); setPane(''); closeCheck(); setStyleEdit(false); setMark(false)
|
|
9124
|
+
setAn(true)
|
|
9125
|
+
}
|
|
9126
|
+
const focusAn = (a) => {
|
|
9127
|
+
setAnSel(a.id)
|
|
9128
|
+
const sc = shown.find((x) => x.key === a.page)
|
|
9129
|
+
if (!sc) return
|
|
9130
|
+
if (!canvas && a.page !== focus) { anGo.current = a.id; pickScreen(a.page); return }
|
|
9131
|
+
if (canvas) { setSel(a.page); setReveal((r) => ({ key: a.page, n: ((r && r.n) || 0) + 1 })) }
|
|
9132
|
+
apiOf(sc).then((api) => {
|
|
9133
|
+
const at = api.annotPage()
|
|
9134
|
+
if (at && at !== a.page) api.annotHome(a.id)
|
|
9135
|
+
else api.annotFocus(a.id)
|
|
9136
|
+
}).catch((e) => console.warn('[dsh-design-studio] 定位标注失败', a.id, e))
|
|
9137
|
+
}
|
|
9138
|
+
const fixAn = (lost) => {
|
|
9139
|
+
const bad = [...((anFile && anFile.errors) || []), ...lost.map((a) => `${a.id}(${a.page})${t('anLostTag')}`)].map((x) => String(x).replace(/\s*\n\s*/g, ' '))
|
|
9140
|
+
insert(t('anFixText', { errs: bad.slice(0, 12).join(';') + (bad.length > 12 ? ';' + t('anMore', { n: bad.length - 12 }) : '') }), 'insertedSend')
|
|
9141
|
+
}
|
|
9142
|
+
const hitAn = (key, x, y) => {
|
|
9143
|
+
const sc = shown.find((s) => s.key === key)
|
|
9144
|
+
const api = sc && apis.current.get(ik(sc))
|
|
9145
|
+
const f = api && typeof api.frame === 'function' ? api.frame() : null
|
|
9146
|
+
if (!f) return
|
|
9147
|
+
const r = f.getBoundingClientRect()
|
|
9148
|
+
const k = Math.max(1, f.offsetWidth) / Math.max(1, r.width)
|
|
9149
|
+
api.annotHit((x - r.left) * k, (y - r.top) * k)
|
|
9150
|
+
}
|
|
8875
9151
|
const styleOff = !url || !!ver || !!demo || inMulti || busy
|
|
8876
9152
|
|
|
8877
9153
|
// ── 画笔标注:画完把台面上看得到的几屏各截一张,按位置摆好,叠上画的东西,存进 refs/,路径放进输入框让模型用 read_image 看(不动剪贴板) ──
|
|
@@ -9086,16 +9362,17 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9086
9362
|
hiddenSaid.current = sig
|
|
9087
9363
|
}, [hiddenN, targetKey])
|
|
9088
9364
|
useEffect(() => { if (checkOff && ck) closeCheck() }, [checkOff])
|
|
9365
|
+
useEffect(() => { if (checkOff) { setAn(false); setAnSel('') } }, [checkOff])
|
|
9089
9366
|
|
|
9090
9367
|
const toggleDemo = () => (demo ? setDemo(null) : startDemo())
|
|
9091
|
-
const openLook = (tab) => { if (tab) setLookTab(tab); setPanel(true); setHist(false); setPhone(false); closeCheck(); setStyleEdit(false) }
|
|
9092
|
-
const toggleHist = () => { setHist(!hist); setPanel(false); setPhone(false); closeCheck(); setStyleEdit(false) }
|
|
9368
|
+
const openLook = (tab) => { if (tab) setLookTab(tab); setPanel(true); setHist(false); setPhone(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
9369
|
+
const toggleHist = () => { setHist(!hist); setPanel(false); setPhone(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
9093
9370
|
// 右边同一时间只开一个面板:别的开了,这几个关掉;开这几个时别的关掉
|
|
9094
9371
|
const oldOpen = !!(panel || hist || phone || ck || styleEdit)
|
|
9095
9372
|
useEffect(() => { if (oldOpen) setPane('') }, [oldOpen])
|
|
9096
9373
|
const openPane = (p) => {
|
|
9097
9374
|
const next = pane === p ? '' : p
|
|
9098
|
-
if (next) { setPanel(false); setHist(false); setPhone(false); closeCheck(); setStyleEdit(false) }
|
|
9375
|
+
if (next) { setPanel(false); setHist(false); setPhone(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
9099
9376
|
setPane(next)
|
|
9100
9377
|
}
|
|
9101
9378
|
const setTweak = (k, v) => setTw((c) => {
|
|
@@ -9137,7 +9414,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9137
9414
|
}), 'insertedSend')
|
|
9138
9415
|
setPane('')
|
|
9139
9416
|
}
|
|
9140
|
-
const togglePhone = () => { setPhone(!phone); setPanel(false); setHist(false); closeCheck(); setStyleEdit(false) }
|
|
9417
|
+
const togglePhone = () => { setPhone(!phone); setPanel(false); setHist(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
9141
9418
|
const reload = () => setReloadSeq((x) => x + 1)
|
|
9142
9419
|
|
|
9143
9420
|
// 浮在画布上的几块,各管一件事,按钮都带字:左上 设计库 | 屏名 ▾(换屏、多尺寸、类型都在这个菜单里);
|
|
@@ -9175,11 +9452,11 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9175
9452
|
const dockTight = box.w > 0 && box.w <= 400 // 侧栏很窄:底部工具坞只放得下四个,「试用」进「更多」
|
|
9176
9453
|
const tool = (cls, on, desc, off, run, Icon, label) => h('button', { className: 'ddp-tool' + (cls ? ' ' + cls : '') + (on ? ' on' : ''), ...tipA(label, desc, on ? 'Esc' : ''), 'aria-pressed': !!on, disabled: !!off, onClick: run }, h(Icon), h('span', null, label))
|
|
9177
9454
|
const islands = editing
|
|
9178
|
-
? [h('div', { key: 'top', className: 'ddp-top' },
|
|
9455
|
+
? [h('div', { key: 'top', className: 'ddp-top' + (anOn ? ' an3' : '') },
|
|
9179
9456
|
h('div', { className: 'ddp-isl tl wide' },
|
|
9180
9457
|
h(AddressForm, { t, sid, initial: st && st.target && st.target.kind === 'file' ? st.target.file : st && st.label ? st.label : '', autoFocus: true, onDone: () => setEditing(false), onBrowse: browse })))]
|
|
9181
9458
|
: [
|
|
9182
|
-
h('div', { key: 'top', className: 'ddp-top' },
|
|
9459
|
+
h('div', { key: 'top', className: 'ddp-top' + (anOn ? ' an3' : '') },
|
|
9183
9460
|
h('div', { className: 'ddp-isl tl' },
|
|
9184
9461
|
h('button', { className: 'ddp-btn lab' + (homeAt === 'on' ? ' sel' : ''), ...tipA(t('homeBtn'), t('dHome'), homeAt === 'on' ? 'Esc' : ''), 'aria-pressed': homeAt === 'on', onClick: () => (homeAt === 'on' ? homeClose() : homeOpen()) }, h(I.home), h('span', { className: 'lb' }, t('homeBtn'))),
|
|
9185
9462
|
h('button', { className: 'ddp-btn lab' + (onCanvas ? ' sel' : ''), ...tipA(t('canvasShort'), t('dCanvas')), 'aria-pressed': onCanvas, disabled: !url, onClick: toCanvas }, h(I.canvas), h('span', { className: 'lb' }, t('canvasShort'))),
|
|
@@ -9192,6 +9469,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9192
9469
|
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'))),
|
|
9193
9470
|
h('button', { className: 'ddp-btn lab' + (ck ? ' sel' : ''), ...tipA(t('checkShort'), ckCount && !ck ? t('dCheckN', { n: ckCount }) : t('dCheck')), disabled: checkOff, onClick: () => (ck ? closeCheck() : runCheck()) },
|
|
9194
9471
|
h(I.stetho), h('span', { className: 'lb' }, t('checkShort')), ckCount && !ck && !checkOff ? h('span', { className: 'bdg' }, ckCount > 99 ? '99+' : String(ckCount)) : null),
|
|
9472
|
+
anOn ? h('button', { className: 'ddp-btn lab' + (anUp ? ' sel' : ''), ...tipA(t('an'), anCount && !anUp ? t('dAnN', { n: anCount }) : t('dAn')), disabled: checkOff, onClick: toggleAn },
|
|
9473
|
+
h(I.note), h('span', { className: 'lb' }, t('an')), anCount && !anUp && !checkOff ? h('span', { className: 'bdg' }, anCount > 99 ? '99+' : String(anCount)) : null) : null,
|
|
9195
9474
|
h('span', { className: 'ddp-sep' }),
|
|
9196
9475
|
h(DropMenu, { t, tip: [t('deliver'), t('dExport')], btnCls: 'pri', icon: I.download, label: t('deliver'), caret: true, open: exMenu, setOpen: setExMenu, disabled: !url, items: [
|
|
9197
9476
|
'hd:' + t('deliverCode'),
|
|
@@ -9686,21 +9965,22 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9686
9965
|
sel: sel || focus,
|
|
9687
9966
|
labelOf: shortOf,
|
|
9688
9967
|
reveal,
|
|
9689
|
-
inset: ck || styleEdit || panel || pane || hist || phone ? 296 : 0, // 右边的面板 276 宽,离边 10
|
|
9968
|
+
inset: anUp || ck || styleEdit || panel || pane || hist || phone ? 296 : 0, // 右边的面板 276 宽,离边 10
|
|
9690
9969
|
render: (sc, z) => renderScreen(sc, z, false),
|
|
9691
9970
|
sleep: sleepScreen,
|
|
9692
9971
|
flows,
|
|
9693
9972
|
onSelect: setSel,
|
|
9973
|
+
onHit: anUp && anShowsMarks ? hitAn : null,
|
|
9694
9974
|
onOpen: (key) => openByUser(key),
|
|
9695
9975
|
})
|
|
9696
9976
|
} else {
|
|
9697
9977
|
const fill = kind === 'web'
|
|
9698
9978
|
const [dw, dh] = deviceBox(kind, size)
|
|
9699
9979
|
// 右边开着面板(体检、调样式、设计规范、换风格):手机这类有外框的让到面板左边(侧栏够宽时),别被挡住
|
|
9700
|
-
const sideOn = !!(ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240
|
|
9980
|
+
const sideOn = !!(anUp || ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240
|
|
9701
9981
|
const aside = !fill && sideOn ? 296 : 0
|
|
9702
9982
|
// 生成中:右侧栏窄(或开着面板)时状态条在上排浮块下面,手机这类给它让一条;宽的时候它在上排中间,不用让。网页不让(一让就重排)
|
|
9703
|
-
busyGap = busy && !fill && (box.w < 860 || sideOn)
|
|
9983
|
+
busyGap = busy && !fill && (anOn || box.w < 860 || sideOn)
|
|
9704
9984
|
// 画笔标注开着:网页按开标注时的大小定住(侧栏拉窄了就整体缩小,不重排),画的才对得上
|
|
9705
9985
|
const lock = fill && mark && markSize ? markSize : null
|
|
9706
9986
|
const z = lock ? Math.max(0.05, Math.min(1, box.w / lock.w, ah / lock.h)) : fill ? 1 : Math.max(0.05, Math.min(1, (box.w - aside - 32) / dw, (ah - 16 - (ver || hintTop || busyGap ? 46 : 0)) / dh))
|
|
@@ -9718,13 +9998,13 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9718
9998
|
}
|
|
9719
9999
|
|
|
9720
10000
|
let chip = null
|
|
9721
|
-
const sideOpen = !!(ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240 // 右边开着面板:提示放在左边那块的中间
|
|
10001
|
+
const sideOpen = !!(anUp || ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240 // 右边开着面板:提示放在左边那块的中间
|
|
9722
10002
|
const side = sideOpen ? ' side' : ''
|
|
9723
10003
|
const hintText = picking ? t(canvas || inMulti ? 'pickAny' : 'pickOne') : textEdit ? t(canvas || inMulti ? 'textAny' : 'textOne') : styleEdit && !sty ? t(canvas ? 'styleAny' : 'styleOne') : ''
|
|
9724
10004
|
if (flash) chip = h('div', { className: 'ddp-chip ok' + side, key: 'ok' }, h(I.check), h('span', null, flash))
|
|
9725
10005
|
|
|
9726
10006
|
return root(
|
|
9727
|
-
h('div', { className: 'ddp-stage isl' + (busy ? ' bz' : ''), ref: stageRef },
|
|
10007
|
+
h('div', { className: 'ddp-stage isl' + (busy ? ' bz' : '') + (anOn ? ' an3' : ''), ref: stageRef },
|
|
9728
10008
|
h('div', { className: 'ddp-body' + (cvBody ? '' : ' pad' + (ver || demo || hintTop || busyGap ? ' vb' : '') + (ease ? ' ease' : '')) }, body),
|
|
9729
10009
|
busy ? h('div', { className: 'ddp-glow' }) : null,
|
|
9730
10010
|
busy ? h('div', { className: 'ddp-ring' }) : null,
|
|
@@ -9733,6 +10013,19 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9733
10013
|
// 提示只占一个位置:有新消息(toast)时它先让开,消息走了再回来
|
|
9734
10014
|
hintText && !toast ? h('div', { className: 'ddp-hint' + (sideOpen ? ' side' : '') }, hintText) : null,
|
|
9735
10015
|
ck ? h(CheckPanel, { t, ck, onFocus: focusIssue, onFix: fixIssues, onAgain: runCheck, onClose: closeCheck }) : null,
|
|
10016
|
+
anUp ? h(AnnotPanel, {
|
|
10017
|
+
t,
|
|
10018
|
+
file: anFile,
|
|
10019
|
+
screens: shown.map((x) => x.key),
|
|
10020
|
+
labelOfKey: (k) => { const sc = shown.find((x) => x.key === k); return sc ? labelOf(sc) : k },
|
|
10021
|
+
states: anStates,
|
|
10022
|
+
sel: anSel,
|
|
10023
|
+
onFocus: focusAn,
|
|
10024
|
+
onSend: (a) => insert(t('anOneText', { id: a.id, title: a.title, page: a.page }), 'inserted'),
|
|
10025
|
+
onMake: () => insert(t('anMakeText'), 'insertedSend'),
|
|
10026
|
+
onFix: fixAn,
|
|
10027
|
+
onClose: toggleAn,
|
|
10028
|
+
}) : null,
|
|
9736
10029
|
styleEdit ? h(StylePanel, {
|
|
9737
10030
|
t,
|
|
9738
10031
|
sty,
|