@streamsai/ui 0.1.2 → 0.1.4
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.
|
@@ -73,8 +73,6 @@ export type SlashCommandCandidate = {
|
|
|
73
73
|
insertText?: string | null;
|
|
74
74
|
/** Menu section; the menu lists `cycles` before `commands`. Ungrouped candidates show under one title. */
|
|
75
75
|
group?: 'cycles' | 'commands';
|
|
76
|
-
/** Draws a soft sweeping highlight behind the row, to point a first-time user at it. */
|
|
77
|
-
emphasis?: boolean;
|
|
78
76
|
};
|
|
79
77
|
/** Host-supplied emoji for the `:` shortcode typeahead (Slack-style `:smile:`). */
|
|
80
78
|
export type EmojiCandidate = {
|
|
@@ -21,8 +21,7 @@ import { $createLinkNode, $isLinkNode, LinkNode, AutoLinkNode } from '@lexical/l
|
|
|
21
21
|
import { $createCodeNode, $isCodeNode, CodeNode } from '@lexical/code';
|
|
22
22
|
import { BOLD_ITALIC_STAR, BOLD_ITALIC_UNDERSCORE, BOLD_STAR, BOLD_UNDERSCORE, CODE, INLINE_CODE, ITALIC_STAR, ITALIC_UNDERSCORE, LINK, ORDERED_LIST, STRIKETHROUGH, UNORDERED_LIST, } from '@lexical/markdown';
|
|
23
23
|
import { cn } from '../../lib/utils.js';
|
|
24
|
-
import { Collapse
|
|
25
|
-
import { loops } from '../../motion/config.js';
|
|
24
|
+
import { Collapse } from '../../motion/index.js';
|
|
26
25
|
import { detectTextDirection, hasStrongCharacter } from '../../lib/text-direction.js';
|
|
27
26
|
import { AgentAvatar } from './agent-avatar.js';
|
|
28
27
|
import { ProviderBadge } from './provider-badge.js';
|
|
@@ -1068,7 +1067,10 @@ function TypeaheadMenuAboveCaret({ anchor, dataAttr, className, children, option
|
|
|
1068
1067
|
width: initialPlacement.width,
|
|
1069
1068
|
// Beats `max-h-60` when the room above the menu is smaller than 240px.
|
|
1070
1069
|
maxHeight: initialPlacement.maxHeight,
|
|
1071
|
-
},
|
|
1070
|
+
},
|
|
1071
|
+
// A tap on a row must not move focus off the composer: on iOS that pulses the keyboard
|
|
1072
|
+
// state for a moment (focusout, then focusin) and the message list behind it jumps.
|
|
1073
|
+
onMouseDown: (event) => event.preventDefault(), onScroll: onNearEnd
|
|
1072
1074
|
? (event) => {
|
|
1073
1075
|
const el = event.currentTarget;
|
|
1074
1076
|
if (el.scrollTop + el.clientHeight >= el.scrollHeight - TYPEAHEAD_NEAR_END_PX) {
|
|
@@ -1400,22 +1402,13 @@ function SlashCommandsPlugin({ searchSlashCommands, onSelectCommand, onSlashType
|
|
|
1400
1402
|
: labels.slashTitle;
|
|
1401
1403
|
return (_jsxs(React.Fragment, { children: [startsGroup ? _jsx(SlashGroupHeader, { label: title, first: index === 0 }) : null, _jsxs("button", { id: `slash-typeahead-item-${index}`, type: "button", role: "option", tabIndex: -1, "aria-selected": selected,
|
|
1402
1404
|
// Lexical scrolls the highlighted row into the max-h menu via this ref.
|
|
1403
|
-
ref: option.setRefElement, className: cn('
|
|
1405
|
+
ref: option.setRefElement, className: cn('flex w-full flex-col rounded-lg p-2 text-start text-sm in-data-[platform=mobile]:mb-0.5 in-data-[platform=mobile]:text-base', selected ? 'bg-accent text-accent-foreground' : 'hover:bg-accent'), onClick: () => {
|
|
1404
1406
|
setHighlightedIndex(index);
|
|
1405
1407
|
selectOptionAndCleanUp(option);
|
|
1406
|
-
}, onMouseEnter: () => setHighlightedIndex(index), children: [
|
|
1408
|
+
}, onMouseEnter: () => setHighlightedIndex(index), children: [_jsxs("span", { children: ["/", option.candidate.name] }), _jsx("span", { className: "text-muted-foreground", children: option.candidate.description })] })] }, option.key));
|
|
1407
1409
|
})) }), document.body);
|
|
1408
1410
|
} }));
|
|
1409
1411
|
}
|
|
1410
|
-
/** A tinted wash with a light band sweeping across it; still (tint only) under reduced motion. */
|
|
1411
|
-
function SlashEmphasis() {
|
|
1412
|
-
const reduceMotion = useReducedMotion();
|
|
1413
|
-
return (_jsx(motion.span, { "aria-hidden": true, "data-slot": "slash-emphasis", className: "pointer-events-none absolute inset-0 -z-10 rounded-lg bg-primary/8", style: {
|
|
1414
|
-
backgroundImage: 'linear-gradient(100deg, transparent 30%, color-mix(in oklab, var(--primary) 22%, transparent) 50%, transparent 70%)',
|
|
1415
|
-
backgroundSize: '220% 100%',
|
|
1416
|
-
backgroundRepeat: 'no-repeat',
|
|
1417
|
-
}, initial: { backgroundPosition: '160% 0' }, animate: reduceMotion === true ? undefined : { backgroundPosition: ['160% 0', '-60% 0'] }, transition: { ...loops.shimmer, duration: 1.8 } }));
|
|
1418
|
-
}
|
|
1419
1412
|
function SlashGroupHeader({ label, first }) {
|
|
1420
1413
|
return (_jsxs("div", { className: cn('flex items-center gap-2.5 px-2 pb-1 text-sm text-muted-foreground', first ? 'pt-1.5' : 'pt-3'), children: [_jsx("span", { children: label }), _jsx("span", { className: "h-px flex-1 bg-border", "aria-hidden": true })] }));
|
|
1421
1414
|
}
|
package/package.json
CHANGED