@ruckc/truss-chat 1.42.0 → 1.44.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/dist/ChatSessions.svelte
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
+
import type { TimeValue } from '@ruckc/truss-ui';
|
|
3
|
+
|
|
2
4
|
export type ChatSession = {
|
|
3
5
|
/** A stable identifier, passed back to every callback and used for `selected`. */
|
|
4
6
|
id: string;
|
|
@@ -7,13 +9,15 @@
|
|
|
7
9
|
archived?: boolean;
|
|
8
10
|
/** A muted second line, e.g. "2 hours ago" or the last message. */
|
|
9
11
|
meta?: string;
|
|
12
|
+
/** When the conversation was last active: shown as a right-aligned, live, narrow relative time ("5m", "3h", "2d") on the title line. */
|
|
13
|
+
time?: TimeValue;
|
|
10
14
|
};
|
|
11
15
|
</script>
|
|
12
16
|
|
|
13
17
|
<script lang="ts">
|
|
14
18
|
import { tick } from 'svelte';
|
|
15
19
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
16
|
-
import { MenuButton, Switch } from '@ruckc/truss-ui';
|
|
20
|
+
import { MenuButton, RelativeTime, Switch } from '@ruckc/truss-ui';
|
|
17
21
|
import RenameField from './internal/RenameField.svelte';
|
|
18
22
|
|
|
19
23
|
let {
|
|
@@ -106,7 +110,7 @@
|
|
|
106
110
|
<RenameField value={s.title} label={renameLabel} oncommit={(t) => stop(s.id, t)} oncancel={() => stop(s.id)} />
|
|
107
111
|
{:else}
|
|
108
112
|
<button type="button" class="pick" aria-current={selected === s.id ? 'true' : undefined} onclick={() => pick(s.id)} ondblclick={() => (editing = s.id)} onkeydown={(e) => key(e, s.id)}>
|
|
109
|
-
<span class="title">{s.title}</span>
|
|
113
|
+
<span class="line"><span class="title">{s.title}</span>{#if s.time !== undefined}<RelativeTime value={s.time} format="narrow" live class="time" />{/if}</span>
|
|
110
114
|
{#if s.meta || s.archived}<span class="meta">{[s.archived && archivedText, s.meta].filter(Boolean).join(' · ')}</span>{/if}
|
|
111
115
|
</button>
|
|
112
116
|
<MenuButton
|
|
@@ -140,6 +144,10 @@
|
|
|
140
144
|
li[data-selected='true'] { background: var(--tr-primary-container); color: var(--tr-on-primary-container); }
|
|
141
145
|
.pick { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: var(--tr-space-1) var(--tr-space-2); border: 0; border-radius: var(--tr-radius-md); background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
|
|
142
146
|
.pick:focus-visible { outline: none; box-shadow: var(--tr-focus-ring); }
|
|
147
|
+
.line { align-self: stretch; display: flex; align-items: baseline; justify-content: space-between; gap: var(--tr-space-2); min-width: 0; }
|
|
148
|
+
.line .title { flex: 1; min-width: 0; }
|
|
149
|
+
.line :global(.time) { flex: none; font-size: var(--tr-text-sm); color: var(--tr-on-surface-variant); font-variant-numeric: tabular-nums; }
|
|
150
|
+
li[data-selected='true'] .line :global(.time) { color: inherit; }
|
|
143
151
|
.title, .meta { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
144
152
|
.meta { font-size: var(--tr-text-sm); color: var(--tr-on-surface-variant); }
|
|
145
153
|
li[data-selected='true'] .meta { color: inherit; }
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TimeValue } from '@ruckc/truss-ui';
|
|
1
2
|
export type ChatSession = {
|
|
2
3
|
/** A stable identifier, passed back to every callback and used for `selected`. */
|
|
3
4
|
id: string;
|
|
@@ -6,6 +7,8 @@ export type ChatSession = {
|
|
|
6
7
|
archived?: boolean;
|
|
7
8
|
/** A muted second line, e.g. "2 hours ago" or the last message. */
|
|
8
9
|
meta?: string;
|
|
10
|
+
/** When the conversation was last active: shown as a right-aligned, live, narrow relative time ("5m", "3h", "2d") on the title line. */
|
|
11
|
+
time?: TimeValue;
|
|
9
12
|
};
|
|
10
13
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
11
14
|
type $$ComponentProps = Omit<HTMLAttributes<HTMLElement>, 'children' | 'class'> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruckc/truss-chat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.0",
|
|
4
4
|
"description": "Chat building blocks for Truss UI: thread, messages, tool calls, composer, status line and a question form",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@ruckc/truss-ui": "^1.0.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ruckc/truss-markdown": "^1.
|
|
30
|
+
"@ruckc/truss-markdown": "^1.44.0"
|
|
31
31
|
},
|
|
32
32
|
"author": "Curtis Ruck",
|
|
33
33
|
"homepage": "https://truss.ruck.io",
|