@240xu/dsh-message-ops 0.11.5 → 0.11.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/client.js +31 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@240xu/dsh-message-ops",
3
- "version": "0.11.5",
3
+ "version": "0.11.7",
4
4
  "description": "DSH web 插件:消息级回滚 / 删除 / 恢复(补 dsh 官方没有的部分)。分支与导出用官方内置能力。",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/client.js CHANGED
@@ -425,13 +425,36 @@ window.__ModuleLoader__.load({
425
425
  }
426
426
 
427
427
  // 头部按钮图标:三叉分支(git-branch 风格,16x16)。
428
+ // ⚠️ 这条 path 是按**描边**(stroke)设计的:圆点用 arc 画、连接线用
429
+ // `v3.44` / `V6.28` / `v.85` 这类**零宽度线段**。若用 fill 渲染,线段没有
430
+ // 面积 → 整条分支线消失,只剩几个孤立色块(0.11.x 实测症状:
431
+ // 「那个 svg 渲染有问题」)。必须 stroke + round cap/join。
432
+ // 唯一数据源:所有图标入口(React 组件 / innerHTML 字符串)都从这里取,
433
+ // 以免再次出现「一处改名、另一处仍用旧名 → d="undefined"」的回归。
428
434
  const BRANCH_PATH = 'M5 2.5a2 2 0 1 1-.9 3.78v3.44a2 2 0 1 1-1.2 0V6.28A2 2 0 1 1 5 2.5Zm0 1.2a.8.8 0 1 0 0 1.6.8.8 0 0 0 0-1.6ZM3.5 11.5a.8.8 0 1 0 1.6 0 .8.8 0 0 0-1.6 0ZM12.5 2.5a2 2 0 0 1 .6 3.9v.85c0 1.9-1.54 3.44-3.44 3.44H8.03a2 2 0 1 1 0-1.2h1.63a2.24 2.24 0 0 0 2.24-2.24V6.4a2 2 0 0 1 .6-3.9Zm0 1.2a.8.8 0 1 0 0 1.6.8.8 0 0 0 0-1.6Z'
435
+ const BRANCH_STROKE = 1.4
436
+
437
+ /** 生成分支图标的 SVG 标记(供 innerHTML 场景复用)。 */
438
+ function branchIconMarkup(size) {
439
+ const px = size || 16
440
+ return '<svg width="' + px + '" height="' + px + '" viewBox="0 0 16 16" fill="none"'
441
+ + ' xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"'
442
+ + ' style="flex:none"><path d="' + BRANCH_PATH + '" fill="none"'
443
+ + ' stroke="currentColor" stroke-width="' + BRANCH_STROKE + '"'
444
+ + ' stroke-linecap="round" stroke-linejoin="round"/></svg>'
445
+ }
429
446
 
430
447
  function BranchIcon() {
431
448
  return React.createElement('svg', {
432
449
  width: 16, height: 16, viewBox: '0 0 16 16', fill: 'none',
433
450
  xmlns: 'http://www.w3.org/2000/svg',
434
- }, React.createElement('path', { d: BRANCH_PATH, fill: 'currentColor' }))
451
+ 'aria-hidden': 'true', focusable: 'false',
452
+ }, React.createElement('path', {
453
+ d: BRANCH_PATH,
454
+ stroke: 'currentColor', strokeWidth: BRANCH_STROKE,
455
+ strokeLinecap: 'round', strokeLinejoin: 'round',
456
+ fill: 'none',
457
+ }))
435
458
  }
436
459
 
437
460
  // --- 共享对话框 -------------------------------------------------------------
@@ -758,8 +781,11 @@ window.__ModuleLoader__.load({
758
781
  const tag = document.createElement('style')
759
782
  tag.id = 'dsh-message-ops-panel-style'
760
783
  tag.textContent = [
761
- '.mopsPanelScrim{position:fixed;inset:0;z-index:1200;background:rgba(15,17,21,.18);display:flex;justify-content:flex-end}',
762
- '.mopsPanel{width:560px;max-width:100vw;height:100%;display:flex;flex-direction:column;background:var(--dsw-alias-bg-primary,#fff);color:var(--dsw-alias-label-primary,#0f1115);border-left:1px solid var(--dsw-alias-border-l2,#e6e6e6);box-shadow:-16px 0 48px rgba(15,17,21,.14);font-family:inherit;font-size:13px;line-height:1.45}',
784
+ '.mopsPanelScrim{position:fixed;inset:0;z-index:1200;background:rgba(15,17,21,.28);display:flex;align-items:center;justify-content:center;padding:24px;animation:mopsFade .12s ease-out}',
785
+ '@keyframes mopsFade{from{opacity:0}to{opacity:1}}',
786
+ '@keyframes mopsRise{from{opacity:0;transform:translateY(8px) scale(.985)}to{opacity:1;transform:none}}',
787
+ '.mopsPanel{width:560px;max-width:min(560px,100%);height:min(760px,100%);max-height:100%;display:flex;flex-direction:column;background:var(--dsw-alias-bg-primary,#fff);color:var(--dsw-alias-label-primary,#0f1115);border:1px solid var(--dsw-alias-border-l2,#e6e6e6);box-shadow:0 24px 64px rgba(15,17,21,.24);font-family:inherit;font-size:13px;line-height:1.45;animation:mopsRise .16s cubic-bezier(.2,.8,.3,1)}',
788
+ '@media(prefers-reduced-motion:reduce){.mopsPanelScrim,.mopsPanel{animation:none}}',
763
789
  '.mopsPanel *{box-sizing:border-box}',
764
790
  '.mopsPanel button{font:inherit;color:inherit;border-radius:0}',
765
791
  '.mopsPanelHead{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:16px 18px 12px;border-bottom:1px solid var(--dsw-alias-border-l2,#e6e6e6)}',
@@ -825,7 +851,7 @@ window.__ModuleLoader__.load({
825
851
  '.mopsTrashMain{flex:1;min-width:0}',
826
852
  '.mopsTrashTitle{font-size:12px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
827
853
  '.mopsTrashMeta{font-size:10px;color:var(--dsw-alias-label-tertiary,#8a8a8e);margin-top:2px}',
828
- '@media(max-width:760px){.mopsPanel{width:100vw;border-left:0}.mopsDetail{max-height:42%}}',
854
+ '@media(max-width:760px){.mopsPanelScrim{padding:0}.mopsPanel{width:100%;height:100%;max-width:100%;max-height:100%;border:0}.mopsDetail{max-height:42%}}',
829
855
  ].join('')
830
856
  document.head.appendChild(tag)
831
857
  } catch { /* style failure must not break the panel */ }
@@ -2717,7 +2743,7 @@ window.__ModuleLoader__.load({
2717
2743
  'font:inherit', 'font-size:13px', 'line-height:20px',
2718
2744
  'text-align:left', 'border-radius:6px', 'cursor:pointer',
2719
2745
  ].join(';')
2720
- item.innerHTML = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" style="flex:none"><path d="' + BRANCH_PATH + '" fill="currentColor"/></svg><span></span>'
2746
+ item.innerHTML = branchIconMarkup(16) + '<span></span>'
2721
2747
  item.querySelector('span').textContent = __t('menu.ops')
2722
2748
  item.addEventListener('mouseenter', function () {
2723
2749
  item.style.background = 'var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.14))'