@parallelworks/ui 0.18.0 → 0.19.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/README.md +86 -6
- package/dist/ai/adapter/memoryStore.d.ts +8 -0
- package/dist/ai/adapter/memoryStore.js +152 -0
- package/dist/ai/adapter/mock/index.d.ts +2 -0
- package/dist/ai/adapter/mock/index.js +3 -0
- package/dist/ai/adapter/mock/mockAdapter.d.ts +4 -0
- package/dist/ai/adapter/mock/mockAdapter.js +81 -0
- package/dist/ai/adapter/openai/createOpenAIStream.d.ts +9 -0
- package/dist/ai/adapter/openai/createOpenAIStream.js +33 -0
- package/dist/ai/adapter/openai/errors.d.ts +3 -0
- package/dist/ai/adapter/openai/errors.js +37 -0
- package/dist/ai/adapter/openai/index.d.ts +6 -0
- package/dist/ai/adapter/openai/index.js +6 -0
- package/dist/ai/adapter/openai/openaiAdapter.d.ts +9 -0
- package/dist/ai/adapter/openai/openaiAdapter.js +54 -0
- package/dist/ai/adapter/openai/responses.d.ts +4 -0
- package/dist/ai/adapter/openai/responses.js +108 -0
- package/dist/ai/adapter/openai/sse.d.ts +24 -0
- package/dist/ai/adapter/openai/sse.js +112 -0
- package/dist/ai/adapter/openai/wire.d.ts +40 -0
- package/dist/ai/adapter/types.d.ts +131 -0
- package/dist/ai/adapter/types.js +11 -0
- package/dist/ai/agent/classifier.d.ts +2 -0
- package/dist/ai/agent/classifier.js +12 -0
- package/dist/ai/agent/diff.d.ts +35 -0
- package/dist/ai/agent/diff.js +223 -0
- package/dist/ai/agent/diffHighlight.d.ts +6 -0
- package/dist/ai/agent/diffHighlight.js +101 -0
- package/dist/ai/agent/index.d.ts +6 -0
- package/dist/ai/agent/permissions.d.ts +11 -0
- package/dist/ai/agent/permissions.js +29 -0
- package/dist/ai/agent/toolfmt.d.ts +18 -0
- package/dist/ai/agent/toolfmt.js +383 -0
- package/dist/ai/agent/transcript.d.ts +38 -0
- package/dist/ai/agent/transcript.js +127 -0
- package/dist/ai/ai.css +325 -0
- package/dist/ai/components/AllocationSelector.d.ts +4 -0
- package/dist/ai/components/AllocationSelector.js +56 -0
- package/dist/ai/components/AttachmentManager.d.ts +1 -0
- package/dist/ai/components/AttachmentManager.js +144 -0
- package/dist/ai/components/AttachmentUpload.d.ts +24 -0
- package/dist/ai/components/AttachmentUpload.js +179 -0
- package/dist/ai/components/BlockedGroupBanner.d.ts +1 -0
- package/dist/ai/components/BlockedGroupBanner.js +29 -0
- package/dist/ai/components/BranchNavigator.d.ts +8 -0
- package/dist/ai/components/BranchNavigator.js +57 -0
- package/dist/ai/components/ChatEmptyState.d.ts +3 -0
- package/dist/ai/components/ChatEmptyState.js +171 -0
- package/dist/ai/components/ChatInput.d.ts +45 -0
- package/dist/ai/components/ChatInput.js +265 -0
- package/dist/ai/components/ChatLayout.d.ts +5 -0
- package/dist/ai/components/ChatLayout.js +15 -0
- package/dist/ai/components/ChatMessage.d.ts +24 -0
- package/dist/ai/components/ChatMessage.js +338 -0
- package/dist/ai/components/ChatMessageList.d.ts +35 -0
- package/dist/ai/components/ChatMessageList.js +301 -0
- package/dist/ai/components/ChatSidebar.d.ts +5 -0
- package/dist/ai/components/ChatSidebar.js +345 -0
- package/dist/ai/components/ChatThread.d.ts +3 -0
- package/dist/ai/components/ChatThread.js +198 -0
- package/dist/ai/components/ComposerChrome.d.ts +18 -0
- package/dist/ai/components/ComposerChrome.js +50 -0
- package/dist/ai/components/ComposerFrame.d.ts +16 -0
- package/dist/ai/components/ComposerFrame.js +33 -0
- package/dist/ai/components/DragOverlay.d.ts +5 -0
- package/dist/ai/components/DragOverlay.js +20 -0
- package/dist/ai/components/ModelSelector.d.ts +6 -0
- package/dist/ai/components/ModelSelector.js +343 -0
- package/dist/ai/components/ShareDialog.d.ts +11 -0
- package/dist/ai/components/ShareDialog.js +260 -0
- package/dist/ai/components/SlashMenu.d.ts +28 -0
- package/dist/ai/components/SlashMenu.js +91 -0
- package/dist/ai/components/agent/ActivityLine.d.ts +21 -0
- package/dist/ai/components/agent/ActivityLine.js +151 -0
- package/dist/ai/components/agent/AgentMessageParts.d.ts +54 -0
- package/dist/ai/components/agent/AgentMessageParts.js +721 -0
- package/dist/ai/components/agent/PermissionPicker.d.ts +11 -0
- package/dist/ai/components/agent/PermissionPicker.js +38 -0
- package/dist/ai/components/attachmentKeys.d.ts +4 -0
- package/dist/ai/components/attachmentKeys.js +10 -0
- package/dist/ai/core/ChatProvider.d.ts +66 -0
- package/dist/ai/core/ChatProvider.js +848 -0
- package/dist/ai/core/KeyboardShortcutsProvider.d.ts +5 -0
- package/dist/ai/core/KeyboardShortcutsProvider.js +9 -0
- package/dist/ai/core/chatReducer.d.ts +114 -0
- package/dist/ai/core/chatReducer.js +223 -0
- package/dist/ai/core/config.d.ts +47 -0
- package/dist/ai/core/config.js +45 -0
- package/dist/ai/core/events.d.ts +1 -0
- package/dist/ai/core/events.js +4 -0
- package/dist/ai/core/exportConversation.d.ts +4 -0
- package/dist/ai/core/exportConversation.js +42 -0
- package/dist/ai/core/greeting.d.ts +3 -0
- package/dist/ai/core/greeting.js +38 -0
- package/dist/ai/core/parts.d.ts +11 -0
- package/dist/ai/core/parts.js +84 -0
- package/dist/ai/core/useDragDrop.d.ts +14 -0
- package/dist/ai/core/useDragDrop.js +36 -0
- package/dist/ai/core/useKeyboardShortcuts.d.ts +12 -0
- package/dist/ai/core/useKeyboardShortcuts.js +77 -0
- package/dist/ai/core/useSSEStream.d.ts +34 -0
- package/dist/ai/core/useSSEStream.js +98 -0
- package/dist/ai/index.d.ts +40 -0
- package/dist/ai/index.js +44 -0
- package/dist/ai/strings.d.ts +167 -0
- package/dist/ai/strings.js +175 -0
- package/dist/ai/types.d.ts +236 -0
- package/dist/ai/ui/Avatar.d.ts +8 -0
- package/dist/ai/ui/Avatar.js +35 -0
- package/dist/ai/ui/Dropdown.d.ts +31 -0
- package/dist/ai/ui/Dropdown.js +110 -0
- package/dist/ai/ui/Markdown.d.ts +8 -0
- package/dist/ai/ui/Markdown.js +79 -0
- package/dist/ai/ui/Notice.d.ts +21 -0
- package/dist/ai/ui/Notice.js +77 -0
- package/dist/ai/ui/buttons.d.ts +1 -0
- package/dist/ai/ui/codeBreaks.d.ts +16 -0
- package/dist/ai/ui/codeBreaks.js +36 -0
- package/dist/ai/ui/prose.d.ts +1 -0
- package/dist/ai/ui/prose.js +13 -0
- package/dist/ai/ui/sidebar.d.ts +81 -0
- package/dist/ai/ui/sidebar.js +148 -0
- package/dist/ai/utils.d.ts +4 -0
- package/dist/ai/utils.js +23 -0
- package/dist/assets/{editor.worker-CuBRIwi-.js → editor.worker-BmHUIVG4.js} +194 -163
- package/dist/assets/{json.worker-8ytS02vz.js → json.worker-D8bJ92nw.js} +384 -338
- package/dist/assets/{yaml.worker-DJC-VUcv.js → yaml.worker-C4gyGAko.js} +15657 -13823
- package/dist/components/AddMenu.js +46 -0
- package/dist/components/Avatar.d.ts +1 -1
- package/dist/components/Avatar.js +46 -0
- package/dist/{chunks/BareModal-BtRiQezg.js → components/BareModal.js} +1 -1
- package/dist/components/Breadcrumbs.d.ts +1 -1
- package/dist/components/Breadcrumbs.js +83 -0
- package/dist/components/Button.js +83 -0
- package/dist/components/Callout.js +23 -0
- package/dist/components/Card.js +31 -0
- package/dist/components/CollapsiblePanel.js +77 -0
- package/dist/components/ConfirmModal.js +74 -0
- package/dist/components/CopyToClipboard.js +81 -0
- package/dist/{chunks/CreateModal-BY6DLmur.js → components/CreateModal.js} +10 -189
- package/dist/components/DescriptionList.js +42 -0
- package/dist/components/Dropdown.d.ts +1 -1
- package/dist/components/Dropdown.js +349 -0
- package/dist/components/EmptyState.d.ts +1 -1
- package/dist/components/EmptyState.js +27 -0
- package/dist/components/Filter.js +32 -0
- package/dist/components/FilterPill.js +13 -0
- package/dist/components/IconButton.js +34 -0
- package/dist/components/Indicator.d.ts +2 -2
- package/dist/{chunks/Indicator-hBSIxOPK.js → components/Indicator.js} +1 -1
- package/dist/components/Input.d.ts +1 -1
- package/dist/components/Input.js +88 -0
- package/dist/components/LetterBadge.d.ts +1 -1
- package/dist/components/LetterBadge.js +13 -0
- package/dist/components/Listbox.js +123 -0
- package/dist/{chunks/Loader-BXoXTZGc.js → components/Loader.js} +1 -1
- package/dist/components/Markdown.js +15 -0
- package/dist/components/MarkdownImpl.d.ts +1 -1
- package/dist/components/MultiSelect.js +171 -0
- package/dist/components/Overview.js +39 -0
- package/dist/components/PageHeader.js +194 -0
- package/dist/components/Pagination.js +35 -0
- package/dist/components/Provider.d.ts +16 -65
- package/dist/{chunks/Provider-Ghua9PkN.js → components/Provider.js} +54 -20
- package/dist/{chunks/RequiredMark-DfLdYbYZ.js → components/RequiredMark.js} +1 -1
- package/dist/components/SectionHeader.js +11 -0
- package/dist/components/SettingModeOption.js +30 -0
- package/dist/components/SettingRow.d.ts +1 -1
- package/dist/components/SettingRow.js +35 -0
- package/dist/components/SettingsCard.js +31 -0
- package/dist/components/SettingsGroup.d.ts +1 -1
- package/dist/components/SettingsGroup.js +17 -0
- package/dist/components/Sort.js +42 -0
- package/dist/components/StatusBadge.js +63 -0
- package/dist/components/SwitchToggle.js +59 -0
- package/dist/{chunks/SwitchToggleSmall-FcsaYSTs.js → components/SwitchToggleSmall.js} +1 -1
- package/dist/{chunks/Table-4OHjdKdO.js → components/Table.js} +7 -5
- package/dist/components/Toggle.js +20 -0
- package/dist/{chunks/Tooltip-Crxo_eU_.js → components/Tooltip.js} +6 -4
- package/dist/{chunks/StatusBadge-C1Blx_cW.js → components/dropdownUtils.js} +2 -63
- package/dist/components/focus.d.ts +2 -0
- package/dist/components/focus.js +7 -0
- package/dist/components/ghostButton.js +7 -0
- package/dist/components/inputClasses.js +4 -0
- package/dist/components/keys.d.ts +12 -0
- package/dist/components/keys.js +27 -0
- package/dist/components/relativeTime.js +32 -0
- package/dist/{chunks/useCssIsDark-DHr05dG2.js → components/useCssIsDark.js} +1 -1
- package/dist/duration.d.ts +3 -0
- package/dist/duration.js +17 -0
- package/dist/editor/Editor.js +13 -0
- package/dist/editor/EditorField.js +53 -0
- package/dist/editor/FormCodePanel.js +173 -0
- package/dist/editor/Monaco.d.ts +1 -20
- package/dist/editor/Monaco.js +112 -0
- package/dist/editor/index.d.ts +2 -1
- package/dist/editor/index.js +7 -2
- package/dist/editor/themes.js +91 -0
- package/dist/editor/workers.js +29 -0
- package/dist/editor/yaml.d.ts +5 -0
- package/dist/editor/yaml.js +15 -0
- package/dist/engine.d.ts +98 -0
- package/dist/file-explorer/FileExplorer.d.ts +11 -2
- package/dist/file-explorer/FileExplorer.js +1402 -0
- package/dist/file-explorer/FileExplorerContext.d.ts +1 -1
- package/dist/file-explorer/FileExplorerContext.js +370 -0
- package/dist/file-explorer/FilePreview/CodePreviewEditor.d.ts +1 -1
- package/dist/{chunks/CodePreviewEditor-4lx3kE-w.js → file-explorer/FilePreview/CodePreviewEditor.js} +3 -2
- package/dist/file-explorer/FilePreview/Inline.js +45 -0
- package/dist/file-explorer/FilePreview/StreamedBadge.js +16 -0
- package/dist/file-explorer/FilePreview/Viewer.js +526 -0
- package/dist/file-explorer/FilePreview/index.js +266 -0
- package/dist/file-explorer/FilePreview/parse.js +63 -0
- package/dist/file-explorer/FilePreview/previewCache.js +98 -0
- package/dist/file-explorer/FilePreview/previewType.d.ts +1 -1
- package/dist/file-explorer/FilePreview/previewType.js +151 -0
- package/dist/file-explorer/FilePreview/readCappedBytes.js +196 -0
- package/dist/file-explorer/FilePreview/useObjectBlobUrl.js +95 -0
- package/dist/file-explorer/FilePreview/useObjectText.js +109 -0
- package/dist/file-explorer/FilePreview/usePresignedUrl.js +73 -0
- package/dist/file-explorer/FileRow.d.ts +1 -1
- package/dist/file-explorer/FileRow.js +165 -0
- package/dist/file-explorer/FileRowsWindow.js +92 -0
- package/dist/file-explorer/FileTable.js +172 -0
- package/dist/file-explorer/FileTableHeaders.js +49 -0
- package/dist/file-explorer/LoadMoreRow.js +46 -0
- package/dist/file-explorer/TreeView.js +376 -0
- package/dist/file-explorer/helpers.d.ts +4 -4
- package/dist/file-explorer/helpers.js +537 -0
- package/dist/file-explorer/index.d.ts +3 -3
- package/dist/file-explorer/index.js +7 -5705
- package/dist/file-explorer/lib/batch.js +39 -0
- package/dist/file-explorer/lib/errors.js +9 -0
- package/dist/file-explorer/lib/paging.js +124 -0
- package/dist/file-explorer/lib/types.d.ts +6 -1
- package/dist/file-explorer/lib/utils.d.ts +1 -3
- package/dist/file-explorer/lib/utils.js +322 -0
- package/dist/file-explorer/toasts.js +400 -0
- package/dist/file-explorer/treeRows.js +73 -0
- package/dist/file-explorer/useNearEnd.d.ts +1 -1
- package/dist/file-explorer/useNearEnd.js +27 -0
- package/dist/form/FieldWrapper.d.ts +2 -2
- package/dist/form/FieldWrapper.js +54 -0
- package/dist/form/Fields/BooleanField.js +51 -0
- package/dist/form/Fields/CheckboxGroupField.js +72 -0
- package/dist/form/Fields/ColorField.js +33 -0
- package/dist/form/Fields/DropdownField.js +49 -0
- package/dist/form/Fields/DurationField.js +130 -0
- package/dist/form/Fields/LabelField.js +19 -0
- package/dist/form/Fields/MultiDropdownField.js +40 -0
- package/dist/form/Fields/NumberField.js +51 -0
- package/dist/form/Fields/ObjectField.js +54 -0
- package/dist/form/Fields/RadioField.js +49 -0
- package/dist/form/Fields/RangeField.js +58 -0
- package/dist/form/Fields/ResourceOptionIcon.d.ts +1 -1
- package/dist/form/Fields/ResourceOptionIcon.js +21 -0
- package/dist/form/Fields/StepField.js +6 -0
- package/dist/form/Fields/StringField.js +37 -0
- package/dist/form/Fields/TextAreaField.js +31 -0
- package/dist/form/Fields/durationValidity.js +11 -0
- package/dist/form/Form.d.ts +4 -21
- package/dist/form/Form.js +643 -0
- package/dist/form/SpecialTypes/DropdownWrapper.js +30 -0
- package/dist/form/SpecialTypes/FormikCustomDropdown.js +122 -0
- package/dist/form/SpecialTypes/FormikCustomInput.js +111 -0
- package/dist/form/SpecialTypes/FormikMultiSelectDropdown.js +31 -0
- package/dist/form/SpecialTypes/FormikNumericInput.js +60 -0
- package/dist/form/Wizard/WizardContainer.js +138 -0
- package/dist/form/Wizard/WizardNavigation.js +92 -0
- package/dist/form/Wizard/WizardStepContent.js +35 -0
- package/dist/form/Wizard/WizardStepIndicator.js +108 -0
- package/dist/form/Wizard/useWizardState.js +118 -0
- package/dist/form/Wizard/utils.js +34 -0
- package/dist/form/fieldContext.js +26 -0
- package/dist/form/fieldRegistry.js +50 -0
- package/dist/form/index.d.ts +11 -12
- package/dist/form/index.js +18 -2445
- package/dist/form/lib.d.ts +6 -1
- package/dist/{chunks/FieldWrapper-Bef01EWO.js → form/lib.js} +5 -104
- package/dist/form/types/fieldComponentTypes.d.ts +3 -2
- package/dist/form/types/fieldTypes.d.ts +6 -20
- package/dist/form/useParsedOpts.d.ts +1 -1
- package/dist/form/useParsedOpts.js +62 -0
- package/dist/form/usePrevious.js +11 -0
- package/dist/form/utils/checkShowIfObject.js +14 -0
- package/dist/form/utils/{slurmDuration.d.ts → duration.d.ts} +2 -2
- package/dist/form/utils/duration.js +69 -0
- package/dist/form/utils/getParentValue.js +23 -0
- package/dist/form/utils/getPlaceholder.js +9 -0
- package/dist/form/utils/getValueUsingPath.js +23 -0
- package/dist/form/utils/secondaryField.js +22 -0
- package/dist/graph/AnnotationBanner.js +141 -0
- package/dist/graph/Collapse.js +41 -0
- package/dist/{workflow/index.js → graph/DependencyGraph.js} +76 -1163
- package/dist/graph/JobSummary.js +104 -0
- package/dist/{workflow → graph}/MatrixGroup.d.ts +2 -2
- package/dist/graph/MatrixGroup.js +107 -0
- package/dist/graph/Reveal.js +57 -0
- package/dist/graph/TreeView.js +711 -0
- package/dist/{workflow → graph}/index.d.ts +1 -1
- package/dist/graph/index.js +2 -0
- package/dist/{workflow → graph}/types.d.ts +3 -3
- package/dist/graph/types.js +6 -0
- package/dist/icons.d.ts +20 -21
- package/dist/index.d.ts +38 -40
- package/dist/index.js +47 -599
- package/dist/list/ActionToolbar.js +184 -0
- package/dist/list/HoverCard.js +73 -0
- package/dist/list/ListPage.js +145 -0
- package/dist/list/ListPager.js +59 -0
- package/dist/list/ListTable.d.ts +1 -1
- package/dist/list/ListTable.js +163 -0
- package/dist/list/ListViewControls.d.ts +2 -2
- package/dist/list/ListViewControls.js +372 -0
- package/dist/list/RowContextMenu.js +350 -0
- package/dist/list/UserHoverCard.js +117 -0
- package/dist/list/index.d.ts +9 -9
- package/dist/list/index.js +11 -2
- package/dist/list/listSearch.js +137 -0
- package/dist/list/listView.js +210 -0
- package/dist/list/textEntry.js +10 -0
- package/dist/logviewer/LogViewer.d.ts +1 -1
- package/dist/logviewer/LogViewer.js +750 -0
- package/dist/logviewer/index.d.ts +1 -0
- package/dist/logviewer/index.js +3 -742
- package/dist/logviewer/segments.d.ts +9 -0
- package/dist/logviewer/segments.js +80 -0
- package/dist/styles/fonts.css +4 -4
- package/dist/styles/theme.css +6 -4
- package/dist/styles.css +1 -1
- package/dist/theme/index.js +2 -2
- package/package.json +38 -14
- package/LICENSE +0 -202
- package/dist/chunks/Monaco-C1POOdVv.js +0 -1046
- package/dist/chunks/PageHeader-l49p1nM9.js +0 -690
- package/dist/chunks/SwitchToggle-CHPP8uZQ.js +0 -755
- package/dist/chunks/editor-9_uVtUyy.js +0 -347
- package/dist/chunks/list-qrojZZNv.js +0 -1411
- package/dist/editor/usesGitlab.d.ts +0 -97
- package/dist/form/Fields/BucketReadOnlyField.d.ts +0 -7
- package/dist/form/types/workflow-schema.d.ts +0 -1145
- package/dist/form/utils/pwResolver.d.ts +0 -18
- package/dist/{chunks/MarkdownImpl-Bq4QhrtA.js → components/MarkdownImpl.js} +1 -1
- /package/dist/{workflow → graph}/AnnotationBanner.d.ts +0 -0
- /package/dist/{workflow → graph}/Collapse.d.ts +0 -0
- /package/dist/{workflow → graph}/DependencyGraph.d.ts +0 -0
- /package/dist/{workflow → graph}/JobSummary.d.ts +0 -0
- /package/dist/{workflow → graph}/Reveal.d.ts +0 -0
- /package/dist/{workflow → graph}/TreeView.d.ts +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type NoticeTone = 'neutral' | 'info' | 'warning' | 'danger';
|
|
3
|
+
/** A standing condition on the surface: a full-width bar under the header
|
|
4
|
+
* with a title, an explanation, and the one thing the reader can do about it. */
|
|
5
|
+
export declare function NoticeBar({ tone, title, children, action, onAction, testId, }: {
|
|
6
|
+
tone: NoticeTone;
|
|
7
|
+
title: string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
action?: string;
|
|
10
|
+
onAction?: () => void;
|
|
11
|
+
testId?: string;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
/** An inline notice next to the composer. One with no dismiss states a fact
|
|
14
|
+
* that is still true; one with a dismiss is a message the reader can put away. */
|
|
15
|
+
export declare function NoticeCard({ tone, children, onDismiss, dismissLabel, testId, }: {
|
|
16
|
+
tone?: NoticeTone;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
onDismiss?: () => void;
|
|
19
|
+
dismissLabel?: string;
|
|
20
|
+
testId?: string;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AlertCircleIcon, CloseIcon, InfoCircleIcon } from "../../icons.js";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/ai/ui/Notice.tsx
|
|
5
|
+
var barTone = {
|
|
6
|
+
neutral: "theme-border theme-muted-panel",
|
|
7
|
+
info: "border-blue-500/30 bg-blue-500/10",
|
|
8
|
+
warning: "border-amber-500/40 bg-amber-500/10",
|
|
9
|
+
danger: "border-red-500/30 bg-red-500/10"
|
|
10
|
+
};
|
|
11
|
+
var iconTone = {
|
|
12
|
+
neutral: "theme-muted-text",
|
|
13
|
+
info: "text-blue-600 dark:text-blue-400",
|
|
14
|
+
warning: "text-amber-600 dark:text-amber-400",
|
|
15
|
+
danger: "text-red-600 dark:text-red-400"
|
|
16
|
+
};
|
|
17
|
+
var titleTone = {
|
|
18
|
+
neutral: "theme-text",
|
|
19
|
+
info: "text-blue-700 dark:text-blue-300",
|
|
20
|
+
warning: "text-amber-700 dark:text-amber-300",
|
|
21
|
+
danger: "text-red-700 dark:text-red-300"
|
|
22
|
+
};
|
|
23
|
+
var cardTone = {
|
|
24
|
+
neutral: "theme-border theme-muted-panel theme-muted-text",
|
|
25
|
+
info: "border-blue-500/40 bg-blue-500/10 text-blue-800 dark:text-blue-200",
|
|
26
|
+
warning: "border-amber-500/40 bg-amber-500/10 text-amber-800 dark:text-amber-200",
|
|
27
|
+
danger: "border-red-500/40 bg-red-500/10 text-red-700 dark:text-red-300"
|
|
28
|
+
};
|
|
29
|
+
/** A standing condition on the surface: a full-width bar under the header
|
|
30
|
+
* with a title, an explanation, and the one thing the reader can do about it. */
|
|
31
|
+
function NoticeBar({ tone, title, children, action, onAction, testId }) {
|
|
32
|
+
const Icon = tone === "danger" || tone === "warning" ? AlertCircleIcon : InfoCircleIcon;
|
|
33
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
34
|
+
"data-testid": testId,
|
|
35
|
+
className: cx("flex shrink-0 items-start gap-3 border-b px-6 py-3", barTone[tone]),
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsx(Icon, { className: cx("mt-0.5 h-4 w-4 shrink-0", iconTone[tone]) }),
|
|
38
|
+
/* @__PURE__ */ jsxs("div", {
|
|
39
|
+
className: "min-w-0 flex-1",
|
|
40
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
41
|
+
className: cx("text-sm font-medium", titleTone[tone]),
|
|
42
|
+
children: title
|
|
43
|
+
}), children && /* @__PURE__ */ jsx("p", {
|
|
44
|
+
className: "mt-0.5 text-xs theme-muted-text",
|
|
45
|
+
children
|
|
46
|
+
})]
|
|
47
|
+
}),
|
|
48
|
+
action && onAction && /* @__PURE__ */ jsx("button", {
|
|
49
|
+
type: "button",
|
|
50
|
+
onClick: onAction,
|
|
51
|
+
className: "shrink-0 rounded-lg border theme-border bg-(--theme-panel-bg) px-3 py-1.5 text-xs theme-text hover:theme-hover",
|
|
52
|
+
children: action
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/** An inline notice next to the composer. One with no dismiss states a fact
|
|
58
|
+
* that is still true; one with a dismiss is a message the reader can put away. */
|
|
59
|
+
function NoticeCard({ tone = "neutral", children, onDismiss, dismissLabel, testId }) {
|
|
60
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
61
|
+
"data-testid": testId,
|
|
62
|
+
className: cx("flex items-start gap-2 rounded-lg border px-3 py-2 text-xs", cardTone[tone]),
|
|
63
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
64
|
+
className: "flex-1",
|
|
65
|
+
children
|
|
66
|
+
}), onDismiss && /* @__PURE__ */ jsx("button", {
|
|
67
|
+
type: "button",
|
|
68
|
+
onClick: onDismiss,
|
|
69
|
+
"aria-label": dismissLabel,
|
|
70
|
+
title: dismissLabel,
|
|
71
|
+
className: "shrink-0 rounded p-0.5 hover:theme-hover",
|
|
72
|
+
children: /* @__PURE__ */ jsx(CloseIcon, { className: "h-3 w-3" })
|
|
73
|
+
})]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { NoticeBar, NoticeCard };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ghostButtonClasses = "inline-flex items-center gap-1.5 h-8 px-3 rounded-md text-sm text-(--theme-muted-text-color,#6c757d) hover:text-(--theme-app,#000000) hover:bg-(--theme-hover,#f3f4f6) transition-colors";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface HastText {
|
|
2
|
+
type: 'text';
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
interface HastElement {
|
|
6
|
+
type: 'element';
|
|
7
|
+
tagName: string;
|
|
8
|
+
properties?: Record<string, unknown>;
|
|
9
|
+
children: HastNode[];
|
|
10
|
+
}
|
|
11
|
+
type HastNode = HastText | HastElement | {
|
|
12
|
+
type: string;
|
|
13
|
+
children?: HastNode[];
|
|
14
|
+
};
|
|
15
|
+
export declare function rehypeCodeBreaks(): (tree: HastNode) => void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/ai/ui/codeBreaks.ts
|
|
2
|
+
var BREAK_AFTER = /(?<=[/])/;
|
|
3
|
+
function withBreaks(text) {
|
|
4
|
+
const pieces = text.split(BREAK_AFTER);
|
|
5
|
+
const out = [];
|
|
6
|
+
pieces.forEach((piece, i) => {
|
|
7
|
+
if (i > 0) out.push({
|
|
8
|
+
type: "element",
|
|
9
|
+
tagName: "wbr",
|
|
10
|
+
properties: {},
|
|
11
|
+
children: []
|
|
12
|
+
});
|
|
13
|
+
if (piece !== "") out.push({
|
|
14
|
+
type: "text",
|
|
15
|
+
value: piece
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
20
|
+
function walk(node, insidePre) {
|
|
21
|
+
if (!("children" in node) || !node.children) return;
|
|
22
|
+
const el = node;
|
|
23
|
+
const pre = insidePre || node.type === "element" && el.tagName === "pre";
|
|
24
|
+
if (node.type === "element" && el.tagName === "code" && !pre) {
|
|
25
|
+
el.children = el.children.flatMap((child) => child.type === "text" ? withBreaks(child.value) : [child]);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
for (const child of node.children) walk(child, pre);
|
|
29
|
+
}
|
|
30
|
+
function rehypeCodeBreaks() {
|
|
31
|
+
return (tree) => {
|
|
32
|
+
walk(tree, false);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { rehypeCodeBreaks };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const chatProseClasses: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/ai/ui/prose.ts
|
|
2
|
+
var chatProseClasses = [
|
|
3
|
+
"chat-ink prose max-w-none leading-relaxed",
|
|
4
|
+
"prose-p:my-3 prose-p:leading-relaxed",
|
|
5
|
+
"prose-headings:font-semibold prose-headings:mt-4 prose-headings:mb-1",
|
|
6
|
+
"prose-h1:text-xl prose-h2:text-lg prose-h3:text-[1rem] prose-h4:text-[1rem]",
|
|
7
|
+
"prose-ul:my-3 prose-ol:my-3 prose-li:my-0.5 prose-li:leading-relaxed",
|
|
8
|
+
"[&_li>p]:my-0.5 [&_li>p:first-child]:mt-0 [&_li>p:last-child]:mb-0",
|
|
9
|
+
"prose-strong:font-semibold prose-pre:my-0 prose-table:my-0",
|
|
10
|
+
"[&>.markdown>*:first-child]:mt-0 [&>.markdown>*:last-child]:mb-0"
|
|
11
|
+
].join(" ");
|
|
12
|
+
//#endregion
|
|
13
|
+
export { chatProseClasses };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { type OpenMenu, type RowMenuItem } from '../../list/index.js';
|
|
3
|
+
export declare const SIDEBAR_RAIL_WIDTH_PX = 48;
|
|
4
|
+
export declare const SIDEBAR_DEFAULT_WIDTH_PX = 256;
|
|
5
|
+
/** The column a conversation list lives in: it animates between its width
|
|
6
|
+
* and a rail, unless a drag is setting the width right now. */
|
|
7
|
+
export declare function SidebarPanel({ collapsed, width, railWidth, resizing, label, className, style, children, }: {
|
|
8
|
+
collapsed: boolean;
|
|
9
|
+
width?: number;
|
|
10
|
+
railWidth?: number;
|
|
11
|
+
resizing?: boolean;
|
|
12
|
+
label?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: CSSProperties;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
export declare function SidebarToggle({ collapsed, onToggle, openLabel, closeLabel, className, }: {
|
|
18
|
+
collapsed: boolean;
|
|
19
|
+
onToggle: () => void;
|
|
20
|
+
openLabel: string;
|
|
21
|
+
closeLabel: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
export declare function SidebarGroupHeading({ children, tone, testId, }: {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
/** 'attention' is for the group the reader is being asked to act on. */
|
|
27
|
+
tone?: 'default' | 'attention';
|
|
28
|
+
testId?: string;
|
|
29
|
+
}): import("react").JSX.Element;
|
|
30
|
+
/** One entry in the list: the row highlights while it is the open one or
|
|
31
|
+
* while its menu is up, and the menu opens from its button or a right-click. */
|
|
32
|
+
export declare function SidebarRow({ selected, menuItems, openMenu, className, children, }: {
|
|
33
|
+
selected: boolean;
|
|
34
|
+
menuItems: RowMenuItem[];
|
|
35
|
+
openMenu: OpenMenu;
|
|
36
|
+
className?: string;
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
}): import("react").JSX.Element;
|
|
39
|
+
/** One entry in the collapsed rail: a square the size of the toggle, with the
|
|
40
|
+
* same highlight as a row, holding whatever stands in for the item. */
|
|
41
|
+
export declare function SidebarRailItem({ selected, label, onSelect, testId, tooltipProps, children, }: {
|
|
42
|
+
selected: boolean;
|
|
43
|
+
label: string;
|
|
44
|
+
onSelect: () => void;
|
|
45
|
+
testId?: string;
|
|
46
|
+
tooltipProps?: Record<string, string>;
|
|
47
|
+
children: ReactNode;
|
|
48
|
+
}): import("react").JSX.Element;
|
|
49
|
+
export declare function RenameDialog({ open, title, label, placeholder, confirmLabel, value, onChange, onConfirm, onClose, }: {
|
|
50
|
+
open: boolean;
|
|
51
|
+
title: string;
|
|
52
|
+
label: string;
|
|
53
|
+
placeholder: string;
|
|
54
|
+
confirmLabel: string;
|
|
55
|
+
value: string;
|
|
56
|
+
onChange: (value: string) => void;
|
|
57
|
+
onConfirm: () => void;
|
|
58
|
+
onClose: () => void;
|
|
59
|
+
}): import("react").JSX.Element;
|
|
60
|
+
export interface RowDialogStrings<T> {
|
|
61
|
+
deleteTitle: string;
|
|
62
|
+
deleteBody: (item: T) => ReactNode;
|
|
63
|
+
deleteAction: string;
|
|
64
|
+
renameTitle: string;
|
|
65
|
+
renameLabel: string;
|
|
66
|
+
renamePlaceholder: string;
|
|
67
|
+
renameAction: string;
|
|
68
|
+
}
|
|
69
|
+
/** The delete confirmation and rename dialog every list of rows needs, with
|
|
70
|
+
* the item they are about. A handler that returns false keeps its dialog
|
|
71
|
+
* open, for a refusal the reader should see before trying again. */
|
|
72
|
+
export declare function useRowDialogs<T>({ strings, nameOf, onDelete, onRename, }: {
|
|
73
|
+
strings: RowDialogStrings<T>;
|
|
74
|
+
nameOf: (item: T) => string;
|
|
75
|
+
onDelete: (item: T) => Promise<boolean | undefined> | boolean | undefined;
|
|
76
|
+
onRename: (item: T, name: string) => Promise<boolean | undefined> | boolean | undefined;
|
|
77
|
+
}): {
|
|
78
|
+
requestDelete: (item: T) => void;
|
|
79
|
+
requestRename: (item: T) => void;
|
|
80
|
+
dialogs: ReactNode;
|
|
81
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { SidebarIcon } from "../../icons.js";
|
|
2
|
+
import { ConfirmModal } from "../../components/ConfirmModal.js";
|
|
3
|
+
import { focusOnMount } from "../../components/focus.js";
|
|
4
|
+
import { MoreButton, rowContextMenuProps, useRowMenuActive } from "../../list/RowContextMenu.js";
|
|
5
|
+
import cx from "classnames";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
var HIGHLIGHT_SELECTED = "bg-[color-mix(in_oklab,var(--theme-panel)_8%,transparent)]";
|
|
9
|
+
var HIGHLIGHT_HOVER = "hover:bg-[color-mix(in_oklab,var(--theme-panel)_5%,transparent)]";
|
|
10
|
+
/** The column a conversation list lives in: it animates between its width
|
|
11
|
+
* and a rail, unless a drag is setting the width right now. */
|
|
12
|
+
function SidebarPanel({ collapsed, width = 256, railWidth = 48, resizing = false, label, className, style, children }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("aside", {
|
|
14
|
+
"aria-label": label,
|
|
15
|
+
className: cx("relative h-full flex shrink-0 flex-col bg-(--theme-muted-panel-bg) overflow-hidden", !resizing && "transition-[width] duration-300 ease-in-out", className),
|
|
16
|
+
style: {
|
|
17
|
+
width: collapsed ? railWidth : width,
|
|
18
|
+
...style
|
|
19
|
+
},
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function SidebarToggle({ collapsed, onToggle, openLabel, closeLabel, className }) {
|
|
24
|
+
const label = collapsed ? openLabel : closeLabel;
|
|
25
|
+
return /* @__PURE__ */ jsx("button", {
|
|
26
|
+
type: "button",
|
|
27
|
+
onClick: onToggle,
|
|
28
|
+
title: label,
|
|
29
|
+
"aria-label": label,
|
|
30
|
+
"aria-expanded": !collapsed,
|
|
31
|
+
className: cx("flex h-7 w-7 items-center justify-center rounded-md theme-muted-text transition-colors hover:theme-muted-panel hover:theme-text", className),
|
|
32
|
+
children: /* @__PURE__ */ jsx(SidebarIcon, { className: "h-4 w-4" })
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function SidebarGroupHeading({ children, tone = "default", testId }) {
|
|
36
|
+
return /* @__PURE__ */ jsx("h4", {
|
|
37
|
+
"data-testid": testId,
|
|
38
|
+
className: cx("mt-4 mb-1 whitespace-nowrap px-2 text-xs font-medium", tone === "attention" ? "text-amber-700 dark:text-amber-300" : "theme-muted-text"),
|
|
39
|
+
children
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/** One entry in the list: the row highlights while it is the open one or
|
|
43
|
+
* while its menu is up, and the menu opens from its button or a right-click. */
|
|
44
|
+
function SidebarRow({ selected, menuItems, openMenu, className, children }) {
|
|
45
|
+
const { active, openMenu: openRowMenu } = useRowMenuActive(openMenu);
|
|
46
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
47
|
+
className: cx("group relative flex items-center justify-between rounded-lg px-2 py-1 transition-colors duration-150", selected || active ? HIGHLIGHT_SELECTED : HIGHLIGHT_HOVER, className),
|
|
48
|
+
...rowContextMenuProps(openRowMenu, menuItems),
|
|
49
|
+
children: [children, /* @__PURE__ */ jsx(MoreButton, {
|
|
50
|
+
active,
|
|
51
|
+
onOpen: (x, y) => openRowMenu(x, y, menuItems)
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/** One entry in the collapsed rail: a square the size of the toggle, with the
|
|
56
|
+
* same highlight as a row, holding whatever stands in for the item. */
|
|
57
|
+
function SidebarRailItem({ selected, label, onSelect, testId, tooltipProps, children }) {
|
|
58
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("button", {
|
|
59
|
+
type: "button",
|
|
60
|
+
"data-testid": testId,
|
|
61
|
+
"aria-label": label,
|
|
62
|
+
"aria-current": selected ? "page" : void 0,
|
|
63
|
+
onClick: onSelect,
|
|
64
|
+
...tooltipProps,
|
|
65
|
+
className: cx("flex h-7 w-7 items-center justify-center rounded-md transition-colors", HIGHLIGHT_HOVER, selected && HIGHLIGHT_SELECTED),
|
|
66
|
+
children
|
|
67
|
+
}) });
|
|
68
|
+
}
|
|
69
|
+
function RenameDialog({ open, title, label, placeholder, confirmLabel, value, onChange, onConfirm, onClose }) {
|
|
70
|
+
return /* @__PURE__ */ jsx(ConfirmModal, {
|
|
71
|
+
open,
|
|
72
|
+
onClose,
|
|
73
|
+
align: "center",
|
|
74
|
+
closeOnConfirm: false,
|
|
75
|
+
title,
|
|
76
|
+
confirmLabel,
|
|
77
|
+
confirmDisabled: !value.trim(),
|
|
78
|
+
onConfirm,
|
|
79
|
+
children: /* @__PURE__ */ jsxs("label", {
|
|
80
|
+
className: "block space-y-2",
|
|
81
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
82
|
+
className: "text-sm font-medium theme-text",
|
|
83
|
+
children: label
|
|
84
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
85
|
+
type: "text",
|
|
86
|
+
value,
|
|
87
|
+
onChange: (e) => onChange(e.target.value),
|
|
88
|
+
onKeyDown: (e) => {
|
|
89
|
+
if (e.key === "Enter" && value.trim()) onConfirm();
|
|
90
|
+
},
|
|
91
|
+
placeholder,
|
|
92
|
+
ref: focusOnMount,
|
|
93
|
+
className: "w-full rounded-md border theme-border bg-(--theme-input-bg) px-3 py-2 text-sm theme-text placeholder:theme-muted-text focus:border-(--theme-element) focus:outline-none"
|
|
94
|
+
})]
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** The delete confirmation and rename dialog every list of rows needs, with
|
|
99
|
+
* the item they are about. A handler that returns false keeps its dialog
|
|
100
|
+
* open, for a refusal the reader should see before trying again. */
|
|
101
|
+
function useRowDialogs({ strings, nameOf, onDelete, onRename }) {
|
|
102
|
+
const [toDelete, setToDelete] = useState(null);
|
|
103
|
+
const [toRename, setToRename] = useState(null);
|
|
104
|
+
const [name, setName] = useState("");
|
|
105
|
+
const closeRename = () => {
|
|
106
|
+
setToRename(null);
|
|
107
|
+
setName("");
|
|
108
|
+
};
|
|
109
|
+
const confirmDelete = async () => {
|
|
110
|
+
if (toDelete === null) return;
|
|
111
|
+
if (await onDelete(toDelete) !== false) setToDelete(null);
|
|
112
|
+
};
|
|
113
|
+
const confirmRename = async () => {
|
|
114
|
+
const trimmed = name.trim();
|
|
115
|
+
if (toRename === null || !trimmed) return;
|
|
116
|
+
if (await onRename(toRename, trimmed) !== false) closeRename();
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
requestDelete: setToDelete,
|
|
120
|
+
requestRename: (item) => {
|
|
121
|
+
setName(nameOf(item));
|
|
122
|
+
setToRename(item);
|
|
123
|
+
},
|
|
124
|
+
dialogs: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ConfirmModal, {
|
|
125
|
+
open: toDelete !== null,
|
|
126
|
+
onClose: () => setToDelete(null),
|
|
127
|
+
align: "center",
|
|
128
|
+
destructive: true,
|
|
129
|
+
closeOnConfirm: false,
|
|
130
|
+
title: strings.deleteTitle,
|
|
131
|
+
description: toDelete === null ? null : strings.deleteBody(toDelete),
|
|
132
|
+
confirmLabel: strings.deleteAction,
|
|
133
|
+
onConfirm: confirmDelete
|
|
134
|
+
}), /* @__PURE__ */ jsx(RenameDialog, {
|
|
135
|
+
open: toRename !== null,
|
|
136
|
+
onClose: closeRename,
|
|
137
|
+
title: strings.renameTitle,
|
|
138
|
+
label: strings.renameLabel,
|
|
139
|
+
placeholder: strings.renamePlaceholder,
|
|
140
|
+
confirmLabel: strings.renameAction,
|
|
141
|
+
value: name,
|
|
142
|
+
onChange: setName,
|
|
143
|
+
onConfirm: confirmRename
|
|
144
|
+
})] })
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
export { RenameDialog, SidebarGroupHeading, SidebarPanel, SidebarRailItem, SidebarRow, SidebarToggle, useRowDialogs };
|
package/dist/ai/utils.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/ai/utils.ts
|
|
2
|
+
function formatFileSize(bytes) {
|
|
3
|
+
if (bytes === 0) return "0 B";
|
|
4
|
+
const k = 1024;
|
|
5
|
+
const sizes = [
|
|
6
|
+
"B",
|
|
7
|
+
"KB",
|
|
8
|
+
"MB",
|
|
9
|
+
"GB",
|
|
10
|
+
"TB"
|
|
11
|
+
];
|
|
12
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
13
|
+
return Number.parseFloat((bytes / k ** i).toFixed(2)) + " " + sizes[i];
|
|
14
|
+
}
|
|
15
|
+
function isMac() {
|
|
16
|
+
return navigator.platform.toUpperCase().includes("MAC");
|
|
17
|
+
}
|
|
18
|
+
/** Only org models bill to an allocation; any other model ignores it. */
|
|
19
|
+
function isOrgModel(modelId) {
|
|
20
|
+
return modelId?.startsWith("org:") ?? false;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { formatFileSize, isMac, isOrgModel };
|