@k2b/ui 0.55.0 → 0.57.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/browser/actions/SplitButton.js +5 -7
- package/dist/browser/actions/SplitButton.js.map +1 -1
- package/dist/browser/actions/Toolbar.js +16 -7
- package/dist/browser/actions/Toolbar.js.map +1 -1
- package/dist/browser/actions/ViewTabs.js +6 -5
- package/dist/browser/actions/ViewTabs.js.map +1 -1
- package/dist/browser/chat/ChatComposer.js +28 -27
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/content/Lightbox.js +917 -283
- package/dist/browser/content/Lightbox.js.map +1 -1
- package/dist/browser/content/PdfPages.js +8 -3
- package/dist/browser/content/PdfPages.js.map +1 -1
- package/dist/browser/content/PdfThumbnails.js +271 -0
- package/dist/browser/content/PdfThumbnails.js.map +1 -0
- package/dist/browser/content/PdfViewer.js +11 -3
- package/dist/browser/content/PdfViewer.js.map +1 -1
- package/dist/browser/content/Timeline.js +116 -117
- package/dist/browser/content/Timeline.js.map +1 -1
- package/dist/browser/content/code-highlight.js +24 -11
- package/dist/browser/content/code-highlight.js.map +1 -1
- package/dist/browser/content/index.js +5 -1
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/lightbox-messages.js +64 -18
- package/dist/browser/content/lightbox-messages.js.map +1 -1
- package/dist/browser/content/lightbox-renderers.js +6 -0
- package/dist/browser/content/lightbox-renderers.js.map +1 -0
- package/dist/browser/content/map-view-worker.js +3 -3
- package/dist/browser/content/pdf-messages.js +16 -2
- package/dist/browser/content/pdf-messages.js.map +1 -1
- package/dist/browser/content/pdf-viewer-engine.js +15 -15
- package/dist/browser/content/pdf-viewer-worker.js +4 -5
- package/dist/browser/feedback/prompt-confirm.js +2 -0
- package/dist/browser/feedback/prompt-confirm.js.map +1 -1
- package/dist/browser/internal/truncated-title.js +9 -0
- package/dist/browser/internal/truncated-title.js.map +1 -0
- package/dist/browser/intl/messages.js +1 -1
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/DetailPanel.js +3 -5
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/FloatingWindow.js +416 -122
- package/dist/browser/layout/FloatingWindow.js.map +1 -1
- package/dist/browser/layout/PanelDialog.js +3 -1
- package/dist/browser/layout/PanelDialog.js.map +1 -1
- package/dist/browser/layout/PersonPopover.js +406 -0
- package/dist/browser/layout/PersonPopover.js.map +1 -0
- package/dist/browser/layout/floating-window-geometry.js +58 -2
- package/dist/browser/layout/floating-window-geometry.js.map +1 -1
- package/dist/browser/layout/floating-window-messages.js +12 -0
- package/dist/browser/layout/floating-window-messages.js.map +1 -1
- package/dist/browser/layout/index.js +1 -0
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/ssr/actions/CommandMenu.js +2 -2
- package/dist/ssr/actions/CommandMenu.js.map +1 -1
- package/dist/ssr/actions/SplitButton.js +5 -7
- package/dist/ssr/actions/SplitButton.js.map +1 -1
- package/dist/ssr/actions/Toolbar.js +16 -7
- package/dist/ssr/actions/Toolbar.js.map +1 -1
- package/dist/ssr/actions/ViewTabs.js +6 -5
- package/dist/ssr/actions/ViewTabs.js.map +1 -1
- package/dist/ssr/chat/ChatComposer.js +31 -30
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/content/Lightbox.js +659 -150
- package/dist/ssr/content/Lightbox.js.map +1 -1
- package/dist/ssr/content/PdfPages.js +8 -3
- package/dist/ssr/content/PdfPages.js.map +1 -1
- package/dist/ssr/content/PdfThumbnails.js +189 -0
- package/dist/ssr/content/PdfThumbnails.js.map +1 -0
- package/dist/ssr/content/PdfViewer.js +11 -3
- package/dist/ssr/content/PdfViewer.js.map +1 -1
- package/dist/ssr/content/Timeline.js +2 -5
- package/dist/ssr/content/Timeline.js.map +1 -1
- package/dist/ssr/content/code-highlight.js +24 -11
- package/dist/ssr/content/code-highlight.js.map +1 -1
- package/dist/ssr/content/index.js +5 -1
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/lightbox-messages.js +64 -18
- package/dist/ssr/content/lightbox-messages.js.map +1 -1
- package/dist/ssr/content/lightbox-renderers.js +6 -0
- package/dist/ssr/content/lightbox-renderers.js.map +1 -0
- package/dist/ssr/content/pdf-messages.js +16 -2
- package/dist/ssr/content/pdf-messages.js.map +1 -1
- package/dist/ssr/feedback/prompt-confirm.js +1 -0
- package/dist/ssr/feedback/prompt-confirm.js.map +1 -1
- package/dist/ssr/inputs/ChoiceInputs.js +2 -2
- package/dist/ssr/inputs/ChoiceInputs.js.map +1 -1
- package/dist/ssr/inputs/SignatureInput.js +2 -2
- package/dist/ssr/inputs/SignatureInput.js.map +1 -1
- package/dist/ssr/inputs/markdown/SlashCommands.js +2 -2
- package/dist/ssr/inputs/markdown/SlashCommands.js.map +1 -1
- package/dist/ssr/internal/truncated-title.js +9 -0
- package/dist/ssr/internal/truncated-title.js.map +1 -0
- package/dist/ssr/intl/messages.js +1 -1
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/DetailPanel.js +1 -4
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/FloatingWindow.js +286 -73
- package/dist/ssr/layout/FloatingWindow.js.map +1 -1
- package/dist/ssr/layout/PanelDialog.js +1 -0
- package/dist/ssr/layout/PanelDialog.js.map +1 -1
- package/dist/ssr/layout/PersonPopover.js +248 -0
- package/dist/ssr/layout/PersonPopover.js.map +1 -0
- package/dist/ssr/layout/floating-window-geometry.js +58 -2
- package/dist/ssr/layout/floating-window-geometry.js.map +1 -1
- package/dist/ssr/layout/floating-window-messages.js +12 -0
- package/dist/ssr/layout/floating-window-messages.js.map +1 -1
- package/dist/ssr/layout/index.js +1 -0
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/SplitButton.d.ts +2 -0
- package/dist/types/actions/Toolbar.d.ts +6 -0
- package/dist/types/chat/ChatComposer.d.ts +1 -0
- package/dist/types/content/Lightbox.d.ts +54 -14
- package/dist/types/content/PdfPages.d.ts +7 -1
- package/dist/types/content/PdfThumbnails.d.ts +26 -0
- package/dist/types/content/PdfViewer.d.ts +12 -3
- package/dist/types/content/index.d.ts +4 -2
- package/dist/types/content/lightbox-messages.d.ts +31 -8
- package/dist/types/content/lightbox-renderers.d.ts +3 -0
- package/dist/types/content/pdf-messages.d.ts +7 -0
- package/dist/types/internal/truncated-title.d.ts +7 -0
- package/dist/types/layout/FloatingWindow.d.ts +29 -1
- package/dist/types/layout/PersonPopover.d.ts +70 -0
- package/dist/types/layout/floating-window-geometry.d.ts +20 -3
- package/dist/types/layout/floating-window-messages.d.ts +6 -0
- package/dist/types/layout/index.d.ts +3 -2
- package/package.json +20 -20
|
@@ -182,6 +182,8 @@ const swallowTap = down => {
|
|
|
182
182
|
const attachmentIcon = attachment => attachment.icon ?? (attachment.kind === "image" ? "ti ti-photo" : attachment.kind === "resource" ? "ti ti-link" : "ti ti-file");
|
|
183
183
|
const hasContent = items => items.some(item => item != null && typeof item !== "boolean" && item !== "");
|
|
184
184
|
export function ChatComposer(props) {
|
|
185
|
+
// A parent that recomputes the same key keeps the same draft: only a new value resets what belongs to the old one.
|
|
186
|
+
const draftKey = createMemo(() => props.draftKey);
|
|
185
187
|
const accessory = children(() => props.accessory);
|
|
186
188
|
const hasAccessory = () => hasContent(accessory.toArray());
|
|
187
189
|
const hint = children(() => props.hint);
|
|
@@ -378,13 +380,13 @@ export function ChatComposer(props) {
|
|
|
378
380
|
});
|
|
379
381
|
const openingStart = createMemo(() => commandQuery()?.start);
|
|
380
382
|
createEffect(() => {
|
|
381
|
-
|
|
383
|
+
draftKey();
|
|
382
384
|
const start = openingStart();
|
|
383
385
|
if (start !== undefined) setCommandOpening(opening => opening + 1);
|
|
384
386
|
});
|
|
385
387
|
// A failed `open` row says so for the rest of its list opening.
|
|
386
388
|
createEffect(() => {
|
|
387
|
-
|
|
389
|
+
draftKey();
|
|
388
390
|
commandOpening();
|
|
389
391
|
setOpenFailures({});
|
|
390
392
|
});
|
|
@@ -406,7 +408,7 @@ export function ChatComposer(props) {
|
|
|
406
408
|
// Rows of a `fixedWhileOpen` section are the ones it had when this `/` opened the list; later ones wait for the next
|
|
407
409
|
// `/`. A retry row starts another opening in the same open list, so it does not count.
|
|
408
410
|
const fixedCommandKeys = createMemo(() => {
|
|
409
|
-
|
|
411
|
+
draftKey();
|
|
410
412
|
if (openingStart() === undefined) return undefined;
|
|
411
413
|
return untrack(() => {
|
|
412
414
|
const fixed = new Set((props.commandSections ?? []).filter(section => section.fixedWhileOpen).map(section => section.id));
|
|
@@ -441,7 +443,7 @@ export function ChatComposer(props) {
|
|
|
441
443
|
const currentCommandQuery = createMemo(() => caretCommandToken()?.query);
|
|
442
444
|
// Arrow marking belongs to one token in one draft; another draft or `/` starts at the top row again.
|
|
443
445
|
createEffect(() => {
|
|
444
|
-
|
|
446
|
+
draftKey();
|
|
445
447
|
caretCommandStart();
|
|
446
448
|
currentCommandQuery();
|
|
447
449
|
setCommandMoved(false);
|
|
@@ -490,15 +492,15 @@ export function ChatComposer(props) {
|
|
|
490
492
|
// cancels too, unless the opener announced that next move with `follow()`: its busy line moves to the status line,
|
|
491
493
|
// and Escape still cancels there. Any later unannounced draft change cancels.
|
|
492
494
|
createEffect(() => {
|
|
493
|
-
const
|
|
495
|
+
const key = draftKey();
|
|
494
496
|
const open = commandsOpen();
|
|
495
497
|
const row = openingRow();
|
|
496
498
|
const run = openingRun;
|
|
497
499
|
if (!run || row === undefined) return;
|
|
498
|
-
if (
|
|
500
|
+
if (key !== run.key) {
|
|
499
501
|
if (run.follow) {
|
|
500
502
|
run.follow = false;
|
|
501
|
-
run.key =
|
|
503
|
+
run.key = key;
|
|
502
504
|
run.moved = true;
|
|
503
505
|
showCommandStatus({
|
|
504
506
|
tone: "busy",
|
|
@@ -608,7 +610,7 @@ export function ChatComposer(props) {
|
|
|
608
610
|
onCleanup(() => window.removeEventListener("pointerdown", onPointerDown, true));
|
|
609
611
|
});
|
|
610
612
|
createEffect(() => {
|
|
611
|
-
|
|
613
|
+
draftKey();
|
|
612
614
|
const token = commandQuery();
|
|
613
615
|
setSearchError(false);
|
|
614
616
|
if (!token || !props.searchCommands) {
|
|
@@ -699,7 +701,7 @@ export function ChatComposer(props) {
|
|
|
699
701
|
const history = [];
|
|
700
702
|
let historyIndex = -1;
|
|
701
703
|
createEffect(() => {
|
|
702
|
-
|
|
704
|
+
draftKey();
|
|
703
705
|
untrack(() => {
|
|
704
706
|
history.length = 0;
|
|
705
707
|
historyIndex = -1;
|
|
@@ -946,8 +948,7 @@ export function ChatComposer(props) {
|
|
|
946
948
|
// drops the source ends it; the words so far stay.
|
|
947
949
|
// Memos compare values, so typing and arriving words never end it.
|
|
948
950
|
const dictationField = createMemo(() => `${Boolean(props.dictation)}:${editBlocked()}`);
|
|
949
|
-
|
|
950
|
-
createEffect(on([dictationField, dictationDraft], () => liveDictation.end(), {
|
|
951
|
+
createEffect(on([dictationField, draftKey], () => liveDictation.end(), {
|
|
951
952
|
defer: true
|
|
952
953
|
}));
|
|
953
954
|
const hasDraft = () => Boolean(props.value.trim() || !running() && attachments().length > 0);
|
|
@@ -1112,7 +1113,7 @@ export function ChatComposer(props) {
|
|
|
1112
1113
|
*/
|
|
1113
1114
|
const attachFilesFromCommand = (token, selection) => {
|
|
1114
1115
|
if (!canSelectFiles()) return;
|
|
1115
|
-
const key =
|
|
1116
|
+
const key = draftKey();
|
|
1116
1117
|
const previous = snapshot();
|
|
1117
1118
|
const previousHistory = {
|
|
1118
1119
|
entries: [...history],
|
|
@@ -1122,7 +1123,7 @@ export function ChatComposer(props) {
|
|
|
1122
1123
|
edit(nextValue, reconcileChatMentions(props.value, nextValue, mentions()));
|
|
1123
1124
|
setDismissed(true);
|
|
1124
1125
|
chooseFiles(() => {
|
|
1125
|
-
if (
|
|
1126
|
+
if (draftKey() !== key || props.value !== nextValue) return;
|
|
1126
1127
|
setDismissed(true);
|
|
1127
1128
|
props.onValueChange(previous.value);
|
|
1128
1129
|
props.onMentionsChange?.(previous.mentions);
|
|
@@ -1135,7 +1136,7 @@ export function ChatComposer(props) {
|
|
|
1135
1136
|
});
|
|
1136
1137
|
});
|
|
1137
1138
|
queueMicrotask(() => {
|
|
1138
|
-
if (
|
|
1139
|
+
if (draftKey() !== key || props.value !== nextValue) return;
|
|
1139
1140
|
textareaRef?.setSelectionRange(token.start, token.start);
|
|
1140
1141
|
syncCaret();
|
|
1141
1142
|
});
|
|
@@ -1157,7 +1158,7 @@ export function ChatComposer(props) {
|
|
|
1157
1158
|
};
|
|
1158
1159
|
const submit = async () => {
|
|
1159
1160
|
if (!canSubmit()) return;
|
|
1160
|
-
const key =
|
|
1161
|
+
const key = draftKey();
|
|
1161
1162
|
setSubmitting(true);
|
|
1162
1163
|
try {
|
|
1163
1164
|
if (isTouchOnly()) {
|
|
@@ -1165,7 +1166,7 @@ export function ChatComposer(props) {
|
|
|
1165
1166
|
// The sheet's Back entry leaves first, so a submit handler that navigates finds the history settled.
|
|
1166
1167
|
await dialogHistorySettled();
|
|
1167
1168
|
// A draft that another one replaced, or that may no longer go out, is not sent and keeps its text.
|
|
1168
|
-
if (disposed ||
|
|
1169
|
+
if (disposed || draftKey() !== key || !submittable()) return;
|
|
1169
1170
|
}
|
|
1170
1171
|
const intent = running() ? runningSubmitIntent() : "send";
|
|
1171
1172
|
const previousValue = props.value;
|
|
@@ -1256,7 +1257,7 @@ export function ChatComposer(props) {
|
|
|
1256
1257
|
// From "+" a reference joins the text at the caret, apart from a word right before it.
|
|
1257
1258
|
const lead = value => fromAdd && token.start > 0 && !/\s/.test(value[token.start - 1] ?? "") ? " " : "";
|
|
1258
1259
|
const previous = snapshot();
|
|
1259
|
-
const key =
|
|
1260
|
+
const key = draftKey();
|
|
1260
1261
|
const replacement = command.mention ? lead(props.value) + command.mention.name + " " : "";
|
|
1261
1262
|
const nextValue = props.value.slice(0, token.start) + replacement + props.value.slice(token.end);
|
|
1262
1263
|
const nextMentions = reconcileChatMentions(props.value, nextValue, mentions());
|
|
@@ -1280,7 +1281,7 @@ export function ChatComposer(props) {
|
|
|
1280
1281
|
let restored = false;
|
|
1281
1282
|
let mentioned;
|
|
1282
1283
|
const restore = () => {
|
|
1283
|
-
if (
|
|
1284
|
+
if (draftKey() !== key || props.value !== nextValue) return;
|
|
1284
1285
|
setDismissed(true);
|
|
1285
1286
|
props.onValueChange(previous.value);
|
|
1286
1287
|
props.onMentionsChange?.(previous.mentions);
|
|
@@ -1297,7 +1298,7 @@ export function ChatComposer(props) {
|
|
|
1297
1298
|
if (heldHistory && command.action) {
|
|
1298
1299
|
await dialogHistorySettled();
|
|
1299
1300
|
// Another draft or no composer any more: the command does not run against it.
|
|
1300
|
-
if (disposed ||
|
|
1301
|
+
if (disposed || draftKey() !== key) return;
|
|
1301
1302
|
}
|
|
1302
1303
|
const result = await command.action?.({
|
|
1303
1304
|
setValue: value => edit(value),
|
|
@@ -1313,7 +1314,7 @@ export function ChatComposer(props) {
|
|
|
1313
1314
|
showCommandStatus();
|
|
1314
1315
|
} else if (result && "mention" in result) {
|
|
1315
1316
|
// One undo step from the token to the reference, as if the row had been a reference itself.
|
|
1316
|
-
if (
|
|
1317
|
+
if (draftKey() === key && props.value === nextValue) {
|
|
1317
1318
|
restore();
|
|
1318
1319
|
restored = false;
|
|
1319
1320
|
const name = result.mention.name;
|
|
@@ -1356,9 +1357,9 @@ export function ChatComposer(props) {
|
|
|
1356
1357
|
if (commandStatus()?.tone === "busy") showCommandStatus();
|
|
1357
1358
|
setExecuting(false);
|
|
1358
1359
|
}
|
|
1359
|
-
if (submitRequested &&
|
|
1360
|
+
if (submitRequested && draftKey() === key) await submit();
|
|
1360
1361
|
queueMicrotask(() => {
|
|
1361
|
-
if (
|
|
1362
|
+
if (draftKey() !== key) return;
|
|
1362
1363
|
if (restored || props.value === nextValue || mentioned && props.value === mentioned.value) {
|
|
1363
1364
|
const position = restored ? token.end : mentioned?.caret ?? token.start + replacement.length;
|
|
1364
1365
|
textareaRef?.setSelectionRange(restored && addSelection ? addSelection.start : position, restored && addSelection ? addSelection.end : position);
|
|
@@ -1374,13 +1375,13 @@ export function ChatComposer(props) {
|
|
|
1374
1375
|
* stays in the row while the list is still there, otherwise the status line says it, so it never ends in silence.
|
|
1375
1376
|
*/
|
|
1376
1377
|
const openFromCommand = async (command, open, token) => {
|
|
1377
|
-
const key =
|
|
1378
|
+
const key = draftKey();
|
|
1378
1379
|
const row = chatCommandKey(command);
|
|
1379
1380
|
const value = props.value;
|
|
1380
1381
|
const nextValue = value.slice(0, token.start) + value.slice(token.end);
|
|
1381
1382
|
const nextMentions = reconcileChatMentions(value, nextValue, mentions());
|
|
1382
1383
|
// Still the same draft and `/…`, so the row is where the person chose it.
|
|
1383
|
-
const inPlace = () => !disposed &&
|
|
1384
|
+
const inPlace = () => !disposed && draftKey() === key && props.value === value && commandQuery()?.start === token.start;
|
|
1384
1385
|
const heldHistory = commandSheetHeld();
|
|
1385
1386
|
// Closing the list or leaving the composer cancels the opening; the row ends at once, without waiting for it.
|
|
1386
1387
|
const controller = new AbortController();
|
|
@@ -1442,15 +1443,15 @@ export function ChatComposer(props) {
|
|
|
1442
1443
|
// Success: the token leaves and the list closes in the same step that ends the opening, so a phone sheet never
|
|
1443
1444
|
// takes its Back entry again while the page navigates.
|
|
1444
1445
|
batch(() => {
|
|
1445
|
-
if (!disposed &&
|
|
1446
|
+
if (!disposed && draftKey() === key && props.value === value) {
|
|
1446
1447
|
edit(nextValue, nextMentions);
|
|
1447
1448
|
setDismissed(true);
|
|
1448
1449
|
}
|
|
1449
|
-
endAddSearch(!disposed &&
|
|
1450
|
+
endAddSearch(!disposed && draftKey() === key);
|
|
1450
1451
|
finish(true);
|
|
1451
1452
|
});
|
|
1452
1453
|
queueMicrotask(() => {
|
|
1453
|
-
if (disposed ||
|
|
1454
|
+
if (disposed || draftKey() !== key || props.value !== nextValue) return;
|
|
1454
1455
|
textareaRef?.setSelectionRange(token.start, token.start);
|
|
1455
1456
|
syncCaret();
|
|
1456
1457
|
autoResize();
|