@efolusi/meridian 1.5.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/README.md +12 -0
- package/ai/AgentRun.d.ts +20 -0
- package/ai/AgentRun.js +100 -0
- package/ai/ChatMessage.d.ts +19 -0
- package/ai/ChatMessage.js +81 -0
- package/ai/Citation.d.ts +23 -0
- package/ai/Citation.js +146 -0
- package/ai/Confirmation.d.ts +26 -0
- package/ai/Confirmation.js +84 -0
- package/ai/Conversation.d.ts +15 -0
- package/ai/Conversation.js +81 -0
- package/ai/DocumentCard.d.ts +17 -0
- package/ai/DocumentCard.js +101 -0
- package/ai/FeedbackBar.d.ts +14 -0
- package/ai/FeedbackBar.js +84 -0
- package/ai/GeneratedImage.d.ts +22 -0
- package/ai/GeneratedImage.js +100 -0
- package/ai/ModelSelector.d.ts +21 -0
- package/ai/ModelSelector.js +112 -0
- package/ai/Player.d.ts +18 -0
- package/ai/Player.js +201 -0
- package/ai/PromptComposer.d.ts +28 -0
- package/ai/PromptComposer.js +111 -0
- package/ai/PromptSteps.d.ts +18 -0
- package/ai/PromptSteps.js +167 -0
- package/ai/Reasoning.d.ts +17 -0
- package/ai/Reasoning.js +57 -0
- package/ai/RichComposer.d.ts +25 -0
- package/ai/RichComposer.js +247 -0
- package/ai/Sandbox.d.ts +20 -0
- package/ai/Sandbox.js +96 -0
- package/ai/SelectionQuote.d.ts +15 -0
- package/ai/SelectionQuote.js +123 -0
- package/ai/SourceCard.d.ts +17 -0
- package/ai/SourceCard.js +57 -0
- package/ai/Suggestions.d.ts +10 -0
- package/ai/Suggestions.js +38 -0
- package/ai/Task.d.ts +15 -0
- package/ai/Task.js +49 -0
- package/ai/Todo.d.ts +13 -0
- package/ai/Todo.js +87 -0
- package/ai/ToolCall.d.ts +30 -0
- package/ai/ToolCall.js +147 -0
- package/ai/Transcript.d.ts +27 -0
- package/ai/Transcript.js +96 -0
- package/ai/UsageMeter.d.ts +21 -0
- package/ai/UsageMeter.js +81 -0
- package/ai/WebPreview.d.ts +19 -0
- package/ai/WebPreview.js +179 -0
- package/assets/fonts/BricolageGrotesque-Variable.ttf +0 -0
- package/assets/fonts/Figtree-Italic-Variable.ttf +0 -0
- package/assets/fonts/Figtree-Variable.ttf +0 -0
- package/assets/fonts/JetBrainsMono-Italic-Variable.ttf +0 -0
- package/assets/fonts/JetBrainsMono-Variable.ttf +0 -0
- package/assets/fonts/OFL-BricolageGrotesque.txt +93 -0
- package/assets/fonts/OFL-Figtree.txt +93 -0
- package/assets/fonts/OFL-JetBrainsMono.txt +93 -0
- package/code/CodeBlock.d.ts +17 -0
- package/code/CodeBlock.js +99 -0
- package/code/Console.d.ts +19 -0
- package/code/Console.js +124 -0
- package/code/CopyField.d.ts +10 -0
- package/code/CopyField.js +54 -0
- package/code/Diff.d.ts +26 -0
- package/code/Diff.js +358 -0
- package/code/EnvList.d.ts +14 -0
- package/code/EnvList.js +89 -0
- package/code/Exception.d.ts +25 -0
- package/code/Exception.js +90 -0
- package/code/Terminal.d.ts +20 -0
- package/code/Terminal.js +58 -0
- package/data/BarChart.d.ts +14 -0
- package/data/BarChart.js +44 -0
- package/data/DonutChart.d.ts +17 -0
- package/data/DonutChart.js +114 -0
- package/data/EmptyState.d.ts +13 -0
- package/data/EmptyState.js +39 -0
- package/data/KeyValueList.d.ts +14 -0
- package/data/KeyValueList.js +34 -0
- package/data/LineChart.d.ts +15 -0
- package/data/LineChart.js +85 -0
- package/data/Skeleton.d.ts +11 -0
- package/data/Skeleton.js +49 -0
- package/data/Sparkline.d.ts +14 -0
- package/data/Sparkline.js +42 -0
- package/data/Stat.d.ts +14 -0
- package/data/Stat.js +40 -0
- package/data/StatusDot.d.ts +10 -0
- package/data/StatusDot.js +34 -0
- package/data/Table.d.ts +53 -0
- package/data/Table.js +174 -0
- package/dates/Calendar.d.ts +8 -0
- package/dates/Calendar.js +143 -0
- package/dates/DatePicker.d.ts +12 -0
- package/dates/DatePicker.js +118 -0
- package/display/Accordion.d.ts +15 -0
- package/display/Accordion.js +52 -0
- package/display/AspectRatio.d.ts +8 -0
- package/display/AspectRatio.js +24 -0
- package/display/Avatar.d.ts +17 -0
- package/display/Avatar.js +52 -0
- package/display/Badge.d.ts +10 -0
- package/display/Badge.js +34 -0
- package/display/Card.d.ts +17 -0
- package/display/Card.js +51 -0
- package/display/Carousel.d.ts +16 -0
- package/display/Carousel.js +97 -0
- package/display/Collapsible.d.ts +12 -0
- package/display/Collapsible.js +46 -0
- package/display/Divider.d.ts +9 -0
- package/display/Divider.js +33 -0
- package/display/Kbd.d.ts +7 -0
- package/display/Kbd.js +18 -0
- package/display/Link.d.ts +12 -0
- package/display/Link.js +41 -0
- package/display/ListItem.d.ts +19 -0
- package/display/ListItem.js +61 -0
- package/display/Resizable.d.ts +16 -0
- package/display/Resizable.js +90 -0
- package/display/ScrollArea.d.ts +8 -0
- package/display/ScrollArea.js +28 -0
- package/display/Tag.d.ts +9 -0
- package/display/Tag.js +41 -0
- package/display/Toolbar.d.ts +22 -0
- package/display/Toolbar.js +55 -0
- package/display/TreeList.d.ts +20 -0
- package/display/TreeList.js +101 -0
- package/feedback/Alert.d.ts +14 -0
- package/feedback/Alert.js +56 -0
- package/feedback/Banner.d.ts +15 -0
- package/feedback/Banner.js +49 -0
- package/feedback/ConfirmDialog.d.ts +18 -0
- package/feedback/ConfirmDialog.js +49 -0
- package/feedback/Dialog.d.ts +13 -0
- package/feedback/Dialog.js +107 -0
- package/feedback/Loader.d.ts +12 -0
- package/feedback/Loader.js +41 -0
- package/feedback/Progress.d.ts +15 -0
- package/feedback/Progress.js +48 -0
- package/feedback/Spinner.d.ts +9 -0
- package/feedback/Spinner.js +38 -0
- package/feedback/Toast.d.ts +70 -0
- package/feedback/Toast.js +216 -0
- package/feedback/Tooltip.d.ts +12 -0
- package/feedback/Tooltip.js +86 -0
- package/files/FileDrop.d.ts +15 -0
- package/files/FileDrop.js +75 -0
- package/files/FileTile.d.ts +19 -0
- package/files/FileTile.js +96 -0
- package/files/FileTypeIcon.d.ts +11 -0
- package/files/FileTypeIcon.js +121 -0
- package/finance/PaymentCard.d.ts +17 -0
- package/finance/PaymentCard.js +109 -0
- package/forms/Button.d.ts +15 -0
- package/forms/Button.js +82 -0
- package/forms/ButtonGroup.d.ts +5 -0
- package/forms/ButtonGroup.js +22 -0
- package/forms/ButtonTile.d.ts +21 -0
- package/forms/ButtonTile.js +69 -0
- package/forms/Checkbox.d.ts +6 -0
- package/forms/Checkbox.js +52 -0
- package/forms/Combobox.d.ts +17 -0
- package/forms/Combobox.js +162 -0
- package/forms/DigitEntry.d.ts +15 -0
- package/forms/DigitEntry.js +88 -0
- package/forms/FormField.d.ts +39 -0
- package/forms/FormField.js +127 -0
- package/forms/IconButton.d.ts +11 -0
- package/forms/IconButton.js +41 -0
- package/forms/Input.d.ts +14 -0
- package/forms/Input.js +75 -0
- package/forms/InputGroup.d.ts +15 -0
- package/forms/InputGroup.js +59 -0
- package/forms/Label.d.ts +11 -0
- package/forms/Label.js +29 -0
- package/forms/Radio.d.ts +6 -0
- package/forms/Radio.js +46 -0
- package/forms/Select.d.ts +10 -0
- package/forms/Select.js +68 -0
- package/forms/Slider.d.ts +18 -0
- package/forms/Slider.js +75 -0
- package/forms/Switch.d.ts +6 -0
- package/forms/Switch.js +46 -0
- package/forms/Textarea.d.ts +8 -0
- package/forms/Textarea.js +58 -0
- package/forms/Toggle.d.ts +26 -0
- package/forms/Toggle.js +85 -0
- package/icons/Icon.d.ts +13 -0
- package/icons/Icon.js +54 -0
- package/index.d.ts +106 -0
- package/index.js +106 -0
- package/navigation/Breadcrumbs.d.ts +12 -0
- package/navigation/Breadcrumbs.js +41 -0
- package/navigation/Menubar.d.ts +10 -0
- package/navigation/Menubar.js +173 -0
- package/navigation/PageControl.d.ts +11 -0
- package/navigation/PageControl.js +36 -0
- package/navigation/Pagination.d.ts +9 -0
- package/navigation/Pagination.js +68 -0
- package/navigation/SegmentedControl.d.ts +17 -0
- package/navigation/SegmentedControl.js +42 -0
- package/navigation/SideNav.d.ts +18 -0
- package/navigation/SideNav.js +87 -0
- package/navigation/Steps.d.ts +15 -0
- package/navigation/Steps.js +61 -0
- package/navigation/Tabs.d.ts +17 -0
- package/navigation/Tabs.js +76 -0
- package/navigation/TopNav.d.ts +10 -0
- package/navigation/TopNav.js +26 -0
- package/overlay/CommandPalette.d.ts +21 -0
- package/overlay/CommandPalette.js +164 -0
- package/overlay/ContextMenu.d.ts +11 -0
- package/overlay/ContextMenu.js +140 -0
- package/overlay/Drawer.d.ts +14 -0
- package/overlay/Drawer.js +99 -0
- package/overlay/HoverCard.d.ts +17 -0
- package/overlay/HoverCard.js +74 -0
- package/overlay/Menu.d.ts +24 -0
- package/overlay/Menu.js +153 -0
- package/overlay/Popover.d.ts +16 -0
- package/overlay/Popover.js +96 -0
- package/overlay/Portal.d.ts +10 -0
- package/overlay/Portal.js +127 -0
- package/package.json +41 -0
- package/styles.css +6 -0
- package/tokens/base.css +10 -0
- package/tokens/colors.css +38 -0
- package/tokens/effects.css +22 -0
- package/tokens/fonts.css +5 -0
- package/tokens/spacing.css +12 -0
- package/tokens/typography.css +9 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { injectEfCss } from "../forms/Button.js";
|
|
4
|
+
import { Icon } from "../icons/Icon.js";
|
|
5
|
+
const CSS = `
|
|
6
|
+
.ef-doccard{border:1px solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-card);font-family:var(--font-sans)}
|
|
7
|
+
.ef-doccard__head{display:flex;align-items:center;gap:9px;padding:10px 10px 10px 14px}
|
|
8
|
+
.ef-doccard__glyph{display:inline-flex;color:var(--text-muted)}
|
|
9
|
+
.ef-doccard__title{flex:1;min-width:0;font-size:13.5px;font-weight:var(--weight-semibold);color:var(--text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
10
|
+
.ef-doccard__meta{font-size:12px;color:var(--text-muted)}
|
|
11
|
+
.ef-doccard__btn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;background:none;cursor:pointer;color:var(--text-muted);border-radius:var(--radius-sm);transition:color var(--dur-fast) var(--ease-out),background var(--dur-fast) var(--ease-out)}
|
|
12
|
+
.ef-doccard__btn:hover{color:var(--text-primary);background:var(--surface-subtle)}
|
|
13
|
+
.ef-doccard__btn:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
14
|
+
.ef-doccard__btn--open{transform:rotate(180deg)}
|
|
15
|
+
.ef-doccard__win{position:relative;overflow:hidden;transition:height .45s cubic-bezier(.32,.72,0,1)}
|
|
16
|
+
.ef-doccard__content{padding:0 16px 14px;font-size:14px;line-height:1.7;color:var(--text-secondary)}
|
|
17
|
+
.ef-doccard__content h1,.ef-doccard__content h2,.ef-doccard__content h3{color:var(--text-primary);font-family:var(--font-display,var(--font-sans));margin:.2em 0 .4em}
|
|
18
|
+
.ef-doccard__content p{margin:0 0 .8em}
|
|
19
|
+
.ef-doccard__fade{position:absolute;left:0;right:0;bottom:0;height:72px;background:linear-gradient(to top,var(--surface-card),transparent);pointer-events:none;transition:opacity var(--dur-med) var(--ease-out)}
|
|
20
|
+
.ef-doccard--open .ef-doccard__fade{opacity:0}
|
|
21
|
+
`;
|
|
22
|
+
export function DocumentCard({
|
|
23
|
+
title,
|
|
24
|
+
meta,
|
|
25
|
+
icon = 'file-text',
|
|
26
|
+
collapsedHeight = 200,
|
|
27
|
+
defaultOpen = false,
|
|
28
|
+
onCopy,
|
|
29
|
+
actions,
|
|
30
|
+
children,
|
|
31
|
+
style,
|
|
32
|
+
className,
|
|
33
|
+
...rest
|
|
34
|
+
}) {
|
|
35
|
+
injectEfCss('ef-css-doccard', CSS);
|
|
36
|
+
const [open, setOpen] = React.useState(!!defaultOpen);
|
|
37
|
+
const [full, setFull] = React.useState(null);
|
|
38
|
+
const [copied, setCopied] = React.useState(false);
|
|
39
|
+
const inner = React.useRef(null);
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
const el = inner.current;
|
|
42
|
+
if (!el) return;
|
|
43
|
+
const update = () => setFull(el.scrollHeight);
|
|
44
|
+
update();
|
|
45
|
+
const ro = new ResizeObserver(update);
|
|
46
|
+
ro.observe(el);
|
|
47
|
+
return () => ro.disconnect();
|
|
48
|
+
}, []);
|
|
49
|
+
const overflows = full !== null && full > collapsedHeight;
|
|
50
|
+
const height = full === null ? open ? undefined : collapsedHeight : open ? full : Math.min(full, collapsedHeight);
|
|
51
|
+
const copy = () => {
|
|
52
|
+
const text = inner.current ? inner.current.textContent : '';
|
|
53
|
+
if (navigator.clipboard) navigator.clipboard.writeText(text).catch(() => {});
|
|
54
|
+
if (onCopy) onCopy(text);
|
|
55
|
+
setCopied(true);
|
|
56
|
+
setTimeout(() => setCopied(false), 1600);
|
|
57
|
+
};
|
|
58
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
59
|
+
className: `ef-doccard${open ? ' ef-doccard--open' : ''}${className ? ' ' + className : ''}`,
|
|
60
|
+
style: style
|
|
61
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: "ef-doccard__head"
|
|
63
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
64
|
+
className: "ef-doccard__glyph"
|
|
65
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
66
|
+
name: icon,
|
|
67
|
+
size: 15
|
|
68
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
69
|
+
className: "ef-doccard__title"
|
|
70
|
+
}, title), meta ? /*#__PURE__*/React.createElement("span", {
|
|
71
|
+
className: "ef-doccard__meta"
|
|
72
|
+
}, meta) : null, actions, /*#__PURE__*/React.createElement("button", {
|
|
73
|
+
type: "button",
|
|
74
|
+
className: "ef-doccard__btn",
|
|
75
|
+
"aria-label": "Copy document",
|
|
76
|
+
onClick: copy
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
78
|
+
name: copied ? 'check' : 'copy',
|
|
79
|
+
size: 14
|
|
80
|
+
})), overflows || !open ? /*#__PURE__*/React.createElement("button", {
|
|
81
|
+
type: "button",
|
|
82
|
+
className: `ef-doccard__btn${open ? ' ef-doccard__btn--open' : ''}`,
|
|
83
|
+
"aria-expanded": open,
|
|
84
|
+
"aria-label": open ? 'Collapse' : 'Expand',
|
|
85
|
+
onClick: () => setOpen(!open)
|
|
86
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
87
|
+
name: "chevron-down",
|
|
88
|
+
size: 14
|
|
89
|
+
})) : null), /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "ef-doccard__win",
|
|
91
|
+
style: {
|
|
92
|
+
height
|
|
93
|
+
}
|
|
94
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
ref: inner,
|
|
96
|
+
className: "ef-doccard__content"
|
|
97
|
+
}, children), overflows && !open ? /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: "ef-doccard__fade",
|
|
99
|
+
onClick: () => setOpen(true)
|
|
100
|
+
}) : null));
|
|
101
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface FeedbackBarProps {
|
|
2
|
+
/** Fires 'up' | 'down' | null (toggled off) */
|
|
3
|
+
onFeedback?: (dir: 'up' | 'down' | null) => void;
|
|
4
|
+
/** Copies this text on the copy button */
|
|
5
|
+
copyText?: string;
|
|
6
|
+
onCopy?: () => void;
|
|
7
|
+
/** Shows the regenerate button */
|
|
8
|
+
onRetry?: () => void;
|
|
9
|
+
/** Muted note after the buttons */
|
|
10
|
+
note?: React.ReactNode;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function FeedbackBar(props: FeedbackBarProps): React.JSX.Element;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { injectEfCss } from "../forms/Button.js";
|
|
4
|
+
import { Icon } from "../icons/Icon.js";
|
|
5
|
+
const CSS = `
|
|
6
|
+
.ef-feedback{display:inline-flex;align-items:center;gap:2px}
|
|
7
|
+
.ef-feedback__btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border:none;border-radius:var(--radius-sm);background:none;cursor:pointer;color:var(--text-muted);transition:color var(--dur-fast) var(--ease-out),background var(--dur-fast) var(--ease-out)}
|
|
8
|
+
.ef-feedback__btn:hover{color:var(--text-primary);background:var(--surface-sunken)}
|
|
9
|
+
.ef-feedback__btn:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
10
|
+
.ef-feedback__btn--on{color:var(--brand-700);background:var(--accent-subtle)}
|
|
11
|
+
.ef-feedback__sep{width:1px;height:14px;background:var(--border-default);margin:0 5px}
|
|
12
|
+
.ef-feedback__note{font-size:11.5px;color:var(--text-muted);margin-left:6px}
|
|
13
|
+
`;
|
|
14
|
+
export function FeedbackBar({
|
|
15
|
+
onFeedback,
|
|
16
|
+
onCopy,
|
|
17
|
+
onRetry,
|
|
18
|
+
copyText,
|
|
19
|
+
note,
|
|
20
|
+
style,
|
|
21
|
+
className,
|
|
22
|
+
...rest
|
|
23
|
+
}) {
|
|
24
|
+
injectEfCss('ef-css-feedback', CSS);
|
|
25
|
+
const [vote, setVote] = React.useState(null);
|
|
26
|
+
const [copied, setCopied] = React.useState(false);
|
|
27
|
+
const cast = dir => {
|
|
28
|
+
const next = vote === dir ? null : dir;
|
|
29
|
+
setVote(next);
|
|
30
|
+
if (onFeedback) onFeedback(next);
|
|
31
|
+
};
|
|
32
|
+
const copy = () => {
|
|
33
|
+
if (copyText) {
|
|
34
|
+
try {
|
|
35
|
+
navigator.clipboard.writeText(copyText);
|
|
36
|
+
} catch (e) {}
|
|
37
|
+
}
|
|
38
|
+
if (onCopy) onCopy();
|
|
39
|
+
setCopied(true);
|
|
40
|
+
setTimeout(() => setCopied(false), 1400);
|
|
41
|
+
};
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
43
|
+
className: `ef-feedback${className ? ' ' + className : ''}`,
|
|
44
|
+
style: style
|
|
45
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
46
|
+
type: "button",
|
|
47
|
+
"aria-label": "Good response",
|
|
48
|
+
"aria-pressed": vote === 'up',
|
|
49
|
+
className: `ef-feedback__btn${vote === 'up' ? ' ef-feedback__btn--on' : ''}`,
|
|
50
|
+
onClick: () => cast('up')
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
52
|
+
name: "thumbs-up",
|
|
53
|
+
size: 13
|
|
54
|
+
})), /*#__PURE__*/React.createElement("button", {
|
|
55
|
+
type: "button",
|
|
56
|
+
"aria-label": "Bad response",
|
|
57
|
+
"aria-pressed": vote === 'down',
|
|
58
|
+
className: `ef-feedback__btn${vote === 'down' ? ' ef-feedback__btn--on' : ''}`,
|
|
59
|
+
onClick: () => cast('down')
|
|
60
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
61
|
+
name: "thumbs-down",
|
|
62
|
+
size: 13
|
|
63
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
64
|
+
className: "ef-feedback__sep"
|
|
65
|
+
}), onCopy || copyText ? /*#__PURE__*/React.createElement("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
"aria-label": "Copy",
|
|
68
|
+
className: `ef-feedback__btn${copied ? ' ef-feedback__btn--on' : ''}`,
|
|
69
|
+
onClick: copy
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
71
|
+
name: copied ? 'check' : 'copy',
|
|
72
|
+
size: 13
|
|
73
|
+
})) : null, onRetry ? /*#__PURE__*/React.createElement("button", {
|
|
74
|
+
type: "button",
|
|
75
|
+
"aria-label": "Regenerate",
|
|
76
|
+
className: "ef-feedback__btn",
|
|
77
|
+
onClick: onRetry
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
79
|
+
name: "refresh-cw",
|
|
80
|
+
size: 13
|
|
81
|
+
})) : null, note ? /*#__PURE__*/React.createElement("span", {
|
|
82
|
+
className: "ef-feedback__note"
|
|
83
|
+
}, note) : null);
|
|
84
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface GeneratedImageAction {
|
|
2
|
+
icon: string;
|
|
3
|
+
label: string;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface GeneratedImageProps {
|
|
7
|
+
/** 'queued' | 'generating' | 'complete' | 'error' */
|
|
8
|
+
state?: 'queued' | 'generating' | 'complete' | 'error';
|
|
9
|
+
src?: string;
|
|
10
|
+
alt?: string;
|
|
11
|
+
/** Prompt shown top-left over the image */
|
|
12
|
+
prompt?: string;
|
|
13
|
+
/** 'square' | 'video' | 'portrait' */
|
|
14
|
+
aspect?: 'square' | 'video' | 'portrait';
|
|
15
|
+
error?: React.ReactNode;
|
|
16
|
+
onRetry?: () => void;
|
|
17
|
+
/** Hover actions, top-right (e.g. download) */
|
|
18
|
+
actions?: GeneratedImageAction[];
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function GeneratedImage(props: GeneratedImageProps): React.JSX.Element;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { injectEfCss } from "../forms/Button.js";
|
|
4
|
+
import { Icon } from "../icons/Icon.js";
|
|
5
|
+
const CSS = `
|
|
6
|
+
.ef-genimg{position:relative;width:100%;overflow:hidden;border-radius:var(--radius-md);border:1px solid var(--border-default);background:var(--surface-sunken);font-family:var(--font-sans)}
|
|
7
|
+
.ef-genimg--square{aspect-ratio:1}
|
|
8
|
+
.ef-genimg--video{aspect-ratio:16/9}
|
|
9
|
+
.ef-genimg--portrait{aspect-ratio:3/4}
|
|
10
|
+
.ef-genimg--error{border-color:var(--danger-300);box-shadow:0 0 0 3px var(--danger-100)}
|
|
11
|
+
.ef-genimg__img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .5s var(--ease-out)}
|
|
12
|
+
.ef-genimg--complete .ef-genimg__img{opacity:1}
|
|
13
|
+
.ef-genimg--error .ef-genimg__img{opacity:.3}
|
|
14
|
+
.ef-genimg__dark{position:absolute;inset:0;background:#141210;opacity:0;transition:opacity var(--dur-med) var(--ease-out);pointer-events:none}
|
|
15
|
+
.ef-genimg--generating .ef-genimg__dark{opacity:1}
|
|
16
|
+
.ef-genimg__dots{position:absolute;inset:0;background-image:radial-gradient(circle,rgba(243,239,231,.22) 1.3px,transparent 1.7px);background-size:30px 30px;-webkit-mask-image:radial-gradient(ellipse at center,black 10%,transparent 78%);mask-image:radial-gradient(ellipse at center,black 10%,transparent 78%);animation:ef-genimg-pulse 2.8s ease-in-out infinite}
|
|
17
|
+
@keyframes ef-genimg-pulse{0%,100%{opacity:.45}50%{opacity:1}}
|
|
18
|
+
.ef-genimg__scrim{position:absolute;left:0;right:0;pointer-events:none;opacity:0;transition:opacity var(--dur-med) var(--ease-out)}
|
|
19
|
+
.ef-genimg--complete .ef-genimg__scrim{opacity:1}
|
|
20
|
+
.ef-genimg__scrim--top{top:0;height:34%;background:linear-gradient(to bottom,rgba(20,16,12,.55),transparent)}
|
|
21
|
+
.ef-genimg__prompt{position:absolute;top:13px;left:16px;right:16px;font-size:13px;font-weight:var(--weight-semibold);color:var(--text-primary);z-index:2}
|
|
22
|
+
.ef-genimg--generating .ef-genimg__prompt,.ef-genimg--complete .ef-genimg__prompt{color:#FAF9F6}
|
|
23
|
+
.ef-genimg__status{position:absolute;left:16px;bottom:13px;font-size:12.5px;color:rgba(250,249,246,.75);z-index:2;animation:ef-genimg-pulse 1.6s ease-in-out infinite}
|
|
24
|
+
.ef-genimg__center{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;color:var(--text-muted);font-size:13px;z-index:2;padding:20px;text-align:center}
|
|
25
|
+
.ef-genimg__actions{position:absolute;top:9px;right:9px;display:flex;gap:2px;z-index:3;opacity:0;transition:opacity var(--dur-fast) var(--ease-out)}
|
|
26
|
+
.ef-genimg--complete:hover .ef-genimg__actions,.ef-genimg--complete:focus-within .ef-genimg__actions{opacity:1}
|
|
27
|
+
.ef-genimg__act{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;border:none;cursor:pointer;color:#FAF9F6;background:rgba(20,16,12,.45);border-radius:var(--radius-sm);backdrop-filter:blur(2px);transition:background var(--dur-fast) var(--ease-out)}
|
|
28
|
+
.ef-genimg__act:hover{background:rgba(20,16,12,.7)}
|
|
29
|
+
.ef-genimg__act:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
30
|
+
.ef-genimg__retry{display:inline-flex;align-items:center;gap:6px;padding:7px 13px;border:1px solid var(--border-strong);border-radius:var(--radius-full);background:var(--surface-card);cursor:pointer;font-family:var(--font-sans);font-size:12.5px;font-weight:var(--weight-semibold);color:var(--text-primary)}
|
|
31
|
+
.ef-genimg__err{color:var(--danger-600)}
|
|
32
|
+
`;
|
|
33
|
+
export function GeneratedImage({
|
|
34
|
+
state = 'complete',
|
|
35
|
+
src,
|
|
36
|
+
alt,
|
|
37
|
+
prompt,
|
|
38
|
+
aspect = 'square',
|
|
39
|
+
error,
|
|
40
|
+
onRetry,
|
|
41
|
+
actions,
|
|
42
|
+
style,
|
|
43
|
+
className,
|
|
44
|
+
...rest
|
|
45
|
+
}) {
|
|
46
|
+
injectEfCss('ef-css-genimg', CSS);
|
|
47
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
48
|
+
className: `ef-genimg ef-genimg--${aspect} ef-genimg--${state}${className ? ' ' + className : ''}`,
|
|
49
|
+
style: style,
|
|
50
|
+
"data-state": state
|
|
51
|
+
}), src && (state === 'complete' || state === 'error') ? /*#__PURE__*/React.createElement("img", {
|
|
52
|
+
className: "ef-genimg__img",
|
|
53
|
+
src: src,
|
|
54
|
+
alt: alt || prompt || ''
|
|
55
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: "ef-genimg__dark"
|
|
57
|
+
}, state === 'generating' ? /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "ef-genimg__dots"
|
|
59
|
+
}) : null), /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: "ef-genimg__scrim ef-genimg__scrim--top",
|
|
61
|
+
"aria-hidden": "true"
|
|
62
|
+
}), prompt ? /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: "ef-genimg__prompt"
|
|
64
|
+
}, prompt) : null, state === 'queued' ? /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: "ef-genimg__center"
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
67
|
+
name: "image",
|
|
68
|
+
size: 20
|
|
69
|
+
}), /*#__PURE__*/React.createElement("span", null, "Queued\u2026")) : null, state === 'generating' ? /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: "ef-genimg__status"
|
|
71
|
+
}, "Generating\u2026") : null, state === 'error' ? /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: "ef-genimg__center"
|
|
73
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
74
|
+
className: "ef-genimg__err"
|
|
75
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
76
|
+
name: "circle-alert",
|
|
77
|
+
size: 20
|
|
78
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
79
|
+
className: "ef-genimg__err"
|
|
80
|
+
}, error || 'Generation failed'), onRetry ? /*#__PURE__*/React.createElement("button", {
|
|
81
|
+
type: "button",
|
|
82
|
+
className: "ef-genimg__retry",
|
|
83
|
+
onClick: onRetry
|
|
84
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
85
|
+
name: "refresh-cw",
|
|
86
|
+
size: 13
|
|
87
|
+
}), "Retry") : null) : null, actions && actions.length ? /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "ef-genimg__actions"
|
|
89
|
+
}, actions.map((a, i) => /*#__PURE__*/React.createElement("button", {
|
|
90
|
+
key: i,
|
|
91
|
+
type: "button",
|
|
92
|
+
className: "ef-genimg__act",
|
|
93
|
+
"aria-label": a.label,
|
|
94
|
+
title: a.label,
|
|
95
|
+
onClick: a.onClick
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
97
|
+
name: a.icon,
|
|
98
|
+
size: 14
|
|
99
|
+
})))) : null);
|
|
100
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ModelOption {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
/** Shown muted next to the name */
|
|
5
|
+
provider?: string;
|
|
6
|
+
/** Second line in the list */
|
|
7
|
+
hint?: string;
|
|
8
|
+
/** Small uppercase tag, e.g. 'New' */
|
|
9
|
+
badge?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ModelSelectorProps {
|
|
12
|
+
models: ModelOption[];
|
|
13
|
+
/** Selected model id */
|
|
14
|
+
value?: string;
|
|
15
|
+
onChange?: (id: string) => void;
|
|
16
|
+
/** Panel direction @default 'up' */
|
|
17
|
+
side?: 'up' | 'down';
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function ModelSelector(props: ModelSelectorProps): React.JSX.Element;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { injectEfCss } from "../forms/Button.js";
|
|
4
|
+
import { Portal, useAnchoredStyle } from "../overlay/Portal.js";
|
|
5
|
+
import { Icon } from "../icons/Icon.js";
|
|
6
|
+
const CSS = `
|
|
7
|
+
.ef-modelsel{position:relative;display:inline-flex}
|
|
8
|
+
.ef-modelsel__btn{display:inline-flex;align-items:center;gap:8px;height:32px;padding:0 10px;border:1px solid var(--border-strong);border-radius:var(--radius-sm);background:var(--surface-card);cursor:pointer;font-family:var(--font-sans);font-size:13px;font-weight:500;color:var(--text-primary);transition:border-color var(--dur-fast) var(--ease-out)}
|
|
9
|
+
.ef-modelsel__btn:hover{border-color:var(--text-muted)}
|
|
10
|
+
.ef-modelsel__btn:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
11
|
+
.ef-modelsel__provider{font-size:11.5px;color:var(--text-muted);font-weight:400}
|
|
12
|
+
.ef-modelsel__chev{display:inline-flex;color:var(--text-muted)}
|
|
13
|
+
.ef-modelsel__panel{position:absolute;bottom:calc(100% + 6px);left:0;min-width:260px;background:var(--surface-card);border:1px solid var(--border-strong);border-radius:var(--radius-md);box-shadow:var(--shadow-md);padding:4px;z-index:var(--z-dropdown);animation:ef-modelsel-in var(--dur-fast) var(--ease-out)}
|
|
14
|
+
.ef-modelsel--down .ef-modelsel__panel{bottom:auto;top:calc(100% + 6px)}
|
|
15
|
+
@keyframes ef-modelsel-in{from{opacity:0;transform:translateY(3px)}}
|
|
16
|
+
.ef-modelsel__item{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:none;border-radius:var(--radius-sm);background:none;cursor:pointer;text-align:left;font-family:var(--font-sans);transition:background var(--dur-fast) var(--ease-out)}
|
|
17
|
+
.ef-modelsel__item:hover{background:var(--surface-sunken)}
|
|
18
|
+
.ef-modelsel__item:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
19
|
+
.ef-modelsel__name{font-size:13.5px;font-weight:500;color:var(--text-primary)}
|
|
20
|
+
.ef-modelsel__hint{font-size:12px;color:var(--text-muted);margin-top:1px}
|
|
21
|
+
.ef-modelsel__badge{margin-left:auto;flex:none;font-size:10.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--brand-700);background:var(--accent-subtle);border-radius:var(--radius-sm);padding:2px 6px}
|
|
22
|
+
.ef-modelsel__check{margin-left:auto;flex:none;display:inline-flex;color:var(--brand-700)}
|
|
23
|
+
.ef-modelsel__badge+.ef-modelsel__check{margin-left:8px}
|
|
24
|
+
`;
|
|
25
|
+
export function ModelSelector({
|
|
26
|
+
models = [],
|
|
27
|
+
value,
|
|
28
|
+
onChange,
|
|
29
|
+
side = 'up',
|
|
30
|
+
style,
|
|
31
|
+
className,
|
|
32
|
+
...rest
|
|
33
|
+
}) {
|
|
34
|
+
injectEfCss('ef-css-modelsel', CSS);
|
|
35
|
+
const [open, setOpen] = React.useState(false);
|
|
36
|
+
const ref = React.useRef(null);
|
|
37
|
+
const panelRef = React.useRef(null);
|
|
38
|
+
const {
|
|
39
|
+
style: anchored
|
|
40
|
+
} = useAnchoredStyle(ref, panelRef, {
|
|
41
|
+
open,
|
|
42
|
+
placement: side === 'down' ? 'bottom' : 'top',
|
|
43
|
+
align: 'start'
|
|
44
|
+
});
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
if (!open) return;
|
|
47
|
+
const away = e => {
|
|
48
|
+
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
49
|
+
};
|
|
50
|
+
const key = e => {
|
|
51
|
+
if (e.key === 'Escape') setOpen(false);
|
|
52
|
+
};
|
|
53
|
+
document.addEventListener('mousedown', away);
|
|
54
|
+
document.addEventListener('keydown', key);
|
|
55
|
+
return () => {
|
|
56
|
+
document.removeEventListener('mousedown', away);
|
|
57
|
+
document.removeEventListener('keydown', key);
|
|
58
|
+
};
|
|
59
|
+
}, [open]);
|
|
60
|
+
const cur = models.find(m => m.id === value) || models[0] || {};
|
|
61
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
62
|
+
ref: ref,
|
|
63
|
+
className: `ef-modelsel${side === 'down' ? ' ef-modelsel--down' : ''}${className ? ' ' + className : ''}`,
|
|
64
|
+
style: style
|
|
65
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
className: "ef-modelsel__btn",
|
|
68
|
+
"aria-haspopup": "listbox",
|
|
69
|
+
"aria-expanded": open,
|
|
70
|
+
onClick: () => setOpen(!open)
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
72
|
+
name: "sparkles",
|
|
73
|
+
size: 13
|
|
74
|
+
}), cur.name || 'Choose model', cur.provider ? /*#__PURE__*/React.createElement("span", {
|
|
75
|
+
className: "ef-modelsel__provider"
|
|
76
|
+
}, cur.provider) : null, /*#__PURE__*/React.createElement("span", {
|
|
77
|
+
className: "ef-modelsel__chev"
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
79
|
+
name: side === 'down' ? 'chevron-down' : 'chevron-up',
|
|
80
|
+
size: 13
|
|
81
|
+
}))), open ? /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
role: "listbox",
|
|
83
|
+
ref: panelRef,
|
|
84
|
+
className: "ef-modelsel__panel",
|
|
85
|
+
style: anchored
|
|
86
|
+
}, models.map(m => /*#__PURE__*/React.createElement("button", {
|
|
87
|
+
key: m.id,
|
|
88
|
+
type: "button",
|
|
89
|
+
role: "option",
|
|
90
|
+
"aria-selected": m.id === cur.id,
|
|
91
|
+
className: "ef-modelsel__item",
|
|
92
|
+
onClick: () => {
|
|
93
|
+
setOpen(false);
|
|
94
|
+
if (onChange) onChange(m.id);
|
|
95
|
+
}
|
|
96
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
97
|
+
style: {
|
|
98
|
+
minWidth: 0
|
|
99
|
+
}
|
|
100
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
101
|
+
className: "ef-modelsel__name"
|
|
102
|
+
}, m.name), m.hint ? /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: "ef-modelsel__hint"
|
|
104
|
+
}, m.hint) : null), m.badge ? /*#__PURE__*/React.createElement("span", {
|
|
105
|
+
className: "ef-modelsel__badge"
|
|
106
|
+
}, m.badge) : null, m.id === cur.id ? /*#__PURE__*/React.createElement("span", {
|
|
107
|
+
className: "ef-modelsel__check"
|
|
108
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
109
|
+
name: "check",
|
|
110
|
+
size: 14
|
|
111
|
+
})) : null)))) : null);
|
|
112
|
+
}
|
package/ai/Player.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface PlayerHandle {
|
|
2
|
+
jumpTo: (seconds: number) => void;
|
|
3
|
+
play: () => void;
|
|
4
|
+
pause: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface PlayerProps {
|
|
7
|
+
src?: string;
|
|
8
|
+
title?: React.ReactNode;
|
|
9
|
+
meta?: React.ReactNode;
|
|
10
|
+
/** Normalized 0–1 waveform peaks; deterministic placeholder bars if omitted */
|
|
11
|
+
peaks?: number[];
|
|
12
|
+
/** Bar count when peaks omitted. Default 72 */
|
|
13
|
+
samples?: number;
|
|
14
|
+
onTimeChange?: (seconds: number) => void;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const Player: React.ForwardRefExoticComponent<PlayerProps & React.RefAttributes<PlayerHandle>>;
|