dsh-design-studio 0.16.1 → 0.18.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 +505 -50
- package/lib/gallery/routes.js +53 -4
- package/lib/gallery/submit.js +288 -0
- package/lib/handoff.js +7 -3
- package/lib/index.js +82 -11
- 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: '让模型照这几个值改设计(可以顺手调整相关的地方)',
|
|
@@ -824,7 +854,7 @@ window.__ModuleLoader__.load({
|
|
|
824
854
|
exShare: '分享到设计市场',
|
|
825
855
|
shTitle: '分享到设计市场',
|
|
826
856
|
shGh: '投稿要有 GitHub 账号',
|
|
827
|
-
shTip: '
|
|
857
|
+
shTip: '交上去的东西是公开的:别人能看、能拿去用。先查一遍,过了就能投。',
|
|
828
858
|
shName: '名字',
|
|
829
859
|
shDesc: '一句话介绍',
|
|
830
860
|
shDescPh: '比如:街角茶饮店的三屏点单 App',
|
|
@@ -837,12 +867,39 @@ window.__ModuleLoader__.load({
|
|
|
837
867
|
shChecking: '在查…',
|
|
838
868
|
shOk: '查过了,打好了:{name}(在「下载」里)',
|
|
839
869
|
shSteps: '还差三步:',
|
|
840
|
-
shStep1: '
|
|
870
|
+
shStep1: '点「打开投稿页」(先登录 GitHub)',
|
|
841
871
|
shStep2: '把这个 zip 拖进「设计包」那一栏',
|
|
842
872
|
shStep3: '勾上四个确认,点「Submit new issue」',
|
|
843
873
|
shOpen: '打开投稿页',
|
|
844
874
|
shAfter: '几分钟后机器人会在那条 issue 里回复结果;上架后「我的作品」里这套会显示「已上架」。投稿记号:{ref}',
|
|
845
875
|
shAgain: '改好了,再查一遍',
|
|
876
|
+
shGhWhy: '连一次 GitHub,以后点一下就能投:插件替你把 zip 放进你自己的 GitHub 仓库、开好投稿 issue。',
|
|
877
|
+
shGhConnect: '连上 GitHub',
|
|
878
|
+
shGhCode: '到 GitHub 输这个码:',
|
|
879
|
+
shGhCopy: '复制',
|
|
880
|
+
shGhOpen: '打开 GitHub 输码',
|
|
881
|
+
shGhCancel: '取消',
|
|
882
|
+
shGhWaiting: '输完点「Authorize」,这里会自动接着走。',
|
|
883
|
+
shGhAs: '用 GitHub 账号 {login} 投稿',
|
|
884
|
+
shGhLogout: '断开',
|
|
885
|
+
shGhErr_denied: '你在 GitHub 上点了拒绝。想投的话再连一次。',
|
|
886
|
+
shGhErr_expired: '码过期了,再连一次。',
|
|
887
|
+
shGhErr_net: '连不上 GitHub,等会儿再试,或者用网页表单交。',
|
|
888
|
+
shGhErr_noApp: '这个版本还不能一键投稿,用网页表单交。',
|
|
889
|
+
shGhErr_device: 'GitHub 没连上,再试一次,或者用网页表单交。',
|
|
890
|
+
shSubmit: '一键投稿',
|
|
891
|
+
shSubmittingShort: '在投…',
|
|
892
|
+
shSubmitting: '在投…第一次会在你的 GitHub 里建一个副本放 zip,要一两分钟。',
|
|
893
|
+
shSubmitted: '交上去了:机器人几分钟内会在投稿 issue 里回复检查结果。',
|
|
894
|
+
shSubmittedLink: '看投稿进度',
|
|
895
|
+
shManual: '不想连 GitHub?用网页表单交',
|
|
896
|
+
shSubErr_auth: 'GitHub 授权失效了,重新连一次。',
|
|
897
|
+
shSubErr_net: '连不上 GitHub,等会儿再试,或者用网页表单交。',
|
|
898
|
+
shSubErr_big: '包太大(超过 8MB),投不上去:删掉用不到的大图再查一遍。',
|
|
899
|
+
shSubErr_notShared: '找不到刚打好的包了,再点一次「检查并投稿」。',
|
|
900
|
+
shSubErr_busy: '正在投,稍等。',
|
|
901
|
+
shSubErr_who: '现在连着的 GitHub 账号换成了 {msg}(别的窗口里换的)。没投,确认用这个账号的话再点一次。',
|
|
902
|
+
shSubErr_api: 'GitHub 没接住({msg}):再试一次,或者用网页表单交。',
|
|
846
903
|
wkShare: '分享到设计市场',
|
|
847
904
|
wkListed: '已上架 · 去市场看',
|
|
848
905
|
wkShared: '分享过 · 还没上架',
|
|
@@ -931,6 +988,9 @@ window.__ModuleLoader__.load({
|
|
|
931
988
|
chipTweak: 'Tweaked values',
|
|
932
989
|
chipTwMake: 'Make tweaks',
|
|
933
990
|
chipTwFix: 'Fix tweaks',
|
|
991
|
+
chipAnMake: 'Write business notes',
|
|
992
|
+
chipAnFix: 'Fix business notes',
|
|
993
|
+
chipAn: 'Note {id}',
|
|
934
994
|
chipSysEx: 'Extract design system',
|
|
935
995
|
chipSysAp: 'Apply design system',
|
|
936
996
|
chipLook: 'Style · {name}',
|
|
@@ -1040,6 +1100,7 @@ window.__ModuleLoader__.load({
|
|
|
1040
1100
|
checkFixTip: 'Send these issues to the chat for the model to fix',
|
|
1041
1101
|
checkAgain: 'Check again',
|
|
1042
1102
|
checkFail: 'Check failed: {msg}',
|
|
1103
|
+
checkLayout: 'The page was not laid out yet, so it was not measured. Check again in a moment.',
|
|
1043
1104
|
checkNote: 'Only measurable layout problems; whether it looks good is still up to you',
|
|
1044
1105
|
checkCount: 'Design check: {n} problems last time. Click to see them',
|
|
1045
1106
|
checkAsk: '[Design check] Found {n} problems:',
|
|
@@ -1305,6 +1366,28 @@ window.__ModuleLoader__.load({
|
|
|
1305
1366
|
dLook: 'Change colors and fonts, or switch the whole style',
|
|
1306
1367
|
dCheck: 'Find overflowing or overlapping text, low contrast and tiny tap targets',
|
|
1307
1368
|
dCheckN: '{n} problems last time. Click to see them',
|
|
1369
|
+
an: 'Notes',
|
|
1370
|
+
dAn: 'Rules the UI does not show: numbered markers on the page, cards on the right, each locating the other',
|
|
1371
|
+
dAnN: '{n} business notes. Click to see them',
|
|
1372
|
+
anEmpty: 'This design has no business notes yet. The model writes them for new designs; for an existing one, ask it to add them.',
|
|
1373
|
+
anMake: 'Ask the model',
|
|
1374
|
+
anFix: 'Ask the model to fix',
|
|
1375
|
+
anBad: 'The notes file has {n} problems:',
|
|
1376
|
+
anLost: '{n} not located',
|
|
1377
|
+
anLostTag: 'Not located',
|
|
1378
|
+
anOpenTag: 'To confirm',
|
|
1379
|
+
anUpdated: '{n} notes · file updated {time}',
|
|
1380
|
+
anWhole: 'Whole screen',
|
|
1381
|
+
anSend: 'Send to chat',
|
|
1382
|
+
anSendTip: 'Put it in the message box, then say what to change',
|
|
1383
|
+
anGone: 'Not in this design',
|
|
1384
|
+
anT_rule: 'Rule',
|
|
1385
|
+
anT_state: 'State',
|
|
1386
|
+
anT_logic: 'Logic',
|
|
1387
|
+
anT_flow: 'Flow',
|
|
1388
|
+
anT_metric: 'Metric',
|
|
1389
|
+
anT_data: 'Metric',
|
|
1390
|
+
anMore: '{n} more',
|
|
1308
1391
|
dExport: 'Build as code, save images / PDF / PPT, or pack and share',
|
|
1309
1392
|
dMore: 'Versions, view on phone, refresh, open in browser',
|
|
1310
1393
|
dZoom: 'Hold {mod} and scroll to zoom too',
|
|
@@ -1381,6 +1464,7 @@ window.__ModuleLoader__.load({
|
|
|
1381
1464
|
stCode: 'Turning it into code',
|
|
1382
1465
|
stCompare: 'Comparing pixel by pixel',
|
|
1383
1466
|
stPhotos: 'Picking photos',
|
|
1467
|
+
stStyle: 'Picking a style',
|
|
1384
1468
|
stShell: 'Running a command',
|
|
1385
1469
|
stRead: 'Reading files',
|
|
1386
1470
|
stWeb: 'Looking things up',
|
|
@@ -1408,6 +1492,9 @@ window.__ModuleLoader__.load({
|
|
|
1408
1492
|
twFix: 'Ask the model to fix it',
|
|
1409
1493
|
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
1494
|
twFixText: '[Tweaks] tweaks.json has problems: {errs}. Fix it as the ui-design skill describes under "Tweaks".',
|
|
1495
|
+
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.',
|
|
1496
|
+
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.',
|
|
1497
|
+
anOneText: '[Business note {id}] "{title}" on {page}. Change it to:',
|
|
1411
1498
|
twAskHead: '[Tweaks] I set the tweaks in the sidebar to these values:',
|
|
1412
1499
|
twAskTail: 'Change the design to match (edit the style sources and update the matching values in tweaks.json).',
|
|
1413
1500
|
twAskTip: 'Let the model apply these values (and adjust related details)',
|
|
@@ -1632,7 +1719,7 @@ window.__ModuleLoader__.load({
|
|
|
1632
1719
|
exShare: 'Share to the gallery',
|
|
1633
1720
|
shTitle: 'Share to the gallery',
|
|
1634
1721
|
shGh: 'You need a GitHub account to submit',
|
|
1635
|
-
shTip: 'What you share is public: anyone can see and reuse it. It is checked first
|
|
1722
|
+
shTip: 'What you share is public: anyone can see and reuse it. It is checked first; once it passes you can submit it.',
|
|
1636
1723
|
shName: 'Name',
|
|
1637
1724
|
shDesc: 'One-line description',
|
|
1638
1725
|
shDescPh: 'e.g. A three-screen ordering app for a corner tea shop',
|
|
@@ -1645,12 +1732,39 @@ window.__ModuleLoader__.load({
|
|
|
1645
1732
|
shChecking: 'Checking…',
|
|
1646
1733
|
shOk: 'Checked and saved: {name} (in Downloads)',
|
|
1647
1734
|
shSteps: 'Three more steps:',
|
|
1648
|
-
shStep1: 'Click “Open the submission page”
|
|
1735
|
+
shStep1: 'Click “Open the submission page” (sign in to GitHub first)',
|
|
1649
1736
|
shStep2: 'Drag this zip into the “Design pack” box',
|
|
1650
1737
|
shStep3: 'Tick the four boxes and click “Submit new issue”',
|
|
1651
1738
|
shOpen: 'Open the submission page',
|
|
1652
1739
|
shAfter: 'A bot replies on that issue within minutes; once it is listed, My work shows “Listed”. Submission ref: {ref}',
|
|
1653
1740
|
shAgain: 'Fixed, check again',
|
|
1741
|
+
shGhWhy: 'Connect GitHub once and submitting is one click: the plugin puts the zip in your own GitHub repository and opens the submission issue for you.',
|
|
1742
|
+
shGhConnect: 'Connect GitHub',
|
|
1743
|
+
shGhCode: 'Enter this code on GitHub:',
|
|
1744
|
+
shGhCopy: 'Copy',
|
|
1745
|
+
shGhOpen: 'Open GitHub to enter the code',
|
|
1746
|
+
shGhCancel: 'Cancel',
|
|
1747
|
+
shGhWaiting: 'After entering it, click “Authorize”; this continues by itself.',
|
|
1748
|
+
shGhAs: 'Submitting as GitHub user {login}',
|
|
1749
|
+
shGhLogout: 'Disconnect',
|
|
1750
|
+
shGhErr_denied: 'You declined on GitHub. Connect again if you want to submit.',
|
|
1751
|
+
shGhErr_expired: 'The code expired. Connect again.',
|
|
1752
|
+
shGhErr_net: 'Could not reach GitHub. Try again later, or use the web form.',
|
|
1753
|
+
shGhErr_noApp: 'One-click submission is not available in this version; use the web form.',
|
|
1754
|
+
shGhErr_device: 'Could not connect GitHub. Try again, or use the web form.',
|
|
1755
|
+
shSubmit: 'Submit',
|
|
1756
|
+
shSubmittingShort: 'Submitting…',
|
|
1757
|
+
shSubmitting: 'Submitting… The first time, a copy of the gallery is made in your GitHub to hold the zip; this takes a minute or two.',
|
|
1758
|
+
shSubmitted: 'Submitted: a bot replies on the submission issue with the check results within minutes.',
|
|
1759
|
+
shSubmittedLink: 'See progress',
|
|
1760
|
+
shManual: 'Rather not connect GitHub? Use the web form',
|
|
1761
|
+
shSubErr_auth: 'GitHub access expired. Connect again.',
|
|
1762
|
+
shSubErr_net: 'Could not reach GitHub. Try again later, or use the web form.',
|
|
1763
|
+
shSubErr_big: 'The pack is too big (over 8 MB): remove large images you do not use and check again.',
|
|
1764
|
+
shSubErr_notShared: 'The pack just made is gone; click “Check and submit” again.',
|
|
1765
|
+
shSubErr_busy: 'Already submitting, one moment.',
|
|
1766
|
+
shSubErr_who: 'The connected GitHub account changed to {msg} (in another window). Nothing was sent; click again to submit with this account.',
|
|
1767
|
+
shSubErr_api: 'GitHub did not accept it ({msg}): try again, or use the web form.',
|
|
1654
1768
|
wkShare: 'Share to the gallery',
|
|
1655
1769
|
wkListed: 'Listed · view in gallery',
|
|
1656
1770
|
wkShared: 'Shared · not listed yet',
|
|
@@ -1683,6 +1797,7 @@ window.__ModuleLoader__.load({
|
|
|
1683
1797
|
mark: 'M4 20l4.5-1L19 8.5a2.1 2.1 0 0 0-3-3L5.5 16z M14 7.5l3 3',
|
|
1684
1798
|
text: 'M5 7V5h14v2 M12 5v14 M9 19h6',
|
|
1685
1799
|
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',
|
|
1800
|
+
note: 'M4 5h16v11H10l-4 4v-4H4z M8 9h8 M8 12h5',
|
|
1686
1801
|
layers: 'M12 3l9 5-9 5-9-5z M3 13l9 5 9-5',
|
|
1687
1802
|
check: 'M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0 M8 12.5l2.7 2.7L16 10',
|
|
1688
1803
|
code: 'M8 7l-5 5 5 5 M16 7l5 5-5 5',
|
|
@@ -2045,6 +2160,31 @@ window.__ModuleLoader__.load({
|
|
|
2045
2160
|
.ddp-drop .in b{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500}
|
|
2046
2161
|
.ddp-home .lk{border:0;padding:0;background:transparent;color:${ACCENT};font:inherit;cursor:pointer}
|
|
2047
2162
|
.ddp-home .lk:hover{text-decoration:underline;text-underline-offset:2px}
|
|
2163
|
+
.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}
|
|
2164
|
+
.ddp-ancard:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08))}
|
|
2165
|
+
.ddp-ancard.sel{box-shadow:inset 0 0 0 1.5px #4d6bfe;background:rgba(77,107,254,.06)}
|
|
2166
|
+
.ddp-ancard.lost{opacity:.78}
|
|
2167
|
+
.ddp-ancard .hd{display:flex;align-items:center;gap:6px;min-height:20px;font-size:11px;color:var(--dsw-alias-label-secondary)}
|
|
2168
|
+
.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}
|
|
2169
|
+
.ddp-ancard.sel .no{background:#4d6bfe;color:#fff}
|
|
2170
|
+
.ddp-ancard .id{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary)}
|
|
2171
|
+
.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}
|
|
2172
|
+
.ddp-ancard .tag.lost{background:rgba(229,72,77,.14);color:#e5484d}
|
|
2173
|
+
.ddp-ancard .ti{margin-top:4px;font-weight:600;color:var(--dsw-alias-label-primary);overflow-wrap:anywhere}
|
|
2174
|
+
.ddp-ancard .md{margin-top:2px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}
|
|
2175
|
+
.ddp-ancard .md p{margin:2px 0}
|
|
2176
|
+
.ddp-ancard .md ul{margin:2px 0;padding-left:16px}
|
|
2177
|
+
.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}
|
|
2178
|
+
.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}
|
|
2179
|
+
.ddp-ancard .ft.sm{margin-top:3px;padding-top:0;border-top:0}
|
|
2180
|
+
.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}
|
|
2181
|
+
.ddp-ancard:hover .send,.ddp-ancard:focus-within .send,.ddp-ancard.sel .send{display:block}
|
|
2182
|
+
.ddp-ancard .send:hover{color:var(--dsw-alias-label-primary)}
|
|
2183
|
+
.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}
|
|
2184
|
+
.ddp-anerr b{font-weight:600;color:#e5484d}
|
|
2185
|
+
.ddp-anerr p{margin:3px 0 0}
|
|
2186
|
+
.ddp-anp footer.row{align-items:center}
|
|
2187
|
+
.ddp-anp footer .lostn{flex:none;padding:0 4px;font-size:11px;color:var(--dsw-alias-label-tertiary);white-space:nowrap}
|
|
2048
2188
|
.ddp-ck{align-items:flex-start}
|
|
2049
2189
|
.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
2190
|
.ddp-ck .no.hi{background:#e5484d}
|
|
@@ -2559,6 +2699,9 @@ window.__ModuleLoader__.load({
|
|
|
2559
2699
|
.ddp-share .steps{margin:10px 6px 0;line-height:1.6}
|
|
2560
2700
|
.ddp-share .steps p{margin:0}
|
|
2561
2701
|
.ddp-share .steps ol{margin:4px 0 6px;padding-left:20px}
|
|
2702
|
+
.ddp-share .steps.gh1{display:flex;flex-direction:column;gap:6px}
|
|
2703
|
+
.ddp-share .steps .code b{font:600 20px/1.3 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;letter-spacing:2px;color:var(--dsw-alias-label-primary);user-select:all}
|
|
2704
|
+
.ddp-share .steps .lk{padding:0}
|
|
2562
2705
|
.ddp-share footer a.go{display:flex;flex:1;align-items:center;justify-content:center;height:30px;padding:0 10px;border-radius:8px;font:inherit;text-decoration:none}
|
|
2563
2706
|
.ddp-share footer a.go:hover{opacity:.88}
|
|
2564
2707
|
.ddp-pack .okbox{display:flex;flex-direction:column;align-items:flex-start;gap:6px;margin:10px 4px 0;padding:10px;border-radius:10px;background:color-mix(in srgb,#16a34a 11%,transparent);color:var(--dsw-alias-label-primary);line-height:1.5}
|
|
@@ -2579,6 +2722,10 @@ window.__ModuleLoader__.load({
|
|
|
2579
2722
|
/* 浮块窄了:先截屏名,到 440 再收按钮上的字,400 收工具坞里的演示(演示时横幅上能退出) */
|
|
2580
2723
|
@container (max-width:560px){.ddp-top>.tl .lab .lb{display:none}.ddp-top>.tl .ddp-btn.lab{padding:0 6px}}
|
|
2581
2724
|
@container (max-width:490px){.ddp-top .lab .lb,.ddp-top .pri .lb{display:none}.ddp-top .ddp-btn.lab{padding:0 6px}}
|
|
2725
|
+
@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}}
|
|
2726
|
+
@container (max-width:640px){.ddp-top.an3>.tl .lab .lb{display:none}.ddp-top.an3>.tl .ddp-btn.lab{padding:0 6px}}
|
|
2727
|
+
@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}}
|
|
2728
|
+
@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
2729
|
@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
2730
|
@container (max-width:380px){.ddp-tool{width:32px}.ddp-kind.ddp-where{min-width:64px}}
|
|
2584
2731
|
/* 标注底栏:右侧栏窄时「这支笔怎么用」折成两行,不被三个按钮挤成省略号 */
|
|
@@ -2664,6 +2811,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
2664
2811
|
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
2812
|
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
2813
|
check: () => svg([h('path', { key: 1, d: 'M5 12.5l4.5 4.5L19 7.5', strokeWidth: 2.4 })]),
|
|
2814
|
+
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
2815
|
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
2816
|
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
2817
|
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 +2856,32 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
2708
2856
|
function poller(sid) {
|
|
2709
2857
|
let p = pollers.get(sid)
|
|
2710
2858
|
if (p) return p
|
|
2711
|
-
p = { state: null, subs: new Set(), timer: null, refs: 0, inflight: false }
|
|
2859
|
+
p = { state: null, subs: new Set(), timer: null, refs: 0, inflight: false, gen: 0 }
|
|
2712
2860
|
const tick = async () => {
|
|
2713
2861
|
p.timer = null
|
|
2714
2862
|
if (!p.inflight) {
|
|
2715
2863
|
p.inflight = true
|
|
2864
|
+
const gen = p.gen
|
|
2716
2865
|
try {
|
|
2717
|
-
const
|
|
2718
|
-
|
|
2866
|
+
const anSig = p.state && p.state.annotations && p.state.annotations.sig // 业务标注没变就不用再传一遍
|
|
2867
|
+
const r = await fetch(`${API}state?session=${encodeURIComponent(sid)}${anSig ? `&an=${encodeURIComponent(anSig)}` : ''}`, { credentials: 'same-origin', cache: 'no-store' })
|
|
2868
|
+
if (r.ok) {
|
|
2869
|
+
const s = await r.json()
|
|
2870
|
+
// 等回包时别处已经换了状态(换屏、打开):这一份过期了,下一轮再取
|
|
2871
|
+
if (gen === p.gen) {
|
|
2872
|
+
const had = p.state && p.state.annotations
|
|
2873
|
+
const same = s.annotations && s.annotations.same
|
|
2874
|
+
if (same && had && had.sig === s.annotations.sig) s.annotations = had
|
|
2875
|
+
if (!same || s.annotations === had) p.apply(s)
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2719
2878
|
} catch { /* 下一轮再试 */ }
|
|
2720
2879
|
p.inflight = false
|
|
2721
2880
|
}
|
|
2722
2881
|
if (p.refs > 0) p.timer = setTimeout(tick, p.state && p.state.turn ? 700 : 1500)
|
|
2723
2882
|
}
|
|
2724
|
-
p.set = (s) => {
|
|
2883
|
+
p.set = (s) => { p.gen++; p.apply(s) }
|
|
2884
|
+
p.apply = (s) => {
|
|
2725
2885
|
if (JSON.stringify(s) === JSON.stringify(p.state)) return
|
|
2726
2886
|
strictBy.set(sid, new Set(s && Array.isArray(s.strict) ? s.strict : []))
|
|
2727
2887
|
p.state = s
|
|
@@ -3020,6 +3180,9 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
3020
3180
|
card: (v, t, s) => [['b', t('chipTweak')], ...s.split('\n').filter((l) => l.startsWith('- ')).slice(0, 5).map((l) => ['span', l.slice(2)])] },
|
|
3021
3181
|
{ i: 'style', label: (v, t) => t('chipTwMake'), alts: both('twMakeText'), card: (v, t) => [['b', t('chipTwMake')], ['span', 'tweaks.json']] },
|
|
3022
3182
|
{ i: 'style', label: (v, t) => t('chipTwFix'), alts: both('twFixText'), card: (v, t) => [['b', t('chipTwFix')], ['p', v.errs]] },
|
|
3183
|
+
{ i: 'note', label: (v, t) => t('chipAnMake'), alts: both('anMakeText'), card: (v, t) => [['b', t('chipAnMake')], ['span', 'annotations.json']] },
|
|
3184
|
+
{ i: 'note', label: (v, t) => t('chipAnFix'), alts: both('anFixText'), card: (v, t) => [['b', t('chipAnFix')], ['p', v.errs]] },
|
|
3185
|
+
{ 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
3186
|
{ i: 'look', label: (v, t) => t('chipSysEx'), alts: both('sysExtractText'), card: (v, t) => [['b', t('chipSysEx')], ['code', v.src]] },
|
|
3024
3187
|
{ i: 'look', label: (v, t) => t('chipSysAp'), alts: both('sysApplyText'), card: (v, t) => [['b', t('chipSysAp')], ['code', v.name], ['span', v.dir]] },
|
|
3025
3188
|
{ 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 +3733,11 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
3570
3733
|
const AUTO_SPREAD = ['minimal', 'editorial', 'playful', 'fresh', 'tech', 'glass', 'dark', 'sport']
|
|
3571
3734
|
// 「北欧风」「清新风:首页…」「中国风的界面」算说了风格;先去掉「通风」「台风」「新风系统」「风控」「风景」这类不是风格的词
|
|
3572
3735
|
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
|
|
3736
|
+
const SAID_STYLE = /风格|配色|色调|主色|色系|[红橙黄绿青蓝紫粉黑白灰棕金银米]色|蓝白|黑白|黑金|红白|绿白|深色|浅色|暗色|亮色|[^\s。,,、::;;((]风|\b(style|styled|aesthetic|vibe|palette|colou?r scheme|look and feel|dark|light)\b/i
|
|
3576
3737
|
function autoStyle(text, kind) {
|
|
3577
3738
|
const s = String(text || '')
|
|
3578
3739
|
if (!s.trim()) return null
|
|
3579
|
-
const said = s.replace(
|
|
3740
|
+
const said = s.replace(NOT_STYLE_FENG, ' ')
|
|
3580
3741
|
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
3742
|
const by = (id) => STYLES.find((x) => x.id === id) || null
|
|
3582
3743
|
for (const [id, re] of AUTO_STYLE) if (re.test(s)) return by(id)
|
|
@@ -3831,7 +3992,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
3831
3992
|
const n = list.reduce((m, x) => m + x.issues.length, 0)
|
|
3832
3993
|
const lines = [t(head, { n, s: list.length })]
|
|
3833
3994
|
for (const sc of list) {
|
|
3834
|
-
if (sc.error && head !== 'checkAsk') lines.push('', t('ckToolErr', { label: sc.label, msg: sc.error }))
|
|
3995
|
+
if (sc.error && head !== 'checkAsk') lines.push('', t('ckToolErr', { label: sc.label, msg: sc.error === 'layout' ? t('checkLayout') : sc.error }))
|
|
3835
3996
|
if (!sc.issues.length) continue
|
|
3836
3997
|
const sz = head === 'checkAsk' ? '' : sizeLine(t, sc.metrics)
|
|
3837
3998
|
lines.push('', t('ckScreen', { label: sc.label, where: whereOf(sc.url, st) }) + (sz ? ` · ${sz}` : ''))
|
|
@@ -4827,7 +4988,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
4827
4988
|
// 模型在做什么:按它调的工具说人话(写文件另算,见 busyPhase)
|
|
4828
4989
|
const TOOL_PHASE = [
|
|
4829
4990
|
[/^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'],
|
|
4991
|
+
[/^handoff_design$/, 'stCode'], [/^compare_design$/, 'stCompare'], [/^find_photos$/, 'stPhotos'], [/^pick_style$/, 'stStyle'], [/^ask_user_question$/, 'asking'],
|
|
4831
4992
|
[/^(bash|shell|sh|zsh|powershell|pwsh|exec|run_command|terminal)$/i, 'stShell'],
|
|
4832
4993
|
[/^skill$/i, 'stSkill'],
|
|
4833
4994
|
[/web|fetch|browse|http/i, 'stWeb'],
|
|
@@ -5171,7 +5332,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5171
5332
|
const rem = remOf(props)
|
|
5172
5333
|
const wins = useRef(new Map())
|
|
5173
5334
|
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 }
|
|
5335
|
+
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
5336
|
const curRef = useRef(0)
|
|
5176
5337
|
const P = useRef(props)
|
|
5177
5338
|
P.current = props
|
|
@@ -5208,6 +5369,10 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5208
5369
|
}),
|
|
5209
5370
|
checkFocus: (i) => { if (curRef.current) postTo(curRef.current, { type: 'checkFocus', i }) },
|
|
5210
5371
|
checkClear: () => { if (curRef.current) postTo(curRef.current, { type: 'checkClear' }) },
|
|
5372
|
+
annotFocus: (id) => { if (curRef.current) postTo(curRef.current, { type: 'annotFocus', id }) },
|
|
5373
|
+
annotPage: () => life.current.pageOf.get(curRef.current) || '', // 这一帧实际显示的屏(设计里的链接能带走)
|
|
5374
|
+
annotHome: (id) => { if (P.current.annotGo) P.current.annotGo.current = id; life.current.at = ''; load(null) }, // 走开了:重新载回这一屏,载好再定位
|
|
5375
|
+
annotHit: (x, y) => { if (curRef.current) postTo(curRef.current, { type: 'annotHit', x, y }) },
|
|
5211
5376
|
unpin: () => { if (curRef.current) postTo(curRef.current, { type: 'unpin' }) }, // 去掉「已选」虚线框
|
|
5212
5377
|
holdScroll: () => { if (curRef.current) postTo(curRef.current, { type: 'holdScroll' }) }, // 用户要在这个位置上画:闪改动别再滚回去
|
|
5213
5378
|
// 画笔标注:这一屏的页面(iframe)现在摆在哪,拼图时按它的位置放截图
|
|
@@ -5282,6 +5447,11 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5282
5447
|
}
|
|
5283
5448
|
|
|
5284
5449
|
// 一帧好了:淡入换上来
|
|
5450
|
+
/** 这一帧该标哪些(设计里的链接能把这一帧带到别的屏,按它实际显示的那屏取) */
|
|
5451
|
+
const annotsOf = (p, id) => {
|
|
5452
|
+
const k = life.current.pageOf.get(id)
|
|
5453
|
+
return p.annotsFor && k && k !== p.annotKey ? p.annotsFor(k) : p.annots
|
|
5454
|
+
}
|
|
5285
5455
|
const swap = (id, changes) => {
|
|
5286
5456
|
const L = life.current
|
|
5287
5457
|
if (L.loading === id) L.loading = 0
|
|
@@ -5298,11 +5468,14 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5298
5468
|
if (p.textEdit) postTo(id, { type: 'edit', on: true, hint: false })
|
|
5299
5469
|
if (p.styleEdit) styleTo(id, p)
|
|
5300
5470
|
if (L.tops.has(id) && p.onTop) p.onTop(L.tops.get(id))
|
|
5471
|
+
if (L.anStates.has(id) && p.onAnnotState) p.onAnnotState(L.anStates.get(id))
|
|
5301
5472
|
if (first && p.onShown) p.onShown()
|
|
5302
5473
|
if (first) { if (build && p.onBuilt) p.onBuilt(L.title || '') } else if (p.onNote) p.onNote({ changes, file: L.file, build })
|
|
5303
5474
|
L.file = ''
|
|
5304
5475
|
setTimeout(() => setFrames((fs) => fs.filter((f) => f.id >= curRef.current || f.id > id)), 450)
|
|
5305
5476
|
for (const k of [...L.tops.keys()]) if (k < id) L.tops.delete(k)
|
|
5477
|
+
for (const k of [...L.anStates.keys()]) if (k < id) L.anStates.delete(k)
|
|
5478
|
+
for (const k of [...L.pageOf.keys()]) if (k < id) L.pageOf.delete(k)
|
|
5306
5479
|
if (L.again) {
|
|
5307
5480
|
L.again = false
|
|
5308
5481
|
postTo(id, { type: 'snapshot' })
|
|
@@ -5353,6 +5526,15 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5353
5526
|
L.title = d.title || ''
|
|
5354
5527
|
if (p.dark) postTo(id, { type: 'theme', dark: true })
|
|
5355
5528
|
if (p.tweak) postTo(id, { type: 'tweak', vars: p.tweak.vars, attrs: p.tweak.attrs })
|
|
5529
|
+
try { if (d.href) L.pageOf.set(id, keyOfPath(decodeURIComponent(new URL(d.href).pathname), true)) } catch { /* 地址不认识:当没跳 */ }
|
|
5530
|
+
{
|
|
5531
|
+
const list = annotsOf(p, id)
|
|
5532
|
+
if (list) {
|
|
5533
|
+
postTo(id, { type: 'annots', list, sel: p.annotSel || '' })
|
|
5534
|
+
// 单页时点了别的屏的卡片:这一屏载好了再滚过去
|
|
5535
|
+
if (p.annotGo && list.some((x) => x.id === p.annotGo.current)) { postTo(id, { type: 'annotFocus', id: p.annotGo.current }); p.annotGo.current = '' }
|
|
5536
|
+
}
|
|
5537
|
+
}
|
|
5356
5538
|
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
5539
|
if (p.onHref && d.href) p.onHref(d.href)
|
|
5358
5540
|
if (isCur) {
|
|
@@ -5377,6 +5559,16 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5377
5559
|
case 'dropIn':
|
|
5378
5560
|
if (p.onPageDrag) p.onPageDrag(d)
|
|
5379
5561
|
break
|
|
5562
|
+
case 'annotPick':
|
|
5563
|
+
if (isCur && p.onAnnotPick) p.onAnnotPick(String(d.id || ''))
|
|
5564
|
+
break
|
|
5565
|
+
case 'annotState':
|
|
5566
|
+
// 每帧记着自己的;只有正显示的那帧算数(预载的换上来时再用,旧帧晚到的不管)
|
|
5567
|
+
if (Array.isArray(d.list)) {
|
|
5568
|
+
L.anStates.set(id, d.list)
|
|
5569
|
+
if (isCur && p.onAnnotState) p.onAnnotState(d.list)
|
|
5570
|
+
}
|
|
5571
|
+
break
|
|
5380
5572
|
case 'top':
|
|
5381
5573
|
// 每帧记着自己的;只有正显示的那帧算数(预载的换上来时再用,旧帧晚到的不管)
|
|
5382
5574
|
L.tops.set(id, !!d.dark)
|
|
@@ -5448,6 +5640,10 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
5448
5640
|
// 调节滑块:拖的时候改页面上的 CSS 变量 / <html> 属性(新载的一帧在 ready 时套上)
|
|
5449
5641
|
const twSig = JSON.stringify(props.tweak || null)
|
|
5450
5642
|
useEffect(() => { if (cur) postTo(cur, { type: 'tweak', vars: (props.tweak || {}).vars || {}, attrs: (props.tweak || {}).attrs || {} }) }, [twSig])
|
|
5643
|
+
// 业务标注:编号画在页面里(新载的一帧在 ready 时再发一次);点选、改字这些模式下 annots 是 null,编号收起
|
|
5644
|
+
const anSig = JSON.stringify(props.annots || null)
|
|
5645
|
+
useEffect(() => { if (cur) postTo(cur, { type: 'annots', list: annotsOf(props, cur) || [], sel: props.annotSel || '' }) }, [anSig, props.annotVer])
|
|
5646
|
+
useEffect(() => { if (cur && props.annots) postTo(cur, { type: 'annotSel', id: props.annotSel || '' }) }, [props.annotSel || ''])
|
|
5451
5647
|
useEffect(() => {
|
|
5452
5648
|
// 刚退出改字(点按钮、Esc、模型开始干活):页面会把正在改的那一处交上来,这一小会儿还收
|
|
5453
5649
|
if (editWas.current && !props.textEdit) editOffAt.current = Date.now()
|
|
@@ -6163,19 +6359,86 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
6163
6359
|
h('div', { className: 'bd' },
|
|
6164
6360
|
...list.filter((sc) => sc.issues.length || sc.error).map((sc) => h('div', { key: sc.key },
|
|
6165
6361
|
multi ? h('h4', null, sc.label) : null,
|
|
6166
|
-
sc.error ? h('div', { className: 'none' }, t('checkFail', { msg: sc.error })) : null,
|
|
6362
|
+
sc.error ? h('div', { className: 'none' }, sc.error === 'layout' ? t('checkLayout') : t('checkFail', { msg: sc.error })) : null,
|
|
6167
6363
|
...sc.issues.map((it, i) => h('button', { key: i, className: 'ddp-tok ddp-ck', title: it.sel || '', onClick: () => onFocus(sc.key, i) },
|
|
6168
6364
|
h('span', { className: 'no' + (it.sev > 1 ? ' hi' : '') }, String(i + 1)),
|
|
6169
6365
|
h('span', { className: 'tx' },
|
|
6170
6366
|
h('span', { className: 'nm' }, t('ck_' + it.type) + (it.text ? ` · ${it.text}` : '')),
|
|
6171
6367
|
h('span', { className: 'vl' }, checkDetail(t, it))))))),
|
|
6172
|
-
!ck.running && !n ? h('div', { className: 'ok' }, h(I.check), h('span', null, t('checkNone'))) : null),
|
|
6368
|
+
!ck.running && !n && !list.some((sc) => sc.error) ? h('div', { className: 'ok' }, h(I.check), h('span', null, t('checkNone'))) : null),
|
|
6173
6369
|
n ? h('p', { className: 'tip' }, t('checkNote')) : null,
|
|
6174
6370
|
h('footer', { className: 'row' },
|
|
6175
6371
|
h('button', { onClick: onAgain, disabled: ck.running }, h(I.refresh), h('span', null, t('checkAgain'))),
|
|
6176
6372
|
n ? h('button', { className: 'go', onClick: onFix, disabled: ck.running, title: t('checkFixTip') }, h(I.sparkle), h('span', null, t('checkFix'))) : null))
|
|
6177
6373
|
}
|
|
6178
6374
|
|
|
6375
|
+
/** 业务标注的正文:换行、**加粗**、`行内代码`、- 列表,别的原样显示(全走文字节点,不拼 HTML) */
|
|
6376
|
+
const anInline = (s) => String(s).split(/(\*\*[^*\n]+\*\*|`[^`\n]+`)/).map((x, i) => (
|
|
6377
|
+
/^\*\*[^*\n]+\*\*$/.test(x) ? h('b', { key: i }, x.slice(2, -2)) : /^`[^`\n]+`$/.test(x) ? h('code', { key: i }, x.slice(1, -1)) : x))
|
|
6378
|
+
function anBody(text) {
|
|
6379
|
+
const out = []
|
|
6380
|
+
let items = null
|
|
6381
|
+
String(text || '').split('\n').forEach((raw, i) => {
|
|
6382
|
+
const line = raw.trim()
|
|
6383
|
+
const m = /^[-*]\s+(.*)$/.exec(line)
|
|
6384
|
+
if (m) {
|
|
6385
|
+
if (!items) { items = []; out.push(h('ul', { key: i }, items)) }
|
|
6386
|
+
items.push(h('li', { key: i }, anInline(m[1])))
|
|
6387
|
+
return
|
|
6388
|
+
}
|
|
6389
|
+
items = null
|
|
6390
|
+
if (line) out.push(h('p', { key: i }, anInline(line)))
|
|
6391
|
+
})
|
|
6392
|
+
return out
|
|
6393
|
+
}
|
|
6394
|
+
|
|
6395
|
+
/** 业务标注面板:按屏分组,每条一张卡片;定位不到的排在这一屏最后 */
|
|
6396
|
+
function AnnotPanel({ t, file, screens, labelOfKey, states, sel, onFocus, onSend, onMake, onFix, onClose }) {
|
|
6397
|
+
const ref = useRef(null)
|
|
6398
|
+
useEffect(() => {
|
|
6399
|
+
if (!sel || !ref.current) return
|
|
6400
|
+
const el = [...ref.current.querySelectorAll('[data-an]')].find((x) => x.getAttribute('data-an') === sel)
|
|
6401
|
+
if (el) el.scrollIntoView({ block: 'nearest', behavior: 'smooth' })
|
|
6402
|
+
}, [sel])
|
|
6403
|
+
const list = (file && file.list) || []
|
|
6404
|
+
const errors = (file && file.errors) || []
|
|
6405
|
+
const blank = !list.length && !errors.length // 没有文件,或者文件里一条都没有
|
|
6406
|
+
const known = new Set(screens)
|
|
6407
|
+
const isLost = (a) => !known.has(a.page) || !!(states[a.id] && states[a.id].how === '')
|
|
6408
|
+
const lost = list.filter(isLost)
|
|
6409
|
+
const pages = [...screens.filter((k) => list.some((a) => a.page === k)), ...new Set(list.filter((a) => !known.has(a.page)).map((a) => a.page))]
|
|
6410
|
+
const card = (a) => {
|
|
6411
|
+
const gone = isLost(a)
|
|
6412
|
+
const whole = !a.selector && !a.fallbackText
|
|
6413
|
+
const typeName = a.type ? (['rule', 'state', 'logic', 'flow', 'metric', 'data'].includes(a.type) ? t('anT_' + a.type) : a.type) : ''
|
|
6414
|
+
const go = () => onFocus(a)
|
|
6415
|
+
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() } },
|
|
6416
|
+
h('div', { className: 'hd' },
|
|
6417
|
+
h('span', { className: 'no' }, String(a.n)),
|
|
6418
|
+
typeName ? h('span', { className: 'ty' }, typeName) : null,
|
|
6419
|
+
h('span', { className: 'id' }, a.id),
|
|
6420
|
+
a.status === 'open' ? h('span', { className: 'tag' }, t('anOpenTag')) : null,
|
|
6421
|
+
gone ? h('span', { className: 'tag lost' }, t('anLostTag')) : null),
|
|
6422
|
+
h('div', { className: 'ti' }, a.title),
|
|
6423
|
+
a.detail ? h('div', { className: 'md' }, anBody(a.detail)) : null,
|
|
6424
|
+
a.anchorLabel || a.selector || whole ? h('div', { className: 'ft' }, whole ? t('anWhole') : a.anchorLabel, a.selector ? h('code', null, a.selector) : null) : null,
|
|
6425
|
+
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,
|
|
6426
|
+
h('button', { className: 'send', title: t('anSendTip'), onClick: (e) => { e.stopPropagation(); onSend(a) } }, t('anSend')))
|
|
6427
|
+
}
|
|
6428
|
+
return h('div', { className: 'ddp-tokens ddp-check ddp-anp', ref, onPointerDown: (e) => e.stopPropagation() },
|
|
6429
|
+
h('header', null, h(I.note), h('b', null, t('an')), h('button', { className: 'ddp-btn', title: '×', onClick: onClose }, h(I.close))),
|
|
6430
|
+
list.length ? h('p', { className: 'tip' }, t('anUpdated', { n: list.length, time: hhmm(file.mtime) })) : null,
|
|
6431
|
+
blank ? h('div', { className: 'bd' }, h('div', { className: 'none' }, t('anEmpty'))) : null,
|
|
6432
|
+
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,
|
|
6433
|
+
list.length ? h('div', { className: 'bd' }, pages.map((k) => h('div', { key: k },
|
|
6434
|
+
h('h4', null, known.has(k) ? labelOfKey(k) : `${k} · ${t('anGone')}`),
|
|
6435
|
+
[...list.filter((a) => a.page === k && !isLost(a)), ...list.filter((a) => a.page === k && isLost(a))].map(card)))) : null,
|
|
6436
|
+
blank ? h('footer', { className: 'row' }, h('button', { className: 'go', onClick: onMake }, h(I.sparkle), h('span', null, t('anMake')))) : null,
|
|
6437
|
+
file && (errors.length || lost.length) ? h('footer', { className: 'row' },
|
|
6438
|
+
lost.length ? h('span', { className: 'lostn' }, t('anLost', { n: lost.length })) : null,
|
|
6439
|
+
h('button', { className: 'go', onClick: () => onFix(lost) }, h(I.sparkle), h('span', null, t('anFix')))) : null)
|
|
6440
|
+
}
|
|
6441
|
+
|
|
6179
6442
|
/**
|
|
6180
6443
|
* 调样式面板:选中的元素的字号、字重、颜色、背景、圆角、内边距、间距。
|
|
6181
6444
|
* 拖的时候页面上先看效果(还没写进文件);设计变量列成小块,点一个就用 var(--x)。
|
|
@@ -7397,34 +7660,132 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
7397
7660
|
const [agree, setAgree] = useState({})
|
|
7398
7661
|
const [res, setRes] = useState(null)
|
|
7399
7662
|
const [busy, setBusy] = useState(false)
|
|
7663
|
+
const packSeq = useRef(0) // 每次查、每次换作品都加一:晚到的回包对不上就不认(不然 B 的面板会拿到 A 的包去投)
|
|
7664
|
+
const edited = useRef({}) // 用户自己改过的栏:预填回来不覆盖
|
|
7400
7665
|
useEffect(() => {
|
|
7666
|
+
// 换了作品:上一套填的名字、介绍、授权和四个确认都不带过来,等这一套的预填
|
|
7667
|
+
packSeq.current++
|
|
7668
|
+
edited.current = {}
|
|
7669
|
+
setBusy(false)
|
|
7401
7670
|
setRes(null)
|
|
7402
7671
|
setInfo(null)
|
|
7672
|
+
setTitle('')
|
|
7673
|
+
setDesc('')
|
|
7674
|
+
setLic('CC0-1.0')
|
|
7675
|
+
setAgree({})
|
|
7403
7676
|
if (!root) return undefined
|
|
7404
7677
|
let on = true
|
|
7678
|
+
const my = packSeq.current
|
|
7405
7679
|
post('pack', { session: sid, dir: root, info: true, lang: L }).then((d) => {
|
|
7406
|
-
if (!on) return
|
|
7680
|
+
if (!on || packSeq.current !== my) return // 预填晚到、用户已经点了检查:不改正在查的表单
|
|
7407
7681
|
setInfo(d)
|
|
7408
|
-
setTitle(d.title && d.title !== baseName(root) ? d.title : brand || d.title || '')
|
|
7409
|
-
setDesc(d.description || '')
|
|
7410
|
-
setLic(d.license === 'CC-BY-4.0' ? 'CC-BY-4.0' : 'CC0-1.0')
|
|
7411
|
-
}, (e) => { if (on) setInfo({ error: e.message }) })
|
|
7682
|
+
if (!edited.current.title) setTitle(d.title && d.title !== baseName(root) ? d.title : brand || d.title || '')
|
|
7683
|
+
if (!edited.current.desc) setDesc(d.description || '')
|
|
7684
|
+
if (!edited.current.lic) setLic(d.license === 'CC-BY-4.0' ? 'CC-BY-4.0' : 'CC0-1.0')
|
|
7685
|
+
}, (e) => { if (on && packSeq.current === my) setInfo({ error: e.message }) })
|
|
7412
7686
|
return () => { on = false }
|
|
7413
7687
|
}, [root])
|
|
7414
|
-
|
|
7688
|
+
// 预填回来之前不能查(不然用的是没对上这一套的表单)
|
|
7689
|
+
const ready = !!root && !!info && !!title.trim() && !!desc.trim() && SHARE_AGREE.every(([k]) => agree[k])
|
|
7415
7690
|
const go = async () => {
|
|
7691
|
+
const my = ++packSeq.current
|
|
7416
7692
|
setBusy(true)
|
|
7417
7693
|
setRes(null)
|
|
7418
|
-
|
|
7694
|
+
setLost(false)
|
|
7695
|
+
let r
|
|
7696
|
+
try { r = await post('pack', { session: sid, dir: root, share: true, title: title.trim(), description: desc.trim(), license: lic, agree, lang: L }) } catch (e) { r = { error: e.message } }
|
|
7697
|
+
if (packSeq.current !== my) return
|
|
7698
|
+
setRes(r)
|
|
7699
|
+
setBusy(false)
|
|
7419
7700
|
}
|
|
7420
7701
|
const formUrl = (r) => {
|
|
7421
|
-
const q = new URLSearchParams({ template: 'submit-design.yml', title: `投稿 / Submission: ${r.share.title || title.trim()} · ${r.share.ref}`, license: FORM_LIC[lic] })
|
|
7702
|
+
const q = new URLSearchParams({ template: 'submit-design.yml', title: `投稿 / Submission: ${r.share.title || title.trim()} · ${r.share.ref}`, license: FORM_LIC[r.share.license] || FORM_LIC[lic] })
|
|
7422
7703
|
if (r.share.slug) q.set('slug', r.share.slug)
|
|
7423
7704
|
return `${GALLERY_REPO}/issues/new?${q}`
|
|
7424
7705
|
}
|
|
7425
7706
|
const aiN = (res && res.aiPhotos) || 0
|
|
7426
7707
|
const fixed = res && res.notes ? Object.entries(res.notes.reduce((m, n) => { m[n.code] = (m[n.code] || 0) + 1; return m }, {})).map(([k, n]) => t('pkNote_' + k, { n })).join(t('sep')) : ''
|
|
7427
7708
|
const done = res && res.ok && res.share
|
|
7709
|
+
// 一键投稿:连 GitHub(设备授权,输个码)→ 插件替你放 zip、开投稿 issue;不想连的走网页表单
|
|
7710
|
+
const [gh, setGh] = useState(null)
|
|
7711
|
+
const [ghBusy, setGhBusy] = useState(false)
|
|
7712
|
+
const [sub, setSub] = useState(null) // { busy } / { url } / { error, msg }
|
|
7713
|
+
const [manual, setManual] = useState(false)
|
|
7714
|
+
const [lost, setLost] = useState(false) // 打好的包找不到了(插件重启过、zip 被删了):回到表单重新查
|
|
7715
|
+
const resNow = useRef(res) // 投稿回来时核对:还是投的那个包(中间换了作品、重新查过就不认这次的回包)
|
|
7716
|
+
resNow.current = res
|
|
7717
|
+
useEffect(() => { setSub(null); setManual(false) }, [res])
|
|
7718
|
+
const ghSeq = useRef(0) // 连、取消、断开、投稿发现授权失效都加一:之前发出去还没回来的查状态作废(不然断开后又显示连着)
|
|
7719
|
+
useEffect(() => {
|
|
7720
|
+
if (!done) return undefined
|
|
7721
|
+
let on = true
|
|
7722
|
+
const my = ghSeq.current
|
|
7723
|
+
getJson('ghauth').then((s) => { if (on && ghSeq.current === my) setGh(s) }, () => { if (on && ghSeq.current === my) setGh({ ready: false }) })
|
|
7724
|
+
return () => { on = false }
|
|
7725
|
+
}, [done])
|
|
7726
|
+
const waiting = !!(gh && gh.flow && !gh.flow.error && !gh.login)
|
|
7727
|
+
useEffect(() => {
|
|
7728
|
+
if (!waiting) return undefined
|
|
7729
|
+
let on = true
|
|
7730
|
+
const id = setInterval(() => {
|
|
7731
|
+
const my = ghSeq.current
|
|
7732
|
+
getJson('ghauth').then((s) => { if (on && ghSeq.current === my) setGh(s) }, () => {})
|
|
7733
|
+
}, 2500)
|
|
7734
|
+
return () => { on = false; clearInterval(id) }
|
|
7735
|
+
}, [waiting])
|
|
7736
|
+
const ghOp = async (op) => {
|
|
7737
|
+
const my = ++ghSeq.current
|
|
7738
|
+
setGhBusy(true)
|
|
7739
|
+
try {
|
|
7740
|
+
const s = await post('ghauth', { op })
|
|
7741
|
+
if (ghSeq.current === my) setGh(s)
|
|
7742
|
+
} catch (e) {
|
|
7743
|
+
if (ghSeq.current === my) setGh((g) => ({ ...(g || {}), ready: true, login: '', flow: { error: e.message } }))
|
|
7744
|
+
} finally { setGhBusy(false) }
|
|
7745
|
+
}
|
|
7746
|
+
const submit = async () => {
|
|
7747
|
+
const mine = res
|
|
7748
|
+
const still = () => resNow.current === mine
|
|
7749
|
+
setSub({ busy: true })
|
|
7750
|
+
try {
|
|
7751
|
+
const r = await fetch(API + 'submit', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ path: mine.path, login: (gh && gh.login) || '' }) })
|
|
7752
|
+
const d = await r.json().catch(() => ({}))
|
|
7753
|
+
if (!still()) return
|
|
7754
|
+
if (r.ok && d.url) setSub({ url: d.url })
|
|
7755
|
+
else if (d.error === 'notShared') { setLost(true); setRes(null) }
|
|
7756
|
+
else {
|
|
7757
|
+
setSub({ error: d.error || 'net', msg: d.msg || '' })
|
|
7758
|
+
if (d.error === 'auth') { ghSeq.current++; setGh((g) => ({ ...(g || {}), login: '', flow: null })) }
|
|
7759
|
+
// 别的窗口换了账号:面板换成现在连着的那个,用户看清楚再点
|
|
7760
|
+
if (d.error === 'who') { ghSeq.current++; setGh((g) => ({ ...(g || {}), login: d.msg || '', flow: null })) }
|
|
7761
|
+
}
|
|
7762
|
+
} catch { if (still()) setSub({ error: 'net' }) }
|
|
7763
|
+
}
|
|
7764
|
+
const ghErr = (code) => t(['denied', 'expired', 'net', 'noApp'].includes(code) ? 'shGhErr_' + code : 'shGhErr_device')
|
|
7765
|
+
const subErr = (s) => t(['auth', 'net', 'big', 'notShared', 'busy', 'who'].includes(s.error) ? 'shSubErr_' + s.error : 'shSubErr_api', { msg: s.msg || s.error })
|
|
7766
|
+
const canOne = !!(gh && gh.ready)
|
|
7767
|
+
const steps = h('div', { className: 'steps' },
|
|
7768
|
+
h('p', null, t('shSteps')),
|
|
7769
|
+
h('ol', null, h('li', null, t('shStep1')), h('li', null, t('shStep2')), h('li', null, t('shStep3'))),
|
|
7770
|
+
h('a', { className: 'lk', href: done ? formUrl(res) : '#', target: '_blank', rel: 'noopener noreferrer' }, t('shOpen')))
|
|
7771
|
+
const oneClick = !done || !canOne ? null : sub && sub.url
|
|
7772
|
+
? h('div', { className: 'okbox' }, h('div', null, h(I.check), h('span', null, t('shSubmitted'))), h('a', { className: 'lk', href: sub.url, target: '_blank', rel: 'noopener noreferrer' }, t('shSubmittedLink')))
|
|
7773
|
+
: h('div', { className: 'steps gh1' },
|
|
7774
|
+
gh.login
|
|
7775
|
+
? h('p', null, t('shGhAs', { login: gh.login }), ' ', h('button', { className: 'lk', disabled: !!(sub && sub.busy), onClick: () => ghOp('logout') }, t('shGhLogout')))
|
|
7776
|
+
: waiting
|
|
7777
|
+
? [
|
|
7778
|
+
h('p', { key: 'c' }, t('shGhCode')),
|
|
7779
|
+
h('p', { key: 'v', className: 'code' }, h('b', null, gh.flow.code), ' ', h('button', { className: 'lk', onClick: () => { try { navigator.clipboard.writeText(gh.flow.code).catch(() => {}) } catch { /* 能选中自己复制 */ } } }, t('shGhCopy'))),
|
|
7780
|
+
h('p', { key: 'o' }, h('a', { className: 'lk', href: gh.flow.uri, target: '_blank', rel: 'noopener noreferrer' }, t('shGhOpen')), ' · ', h('button', { className: 'lk', onClick: () => ghOp('cancel') }, t('shGhCancel'))),
|
|
7781
|
+
h('p', { key: 'w', className: 'note' }, t('shGhWaiting')),
|
|
7782
|
+
]
|
|
7783
|
+
: [
|
|
7784
|
+
h('p', { key: 'y' }, t('shGhWhy')),
|
|
7785
|
+
gh.flow && gh.flow.error ? h('p', { key: 'e', className: 'note' }, ghErr(gh.flow.error)) : null,
|
|
7786
|
+
],
|
|
7787
|
+
sub && sub.busy ? h('p', { className: 'note' }, t('shSubmitting')) : null,
|
|
7788
|
+
sub && sub.error ? h('p', { className: 'note' }, subErr(sub)) : null)
|
|
7428
7789
|
return h('div', { className: 'ddp-tokens ddp-pack ddp-share', onPointerDown: (e) => e.stopPropagation() },
|
|
7429
7790
|
h('header', null, h(I.share), h('b', null, t('shTitle')), h('button', { className: 'ddp-btn', title: '×', onClick: onClose }, h(I.close))),
|
|
7430
7791
|
h('p', { className: 'tip gh' }, h(I.info), h('span', null, t('shGh'))),
|
|
@@ -7434,25 +7795,27 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
7434
7795
|
info && info.error ? h('div', { className: 'none' }, info.error === 'noScreens' ? t('pkNoDesign') : t('libFail', { msg: info.error })) : null,
|
|
7435
7796
|
done ? null : [
|
|
7436
7797
|
h('h4', { key: 'n' }, t('shName')),
|
|
7437
|
-
h('input', { key: 'ni', className: 'who', value: title, maxLength: 24, 'aria-label': t('shName'), onChange: (e) => setTitle(e.target.value) }),
|
|
7798
|
+
h('input', { key: 'ni', className: 'who', value: title, maxLength: 24, disabled: busy, 'aria-label': t('shName'), onChange: (e) => { edited.current.title = true; setTitle(e.target.value) } }),
|
|
7438
7799
|
h('h4', { key: 'd' }, t('shDesc')),
|
|
7439
|
-
h('input', { key: 'di', className: 'who', value: desc, maxLength: 120, placeholder: t('shDescPh'), 'aria-label': t('shDesc'), onChange: (e) => setDesc(e.target.value) }),
|
|
7800
|
+
h('input', { key: 'di', className: 'who', value: desc, maxLength: 120, disabled: busy, placeholder: t('shDescPh'), 'aria-label': t('shDesc'), onChange: (e) => { edited.current.desc = true; setDesc(e.target.value) } }),
|
|
7440
7801
|
h('h4', { key: 'l' }, t('pkLicense')),
|
|
7441
7802
|
h('div', { key: 'li', className: 'lic' }, ...[['CC0-1.0', 'pkCC0'], ['CC-BY-4.0', 'pkBY']].map(([k, label]) => h('label', { key: k, className: lic === k ? 'on' : '' },
|
|
7442
|
-
h('input', { type: 'radio', name: 'ddp-shlic', checked: lic === k, onChange: () => setLic(k) }), h('span', null, t(label))))),
|
|
7803
|
+
h('input', { type: 'radio', name: 'ddp-shlic', checked: lic === k, disabled: busy, onChange: () => { edited.current.lic = true; setLic(k) } }), h('span', null, t(label))))),
|
|
7443
7804
|
lic === 'CC-BY-4.0' ? h('p', { key: 'by', className: 'note' }, t('shBYNote')) : null,
|
|
7444
7805
|
h('div', { key: 'ag', className: 'agree' }, ...SHARE_AGREE.map(([k, label]) => h('label', { key: k },
|
|
7445
|
-
h('input', { type: 'checkbox', checked: !!agree[k], onChange: (e) => setAgree((a) => ({ ...a, [k]: e.target.checked })) }), h('span', null, t(label))))),
|
|
7806
|
+
h('input', { type: 'checkbox', checked: !!agree[k], disabled: busy, onChange: (e) => setAgree((a) => ({ ...a, [k]: e.target.checked })) }), h('span', null, t(label))))),
|
|
7446
7807
|
],
|
|
7447
7808
|
busy ? h('div', { className: 'none' }, t('shChecking')) : null,
|
|
7809
|
+
lost && !res && !busy ? h('p', { className: 'note' }, t('shSubErr_notShared')) : null,
|
|
7448
7810
|
res && res.error ? h('div', { className: 'none' }, res.error === 'noScreens' ? t('pkNoDesign') : t('libFail', { msg: res.error })) : null,
|
|
7449
7811
|
done ? h('div', { className: 'okbox' },
|
|
7450
7812
|
h('div', null, h(I.check), h('span', null, t('shOk', { name: baseName(res.path) }))),
|
|
7451
7813
|
h('button', { className: 'lk', onClick: () => post('reveal', { path: res.path }).catch(() => {}) }, t('pkReveal'))) : null,
|
|
7452
|
-
done ? h('
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7814
|
+
done && res.share.license ? h('p', { className: 'note' }, h('b', null, t('pkLicense')), ' ', t(res.share.license === 'CC-BY-4.0' ? 'pkBY' : 'pkCC0')) : null,
|
|
7815
|
+
oneClick,
|
|
7816
|
+
done && (!canOne || manual) && !(sub && sub.url) ? steps : null,
|
|
7817
|
+
done && canOne && !manual && !(sub && sub.url) ? h('button', { className: 'lk', onClick: () => setManual(true) }, t('shManual')) : null,
|
|
7818
|
+
done ? h('p', { className: 'note' }, t('shAfter', { ref: res.share.ref })) : null,
|
|
7456
7819
|
res && res.ok === false ? h('div', { className: 'errs' },
|
|
7457
7820
|
h('p', null, t('pkFail', { n: res.errors.length + (res.more || 0) })),
|
|
7458
7821
|
h('ol', null, ...res.errors.slice(0, 30).map((e, i) => h('li', { key: i }, e.msg))),
|
|
@@ -7463,9 +7826,14 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
7463
7826
|
res.flags.length > 8 || res.flagsMore ? h('p', null, t('pkMore', { n: res.flags.length - 8 + (res.flagsMore || 0) })) : null) : null),
|
|
7464
7827
|
h('footer', { className: 'row' },
|
|
7465
7828
|
res && res.ok === false ? h('button', { onClick: () => onFix(res.errors) }, h('span', null, t('pkFix'))) : null,
|
|
7466
|
-
done
|
|
7467
|
-
? h('
|
|
7468
|
-
:
|
|
7829
|
+
!done
|
|
7830
|
+
? h('button', { className: 'go', disabled: busy || !ready, onClick: go }, h('span', null, t(res && res.ok === false ? 'shAgain' : 'shGo')))
|
|
7831
|
+
: !gh ? null
|
|
7832
|
+
: !canOne ? h('a', { className: 'go', href: formUrl(res), target: '_blank', rel: 'noopener noreferrer' }, h('span', null, t('shOpen')))
|
|
7833
|
+
: sub && sub.url ? null
|
|
7834
|
+
: gh.login ? h('button', { className: 'go', disabled: !!(sub && sub.busy), onClick: submit }, h('span', null, t(sub && sub.busy ? 'shSubmittingShort' : 'shSubmit')))
|
|
7835
|
+
: waiting ? null
|
|
7836
|
+
: h('button', { className: 'go', disabled: ghBusy, onClick: () => ghOp('start') }, h('span', null, t('shGhConnect')))))
|
|
7469
7837
|
}
|
|
7470
7838
|
|
|
7471
7839
|
/** 拖进来的设计包没过检查:说清哪几条 */
|
|
@@ -7772,12 +8140,13 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
7772
8140
|
}
|
|
7773
8141
|
setCam({ ...d.cam, x: d.cam.x + dx, y: d.cam.y + dy })
|
|
7774
8142
|
}
|
|
7775
|
-
const up = () => {
|
|
8143
|
+
const up = (ev) => {
|
|
7776
8144
|
window.removeEventListener('pointermove', move)
|
|
7777
8145
|
window.removeEventListener('pointerup', up)
|
|
7778
8146
|
setDrag(false)
|
|
7779
8147
|
if (d.moved) return
|
|
7780
8148
|
if (props.onSelect) props.onSelect(d.key)
|
|
8149
|
+
if (props.onHit && d.key) props.onHit(d.key, ev.clientX, ev.clientY) // 挡板盖着页面:点的是不是业务标注的编号,让页面自己判断
|
|
7781
8150
|
const now = Date.now()
|
|
7782
8151
|
if (d.key && props.onOpen && lastTap.current.key === d.key && now - lastTap.current.at < 380) props.onOpen(d.key)
|
|
7783
8152
|
lastTap.current = { key: d.key, at: now }
|
|
@@ -7902,7 +8271,13 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
7902
8271
|
const [dark, setDark] = useState(false)
|
|
7903
8272
|
const [phone, setPhone] = useState(false) // 手机上看的面板
|
|
7904
8273
|
const [multi, setMulti] = useState(false) // 多尺寸并排
|
|
8274
|
+
const ckGen = useRef(0) // 每量一次、每关一次面板 +1:量完发现不是最新的一次就不算数
|
|
8275
|
+
const ckOpen = useRef(false) // 面板开着(或正在量):过期的一次结果回来时别清掉新一轮的标记
|
|
7905
8276
|
const [ck, setCk] = useState(null) // 设计体检:null = 面板关着;{ running, list: [{ key, label, url, issues, error }] }
|
|
8277
|
+
const [an, setAn] = useState(false) // 业务标注:面板开着(页面上同时出编号)
|
|
8278
|
+
const [anSel, setAnSel] = useState('') // 选中的那条(id)
|
|
8279
|
+
const [anStates, setAnStates] = useState({}) // id → { how, count }:页面里定位的结果
|
|
8280
|
+
const anGo = useRef('') // 单页时点了别的屏的卡片:那一屏载好后滚到这条
|
|
7906
8281
|
const [ckCount, setCkCount] = useState(0) // 最近一次体检(模型干完活会悄悄查一次)有几个问题:面板关着时标在按钮上
|
|
7907
8282
|
const [reveal, setReveal] = useState(null) // 画布上要露出来的那一屏 { key, n }(体检里点了一条)
|
|
7908
8283
|
const [demo, setDemo] = useState(null) // 演示:{ stack: [屏…], layers: [{ id, key, dir, shown }] }
|
|
@@ -8114,6 +8489,20 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8114
8489
|
useEffect(() => { twGen.current++; setTw({}); setTv({}) }, [site])
|
|
8115
8490
|
// 拖的滑块 + 外观面板里直接改的颜色:一起发给页面先看效果
|
|
8116
8491
|
const tweak = Object.keys(tw).length || Object.keys(tv).length ? (() => { const m = tweakMsg(tlist, tw); return { vars: { ...m.vars, ...tv }, attrs: m.attrs } })() : null
|
|
8492
|
+
// 业务标注:开关开着才有 st.annotations 这个键(null = 还没有文件)
|
|
8493
|
+
const anOn = !!st && Object.prototype.hasOwnProperty.call(st, 'annotations')
|
|
8494
|
+
const anFile = anOn ? st.annotations : null
|
|
8495
|
+
const anCount = anFile ? anFile.list.length : 0
|
|
8496
|
+
const anUp = an && anOn && !styleEdit && !mark // 面板在右边显示着(调样式、画笔占着那个位置时让开)
|
|
8497
|
+
const anShowsMarks = anUp && !picking && !textEdit // 页面上出编号
|
|
8498
|
+
const anByPage = useMemo(() => {
|
|
8499
|
+
const out = new Map()
|
|
8500
|
+
for (const a of (anFile && anFile.list) || []) {
|
|
8501
|
+
if (!out.has(a.page)) out.set(a.page, [])
|
|
8502
|
+
out.get(a.page).push({ id: a.id, n: a.n, selector: a.selector, fallbackText: a.fallbackText })
|
|
8503
|
+
}
|
|
8504
|
+
return out
|
|
8505
|
+
}, [anFile ? anFile.sig : ''])
|
|
8117
8506
|
|
|
8118
8507
|
// 看旧版本:画布上换成那一版的几屏(按现在的顺序,那一版独有的接在后面)
|
|
8119
8508
|
const vbase = ver ? `${origin}/__dsh_design__/v/${ver.n}/` : ''
|
|
@@ -8261,7 +8650,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8261
8650
|
return () => ro.disconnect()
|
|
8262
8651
|
}, [!!url])
|
|
8263
8652
|
|
|
8264
|
-
useEffect(() => { setPicking(false); setTextEdit(false); setStyleEdit(false); setSel(''); setVer(null); setCmp(false) }, [site])
|
|
8653
|
+
useEffect(() => { setPicking(false); setTextEdit(false); setStyleEdit(false); setSel(''); setVer(null); setCmp(false); setAn(false); setAnSel(''); setAnStates({}) }, [site])
|
|
8265
8654
|
|
|
8266
8655
|
// 版本列表:面板开着时拉一次,存了新版本(vrev 变了)再拉
|
|
8267
8656
|
const vrev = st ? st.vrev : 0
|
|
@@ -8506,6 +8895,14 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8506
8895
|
styleSel: sty && sty.key === sc.key ? sty.selector : '',
|
|
8507
8896
|
styleCss: sty && sty.key === sc.key ? sty.live : null,
|
|
8508
8897
|
tweak: sc.v ? null : tweak,
|
|
8898
|
+
annots: sc.v || !anShowsMarks ? null : anByPage.get(sc.key) || null,
|
|
8899
|
+
annotKey: sc.key,
|
|
8900
|
+
annotsFor: sc.v || !anShowsMarks ? null : (k) => anByPage.get(k) || [],
|
|
8901
|
+
annotVer: anShowsMarks && anFile ? anFile.sig : '',
|
|
8902
|
+
annotSel: anSel,
|
|
8903
|
+
annotGo: anGo,
|
|
8904
|
+
onAnnotPick: (id) => { setAnSel(id); if (canvas) setSel(sc.key) },
|
|
8905
|
+
onAnnotState: (list) => setAnStates((m) => ({ ...m, ...Object.fromEntries(list.map((x) => [x.id, x])) })),
|
|
8509
8906
|
onStylePick: (p) => onStylePick(sc, p),
|
|
8510
8907
|
onStyleCancel: () => setStyleEdit(false),
|
|
8511
8908
|
dark,
|
|
@@ -8789,6 +9186,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8789
9186
|
|
|
8790
9187
|
// ── 设计体检:画布上量所有屏,单页量这一屏;问题标在页面上,列在面板里 ──
|
|
8791
9188
|
const closeCheck = () => {
|
|
9189
|
+
ckGen.current++
|
|
9190
|
+
ckOpen.current = false
|
|
8792
9191
|
if (ck) for (const sc of ck.list || []) { const a = apis.current.get(ik(sc)); if (a) a.checkClear() }
|
|
8793
9192
|
setCk(null)
|
|
8794
9193
|
}
|
|
@@ -8806,9 +9205,15 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8806
9205
|
}))
|
|
8807
9206
|
const total = (list) => list.reduce((m, x) => m + x.issues.length, 0)
|
|
8808
9207
|
const runCheck = async () => {
|
|
8809
|
-
setPanel(false); setHist(false); setPhone(false)
|
|
9208
|
+
setPanel(false); setHist(false); setPhone(false); setAn(false)
|
|
8810
9209
|
setCk({ running: true, list: [] })
|
|
9210
|
+
const g = ++ckGen.current
|
|
9211
|
+
ckOpen.current = true
|
|
8811
9212
|
const out = await measure(checkList(), false)
|
|
9213
|
+
if (g !== ckGen.current) { // 量的时候面板关了 / 又量了一轮:这份结果作废;面板关着的话,这一轮画上的标记也清掉
|
|
9214
|
+
if (!ckOpen.current) for (const sc of out) { const a = apis.current.get(ik(sc)); if (a) a.checkClear() }
|
|
9215
|
+
return out
|
|
9216
|
+
}
|
|
8812
9217
|
if (canvas && shown.length > LIVE_MAX) say(t('checkPartial', { n: out.length }))
|
|
8813
9218
|
setCk({ running: false, list: out })
|
|
8814
9219
|
setCkCount(total(out))
|
|
@@ -8872,6 +9277,39 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
8872
9277
|
closeCheck()
|
|
8873
9278
|
}
|
|
8874
9279
|
const checkOff = !url || !!ver || !!demo || inMulti
|
|
9280
|
+
|
|
9281
|
+
// ── 业务标注(插件页的试验开关开着才有 st.annotations 这个键):面板和体检、版本共用右边那个位置;点选、改字、调样式、画笔时编号收起,退出后回来 ──
|
|
9282
|
+
useEffect(() => { setAnStates({}) }, [anFile ? anFile.sig : '']) // 文件变了(模型改过选择器):别的屏的旧结果作废,等页面重新报
|
|
9283
|
+
const toggleAn = () => {
|
|
9284
|
+
if (an) { setAn(false); setAnSel(''); return }
|
|
9285
|
+
setPanel(false); setHist(false); setPhone(false); setPane(''); closeCheck(); setStyleEdit(false); setMark(false)
|
|
9286
|
+
setAn(true)
|
|
9287
|
+
}
|
|
9288
|
+
const focusAn = (a) => {
|
|
9289
|
+
setAnSel(a.id)
|
|
9290
|
+
const sc = shown.find((x) => x.key === a.page)
|
|
9291
|
+
if (!sc) return
|
|
9292
|
+
if (!canvas && a.page !== focus) { anGo.current = a.id; pickScreen(a.page); return }
|
|
9293
|
+
if (canvas) { setSel(a.page); setReveal((r) => ({ key: a.page, n: ((r && r.n) || 0) + 1 })) }
|
|
9294
|
+
apiOf(sc).then((api) => {
|
|
9295
|
+
const at = api.annotPage()
|
|
9296
|
+
if (at && at !== a.page) api.annotHome(a.id)
|
|
9297
|
+
else api.annotFocus(a.id)
|
|
9298
|
+
}).catch((e) => console.warn('[dsh-design-studio] 定位标注失败', a.id, e))
|
|
9299
|
+
}
|
|
9300
|
+
const fixAn = (lost) => {
|
|
9301
|
+
const bad = [...((anFile && anFile.errors) || []), ...lost.map((a) => `${a.id}(${a.page})${t('anLostTag')}`)].map((x) => String(x).replace(/\s*\n\s*/g, ' '))
|
|
9302
|
+
insert(t('anFixText', { errs: bad.slice(0, 12).join(';') + (bad.length > 12 ? ';' + t('anMore', { n: bad.length - 12 }) : '') }), 'insertedSend')
|
|
9303
|
+
}
|
|
9304
|
+
const hitAn = (key, x, y) => {
|
|
9305
|
+
const sc = shown.find((s) => s.key === key)
|
|
9306
|
+
const api = sc && apis.current.get(ik(sc))
|
|
9307
|
+
const f = api && typeof api.frame === 'function' ? api.frame() : null
|
|
9308
|
+
if (!f) return
|
|
9309
|
+
const r = f.getBoundingClientRect()
|
|
9310
|
+
const k = Math.max(1, f.offsetWidth) / Math.max(1, r.width)
|
|
9311
|
+
api.annotHit((x - r.left) * k, (y - r.top) * k)
|
|
9312
|
+
}
|
|
8875
9313
|
const styleOff = !url || !!ver || !!demo || inMulti || busy
|
|
8876
9314
|
|
|
8877
9315
|
// ── 画笔标注:画完把台面上看得到的几屏各截一张,按位置摆好,叠上画的东西,存进 refs/,路径放进输入框让模型用 read_image 看(不动剪贴板) ──
|
|
@@ -9086,16 +9524,17 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9086
9524
|
hiddenSaid.current = sig
|
|
9087
9525
|
}, [hiddenN, targetKey])
|
|
9088
9526
|
useEffect(() => { if (checkOff && ck) closeCheck() }, [checkOff])
|
|
9527
|
+
useEffect(() => { if (checkOff) { setAn(false); setAnSel('') } }, [checkOff])
|
|
9089
9528
|
|
|
9090
9529
|
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) }
|
|
9530
|
+
const openLook = (tab) => { if (tab) setLookTab(tab); setPanel(true); setHist(false); setPhone(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
9531
|
+
const toggleHist = () => { setHist(!hist); setPanel(false); setPhone(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
9093
9532
|
// 右边同一时间只开一个面板:别的开了,这几个关掉;开这几个时别的关掉
|
|
9094
9533
|
const oldOpen = !!(panel || hist || phone || ck || styleEdit)
|
|
9095
9534
|
useEffect(() => { if (oldOpen) setPane('') }, [oldOpen])
|
|
9096
9535
|
const openPane = (p) => {
|
|
9097
9536
|
const next = pane === p ? '' : p
|
|
9098
|
-
if (next) { setPanel(false); setHist(false); setPhone(false); closeCheck(); setStyleEdit(false) }
|
|
9537
|
+
if (next) { setPanel(false); setHist(false); setPhone(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
9099
9538
|
setPane(next)
|
|
9100
9539
|
}
|
|
9101
9540
|
const setTweak = (k, v) => setTw((c) => {
|
|
@@ -9137,7 +9576,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9137
9576
|
}), 'insertedSend')
|
|
9138
9577
|
setPane('')
|
|
9139
9578
|
}
|
|
9140
|
-
const togglePhone = () => { setPhone(!phone); setPanel(false); setHist(false); closeCheck(); setStyleEdit(false) }
|
|
9579
|
+
const togglePhone = () => { setPhone(!phone); setPanel(false); setHist(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
9141
9580
|
const reload = () => setReloadSeq((x) => x + 1)
|
|
9142
9581
|
|
|
9143
9582
|
// 浮在画布上的几块,各管一件事,按钮都带字:左上 设计库 | 屏名 ▾(换屏、多尺寸、类型都在这个菜单里);
|
|
@@ -9175,11 +9614,11 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9175
9614
|
const dockTight = box.w > 0 && box.w <= 400 // 侧栏很窄:底部工具坞只放得下四个,「试用」进「更多」
|
|
9176
9615
|
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
9616
|
const islands = editing
|
|
9178
|
-
? [h('div', { key: 'top', className: 'ddp-top' },
|
|
9617
|
+
? [h('div', { key: 'top', className: 'ddp-top' + (anOn ? ' an3' : '') },
|
|
9179
9618
|
h('div', { className: 'ddp-isl tl wide' },
|
|
9180
9619
|
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
9620
|
: [
|
|
9182
|
-
h('div', { key: 'top', className: 'ddp-top' },
|
|
9621
|
+
h('div', { key: 'top', className: 'ddp-top' + (anOn ? ' an3' : '') },
|
|
9183
9622
|
h('div', { className: 'ddp-isl tl' },
|
|
9184
9623
|
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
9624
|
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 +9631,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9192
9631
|
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
9632
|
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
9633
|
h(I.stetho), h('span', { className: 'lb' }, t('checkShort')), ckCount && !ck && !checkOff ? h('span', { className: 'bdg' }, ckCount > 99 ? '99+' : String(ckCount)) : null),
|
|
9634
|
+
anOn ? h('button', { className: 'ddp-btn lab' + (anUp ? ' sel' : ''), ...tipA(t('an'), anCount && !anUp ? t('dAnN', { n: anCount }) : t('dAn')), disabled: checkOff, onClick: toggleAn },
|
|
9635
|
+
h(I.note), h('span', { className: 'lb' }, t('an')), anCount && !anUp && !checkOff ? h('span', { className: 'bdg' }, anCount > 99 ? '99+' : String(anCount)) : null) : null,
|
|
9195
9636
|
h('span', { className: 'ddp-sep' }),
|
|
9196
9637
|
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
9638
|
'hd:' + t('deliverCode'),
|
|
@@ -9686,21 +10127,22 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9686
10127
|
sel: sel || focus,
|
|
9687
10128
|
labelOf: shortOf,
|
|
9688
10129
|
reveal,
|
|
9689
|
-
inset: ck || styleEdit || panel || pane || hist || phone ? 296 : 0, // 右边的面板 276 宽,离边 10
|
|
10130
|
+
inset: anUp || ck || styleEdit || panel || pane || hist || phone ? 296 : 0, // 右边的面板 276 宽,离边 10
|
|
9690
10131
|
render: (sc, z) => renderScreen(sc, z, false),
|
|
9691
10132
|
sleep: sleepScreen,
|
|
9692
10133
|
flows,
|
|
9693
10134
|
onSelect: setSel,
|
|
10135
|
+
onHit: anUp && anShowsMarks ? hitAn : null,
|
|
9694
10136
|
onOpen: (key) => openByUser(key),
|
|
9695
10137
|
})
|
|
9696
10138
|
} else {
|
|
9697
10139
|
const fill = kind === 'web'
|
|
9698
10140
|
const [dw, dh] = deviceBox(kind, size)
|
|
9699
10141
|
// 右边开着面板(体检、调样式、设计规范、换风格):手机这类有外框的让到面板左边(侧栏够宽时),别被挡住
|
|
9700
|
-
const sideOn = !!(ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240
|
|
10142
|
+
const sideOn = !!(anUp || ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240
|
|
9701
10143
|
const aside = !fill && sideOn ? 296 : 0
|
|
9702
10144
|
// 生成中:右侧栏窄(或开着面板)时状态条在上排浮块下面,手机这类给它让一条;宽的时候它在上排中间,不用让。网页不让(一让就重排)
|
|
9703
|
-
busyGap = busy && !fill && (box.w < 860 || sideOn)
|
|
10145
|
+
busyGap = busy && !fill && (anOn || box.w < 860 || sideOn)
|
|
9704
10146
|
// 画笔标注开着:网页按开标注时的大小定住(侧栏拉窄了就整体缩小,不重排),画的才对得上
|
|
9705
10147
|
const lock = fill && mark && markSize ? markSize : null
|
|
9706
10148
|
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 +10160,13 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9718
10160
|
}
|
|
9719
10161
|
|
|
9720
10162
|
let chip = null
|
|
9721
|
-
const sideOpen = !!(ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240 // 右边开着面板:提示放在左边那块的中间
|
|
10163
|
+
const sideOpen = !!(anUp || ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240 // 右边开着面板:提示放在左边那块的中间
|
|
9722
10164
|
const side = sideOpen ? ' side' : ''
|
|
9723
10165
|
const hintText = picking ? t(canvas || inMulti ? 'pickAny' : 'pickOne') : textEdit ? t(canvas || inMulti ? 'textAny' : 'textOne') : styleEdit && !sty ? t(canvas ? 'styleAny' : 'styleOne') : ''
|
|
9724
10166
|
if (flash) chip = h('div', { className: 'ddp-chip ok' + side, key: 'ok' }, h(I.check), h('span', null, flash))
|
|
9725
10167
|
|
|
9726
10168
|
return root(
|
|
9727
|
-
h('div', { className: 'ddp-stage isl' + (busy ? ' bz' : ''), ref: stageRef },
|
|
10169
|
+
h('div', { className: 'ddp-stage isl' + (busy ? ' bz' : '') + (anOn ? ' an3' : ''), ref: stageRef },
|
|
9728
10170
|
h('div', { className: 'ddp-body' + (cvBody ? '' : ' pad' + (ver || demo || hintTop || busyGap ? ' vb' : '') + (ease ? ' ease' : '')) }, body),
|
|
9729
10171
|
busy ? h('div', { className: 'ddp-glow' }) : null,
|
|
9730
10172
|
busy ? h('div', { className: 'ddp-ring' }) : null,
|
|
@@ -9733,6 +10175,19 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9733
10175
|
// 提示只占一个位置:有新消息(toast)时它先让开,消息走了再回来
|
|
9734
10176
|
hintText && !toast ? h('div', { className: 'ddp-hint' + (sideOpen ? ' side' : '') }, hintText) : null,
|
|
9735
10177
|
ck ? h(CheckPanel, { t, ck, onFocus: focusIssue, onFix: fixIssues, onAgain: runCheck, onClose: closeCheck }) : null,
|
|
10178
|
+
anUp ? h(AnnotPanel, {
|
|
10179
|
+
t,
|
|
10180
|
+
file: anFile,
|
|
10181
|
+
screens: shown.map((x) => x.key),
|
|
10182
|
+
labelOfKey: (k) => { const sc = shown.find((x) => x.key === k); return sc ? labelOf(sc) : k },
|
|
10183
|
+
states: anStates,
|
|
10184
|
+
sel: anSel,
|
|
10185
|
+
onFocus: focusAn,
|
|
10186
|
+
onSend: (a) => insert(t('anOneText', { id: a.id, title: a.title, page: a.page }), 'inserted'),
|
|
10187
|
+
onMake: () => insert(t('anMakeText'), 'insertedSend'),
|
|
10188
|
+
onFix: fixAn,
|
|
10189
|
+
onClose: toggleAn,
|
|
10190
|
+
}) : null,
|
|
9736
10191
|
styleEdit ? h(StylePanel, {
|
|
9737
10192
|
t,
|
|
9738
10193
|
sty,
|