poi-plugin-inventory-cleaner 1.13.1 → 1.14.1

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/i18n/en-US.json CHANGED
@@ -23,6 +23,12 @@
23
23
  "stock.verdictDepends": "Depends on fleet",
24
24
  "stock.verdictUnknown": "Not in guide",
25
25
  "stock.materialNote": "Used as material: {{text}}",
26
+ "stock.materialNoteTitle": "Used as material by",
27
+ "stock.consumeImprove": "improvement",
28
+ "stock.consumeQuestScrap": "quest (scrap)",
29
+ "stock.consumeQuestEquip": "quest (equip)",
30
+ "stock.consumeQuestStore": "quest (store)",
31
+ "stock.consumeOther": "other",
26
32
  "stock.keepLabel": "Keep",
27
33
  "stock.keepUnit": "",
28
34
  "stock.keepPlaceholder": "guide",
package/i18n/zh-CN.json CHANGED
@@ -23,6 +23,12 @@
23
23
  "stock.verdictDepends": "看舰队需求",
24
24
  "stock.verdictUnknown": "攻略未收录",
25
25
  "stock.materialNote": "素材用途:{{text}}",
26
+ "stock.materialNoteTitle": "素材用途",
27
+ "stock.consumeImprove": "改修",
28
+ "stock.consumeQuestScrap": "任务·拆",
29
+ "stock.consumeQuestEquip": "任务·装",
30
+ "stock.consumeQuestStore": "任务·库",
31
+ "stock.consumeOther": "其他",
26
32
  "stock.keepLabel": "保留",
27
33
  "stock.keepUnit": "件",
28
34
  "stock.keepPlaceholder": "攻略",
package/index.js CHANGED
@@ -115,6 +115,18 @@ const VIEWS = [
115
115
  { id: 'plan', labelKey: 'stock.filterPlan' },
116
116
  ]
117
117
 
118
+ const CONSUME_LABELS = {
119
+ 锤: 'stock.consumeImprove',
120
+ 拆: 'stock.consumeQuestScrap',
121
+ 装: 'stock.consumeQuestEquip',
122
+ 库: 'stock.consumeQuestStore',
123
+ }
124
+
125
+ function consumeLabel(tag) {
126
+ const key = CONSUME_LABELS[tag]
127
+ return key ? t(key) : t('stock.consumeOther')
128
+ }
129
+
118
130
  const VERDICT = {
119
131
  scrap: { className: 'is-scrap', labelKey: 'stock.verdictScrap' },
120
132
  keepSome: { className: 'is-keepsome', labelKey: 'stock.verdictKeepSome' },
@@ -345,11 +357,23 @@ function StockRow({ row, onKeepChange }) {
345
357
  row.usage
346
358
  ? h('p', { className: 'stock-note', title: row.usage }, row.usage)
347
359
  : null,
348
- row.consumed
360
+ row.consumedItems && row.consumedItems.length
349
361
  ? h(
350
- 'p',
351
- { className: 'stock-consume', title: row.consumed },
352
- t('stock.materialNote', { text: row.consumed }),
362
+ 'div',
363
+ { className: 'stock-consume' },
364
+ h('div', { className: 'stock-consume-title' }, t('stock.materialNoteTitle')),
365
+ h(
366
+ 'ol',
367
+ { className: 'stock-consume-list' },
368
+ row.consumedItems.map((item, index) =>
369
+ h(
370
+ 'li',
371
+ { key: index, className: 'is-' + item.kind },
372
+ h('span', { className: 'stock-consume-tag' }, consumeLabel(item.tag)),
373
+ h('span', { className: 'stock-consume-text' }, item.text),
374
+ ),
375
+ ),
376
+ ),
353
377
  )
354
378
  : null,
355
379
  )
package/lib/inventory.js CHANGED
@@ -26,6 +26,39 @@ function toNumber(value, fallback = 0) {
26
26
  return Number.isFinite(number) ? number : fallback
27
27
  }
28
28
 
29
+ const CONSUME_KINDS = {
30
+ 锤: 'improve',
31
+ 拆: 'quest',
32
+ 装: 'quest',
33
+ 库: 'quest',
34
+ }
35
+
36
+ /**
37
+ * 把「《锤》xxx《拆》yyy」这种素材用途串拆成条目,任务类排在改修类前面。
38
+ */
39
+ function parseConsumed(text) {
40
+ const value = String(text || '').trim()
41
+ if (!value) return []
42
+
43
+ const parts = value
44
+ .split(/(?=《)/)
45
+ .map((part) => part.trim())
46
+ .filter(Boolean)
47
+
48
+ const items = parts.map((raw) => {
49
+ const matched = raw.match(/^《([^》]{1,3})》\s*(.*)$/)
50
+ const tag = matched ? matched[1] : ''
51
+ const detail = matched ? matched[2] : raw
52
+ return { tag, kind: CONSUME_KINDS[tag] || 'other', text: detail }
53
+ })
54
+
55
+ const rank = { quest: 0, improve: 1, other: 2 }
56
+ return items
57
+ .map((item, index) => ({ item, index }))
58
+ .sort((a, b) => rank[a.item.kind] - rank[b.item.kind] || a.index - b.index)
59
+ .map(({ item }) => item)
60
+ }
61
+
29
62
  function equipName(equipId) {
30
63
  const pair = INDEX[String(equipId)] || []
31
64
  return { jp: pair[0] || '', cn: pair[1] || '' }
@@ -118,6 +151,7 @@ function buildInventory(state, options = {}) {
118
151
  usage: rule ? rule.usage : '',
119
152
  obtain: rule ? rule.obtain : '',
120
153
  consumed,
154
+ consumedItems: parseConsumed(consumed),
121
155
  stage: guide ? guide.stage : '',
122
156
  note: guide ? guide.note : '',
123
157
  inPlan,
@@ -249,6 +283,7 @@ function filterRows(rows, options = {}) {
249
283
 
250
284
  module.exports = {
251
285
  OTHER_CATEGORY,
286
+ parseConsumed,
252
287
  SORTS,
253
288
  sortRows,
254
289
  applyCategoryKeep,
package/lib/style.js CHANGED
@@ -347,7 +347,7 @@ const CSS = `
347
347
  gap: 12px;
348
348
  flex-wrap: wrap;
349
349
  margin-top: 4px;
350
- font-size: 11px;
350
+ font-size: 12px;
351
351
  opacity: 0.68;
352
352
  font-variant-numeric: tabular-nums;
353
353
  }
@@ -372,8 +372,8 @@ const CSS = `
372
372
 
373
373
  .stock-note {
374
374
  margin: 6px 0 0;
375
- font-size: 11px;
376
- line-height: 1.6;
375
+ font-size: 12.5px;
376
+ line-height: 1.65;
377
377
  opacity: 0.7;
378
378
  white-space: normal;
379
379
  overflow-wrap: anywhere;
@@ -381,11 +381,65 @@ const CSS = `
381
381
  }
382
382
 
383
383
  .stock-consume {
384
- margin: 4px 0 0;
385
- font-size: 10px;
386
- line-height: 1.55;
384
+ margin: 7px 0 0;
385
+ font-size: 12.5px;
386
+ line-height: 1.6;
387
+ opacity: 0.62;
388
+ }
389
+
390
+ .stock-consume-title {
391
+ margin-bottom: 3px;
392
+ font-size: 11.5px;
393
+ opacity: 0.85;
394
+ }
395
+
396
+ .stock-consume-list {
397
+ margin: 0;
398
+ padding: 0;
399
+ list-style: none;
400
+ display: grid;
401
+ gap: 2px;
402
+ counter-reset: consume;
403
+ }
404
+
405
+ .stock-consume-list li {
406
+ display: flex;
407
+ align-items: baseline;
408
+ gap: 6px;
409
+ counter-increment: consume;
410
+ }
411
+
412
+ .stock-consume-list li::before {
413
+ content: counter(consume) '.';
414
+ flex: none;
415
+ min-width: 14px;
416
+ text-align: right;
387
417
  opacity: 0.45;
388
- white-space: normal;
418
+ font-variant-numeric: tabular-nums;
419
+ }
420
+
421
+ .stock-consume-tag {
422
+ flex: none;
423
+ padding: 0 6px;
424
+ border-radius: 4px;
425
+ background: var(--stock-surface-2);
426
+ font-size: 10.5px;
427
+ white-space: nowrap;
428
+ }
429
+
430
+ .stock-consume-list li.is-quest .stock-consume-tag {
431
+ color: var(--stock-amber);
432
+ background: rgba(245, 158, 11, 0.16);
433
+ }
434
+
435
+ .stock-consume-list li.is-improve .stock-consume-tag {
436
+ color: var(--stock-cyan);
437
+ background: rgba(6, 182, 212, 0.14);
438
+ }
439
+
440
+ .stock-consume-text {
441
+ flex: 1 1 auto;
442
+ min-width: 0;
389
443
  overflow-wrap: anywhere;
390
444
  word-break: break-word;
391
445
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poi-plugin-inventory-cleaner",
3
- "version": "1.13.1",
3
+ "version": "1.14.1",
4
4
  "description": "库存清理大师:对照改修攻略与保留上限,找出囤积过量、可以清理的装备,并标出不能拆的改修材料。",
5
5
  "main": "index.js",
6
6
  "files": [