dsh-sidenote 0.7.0 → 0.7.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/README.md +3 -3
- package/lib/client.js +1131 -606
- package/lib/types/client/annotations/NativeComposer.d.ts +10 -0
- package/lib/types/client/annotations/NativeUserContext.d.ts +33 -2
- package/lib/types/client/annotations/chip.d.ts +2 -12
- package/lib/types/client/host/chat.d.ts +34 -0
- package/lib/types/client/host/contracts.d.ts +14 -1
- package/lib/types/client/host/dom.d.ts +5 -0
- package/lib/types/client/locales.d.ts +13 -0
- package/lib/types/client/sidechat/NativeConversation.d.ts +7 -0
- package/lib/types/client/sidechat/identity.d.ts +1 -1
- package/lib/types/client/sidechat/snapshot.d.ts +2 -0
- package/package.json +9 -4
- package/src/client/annotate/index.tsx +7 -16
- package/src/client/annotations/NativeComposer.tsx +110 -0
- package/src/client/annotations/NativeUserContext.tsx +168 -36
- package/src/client/annotations/annotations.module.css +60 -157
- package/src/client/annotations/chip.tsx +122 -118
- package/src/client/host/chat.ts +23 -19
- package/src/client/host/contracts.ts +5 -0
- package/src/client/host/dom.ts +13 -1
- package/src/client/locales.ts +30 -4
- package/src/client/reflow.ts +1 -1
- package/src/client/sidechat/NativeConversation.tsx +33 -16
- package/src/client/sidechat/SideChatPanel.tsx +8 -3
- package/src/client/sidechat/identity.ts +5 -1
- package/src/client/sidechat/sidechat.module.css +15 -1
- package/src/client/sidechat/snapshot.ts +7 -0
- package/lib/types/client/annotate/chip.d.ts +0 -10
- package/lib/types/client/annotate/send.d.ts +0 -8
- package/src/client/annotate/chip.tsx +0 -94
- package/src/client/annotate/send.ts +0 -155
|
@@ -1,46 +1,178 @@
|
|
|
1
|
-
import { createElement, type ComponentType } from 'react'
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { createElement, useEffect, useId, useLayoutEffect, useRef, useState, type ComponentType, type CSSProperties, type ReactNode } from 'react'
|
|
2
|
+
import { createPortal } from 'react-dom'
|
|
3
|
+
import type { Context, UiConversationLike } from '../host/contracts.ts'
|
|
4
|
+
import { conversationViewOf, mountUserBubbleAddon } from '../host/dom.ts'
|
|
5
|
+
import { IconChevronDownOutline14, IconListPenOutline16, IconShareOutline16 } from '../host/icons.ts'
|
|
6
|
+
import { flattenReflowContent, splitProtocolPrefix, splitSnapshotPrefix, type ProtocolPrefix } from './format.ts'
|
|
4
7
|
import { t } from '../locales.ts'
|
|
8
|
+
import { useLocaleTick } from '../locale-tick.ts'
|
|
5
9
|
import css from './annotations.module.css'
|
|
6
10
|
|
|
7
|
-
interface
|
|
11
|
+
interface HistoryNode { kind: string; seq: number; source?: { kind?: string }; content?: readonly { type: string; text?: string }[] }
|
|
12
|
+
interface UserProps {
|
|
13
|
+
node: { data: { seq: number; content: readonly { type: string; text?: string }[] } }
|
|
14
|
+
useChat<T>(select: (state: { legacy: { nodes: readonly HistoryNode[] } }) => T): T
|
|
15
|
+
}
|
|
8
16
|
interface Entry { component: ComponentType<UserProps>; options: { key?: string } }
|
|
17
|
+
const CONTEXT_NODE = 'dsh-sidenote-context'
|
|
18
|
+
|
|
19
|
+
/** Injected notices and their following human input are one admitted batch.
|
|
20
|
+
* Project its reflows into that bubble without changing or resending history. */
|
|
21
|
+
export function injectedReflowPrefix(nodes: readonly HistoryNode[], seq: number): string {
|
|
22
|
+
const prefixes: string[] = []
|
|
23
|
+
for (let i = nodes.findIndex(node => node.seq === seq) - 1; i >= 0; i--) {
|
|
24
|
+
const node = nodes[i]!
|
|
25
|
+
if (node.kind !== 'context') break
|
|
26
|
+
if (node.source?.kind !== 'dsh-sidenote') continue
|
|
27
|
+
const text = (node.content ?? []).filter(block => block.type === 'text').map(block => block.text ?? '').join('\n')
|
|
28
|
+
const start = text.indexOf('<reflow ')
|
|
29
|
+
if (start < 0) continue
|
|
30
|
+
const prefix = splitProtocolPrefix(text.slice(start))
|
|
31
|
+
if (prefix?.reflows.length) prefixes.unshift(text.slice(start, start + prefix.length))
|
|
32
|
+
}
|
|
33
|
+
return prefixes.join('\n\n')
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** One prefix node leaves the body, @ references and attachments to the host. */
|
|
37
|
+
export const sentContextRule = {
|
|
38
|
+
id: CONTEXT_NODE,
|
|
39
|
+
order: 0,
|
|
40
|
+
match(text: string, from: number) {
|
|
41
|
+
const snapshot = splitSnapshotPrefix(text)
|
|
42
|
+
const start = snapshot ? text.length - snapshot.rest.length : 0
|
|
43
|
+
if (from > start) return undefined
|
|
44
|
+
const protocol = splitProtocolPrefix(text.slice(start))
|
|
45
|
+
return protocol ? { id: CONTEXT_NODE, start, end: start + protocol.length, data: protocol } : undefined
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function ContextChip({ label, icon, children, interactive }: { label: string; icon: ReactNode; children: ReactNode; interactive: boolean }) {
|
|
50
|
+
const [open, setOpen] = useState<{ pinned: boolean } | null>(null)
|
|
51
|
+
const [position, setPosition] = useState<CSSProperties>({ visibility: 'hidden' })
|
|
52
|
+
const anchor = useRef<HTMLButtonElement>(null)
|
|
53
|
+
const panel = useRef<HTMLDivElement>(null)
|
|
54
|
+
const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)
|
|
55
|
+
const clearTimer = () => { clearTimeout(timer.current); timer.current = undefined }
|
|
56
|
+
const leave = () => {
|
|
57
|
+
clearTimer()
|
|
58
|
+
if (!open?.pinned) timer.current = setTimeout(() => { if (!panel.current?.contains(document.activeElement)) setOpen(null) }, 160)
|
|
59
|
+
}
|
|
60
|
+
const id = useId()
|
|
61
|
+
const expanded = open !== null
|
|
62
|
+
useEffect(() => clearTimer, [])
|
|
63
|
+
useLayoutEffect(() => {
|
|
64
|
+
if (!expanded) return
|
|
65
|
+
const place = () => {
|
|
66
|
+
const rect = anchor.current!.getBoundingClientRect()
|
|
67
|
+
const view = conversationViewOf(anchor.current!).getBoundingClientRect()
|
|
68
|
+
const left = Math.max(12, view.left + 12), right = Math.min(window.innerWidth - 12, view.right - 12)
|
|
69
|
+
const top = Math.max(12, view.top + 12), bottom = Math.min(window.innerHeight - 12, view.bottom - 12)
|
|
70
|
+
if (rect.bottom < top || rect.top > bottom) { setOpen(null); return }
|
|
71
|
+
const width = Math.min(420, right - left)
|
|
72
|
+
const above = rect.top - top - 8, below = bottom - rect.bottom - 8
|
|
73
|
+
const preferAbove = above >= Math.min(280, window.innerHeight / 3) || above >= below
|
|
74
|
+
setPosition({ width, left: Math.max(left, Math.min(rect.left, right - width)), maxHeight: Math.min(280, window.innerHeight / 3, preferAbove ? above : below), ...(preferAbove ? { bottom: window.innerHeight - rect.top + 8 } : { top: rect.bottom + 8 }) })
|
|
75
|
+
}
|
|
76
|
+
place()
|
|
77
|
+
window.addEventListener('scroll', place, true)
|
|
78
|
+
window.addEventListener('resize', place)
|
|
79
|
+
return () => { window.removeEventListener('scroll', place, true); window.removeEventListener('resize', place) }
|
|
80
|
+
}, [expanded])
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!expanded) return
|
|
83
|
+
const outside = (event: PointerEvent) => { if (!anchor.current?.contains(event.target as Node) && !panel.current?.contains(event.target as Node)) { clearTimer(); setOpen(null) } }
|
|
84
|
+
const escape = (event: KeyboardEvent) => { if (event.key === 'Escape') { event.preventDefault(); clearTimer(); setOpen(null); anchor.current?.focus() } }
|
|
85
|
+
document.addEventListener('pointerdown', outside)
|
|
86
|
+
document.addEventListener('keydown', escape)
|
|
87
|
+
return () => { document.removeEventListener('pointerdown', outside); document.removeEventListener('keydown', escape) }
|
|
88
|
+
}, [expanded])
|
|
89
|
+
useLayoutEffect(() => { if (open?.pinned && document.activeElement === anchor.current) panel.current?.focus() }, [open?.pinned])
|
|
90
|
+
return <span className={css.sentChipGroup}>
|
|
91
|
+
{interactive ? <button ref={anchor} type="button" className={css.sentChip} aria-haspopup="dialog" aria-expanded={expanded} aria-controls={id} onPointerEnter={event => {
|
|
92
|
+
if (event.pointerType === 'touch') return
|
|
93
|
+
clearTimer()
|
|
94
|
+
if (!open && !document.querySelector('[data-sidenote-sent-preview][data-pinned]')) timer.current = setTimeout(() => { setOpen({ pinned: false }) }, 180)
|
|
95
|
+
}} onPointerLeave={leave} onClick={() => { clearTimer(); setOpen(open?.pinned ? null : { pinned: true }) }}>
|
|
96
|
+
{icon}<span>{label}</span><IconChevronDownOutline14 size={12} className={expanded ? css.sentChevronOpen : css.sentChevron} />
|
|
97
|
+
</button> : <span className={css.sentChip}>{icon}<span>{label}</span></span>}
|
|
98
|
+
{interactive && expanded && createPortal(<div ref={panel} id={id} role="dialog" tabIndex={-1} aria-label={label} className={`${css.contextPanel} ${css.sentPreview}`} style={position} data-sidenote-sent-preview data-pinned={open.pinned || undefined} data-sidenote-no-quote onPointerEnter={clearTimer} onPointerLeave={leave}>{children}</div>, document.body)}
|
|
99
|
+
</span>
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function SentContext({ protocol, interactive = true }: { protocol: ProtocolPrefix; interactive?: boolean }) {
|
|
103
|
+
useLocaleTick()
|
|
104
|
+
return <span className={css.sentChips} data-dsh-sidenote-bubble data-sidenote-no-quote>
|
|
105
|
+
{protocol.annotations.length > 0 && <ContextChip label={t('sentChipLabel', { n: protocol.annotations.length })} icon={<IconListPenOutline16 size={12} />} interactive={interactive}>
|
|
106
|
+
<ul className={css.contextList}>{protocol.annotations.map(annotation => <li className={css.contextItem} key={annotation.id}>
|
|
107
|
+
<span className={css.contextNumber}>{annotation.id}.</span><div className={css.contextContent}>
|
|
108
|
+
<div className={css.contextLabel}>{t('selectedText')}</div><div className={css.contextText}>{annotation.quote}</div>
|
|
109
|
+
{annotation.note && <><div className={css.contextLabel}>{t('userComment')}</div><div className={css.contextText}>{annotation.note}</div></>}
|
|
110
|
+
</div>
|
|
111
|
+
</li>)}</ul>
|
|
112
|
+
</ContextChip>}
|
|
113
|
+
{protocol.reflows.length > 0 && <ContextChip label={t('reflowBubbleLabel')} icon={<IconShareOutline16 size={12} />} interactive={interactive}>
|
|
114
|
+
<ul className={css.contextList}>{protocol.reflows.map((reflow, index) => <li className={css.contextItem} key={index}>
|
|
115
|
+
<span className={css.contextNumber}>{index + 1}.</span><div className={css.contextContent}><div className={css.contextSource}>{reflow.source}</div><div className={css.contextText}>{flattenReflowContent(reflow.content)}</div></div>
|
|
116
|
+
</li>)}</ul>
|
|
117
|
+
</ContextChip>}
|
|
118
|
+
</span>
|
|
119
|
+
}
|
|
9
120
|
|
|
10
|
-
|
|
11
|
-
|
|
121
|
+
function LegacyContext({ Original, props, protocol }: { Original: ComponentType<UserProps>; props: UserProps; protocol: ProtocolPrefix }) {
|
|
122
|
+
const root = useRef<HTMLDivElement>(null)
|
|
123
|
+
const [seat] = useState(() => document.createElement('span'))
|
|
124
|
+
useLayoutEffect(() => root.current ? mountUserBubbleAddon(root.current, seat) : undefined, [seat, props.node])
|
|
125
|
+
return <div ref={root} className={css.userContextHost}>{createElement(Original, props)}{createPortal(<SentContext protocol={protocol} />, seat)}</div>
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Keep contextual chips inside the native bubble on both main and side chat.
|
|
129
|
+
* Only the progress snapshot remains outside its owning user message. */
|
|
12
130
|
export function registerUserContext(ctx: Context): void {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
131
|
+
ctx.inject(['uiConversation'], () => {
|
|
132
|
+
const ui = ctx.get('uiConversation') as UiConversationLike
|
|
133
|
+
const nativeText = ui.userText !== undefined
|
|
134
|
+
if (nativeText) {
|
|
135
|
+
ctx.slots.inject('conversation.user.text.node', () => {
|
|
136
|
+
const offRenderer = ctx.slots.register({ name: 'conversation.user.text.node', key: CONTEXT_NODE }, (props: { node: { data: ProtocolPrefix }; interactive: boolean }) => <SentContext protocol={props.node.data} interactive={props.interactive} />)
|
|
137
|
+
const offRule = ui.userText!.register(sentContextRule)
|
|
138
|
+
return () => { offRule(); offRenderer() }
|
|
139
|
+
})
|
|
140
|
+
}
|
|
141
|
+
const slots = ctx.slots as Context['slots'] & { entries(name: string): readonly Entry[]; subscribe(name: string, notify: () => void): () => void }
|
|
142
|
+
ctx.slots.inject('conversation.chat.node', () => {
|
|
143
|
+
const patched = new Map<Entry, { original: ComponentType<UserProps>; wrapped: ComponentType<UserProps> }>()
|
|
144
|
+
const patch = (): void => {
|
|
145
|
+
for (const entry of slots.entries('conversation.chat.node')) {
|
|
146
|
+
if (!['user', 'steering'].includes(entry.options.key ?? '') || patched.has(entry)) continue
|
|
147
|
+
const Original = entry.component
|
|
148
|
+
function ContextUser(props: UserProps) {
|
|
149
|
+
const nodes = props.useChat(state => state.legacy.nodes)
|
|
150
|
+
const injected = injectedReflowPrefix(nodes, props.node.data.seq)
|
|
151
|
+
const blocks = props.node.data.content
|
|
152
|
+
const at = blocks.findIndex(block => block.type === 'text')
|
|
153
|
+
const text = blocks[at]?.text ?? ''
|
|
154
|
+
const snapshot = splitSnapshotPrefix(text)
|
|
155
|
+
const afterSnapshot = (injected ? injected + '\n\n' : '') + (snapshot?.rest ?? text)
|
|
156
|
+
const protocol = nativeText ? null : splitProtocolPrefix(afterSnapshot)
|
|
157
|
+
if (!snapshot && !protocol && !injected) return createElement(Original, props)
|
|
158
|
+
const body = protocol ? afterSnapshot.slice(protocol.length).trimStart() : afterSnapshot
|
|
159
|
+
// Retain the native bubble for an annotation-only message; this
|
|
160
|
+
// presentation-only word joiner never enters the durable content.
|
|
161
|
+
const displayText = body || (protocol ? '\u2060' : '')
|
|
162
|
+
const content = at < 0 ? [...blocks, { type: 'text', text: displayText }] : blocks.map((block, index) => index === at ? { ...block, text: displayText } : block)
|
|
163
|
+
const projected = { ...props, node: { ...props.node, data: { ...props.node.data, content } } }
|
|
164
|
+
return <>
|
|
165
|
+
{snapshot && <details className={css.sentContext} data-sidenote-progress-snapshot><summary>{t('snapshotContext')}</summary><pre>{snapshot.snapshot}</pre></details>}
|
|
166
|
+
{protocol ? <LegacyContext Original={Original} props={projected} protocol={protocol} /> : createElement(Original, projected)}
|
|
167
|
+
</>
|
|
168
|
+
}
|
|
169
|
+
entry.component = ContextUser
|
|
170
|
+
patched.set(entry, { original: Original, wrapped: ContextUser })
|
|
37
171
|
}
|
|
38
|
-
entry.component = ContextUser
|
|
39
|
-
patched.set(entry, { original: Original, wrapped: ContextUser })
|
|
40
172
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
173
|
+
patch()
|
|
174
|
+
const off = slots.subscribe('conversation.chat.node', patch)
|
|
175
|
+
return () => { off(); for (const [entry, value] of patched) if (entry.component === value.wrapped) entry.component = value.original }
|
|
176
|
+
})
|
|
45
177
|
})
|
|
46
178
|
}
|
|
@@ -1,163 +1,66 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
1
|
+
/* Both context kinds share one aligned native composer dock. */
|
|
2
|
+
.chipWrap { box-sizing: border-box; width: calc(100% - 2 * var(--dsh-composer-side-clearance, 16px)); max-width: var(--dsh-composer-card-max-width, 780px); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 0; background: var(--dsw-alias-bg-base); }
|
|
3
|
+
.chip { --chip-surface: var(--dsw-alias-bg-layer-1); display: inline-flex; position: relative; align-items: center; border: 1px solid var(--dsw-alias-border-l1); border-radius: 10px; background: var(--chip-surface); color: var(--dsw-alias-label-secondary); transition: background 120ms, color 120ms; }
|
|
4
|
+
.chip:hover, .chip:focus-within, .chip[data-open] { --chip-surface: var(--dsw-alias-interactive-bg-hover-solid); color: var(--dsw-alias-label-primary); }
|
|
5
|
+
.chipMain { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; border: 0; border-radius: inherit; background: transparent; color: inherit; font: inherit; font-size: 12px; line-height: 18px; padding: 3px 9px; cursor: pointer; }
|
|
6
|
+
.chipDismissShade { display: flex; justify-content: flex-end; align-items: center; position: absolute; inset: 0 3px 0 auto; width: 38px; border-radius: inherit; background: linear-gradient(to right, transparent, var(--chip-surface) 45%); opacity: 0; pointer-events: none; transition: opacity 160ms ease-out; }
|
|
7
|
+
.chipDismiss { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px; padding: 0; border: 1px solid var(--dsw-alias-border-l1); border-radius: 50%; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-secondary); cursor: pointer; transform: translateX(2px) scale(.94); transition: transform 160ms ease-out, background 120ms, color 120ms; }
|
|
8
|
+
.chip:hover .chipDismissShade, .chip:focus-within .chipDismissShade { opacity: 1; }
|
|
9
|
+
.chip:hover .chipDismiss, .chip:focus-within .chipDismiss { pointer-events: auto; transform: none; }
|
|
10
|
+
.chipDismiss:hover { background: var(--dsw-alias-interactive-bg-hover-solid); color: var(--dsw-alias-label-primary); }
|
|
11
|
+
.chipDismiss:disabled { opacity: .45; cursor: default; }
|
|
12
|
+
.contextPanel { box-sizing: border-box; position: fixed; z-index: 1000; padding: 4px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--dsw-alias-border-l1); border-radius: 14px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); box-shadow: 0 8px 28px rgba(0,0,0,.12); animation: contextAppear 120ms ease-out; }
|
|
13
|
+
.contextList { list-style: none; margin: 0; padding: 0; }
|
|
14
|
+
.contextItem { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 8px 10px; border-radius: 10px; transition: background 120ms; }
|
|
15
|
+
.contextItem + .contextItem { border-top: 1px solid var(--dsw-alias-border-l1); }
|
|
16
|
+
.contextItem:hover, .contextItem:focus-within { background: var(--dsw-alias-interactive-bg-hover); }
|
|
17
|
+
.contextNumber { flex: none; min-width: 16px; color: var(--dsw-alias-label-tertiary); font-size: 12px; line-height: 21px; font-variant-numeric: tabular-nums; }
|
|
18
|
+
.contextContent { flex: 1; min-width: 0; }
|
|
19
|
+
.contextLabel { color: var(--dsw-alias-label-tertiary); font-size: 12px; line-height: 18px; }
|
|
20
|
+
.contextLabel:not(:first-child) { margin-top: 6px; }
|
|
21
|
+
.contextSource { margin-bottom: 8px; color: var(--dsw-alias-label-secondary); font-size: 12px; }
|
|
22
|
+
.contextText { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; user-select: text; }
|
|
23
|
+
.contextActions { display: flex; flex: none; gap: 2px; }
|
|
24
|
+
.contextAction { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--dsw-alias-label-tertiary); cursor: pointer; transition: color 120ms, background 120ms; }
|
|
25
|
+
.contextAction:hover { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-interactive-bg-hover); }
|
|
26
|
+
.contextAction:disabled, .chipClearAll:disabled { opacity: .45; cursor: default; }
|
|
27
|
+
.contextEditor { box-sizing: border-box; display: block; width: 100%; resize: vertical; min-height: 64px; margin-top: 4px; border: 1px solid var(--dsw-alias-border-l1); border-radius: 6px; padding: 6px 8px; background: var(--dsw-alias-bg-base); color: inherit; font: inherit; font-size: 13px; line-height: 1.6; }
|
|
28
|
+
.contextFooter { padding: 2px 10px 4px; }
|
|
29
|
+
.chipClearAll { border: 0; border-radius: 6px; background: transparent; color: var(--dsw-alias-label-tertiary); padding: 4px 6px; cursor: pointer; font: inherit; font-size: 12px; }
|
|
30
|
+
.chipClearAll:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-state-error-primary); }
|
|
31
|
+
.chipMain:focus-visible, .chipDismiss:focus-visible, .contextAction:focus-visible, .chipClearAll:focus-visible, .contextEditor:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary); outline-offset: 2px; }
|
|
32
|
+
.storageNotice { flex-basis: 100%; font-size: 12px; color: var(--dsw-alias-label-secondary); }
|
|
33
|
+
@keyframes contextAppear { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
|
|
34
|
+
@media (hover: none) { .chipMain { padding-right: 32px; } .chipDismissShade { opacity: 1; } .chipDismiss { pointer-events: auto; transform: none; } }
|
|
35
|
+
@media (prefers-reduced-motion: reduce) { .contextPanel { animation: none; } .chip, .chipDismissShade, .chipDismiss, .contextItem, .contextAction { transition: none; } }
|
|
36
|
+
.sentContext { color: var(--dsw-alias-label-secondary); font-size: 13px; margin: 8px 0; }
|
|
37
|
+
.sentContext summary { cursor: pointer; }
|
|
38
|
+
.sentContext pre, .sentContext blockquote { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
|
|
17
39
|
|
|
18
|
-
.
|
|
40
|
+
.userContextHost { display: contents; }
|
|
41
|
+
:global([data-sidenote-context-replaced]) { display: none !important; }
|
|
42
|
+
.sentChips { display: inline; white-space: normal; }
|
|
43
|
+
.sentChipGroup { display: inline; }
|
|
44
|
+
.sentChip {
|
|
19
45
|
display: inline-flex;
|
|
20
46
|
align-items: center;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
background: var(--dsw-alias-bg-layer-1, #ffffff);
|
|
25
|
-
color: var(--dsw-alias-label-primary, #1f2329);
|
|
26
|
-
font-size: 12px;
|
|
27
|
-
line-height: 18px;
|
|
28
|
-
padding: 2px 10px;
|
|
29
|
-
cursor: pointer;
|
|
30
|
-
user-select: none;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.chip:hover {
|
|
34
|
-
background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.05));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* chip 在输入框卡片正上方,展开面板向上打开(向下会盖住输入区)。 */
|
|
38
|
-
.chipPanel {
|
|
39
|
-
position: absolute;
|
|
40
|
-
bottom: calc(100% + 4px);
|
|
41
|
-
left: 0;
|
|
42
|
-
z-index: 50;
|
|
43
|
-
margin: 0;
|
|
44
|
-
padding: 4px;
|
|
45
|
-
list-style: none;
|
|
46
|
-
min-width: 220px;
|
|
47
|
-
max-width: 420px;
|
|
48
|
-
border: 1px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.08));
|
|
49
|
-
border-radius: 12px;
|
|
50
|
-
background: var(--dsw-alias-bg-layer-1, #ffffff);
|
|
51
|
-
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.chipRow {
|
|
55
|
-
display: flex;
|
|
56
|
-
align-items: center;
|
|
57
|
-
gap: 8px;
|
|
58
|
-
padding: 4px 6px;
|
|
59
|
-
border-radius: 8px;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.chipRow:hover {
|
|
63
|
-
background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.04));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.chipNumber {
|
|
67
|
-
flex: none;
|
|
68
|
-
width: 16px;
|
|
69
|
-
height: 16px;
|
|
70
|
-
border-radius: 999px;
|
|
71
|
-
background: #2f88ff;
|
|
72
|
-
color: #ffffff;
|
|
73
|
-
font-size: 10px;
|
|
74
|
-
font-weight: 600;
|
|
75
|
-
line-height: 16px;
|
|
76
|
-
text-align: center;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.chipText {
|
|
80
|
-
flex: auto;
|
|
81
|
-
min-width: 0;
|
|
82
|
-
overflow: hidden;
|
|
83
|
-
text-overflow: ellipsis;
|
|
84
|
-
white-space: nowrap;
|
|
85
|
-
font-size: 12px;
|
|
86
|
-
color: var(--dsw-alias-label-primary, #1f2329);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.chipNote {
|
|
90
|
-
color: var(--dsw-alias-label-tertiary, #8f959e);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.chipRemove {
|
|
94
|
-
flex: none;
|
|
95
|
-
width: 20px;
|
|
96
|
-
height: 20px;
|
|
97
|
-
border: none;
|
|
98
|
-
border-radius: 999px;
|
|
99
|
-
background: transparent;
|
|
100
|
-
color: var(--dsw-alias-label-tertiary, #8f959e);
|
|
101
|
-
cursor: pointer;
|
|
102
|
-
display: grid;
|
|
103
|
-
place-items: center;
|
|
104
|
-
padding: 0;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.chipRemove:hover {
|
|
108
|
-
background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.08));
|
|
109
|
-
color: var(--dsw-alias-state-error-primary, #d53f3f);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/* chip 展开面板的「清空全部」行。 */
|
|
113
|
-
.chipClearAll {
|
|
114
|
-
border: none;
|
|
115
|
-
background: transparent;
|
|
116
|
-
color: var(--dsw-alias-label-tertiary, #8f959e);
|
|
117
|
-
font-size: 12px;
|
|
118
|
-
line-height: 18px;
|
|
47
|
+
vertical-align: middle;
|
|
48
|
+
gap: 4px;
|
|
49
|
+
margin: 0 6px 2px 0;
|
|
119
50
|
padding: 2px 6px;
|
|
120
|
-
|
|
51
|
+
border: 0;
|
|
121
52
|
border-radius: 6px;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
color: var(--dsw-alias-state-error-primary, #d53f3f);
|
|
126
|
-
background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.04));
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/* P1-2:chip 行加不透明底带——转录内容滚动经过 composer 渐隐区时不再
|
|
130
|
-
从药丸背后透出(对齐宿主 composerSeat 的遮挡语义)。 */
|
|
131
|
-
.chipWrap {
|
|
132
|
-
background: var(--dsw-alias-bg-base, #ffffff);
|
|
133
|
-
padding: 2px 0;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/* P2-10:chip 展开面板加起源小三角(指向药丸)。 */
|
|
137
|
-
.chipPanel::after {
|
|
138
|
-
content: "";
|
|
139
|
-
position: absolute;
|
|
140
|
-
bottom: -5px;
|
|
141
|
-
left: 18px;
|
|
142
|
-
width: 10px;
|
|
143
|
-
height: 10px;
|
|
144
|
-
background: var(--dsw-alias-bg-layer-1, #ffffff);
|
|
145
|
-
border-right: 1px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.08));
|
|
146
|
-
border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.08));
|
|
147
|
-
transform: rotate(45deg);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
.side {
|
|
152
|
-
width: 100%;
|
|
153
|
-
max-width: none;
|
|
154
|
-
margin: 0;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.storageNotice {
|
|
53
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
54
|
+
color: var(--dsw-alias-label-secondary);
|
|
55
|
+
font: inherit;
|
|
158
56
|
font-size: 12px;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
.
|
|
163
|
-
.
|
|
57
|
+
line-height: 18px;
|
|
58
|
+
transition: background 140ms, color 140ms;
|
|
59
|
+
}
|
|
60
|
+
button.sentChip { cursor: pointer; }
|
|
61
|
+
button.sentChip:hover, button.sentChip[aria-expanded=true] { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-interactive-bg-hover-solid); }
|
|
62
|
+
button.sentChip:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary); outline-offset: 2px; }
|
|
63
|
+
.sentChevron, .sentChevronOpen { flex: none; opacity: .65; transition: transform 140ms; }
|
|
64
|
+
.sentChevronOpen { transform: rotate(180deg); }
|
|
65
|
+
.sentPreview { text-align: left; white-space: normal; }
|
|
66
|
+
@media (prefers-reduced-motion: reduce) { .sentChip, .sentChevron, .sentChevronOpen { transition: none; } }
|