dsh-token-receipt 1.1.1 → 1.2.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/CHANGELOG.md +8 -0
- package/client.js +23 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## 1.2.0
|
|
6
|
+
|
|
7
|
+
Released on 2026-11-17.
|
|
8
|
+
|
|
9
|
+
- Show the full receipt generation timestamp with year, month, day, hour, minute, and second.
|
|
10
|
+
- Remove the fixed `1 USD ≈ 6.67 CNY` exchange-rate note from CNY receipts.
|
|
11
|
+
- Increase receipt paper font sizes by 1–2px across headings, model rows, totals, metadata, and barcode text for better readability.
|
|
12
|
+
|
|
5
13
|
## 1.1.1
|
|
6
14
|
|
|
7
15
|
Released on 2026-11-17.
|
package/client.js
CHANGED
|
@@ -11,7 +11,7 @@ window.__ModuleLoader__.load({
|
|
|
11
11
|
const NS = 'token-receipt'
|
|
12
12
|
const PANEL = 'token-receipt'
|
|
13
13
|
/** Kept in sync with package.json by tests/version-guard.test.js. */
|
|
14
|
-
const CLIENT_VERSION = '1.
|
|
14
|
+
const CLIENT_VERSION = '1.2.0'
|
|
15
15
|
const DAY_MS = 24 * 60 * 60 * 1000
|
|
16
16
|
const MIN_PROCESSING_MS = 850
|
|
17
17
|
const EXPORT_SCALE = 3
|
|
@@ -101,7 +101,6 @@ window.__ModuleLoader__.load({
|
|
|
101
101
|
partialPrice: '有 {n} 次请求未计价,金额为部分小计。',
|
|
102
102
|
unavailablePrice: '价格暂不可用,用量已保留。',
|
|
103
103
|
stalePrice: '使用上次获取的价格,稍后可重试。',
|
|
104
|
-
exchangeRate: '人民币按 1 USD ≈ 6.67 CNY 换算。',
|
|
105
104
|
unpriced: '未计价',
|
|
106
105
|
priceRetry: '重新获取价格',
|
|
107
106
|
fetchError: '读取用量失败',
|
|
@@ -177,7 +176,6 @@ window.__ModuleLoader__.load({
|
|
|
177
176
|
partialPrice: '{n} requests unpriced; subtotal excludes them.',
|
|
178
177
|
unavailablePrice: 'Prices unavailable. Usage is still recorded.',
|
|
179
178
|
stalePrice: 'Using previously fetched prices. Retry to refresh.',
|
|
180
|
-
exchangeRate: 'CNY converted at 1 USD ≈ 6.67 CNY.',
|
|
181
179
|
unpriced: 'Unpriced',
|
|
182
180
|
priceRetry: 'Retry prices',
|
|
183
181
|
fetchError: 'Could not read usage',
|
|
@@ -253,7 +251,6 @@ window.__ModuleLoader__.load({
|
|
|
253
251
|
partialPrice: "{n} 件は料金未計算のため、小計に含まれません。",
|
|
254
252
|
unavailablePrice: "料金を取得できません。使用量は保持されています。",
|
|
255
253
|
stalePrice: "前回取得した料金を使用中です。後ほど再試行してください。",
|
|
256
|
-
exchangeRate: "人民元は 1 USD ≈ 6.67 CNY で換算。",
|
|
257
254
|
unpriced: "料金未計算",
|
|
258
255
|
priceRetry: "料金を再取得",
|
|
259
256
|
fetchError: "使用量を読み込めませんでした",
|
|
@@ -471,39 +468,39 @@ body[data-ds-dark-theme] .tr-slot { border-color: var(--tr-g1); background: var(
|
|
|
471
468
|
100% { transform: translateY(0); }
|
|
472
469
|
}
|
|
473
470
|
|
|
474
|
-
.tr-paper { position: relative; z-index: 1; width: 100%; min-height: 20rem; padding: 28px 24px 32px; background-color: var(--tr-paper-bg); background-image: url("data:image/svg+xml;base64,${PAPER_TEXTURE}"); background-size: cover; background-blend-mode: soft-light; color: var(--tr-paper-ink); font-family: "TokenReceiptMono", "JetBrains Mono", "JetBrains Mono Fallback", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-monospace, SFMono-Regular, Menlo, monospace; font-size:
|
|
471
|
+
.tr-paper { position: relative; z-index: 1; width: 100%; min-height: 20rem; padding: 28px 24px 32px; background-color: var(--tr-paper-bg); background-image: url("data:image/svg+xml;base64,${PAPER_TEXTURE}"); background-size: cover; background-blend-mode: soft-light; color: var(--tr-paper-ink); font-family: "TokenReceiptMono", "JetBrains Mono", "JetBrains Mono Fallback", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 4px), 98.75% 100%, 97.5% calc(100% - 4px), 96.25% 100%, 95% calc(100% - 4px), 93.75% 100%, 92.5% calc(100% - 4px), 91.25% 100%, 90% calc(100% - 4px), 88.75% 100%, 87.5% calc(100% - 4px), 86.25% 100%, 85% calc(100% - 4px), 83.75% 100%, 82.5% calc(100% - 4px), 81.25% 100%, 80% calc(100% - 4px), 78.75% 100%, 77.5% calc(100% - 4px), 76.25% 100%, 75% calc(100% - 4px), 73.75% 100%, 72.5% calc(100% - 4px), 71.25% 100%, 70% calc(100% - 4px), 68.75% 100%, 67.5% calc(100% - 4px), 66.25% 100%, 65% calc(100% - 4px), 63.75% 100%, 62.5% calc(100% - 4px), 61.25% 100%, 60% calc(100% - 4px), 58.75% 100%, 57.5% calc(100% - 4px), 56.25% 100%, 55% calc(100% - 4px), 53.75% 100%, 52.5% calc(100% - 4px), 51.25% 100%, 50% calc(100% - 4px), 48.75% 100%, 47.5% calc(100% - 4px), 46.25% 100%, 45% calc(100% - 4px), 43.75% 100%, 42.5% calc(100% - 4px), 41.25% 100%, 40% calc(100% - 4px), 38.75% 100%, 37.5% calc(100% - 4px), 36.25% 100%, 35% calc(100% - 4px), 33.75% 100%, 32.5% calc(100% - 4px), 31.25% 100%, 30% calc(100% - 4px), 28.75% 100%, 27.5% calc(100% - 4px), 26.25% 100%, 25% calc(100% - 4px), 23.75% 100%, 22.5% calc(100% - 4px), 21.25% 100%, 20% calc(100% - 4px), 18.75% 100%, 17.5% calc(100% - 4px), 16.25% 100%, 15% calc(100% - 4px), 13.75% 100%, 12.5% calc(100% - 4px), 11.25% 100%, 10% calc(100% - 4px), 8.75% 100%, 7.5% calc(100% - 4px), 6.25% 100%, 5% calc(100% - 4px), 3.75% 100%, 2.5% calc(100% - 4px), 1.25% 100%, 0% calc(100% - 4px)); }
|
|
475
472
|
.tr-page:lang(ja) { font-family: "TokenReceiptInter", Inter, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, "Noto Sans JP", sans-serif; }
|
|
476
473
|
.tr-page:lang(ja) .tr-paper { font-family: "TokenReceiptMono", "JetBrains Mono", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, "Noto Sans JP", monospace; }
|
|
477
474
|
.tr-paper-head { text-align: center; }
|
|
478
475
|
.tr-paper-logo { display: block; width: 40px; height: 40px; margin: 0 auto; color: var(--tr-paper-ink); opacity: .9; }
|
|
479
|
-
.tr-paper-kicker { margin: 13px 0 0; font-size:
|
|
480
|
-
.tr-paper-date { margin: 4px 0 0; color: var(--tr-paper-ink); opacity: .55; font-size:
|
|
476
|
+
.tr-paper-kicker { margin: 13px 0 0; font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
|
|
477
|
+
.tr-paper-date { margin: 4px 0 0; color: var(--tr-paper-ink); opacity: .55; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
|
|
481
478
|
.tr-rule { margin: 20px 0; border-top: 1px dashed color-mix(in oklab, var(--tr-paper-ink) 25%, transparent); }
|
|
482
479
|
.tr-rule.tight { margin: 16px 0; }
|
|
483
|
-
.tr-section-label { margin: 0 0 7px; color: var(--tr-paper-ink); opacity: .55; font-size:
|
|
480
|
+
.tr-section-label { margin: 0 0 7px; color: var(--tr-paper-ink); opacity: .55; font-size: 11px; font-weight: 700; letter-spacing: .72px; text-transform: uppercase; }
|
|
484
481
|
.tr-items { display: flex; flex-direction: column; gap: 9px; }
|
|
485
482
|
.tr-item-block { min-width: 0; }
|
|
486
|
-
.tr-item-detail { margin: 0; font-size:
|
|
483
|
+
.tr-item-detail { margin: 0; font-size: 11px; line-height: 17px; opacity: .55; }
|
|
487
484
|
.tr-price-notes { margin-top: 12px; }
|
|
488
|
-
.tr-price-notes p { margin: 0; font-size:
|
|
489
|
-
.tr-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; font-size:
|
|
485
|
+
.tr-price-notes p { margin: 0; font-size: 9px; line-height: 13px; opacity: .55; overflow-wrap: anywhere; }
|
|
486
|
+
.tr-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; font-size: 11px; line-height: 17px; }
|
|
490
487
|
.tr-item-name { min-width: 0; flex: 1; letter-spacing: .08em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
|
|
491
488
|
.tr-item-value { flex: none; font-variant-numeric: tabular-nums; font-weight: 700; }
|
|
492
|
-
.tr-empty { padding: 6px 0; text-align: center; color: var(--tr-paper-ink); opacity: .55; font-size:
|
|
489
|
+
.tr-empty { padding: 6px 0; text-align: center; color: var(--tr-paper-ink); opacity: .55; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
|
|
493
490
|
.tr-summary { display: flex; flex-direction: column; gap: 6px; margin: 0; }
|
|
494
|
-
.tr-summary-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; font-size:
|
|
491
|
+
.tr-summary-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; font-size: 11px; line-height: 11px; }
|
|
495
492
|
.tr-summary-row dt { margin: 0; color: var(--tr-paper-ink); opacity: .55; }
|
|
496
493
|
.tr-summary-row dd { margin: 0; font-variant-numeric: tabular-nums; }
|
|
497
494
|
.tr-total { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-top: 8px; }
|
|
498
|
-
.tr-total dt { margin: 0; font-size:
|
|
499
|
-
.tr-total dd { margin: 0; white-space: nowrap; font-size:
|
|
500
|
-
.tr-meta { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 16px; font-size:
|
|
495
|
+
.tr-total dt { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
|
|
496
|
+
.tr-total dd { margin: 0; white-space: nowrap; font-size: 17px; font-weight: 700; line-height: 17px; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
|
|
497
|
+
.tr-meta { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 16px; font-size: 9px; line-height: 12px; }
|
|
501
498
|
.tr-meta dt { margin: 0; color: var(--tr-paper-ink); opacity: .55; }
|
|
502
499
|
.tr-meta dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
|
|
503
500
|
.tr-barcodewrap { margin-top: 14px; text-align: center; }
|
|
504
501
|
.tr-barcode { width: 128px; height: 28px; margin: 0 auto; background-image: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 3px, currentColor 3px 5px, transparent 5px 7px, currentColor 7px 8px, transparent 8px 11px); opacity: .85; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
|
|
505
|
-
.tr-barcode-label { margin: 4px 0 0; color: var(--tr-paper-ink); opacity: .5; font-size:
|
|
506
|
-
.tr-thanks { margin: 8px 0 0; text-align: center; color: var(--tr-paper-ink); opacity: .5; font-size:
|
|
502
|
+
.tr-barcode-label { margin: 4px 0 0; color: var(--tr-paper-ink); opacity: .5; font-size: 9px; line-height: 12px; letter-spacing: 1.26px; text-transform: uppercase; }
|
|
503
|
+
.tr-thanks { margin: 8px 0 0; text-align: center; color: var(--tr-paper-ink); opacity: .5; font-size: 9px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
|
|
507
504
|
|
|
508
505
|
.tr-error { width: 100%; max-width: 540px; margin: 14px auto 0; padding: 13px 16px; border: 1px solid color-mix(in srgb, #e5484d 34%, var(--tr-g3)); border-radius: 10px; background: color-mix(in srgb, #e5484d 7%, var(--tr-g2)); color: var(--tr-page-ink); font-size: 12.5px; line-height: 1.5; text-align: center; }
|
|
509
506
|
.tr-sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
|
|
@@ -883,6 +880,13 @@ body[data-ds-dark-theme] .tr-slot { border-color: var(--tr-g1); background: var(
|
|
|
883
880
|
return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })
|
|
884
881
|
}
|
|
885
882
|
|
|
883
|
+
function dateTime(date, locale) {
|
|
884
|
+
const lang = normalizeLocale(locale)
|
|
885
|
+
const time = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`
|
|
886
|
+
if (lang === 'zh' || lang === 'ja') return `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日 ${time}`
|
|
887
|
+
return `${date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })} ${time}`
|
|
888
|
+
}
|
|
889
|
+
|
|
886
890
|
function shortDate(date, locale) {
|
|
887
891
|
const lang = normalizeLocale(locale)
|
|
888
892
|
if (lang === 'zh' || lang === 'ja') return `${date.getMonth() + 1}月${date.getDate()}日`
|
|
@@ -1084,7 +1088,7 @@ body[data-ds-dark-theme] .tr-slot { border-color: var(--tr-g1); background: var(
|
|
|
1084
1088
|
const rangeEnd = new Date(data.to)
|
|
1085
1089
|
const displayStart = resolveDisplayStart(period, rangeStart, data)
|
|
1086
1090
|
const issued = new Date(data.generatedAt)
|
|
1087
|
-
const issuedText = Number.isNaN(issued.getTime()) ? '—' :
|
|
1091
|
+
const issuedText = Number.isNaN(issued.getTime()) ? '—' : dateTime(issued, lang)
|
|
1088
1092
|
const billNo = billNumber(period, data.date, totals.totalTokens, totals.requests)
|
|
1089
1093
|
const partial = pricing?.status === 'partial'
|
|
1090
1094
|
const hasPrice = typeof pricing?.totalUsd === 'number' && Number.isFinite(pricing.totalUsd)
|
|
@@ -1092,7 +1096,6 @@ body[data-ds-dark-theme] .tr-slot { border-color: var(--tr-g1); background: var(
|
|
|
1092
1096
|
if (!hasPrice) notes.push(copy.unavailablePrice)
|
|
1093
1097
|
else if (partial) notes.push(copy.partialPrice.replace('{n}', pricing.unpricedRequests))
|
|
1094
1098
|
if (pricing?.stale) notes.push(copy.stalePrice)
|
|
1095
|
-
if (currency === 'cny') notes.push(copy.exchangeRate)
|
|
1096
1099
|
if (currency === 'jpy') notes.push(copy.exchangeRateJpy.replace('{rate}', DISPLAY_RATES.jpy).replace('{date}', JPY_RATE_DATE))
|
|
1097
1100
|
const modelRow = (model) => h(
|
|
1098
1101
|
'div',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-token-receipt",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Print daily, weekly, monthly, 30-day, 90-day, or all-time token usage and estimated model costs as a tactile receipt, with clipboard copy and PNG export.",
|
|
6
6
|
"type": "module",
|