@sentropic/design-system-svelte 0.41.5 → 0.43.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/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 +1621 -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 +24 -4
- package/dist/DiagramCard.svelte.d.ts.map +1 -1
- package/dist/DiagramCardHeader.svelte +5 -2
- package/dist/DiagramCardHeader.svelte.d.ts +2 -0
- package/dist/DiagramCardHeader.svelte.d.ts.map +1 -1
- package/dist/DiagramSceneFigure.svelte +11 -13
- package/dist/DiagramSceneFigure.svelte.d.ts +4 -0
- package/dist/DiagramSceneFigure.svelte.d.ts.map +1 -1
- package/dist/DiagramZone.svelte +37 -11
- package/dist/DiagramZone.svelte.d.ts.map +1 -1
- package/dist/DiagramZoneHeader.svelte +9 -2
- package/dist/DiagramZoneHeader.svelte.d.ts +4 -0
- package/dist/DiagramZoneHeader.svelte.d.ts.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/diagram-render/renderCardSvg.js +9 -4
- package/dist/diagram-render/renderZoneSvg.d.ts.map +1 -1
- package/dist/diagram-render/renderZoneSvg.js +8 -3
- 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,379 @@
|
|
|
1
|
+
// Pure helpers for the Svelte review/comment kit (SPEC-r6 §2, §3, §4).
|
|
2
|
+
// Safe markdown-lite AST parser (zero raw HTML injection), Ref trailer chips,
|
|
3
|
+
// resolution record detection, anchor labels, actor color sanitization, and focus trap.
|
|
4
|
+
import { FALLBACK_ACTOR_COLOR, MAX_SECTION_KEY_LENGTH, ReviewAdapterError, } from "@sentropic/design-system-review-core";
|
|
5
|
+
const REF_LINE_RE = /^Ref:\s*(decision|track):([^\s]+)\s*$/i;
|
|
6
|
+
const RESOLUTION_LINE_RE = /^Resolved\s+in\s+([^\r\n]+?)\s*$/i;
|
|
7
|
+
const SAFE_HEX_COLOR_RE = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;
|
|
8
|
+
const SAFE_FUNC_COLOR_RE = /^(?:rgba?|hsla?|oklch|oklab)\([0-9.,%\s/+deg-]+\)$/i;
|
|
9
|
+
const SAFE_VAR_COLOR_RE = /^var\(--st-[a-zA-Z0-9-]+\)$/;
|
|
10
|
+
/** Sanitize an untrusted `CollaborationActor.color` value before CSS binding. */
|
|
11
|
+
export function sanitizeActorColor(color) {
|
|
12
|
+
if (typeof color !== "string")
|
|
13
|
+
return FALLBACK_ACTOR_COLOR;
|
|
14
|
+
const trimmed = color.trim();
|
|
15
|
+
if (SAFE_HEX_COLOR_RE.test(trimmed) ||
|
|
16
|
+
SAFE_FUNC_COLOR_RE.test(trimmed) ||
|
|
17
|
+
SAFE_VAR_COLOR_RE.test(trimmed)) {
|
|
18
|
+
return trimmed;
|
|
19
|
+
}
|
|
20
|
+
return FALLBACK_ACTOR_COLOR;
|
|
21
|
+
}
|
|
22
|
+
/** Check whether a URL is safe to expose as an anchor href (never javascript:/data:/vbscript:). */
|
|
23
|
+
export function isSafeMarkdownHref(rawHref) {
|
|
24
|
+
const trimmed = rawHref.trim();
|
|
25
|
+
if (trimmed.length === 0) {
|
|
26
|
+
return { safe: false, external: false, href: "" };
|
|
27
|
+
}
|
|
28
|
+
if (trimmed.startsWith("/") || trimmed.startsWith("#")) {
|
|
29
|
+
return { safe: true, external: false, href: trimmed };
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const parsed = new URL(trimmed);
|
|
33
|
+
const protocol = parsed.protocol.toLowerCase();
|
|
34
|
+
if (protocol === "https:" || protocol === "http:" || protocol === "mailto:") {
|
|
35
|
+
return { safe: true, external: protocol !== "mailto:", href: parsed.href };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return { safe: false, external: false, href: "" };
|
|
40
|
+
}
|
|
41
|
+
return { safe: false, external: false, href: "" };
|
|
42
|
+
}
|
|
43
|
+
/** Parse `Ref: decision:<id>` / `Ref: track:<id>` promotion trailers (SPEC-r6 §4). */
|
|
44
|
+
export function parseCommentRefs(body) {
|
|
45
|
+
const refs = [];
|
|
46
|
+
const lines = body.replace(/\r\n?/g, "\n").split("\n");
|
|
47
|
+
for (const line of lines) {
|
|
48
|
+
const match = REF_LINE_RE.exec(line.trim());
|
|
49
|
+
if (match) {
|
|
50
|
+
const kind = match[1].toLowerCase();
|
|
51
|
+
const id = match[2];
|
|
52
|
+
refs.push({ kind, id, raw: line.trim() });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return refs;
|
|
56
|
+
}
|
|
57
|
+
/** Detect the `Resolved in <version|commit>` resolution reply convention (SPEC-r6 §2). */
|
|
58
|
+
export function isResolutionReply(body) {
|
|
59
|
+
const firstNonEmpty = body
|
|
60
|
+
.replace(/\r\n?/g, "\n")
|
|
61
|
+
.split("\n")
|
|
62
|
+
.map((line) => line.trim())
|
|
63
|
+
.find((line) => line.length > 0);
|
|
64
|
+
if (!firstNonEmpty)
|
|
65
|
+
return null;
|
|
66
|
+
const match = RESOLUTION_LINE_RE.exec(firstNonEmpty);
|
|
67
|
+
if (!match)
|
|
68
|
+
return null;
|
|
69
|
+
const version = match[1].trim();
|
|
70
|
+
return version.length > 0 ? { version } : null;
|
|
71
|
+
}
|
|
72
|
+
function parseInlineSegment(text) {
|
|
73
|
+
const tokens = [];
|
|
74
|
+
let cursor = 0;
|
|
75
|
+
const pushText = (chunk) => {
|
|
76
|
+
if (chunk.length === 0)
|
|
77
|
+
return;
|
|
78
|
+
const prev = tokens[tokens.length - 1];
|
|
79
|
+
if (prev && prev.type === "text") {
|
|
80
|
+
prev.text += chunk;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
tokens.push({ type: "text", text: chunk });
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
while (cursor < text.length) {
|
|
87
|
+
const ch = text[cursor];
|
|
88
|
+
// Inline code: `...`
|
|
89
|
+
if (ch === "`") {
|
|
90
|
+
const end = text.indexOf("`", cursor + 1);
|
|
91
|
+
if (end > cursor + 1) {
|
|
92
|
+
tokens.push({ type: "code", text: text.slice(cursor + 1, end) });
|
|
93
|
+
cursor = end + 1;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Link: [label](url)
|
|
98
|
+
if (ch === "[") {
|
|
99
|
+
const closeBracket = text.indexOf("]", cursor + 1);
|
|
100
|
+
if (closeBracket > cursor + 1 && text[closeBracket + 1] === "(") {
|
|
101
|
+
const closeParen = text.indexOf(")", closeBracket + 2);
|
|
102
|
+
if (closeParen > closeBracket + 2) {
|
|
103
|
+
const label = text.slice(cursor + 1, closeBracket);
|
|
104
|
+
const rawUrl = text.slice(closeBracket + 2, closeParen);
|
|
105
|
+
const checked = isSafeMarkdownHref(rawUrl);
|
|
106
|
+
if (checked.safe) {
|
|
107
|
+
tokens.push({
|
|
108
|
+
type: "link",
|
|
109
|
+
label,
|
|
110
|
+
href: checked.href,
|
|
111
|
+
external: checked.external,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
pushText(label);
|
|
116
|
+
}
|
|
117
|
+
cursor = closeParen + 1;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Bold: **...**
|
|
123
|
+
if (ch === "*" && text[cursor + 1] === "*") {
|
|
124
|
+
const end = text.indexOf("**", cursor + 2);
|
|
125
|
+
if (end > cursor + 2) {
|
|
126
|
+
tokens.push({
|
|
127
|
+
type: "bold",
|
|
128
|
+
children: parseInlineSegment(text.slice(cursor + 2, end)),
|
|
129
|
+
});
|
|
130
|
+
cursor = end + 2;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Strikethrough: ~~...~~
|
|
135
|
+
if (ch === "~" && text[cursor + 1] === "~") {
|
|
136
|
+
const end = text.indexOf("~~", cursor + 2);
|
|
137
|
+
if (end > cursor + 2) {
|
|
138
|
+
tokens.push({
|
|
139
|
+
type: "strike",
|
|
140
|
+
children: parseInlineSegment(text.slice(cursor + 2, end)),
|
|
141
|
+
});
|
|
142
|
+
cursor = end + 2;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Italic: *...* or _..._ (word-boundary guarded for underscores)
|
|
147
|
+
if (ch === "*" || ch === "_") {
|
|
148
|
+
const prevChar = cursor > 0 ? text[cursor - 1] : "";
|
|
149
|
+
const allowOpen = ch === "*" || prevChar === "" || /\s|[([{]/.test(prevChar);
|
|
150
|
+
if (allowOpen && text[cursor + 1] !== ch && text[cursor + 1] !== " ") {
|
|
151
|
+
const end = text.indexOf(ch, cursor + 1);
|
|
152
|
+
const afterEnd = end >= 0 && end + 1 < text.length ? text[end + 1] : "";
|
|
153
|
+
const allowClose = ch === "*" || afterEnd === "" || /\s|[)\]}.,!?;:]/.test(afterEnd);
|
|
154
|
+
if (end > cursor + 1 && text[end - 1] !== " " && allowClose) {
|
|
155
|
+
tokens.push({
|
|
156
|
+
type: "italic",
|
|
157
|
+
children: parseInlineSegment(text.slice(cursor + 1, end)),
|
|
158
|
+
});
|
|
159
|
+
cursor = end + 1;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
pushText(ch);
|
|
165
|
+
cursor += 1;
|
|
166
|
+
}
|
|
167
|
+
return tokens;
|
|
168
|
+
}
|
|
169
|
+
function parseLinesWithBreaks(lines) {
|
|
170
|
+
const out = [];
|
|
171
|
+
lines.forEach((line, index) => {
|
|
172
|
+
if (index > 0) {
|
|
173
|
+
out.push({ type: "break" });
|
|
174
|
+
}
|
|
175
|
+
out.push(...parseInlineSegment(line));
|
|
176
|
+
});
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Parses comment markdown-lite into a safe AST (rendered purely via Svelte text nodes,
|
|
181
|
+
* never `{@html}`), extracting `Ref: decision:<id>` / `Ref: track:<id>` chips and
|
|
182
|
+
* detecting `Resolved in <version|commit>` records.
|
|
183
|
+
*/
|
|
184
|
+
export function parseCommentBody(body) {
|
|
185
|
+
const normalized = body.replace(/\r\n?/g, "\n");
|
|
186
|
+
const rawLines = normalized.split("\n");
|
|
187
|
+
const refs = [];
|
|
188
|
+
const contentLines = [];
|
|
189
|
+
for (const line of rawLines) {
|
|
190
|
+
const refMatch = REF_LINE_RE.exec(line.trim());
|
|
191
|
+
if (refMatch) {
|
|
192
|
+
refs.push({
|
|
193
|
+
kind: refMatch[1].toLowerCase(),
|
|
194
|
+
id: refMatch[2],
|
|
195
|
+
raw: line.trim(),
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
contentLines.push(line);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const resolution = isResolutionReply(normalized);
|
|
203
|
+
const blocks = [];
|
|
204
|
+
let i = 0;
|
|
205
|
+
while (i < contentLines.length) {
|
|
206
|
+
const line = contentLines[i];
|
|
207
|
+
const trimmed = line.trim();
|
|
208
|
+
if (trimmed.length === 0) {
|
|
209
|
+
i += 1;
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
// Fenced code block
|
|
213
|
+
if (trimmed.startsWith("```")) {
|
|
214
|
+
const lang = trimmed.slice(3).trim();
|
|
215
|
+
const codeLines = [];
|
|
216
|
+
i += 1;
|
|
217
|
+
while (i < contentLines.length && !contentLines[i].trim().startsWith("```")) {
|
|
218
|
+
codeLines.push(contentLines[i]);
|
|
219
|
+
i += 1;
|
|
220
|
+
}
|
|
221
|
+
if (i < contentLines.length)
|
|
222
|
+
i += 1; // skip closing fence
|
|
223
|
+
blocks.push({
|
|
224
|
+
type: "codeblock",
|
|
225
|
+
...(lang.length > 0 ? { lang } : {}),
|
|
226
|
+
code: codeLines.join("\n"),
|
|
227
|
+
});
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
// Blockquote
|
|
231
|
+
if (trimmed.startsWith(">")) {
|
|
232
|
+
const quoteLines = [];
|
|
233
|
+
while (i < contentLines.length && contentLines[i].trim().startsWith(">")) {
|
|
234
|
+
quoteLines.push(contentLines[i].trim().replace(/^>\s?/, ""));
|
|
235
|
+
i += 1;
|
|
236
|
+
}
|
|
237
|
+
blocks.push({
|
|
238
|
+
type: "blockquote",
|
|
239
|
+
inlines: parseLinesWithBreaks(quoteLines),
|
|
240
|
+
});
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
// Unordered list
|
|
244
|
+
if (/^[-*]\s+/.test(trimmed)) {
|
|
245
|
+
const items = [];
|
|
246
|
+
while (i < contentLines.length && /^[-*]\s+/.test(contentLines[i].trim())) {
|
|
247
|
+
items.push(parseInlineSegment(contentLines[i].trim().replace(/^[-*]\s+/, "")));
|
|
248
|
+
i += 1;
|
|
249
|
+
}
|
|
250
|
+
blocks.push({ type: "list", ordered: false, items });
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
// Ordered list
|
|
254
|
+
if (/^\d+\.\s+/.test(trimmed)) {
|
|
255
|
+
const items = [];
|
|
256
|
+
while (i < contentLines.length && /^\d+\.\s+/.test(contentLines[i].trim())) {
|
|
257
|
+
items.push(parseInlineSegment(contentLines[i].trim().replace(/^\d+\.\s+/, "")));
|
|
258
|
+
i += 1;
|
|
259
|
+
}
|
|
260
|
+
blocks.push({ type: "list", ordered: true, items });
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
// Paragraph
|
|
264
|
+
const paraLines = [];
|
|
265
|
+
while (i < contentLines.length) {
|
|
266
|
+
const candidate = contentLines[i];
|
|
267
|
+
const cTrim = candidate.trim();
|
|
268
|
+
if (cTrim.length === 0 ||
|
|
269
|
+
cTrim.startsWith("```") ||
|
|
270
|
+
cTrim.startsWith(">") ||
|
|
271
|
+
/^[-*]\s+/.test(cTrim) ||
|
|
272
|
+
/^\d+\.\s+/.test(cTrim)) {
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
paraLines.push(candidate);
|
|
276
|
+
i += 1;
|
|
277
|
+
}
|
|
278
|
+
blocks.push({
|
|
279
|
+
type: "paragraph",
|
|
280
|
+
inlines: parseLinesWithBreaks(paraLines),
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
return { blocks, refs, resolution };
|
|
284
|
+
}
|
|
285
|
+
function clampString(value, maxLength) {
|
|
286
|
+
const collapsed = value.replace(/\s+/g, " ").trim();
|
|
287
|
+
const cps = Array.from(collapsed);
|
|
288
|
+
if (cps.length <= maxLength)
|
|
289
|
+
return collapsed;
|
|
290
|
+
if (maxLength <= 1)
|
|
291
|
+
return "…";
|
|
292
|
+
return `${cps.slice(0, maxLength - 1).join("")}…`;
|
|
293
|
+
}
|
|
294
|
+
/** Derives a <= 140-char quote or element label from a decoded `AnchorPayload` (SPEC-r6 §3). */
|
|
295
|
+
export function formatAnchorLabel(anchor, maxLength = 140) {
|
|
296
|
+
if (anchor === null)
|
|
297
|
+
return "Unattached";
|
|
298
|
+
if (anchor.t === "text") {
|
|
299
|
+
return clampString(anchor.q.exact, maxLength);
|
|
300
|
+
}
|
|
301
|
+
if (anchor.t === "element") {
|
|
302
|
+
const raw = anchor.aid ? `#${anchor.aid}` : anchor.sel;
|
|
303
|
+
return clampString(raw, maxLength);
|
|
304
|
+
}
|
|
305
|
+
const xPct = Math.round(anchor.rect.x * 100);
|
|
306
|
+
const yPct = Math.round(anchor.rect.y * 100);
|
|
307
|
+
return clampString(`Region (${xPct}%, ${yPct}%)`, maxLength);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Formats a pin's accessible name per SPEC-r6 §3:
|
|
311
|
+
* `Thread 2, 3 comments, 1 unread, on '…'`
|
|
312
|
+
*/
|
|
313
|
+
export function formatPinAriaLabel(options) {
|
|
314
|
+
const { index, count, unreadCount = 0, resolved = false, excerpt } = options;
|
|
315
|
+
const parts = [
|
|
316
|
+
`Thread ${index}`,
|
|
317
|
+
`${count} ${count === 1 ? "comment" : "comments"}`,
|
|
318
|
+
];
|
|
319
|
+
if (unreadCount > 0) {
|
|
320
|
+
parts.push(`${unreadCount} unread`);
|
|
321
|
+
}
|
|
322
|
+
if (resolved) {
|
|
323
|
+
parts.push("resolved");
|
|
324
|
+
}
|
|
325
|
+
if (excerpt && excerpt.trim().length > 0) {
|
|
326
|
+
parts.push(`on '${clampString(excerpt, 60)}'`);
|
|
327
|
+
}
|
|
328
|
+
return parts.join(", ");
|
|
329
|
+
}
|
|
330
|
+
/** Normalize adapter/composer errors, mapping server 400 cap errors to a consistent message. */
|
|
331
|
+
export function formatReviewError(error) {
|
|
332
|
+
if (error instanceof ReviewAdapterError) {
|
|
333
|
+
if (error.code === "SECTION_KEY_TOO_LONG") {
|
|
334
|
+
return `Selection anchor exceeds the ${MAX_SECTION_KEY_LENGTH}-character limit.`;
|
|
335
|
+
}
|
|
336
|
+
return error.message;
|
|
337
|
+
}
|
|
338
|
+
if (error instanceof Error) {
|
|
339
|
+
if (/section_key_too_long|SECTION_KEY_TOO_LONG|ANCHOR_TOO_LONG/i.test(error.message) ||
|
|
340
|
+
(error.code === "section_key_too_long")) {
|
|
341
|
+
return `Selection anchor exceeds the ${MAX_SECTION_KEY_LENGTH}-character limit.`;
|
|
342
|
+
}
|
|
343
|
+
return error.message;
|
|
344
|
+
}
|
|
345
|
+
return "Action failed. Please try again.";
|
|
346
|
+
}
|
|
347
|
+
const FOCUSABLE_SELECTOR = [
|
|
348
|
+
"a[href]",
|
|
349
|
+
"button:not([disabled])",
|
|
350
|
+
"textarea:not([disabled])",
|
|
351
|
+
"input:not([disabled]):not([type='hidden'])",
|
|
352
|
+
"select:not([disabled])",
|
|
353
|
+
"[tabindex]:not([tabindex='-1'])",
|
|
354
|
+
].join(", ");
|
|
355
|
+
/** Collect visible/focusable elements within a focus-trap container. */
|
|
356
|
+
export function getFocusableElements(container) {
|
|
357
|
+
return Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR)).filter((el) => !el.hasAttribute("disabled") && el.getAttribute("aria-hidden") !== "true");
|
|
358
|
+
}
|
|
359
|
+
/** Handles Tab / Shift+Tab cycling within `container` for trapped layers. */
|
|
360
|
+
export function handleFocusTrapKeydown(event, container) {
|
|
361
|
+
if (event.key !== "Tab" || !container)
|
|
362
|
+
return;
|
|
363
|
+
const focusables = getFocusableElements(container);
|
|
364
|
+
if (focusables.length === 0)
|
|
365
|
+
return;
|
|
366
|
+
const first = focusables[0];
|
|
367
|
+
const last = focusables[focusables.length - 1];
|
|
368
|
+
const active = container.ownerDocument.activeElement;
|
|
369
|
+
if (event.shiftKey) {
|
|
370
|
+
if (!active || active === first || !container.contains(active)) {
|
|
371
|
+
event.preventDefault();
|
|
372
|
+
last.focus();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
else if (!active || active === last || !container.contains(active)) {
|
|
376
|
+
event.preventDefault();
|
|
377
|
+
first.focus();
|
|
378
|
+
}
|
|
379
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentropic/design-system-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -63,9 +63,10 @@
|
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@lucide/svelte": "^0.562.0",
|
|
66
|
+
"@sentropic/design-system-review-core": "0.1.0",
|
|
66
67
|
"@sentropic/design-system-rich-text": "0.1.1",
|
|
67
|
-
"@sentropic/design-system-themes": "0.
|
|
68
|
-
"@sentropic/diagram-canvas": "0.
|
|
68
|
+
"@sentropic/design-system-themes": "0.15.0",
|
|
69
|
+
"@sentropic/diagram-canvas": "0.3.0",
|
|
69
70
|
"@sentropic/graph": "0.3.1"
|
|
70
71
|
},
|
|
71
72
|
"peerDependencies": {
|
|
@@ -97,7 +98,7 @@
|
|
|
97
98
|
},
|
|
98
99
|
"devDependencies": {
|
|
99
100
|
"@sentropic/design-system-theme-dsfr": "0.2.2",
|
|
100
|
-
"@sentropic/design-system-themes": "0.
|
|
101
|
+
"@sentropic/design-system-themes": "0.15.0",
|
|
101
102
|
"@sveltejs/package": "^2.5.0",
|
|
102
103
|
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
|
103
104
|
"@testing-library/svelte": "^5.2.8",
|