dsh-colophon 0.2.4 → 0.2.6
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/README.md +13 -0
- package/client.js +87 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## 0.2.6(入口按钮更明显)
|
|
2
|
+
|
|
3
|
+
- 输入框上方的入口改成实心感按钮:主题强调色文字与描边、浅色填充、圆角 10px、悬停加深并带投影。
|
|
4
|
+
- 左侧加 ✎ 图标、右侧加 ▾ 指示,明确「可点击展开」。
|
|
5
|
+
- 无摘要时显示「生成卷末摘要」,有摘要时显示「卷末摘要」。
|
|
6
|
+
|
|
7
|
+
## 0.2.5(摘要面板排版精修)
|
|
8
|
+
|
|
9
|
+
- 区块标题加大到 15px 并使用主题强调色,标题前带强调竖条。
|
|
10
|
+
- 面板右上角新增 ✕ 关闭按钮。
|
|
11
|
+
- 底部操作区与正文用分隔线分开。
|
|
12
|
+
- 区块内的条目改为有序编号(1. 2. 3.),不再使用短横线。
|
|
13
|
+
|
|
1
14
|
## 0.2.4(摘要区块可配置 + 明亮摘要面板)
|
|
2
15
|
|
|
3
16
|
- 摘要内容改为**区块制**,可在设置页逐项开关:目标 / 结论 / 决策 / 涉及文件 / 完成情况 / 下一步 / 风险与注意 / 关键词 / 待确认问题(默认只开目标、结论、决策、下一步、风险与注意,不再输出中间的已完成动作)。
|
package/client.js
CHANGED
|
@@ -253,15 +253,22 @@ window.__ModuleLoader__.load({
|
|
|
253
253
|
|
|
254
254
|
const styles = {
|
|
255
255
|
chip: {
|
|
256
|
-
display: 'inline-flex', alignItems: 'center', gap:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
256
|
+
display: 'inline-flex', alignItems: 'center', gap: 7, padding: '0 14px', height: 32,
|
|
257
|
+
borderRadius: 10, cursor: 'pointer', fontSize: 13, fontWeight: 600, letterSpacing: '0.01em',
|
|
258
|
+
color: 'var(--dsw-alias-button-primary-fill, #4d6bfe)',
|
|
259
|
+
border: '1px solid color-mix(in srgb, var(--dsw-alias-button-primary-fill, #4d6bfe) 55%, transparent)',
|
|
260
|
+
background: 'color-mix(in srgb, var(--dsw-alias-button-primary-fill, #4d6bfe) 12%, transparent)',
|
|
261
|
+
boxShadow: '0 1px 2px rgba(0,0,0,0.06)', transition: 'background 120ms ease, box-shadow 120ms ease',
|
|
262
|
+
},
|
|
263
|
+
chipHover: {
|
|
264
|
+
background: 'color-mix(in srgb, var(--dsw-alias-button-primary-fill, #4d6bfe) 22%, transparent)',
|
|
265
|
+
boxShadow: '0 2px 10px rgba(0,0,0,0.18)',
|
|
260
266
|
},
|
|
261
267
|
chipOn: {
|
|
262
268
|
border: '1px solid var(--dsw-alias-button-primary-fill, #4d6bfe)',
|
|
263
|
-
background: 'color-mix(in srgb, var(--dsw-alias-button-primary-fill, #4d6bfe)
|
|
269
|
+
background: 'color-mix(in srgb, var(--dsw-alias-button-primary-fill, #4d6bfe) 20%, transparent)',
|
|
264
270
|
},
|
|
271
|
+
chipIcon: { display: 'inline-flex', width: 14, height: 14, alignItems: 'center', justifyContent: 'center', fontSize: 13, lineHeight: 1 },
|
|
265
272
|
dot: { width: 7, height: 7, borderRadius: 999, background: '#4cc38a', display: 'inline-block' },
|
|
266
273
|
dotEmpty: { width: 7, height: 7, borderRadius: 999, background: 'rgba(255,255,255,0.35)', display: 'inline-block' },
|
|
267
274
|
panel: {
|
|
@@ -274,14 +281,30 @@ window.__ModuleLoader__.load({
|
|
|
274
281
|
},
|
|
275
282
|
panelHead: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 10 },
|
|
276
283
|
title: { fontSize: 15, fontWeight: 600, color: 'var(--dsw-alias-label-primary, #1f2329)' },
|
|
277
|
-
digestTitle: {
|
|
278
|
-
|
|
284
|
+
digestTitle: {
|
|
285
|
+
fontSize: 15, fontWeight: 650, letterSpacing: '-0.01em',
|
|
286
|
+
color: 'var(--dsw-alias-state-business-primary, #4d6bfe)', marginBottom: 6,
|
|
287
|
+
display: 'flex', alignItems: 'center', gap: 7,
|
|
288
|
+
},
|
|
289
|
+
digestTitleBar: { width: 3, height: 14, borderRadius: 2, background: 'currentColor', display: 'inline-block' },
|
|
290
|
+
digestBlock: { marginTop: 6, paddingTop: 14, borderTop: '1px solid var(--dsw-alias-border-l1, rgba(0,0,0,0.07))' },
|
|
291
|
+
digestPara: { margin: '0 0 6px', fontSize: 13, lineHeight: 1.65, color: 'var(--dsw-alias-label-primary, #1f2329)' },
|
|
292
|
+
digestList: { margin: '4px 0 6px', paddingLeft: 20, fontSize: 13, lineHeight: 1.7, color: 'var(--dsw-alias-label-primary, #1f2329)' },
|
|
293
|
+
digestItem: { marginBottom: 2, paddingLeft: 2 },
|
|
279
294
|
digestBody: {
|
|
280
295
|
whiteSpace: 'pre-wrap', wordBreak: 'break-word', margin: 0, fontFamily: 'inherit',
|
|
281
296
|
fontSize: 13, lineHeight: 1.65, color: 'var(--dsw-alias-label-primary, #1f2329)',
|
|
282
297
|
},
|
|
283
298
|
pre: { whiteSpace: 'pre-wrap', wordBreak: 'break-word', margin: 0, fontFamily: 'var(--dsh-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace)', fontSize: 11, lineHeight: 1.6 },
|
|
284
|
-
actions: {
|
|
299
|
+
actions: {
|
|
300
|
+
display: 'flex', gap: 8, marginTop: 14, paddingTop: 12, flexWrap: 'wrap',
|
|
301
|
+
borderTop: '1px solid var(--dsw-alias-border-l1, rgba(0,0,0,0.07))',
|
|
302
|
+
},
|
|
303
|
+
closeIcon: {
|
|
304
|
+
appearance: 'none', border: 0, background: 'transparent', cursor: 'pointer', marginLeft: 4,
|
|
305
|
+
width: 26, height: 26, borderRadius: 6, display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
|
306
|
+
color: 'var(--dsw-alias-label-tertiary, #8b93a1)', fontSize: 14, lineHeight: 1,
|
|
307
|
+
},
|
|
285
308
|
button: {
|
|
286
309
|
padding: '4px 10px', borderRadius: 8, border: '1px solid rgba(255,255,255,0.2)',
|
|
287
310
|
background: 'rgba(255,255,255,0.08)', color: 'inherit', cursor: 'pointer', fontSize: 12,
|
|
@@ -463,11 +486,51 @@ window.__ModuleLoader__.load({
|
|
|
463
486
|
.filter(block => block.body !== '' || /^(卷末|Colophon)/i.test(block.heading) === false)
|
|
464
487
|
}
|
|
465
488
|
|
|
489
|
+
/** Render one digest block: paragraphs plus a numbered list for bullet lines. */
|
|
490
|
+
function renderDigestBlock(block, key) {
|
|
491
|
+
const nodes = []
|
|
492
|
+
let paragraphs = []
|
|
493
|
+
let items = []
|
|
494
|
+
const flushParagraph = () => {
|
|
495
|
+
if (paragraphs.length > 0) {
|
|
496
|
+
nodes.push(h('p', { key: `p${nodes.length}`, style: styles.digestPara }, paragraphs.join('\n')))
|
|
497
|
+
paragraphs = []
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
const flushItems = () => {
|
|
501
|
+
if (items.length > 0) {
|
|
502
|
+
nodes.push(h('ol', { key: `l${nodes.length}`, style: styles.digestList },
|
|
503
|
+
items.map((item, index) => h('li', { key: index, style: styles.digestItem }, item))))
|
|
504
|
+
items = []
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
for (const raw of block.body.split('\n')) {
|
|
508
|
+
const line = raw.trim()
|
|
509
|
+
const bullet = line.match(/^[-*•]\s+(.*)$/)
|
|
510
|
+
if (bullet) {
|
|
511
|
+
flushParagraph()
|
|
512
|
+
items.push(bullet[1])
|
|
513
|
+
} else if (line === '') {
|
|
514
|
+
flushParagraph()
|
|
515
|
+
flushItems()
|
|
516
|
+
} else {
|
|
517
|
+
flushItems()
|
|
518
|
+
paragraphs.push(line)
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
flushItems()
|
|
522
|
+
flushParagraph()
|
|
523
|
+
return h('div', { key, style: styles.digestBlock },
|
|
524
|
+
h('div', { style: styles.digestTitle }, h('span', { style: styles.digestTitleBar }), block.heading),
|
|
525
|
+
nodes)
|
|
526
|
+
}
|
|
527
|
+
|
|
466
528
|
/** The chip + floating digest panel above the composer. */
|
|
467
529
|
function ColophonDock(props) {
|
|
468
530
|
const sessionId = props.sessionId
|
|
469
531
|
const variant = props.variant
|
|
470
532
|
const [open, setOpen] = useState(false)
|
|
533
|
+
const [hovered, setHovered] = useState(false)
|
|
471
534
|
const [loading, setLoading] = useState(false)
|
|
472
535
|
const [digest, setDigest] = useState(null)
|
|
473
536
|
const [error, setError] = useState('')
|
|
@@ -528,13 +591,19 @@ window.__ModuleLoader__.load({
|
|
|
528
591
|
// The hero (new session) has no history yet; keep it clean.
|
|
529
592
|
if (variant === 'hero' || !sessionId) return null
|
|
530
593
|
|
|
594
|
+
const chipStyle = { ...styles.chip, ...(digest ? styles.chipOn : null), ...(hovered ? styles.chipHover : null) }
|
|
531
595
|
const chip = h('button', {
|
|
532
|
-
|
|
596
|
+
type: 'button',
|
|
597
|
+
style: chipStyle,
|
|
533
598
|
title: tr('panelTitle'),
|
|
599
|
+
'aria-expanded': open,
|
|
600
|
+
onMouseEnter: () => setHovered(true),
|
|
601
|
+
onMouseLeave: () => setHovered(false),
|
|
534
602
|
onClick: () => setOpen(current => !current),
|
|
535
603
|
},
|
|
536
|
-
h('span', { style:
|
|
537
|
-
h('span', null, digest ? tr('chipReady') : tr('chipEmpty'))
|
|
604
|
+
h('span', { style: styles.chipIcon, 'aria-hidden': true }, '✎'),
|
|
605
|
+
h('span', null, digest ? tr('chipReady') : tr('chipEmpty')),
|
|
606
|
+
h('span', { style: { opacity: 0.6, marginLeft: 2, fontSize: 11 } }, '▾'))
|
|
538
607
|
|
|
539
608
|
const blocks = digest?.markdown ? parseDigestBlocks(digest.markdown) : []
|
|
540
609
|
|
|
@@ -542,14 +611,16 @@ window.__ModuleLoader__.load({
|
|
|
542
611
|
h('div', { style: styles.panelHead },
|
|
543
612
|
h('span', { style: styles.title }, tr('panelTitle')),
|
|
544
613
|
h('span', { style: { ...styles.muted, marginRight: 'auto' } }, digest?.updatedAt ? new Date(digest.updatedAt).toLocaleString() : ''),
|
|
545
|
-
h('button', { style: { ...styles.buttonPrimary, minWidth: 92 }, onClick: () => void generate(), disabled: loading },
|
|
546
|
-
digest ? tr('regenerate') : tr('generate'))
|
|
614
|
+
h('button', { style: { ...styles.buttonPrimary, minWidth: 92, height: 30 }, onClick: () => void generate(), disabled: loading },
|
|
615
|
+
digest ? tr('regenerate') : tr('generate')),
|
|
616
|
+
h('button', {
|
|
617
|
+
style: styles.closeIcon, title: tr('close'), 'aria-label': tr('close'),
|
|
618
|
+
onClick: () => setOpen(false),
|
|
619
|
+
}, '✕')),
|
|
547
620
|
loading ? h('div', { style: styles.muted }, tr('loading'))
|
|
548
621
|
: error ? h('div', { style: styles.warn }, tr('failed', { message: error }))
|
|
549
622
|
: blocks.length > 0
|
|
550
|
-
? h('div', null, blocks.map((block, index) =>
|
|
551
|
-
h('div', { style: styles.digestTitle }, block.heading),
|
|
552
|
-
h('div', { style: styles.digestBody }, block.body))))
|
|
623
|
+
? h('div', null, blocks.map((block, index) => renderDigestBlock(block, index)))
|
|
553
624
|
: h('div', { style: styles.muted }, tr('empty')),
|
|
554
625
|
h('div', { style: styles.actions },
|
|
555
626
|
digest?.markdown ? h('button', { style: styles.buttonSecondary, onClick: () => void copy() }, copied ? tr('copied') : tr('copy')) : null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-colophon",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Colophon(卷末)— keep a local, token-free conclusion digest for every conversation, so reopening an old session starts from its final state instead of its full history.",
|
|
5
5
|
"documentation": "README.md",
|
|
6
6
|
"license": "MIT",
|