dsh-skill-harbor 0.3.1 → 0.3.2

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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-skill-harbor",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "main": "./lib/index.js",
5
5
  "description": "技能港湾:技能发现、遮蔽判定、审计与市场管理(基础骨架)",
6
6
  "engines": {
@@ -37,6 +37,14 @@ function injectStyles() {
37
37
  .dshh-verdict[data-v="warn"] { background: #ed6c0233; color: #ff9800; }
38
38
  .dshh-verdict[data-v="fail"] { background: #c6282833; color: #f44336; }
39
39
  .dshh-verdict[data-v="skipped"] { background: #9e9e9e33; color: #9e9e9e; }
40
+ .dshh-dup-panel { border: 1px solid var(--dsw-alias-border, #3334); border-radius: 6px; padding: 10px; margin-bottom: 12px; }
41
+ .dshh-dup-heading { font-weight: 600; margin-bottom: 8px; }
42
+ .dshh-dup-group { margin-bottom: 10px; }
43
+ .dshh-dup-group:last-child { margin-bottom: 0; }
44
+ .dshh-dup-title { font-size: 12px; opacity: 0.75; margin-bottom: 4px; }
45
+ .dshh-dup-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 12px; }
46
+ .dshh-dup-meta { opacity: 0.6; }
47
+ .dshh-dup-winner { color: #4caf50; font-weight: 600; }
40
48
  `
41
49
  document.head.appendChild(style)
42
50
  }
@@ -99,6 +107,52 @@ export function createPanel(options = {}) {
99
107
  return el('div', { className: 'dshh-empty', text: t.noSkills })
100
108
  }
101
109
 
110
+ return el('div', {}, [
111
+ // 同名冲突先给树状视图:谁的 rank 高、谁被压住
112
+ state.duplicates.length > 0 ? renderDuplicates() : el('span', {}),
113
+ renderTable(),
114
+ ])
115
+ }
116
+
117
+ /**
118
+ * 遮蔽关系树:一组同名技能按 rank 升序竖排,
119
+ * 胜者标「胜出」,其余标注被谁压住。
120
+ */
121
+ function renderDuplicates() {
122
+ const groups = state.duplicates.map(group => {
123
+ // 从 skills 里捞出该组的全部条目(list 已按 rank 排序)
124
+ const entries = state.skills
125
+ .filter(skill => skill.name.toLowerCase() === group.name.toLowerCase())
126
+ .sort((a, b) => a.rank - b.rank)
127
+
128
+ const rows = entries.map((skill, index) => {
129
+ const isWinner = index === 0
130
+ return el('div', {
131
+ className: isWinner ? 'dshh-dup-row' : 'dshh-dup-row dshh-shadowed',
132
+ style: `padding-left:${index * 16}px`,
133
+ }, [
134
+ el('span', { text: isWinner ? '▼ ' : ' └ ' }),
135
+ el('span', { text: `${skill.name} ` }),
136
+ el('span', { className: 'dshh-dup-meta', text: `${sourceLabel(t, skill.source)} (rank ${skill.rank})` }),
137
+ isWinner
138
+ ? el('span', { className: 'dshh-dup-winner', text: ` — ${t.winner}` })
139
+ : el('span', { className: 'dshh-shadow-tag', text: ` — ${t.shadowedBy}` }),
140
+ ])
141
+ })
142
+
143
+ return el('div', { className: 'dshh-dup-group' }, [
144
+ el('div', { className: 'dshh-dup-title', text: `${t.duplicateGroup}: ${group.name}` }),
145
+ ...rows,
146
+ ])
147
+ })
148
+
149
+ return el('div', { className: 'dshh-dup-panel' }, [
150
+ el('div', { className: 'dshh-dup-heading', text: t.duplicateGroup }),
151
+ ...groups,
152
+ ])
153
+ }
154
+
155
+ function renderTable() {
102
156
  const rows = state.skills.map(skill => {
103
157
  const shadowed = skill.shadowedBy !== null
104
158
  const cells = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-skill-harbor",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "DSH 技能港湾:技能发现、遮蔽判定、审计与市场管理插件(基础骨架)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -37,6 +37,14 @@ function injectStyles() {
37
37
  .dshh-verdict[data-v="warn"] { background: #ed6c0233; color: #ff9800; }
38
38
  .dshh-verdict[data-v="fail"] { background: #c6282833; color: #f44336; }
39
39
  .dshh-verdict[data-v="skipped"] { background: #9e9e9e33; color: #9e9e9e; }
40
+ .dshh-dup-panel { border: 1px solid var(--dsw-alias-border, #3334); border-radius: 6px; padding: 10px; margin-bottom: 12px; }
41
+ .dshh-dup-heading { font-weight: 600; margin-bottom: 8px; }
42
+ .dshh-dup-group { margin-bottom: 10px; }
43
+ .dshh-dup-group:last-child { margin-bottom: 0; }
44
+ .dshh-dup-title { font-size: 12px; opacity: 0.75; margin-bottom: 4px; }
45
+ .dshh-dup-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 12px; }
46
+ .dshh-dup-meta { opacity: 0.6; }
47
+ .dshh-dup-winner { color: #4caf50; font-weight: 600; }
40
48
  `
41
49
  document.head.appendChild(style)
42
50
  }
@@ -99,6 +107,52 @@ export function createPanel(options = {}) {
99
107
  return el('div', { className: 'dshh-empty', text: t.noSkills })
100
108
  }
101
109
 
110
+ return el('div', {}, [
111
+ // 同名冲突先给树状视图:谁的 rank 高、谁被压住
112
+ state.duplicates.length > 0 ? renderDuplicates() : el('span', {}),
113
+ renderTable(),
114
+ ])
115
+ }
116
+
117
+ /**
118
+ * 遮蔽关系树:一组同名技能按 rank 升序竖排,
119
+ * 胜者标「胜出」,其余标注被谁压住。
120
+ */
121
+ function renderDuplicates() {
122
+ const groups = state.duplicates.map(group => {
123
+ // 从 skills 里捞出该组的全部条目(list 已按 rank 排序)
124
+ const entries = state.skills
125
+ .filter(skill => skill.name.toLowerCase() === group.name.toLowerCase())
126
+ .sort((a, b) => a.rank - b.rank)
127
+
128
+ const rows = entries.map((skill, index) => {
129
+ const isWinner = index === 0
130
+ return el('div', {
131
+ className: isWinner ? 'dshh-dup-row' : 'dshh-dup-row dshh-shadowed',
132
+ style: `padding-left:${index * 16}px`,
133
+ }, [
134
+ el('span', { text: isWinner ? '▼ ' : ' └ ' }),
135
+ el('span', { text: `${skill.name} ` }),
136
+ el('span', { className: 'dshh-dup-meta', text: `${sourceLabel(t, skill.source)} (rank ${skill.rank})` }),
137
+ isWinner
138
+ ? el('span', { className: 'dshh-dup-winner', text: ` — ${t.winner}` })
139
+ : el('span', { className: 'dshh-shadow-tag', text: ` — ${t.shadowedBy}` }),
140
+ ])
141
+ })
142
+
143
+ return el('div', { className: 'dshh-dup-group' }, [
144
+ el('div', { className: 'dshh-dup-title', text: `${t.duplicateGroup}: ${group.name}` }),
145
+ ...rows,
146
+ ])
147
+ })
148
+
149
+ return el('div', { className: 'dshh-dup-panel' }, [
150
+ el('div', { className: 'dshh-dup-heading', text: t.duplicateGroup }),
151
+ ...groups,
152
+ ])
153
+ }
154
+
155
+ function renderTable() {
102
156
  const rows = state.skills.map(skill => {
103
157
  const shadowed = skill.shadowedBy !== null
104
158
  const cells = [