dsh-design-studio 0.25.3 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -619,6 +619,51 @@ window.__ModuleLoader__.load({
619
619
  stBrand: '正在提取品牌',
620
620
  stCode: '正在转成代码',
621
621
  stCompare: '正在逐像素对比',
622
+ implCmp: '和做出来的比',
623
+ implShort: '和做出来的比',
624
+ implDesign: '设计稿',
625
+ implSide: '做出来的',
626
+ implHidden: '外框里的 main 露不出来:画幅改成外框自己的 {w}×{h} 再看',
627
+ implOpening: '正在打开做出来的页面…',
628
+ implNeed: '在上面填做出来的页面地址(开发服务器要先跑起来)',
629
+ implBadUrl: '地址不对:只认本机的页面,比如 http://localhost:5173/login、端口 5173,或本地 HTML 文件',
630
+ implSelf: '这是设计稿自己的预览地址:填做出来的那个项目的',
631
+ implHttps: 'https 的开发服务器嵌不进来:换成 http 地址',
632
+ implOpenFail: '打不开做出来的页面({msg})',
633
+ implCmpFail: '没比成:做出来的页面打得开吗?开发服务器起来了吗?',
634
+ implCmpHidden: '没比成:这个画幅下外框里的 main 露不出来',
635
+ implScore: '比完了:差异 {pct}%',
636
+ implDone: '模型刚和做出来的比过「{name}」:差异 {pct}%',
637
+ implSee: '看对比',
638
+ implUrl: '做出来的页面地址',
639
+ implGo: '打开',
640
+ dImplUrl: '点一下换地址',
641
+ implPct: '差异 {pct}%',
642
+ dImplPct: '上次比对:{time},{who};点一下看拼图',
643
+ implByModel: '模型比的',
644
+ implByYou: '你点的',
645
+ implRe: '重新比',
646
+ dImplRe: '照现在的画幅、深浅色逐像素比一次(和 compare_design 一样)',
647
+ implHere: '比这一页',
648
+ implBlocked: '外链不在对比里打开:{href}',
649
+ dImplHere: '做出来的页面换到了 {path}(上次的分数、红框是原来那页的):点这里改成和这一页比',
650
+ implRunning: '在比…',
651
+ implExit: '退出对比',
652
+ implShotT: '上次比对的拼图',
653
+ implShotGone: '拼图没了(重开过 DSH):点「重新比」再出一张',
654
+ implShotHow: '设计稿 | 做出来的 | 差异;点任意处关掉',
655
+ implSplit: '拖线',
656
+ dImplSplit: '左边设计稿、右边做出来的,拖中间的把手',
657
+ implOver: '叠加',
658
+ dImplOver: '做出来的半透明盖在设计稿上',
659
+ implSideBy: '并排',
660
+ dImplSide: '两个并排,滚动同步',
661
+ implOp: '透明度',
662
+ dImplOp: '做出来的那层有多实',
663
+ implDiff: '反色',
664
+ dImplDiff: '一样的地方发黑,对不上的地方发亮',
665
+ implBoxes: '红框',
666
+ dImplBoxes: '标出上次比对差得最多的几块(同样画幅、顶上一屏时)',
622
667
  stPhotos: '正在挑照片',
623
668
  stStyle: '正在挑风格',
624
669
  stFrame: '正在存外框',
@@ -1501,6 +1546,51 @@ window.__ModuleLoader__.load({
1501
1546
  stBrand: 'Extracting the brand',
1502
1547
  stCode: 'Turning it into code',
1503
1548
  stCompare: 'Comparing pixel by pixel',
1549
+ implCmp: 'Compare with build',
1550
+ implShort: 'Compare with build',
1551
+ implDesign: 'Design',
1552
+ implSide: 'Built',
1553
+ implHidden: 'The main slot inside the frame does not show at this size: set the canvas size to the frame’s own {w}×{h}',
1554
+ implOpening: 'Opening the built page…',
1555
+ implNeed: 'Enter the built page’s address above (start the dev server first)',
1556
+ implBadUrl: 'Not a usable address: only pages on this computer, such as http://localhost:5173/login, port 5173, or a local HTML file',
1557
+ implSelf: 'That is the design’s own preview address: enter the address of the project you built',
1558
+ implHttps: 'An https dev server cannot be embedded: use its http address',
1559
+ implOpenFail: 'Could not open the built page ({msg})',
1560
+ implCmpFail: 'Could not compare: does the built page open? Is the dev server running?',
1561
+ implCmpHidden: 'Could not compare: the main slot inside the frame does not show at this size',
1562
+ implScore: 'Compared: {pct}% different',
1563
+ implDone: 'The model just compared “{name}” with the build: {pct}% different',
1564
+ implSee: 'View comparison',
1565
+ implUrl: 'Built page address',
1566
+ implGo: 'Open',
1567
+ dImplUrl: 'Click to change the address',
1568
+ implPct: '{pct}% different',
1569
+ dImplPct: 'Last compared {time} by {who}; click to see the comparison image',
1570
+ implByModel: 'the model',
1571
+ implByYou: 'you',
1572
+ implRe: 'Compare again',
1573
+ dImplRe: 'Compare pixel by pixel at the current size and theme (same as compare_design)',
1574
+ implHere: 'Compare this page',
1575
+ implBlocked: 'Outside links don\'t open inside the comparison: {href}',
1576
+ dImplHere: 'The built page moved to {path} (the last score and boxes are for the old page): click to compare against this page instead',
1577
+ implRunning: 'Comparing…',
1578
+ implExit: 'Leave comparison',
1579
+ implShotT: 'Last comparison image',
1580
+ implShotGone: 'The image is gone (DSH was restarted): click Compare again for a new one',
1581
+ implShotHow: 'Design | Built | Difference; click anywhere to close',
1582
+ implSplit: 'Split',
1583
+ dImplSplit: 'Design on the left, build on the right; drag the handle',
1584
+ implOver: 'Overlay',
1585
+ dImplOver: 'The build sits translucent over the design',
1586
+ implSideBy: 'Side',
1587
+ dImplSide: 'Both side by side, scrolling together',
1588
+ implOp: 'Opacity',
1589
+ dImplOp: 'How solid the build layer is',
1590
+ implDiff: 'Invert',
1591
+ dImplDiff: 'Matching areas turn black, mismatches light up',
1592
+ implBoxes: 'Boxes',
1593
+ dImplBoxes: 'Mark the areas that differed most last time (same size, top of the page)',
1504
1594
  stPhotos: 'Picking photos',
1505
1595
  stStyle: 'Picking a style',
1506
1596
  stFrame: 'Saving the frame',
@@ -2497,6 +2587,33 @@ window.__ModuleLoader__.load({
2497
2587
  .ddp-cmp .tag{position:absolute;top:10px;z-index:4;padding:3px 9px;border-radius:999px;background:rgba(0,0,0,.6);color:#fff;font:500 11px/16px -apple-system,BlinkMacSystemFont,"PingFang SC",sans-serif;pointer-events:none}
2498
2588
  .ddp-cmp .tag.l{left:10px}
2499
2589
  .ddp-cmp .tag.r{right:10px;background:${ACCENT}}
2590
+ /* 和做出来的比:叠加时真页面盖在设计稿上(isolation:反色只和设计稿混);套了外框时真页面只占槽位那块 */
2591
+ .ddp-icmp{isolation:isolate}
2592
+ .ddp-icmp .im{position:absolute;z-index:2;overflow:hidden;background:#fff}
2593
+ .ddp-icmp .im>.miss{background:rgba(244,244,246,.92)}
2594
+ .ddp-icmp .miss.hid{z-index:3;background:rgba(244,244,246,.92)}
2595
+ .ddp-icmp .bx{position:absolute;z-index:3;overflow:hidden;pointer-events:none}
2596
+ .ddp-icmp .bx>i{position:absolute;box-sizing:border-box;border:2px solid #e8382f;border-radius:2px}
2597
+ .ddp-icmp .bx>i>b{position:absolute;left:-1px;top:-1px;min-width:18px;height:18px;padding:0 4px;border-radius:2px;background:#e8382f;color:#fff;font:700 11px/18px -apple-system,BlinkMacSystemFont,sans-serif;text-align:center;transform-origin:top left}
2598
+ .ddp-iside{position:absolute;top:0;left:0}
2599
+ .ddp-ibn{padding-left:10px}
2600
+ .ddp-ibn.side>b{display:none}
2601
+ .ddp-ibn .ddp-iurl{flex:0 1 auto}
2602
+ .ddp-iurl{min-width:0;max-width:220px;overflow:hidden;text-overflow:ellipsis;height:24px;padding:0 8px;border:0;border-radius:999px;background:rgba(127,127,127,.12);color:var(--dsw-alias-label-primary);font:inherit;cursor:text}
2603
+ .ddp-iurl:hover{background:rgba(127,127,127,.2)}
2604
+ .ddp-iform{display:flex;align-items:center;gap:4px;min-width:0}
2605
+ .ddp-iform input{width:220px;min-width:80px;height:24px;padding:0 9px;border:0;border-radius:999px;background:rgba(127,127,127,.12);color:var(--dsw-alias-label-primary);font:inherit;outline:none}
2606
+ .ddp-iform input:focus{box-shadow:inset 0 0 0 1px ${ACCENT}}
2607
+ .ddp-iscore{flex:none;height:24px;padding:0 9px;border:0;border-radius:999px;background:rgba(232,56,47,.12);color:#d0312a;font:600 12px/24px inherit;font-family:inherit;cursor:zoom-in}
2608
+ .ddp-iscore.ok{background:rgba(34,160,90,.12);color:#1f8a4f}
2609
+ @container (max-width:460px){.ddp-iurl{max-width:90px}.ddp-iform input{width:120px}}
2610
+ .ddp-ibar .ddp-tool{width:auto;min-width:44px;padding:0 6px}
2611
+ .ddp-iop{display:flex;align-items:center;gap:6px;padding:0 6px;font-size:11px;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}
2612
+ .ddp-iop input{width:88px;accent-color:${ACCENT}}
2613
+ .ddp-iop span{min-width:30px;text-align:right}
2614
+ .ddp-ishot{position:absolute;inset:0;z-index:20;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px;background:rgba(0,0,0,.72);cursor:zoom-out;animation:ddp-in .15s ${EASE}}
2615
+ .ddp-ishot img{max-width:100%;max-height:calc(100% - 30px);border-radius:6px;box-shadow:0 8px 30px rgba(0,0,0,.4)}
2616
+ .ddp-ishot span{color:rgba(255,255,255,.8);font-size:12px}
2500
2617
  /* 屏头小按钮:悬停或选中那屏才出来(平时不占地方,给屏名和「用这版」留位置) */
2501
2618
  .ddp-act{margin-left:auto;display:none;gap:1px;flex:none}
2502
2619
  .ddp-cell:hover .ddp-act,.ddp-cell.sel .ddp-act{display:flex}
@@ -2824,6 +2941,12 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
2824
2941
 
2825
2942
  const svg = (d, extra) => h('svg', { viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 1.8, strokeLinecap: 'round', strokeLinejoin: 'round', ...extra }, ...d)
2826
2943
  const I = {
2944
+ // 和做出来的比:两张叠着的页面(后一张虚线)
2945
+ overlay: () => svg([h('rect', { key: 1, x: 3.5, y: 5.5, width: 11, height: 13, rx: 2 }), h('rect', { key: 2, x: 9.5, y: 5.5, width: 11, height: 13, rx: 2, strokeDasharray: '2.5 2' })]),
2946
+ splitV: () => svg([h('rect', { key: 1, x: 3.5, y: 4.5, width: 17, height: 15, rx: 2 }), h('path', { key: 2, d: 'M12 2.5v19' })]),
2947
+ sideBy: () => svg([h('rect', { key: 1, x: 3, y: 5.5, width: 8, height: 13, rx: 1.5 }), h('rect', { key: 2, x: 13, y: 5.5, width: 8, height: 13, rx: 1.5 })]),
2948
+ invert: () => svg([h('circle', { key: 1, cx: 12, cy: 12, r: 8 }), h('path', { key: 2, d: 'M12 4a8 8 0 0 1 0 16z', fill: 'currentColor' })]),
2949
+ boxes: () => svg([h('rect', { key: 1, x: 4.5, y: 6.5, width: 15, height: 11, rx: 1, strokeDasharray: '3 2' }), h('path', { key: 2, d: 'M4.5 6.5h4v4h-4z', fill: 'currentColor', stroke: 'none' })]),
2827
2950
  pick: () => svg([h('path', { key: 1, d: 'M4 4l6.5 16 2.3-6.7L19.5 11z' }), h('path', { key: 2, d: 'M13 13l6 6' })]),
2828
2951
  canvas: () => svg([h('rect', { key: 1, x: 3.5, y: 3.5, width: 7, height: 7, rx: 1.6 }), h('rect', { key: 2, x: 13.5, y: 3.5, width: 7, height: 7, rx: 1.6 }),
2829
2952
  h('rect', { key: 3, x: 3.5, y: 13.5, width: 7, height: 7, rx: 1.6 }), h('rect', { key: 4, x: 13.5, y: 13.5, width: 7, height: 7, rx: 1.6 })]),
@@ -5599,6 +5722,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
5599
5722
  holdScroll: () => { if (curRef.current) postTo(curRef.current, { type: 'holdScroll' }) }, // 用户要在这个位置上画:闪改动别再滚回去
5600
5723
  // 画笔标注:这一屏的页面(iframe)现在摆在哪,拼图时按它的位置放截图
5601
5724
  frame: () => wins.current.get(curRef.current) || null,
5725
+ // 和做出来的比:替另一边滚到同一个位置
5726
+ scrollTo: (x, y) => { if (curRef.current) postTo(curRef.current, { type: 'scrollTo', x, y }) },
5602
5727
  }
5603
5728
  }
5604
5729
  // 登记到右侧栏:导出图片时按屏找到它
@@ -5607,8 +5732,15 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
5607
5732
  const k = props.apiKey
5608
5733
  if (!m || !k) return undefined
5609
5734
  m.set(k, api.current)
5610
- return () => { if (m.get(k) === api.current) m.delete(k) }
5611
- }, [props.apiKey])
5735
+ // 和做出来的比:设计稿那边也登记到右侧栏那份(对比开着时导出、截图照样找得到这一屏)
5736
+ const m2 = props.alsoApis
5737
+ const k2 = props.alsoKey
5738
+ if (m2 && k2) m2.set(k2, api.current)
5739
+ return () => {
5740
+ if (m.get(k) === api.current) m.delete(k)
5741
+ if (m2 && k2 && m2.get(k2) === api.current) m2.delete(k2)
5742
+ }
5743
+ }, [props.apiKey, props.alsoKey])
5612
5744
 
5613
5745
  const postTo = (id, msg) => {
5614
5746
  const f = wins.current.get(id)
@@ -5713,6 +5845,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
5713
5845
  }
5714
5846
 
5715
5847
  const pickMsg = () => ({ type: 'pick', hint: false }) // 提示放在右侧栏(页面顶上会被手机的灵动岛挡住)
5848
+ // 和做出来的比:页面报滚动(两边同步),套了外框的设计稿还报 main 槽位在哪
5849
+ const syncMsg = (p) => ({ type: 'sync', on: !!p.sync, slot: !!(p.sync && p.sync.slot) })
5716
5850
  // 调样式:开模式、选中右侧栏记着的那个元素、把改到一半的样式再套上(新载的一帧要从头告诉它)
5717
5851
  const styleTo = (id, p) => {
5718
5852
  postTo(id, { type: 'styleMode', on: true })
@@ -5741,6 +5875,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
5741
5875
  if (p.demo) postTo(id, { type: 'demo', on: true })
5742
5876
  if (p.textEdit) postTo(id, { type: 'edit', on: true, hint: false })
5743
5877
  if (p.styleEdit) styleTo(id, p)
5878
+ if (p.sync) postTo(id, syncMsg(p))
5744
5879
  if (L.tops.has(id) && p.onTop) p.onTop(L.tops.get(id))
5745
5880
  if (L.anStates.has(id) && p.onAnnotState) p.onAnnotState(L.anStates.get(id))
5746
5881
  if (first && p.onShown) p.onShown()
@@ -5836,7 +5971,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
5836
5971
  const seed = L.seeds.get(id) || L.seedOf.get(id) || null
5837
5972
  L.seeds.delete(id)
5838
5973
  L.seedOf.delete(id)
5839
- postTo(id, { type: 'init', seed, relay: true }) // 改动通知由右侧栏转告(见下面「本机预览」),页面别自己开 SSE
5974
+ // 改动通知由右侧栏转告(见下面「本机预览」),页面别自己开 SSE;做出来的页面(ownEvents)不在设计目录里,让它自己听
5975
+ postTo(id, { type: 'init', seed, relay: !P.current.ownEvents })
5840
5976
  break
5841
5977
  }
5842
5978
  case 'ready':
@@ -5862,6 +5998,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
5862
5998
  if (p.demo) postTo(id, { type: 'demo', on: true })
5863
5999
  if (p.textEdit) postTo(id, { type: 'edit', on: true, hint: false })
5864
6000
  if (p.styleEdit) styleTo(id, p)
6001
+ if (p.sync) postTo(id, syncMsg(p))
5865
6002
  if (d.changes && d.changes.count && p.onNote) p.onNote({ changes: d.changes, file: '' })
5866
6003
  } else if (id > curRef.current) swap(id, d.changes)
5867
6004
  break
@@ -5870,7 +6007,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
5870
6007
  break
5871
6008
  case 'blocked':
5872
6009
  // 别人做的设计里点了站外链接:拦下了,告诉用户一声
5873
- if (isCur) for (const f of blockedSubs) f(typeof d.href === 'string' ? d.href.slice(0, 200) : '')
6010
+ if (isCur) for (const f of blockedSubs) f(typeof d.href === 'string' ? d.href.slice(0, 200) : '', d.why === 'sync')
5874
6011
  break
5875
6012
  case 'dragIn':
5876
6013
  case 'dragOut':
@@ -5887,6 +6024,15 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
5887
6024
  if (isCur && p.onAnnotState) p.onAnnotState(d.list)
5888
6025
  }
5889
6026
  break
6027
+ case 'scrolled':
6028
+ if (isCur && p.sync && p.onScrolled) p.onScrolled({ x: Number(d.x) || 0, y: Number(d.y) || 0, first: d.first === true, set: d.set === true })
6029
+ break
6030
+ case 'slot':
6031
+ if (isCur && p.sync && p.onSlot) p.onSlot(d.box && typeof d.box === 'object' ? d.box : null)
6032
+ break
6033
+ case 'route':
6034
+ if (isCur && p.sync && p.onRoute) p.onRoute(String(d.path || '').slice(0, 2000), d.user === true)
6035
+ break
5890
6036
  case 'top':
5891
6037
  // 每帧记着自己的;只有正显示的那帧算数(预载的换上来时再用,旧帧晚到的不管)
5892
6038
  L.tops.set(id, !!d.dark)
@@ -5950,6 +6096,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
5950
6096
  useEffect(() => { if (cur) postTo(cur, { type: 'zoom', z: zq / 100 }) }, [zq])
5951
6097
  useEffect(() => { if (cur) postTo(cur, props.picking ? pickMsg() : { type: 'cancel' }) }, [!!props.picking])
5952
6098
  useEffect(() => { if (cur) postTo(cur, { type: 'theme', dark: !!props.dark }) }, [!!props.dark])
6099
+ const syncSig = props.sync ? (props.sync.slot ? 'slot' : 'page') : ''
6100
+ useEffect(() => { if (cur) postTo(cur, syncMsg(P.current)) }, [syncSig]) // 刚挂上时 cur 还是 0:载好时(ready / 换帧)再发
5953
6101
  useEffect(() => { if (cur) { if (props.styleEdit) styleTo(cur, props); else postTo(cur, { type: 'styleMode', on: false }) } }, [!!props.styleEdit])
5954
6102
  useEffect(() => { if (cur && props.styleEdit) postTo(cur, { type: 'styleSel', selector: props.styleSel || '' }) }, [props.styleSel || ''])
5955
6103
  const cssSig = JSON.stringify(props.styleCss || {})
@@ -6061,6 +6209,188 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
6061
6209
  h(Skeleton, { gone: !!cur }))
6062
6210
  }
6063
6211
 
6212
+ /** 和做出来的比:填做出来的页面地址(横幅里一行) */
6213
+ function ImplUrlForm({ t, initial, busy, onGo, onCancel }) {
6214
+ const ref = useRef(null)
6215
+ useEffect(() => { const el = ref.current; if (el) { el.focus(); el.select() } }, [])
6216
+ return h('form', { className: 'ddp-iform', onSubmit: (e) => { e.preventDefault(); const v = ref.current ? ref.current.value.trim() : ''; if (v) onGo(v) } },
6217
+ h('input', { ref, type: 'text', defaultValue: initial || '', placeholder: 'http://localhost:5173/', spellCheck: false, 'aria-label': t('implUrl'), disabled: busy,
6218
+ onKeyDown: (e) => { if (e.key === 'Escape' && onCancel) { e.preventDefault(); e.stopPropagation(); onCancel() } } }),
6219
+ h('button', { type: 'submit', className: 'ddp-go', disabled: busy }, t('implGo')))
6220
+ }
6221
+
6222
+ // ── 和做出来的比(#25):设计稿和做出来的真页面摆在一起看 ─────────────────────────────
6223
+ // 拖线:中间把手左右拖,左边设计稿、右边做出来的;叠加:真页面半透明盖在设计稿上(反色:一样的地方发黑);并排:两个并排。
6224
+ // 套了外框的设计(DSH 插件、外框库):真页面只盖在 main 槽位上,外框照设计稿显示(和 compare_design 只比槽位一样)。
6225
+ // 两边滚动同步(页面里的设计台脚本报滚动、替另一边滚);上次比对的红框按设计稿那边滚到哪标回去
6226
+ const SYNC_SLOT = { slot: true }
6227
+ const SYNC_PAGE = { slot: false }
6228
+ /**
6229
+ * 真页面跳到的那页(预览服务器上的路径)换回记录用的地址。
6230
+ * 本地 HTML 的预览根可能比 HTML 所在文件夹高几层(页面引用了 ../),按眼前地址的层数退回根再接上。
6231
+ */
6232
+ function implAwayUrl(impl, away) {
6233
+ if (!/^file:/i.test(impl.url)) return new URL(away, impl.url).href
6234
+ let depth = 0
6235
+ try { depth = Math.max(0, new URL(impl.live).pathname.split('/').length - 2) } catch { /* 还没开好:按同一个文件夹 */ }
6236
+ return new URL('.' + away, new URL('../'.repeat(depth) || './', impl.url)).href
6237
+ }
6238
+
6239
+ /**
6240
+ * 真页面摆在哪、红框标不标:套了外框(设计稿报了槽位、没说整屏比)盖在槽位那块;槽位露不出来就不放;
6241
+ * 红框只在比的是同样大小(套了外框比的是槽位)、比的是顶上一屏、同样深浅色、量得到眼前多大时标
6242
+ */
6243
+ function implLayout(slot, rec, size, flat, boxesOn, dark = false) {
6244
+ const whole = !!(rec && rec.whole)
6245
+ const framed = !!slot && !slot.hidden && !whole
6246
+ const hidden = !!slot && !!slot.hidden && !whole
6247
+ const rect = framed ? { left: slot.vx, top: slot.vy, width: slot.w, height: slot.h } : { left: 0, top: 0, right: 0, bottom: 0 }
6248
+ const cw = framed ? slot.w : size[0]
6249
+ const ch = framed ? slot.h : size[1]
6250
+ const boxOk = !!(boxesOn && !hidden && !flat && rec && Array.isArray(rec.boxes) && rec.boxes.length && rec.at !== 'bottom' && !!rec.dark === !!dark && Array.isArray(rec.cmp) && !!rec.slot === framed && rec.cmp[0] === cw && rec.cmp[1] === ch)
6251
+ return { framed, hidden, rect, boxOk }
6252
+ }
6253
+ function ImplCompare(props) {
6254
+ const { t, mode, live, z, flat, lock, dw, dh, gap, kind, size, os, label, top, rec, boxesOn, dark, reloadSeq, missText } = props
6255
+ const apis = useRef(new Map())
6256
+ const [slot, setSlot] = useState(null)
6257
+ const [cx, setCx] = useState(50)
6258
+ const [drag, setDrag] = useState(false)
6259
+ const [pos, setPos] = useState({ x: 0, y: 0 }) // 设计稿那边滚到哪
6260
+ const [ipos, setIpos] = useState({ x: 0, y: 0 }) // 真页面那边滚到哪(设计稿短、真页面长时只有它滚得动)
6261
+ const navFresh = useRef(false) // 用户刚点去了另一页(下一次「刚载好」不滚回原处)
6262
+ const last = useRef({ d: { x: 0, y: 0 }, i: { x: 0, y: 0 } }) // 两边各自滚到哪(真页面比设计稿长时两边不一样)
6263
+ const wrap = useRef(null)
6264
+ const P = useRef(props)
6265
+ P.current = props
6266
+ // 网页铺满、右边开着面板(lock):页面按定住的大小铺满(同「版本对比」);眼前多大量出来(重新比照这个大小比,红框按它对)
6267
+ const fill = flat || !!lock
6268
+ const [view, setView] = useState(null)
6269
+ const vsize = mode === 'side' ? size : view || size
6270
+ const lay = implLayout(slot, rec, vsize, mode !== 'side' && fill && !view, boxesOn, dark)
6271
+ const { framed, hidden, rect } = lay
6272
+ // 真页面换了路由(点了站内链接):比的不是这页了,红框不标,告诉右侧栏
6273
+ const [away, setAway] = useState('')
6274
+ const want = (() => { try { const u = new URL(live); return u.pathname + u.search + u.hash } catch { return '' } })()
6275
+ const wantRef = useRef(want)
6276
+ wantRef.current = want
6277
+ // 基准:开这个地址后页面自己停下的路由(项目常把 / 跳到 /login、hash 路由把 / 变成 /#/):载好后 2 秒内页面自己跳的都算基准;
6278
+ // 用户点过去的(picker 报 user)马上算换页
6279
+ const base = useRef({ path: null, at: 0 })
6280
+ useEffect(() => { setAway(''); base.current = { path: null, at: 0 } }, [live])
6281
+ useEffect(() => { if (P.current.onAway) P.current.onAway(away) }, [away])
6282
+ const onRoute = useMemo(() => (path, user) => {
6283
+ // 用户点去了另一页:新页从顶上开始,别把上一页滚到的位置套上去
6284
+ if (user) { last.current.i = { x: 0, y: 0 }; navFresh.current = true }
6285
+ const b = base.current
6286
+ if (b.path === null || (!user && Date.now() - b.at < 2000)) { base.current = { path, at: b.path === null ? Date.now() : b.at }; setAway(''); return }
6287
+ setAway(path === b.path || path === wantRef.current ? '' : path) // 切看法重载时先报一下原地址、再跳到基准:都不算换页
6288
+ }, [])
6289
+ const boxOk = lay.boxOk && !away
6290
+ useEffect(() => {
6291
+ const el = wrap.current
6292
+ if (!el || typeof ResizeObserver === 'undefined') return undefined
6293
+ const ro = new ResizeObserver(() => {
6294
+ const v = [Math.round(el.offsetWidth), Math.round(el.offsetHeight)]
6295
+ if (v[0] > 0 && v[1] > 0) setView((o) => (o && o[0] === v[0] && o[1] === v[1] ? o : v))
6296
+ })
6297
+ ro.observe(el)
6298
+ return () => ro.disconnect()
6299
+ }, [mode === 'side'])
6300
+ useEffect(() => { if (P.current.onView) P.current.onView(mode === 'side' ? null : view) }, [view, mode === 'side'])
6301
+ // 一边滚了替另一边滚(对面是我们替它滚的,不会再传回来)
6302
+ const from = (me) => (p) => {
6303
+ const at = { x: p.x, y: p.y }
6304
+ // 刚载好报的位置(多半是顶上;换看法、重载了都会重新载):这边原来滚开了就滚回原处,
6305
+ // 没滚过(刚开出来)就跟另一边对齐,不把另一边拽回去
6306
+ if (p.first && me === 'i' && navFresh.current) { navFresh.current = false; last.current.i = at; setIpos(at); return }
6307
+ if (p.first) {
6308
+ const mine = last.current[me]
6309
+ const theirs = last.current[me === 'd' ? 'i' : 'd']
6310
+ const to = mine.x || mine.y ? mine : theirs.x || theirs.y ? theirs : null
6311
+ if (to) { const a = apis.current.get(me); if (a) a.scrollTo(to.x, to.y); return }
6312
+ }
6313
+ last.current[me] = at
6314
+ if (me === 'd') setPos(at) // 红框按设计稿实际滚到哪标
6315
+ else setIpos(at)
6316
+ // 替它滚完它实际停在哪(滚到头停住):只记下,不再转给对面
6317
+ if (p.set) return
6318
+ const other = apis.current.get(me === 'd' ? 'i' : 'd')
6319
+ if (other) other.scrollTo(p.x, p.y)
6320
+ }
6321
+ const onD = useMemo(() => from('d'), [])
6322
+ const onI = useMemo(() => from('i'), [])
6323
+ const onSlot = useMemo(() => (box) => { setSlot(box); if (P.current.onSlot) P.current.onSlot(box) }, [])
6324
+ useEffect(() => { setSlot(null); last.current = { d: { x: 0, y: 0 }, i: { x: 0, y: 0 } }; setPos({ x: 0, y: 0 }); setIpos({ x: 0, y: 0 }) }, [props.designKey])
6325
+ const dragKnob = (e) => {
6326
+ const el = wrap.current
6327
+ if (!el) return
6328
+ e.preventDefault()
6329
+ const target = e.currentTarget
6330
+ try { target.setPointerCapture(e.pointerId) } catch { /* 老浏览器 */ }
6331
+ setDrag(true)
6332
+ const move = (ev) => {
6333
+ const r = el.getBoundingClientRect()
6334
+ if (r.width > 0) setCx(Math.max(0, Math.min(100, ((ev.clientX - r.left) / r.width) * 100)))
6335
+ }
6336
+ const up = () => {
6337
+ target.removeEventListener('pointermove', move)
6338
+ target.removeEventListener('pointerup', up)
6339
+ target.removeEventListener('pointercancel', up)
6340
+ setDrag(false)
6341
+ }
6342
+ target.addEventListener('pointermove', move)
6343
+ target.addEventListener('pointerup', up)
6344
+ target.addEventListener('pointercancel', up)
6345
+ move(e)
6346
+ }
6347
+ // 设计稿那边点了链接跳到别的屏:对比跟着换成那屏(屏名、分数、「重新比」都对上)
6348
+ const onDesignHref = useMemo(() => (href) => {
6349
+ if (!P.current.onDesignNav || !P.current.fileKeys) return
6350
+ let k = ''
6351
+ try { k = keyOfPath(decodeURIComponent(new URL(href).pathname), true) } catch { return }
6352
+ if (k && k !== P.current.designKey && P.current.fileKeys.includes(k)) P.current.onDesignNav(k)
6353
+ }, [])
6354
+ const design = (key, extra) => props.renderDesign({ apis: apis.current, apiKey: key, ...(key === 'd' ? { onHref: onDesignHref } : {}), ...extra })
6355
+ const implEl = () => (live
6356
+ ? h(Screen, { t, src: live, label: t('implSide'), busy: false, born: false, picking: false, dark, zoom: z, reloadSeq, apis: apis.current, apiKey: 'i', sync: SYNC_PAGE, onScrolled: onI, onRoute, ownEvents: true })
6357
+ : h('div', { className: 'miss' }, missText))
6358
+ const implLayer = (style) => (hidden ? null : h('div', { className: 'im', style: { ...rect, ...style } }, implEl()))
6359
+ // 上次比对的红框:跟着设计稿那边的滚动挪
6360
+ // 红框是顶上一屏比出来的:两边任一边滚开了就先收起(固定的顶栏不跟着滚,标了会偏)
6361
+ const top0 = (p) => Math.abs(p.x) < 2 && Math.abs(p.y) < 2
6362
+ const boxes = () => (boxOk && top0(pos) && top0(ipos) ? h('div', { className: 'bx', style: rect, 'aria-hidden': true }, ...rec.boxes.map((b, i) => h('i', { key: i, style: { left: b.x - pos.x, top: b.y - pos.y, width: b.w, height: b.h, borderWidth: Math.max(1, 2 / z) } },
6363
+ h('b', { style: { transform: `scale(${1 / z})` } }, String(i + 1))))) : null)
6364
+ const tagAt = (side) => ({ top: kind === 'app' || kind === 'miniprogram' || kind === 'tablet' ? 60 : 10, transform: `scale(${1 / z})`, transformOrigin: 'top ' + side })
6365
+ const tag = (side, k) => h('span', { className: 'tag ' + side[0], style: tagAt(side) }, t(k))
6366
+ const note = hidden ? h('div', { className: 'miss hid' }, t('implHidden', { w: slot.fw, h: slot.fh })) : null
6367
+ const dev = (children, k) => h(Device, { key: k, kind, w: size[0], h: size[1], fill, label, top, os }, children)
6368
+ if (mode === 'side') {
6369
+ return h('div', { className: 'ddp-fit', style: { width: dw * 2 + gap, height: dh, transform: `translate(-50%, -50%) scale(${z})` } },
6370
+ h('div', { className: 'ddp-iside', style: { width: dw, height: dh } },
6371
+ dev(h('div', { className: 'ddp-cmp ddp-icmp' }, h('div', { className: 'ly' }, design('d', { sync: SYNC_SLOT, onScrolled: onD, onSlot })), boxes(), tag('left', 'implDesign')), 'l')),
6372
+ h('div', { className: 'ddp-iside', style: { left: dw + gap, width: dw, height: dh } },
6373
+ dev(h('div', { className: 'ddp-cmp ddp-icmp' }, framed || hidden ? h('div', { className: 'ly' }, design('c', {})) : null, implLayer(), note, boxes(), tag('right', 'implSide')), 'r')))
6374
+ }
6375
+ const W = lock ? lock.w : dw
6376
+ const H = lock ? lock.h : dh
6377
+ const over = mode === 'overlay'
6378
+ const op = Math.max(0, Math.min(100, Number(props.opacity) || 0))
6379
+ return h('div', { className: 'ddp-fit' + (flat ? ' fill' : ''), style: flat ? undefined : { width: W, height: H, transform: `translate(-50%, -50%) scale(${z})` } },
6380
+ dev(h('div', { className: 'ddp-cmp ddp-icmp' + (drag ? ' drag' : '') + (over ? ' ov' : ''), ref: wrap },
6381
+ h('div', { className: 'ly' }, design('d', { sync: SYNC_SLOT, onScrolled: onD, onSlot })),
6382
+ over
6383
+ ? implLayer(props.diff ? { mixBlendMode: 'difference' } : { opacity: op / 100, pointerEvents: op === 0 ? 'none' : undefined })
6384
+ // 右边一层只露出把手右边那块:外层裁宽度,里面整屏往左挪(同「版本对比」);拖到最右也不卸掉真页面(再拖回来不用重载)
6385
+ : h('div', { className: 'ly r', style: { width: Math.max(0.5, 100 - cx) + '%', visibility: cx >= 100 ? 'hidden' : undefined } },
6386
+ h('div', { style: { width: (10000 / Math.max(0.5, 100 - cx)) + '%', left: (-100 * Math.min(cx, 99.5) / Math.max(0.5, 100 - cx)) + '%' } }, implLayer())),
6387
+ note,
6388
+ boxes(),
6389
+ over ? null : h('div', { className: 'ddp-knob', style: { left: cx + '%' }, onPointerDown: dragKnob }, h('i')),
6390
+ over ? null : tag('left', 'implDesign'),
6391
+ over ? null : tag('right', 'implSide')), 'one'))
6392
+ }
6393
+
6064
6394
  /** 类型菜单:网页 / App / 平板 / 海报 / 幻灯片 / 邮件 */
6065
6395
 
6066
6396
  // ── 画笔标注:一层透明画布盖在预览上,画的东西按台面上的坐标(CSS 像素)一笔一笔记着,能撤销、能擦 ──
@@ -9148,6 +9478,40 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
9148
9478
 
9149
9479
  // ── 演示跳屏(从预览面板里拆出来的):点页面里的按钮跳到别的屏,前进从右边滑进来、返回从左边
9150
9480
  // x:setDemo、demoSeq(层的编号)、fileTarget(把链接路径换成哪一屏);开始演示、Esc 收起留在面板里
9481
+ /** 和做出来的比(#25):开真页面(按记着的 / 刚填的地址)、重新比 */
9482
+ function makeImpl(x) {
9483
+ const { sid, setImpl, setImplRun, say, t } = x
9484
+ const errOf = (e) => {
9485
+ const c = (e && e.message) || ''
9486
+ if (c === 'no-url') return ''
9487
+ return c === 'bad-url' ? t('implBadUrl') : c === 'self' ? t('implSelf') : c === 'https' ? t('implHttps') : t('implOpenFail', { msg: c })
9488
+ }
9489
+ const implLoad = (key, url) => {
9490
+ setImpl((c) => (c && c.key === key ? { ...c, busy: true, err: '' } : c))
9491
+ return post('impl', { session: sid, screen: key, ...(url ? { url } : {}) }).then(
9492
+ (d) => setImpl((c) => (c && c.key === key ? { ...c, busy: false, live: d.live || '', url: d.url || '', err: '', edit: false } : c)),
9493
+ (e) => {
9494
+ const msg = errOf(e)
9495
+ if (msg) say(msg)
9496
+ setImpl((c) => (c && c.key === key ? { ...c, busy: false, err: msg, edit: true } : c))
9497
+ })
9498
+ }
9499
+ // 照现在看的尺寸、深浅色比(看到的就是打分的)
9500
+ const implRecompare = (key, size, dark, url) => {
9501
+ setImplRun(true)
9502
+ return post('implcmp', { session: sid, screen: key, url, size: `${size[0]}x${size[1]}`, dark: !!dark })
9503
+ .then((d) => {
9504
+ if (d.error === 'stale') return // 比的时候换了设计 / 地址:这次的不算
9505
+ if (d.error) say(t('implCmpFail'))
9506
+ else if (!d.ok) say(t('implCmpHidden'))
9507
+ else if (d.rec && typeof d.rec.pct === 'number') say(t('implScore', { pct: d.rec.pct.toFixed(1) }))
9508
+ })
9509
+ .catch(() => say(t('implCmpFail')))
9510
+ .finally(() => setImplRun(false))
9511
+ }
9512
+ return { implLoad, implRecompare }
9513
+ }
9514
+
9151
9515
  function makeDemoNav(x) {
9152
9516
  const { setDemo, demoSeq, fileTarget } = x
9153
9517
  const demoGo = (path) => demoTo(keyOfPath(path, fileTarget))
@@ -9230,6 +9594,18 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
9230
9594
  const [cmp, setCmp] = useState(false) // 和现在左右对比
9231
9595
  const [cx, setCx] = useState(50)
9232
9596
  const [cmpDrag, setCmpDrag] = useState(false)
9597
+ // 和做出来的比(#25):null 关着;{ key 哪一屏, live 真页面经预览服务器的地址, url 原地址, err, edit 在填地址, busy }
9598
+ const [impl, setImpl] = useState(null)
9599
+ const [implMode, setImplModeS] = useState(() => { try { const v = localStorage.getItem('ddp-impl-mode'); return v === 'overlay' || v === 'side' ? v : 'split' } catch { return 'split' } })
9600
+ const setImplMode = (v) => { setImplModeS(v); try { localStorage.setItem('ddp-impl-mode', v) } catch { /* 记不住就这次有效 */ } }
9601
+ const [implOp, setImplOp] = useState(50) // 叠加时真页面的不透明度
9602
+ const [implDiff, setImplDiff] = useState(false) // 叠加时反色(一样的地方发黑)
9603
+ const [implBoxes, setImplBoxes] = useState(true) // 标出上次比对的红框
9604
+ const [implRun, setImplRun] = useState(false) // 正在重新比
9605
+ const [implSlot, setImplSlot] = useState(null) // 设计稿外框里 main 槽位在哪(没套外框为 null)
9606
+ const [implShot, setImplShot] = useState('') // 在看上次比对的拼图:图片地址
9607
+ const implView = useRef(null) // 对比里设计稿眼前多大(网页铺满时不是画幅):「重新比」照这个比
9608
+ const [implAway, setImplAway] = useState('') // 真页面换到了别的路由(点了站内链接):那条路由
9233
9609
  const [dark, setDark] = useState(false)
9234
9610
  const [phone, setPhone] = useState(false) // 手机上看的面板
9235
9611
  const [multi, setMulti] = useState(false) // 多尺寸并排
@@ -9557,7 +9933,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
9557
9933
  }
9558
9934
  // 设计库来的设计里点了站外链接 / 下载:拦下了
9559
9935
  useEffect(() => {
9560
- const f = (href) => showFlash(href === 'download' ? t('blockedDownload') : t('blockedLink', { href: href.replace(/^https?:\/\//, '').slice(0, 40) }))
9936
+ const f = (href, sync) => showFlash(href === 'download' ? t('blockedDownload') : t(sync ? 'implBlocked' : 'blockedLink', { href: href.replace(/^https?:\/\//, '').slice(0, 40) }))
9561
9937
  blockedSubs.add(f)
9562
9938
  return () => { blockedSubs.delete(f) }
9563
9939
  }, [])
@@ -9785,6 +10161,76 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
9785
10161
  }
9786
10162
  // 演示里跳屏、返回、从头来(makeDemoNav)
9787
10163
  const { demoGo, demoTo, demoRestart, demoBack, demoShown, demoHref } = makeDemoNav({ setDemo, demoSeq, fileTarget })
10164
+ const { implLoad, implRecompare } = makeImpl({ sid, setImpl, setImplRun, say, t })
10165
+ // 和做出来的比:在比哪一屏(看旧版本时不比)、那屏记着的地址和上次的分数
10166
+ const implSc = impl && !ver ? screens.find((x) => x.key === impl.key) || null : null
10167
+ // 远程看(手机 / 别的电脑开的 DSH 网页):做出来的页面在这台电脑的 localhost 上,那边打不开,不给进
10168
+ const implFar = (() => { try { return /^https?:$/.test(location.protocol) && !LOCAL_HOST.test(location.hostname) } catch { return false } })()
10169
+ const implMap = (st && st.impl) || null
10170
+ const implRec = impl && implMap ? implMap[impl.key] || null : null
10171
+ const implOpen = (key) => {
10172
+ if (!key || !screens.some((x) => x.key === key)) return
10173
+ setPicking(false)
10174
+ setTextEdit(false)
10175
+ setStyleEdit(false)
10176
+ markRun.current++
10177
+ setMark(false)
10178
+ setDemo(null)
10179
+ setMulti(false)
10180
+ setCmp(false)
10181
+ setVer(null)
10182
+ setImplSlot(null)
10183
+ setImplShot('')
10184
+ setImplAway('')
10185
+ setImpl({ key, live: '', url: '', err: '', edit: false, busy: true })
10186
+ implLoad(key)
10187
+ }
10188
+ const implClose = () => { setImpl(null); setImplShot(''); setImplAway('') }
10189
+ // 这屏还没记地址:先填上别的屏用过的开发服务器(同一个项目多半是同一个端口)
10190
+ const implGuess = () => {
10191
+ for (const k of Object.keys(implMap || {})) {
10192
+ try { const u = new URL(implMap[k].url); if (/^https?:$/.test(u.protocol)) return u.origin + '/' } catch { /* 不认识的地址 */ }
10193
+ }
10194
+ return ''
10195
+ }
10196
+ // 模型拿别的地址比过了:换成那个页面
10197
+ const implRecUrl = implRec ? implRec.url : ''
10198
+ useEffect(() => { if (impl && implRecUrl && impl.url && implRecUrl !== impl.url && !impl.edit) implLoad(impl.key) }, [implRecUrl])
10199
+ // 改地址时模型换了地址、用户又按 Esc 取消:收起输入框时换过去(画面和分数要对得上)
10200
+ const implCancel = () => { if (impl && implRecUrl && impl.url && implRecUrl !== impl.url) implLoad(impl.key); else setImpl((c) => (c ? { ...c, edit: false } : c)) }
10201
+ // 那一屏没了、开始看旧版本:退出对比
10202
+ const keysSig = screens.map((x) => x.key).join('\n')
10203
+ useEffect(() => { if (impl && st && (ver || !screens.some((x) => x.key === impl.key))) implClose() }, [keysSig, !!ver])
10204
+ // 模型刚调过 compare_design:提示一声,点「看对比」打开(正在比的就是这屏时不用提示)
10205
+ const implSeen = useRef(null)
10206
+ const implWhoWas = useRef('')
10207
+ const implSig = implMap ? Object.keys(implMap).map((k) => k + ':' + implMap[k].when).join('|') : ''
10208
+ const implWho = st && st.target ? `${st.target.kind}:${st.target.root || st.target.port || ''}` : ''
10209
+ useEffect(() => {
10210
+ if (!implMap) return
10211
+ const prev = implSeen.current
10212
+ const now = {}
10213
+ for (const k of Object.keys(implMap)) now[k] = implMap[k].when
10214
+ implSeen.current = { who: implWho, now }
10215
+ if (!prev || prev.who !== implWho) return
10216
+ const fresh = Object.keys(implMap).filter((k) => implMap[k].by === 'model' && typeof implMap[k].pct === 'number' && implMap[k].when > (prev.now[k] || 0))
10217
+ if (!fresh.length || (impl && fresh.includes(impl.key))) return
10218
+ const k = fresh[fresh.length - 1]
10219
+ const sc = screens.find((x) => x.key === k)
10220
+ say(t('implDone', { name: sc ? dropBrand(shortOf(sc)) : k, pct: implMap[k].pct.toFixed(1) }), implFar ? undefined : { label: t('implSee'), run: () => implOpen(k) })
10221
+ }, [implSig, implWho])
10222
+ // 换了一个设计:关掉对比(同名的屏是另一个设计的,记着的地址、分数也是另一份)
10223
+ useEffect(() => {
10224
+ const was = implWhoWas.current
10225
+ if (implWho) implWhoWas.current = implWho
10226
+ if (was && implWho && was !== implWho && impl) implClose()
10227
+ }, [implWho])
10228
+ useEffect(() => {
10229
+ if (!impl) return undefined
10230
+ const onKey = (e) => { if (e.key === 'Escape' && !overlayUp() && !e.defaultPrevented) { if (implShot) setImplShot(''); else implClose() } }
10231
+ window.addEventListener('keydown', onKey)
10232
+ return () => window.removeEventListener('keydown', onKey)
10233
+ }, [!!impl, implShot])
9788
10234
  useEffect(() => {
9789
10235
  if (!demo) return undefined
9790
10236
  const onKey = (e) => { if (e.key === 'Escape' && !overlayUp()) setDemo(null) }
@@ -9858,7 +10304,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
9858
10304
  return api
9859
10305
  }
9860
10306
  // ── 导出图片(makeExporter)──
9861
- const { withFrames, measureAll, exportShots } = makeExporter({ apiOf, targetKey, sid, st, kind, size, dark, meta, tokens, t, say, canvas, focus, sel, shown, ik, labelOf, infoOf, fileTarget, ver, apis, designNow, designSeq, ghostApis, ghostBatch, ghostQueue, setBackFrames, warned,
10307
+ // 在和做出来的比:导出的「这一屏」是比的那屏,画布没挂着(别的屏在背后挂)
10308
+ const { withFrames, measureAll, exportShots } = makeExporter({ apiOf, targetKey, sid, st, kind, size, dark, meta, tokens, t, say, canvas: canvas && !implSc, focus: implSc ? implSc.key : focus, sel, shown, ik, labelOf, infoOf, fileTarget, ver, apis, designNow, designSeq, ghostApis, ghostBatch, ghostQueue, setBackFrames, warned,
9862
10309
  onWarn: () => { if (pane !== 'export') openPane('export') } })
9863
10310
  const designId = JSON.stringify([sid, targetKey, ver ? ver.n : 0])
9864
10311
  if (designNow.current !== designId) { designNow.current = designId; designSeq.current++ }
@@ -9994,7 +10441,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
9994
10441
  }, 1500)
9995
10442
  return () => clearTimeout(timer)
9996
10443
  }, [ckReq])
9997
- const checkOff = !url || !!ver || !!demo || inMulti
10444
+ const checkOff = !url || !!ver || !!demo || inMulti || !!implSc
9998
10445
  // ── 业务标注(插件页的试验开关开着才有 st.annotations 这个键):面板和体检、版本共用右边那个位置;点选、改字、调样式、画笔时编号收起,退出后回来 ──
9999
10446
  useEffect(() => { setAnStates({}) }, [anFile ? anFile.sig : '']) // 文件变了(模型改过选择器):别的屏的旧结果作废,等页面重新报
10000
10447
  const toggleAn = () => {
@@ -10027,10 +10474,10 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10027
10474
  const k = Math.max(1, f.offsetWidth) / Math.max(1, r.width)
10028
10475
  api.annotHit((x - r.left) * k, (y - r.top) * k)
10029
10476
  }
10030
- const styleOff = !url || !!ver || !!demo || inMulti || busy
10477
+ const styleOff = !url || !!ver || !!demo || inMulti || busy || !!implSc
10031
10478
 
10032
10479
  // ── 画笔标注:画完把台面上看得到的几屏各截一张,按位置摆好,叠上画的东西,存进 refs/,路径放进输入框让模型用 read_image 看(不动剪贴板) ──
10033
- const markOff = !url || !!ver || !!demo || inMulti
10480
+ const markOff = !url || !!ver || !!demo || inMulti || !!implSc
10034
10481
  const toggleMark = () => {
10035
10482
  markRun.current++
10036
10483
  if (mark) { setMark(false); return }
@@ -10123,7 +10570,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10123
10570
  // 右上 外观 体检 | 导出 ▾ ⋯;底部中间 选择 改字 样式 画笔 | 试用;右下缩放(画布自己带)
10124
10571
  // 鼠标停一下出说明卡(HoverTip):名字 + 一句用途
10125
10572
  // 窄了(样式表里):先截屏名,再收字
10126
- const curKey = canvas ? '' : (focus || (screens[0] && screens[0].key) || '')
10573
+ const curKey = implSc ? implSc.key : canvas ? '' : (focus || (screens[0] && screens[0].key) || '') // 在和做出来的比:是比的那屏
10127
10574
  const curSc = screens.find((x) => x.key === curKey)
10128
10575
  // 产品名:画布上几屏标题都带它时认得出来;单页只拿得到一屏的标题,用记下的那个把它去掉(「订单 · 巷口面馆」→「订单」)
10129
10576
  const brand0 = splitTitles(shown.map(labelOf)).brand
@@ -10135,22 +10582,23 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10135
10582
  return p.length >= 2 && (p[0] === brand || p[p.length - 1] === brand) ? p.filter((y) => y !== brand).join(' · ') : x
10136
10583
  }
10137
10584
  const stLabel = (st && st.label) || ''
10138
- const scrLabel = canvas && screens.length > 1
10585
+ const scrLabel = canvas && screens.length > 1 && !implSc
10139
10586
  ? t('screensN', { name: brand || stLabel, n: screens.length })
10140
10587
  : curSc ? dropBrand(shortOf(curSc)) + (takeTag(curSc) ? ' · ' + takeTag(curSc) : '') : stLabel
10141
10588
  // 菜单里点某一屏:单看这一屏(「全部 n 屏」回画布)
10142
10589
  const pickScreen = (key) => {
10590
+ if (implSc) { implOpen(key); return } // 在和做出来的比:换成比这一屏
10143
10591
  setMulti(false)
10144
10592
  if (demo) setDemo(null)
10145
10593
  setSel(key)
10146
10594
  if (canvas || key !== focus || dr) openByUser(key)
10147
10595
  }
10148
10596
  // 导出菜单写出是哪一屏(和 doExport 取同一屏)
10149
- const exSc = shown.find((x) => x.key === (canvas ? sel || focus : focus)) || shown[0]
10597
+ const exSc = implSc || shown.find((x) => x.key === (canvas ? sel || focus : focus)) || shown[0]
10150
10598
  const exName = exSc ? dropBrand(shortOf(exSc)) + (takeTag(exSc) ? ' · ' + takeTag(exSc) : '') : ''
10151
10599
  const libOpen = () => { setLibFocus(''); if (lib) setLib(''); else libDefaultThen((k) => setLib((c) => c || k)) }
10152
- const onCanvas = canvas && !inMulti && !demo && homeAt !== 'on' && !(ver && cmp)
10153
- const toCanvas = () => { homeAway(); setMulti(false); setCmp(false); if (demo) setDemo(null); change({ view: 'canvas' }) }
10600
+ const onCanvas = canvas && !inMulti && !demo && homeAt !== 'on' && !(ver && cmp) && !implSc
10601
+ const toCanvas = () => { homeAway(); setMulti(false); setCmp(false); implClose(); if (demo) setDemo(null); change({ view: 'canvas' }) }
10154
10602
  const dockTight = box.w > 0 && box.w <= 400 // 侧栏很窄:底部工具坞只放得下四个,「试用」进「更多」
10155
10603
  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))
10156
10604
  const islands = editing
@@ -10163,9 +10611,9 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10163
10611
  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'))),
10164
10612
  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'))),
10165
10613
  h('span', { className: 'ddp-sep' }),
10166
- h(ScreenMenu, { t, hidden: hiddenN, hiddenText, label: scrLabel, tip: [scrLabel || stLabel, t('dScreen')], src: stLabel, busy, list: screens.map((x) => { const L = takeTag(x); return { key: x.key, label: dropBrand(shortOf(x)) + (L ? ' · ' + L : '') } }), cur: curKey, canvas: canvas && !inMulti && !demo, open: scrMenu, setOpen: setScrMenu,
10614
+ h(ScreenMenu, { t, hidden: hiddenN, hiddenText, label: scrLabel, tip: [scrLabel || stLabel, t('dScreen')], src: stLabel, busy, list: screens.map((x) => { const L = takeTag(x); return { key: x.key, label: dropBrand(shortOf(x)) + (L ? ' · ' + L : '') } }), cur: curKey, canvas: canvas && !inMulti && !demo && !implSc, open: scrMenu, setOpen: setScrMenu,
10167
10615
  onPick: pickScreen, onAll: toCanvas, onOther: () => setEditing(true),
10168
- sizes: mark ? null : { on: inMulti, off: !sizeSet || !!ver, tip: sizeSet ? t('sizes') : t('sizesNo'), note: sizeSet ? '' : t('sizesNoShort'), run: () => setMulti(!inMulti) },
10616
+ sizes: mark ? null : { on: inMulti, off: !sizeSet || !!ver, tip: sizeSet ? t('sizes') : t('sizesNo'), note: sizeSet ? '' : t('sizesNoShort'), run: () => { if (implSc) implClose(); setMulti(!inMulti) } },
10169
10617
  fit: kind === 'web' && !mark ? { on: webFit, note: size.join('×'), run: toggleFit } : null,
10170
10618
  kind, onKind: mark ? null : (k) => change({ kind: k }),
10171
10619
  // 自定义画幅(#23):外框类型的画幅跟着外框走,不让改
@@ -10181,6 +10629,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10181
10629
  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: [
10182
10630
  'hd:' + t('deliverCode'),
10183
10631
  ['', I.code, t('handoff'), pane === 'handoff', !!ver, () => openPane('handoff')],
10632
+ ['', I.overlay, t('implCmp'), !!implSc, !!ver || !exSc || implFar, () => (implSc ? implClose() : implOpen(exSc.key))],
10184
10633
  'hd:' + t('exFiles'),
10185
10634
  ...exportItems(t, kind, shown.length, exName).map(([mode, Icon, label]) => ['', Icon, label, false, false, () => doExport(mode)]),
10186
10635
  fileTarget ? 'hd:' + t('deliverShare') : null, // 只有本地的设计才能打包、分享
@@ -10188,7 +10637,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10188
10637
  fileTarget ? ['', I.share, t('exShare'), false, false, () => doExport('share')] : null,
10189
10638
  ], foot: t('exWhere') }),
10190
10639
  h(DropMenu, { t, cls: 'ddp-more', tip: [t('more'), phoneOn && !phone ? t('phoneOnTip') + ' · ' + t('dMore') : t('dMore')], icon: I.more, has: phoneOn && !phone, open: more, setOpen: setMore, items: [
10191
- dockTight ? ['', I.play, t('demoShort'), !!demo, !url || !!ver, toggleDemo] : null, // 侧栏太窄,底部工具坞放不下「试用」:挪到这里
10640
+ dockTight ? ['', I.play, t('demoShort'), !!demo, !url || !!ver, () => { if (implSc) implClose(); toggleDemo() }] : null, // 侧栏太窄,底部工具坞放不下「试用」:挪到这里
10192
10641
  dockTight ? 'sep' : null,
10193
10642
  ['', I.history, t('history'), hist || !!ver, !fileTarget, toggleHist],
10194
10643
  ['', I.scan, t('phone'), phone, !url, togglePhone, phoneOn ? t('phoneOnShort') : ''],
@@ -10197,7 +10646,16 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10197
10646
  ['', I.refresh, t('refresh'), false, false, reload],
10198
10647
  ['', I.external, t('external'), false, !url, url],
10199
10648
  ] }))),
10200
- h('div', { key: 'dock', className: 'ddp-isl ddp-dock', role: 'toolbar', 'aria-label': t('toolsT') },
10649
+ implSc ? h('div', { key: 'dock', className: 'ddp-isl ddp-dock ddp-ibar', role: 'toolbar', 'aria-label': t('implCmp') },
10650
+ tool('', implMode === 'split', t('dImplSplit'), false, () => setImplMode('split'), I.splitV, t('implSplit')),
10651
+ tool('', implMode === 'overlay', t('dImplOver'), false, () => setImplMode('overlay'), I.overlay, t('implOver')),
10652
+ tool('', implMode === 'side', t('dImplSide'), false, () => setImplMode('side'), I.sideBy, t('implSideBy')),
10653
+ implMode === 'overlay' ? h('span', { className: 'ddp-sep' }) : null,
10654
+ implMode === 'overlay' ? h('label', { className: 'ddp-iop', ...tipA(t('implOp'), t('dImplOp')) }, h('input', { type: 'range', min: 0, max: 100, step: 5, value: implOp, disabled: implDiff, 'aria-label': t('implOp'), onChange: (e) => setImplOp(Number(e.target.value)) }), h('span', null, implDiff ? '—' : implOp + '%')) : null,
10655
+ implMode === 'overlay' ? tool('', implDiff, t('dImplDiff'), false, () => setImplDiff(!implDiff), I.invert, t('implDiff')) : null,
10656
+ implRec && Array.isArray(implRec.boxes) && implRec.boxes.length ? h('span', { className: 'ddp-sep' }) : null,
10657
+ implRec && Array.isArray(implRec.boxes) && implRec.boxes.length ? tool('', implBoxes, t('dImplBoxes'), false, () => setImplBoxes(!implBoxes), I.boxes, t('implBoxes')) : null)
10658
+ : h('div', { key: 'dock', className: 'ddp-isl ddp-dock', role: 'toolbar', 'aria-label': t('toolsT') },
10201
10659
  tool('pick', picking, t('dPick'), !url || !!ver || !!demo || mark, togglePick, I.pick, t('pick')),
10202
10660
  tool('', textEdit, t('dText'), !url || !!ver || !!demo || busy || mark, toggleText, I.text, t('textShort')),
10203
10661
  tool('', styleEdit, t('dStyle'), styleOff || mark, toggleStyle, I.sliders, t('styleShort')),
@@ -10447,7 +10905,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10447
10905
  return h(ExportPanel, { t, kind, size, opts: xo, setOpts: setXo, screens: shown.map(ik).join('|'), rev: `${st ? st.rev : 0}|${reloadSeq}|${loadTick}`, measure: () => withFrames(measureAll), onResize: (s) => change({ size: s }), onExport: (format) => doExport(format, undefined, xo), onClose: () => setPane('') })
10448
10906
  }
10449
10907
  if (pane === 'handoff') {
10450
- return h(HandoffPanel, { t, sid, root: fileTarget ? st.target.root : '', fileTarget, count: screens.length, cur: (curScreen && curScreen.key) || focus, onGo: doHandoff, onSay: say, onClose: () => setPane('') })
10908
+ return h(HandoffPanel, { t, sid, root: fileTarget ? st.target.root : '', fileTarget, count: screens.length, cur: implSc ? implSc.key : (curScreen && curScreen.key) || focus, onGo: doHandoff, onSay: say, onClose: () => setPane('') })
10451
10909
  }
10452
10910
  return null
10453
10911
  }
@@ -10554,7 +11012,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10554
11012
 
10555
11013
  // 上下两排浮块中间那块的高度:单页、演示、对比按它缩放
10556
11014
  const ah = Math.max(0, box.h - TOP_R - BOT_R)
10557
- const cvBody = !demo && (inMulti || (canvas && !(ver && cmp)))
11015
+ const cvBody = !demo && (inMulti || (canvas && !(ver && cmp) && !implSc))
10558
11016
  let body
10559
11017
  let busyGap = false
10560
11018
  // 单看、演示、对比共用:网页铺满右侧栏(没开「按画幅显示」时),别的按画幅整屏缩放
@@ -10629,19 +11087,37 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10629
11087
  onTop: (dk) => setTop(ik(base) + '|' + i, dk),
10630
11088
  })),
10631
11089
  })
10632
- } else if (ver && cmp) {
10633
- // 对比:同一屏,左边那一版、右边现在,中间的把手左右拖
10634
- const k = canvas ? sel || focus : focus
10635
- const now = screens.find((x) => x.key === k) || screens[0]
10636
- const has = now && ver.screens.includes(now.key)
10637
- const old = now ? { key: now.key, id: `v${ver.n}|${now.key}`, v: ver.n, url: vbase + encodeURIComponent(now.key), label: now.label } : null
10638
- // 右边开着版本面板:手机这类有外框的让到面板左边(和单看时一样)
11090
+ } else if ((ver && cmp) || implSc) {
11091
+ // 对比:同一屏,左边那一版、右边现在,中间的把手左右拖;和做出来的比(#25)也按这个摆
11092
+ // 右边开着面板:手机这类有外框的让到面板左边(和单看时一样)
10639
11093
  const cmpSide = !!(ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240
10640
- // 网页铺满时也让(#22):按铺满时的大小定住(上面有版本横幅,少 46),整体缩到面板左边,不重排
11094
+ // 网页铺满时也让(#22):按铺满时的大小定住(上面有横幅,少 46),整体缩到面板左边,不重排
10641
11095
  const cmpLock = fill && cmpSide ? { w: box.w, h: ah - 46 } : null
10642
11096
  const aside = cmpSide && (!fill || cmpLock) ? 296 : 0
10643
11097
  const flat = fill && !cmpLock
10644
- const z = cmpLock ? Math.max(0.05, Math.min(1, (box.w - aside - 32) / cmpLock.w)) : fill ? 1 : Math.max(0.05, Math.min(1, (box.w - aside - 32) / dw, (ah - 16 - (ver ? 46 : 0)) / dh))
11098
+ const z = cmpLock ? Math.max(0.05, Math.min(1, (box.w - aside - 32) / cmpLock.w)) : fill ? 1 : Math.max(0.05, Math.min(1, (box.w - aside - 32) / dw, (ah - 16 - 46) / dh))
11099
+ if (implSc) {
11100
+ // 并排:两个按画幅并排缩进来(铺满的网页也按画幅,不然两边各占一半宽、和设计的尺寸对不上)
11101
+ const side = implMode === 'side'
11102
+ const GAP = 24
11103
+ const zs = Math.max(0.05, Math.min(1, (box.w - aside - 32 - GAP) / (dw * 2), (ah - 16 - 46) / dh))
11104
+ const sc = implSc
11105
+ body = h('div', { className: 'ddp-single', style: aside ? { right: aside } : undefined },
11106
+ h(ImplCompare, {
11107
+ t, mode: implMode, live: impl.live, z: side ? zs : z, flat: side ? false : flat, lock: side ? null : cmpLock, dw, dh, gap: GAP,
11108
+ kind, size, os: meta.os, label: labelOf(sc), top: tops[ik(sc)], rec: implRec, boxesOn: implBoxes, dark, reloadSeq,
11109
+ opacity: implOp, diff: implDiff, designKey: sc.key, onSlot: setImplSlot, onView: (v) => { implView.current = v }, onAway: setImplAway,
11110
+ fileKeys: fileTarget ? screens.map((x) => x.key) : null, onDesignNav: implOpen,
11111
+ missText: impl.busy ? t('implOpening') : t('implNeed'),
11112
+ renderDesign: (extra) => h(Screen, { t, remote, onPageDrag: pageDrag, src: sc.url, label: labelOf(sc), busy: false, born: false, picking: false, dark, zoom: side ? zs : z, reloadSeq, tweak,
11113
+ onMeta: (m, title, toks, dk) => remember(ik(sc), m, title, toks, dk), onTop: (dk) => setTop(ik(sc), dk), ...extra,
11114
+ ...(extra.apiKey === 'd' ? { alsoApis: apis.current, alsoKey: ik(sc) } : {}) }),
11115
+ }))
11116
+ } else {
11117
+ const k = canvas ? sel || focus : focus
11118
+ const now = screens.find((x) => x.key === k) || screens[0]
11119
+ const has = now && ver.screens.includes(now.key)
11120
+ const old = now ? { key: now.key, id: `v${ver.n}|${now.key}`, v: ver.n, url: vbase + encodeURIComponent(now.key), label: now.label } : null
10645
11121
  // 两边的小标签不跟着画面缩小(缩了看不清);手机、平板躲开状态栏
10646
11122
  const tagAt = (side) => ({ top: kind === 'app' || kind === 'miniprogram' || kind === 'tablet' ? 60 : 10, transform: `scale(${1 / z})`, transformOrigin: 'top ' + side })
10647
11123
  const screenOf = (sc) => h(Screen, { t, remote, onPageDrag: pageDrag, src: sc.url, label: labelOf(sc), busy: false, born: false, picking: false, dark, zoom: z, reloadSeq,
@@ -10658,6 +11134,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10658
11134
  h('div', { className: 'ddp-knob', style: { left: cx + '%' }, onPointerDown: dragKnob }, h('i')),
10659
11135
  h('span', { className: 'tag l', style: tagAt('left') }, t('vN', { n: ver.n })),
10660
11136
  h('span', { className: 'tag r', style: tagAt('right') }, t('cmpNow')))) : null))
11137
+ }
10661
11138
  } else if (canvas) {
10662
11139
  body = h(Canvas, {
10663
11140
  key: 'grid',
@@ -10719,7 +11196,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10719
11196
 
10720
11197
  return root(
10721
11198
  h('div', { className: 'ddp-stage isl' + (busy ? ' bz' : '') + (anOn ? ' an3' : ''), ref: stageRef },
10722
- h('div', { className: 'ddp-body' + (cvBody ? '' : ' pad' + (ver || demo || hintTop || busyGap ? ' vb' : '') + (ease ? ' ease' : '')) }, body),
11199
+ h('div', { className: 'ddp-body' + (cvBody ? '' : ' pad' + (ver || demo || implSc || hintTop || busyGap ? ' vb' : '') + (ease ? ' ease' : '')) }, body),
10723
11200
  busy ? h('div', { className: 'ddp-glow' }) : null,
10724
11201
  busy ? h('div', { className: 'ddp-ring' }) : null,
10725
11202
  busy ? busyBar(sideOpen) : null,
@@ -10810,8 +11287,26 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10810
11287
  h('button', { className: 'ddp-go sec' + (cmp ? ' on' : ''), onClick: () => setCmp(!cmp) }, t('compare')),
10811
11288
  h('button', { className: 'ddp-go pri', onClick: doRestore }, t('restore')),
10812
11289
  h('button', { className: 'ddp-btn', title: t('backNow'), onClick: () => { setVer(null); setCmp(false) } }, h(I.close))) : null,
11290
+ implSc ? h('div', { className: 'ddp-banner ddp-ibn' + side },
11291
+ h(I.overlay),
11292
+ h('b', null, t('implShort')),
11293
+ !impl.edit && !impl.url && impl.busy ? h('span', { className: 'nm' }, t('implOpening'))
11294
+ : impl.edit || !impl.url
11295
+ ? h(ImplUrlForm, { key: impl.key, t, initial: impl.url || implGuess(), busy: impl.busy, onGo: (v) => implLoad(impl.key, v), onCancel: impl.url ? implCancel : null })
11296
+ : h('button', { className: 'ddp-iurl', ...tipA(impl.url, t('dImplUrl')), onClick: () => setImpl((c) => (c ? { ...c, edit: true } : c)) }, impl.url.replace(/^https?:\/\//, '').replace(/^file:\/\/.*\//, '')),
11297
+ implAway && impl.url && !impl.edit
11298
+ ? h('button', { className: 'ddp-go', ...tipA(t('implHere'), t('dImplHere', { path: implAway })), onClick: () => { try { implLoad(impl.key, implAwayUrl(impl, implAway)) } catch { /* 认不出的地址 */ } } }, t('implHere'))
11299
+ : implRec && typeof implRec.pct === 'number' && !impl.edit
11300
+ ? h('button', { className: 'ddp-iscore' + (implRec.pct < 3 ? ' ok' : ''), ...tipA(t('implPct', { pct: implRec.pct.toFixed(1) }), t('dImplPct', { time: hhmm(implRec.when), who: implRec.by === 'model' ? t('implByModel') : t('implByYou') })),
11301
+ onClick: () => setImplShot(`${API}implshot?session=${encodeURIComponent(sid)}&screen=${encodeURIComponent(impl.key)}&v=${implRec.when}`) }, t('implPct', { pct: implRec.pct.toFixed(1) }))
11302
+ : null,
11303
+ impl.url && !impl.edit && !implAway ? h('button', { className: 'ddp-go sec', disabled: implRun, ...tipA(t('implRe'), t('dImplRe')), onClick: () => implRecompare(impl.key, (implMode !== 'side' && implView.current) || size, dark, impl.url) }, implRun ? t('implRunning') : t('implRe')) : null,
11304
+ h('button', { className: 'ddp-btn', ...tipA(t('implExit'), '', 'Esc'), onClick: implClose }, h(I.close))) : null,
11305
+ implShot ? h('div', { className: 'ddp-ishot', role: 'dialog', 'aria-label': t('implShotT'), onClick: () => setImplShot('') },
11306
+ h('img', { src: implShot, alt: t('implShotT'), onError: () => { setImplShot(''); say(t('implShotGone')) } }),
11307
+ h('span', null, t('implShotHow'))) : null,
10813
11308
  chip,
10814
- toast ? h('div', { className: 'ddp-toast' + (mark ? ' mk' : ver || demo ? ' low' : '') + (sideOpen && !mark ? ' side' : ''), role: 'status' }, h('span', null, toast.text),
11309
+ toast ? h('div', { className: 'ddp-toast' + (mark ? ' mk' : ver || demo || implSc ? ' low' : '') + (sideOpen && !mark ? ' side' : ''), role: 'status' }, h('span', null, toast.text),
10815
11310
  toast.act ? h('button', { onClick: () => { toast.act.run(); setToast('') } }, toast.act.label) : null) : null,
10816
11311
  ...islands,
10817
11312
  h(HoverTip, { key: 'tip' })))
@@ -10940,7 +11435,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
10940
11435
  // 注意:这里是客户端**服务名**(短的),不是包名
10941
11436
  exports.inject = INJECT
10942
11437
  // 测试用
10943
- exports._test = { makeDemoNav, KIND_LIST, KIND_KEY, KIND_SIZE, META_ALIAS, FIXED, SHOW_COLS, FRAME, ASK_EX, ASK_KINDS, KIND_ICON: I, pollGap, webFitOf, precheckOf, fitCanvas, layoutOk, fitHOk, autoSize, pulseStep, MarketDetail, dragKind, droppedOf, pickInfo, pickLabel, pickRanges, pickRule, chipOf, chipRanges, makeT, ZH, EN, formatCheck, formatTweaks, markHit, markPath, STYLES, formatStyle, accentUse, autoStyle, styleLook, padInsert, pageOf, pxOf, styleChanges, formatStyleAsk, takesOf, formatCheckTool, poller, frameOf, paletteOf, formatRef, layoutRow, keyOfPath, flowsOf, flowLines, flowMarks, formatPick, whereOf, parseMeta, sizeOf, layoutGrid, fitCam, nearestLive, LIVE_MAX, tokenKind, formatToken, splitTitles, pickColors, hhmm, formatTpl, formatPrep, styleFromTokens, myStyleOf, isZipFile }
11438
+ exports._test = { makeDemoNav, implLayout, implAwayUrl, KIND_LIST, KIND_KEY, KIND_SIZE, META_ALIAS, FIXED, SHOW_COLS, FRAME, ASK_EX, ASK_KINDS, KIND_ICON: I, pollGap, webFitOf, precheckOf, fitCanvas, layoutOk, fitHOk, autoSize, pulseStep, MarketDetail, dragKind, droppedOf, pickInfo, pickLabel, pickRanges, pickRule, chipOf, chipRanges, makeT, ZH, EN, formatCheck, formatTweaks, markHit, markPath, STYLES, formatStyle, accentUse, autoStyle, styleLook, padInsert, pageOf, pxOf, styleChanges, formatStyleAsk, takesOf, formatCheckTool, poller, frameOf, paletteOf, formatRef, layoutRow, keyOfPath, flowsOf, flowLines, flowMarks, formatPick, whereOf, parseMeta, sizeOf, layoutGrid, fitCam, nearestLive, LIVE_MAX, tokenKind, formatToken, splitTitles, pickColors, hhmm, formatTpl, formatPrep, styleFromTokens, myStyleOf, isZipFile }
10944
11439
  return module.exports
10945
11440
  },
10946
11441
  })