@sentropic/design-system-svelte 0.42.0 → 0.43.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/dist/CommentAuthorship.svelte +186 -0
- package/dist/CommentAuthorship.svelte.d.ts +18 -0
- package/dist/CommentAuthorship.svelte.d.ts.map +1 -0
- package/dist/CommentComposer.svelte +336 -0
- package/dist/CommentComposer.svelte.d.ts +33 -0
- package/dist/CommentComposer.svelte.d.ts.map +1 -0
- package/dist/CommentLayer.svelte +1629 -0
- package/dist/CommentLayer.svelte.d.ts +64 -0
- package/dist/CommentLayer.svelte.d.ts.map +1 -0
- package/dist/CommentPin.svelte +219 -0
- package/dist/CommentPin.svelte.d.ts +26 -0
- package/dist/CommentPin.svelte.d.ts.map +1 -0
- package/dist/CommentThread.svelte +801 -0
- package/dist/CommentThread.svelte.d.ts +42 -0
- package/dist/CommentThread.svelte.d.ts.map +1 -0
- package/dist/DiagramCard.svelte +14 -4
- package/dist/DiagramCard.svelte.d.ts.map +1 -1
- package/dist/DiagramCardHeader.svelte +14 -2
- package/dist/DiagramCardHeader.svelte.d.ts +2 -0
- package/dist/DiagramCardHeader.svelte.d.ts.map +1 -1
- package/dist/DiagramSceneFigure.svelte +24 -3
- package/dist/DiagramSceneFigure.svelte.d.ts +1 -1
- package/dist/DiagramSceneFigure.svelte.d.ts.map +1 -1
- package/dist/DiagramZone.svelte +31 -13
- package/dist/DiagramZone.svelte.d.ts.map +1 -1
- package/dist/DiagramZoneHeader.svelte +1 -0
- package/dist/Drawer.svelte +96 -4
- package/dist/Drawer.svelte.d.ts.map +1 -1
- package/dist/OrphanList.svelte +267 -0
- package/dist/OrphanList.svelte.d.ts +18 -0
- package/dist/OrphanList.svelte.d.ts.map +1 -0
- package/dist/ReviewModeToggle.svelte +110 -0
- package/dist/ReviewModeToggle.svelte.d.ts +19 -0
- package/dist/ReviewModeToggle.svelte.d.ts.map +1 -0
- package/dist/ThreadPanel.svelte +654 -0
- package/dist/ThreadPanel.svelte.d.ts +42 -0
- package/dist/ThreadPanel.svelte.d.ts.map +1 -0
- package/dist/diagram-render/renderCardSvg.js +1 -1
- package/dist/diagram-render/renderZoneSvg.js +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/review-markdown.d.ts +90 -0
- package/dist/review-markdown.d.ts.map +1 -0
- package/dist/review-markdown.js +379 -0
- package/package.json +5 -4
|
@@ -0,0 +1,654 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import type {
|
|
5
|
+
CollaborationActor,
|
|
6
|
+
ReviewComment,
|
|
7
|
+
ReviewThread,
|
|
8
|
+
ThreadFilter,
|
|
9
|
+
ThreadReadState,
|
|
10
|
+
} from "@sentropic/design-system-review-core";
|
|
11
|
+
|
|
12
|
+
export type ThreadPanelProps = Omit<HTMLAttributes<HTMLElement>, "class"> & {
|
|
13
|
+
/** Attached threads (or full thread list when `orphaned` is a subset). */
|
|
14
|
+
threads: readonly ReviewThread[];
|
|
15
|
+
/** Unattached/orphaned threads rendered in `OrphanList` and counted in the header. */
|
|
16
|
+
orphaned?: readonly ReviewThread[];
|
|
17
|
+
currentUser: CollaborationActor;
|
|
18
|
+
activeThreadId?: string | null;
|
|
19
|
+
/** Active filter (`"all" | "open" | "resolved" | "mine"`). */
|
|
20
|
+
filter?: ThreadFilter;
|
|
21
|
+
/** Controls visibility of the panel / <48rem bottom sheet (default `true`). */
|
|
22
|
+
open?: boolean;
|
|
23
|
+
readState?: ThreadReadState | null;
|
|
24
|
+
canModerate?: boolean;
|
|
25
|
+
title?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Explicit compact (<48rem bottom-sheet `Drawer`) override.
|
|
28
|
+
* When omitted, tracks `window.matchMedia("(max-width: 47.999rem)")`.
|
|
29
|
+
*/
|
|
30
|
+
compact?: boolean;
|
|
31
|
+
class?: string;
|
|
32
|
+
onSelect?: (threadId: string | null) => void;
|
|
33
|
+
onFilterChange?: (filter: ThreadFilter) => void;
|
|
34
|
+
onClose?: () => void;
|
|
35
|
+
onReply?: (threadId: string, body: string) => void | Promise<void>;
|
|
36
|
+
onResolve?: (threadId: string) => void | Promise<void>;
|
|
37
|
+
onReopen?: (threadId: string) => void | Promise<void>;
|
|
38
|
+
onEditComment?: (commentId: string, body: string) => void | Promise<void>;
|
|
39
|
+
onDeleteComment?: (commentId: string) => void | Promise<void>;
|
|
40
|
+
onReanchor?: (threadId: string) => void | Promise<void>;
|
|
41
|
+
onMarkRead?: (threadId: string) => void;
|
|
42
|
+
headerActions?: Snippet;
|
|
43
|
+
commentBody?: Snippet<[{ comment: ReviewComment }]>;
|
|
44
|
+
};
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<script lang="ts">
|
|
48
|
+
import { tick, untrack } from "svelte";
|
|
49
|
+
import { ArrowLeft, X } from "@lucide/svelte";
|
|
50
|
+
import {
|
|
51
|
+
countThreadsByFilter,
|
|
52
|
+
countUnreadThreads,
|
|
53
|
+
filterThreads,
|
|
54
|
+
getCommentStateLabel,
|
|
55
|
+
isUnread,
|
|
56
|
+
} from "@sentropic/design-system-review-core";
|
|
57
|
+
import Badge from "./Badge.svelte";
|
|
58
|
+
import Button from "./Button.svelte";
|
|
59
|
+
import CommentAuthorship from "./CommentAuthorship.svelte";
|
|
60
|
+
import CommentThread from "./CommentThread.svelte";
|
|
61
|
+
import Drawer from "./Drawer.svelte";
|
|
62
|
+
import EmptyState from "./EmptyState.svelte";
|
|
63
|
+
import IconButton from "./IconButton.svelte";
|
|
64
|
+
import OrphanList from "./OrphanList.svelte";
|
|
65
|
+
import { formatAnchorLabel } from "./review-markdown.js";
|
|
66
|
+
|
|
67
|
+
const COMPACT_MEDIA_QUERY = "(max-width: 47.999rem)";
|
|
68
|
+
const FILTER_OPTIONS: ReadonlyArray<{ id: ThreadFilter; label: string }> = [
|
|
69
|
+
{ id: "all", label: "All" },
|
|
70
|
+
{ id: "open", label: "Open" },
|
|
71
|
+
{ id: "resolved", label: "Resolved" },
|
|
72
|
+
{ id: "mine", label: "Mine" },
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
let {
|
|
76
|
+
threads,
|
|
77
|
+
orphaned = [],
|
|
78
|
+
currentUser,
|
|
79
|
+
activeThreadId = null,
|
|
80
|
+
filter,
|
|
81
|
+
open = true,
|
|
82
|
+
readState = null,
|
|
83
|
+
canModerate = false,
|
|
84
|
+
title = "Comments",
|
|
85
|
+
compact,
|
|
86
|
+
class: className,
|
|
87
|
+
onSelect,
|
|
88
|
+
onFilterChange,
|
|
89
|
+
onClose,
|
|
90
|
+
onReply,
|
|
91
|
+
onResolve,
|
|
92
|
+
onReopen,
|
|
93
|
+
onEditComment,
|
|
94
|
+
onDeleteComment,
|
|
95
|
+
onReanchor,
|
|
96
|
+
onMarkRead,
|
|
97
|
+
headerActions,
|
|
98
|
+
commentBody,
|
|
99
|
+
...rest
|
|
100
|
+
}: ThreadPanelProps = $props();
|
|
101
|
+
|
|
102
|
+
let asideEl: HTMLElement | undefined = $state();
|
|
103
|
+
let headingEl: HTMLHeadingElement | undefined = $state();
|
|
104
|
+
let compactContainerEl: HTMLElement | undefined = $state();
|
|
105
|
+
let mediaCompact = $state(false);
|
|
106
|
+
let localFilter = $state<ThreadFilter>(untrack(() => filter ?? "all"));
|
|
107
|
+
let liveAnnouncement = $state("");
|
|
108
|
+
let prevActiveId: string | null = untrack(() => activeThreadId);
|
|
109
|
+
|
|
110
|
+
const isCompact = $derived(compact ?? mediaCompact);
|
|
111
|
+
const effectiveFilter = $derived<ThreadFilter>(filter ?? localFilter);
|
|
112
|
+
|
|
113
|
+
const orphanIds = $derived(new Set(orphaned.map((t) => t.threadId)));
|
|
114
|
+
const attachedOnly = $derived(threads.filter((t) => !orphanIds.has(t.threadId)));
|
|
115
|
+
|
|
116
|
+
const allThreads = $derived.by<ReviewThread[]>(() => {
|
|
117
|
+
const seen = new Set<string>();
|
|
118
|
+
const combined: ReviewThread[] = [];
|
|
119
|
+
for (const t of threads) {
|
|
120
|
+
if (!seen.has(t.threadId)) {
|
|
121
|
+
seen.add(t.threadId);
|
|
122
|
+
combined.push(t);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
for (const o of orphaned) {
|
|
126
|
+
if (!seen.has(o.threadId)) {
|
|
127
|
+
seen.add(o.threadId);
|
|
128
|
+
combined.push(o);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return combined;
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const filterCounts = $derived(countThreadsByFilter(allThreads, currentUser));
|
|
135
|
+
const unreadTotal = $derived(countUnreadThreads(allThreads, currentUser, readState));
|
|
136
|
+
const filteredAttached = $derived(filterThreads(attachedOnly, effectiveFilter, currentUser));
|
|
137
|
+
const filteredOrphaned = $derived(filterThreads(orphaned, effectiveFilter, currentUser));
|
|
138
|
+
const activeThread = $derived(
|
|
139
|
+
activeThreadId !== null && activeThreadId !== undefined
|
|
140
|
+
? allThreads.find((t) => t.threadId === activeThreadId) ?? null
|
|
141
|
+
: null,
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
// Track <48rem breakpoint when `compact` prop is not explicitly controlled.
|
|
145
|
+
$effect(() => {
|
|
146
|
+
if (compact !== undefined || typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const mql = window.matchMedia(COMPACT_MEDIA_QUERY);
|
|
150
|
+
mediaCompact = mql.matches;
|
|
151
|
+
const onChange = (event: MediaQueryListEvent) => {
|
|
152
|
+
mediaCompact = event.matches;
|
|
153
|
+
};
|
|
154
|
+
mql.addEventListener("change", onChange);
|
|
155
|
+
return () => mql.removeEventListener("change", onChange);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
function resolvePanelHeading(): HTMLElement | null {
|
|
159
|
+
if (headingEl) return headingEl;
|
|
160
|
+
return (
|
|
161
|
+
compactContainerEl
|
|
162
|
+
?.closest(".st-drawer")
|
|
163
|
+
?.querySelector<HTMLElement>(".st-drawer__title") ?? null
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Focus panel heading when transitioning to a newly selected thread in both >=48rem aside
|
|
168
|
+
// and <48rem bottom sheet (SPEC-r6 §3).
|
|
169
|
+
$effect(() => {
|
|
170
|
+
const nextId = activeThreadId ?? null;
|
|
171
|
+
const isOpen = open;
|
|
172
|
+
// Track container bindings so heading focus runs once the active surface mounts.
|
|
173
|
+
void headingEl;
|
|
174
|
+
void compactContainerEl;
|
|
175
|
+
if (isOpen && nextId !== null && nextId !== prevActiveId) {
|
|
176
|
+
void tick().then(() => {
|
|
177
|
+
resolvePanelHeading()?.focus();
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
prevActiveId = nextId;
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// Element-scoped Escape on non-modal >=48rem <aside> (never pre-empts an inner composer/popover).
|
|
184
|
+
$effect(() => {
|
|
185
|
+
const node = asideEl;
|
|
186
|
+
if (!node || isCompact || !open) return;
|
|
187
|
+
const onKeydown = (event: KeyboardEvent) => {
|
|
188
|
+
if (event.key !== "Escape") return;
|
|
189
|
+
event.preventDefault();
|
|
190
|
+
event.stopPropagation();
|
|
191
|
+
if (activeThreadId !== null && activeThreadId !== undefined) {
|
|
192
|
+
onSelect?.(null);
|
|
193
|
+
} else {
|
|
194
|
+
onClose?.();
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
node.addEventListener("keydown", onKeydown);
|
|
198
|
+
return () => node.removeEventListener("keydown", onKeydown);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
function selectFilter(next: ThreadFilter) {
|
|
202
|
+
localFilter = next;
|
|
203
|
+
onFilterChange?.(next);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function handleSelectThread(threadId: string) {
|
|
207
|
+
onSelect?.(threadId);
|
|
208
|
+
onMarkRead?.(threadId);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async function handleResolveWithLive(threadId: string) {
|
|
212
|
+
if (!onResolve) return;
|
|
213
|
+
await onResolve(threadId);
|
|
214
|
+
liveAnnouncement = "Thread resolved.";
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async function handleReopenWithLive(threadId: string) {
|
|
218
|
+
if (!onReopen) return;
|
|
219
|
+
await onReopen(threadId);
|
|
220
|
+
liveAnnouncement = "Thread reopened.";
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async function handleReplyWithLive(threadId: string, body: string) {
|
|
224
|
+
if (!onReply) return;
|
|
225
|
+
await onReply(threadId, body);
|
|
226
|
+
liveAnnouncement = "Reply posted.";
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const classes = $derived(["st-review-panel", className].filter(Boolean).join(" "));
|
|
230
|
+
</script>
|
|
231
|
+
|
|
232
|
+
{#snippet panelBody()}
|
|
233
|
+
<div class="st-review-panel__filters" role="group" aria-label="Filter comment threads">
|
|
234
|
+
{#each FILTER_OPTIONS as option (option.id)}
|
|
235
|
+
{@const count = filterCounts[option.id]}
|
|
236
|
+
{@const selected = effectiveFilter === option.id}
|
|
237
|
+
<button
|
|
238
|
+
type="button"
|
|
239
|
+
class="st-review-panel__filter-tab"
|
|
240
|
+
class:st-review-panel__filter-tab--active={selected}
|
|
241
|
+
aria-pressed={selected ? "true" : "false"}
|
|
242
|
+
onclick={() => selectFilter(option.id)}
|
|
243
|
+
>
|
|
244
|
+
<span>{option.label}</span>
|
|
245
|
+
<span class="st-review-panel__filter-count">{count}</span>
|
|
246
|
+
</button>
|
|
247
|
+
{/each}
|
|
248
|
+
</div>
|
|
249
|
+
|
|
250
|
+
<div class="st-review-panel__content">
|
|
251
|
+
{#if activeThread}
|
|
252
|
+
<div class="st-review-panel__detail">
|
|
253
|
+
<div class="st-review-panel__back-row">
|
|
254
|
+
<Button
|
|
255
|
+
type="button"
|
|
256
|
+
variant="ghost"
|
|
257
|
+
size="sm"
|
|
258
|
+
onclick={() => onSelect?.(null)}
|
|
259
|
+
>
|
|
260
|
+
<ArrowLeft size={14} strokeWidth={2} aria-hidden="true" />
|
|
261
|
+
<span>All threads</span>
|
|
262
|
+
</Button>
|
|
263
|
+
</div>
|
|
264
|
+
|
|
265
|
+
<CommentThread
|
|
266
|
+
thread={activeThread}
|
|
267
|
+
{currentUser}
|
|
268
|
+
{canModerate}
|
|
269
|
+
{readState}
|
|
270
|
+
onReply={onReply ? handleReplyWithLive : undefined}
|
|
271
|
+
onResolve={onResolve ? handleResolveWithLive : undefined}
|
|
272
|
+
onReopen={onReopen ? handleReopenWithLive : undefined}
|
|
273
|
+
{onEditComment}
|
|
274
|
+
{onDeleteComment}
|
|
275
|
+
{onReanchor}
|
|
276
|
+
{commentBody}
|
|
277
|
+
/>
|
|
278
|
+
</div>
|
|
279
|
+
{:else if filteredAttached.length === 0 && filteredOrphaned.length === 0}
|
|
280
|
+
<EmptyState
|
|
281
|
+
title="No matching threads"
|
|
282
|
+
message={effectiveFilter === "all"
|
|
283
|
+
? "Select text or click an element in Review mode to start a thread."
|
|
284
|
+
: `No threads match the "${effectiveFilter}" filter.`}
|
|
285
|
+
/>
|
|
286
|
+
{:else}
|
|
287
|
+
{#if filteredAttached.length > 0}
|
|
288
|
+
<ul class="st-review-panel__list">
|
|
289
|
+
{#each filteredAttached as thread (thread.threadId)}
|
|
290
|
+
{@const rootComment = thread.comments[0]}
|
|
291
|
+
{@const unread = isUnread(thread, currentUser, readState)}
|
|
292
|
+
{@const stateLabel = getCommentStateLabel(thread.state)}
|
|
293
|
+
{@const excerpt = formatAnchorLabel(thread.anchor, 100)}
|
|
294
|
+
<li>
|
|
295
|
+
<button
|
|
296
|
+
type="button"
|
|
297
|
+
class="st-review-panel__thread-card"
|
|
298
|
+
class:st-review-panel__thread-card--unread={unread}
|
|
299
|
+
class:st-review-panel__thread-card--resolved={thread.state === "closed"}
|
|
300
|
+
data-thread-id={thread.threadId}
|
|
301
|
+
data-thread-state={thread.state}
|
|
302
|
+
data-unread={unread ? "true" : "false"}
|
|
303
|
+
onclick={() => handleSelectThread(thread.threadId)}
|
|
304
|
+
>
|
|
305
|
+
<div class="st-review-panel__card-top">
|
|
306
|
+
{#if rootComment}
|
|
307
|
+
<CommentAuthorship
|
|
308
|
+
author={rootComment.authorship.author}
|
|
309
|
+
sponsor={rootComment.authorship.sponsor}
|
|
310
|
+
size="sm"
|
|
311
|
+
/>
|
|
312
|
+
{/if}
|
|
313
|
+
<div class="st-review-panel__card-badges">
|
|
314
|
+
{#if unread}
|
|
315
|
+
<span
|
|
316
|
+
class="st-review-panel__unread-dot"
|
|
317
|
+
aria-label="Unread"
|
|
318
|
+
></span>
|
|
319
|
+
{/if}
|
|
320
|
+
<Badge
|
|
321
|
+
size="sm"
|
|
322
|
+
tone={thread.state === "closed" ? "success" : "info"}
|
|
323
|
+
>
|
|
324
|
+
{stateLabel}
|
|
325
|
+
</Badge>
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
|
|
329
|
+
<span class="st-review-panel__card-anchor">{excerpt}</span>
|
|
330
|
+
|
|
331
|
+
{#if rootComment}
|
|
332
|
+
<span class="st-review-panel__card-preview">{rootComment.body}</span>
|
|
333
|
+
{/if}
|
|
334
|
+
|
|
335
|
+
<span class="st-review-panel__card-count">
|
|
336
|
+
{thread.comments.length} {thread.comments.length === 1 ? "comment" : "comments"}
|
|
337
|
+
</span>
|
|
338
|
+
</button>
|
|
339
|
+
</li>
|
|
340
|
+
{/each}
|
|
341
|
+
</ul>
|
|
342
|
+
{/if}
|
|
343
|
+
|
|
344
|
+
{#if filteredOrphaned.length > 0}
|
|
345
|
+
<OrphanList
|
|
346
|
+
threads={filteredOrphaned}
|
|
347
|
+
{currentUser}
|
|
348
|
+
{readState}
|
|
349
|
+
onSelect={handleSelectThread}
|
|
350
|
+
onResolve={onResolve ? handleResolveWithLive : undefined}
|
|
351
|
+
onReopen={onReopen ? handleReopenWithLive : undefined}
|
|
352
|
+
{onReanchor}
|
|
353
|
+
/>
|
|
354
|
+
{/if}
|
|
355
|
+
{/if}
|
|
356
|
+
</div>
|
|
357
|
+
|
|
358
|
+
<div class="st-review-panel__sr-live" aria-live="polite" aria-atomic="true">
|
|
359
|
+
{liveAnnouncement}
|
|
360
|
+
</div>
|
|
361
|
+
{/snippet}
|
|
362
|
+
|
|
363
|
+
{#if isCompact}
|
|
364
|
+
<!-- <48rem: modal bottom sheet via Drawer side="bottom" (the only use of Drawer in the kit). -->
|
|
365
|
+
<Drawer
|
|
366
|
+
{open}
|
|
367
|
+
side="bottom"
|
|
368
|
+
{title}
|
|
369
|
+
class={className}
|
|
370
|
+
onclose={() => onClose?.()}
|
|
371
|
+
>
|
|
372
|
+
<div bind:this={compactContainerEl} class="st-review-panel__compact-meta">
|
|
373
|
+
{#if unreadTotal > 0}
|
|
374
|
+
<Badge size="sm" tone="info" class="st-review-panel__unread-count">
|
|
375
|
+
{unreadTotal} unread
|
|
376
|
+
</Badge>
|
|
377
|
+
{/if}
|
|
378
|
+
{#if orphaned.length > 0}
|
|
379
|
+
<Badge size="sm" tone="warning" class="st-review-panel__orphan-count">
|
|
380
|
+
{orphaned.length} unattached
|
|
381
|
+
</Badge>
|
|
382
|
+
{/if}
|
|
383
|
+
{#if headerActions}
|
|
384
|
+
<div class="st-review-panel__header-actions">
|
|
385
|
+
{@render headerActions()}
|
|
386
|
+
</div>
|
|
387
|
+
{/if}
|
|
388
|
+
</div>
|
|
389
|
+
{@render panelBody()}
|
|
390
|
+
</Drawer>
|
|
391
|
+
{:else if open}
|
|
392
|
+
<!-- >=48rem: non-modal anchored <aside> (22-26rem, no scrim, no aria-modal, no outside-click close). -->
|
|
393
|
+
<aside
|
|
394
|
+
{...rest}
|
|
395
|
+
bind:this={asideEl}
|
|
396
|
+
class={classes}
|
|
397
|
+
aria-label={title}
|
|
398
|
+
>
|
|
399
|
+
<header class="st-review-panel__header">
|
|
400
|
+
<div class="st-review-panel__title-group">
|
|
401
|
+
<h2
|
|
402
|
+
bind:this={headingEl}
|
|
403
|
+
tabindex="-1"
|
|
404
|
+
class="st-review-panel__heading"
|
|
405
|
+
>
|
|
406
|
+
{title}
|
|
407
|
+
</h2>
|
|
408
|
+
{#if unreadTotal > 0}
|
|
409
|
+
<Badge size="sm" tone="info" class="st-review-panel__unread-count">
|
|
410
|
+
{unreadTotal} unread
|
|
411
|
+
</Badge>
|
|
412
|
+
{/if}
|
|
413
|
+
{#if orphaned.length > 0}
|
|
414
|
+
<Badge size="sm" tone="warning" class="st-review-panel__orphan-count">
|
|
415
|
+
{orphaned.length} unattached
|
|
416
|
+
</Badge>
|
|
417
|
+
{/if}
|
|
418
|
+
</div>
|
|
419
|
+
|
|
420
|
+
<div class="st-review-panel__header-actions">
|
|
421
|
+
{#if headerActions}
|
|
422
|
+
{@render headerActions()}
|
|
423
|
+
{/if}
|
|
424
|
+
{#if onClose}
|
|
425
|
+
<IconButton
|
|
426
|
+
size="sm"
|
|
427
|
+
variant="ghost"
|
|
428
|
+
aria-label="Close comments panel"
|
|
429
|
+
onclick={() => onClose()}
|
|
430
|
+
>
|
|
431
|
+
<X size={16} strokeWidth={2} aria-hidden="true" />
|
|
432
|
+
</IconButton>
|
|
433
|
+
{/if}
|
|
434
|
+
</div>
|
|
435
|
+
</header>
|
|
436
|
+
|
|
437
|
+
{@render panelBody()}
|
|
438
|
+
</aside>
|
|
439
|
+
{/if}
|
|
440
|
+
|
|
441
|
+
<style>
|
|
442
|
+
/* >=48rem non-modal anchored aside (22-26rem wide, no scrim, pins stay interactive). */
|
|
443
|
+
.st-review-panel {
|
|
444
|
+
background: var(
|
|
445
|
+
--st-component-review-panel-background,
|
|
446
|
+
var(--st-semantic-surface-raised, #ffffff)
|
|
447
|
+
);
|
|
448
|
+
border: 1px solid
|
|
449
|
+
var(--st-component-review-panel-border, var(--st-semantic-border-subtle));
|
|
450
|
+
border-radius: var(--st-component-review-panel-radius, var(--st-radius-md, 0.5rem));
|
|
451
|
+
color: var(--st-semantic-text-primary);
|
|
452
|
+
display: grid;
|
|
453
|
+
gap: var(--st-spacing-3, 0.75rem);
|
|
454
|
+
grid-template-rows: auto auto 1fr;
|
|
455
|
+
max-width: var(--st-component-review-panel-maxWidth, 26rem);
|
|
456
|
+
min-width: var(--st-component-review-panel-minWidth, 22rem);
|
|
457
|
+
padding: var(--st-spacing-4, 1rem);
|
|
458
|
+
width: var(--st-component-review-panel-width, 24rem);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.st-review-panel__header {
|
|
462
|
+
align-items: center;
|
|
463
|
+
border-bottom: 1px solid var(--st-semantic-border-subtle);
|
|
464
|
+
display: flex;
|
|
465
|
+
gap: var(--st-spacing-2, 0.5rem);
|
|
466
|
+
justify-content: space-between;
|
|
467
|
+
padding-bottom: var(--st-spacing-2, 0.5rem);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.st-review-panel__title-group {
|
|
471
|
+
align-items: center;
|
|
472
|
+
display: inline-flex;
|
|
473
|
+
flex-wrap: wrap;
|
|
474
|
+
gap: var(--st-spacing-2, 0.5rem);
|
|
475
|
+
min-width: 0;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.st-review-panel__heading {
|
|
479
|
+
font-size: 1rem;
|
|
480
|
+
font-weight: 700;
|
|
481
|
+
line-height: 1.3;
|
|
482
|
+
margin: 0;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.st-review-panel__heading:focus-visible {
|
|
486
|
+
outline: 2px solid var(--st-semantic-border-interactive, #2563eb);
|
|
487
|
+
outline-offset: 2px;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.st-review-panel__header-actions {
|
|
491
|
+
align-items: center;
|
|
492
|
+
display: inline-flex;
|
|
493
|
+
gap: var(--st-spacing-1, 0.25rem);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.st-review-panel__compact-meta {
|
|
497
|
+
align-items: center;
|
|
498
|
+
display: flex;
|
|
499
|
+
flex-wrap: wrap;
|
|
500
|
+
gap: var(--st-spacing-2, 0.5rem);
|
|
501
|
+
justify-content: space-between;
|
|
502
|
+
margin-bottom: var(--st-spacing-2, 0.5rem);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.st-review-panel__filters {
|
|
506
|
+
display: flex;
|
|
507
|
+
flex-wrap: wrap;
|
|
508
|
+
gap: var(--st-spacing-1, 0.25rem);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.st-review-panel__filter-tab {
|
|
512
|
+
align-items: center;
|
|
513
|
+
background: transparent;
|
|
514
|
+
border: 1px solid var(--st-semantic-border-subtle);
|
|
515
|
+
border-radius: var(--st-radius-pill, 999px);
|
|
516
|
+
color: var(--st-semantic-text-secondary);
|
|
517
|
+
cursor: pointer;
|
|
518
|
+
display: inline-flex;
|
|
519
|
+
font: inherit;
|
|
520
|
+
font-size: 0.75rem;
|
|
521
|
+
font-weight: 600;
|
|
522
|
+
gap: 0.375rem;
|
|
523
|
+
padding: 0.25rem 0.625rem;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.st-review-panel__filter-tab--active {
|
|
527
|
+
background: var(--st-semantic-action-primary, #2563eb);
|
|
528
|
+
border-color: var(--st-semantic-action-primary, #2563eb);
|
|
529
|
+
color: var(--st-semantic-action-primaryText, #ffffff);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.st-review-panel__filter-tab:focus-visible {
|
|
533
|
+
outline: 2px solid var(--st-semantic-border-interactive, #2563eb);
|
|
534
|
+
outline-offset: 2px;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.st-review-panel__filter-count {
|
|
538
|
+
font-variant-numeric: tabular-nums;
|
|
539
|
+
opacity: 0.85;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.st-review-panel__content {
|
|
543
|
+
display: grid;
|
|
544
|
+
gap: var(--st-spacing-3, 0.75rem);
|
|
545
|
+
min-height: 0;
|
|
546
|
+
overflow: auto;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.st-review-panel__detail {
|
|
550
|
+
display: grid;
|
|
551
|
+
gap: var(--st-spacing-2, 0.5rem);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.st-review-panel__back-row {
|
|
555
|
+
display: flex;
|
|
556
|
+
justify-content: flex-start;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.st-review-panel__list {
|
|
560
|
+
display: grid;
|
|
561
|
+
gap: var(--st-spacing-2, 0.5rem);
|
|
562
|
+
list-style: none;
|
|
563
|
+
margin: 0;
|
|
564
|
+
padding: 0;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.st-review-panel__thread-card {
|
|
568
|
+
background: var(--st-semantic-surface-default, #ffffff);
|
|
569
|
+
border: 1px solid var(--st-semantic-border-subtle);
|
|
570
|
+
border-radius: var(--st-radius-md, 0.5rem);
|
|
571
|
+
color: var(--st-semantic-text-primary);
|
|
572
|
+
cursor: pointer;
|
|
573
|
+
display: grid;
|
|
574
|
+
font: inherit;
|
|
575
|
+
gap: var(--st-spacing-1, 0.25rem);
|
|
576
|
+
padding: var(--st-spacing-3, 0.75rem);
|
|
577
|
+
text-align: start;
|
|
578
|
+
width: 100%;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.st-review-panel__thread-card:hover {
|
|
582
|
+
border-color: var(--st-semantic-border-strong, #94a3b8);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
.st-review-panel__thread-card:focus-visible {
|
|
586
|
+
outline: 2px solid var(--st-semantic-border-interactive, #2563eb);
|
|
587
|
+
outline-offset: 2px;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.st-review-panel__thread-card--unread {
|
|
591
|
+
border-color: var(--st-semantic-border-interactive, #2563eb);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.st-review-panel__thread-card--resolved {
|
|
595
|
+
opacity: 0.75;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
.st-review-panel__card-top {
|
|
599
|
+
align-items: flex-start;
|
|
600
|
+
display: flex;
|
|
601
|
+
gap: var(--st-spacing-2, 0.5rem);
|
|
602
|
+
justify-content: space-between;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.st-review-panel__card-badges {
|
|
606
|
+
align-items: center;
|
|
607
|
+
display: inline-flex;
|
|
608
|
+
flex: 0 0 auto;
|
|
609
|
+
gap: var(--st-spacing-1, 0.25rem);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
.st-review-panel__unread-dot {
|
|
613
|
+
background: var(--st-component-review-unreadDot, var(--st-semantic-feedback-info, #2563eb));
|
|
614
|
+
border-radius: 999px;
|
|
615
|
+
display: inline-block;
|
|
616
|
+
height: 0.5rem;
|
|
617
|
+
width: 0.5rem;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.st-review-panel__card-anchor {
|
|
621
|
+
color: var(--st-semantic-text-secondary);
|
|
622
|
+
font-size: 0.75rem;
|
|
623
|
+
font-style: italic;
|
|
624
|
+
overflow: hidden;
|
|
625
|
+
text-overflow: ellipsis;
|
|
626
|
+
white-space: nowrap;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.st-review-panel__card-preview {
|
|
630
|
+
font-size: 0.8125rem;
|
|
631
|
+
line-height: 1.4;
|
|
632
|
+
overflow: hidden;
|
|
633
|
+
text-overflow: ellipsis;
|
|
634
|
+
white-space: nowrap;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.st-review-panel__card-count {
|
|
638
|
+
color: var(--st-semantic-text-secondary);
|
|
639
|
+
font-size: 0.75rem;
|
|
640
|
+
font-variant-numeric: tabular-nums;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.st-review-panel__sr-live {
|
|
644
|
+
border: 0;
|
|
645
|
+
clip: rect(0 0 0 0);
|
|
646
|
+
clip-path: inset(50%);
|
|
647
|
+
height: 1px;
|
|
648
|
+
overflow: hidden;
|
|
649
|
+
padding: 0;
|
|
650
|
+
position: absolute;
|
|
651
|
+
white-space: nowrap;
|
|
652
|
+
width: 1px;
|
|
653
|
+
}
|
|
654
|
+
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { CollaborationActor, ReviewComment, ReviewThread, ThreadFilter, ThreadReadState } from "@sentropic/design-system-review-core";
|
|
4
|
+
export type ThreadPanelProps = Omit<HTMLAttributes<HTMLElement>, "class"> & {
|
|
5
|
+
/** Attached threads (or full thread list when `orphaned` is a subset). */
|
|
6
|
+
threads: readonly ReviewThread[];
|
|
7
|
+
/** Unattached/orphaned threads rendered in `OrphanList` and counted in the header. */
|
|
8
|
+
orphaned?: readonly ReviewThread[];
|
|
9
|
+
currentUser: CollaborationActor;
|
|
10
|
+
activeThreadId?: string | null;
|
|
11
|
+
/** Active filter (`"all" | "open" | "resolved" | "mine"`). */
|
|
12
|
+
filter?: ThreadFilter;
|
|
13
|
+
/** Controls visibility of the panel / <48rem bottom sheet (default `true`). */
|
|
14
|
+
open?: boolean;
|
|
15
|
+
readState?: ThreadReadState | null;
|
|
16
|
+
canModerate?: boolean;
|
|
17
|
+
title?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Explicit compact (<48rem bottom-sheet `Drawer`) override.
|
|
20
|
+
* When omitted, tracks `window.matchMedia("(max-width: 47.999rem)")`.
|
|
21
|
+
*/
|
|
22
|
+
compact?: boolean;
|
|
23
|
+
class?: string;
|
|
24
|
+
onSelect?: (threadId: string | null) => void;
|
|
25
|
+
onFilterChange?: (filter: ThreadFilter) => void;
|
|
26
|
+
onClose?: () => void;
|
|
27
|
+
onReply?: (threadId: string, body: string) => void | Promise<void>;
|
|
28
|
+
onResolve?: (threadId: string) => void | Promise<void>;
|
|
29
|
+
onReopen?: (threadId: string) => void | Promise<void>;
|
|
30
|
+
onEditComment?: (commentId: string, body: string) => void | Promise<void>;
|
|
31
|
+
onDeleteComment?: (commentId: string) => void | Promise<void>;
|
|
32
|
+
onReanchor?: (threadId: string) => void | Promise<void>;
|
|
33
|
+
onMarkRead?: (threadId: string) => void;
|
|
34
|
+
headerActions?: Snippet;
|
|
35
|
+
commentBody?: Snippet<[{
|
|
36
|
+
comment: ReviewComment;
|
|
37
|
+
}]>;
|
|
38
|
+
};
|
|
39
|
+
declare const ThreadPanel: import("svelte").Component<ThreadPanelProps, {}, "">;
|
|
40
|
+
type ThreadPanel = ReturnType<typeof ThreadPanel>;
|
|
41
|
+
export default ThreadPanel;
|
|
42
|
+
//# sourceMappingURL=ThreadPanel.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreadPanel.svelte.d.ts","sourceRoot":"","sources":["../src/lib/ThreadPanel.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,eAAe,EAChB,MAAM,sCAAsC,CAAC;AAE9C,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,GAAG;IAC1E,0EAA0E;IAC1E,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IACjC,sFAAsF;IACtF,QAAQ,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACnC,WAAW,EAAE,kBAAkB,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,8DAA8D;IAC9D,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;QAAE,OAAO,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC,CAAC;CACrD,CAAC;AAuVJ,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|