diff --git a/apps/yaak-client/components/BinaryFileEditor.tsx b/apps/yaak-client/components/BinaryFileEditor.tsx index 29be9679..7069249c 100644 --- a/apps/yaak-client/components/BinaryFileEditor.tsx +++ b/apps/yaak-client/components/BinaryFileEditor.tsx @@ -1,9 +1,8 @@ import type { HttpRequest } from '@yaakapp-internal/models'; +import { Banner, HStack, InlineCode, VStack } from '@yaakapp-internal/ui'; import mime from 'mime'; import { useKeyValue } from '../hooks/useKeyValue'; -import { Banner, InlineCode } from '@yaakapp-internal/ui'; import { Button } from './core/Button'; -import { HStack, VStack } from './core/Stacks'; import { SelectFile } from './SelectFile'; type Props = { diff --git a/apps/yaak-client/components/CloneGitRepositoryDialog.tsx b/apps/yaak-client/components/CloneGitRepositoryDialog.tsx index 7b8d2fda..f43e3ff3 100644 --- a/apps/yaak-client/components/CloneGitRepositoryDialog.tsx +++ b/apps/yaak-client/components/CloneGitRepositoryDialog.tsx @@ -1,15 +1,14 @@ import { open } from '@tauri-apps/plugin-dialog'; import { gitClone } from '@yaakapp-internal/git'; +import { Banner, VStack } from '@yaakapp-internal/ui'; import { useState } from 'react'; import { openWorkspaceFromSyncDir } from '../commands/openWorkspaceFromSyncDir'; import { appInfo } from '../lib/appInfo'; import { showErrorToast } from '../lib/toast'; -import { Banner } from '@yaakapp-internal/ui'; import { Button } from './core/Button'; import { Checkbox } from './core/Checkbox'; import { IconButton } from './core/IconButton'; import { PlainInput } from './core/PlainInput'; -import { VStack } from './core/Stacks'; import { promptCredentials } from './git/credentials'; interface Props { diff --git a/apps/yaak-client/components/CommandPaletteDialog.tsx b/apps/yaak-client/components/CommandPaletteDialog.tsx index d8b2239f..dced21ce 100644 --- a/apps/yaak-client/components/CommandPaletteDialog.tsx +++ b/apps/yaak-client/components/CommandPaletteDialog.tsx @@ -1,4 +1,5 @@ import { workspacesAtom } from '@yaakapp-internal/models'; +import { Heading, Icon, useDebouncedState } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { fuzzyFilter } from 'fuzzbunny'; import { useAtomValue } from 'jotai'; @@ -21,7 +22,6 @@ import { useActiveRequest } from '../hooks/useActiveRequest'; import { activeWorkspaceIdAtom } from '../hooks/useActiveWorkspace'; import { useAllRequests } from '../hooks/useAllRequests'; import { useCreateWorkspace } from '../hooks/useCreateWorkspace'; -import { Icon, useDebouncedState } from '@yaakapp-internal/ui'; import { useEnvironmentsBreakdown } from '../hooks/useEnvironmentsBreakdown'; import { useGrpcRequestActions } from '../hooks/useGrpcRequestActions'; import type { HotkeyAction } from '../hooks/useHotKey'; @@ -47,7 +47,6 @@ import { router } from '../lib/router'; import { setWorkspaceSearchParams } from '../lib/setWorkspaceSearchParams'; import { CookieDialog } from './CookieDialog'; import { Button } from './core/Button'; -import { Heading } from './core/Heading'; import { Hotkey } from './core/Hotkey'; import { HttpMethodTag } from './core/HttpMethodTag'; import { PlainInput } from './core/PlainInput'; diff --git a/apps/yaak-client/components/ConfirmLargeRequestBody.tsx b/apps/yaak-client/components/ConfirmLargeRequestBody.tsx index 4f797977..443b35f8 100644 --- a/apps/yaak-client/components/ConfirmLargeRequestBody.tsx +++ b/apps/yaak-client/components/ConfirmLargeRequestBody.tsx @@ -1,13 +1,12 @@ import type { HttpRequest } from '@yaakapp-internal/models'; import { patchModel } from '@yaakapp-internal/models'; +import { Banner, HStack, InlineCode } from '@yaakapp-internal/ui'; import type { ReactNode } from 'react'; import { useToggle } from '../hooks/useToggle'; import { showConfirm } from '../lib/confirm'; -import { Banner, InlineCode } from '@yaakapp-internal/ui'; import { Button } from './core/Button'; import { Link } from './core/Link'; import { SizeTag } from './core/SizeTag'; -import { HStack } from './core/Stacks'; interface Props { children: ReactNode; diff --git a/apps/yaak-client/components/ConfirmLargeResponse.tsx b/apps/yaak-client/components/ConfirmLargeResponse.tsx index 682bd562..59e1d8a5 100644 --- a/apps/yaak-client/components/ConfirmLargeResponse.tsx +++ b/apps/yaak-client/components/ConfirmLargeResponse.tsx @@ -1,4 +1,5 @@ import type { HttpResponse } from '@yaakapp-internal/models'; +import { Banner, HStack, InlineCode } from '@yaakapp-internal/ui'; import { type ReactNode, useMemo } from 'react'; import { useSaveResponse } from '../hooks/useSaveResponse'; import { useToggle } from '../hooks/useToggle'; @@ -6,10 +7,8 @@ import { isProbablyTextContentType } from '../lib/contentType'; import { getContentTypeFromHeaders } from '../lib/model_util'; import { getResponseBodyText } from '../lib/responseBody'; import { CopyButton } from './CopyButton'; -import { Banner, InlineCode } from '@yaakapp-internal/ui'; import { Button } from './core/Button'; import { SizeTag } from './core/SizeTag'; -import { HStack } from './core/Stacks'; interface Props { children: ReactNode; diff --git a/apps/yaak-client/components/ConfirmLargeResponseRequest.tsx b/apps/yaak-client/components/ConfirmLargeResponseRequest.tsx index bba66b72..eed0208f 100644 --- a/apps/yaak-client/components/ConfirmLargeResponseRequest.tsx +++ b/apps/yaak-client/components/ConfirmLargeResponseRequest.tsx @@ -1,14 +1,13 @@ import type { HttpResponse } from '@yaakapp-internal/models'; +import { Banner, HStack, InlineCode } from '@yaakapp-internal/ui'; import { type ReactNode, useMemo } from 'react'; import { getRequestBodyText as getHttpResponseRequestBodyText } from '../hooks/useHttpRequestBody'; import { useToggle } from '../hooks/useToggle'; import { isProbablyTextContentType } from '../lib/contentType'; import { getContentTypeFromHeaders } from '../lib/model_util'; import { CopyButton } from './CopyButton'; -import { Banner, InlineCode } from '@yaakapp-internal/ui'; import { Button } from './core/Button'; import { SizeTag } from './core/SizeTag'; -import { HStack } from './core/Stacks'; interface Props { children: ReactNode; diff --git a/apps/yaak-client/components/CreateWorkspaceDialog.tsx b/apps/yaak-client/components/CreateWorkspaceDialog.tsx index 0076412d..f91c007a 100644 --- a/apps/yaak-client/components/CreateWorkspaceDialog.tsx +++ b/apps/yaak-client/components/CreateWorkspaceDialog.tsx @@ -1,6 +1,7 @@ import { gitMutations } from '@yaakapp-internal/git'; import type { WorkspaceMeta } from '@yaakapp-internal/models'; import { createGlobalModel, updateModel } from '@yaakapp-internal/models'; +import { VStack } from '@yaakapp-internal/ui'; import { useState } from 'react'; import { router } from '../lib/router'; import { setupOrConfigureEncryption } from '../lib/setupOrConfigureEncryption'; @@ -10,7 +11,6 @@ import { Button } from './core/Button'; import { Checkbox } from './core/Checkbox'; import { Label } from './core/Label'; import { PlainInput } from './core/PlainInput'; -import { VStack } from './core/Stacks'; import { EncryptionHelp } from './EncryptionHelp'; import { gitCallbacks } from './git/callbacks'; import { SyncToFilesystemSetting } from './SyncToFilesystemSetting'; diff --git a/apps/yaak-client/components/DnsOverridesEditor.tsx b/apps/yaak-client/components/DnsOverridesEditor.tsx index 1c5c6d4e..9faed861 100644 --- a/apps/yaak-client/components/DnsOverridesEditor.tsx +++ b/apps/yaak-client/components/DnsOverridesEditor.tsx @@ -1,12 +1,20 @@ import type { DnsOverride, Workspace } from '@yaakapp-internal/models'; import { patchModel } from '@yaakapp-internal/models'; +import { + HStack, + Table, + TableBody, + TableCell, + TableHead, + TableHeaderCell, + TableRow, + VStack, +} from '@yaakapp-internal/ui'; import { useCallback, useId, useMemo } from 'react'; import { Button } from './core/Button'; import { Checkbox } from './core/Checkbox'; import { IconButton } from './core/IconButton'; import { PlainInput } from './core/PlainInput'; -import { HStack, VStack } from './core/Stacks'; -import { Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow } from '@yaakapp-internal/ui'; interface Props { workspace: Workspace; @@ -66,8 +74,8 @@ export function DnsOverridesEditor({ workspace }: Props) {
Override DNS resolution for specific hostnames. This works like{' '} - /etc/hosts{' '} - but only for requests made from this workspace. + /etc/hosts but + only for requests made from this workspace.
{overridesWithIds.length > 0 && ( diff --git a/apps/yaak-client/components/DynamicForm.tsx b/apps/yaak-client/components/DynamicForm.tsx index 773fa155..e3cad5d5 100644 --- a/apps/yaak-client/components/DynamicForm.tsx +++ b/apps/yaak-client/components/DynamicForm.tsx @@ -11,6 +11,7 @@ import type { FormInputText, JsonPrimitive, } from '@yaakapp-internal/plugins'; +import { Banner, VStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { useAtomValue } from 'jotai'; import { useCallback, useEffect, useMemo } from 'react'; @@ -19,7 +20,6 @@ import { useRandomKey } from '../hooks/useRandomKey'; import { capitalize } from '../lib/capitalize'; import { showDialog } from '../lib/dialog'; import { resolvedModelName } from '../lib/resolvedModelName'; -import { Banner } from '@yaakapp-internal/ui'; import { Checkbox } from './core/Checkbox'; import { DetailsBanner } from './core/DetailsBanner'; import { Editor } from './core/Editor/LazyEditor'; @@ -31,7 +31,6 @@ import type { Pair } from './core/PairEditor'; import { PairEditor } from './core/PairEditor'; import { PlainInput } from './core/PlainInput'; import { Select } from './core/Select'; -import { VStack } from './core/Stacks'; import { Markdown } from './Markdown'; import { SelectFile } from './SelectFile'; diff --git a/apps/yaak-client/components/EncryptionHelp.tsx b/apps/yaak-client/components/EncryptionHelp.tsx index e687dedf..c5fdea09 100644 --- a/apps/yaak-client/components/EncryptionHelp.tsx +++ b/apps/yaak-client/components/EncryptionHelp.tsx @@ -1,4 +1,4 @@ -import { VStack } from './core/Stacks'; +import { VStack } from '@yaakapp-internal/ui'; export function EncryptionHelp() { return ( diff --git a/apps/yaak-client/components/EnvironmentEditor.tsx b/apps/yaak-client/components/EnvironmentEditor.tsx index df60531e..6fe6b25f 100644 --- a/apps/yaak-client/components/EnvironmentEditor.tsx +++ b/apps/yaak-client/components/EnvironmentEditor.tsx @@ -1,6 +1,7 @@ import type { Environment } from '@yaakapp-internal/models'; import { patchModel } from '@yaakapp-internal/models'; import type { GenericCompletionOption } from '@yaakapp-internal/plugins'; +import { Heading } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { useCallback, useMemo } from 'react'; import { useEnvironmentsBreakdown } from '../hooks/useEnvironmentsBreakdown'; @@ -15,7 +16,6 @@ import { } from '../lib/setupOrConfigureEncryption'; import { DismissibleBanner } from './core/DismissibleBanner'; import type { GenericCompletionConfig } from './core/Editor/genericCompletion'; -import { Heading } from './core/Heading'; import type { PairEditorHandle, PairWithId } from './core/PairEditor'; import { ensurePairId } from './core/PairEditor.util'; import { PairOrBulkEditor } from './core/PairOrBulkEditor'; diff --git a/apps/yaak-client/components/ExportDataDialog.tsx b/apps/yaak-client/components/ExportDataDialog.tsx index 89942fed..69613710 100644 --- a/apps/yaak-client/components/ExportDataDialog.tsx +++ b/apps/yaak-client/components/ExportDataDialog.tsx @@ -1,6 +1,7 @@ import { save } from '@tauri-apps/plugin-dialog'; import type { Workspace } from '@yaakapp-internal/models'; import { workspacesAtom } from '@yaakapp-internal/models'; +import { HStack, VStack } from '@yaakapp-internal/ui'; import { useAtomValue } from 'jotai'; import { useCallback, useMemo, useState } from 'react'; import slugify from 'slugify'; @@ -11,7 +12,6 @@ import { Button } from './core/Button'; import { Checkbox } from './core/Checkbox'; import { DetailsBanner } from './core/DetailsBanner'; import { Link } from './core/Link'; -import { HStack, VStack } from './core/Stacks'; interface Props { onHide: () => void; diff --git a/apps/yaak-client/components/FolderLayout.tsx b/apps/yaak-client/components/FolderLayout.tsx index 505f5181..3038523f 100644 --- a/apps/yaak-client/components/FolderLayout.tsx +++ b/apps/yaak-client/components/FolderLayout.tsx @@ -1,5 +1,6 @@ import type { Folder, GrpcRequest, HttpRequest, WebsocketRequest } from '@yaakapp-internal/models'; import { foldersAtom } from '@yaakapp-internal/models'; +import { Heading, HStack, Icon, LoadingIcon } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { useAtomValue } from 'jotai'; import type { CSSProperties, ReactNode } from 'react'; @@ -12,14 +13,11 @@ import { showDialog } from '../lib/dialog'; import { resolvedModelName } from '../lib/resolvedModelName'; import { router } from '../lib/router'; import { Button } from './core/Button'; -import { Heading } from './core/Heading'; import { HttpResponseDurationTag } from './core/HttpResponseDurationTag'; import { HttpStatusTag } from './core/HttpStatusTag'; -import { Icon, LoadingIcon } from '@yaakapp-internal/ui'; import { IconButton } from './core/IconButton'; import { Separator } from './core/Separator'; import { SizeTag } from './core/SizeTag'; -import { HStack } from './core/Stacks'; import { HttpResponsePane } from './HttpResponsePane'; interface Props { diff --git a/apps/yaak-client/components/FolderSettingsDialog.tsx b/apps/yaak-client/components/FolderSettingsDialog.tsx index 079a509b..b3786edc 100644 --- a/apps/yaak-client/components/FolderSettingsDialog.tsx +++ b/apps/yaak-client/components/FolderSettingsDialog.tsx @@ -1,8 +1,5 @@ -import { - createWorkspaceModel, - foldersAtom, - patchModel, -} from '@yaakapp-internal/models'; +import { createWorkspaceModel, foldersAtom, patchModel } from '@yaakapp-internal/models'; +import { HStack, Icon, InlineCode, VStack } from '@yaakapp-internal/ui'; import { useAtomValue } from 'jotai'; import { Fragment, useMemo } from 'react'; import { useAuthTab } from '../hooks/useAuthTab'; @@ -15,10 +12,8 @@ import { hideDialog } from '../lib/dialog'; import { CopyIconButton } from './CopyIconButton'; import { Button } from './core/Button'; import { CountBadge } from './core/CountBadge'; -import { Icon, InlineCode } from '@yaakapp-internal/ui'; import { Input } from './core/Input'; import { Link } from './core/Link'; -import { HStack, VStack } from './core/Stacks'; import type { TabItem } from './core/Tabs/Tabs'; import { TabContent, Tabs } from './core/Tabs/Tabs'; import { EmptyStateText } from './EmptyStateText'; @@ -85,11 +80,7 @@ export function FolderSettingsDialog({ folderId, tab }: Props) { {breadcrumbs.map((item, index) => ( {index > 0 && ( - + )} {item.name} @@ -99,10 +90,7 @@ export function FolderSettingsDialog({ folderId, tab }: Props) { {breadcrumbs.length > 0 && ( )} - + {folder.name} diff --git a/apps/yaak-client/components/GrpcEditor.tsx b/apps/yaak-client/components/GrpcEditor.tsx index 67695a93..55855498 100644 --- a/apps/yaak-client/components/GrpcEditor.tsx +++ b/apps/yaak-client/components/GrpcEditor.tsx @@ -1,7 +1,8 @@ -import { jsoncLanguage } from '@shopify/lang-jsonc'; import { linter } from '@codemirror/lint'; import type { EditorView } from '@codemirror/view'; +import { jsoncLanguage } from '@shopify/lang-jsonc'; import type { GrpcRequest } from '@yaakapp-internal/models'; +import { InlineCode, VStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { handleRefresh, @@ -19,8 +20,6 @@ import { Button } from './core/Button'; import type { EditorProps } from './core/Editor/Editor'; import { Editor } from './core/Editor/LazyEditor'; import { FormattedError } from './core/FormattedError'; -import { InlineCode } from '@yaakapp-internal/ui'; -import { VStack } from './core/Stacks'; import { GrpcProtoSelectionDialog } from './GrpcProtoSelectionDialog'; type Props = Pick & { diff --git a/apps/yaak-client/components/GrpcProtoSelectionDialog.tsx b/apps/yaak-client/components/GrpcProtoSelectionDialog.tsx index 88fcf257..15225493 100644 --- a/apps/yaak-client/components/GrpcProtoSelectionDialog.tsx +++ b/apps/yaak-client/components/GrpcProtoSelectionDialog.tsx @@ -1,14 +1,13 @@ import { open } from '@tauri-apps/plugin-dialog'; import type { GrpcRequest } from '@yaakapp-internal/models'; +import { Banner, HStack, Icon, InlineCode, VStack } from '@yaakapp-internal/ui'; import { useActiveRequest } from '../hooks/useActiveRequest'; import { useGrpc } from '../hooks/useGrpc'; import { useGrpcProtoFiles } from '../hooks/useGrpcProtoFiles'; import { pluralizeCount } from '../lib/pluralize'; import { Button } from './core/Button'; -import { Banner, Icon, InlineCode } from '@yaakapp-internal/ui'; import { IconButton } from './core/IconButton'; import { Link } from './core/Link'; -import { HStack, VStack } from './core/Stacks'; interface Props { onDone: () => void; diff --git a/apps/yaak-client/components/GrpcRequestPane.tsx b/apps/yaak-client/components/GrpcRequestPane.tsx index 04c9e984..b24c931b 100644 --- a/apps/yaak-client/components/GrpcRequestPane.tsx +++ b/apps/yaak-client/components/GrpcRequestPane.tsx @@ -1,9 +1,9 @@ import { type GrpcRequest, type HttpRequestHeader, patchModel } from '@yaakapp-internal/models'; +import { HStack, Icon, useContainerSize, VStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import type { CSSProperties } from 'react'; import { useCallback, useMemo, useRef } from 'react'; import { useAuthTab } from '../hooks/useAuthTab'; -import { useContainerSize } from '@yaakapp-internal/ui'; import type { ReflectResponseService } from '../hooks/useGrpc'; import { useHeadersTab } from '../hooks/useHeadersTab'; import { useInheritedHeaders } from '../hooks/useInheritedHeaders'; @@ -11,11 +11,9 @@ import { useRequestUpdateKey } from '../hooks/useRequestUpdateKey'; import { resolvedModelName } from '../lib/resolvedModelName'; import { Button } from './core/Button'; import { CountBadge } from './core/CountBadge'; -import { Icon } from '@yaakapp-internal/ui'; import { IconButton } from './core/IconButton'; import { PlainInput } from './core/PlainInput'; import { RadioDropdown } from './core/RadioDropdown'; -import { HStack, VStack } from './core/Stacks'; import type { TabItem } from './core/Tabs/Tabs'; import { TabContent, Tabs } from './core/Tabs/Tabs'; import { GrpcEditor } from './GrpcEditor'; diff --git a/apps/yaak-client/components/GrpcResponsePane.tsx b/apps/yaak-client/components/GrpcResponsePane.tsx index de14000c..cbbf33b3 100644 --- a/apps/yaak-client/components/GrpcResponsePane.tsx +++ b/apps/yaak-client/components/GrpcResponsePane.tsx @@ -1,4 +1,5 @@ import type { GrpcEvent, GrpcRequest } from '@yaakapp-internal/models'; +import { HStack, Icon, type IconProps, LoadingIcon, VStack } from '@yaakapp-internal/ui'; import { useAtomValue, useSetAtom } from 'jotai'; import type { CSSProperties } from 'react'; import { useEffect, useMemo, useState } from 'react'; @@ -14,9 +15,7 @@ import { Editor } from './core/Editor/LazyEditor'; import { EventDetailHeader, EventViewer } from './core/EventViewer'; import { EventViewerRow } from './core/EventViewerRow'; import { HotkeyList } from './core/HotkeyList'; -import { Icon, LoadingIcon, type IconProps } from '@yaakapp-internal/ui'; import { KeyValueRow, KeyValueRows } from './core/KeyValueRow'; -import { HStack, VStack } from './core/Stacks'; import { EmptyStateText } from './EmptyStateText'; import { ErrorBoundary } from './ErrorBoundary'; import { RecentGrpcConnectionsDropdown } from './RecentGrpcConnectionsDropdown'; diff --git a/apps/yaak-client/components/HeadersEditor.tsx b/apps/yaak-client/components/HeadersEditor.tsx index 05d08ac5..d5d2f0ca 100644 --- a/apps/yaak-client/components/HeadersEditor.tsx +++ b/apps/yaak-client/components/HeadersEditor.tsx @@ -1,5 +1,6 @@ import type { HttpRequestHeader } from '@yaakapp-internal/models'; import type { GenericCompletionOption } from '@yaakapp-internal/plugins'; +import { HStack } from '@yaakapp-internal/ui'; import { charsets } from '../lib/data/charsets'; import { connections } from '../lib/data/connections'; import { encodings } from '../lib/data/encodings'; @@ -13,7 +14,6 @@ import type { Pair, PairEditorProps } from './core/PairEditor'; import { PairEditorRow } from './core/PairEditor'; import { ensurePairId } from './core/PairEditor.util'; import { PairOrBulkEditor } from './core/PairOrBulkEditor'; -import { HStack } from './core/Stacks'; type Props = { forceUpdateKey: string; @@ -41,7 +41,9 @@ export function HeadersEditor({ const validInheritedHeaders = inheritedHeaders?.filter( (pair) => - pair.enabled && (pair.name || pair.value) && !currentHeaderNames.has(pair.name.toLowerCase()), + pair.enabled && + (pair.name || pair.value) && + !currentHeaderNames.has(pair.name.toLowerCase()), ) ?? []; const hasInheritedHeaders = validInheritedHeaders.length > 0; return ( diff --git a/apps/yaak-client/components/HttpAuthenticationEditor.tsx b/apps/yaak-client/components/HttpAuthenticationEditor.tsx index ab048f9a..6bc9ab0d 100644 --- a/apps/yaak-client/components/HttpAuthenticationEditor.tsx +++ b/apps/yaak-client/components/HttpAuthenticationEditor.tsx @@ -6,6 +6,7 @@ import type { Workspace, } from '@yaakapp-internal/models'; import { patchModel } from '@yaakapp-internal/models'; +import { HStack, Icon, InlineCode } from '@yaakapp-internal/ui'; import { useCallback } from 'react'; import { openFolderSettings } from '../commands/openFolderSettings'; import { openWorkspaceSettings } from '../commands/openWorkspaceSettings'; @@ -14,12 +15,10 @@ import { useInheritedAuthentication } from '../hooks/useInheritedAuthentication' import { useRenderTemplate } from '../hooks/useRenderTemplate'; import { resolvedModelName } from '../lib/resolvedModelName'; import { Dropdown, type DropdownItem } from './core/Dropdown'; -import { Icon, InlineCode } from '@yaakapp-internal/ui'; import { IconButton } from './core/IconButton'; import { Input, type InputProps } from './core/Input'; import { Link } from './core/Link'; import { SegmentedControl } from './core/SegmentedControl'; -import { HStack } from './core/Stacks'; import { DynamicForm } from './DynamicForm'; import { EmptyStateText } from './EmptyStateText'; diff --git a/apps/yaak-client/components/HttpResponsePane.tsx b/apps/yaak-client/components/HttpResponsePane.tsx index d08013af..2ed4d1e7 100644 --- a/apps/yaak-client/components/HttpResponsePane.tsx +++ b/apps/yaak-client/components/HttpResponsePane.tsx @@ -1,4 +1,5 @@ import type { HttpResponse, HttpResponseEvent } from '@yaakapp-internal/models'; +import { Banner, HStack, Icon, LoadingIcon, VStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import type { ComponentType, CSSProperties } from 'react'; import { lazy, Suspense, useMemo } from 'react'; @@ -17,10 +18,8 @@ import { CountBadge } from './core/CountBadge'; import { HotkeyList } from './core/HotkeyList'; import { HttpResponseDurationTag } from './core/HttpResponseDurationTag'; import { HttpStatusTag } from './core/HttpStatusTag'; -import { Banner, Icon, LoadingIcon } from '@yaakapp-internal/ui'; import { PillButton } from './core/PillButton'; import { SizeTag } from './core/SizeTag'; -import { HStack, VStack } from './core/Stacks'; import type { TabItem } from './core/Tabs/Tabs'; import { TabContent, Tabs } from './core/Tabs/Tabs'; import { Tooltip } from './core/Tooltip'; diff --git a/apps/yaak-client/components/ImportDataDialog.tsx b/apps/yaak-client/components/ImportDataDialog.tsx index 35931843..d3f80405 100644 --- a/apps/yaak-client/components/ImportDataDialog.tsx +++ b/apps/yaak-client/components/ImportDataDialog.tsx @@ -1,7 +1,7 @@ +import { VStack } from '@yaakapp-internal/ui'; import { useState } from 'react'; import { useLocalStorage } from 'react-use'; import { Button } from './core/Button'; -import { VStack } from './core/Stacks'; import { SelectFile } from './SelectFile'; interface Props { diff --git a/apps/yaak-client/components/MoveToWorkspaceDialog.tsx b/apps/yaak-client/components/MoveToWorkspaceDialog.tsx index 9fc4ef0b..3415379e 100644 --- a/apps/yaak-client/components/MoveToWorkspaceDialog.tsx +++ b/apps/yaak-client/components/MoveToWorkspaceDialog.tsx @@ -1,15 +1,14 @@ import type { GrpcRequest, HttpRequest, WebsocketRequest } from '@yaakapp-internal/models'; import { patchModel, workspacesAtom } from '@yaakapp-internal/models'; +import { InlineCode, VStack } from '@yaakapp-internal/ui'; import { useAtomValue } from 'jotai'; import { useState } from 'react'; import { pluralizeCount } from '../lib/pluralize'; import { resolvedModelName } from '../lib/resolvedModelName'; import { router } from '../lib/router'; import { showToast } from '../lib/toast'; -import { InlineCode } from '@yaakapp-internal/ui'; import { Button } from './core/Button'; import { Select } from './core/Select'; -import { VStack } from './core/Stacks'; interface Props { activeWorkspaceId: string; diff --git a/apps/yaak-client/components/RecentGrpcConnectionsDropdown.tsx b/apps/yaak-client/components/RecentGrpcConnectionsDropdown.tsx index 27a256b6..f083a207 100644 --- a/apps/yaak-client/components/RecentGrpcConnectionsDropdown.tsx +++ b/apps/yaak-client/components/RecentGrpcConnectionsDropdown.tsx @@ -1,12 +1,11 @@ import type { GrpcConnection } from '@yaakapp-internal/models'; import { deleteModel } from '@yaakapp-internal/models'; +import { HStack, Icon } from '@yaakapp-internal/ui'; import { formatDistanceToNowStrict } from 'date-fns'; import { useDeleteGrpcConnections } from '../hooks/useDeleteGrpcConnections'; import { pluralizeCount } from '../lib/pluralize'; import { Dropdown } from './core/Dropdown'; -import { Icon } from '@yaakapp-internal/ui'; import { IconButton } from './core/IconButton'; -import { HStack } from './core/Stacks'; interface Props { connections: GrpcConnection[]; diff --git a/apps/yaak-client/components/RecentHttpResponsesDropdown.tsx b/apps/yaak-client/components/RecentHttpResponsesDropdown.tsx index fe5f9c09..1517b9bf 100644 --- a/apps/yaak-client/components/RecentHttpResponsesDropdown.tsx +++ b/apps/yaak-client/components/RecentHttpResponsesDropdown.tsx @@ -1,14 +1,13 @@ import type { HttpResponse } from '@yaakapp-internal/models'; import { deleteModel } from '@yaakapp-internal/models'; +import { HStack, Icon } from '@yaakapp-internal/ui'; import { useCopyHttpResponse } from '../hooks/useCopyHttpResponse'; import { useDeleteHttpResponses } from '../hooks/useDeleteHttpResponses'; import { useSaveResponse } from '../hooks/useSaveResponse'; import { pluralize } from '../lib/pluralize'; import { Dropdown } from './core/Dropdown'; import { HttpStatusTag } from './core/HttpStatusTag'; -import { Icon } from '@yaakapp-internal/ui'; import { IconButton } from './core/IconButton'; -import { HStack } from './core/Stacks'; interface Props { responses: HttpResponse[]; diff --git a/apps/yaak-client/components/RecentWebsocketConnectionsDropdown.tsx b/apps/yaak-client/components/RecentWebsocketConnectionsDropdown.tsx index 42f5e27c..d2f7a14c 100644 --- a/apps/yaak-client/components/RecentWebsocketConnectionsDropdown.tsx +++ b/apps/yaak-client/components/RecentWebsocketConnectionsDropdown.tsx @@ -1,12 +1,11 @@ import type { WebsocketConnection } from '@yaakapp-internal/models'; import { deleteModel, getModel } from '@yaakapp-internal/models'; +import { HStack, Icon } from '@yaakapp-internal/ui'; import { formatDistanceToNowStrict } from 'date-fns'; import { deleteWebsocketConnections } from '../commands/deleteWebsocketConnections'; import { pluralizeCount } from '../lib/pluralize'; import { Dropdown } from './core/Dropdown'; -import { Icon } from '@yaakapp-internal/ui'; import { IconButton } from './core/IconButton'; -import { HStack } from './core/Stacks'; interface Props { connections: WebsocketConnection[]; diff --git a/apps/yaak-client/components/RouteError.tsx b/apps/yaak-client/components/RouteError.tsx index d6ec5cdc..e4a7e967 100644 --- a/apps/yaak-client/components/RouteError.tsx +++ b/apps/yaak-client/components/RouteError.tsx @@ -1,8 +1,7 @@ +import { Heading, VStack } from '@yaakapp-internal/ui'; import { Button } from './core/Button'; import { DetailsBanner } from './core/DetailsBanner'; import { FormattedError } from './core/FormattedError'; -import { Heading } from './core/Heading'; -import { VStack } from './core/Stacks'; export default function RouteError({ error }: { error: unknown }) { console.log('Error', error); diff --git a/apps/yaak-client/components/SelectFile.tsx b/apps/yaak-client/components/SelectFile.tsx index 0b86e7d0..31b605c9 100644 --- a/apps/yaak-client/components/SelectFile.tsx +++ b/apps/yaak-client/components/SelectFile.tsx @@ -1,5 +1,6 @@ import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'; import { open } from '@tauri-apps/plugin-dialog'; +import { HStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import mime from 'mime'; import type { ReactNode } from 'react'; @@ -9,7 +10,6 @@ import { Button } from './core/Button'; import { IconButton } from './core/IconButton'; import { IconTooltip } from './core/IconTooltip'; import { Label } from './core/Label'; -import { HStack } from './core/Stacks'; type Props = Omit & { onChange: (value: { filePath: string | null; contentType: string | null }) => void; diff --git a/apps/yaak-client/components/Settings/Settings.tsx b/apps/yaak-client/components/Settings/Settings.tsx index da962d45..4103f6ee 100644 --- a/apps/yaak-client/components/Settings/Settings.tsx +++ b/apps/yaak-client/components/Settings/Settings.tsx @@ -3,15 +3,14 @@ import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'; import { type } from '@tauri-apps/plugin-os'; import { useLicense } from '@yaakapp-internal/license'; import { pluginsAtom, settingsAtom } from '@yaakapp-internal/models'; +import { HeaderSize, HStack, Icon } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { useAtomValue } from 'jotai'; import { useKeyPressEvent } from 'react-use'; import { appInfo } from '../../lib/appInfo'; import { capitalize } from '../../lib/capitalize'; import { CountBadge } from '../core/CountBadge'; -import { HStack } from '../core/Stacks'; import { TabContent, type TabItem, Tabs } from '../core/Tabs/Tabs'; -import { HeaderSize, Icon } from '@yaakapp-internal/ui'; import { SettingsCertificates } from './SettingsCertificates'; import { SettingsGeneral } from './SettingsGeneral'; import { SettingsHotkeys } from './SettingsHotkeys'; diff --git a/apps/yaak-client/components/Settings/SettingsCertificates.tsx b/apps/yaak-client/components/Settings/SettingsCertificates.tsx index e1be3287..6b750b1c 100644 --- a/apps/yaak-client/components/Settings/SettingsCertificates.tsx +++ b/apps/yaak-client/components/Settings/SettingsCertificates.tsx @@ -1,17 +1,15 @@ import type { ClientCertificate } from '@yaakapp-internal/models'; import { patchModel, settingsAtom } from '@yaakapp-internal/models'; +import { Heading, HStack, InlineCode, VStack } from '@yaakapp-internal/ui'; import { useAtomValue } from 'jotai'; import { useRef } from 'react'; import { showConfirmDelete } from '../../lib/confirm'; import { Button } from '../core/Button'; import { Checkbox } from '../core/Checkbox'; import { DetailsBanner } from '../core/DetailsBanner'; -import { Heading } from '../core/Heading'; import { IconButton } from '../core/IconButton'; -import { InlineCode } from '@yaakapp-internal/ui'; import { PlainInput } from '../core/PlainInput'; import { Separator } from '../core/Separator'; -import { HStack, VStack } from '../core/Stacks'; import { SelectFile } from '../SelectFile'; function createEmptyCertificate(): ClientCertificate { diff --git a/apps/yaak-client/components/Settings/SettingsGeneral.tsx b/apps/yaak-client/components/Settings/SettingsGeneral.tsx index 0a6af1a9..55aea704 100644 --- a/apps/yaak-client/components/Settings/SettingsGeneral.tsx +++ b/apps/yaak-client/components/Settings/SettingsGeneral.tsx @@ -1,5 +1,6 @@ import { revealItemInDir } from '@tauri-apps/plugin-opener'; import { patchModel, settingsAtom } from '@yaakapp-internal/models'; +import { Heading, VStack } from '@yaakapp-internal/ui'; import { useAtomValue } from 'jotai'; import { activeWorkspaceAtom } from '../../hooks/useActiveWorkspace'; import { useCheckForUpdates } from '../../hooks/useCheckForUpdates'; @@ -7,13 +8,11 @@ import { appInfo } from '../../lib/appInfo'; import { revealInFinderText } from '../../lib/reveal'; import { CargoFeature } from '../CargoFeature'; import { Checkbox } from '../core/Checkbox'; -import { Heading } from '../core/Heading'; import { IconButton } from '../core/IconButton'; import { KeyValueRow, KeyValueRows } from '../core/KeyValueRow'; import { PlainInput } from '../core/PlainInput'; import { Select } from '../core/Select'; import { Separator } from '../core/Separator'; -import { VStack } from '../core/Stacks'; export function SettingsGeneral() { const workspace = useAtomValue(activeWorkspaceAtom); diff --git a/apps/yaak-client/components/Settings/SettingsHotkeys.tsx b/apps/yaak-client/components/Settings/SettingsHotkeys.tsx index 88e6e87c..2f74d739 100644 --- a/apps/yaak-client/components/Settings/SettingsHotkeys.tsx +++ b/apps/yaak-client/components/Settings/SettingsHotkeys.tsx @@ -1,4 +1,16 @@ import { patchModel, settingsAtom } from '@yaakapp-internal/models'; +import { + Heading, + HStack, + Icon, + Table, + TableBody, + TableCell, + TableHead, + TableHeaderCell, + TableRow, + VStack, +} from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { fuzzyMatch } from 'fuzzbunny'; import { useAtomValue } from 'jotai'; @@ -16,13 +28,9 @@ import { capitalize } from '../../lib/capitalize'; import { showDialog } from '../../lib/dialog'; import { Button } from '../core/Button'; import { Dropdown, type DropdownItem } from '../core/Dropdown'; -import { Heading } from '../core/Heading'; import { HotkeyRaw } from '../core/Hotkey'; -import { Icon } from '@yaakapp-internal/ui'; import { IconButton } from '../core/IconButton'; import { PlainInput } from '../core/PlainInput'; -import { HStack, VStack } from '../core/Stacks'; -import { Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow } from '@yaakapp-internal/ui'; const HOLD_KEYS = ['Shift', 'Control', 'Alt', 'Meta']; const LAYOUT_INSENSITIVE_KEYS = [ diff --git a/apps/yaak-client/components/Settings/SettingsInterface.tsx b/apps/yaak-client/components/Settings/SettingsInterface.tsx index c3e6f25c..87b4c4b0 100644 --- a/apps/yaak-client/components/Settings/SettingsInterface.tsx +++ b/apps/yaak-client/components/Settings/SettingsInterface.tsx @@ -3,21 +3,17 @@ import { useFonts } from '@yaakapp-internal/fonts'; import { useLicense } from '@yaakapp-internal/license'; import type { EditorKeymap, Settings } from '@yaakapp-internal/models'; import { patchModel, settingsAtom } from '@yaakapp-internal/models'; +import { clamp, Heading, HStack, Icon, VStack } from '@yaakapp-internal/ui'; import { useAtomValue } from 'jotai'; import { useState } from 'react'; - import { activeWorkspaceAtom } from '../../hooks/useActiveWorkspace'; -import { clamp } from '@yaakapp-internal/ui'; import { showConfirm } from '../../lib/confirm'; import { invokeCmd } from '../../lib/tauri'; import { CargoFeature } from '../CargoFeature'; import { Button } from '../core/Button'; import { Checkbox } from '../core/Checkbox'; -import { Heading } from '../core/Heading'; -import { Icon } from '@yaakapp-internal/ui'; import { Link } from '../core/Link'; import { Select } from '../core/Select'; -import { HStack, VStack } from '../core/Stacks'; const NULL_FONT_VALUE = '__NULL_FONT__'; diff --git a/apps/yaak-client/components/Settings/SettingsLicense.tsx b/apps/yaak-client/components/Settings/SettingsLicense.tsx index e2cb4ccb..37fd5c6a 100644 --- a/apps/yaak-client/components/Settings/SettingsLicense.tsx +++ b/apps/yaak-client/components/Settings/SettingsLicense.tsx @@ -1,5 +1,6 @@ import { openUrl } from '@tauri-apps/plugin-opener'; import { useLicense } from '@yaakapp-internal/license'; +import { Banner, HStack, Icon, VStack } from '@yaakapp-internal/ui'; import { differenceInDays } from 'date-fns'; import { formatDate } from 'date-fns/format'; import { useState } from 'react'; @@ -7,11 +8,9 @@ import { useToggle } from '../../hooks/useToggle'; import { pluralizeCount } from '../../lib/pluralize'; import { CargoFeature } from '../CargoFeature'; import { Button } from '../core/Button'; -import { Banner, Icon } from '@yaakapp-internal/ui'; import { Link } from '../core/Link'; import { PlainInput } from '../core/PlainInput'; import { Separator } from '../core/Separator'; -import { HStack, VStack } from '../core/Stacks'; export function SettingsLicense() { return ( diff --git a/apps/yaak-client/components/Settings/SettingsPlugins.tsx b/apps/yaak-client/components/Settings/SettingsPlugins.tsx index 66b257f4..44adcad5 100644 --- a/apps/yaak-client/components/Settings/SettingsPlugins.tsx +++ b/apps/yaak-client/components/Settings/SettingsPlugins.tsx @@ -9,10 +9,22 @@ import { searchPlugins, uninstallPlugin, } from '@yaakapp-internal/plugins'; +import { + HStack, + Icon, + InlineCode, + LoadingIcon, + Table, + TableBody, + TableCell, + TableHead, + TableHeaderCell, + TableRow, + useDebouncedValue, +} from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { useAtomValue } from 'jotai'; import { useState } from 'react'; -import { Icon, InlineCode, LoadingIcon, useDebouncedValue } from '@yaakapp-internal/ui'; import { useInstallPlugin } from '../../hooks/useInstallPlugin'; import { usePluginInfo } from '../../hooks/usePluginInfo'; import { usePluginsKey, useRefreshPlugins } from '../../hooks/usePlugins'; @@ -24,8 +36,6 @@ import { CountBadge } from '../core/CountBadge'; import { IconButton } from '../core/IconButton'; import { Link } from '../core/Link'; import { PlainInput } from '../core/PlainInput'; -import { HStack } from '../core/Stacks'; -import { Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow } from '@yaakapp-internal/ui'; import { TabContent, Tabs } from '../core/Tabs/Tabs'; import { EmptyStateText } from '../EmptyStateText'; import { SelectFile } from '../SelectFile'; diff --git a/apps/yaak-client/components/Settings/SettingsProxy.tsx b/apps/yaak-client/components/Settings/SettingsProxy.tsx index a63b9071..5bd7ca22 100644 --- a/apps/yaak-client/components/Settings/SettingsProxy.tsx +++ b/apps/yaak-client/components/Settings/SettingsProxy.tsx @@ -1,13 +1,10 @@ import { patchModel, settingsAtom } from '@yaakapp-internal/models'; +import { Heading, HStack, InlineCode, VStack } from '@yaakapp-internal/ui'; import { useAtomValue } from 'jotai'; - import { Checkbox } from '../core/Checkbox'; -import { Heading } from '../core/Heading'; -import { InlineCode } from '@yaakapp-internal/ui'; import { PlainInput } from '../core/PlainInput'; import { Select } from '../core/Select'; import { Separator } from '../core/Separator'; -import { HStack, VStack } from '../core/Stacks'; export function SettingsProxy() { const settings = useAtomValue(settingsAtom); diff --git a/apps/yaak-client/components/Settings/SettingsTheme.tsx b/apps/yaak-client/components/Settings/SettingsTheme.tsx index 59e47c2d..13f26130 100644 --- a/apps/yaak-client/components/Settings/SettingsTheme.tsx +++ b/apps/yaak-client/components/Settings/SettingsTheme.tsx @@ -1,17 +1,15 @@ import { patchModel, settingsAtom } from '@yaakapp-internal/models'; +import { Heading, HStack, Icon, type IconProps, VStack } from '@yaakapp-internal/ui'; import { useAtomValue } from 'jotai'; import { lazy, Suspense } from 'react'; import { activeWorkspaceAtom } from '../../hooks/useActiveWorkspace'; import { useResolvedAppearance } from '../../hooks/useResolvedAppearance'; import { useResolvedTheme } from '../../hooks/useResolvedTheme'; import type { ButtonProps } from '../core/Button'; -import { Heading } from '../core/Heading'; -import { Icon, type IconProps } from '@yaakapp-internal/ui'; import { IconButton } from '../core/IconButton'; import { Link } from '../core/Link'; import type { SelectProps } from '../core/Select'; import { Select } from '../core/Select'; -import { HStack, VStack } from '../core/Stacks'; const Editor = lazy(() => import('../core/Editor/Editor').then((m) => ({ default: m.Editor }))); diff --git a/apps/yaak-client/components/SidebarActions.tsx b/apps/yaak-client/components/SidebarActions.tsx index 58fec491..cc3bd831 100644 --- a/apps/yaak-client/components/SidebarActions.tsx +++ b/apps/yaak-client/components/SidebarActions.tsx @@ -1,9 +1,9 @@ +import { HStack } from '@yaakapp-internal/ui'; import { useMemo } from 'react'; import { useFloatingSidebarHidden } from '../hooks/useFloatingSidebarHidden'; import { useSidebarHidden } from '../hooks/useSidebarHidden'; import { CreateDropdown } from './CreateDropdown'; import { IconButton } from './core/IconButton'; -import { HStack } from './core/Stacks'; interface Props { floating?: boolean; diff --git a/apps/yaak-client/components/SwitchWorkspaceDialog.tsx b/apps/yaak-client/components/SwitchWorkspaceDialog.tsx index 5feb916d..f73b8763 100644 --- a/apps/yaak-client/components/SwitchWorkspaceDialog.tsx +++ b/apps/yaak-client/components/SwitchWorkspaceDialog.tsx @@ -1,12 +1,11 @@ import type { Workspace } from '@yaakapp-internal/models'; import { patchModel, settingsAtom } from '@yaakapp-internal/models'; +import { HStack, Icon, InlineCode, VStack } from '@yaakapp-internal/ui'; import { useAtomValue } from 'jotai'; import { useState } from 'react'; import { switchWorkspace } from '../commands/switchWorkspace'; import { Button } from './core/Button'; import { Checkbox } from './core/Checkbox'; -import { Icon, InlineCode } from '@yaakapp-internal/ui'; -import { HStack, VStack } from './core/Stacks'; interface Props { hide: () => void; diff --git a/apps/yaak-client/components/SyncToFilesystemSetting.tsx b/apps/yaak-client/components/SyncToFilesystemSetting.tsx index 94a812a3..877dd28f 100644 --- a/apps/yaak-client/components/SyncToFilesystemSetting.tsx +++ b/apps/yaak-client/components/SyncToFilesystemSetting.tsx @@ -1,10 +1,9 @@ import { readDir } from '@tauri-apps/plugin-fs'; +import { Banner, VStack } from '@yaakapp-internal/ui'; import { useState } from 'react'; import { openWorkspaceFromSyncDir } from '../commands/openWorkspaceFromSyncDir'; -import { Banner } from '@yaakapp-internal/ui'; import { Button } from './core/Button'; import { Checkbox } from './core/Checkbox'; -import { VStack } from './core/Stacks'; import { SelectFile } from './SelectFile'; export interface SyncToFilesystemSettingProps { diff --git a/apps/yaak-client/components/TemplateFunctionDialog.tsx b/apps/yaak-client/components/TemplateFunctionDialog.tsx index ea997113..746427e4 100644 --- a/apps/yaak-client/components/TemplateFunctionDialog.tsx +++ b/apps/yaak-client/components/TemplateFunctionDialog.tsx @@ -9,10 +9,10 @@ import type { import type { TemplateFunction } from '@yaakapp-internal/plugins'; import type { FnArg, Tokens } from '@yaakapp-internal/templates'; import { parseTemplate } from '@yaakapp-internal/templates'; +import { HStack, InlineCode, LoadingIcon, useDebouncedValue } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { useEffect, useMemo, useState } from 'react'; import { activeWorkspaceAtom } from '../hooks/useActiveWorkspace'; -import { InlineCode, LoadingIcon, useDebouncedValue } from '@yaakapp-internal/ui'; import { useRenderTemplate } from '../hooks/useRenderTemplate'; import { useTemplateFunctionConfig } from '../hooks/useTemplateFunctionConfig'; import { @@ -28,7 +28,6 @@ import { Button } from './core/Button'; import { collectArgumentValues } from './core/Editor/twig/util'; import { IconButton } from './core/IconButton'; import { PlainInput } from './core/PlainInput'; -import { HStack } from './core/Stacks'; import { DYNAMIC_FORM_NULL_ARG, DynamicForm } from './DynamicForm'; interface Props { diff --git a/apps/yaak-client/components/UrlBar.tsx b/apps/yaak-client/components/UrlBar.tsx index 8739f339..e53b6681 100644 --- a/apps/yaak-client/components/UrlBar.tsx +++ b/apps/yaak-client/components/UrlBar.tsx @@ -1,13 +1,13 @@ import type { HttpRequest } from '@yaakapp-internal/models'; +import type { IconProps } from '@yaakapp-internal/ui'; +import { HStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import type { FormEvent, ReactNode } from 'react'; import { memo, useCallback, useRef, useState } from 'react'; import { useHotKey } from '../hooks/useHotKey'; -import type { IconProps } from '@yaakapp-internal/ui'; import { IconButton } from './core/IconButton'; import type { InputHandle, InputProps } from './core/Input'; import { Input } from './core/Input'; -import { HStack } from './core/Stacks'; type Props = Pick & { className?: string; diff --git a/apps/yaak-client/components/UrlParameterEditor.tsx b/apps/yaak-client/components/UrlParameterEditor.tsx index b436526f..d3394d0f 100644 --- a/apps/yaak-client/components/UrlParameterEditor.tsx +++ b/apps/yaak-client/components/UrlParameterEditor.tsx @@ -1,9 +1,9 @@ import type { HttpRequest } from '@yaakapp-internal/models'; +import { VStack } from '@yaakapp-internal/ui'; import { useCallback, useRef } from 'react'; import { useRequestEditor, useRequestEditorEvent } from '../hooks/useRequestEditor'; import type { PairEditorHandle, PairEditorProps } from './core/PairEditor'; import { PairOrBulkEditor } from './core/PairOrBulkEditor'; -import { VStack } from './core/Stacks'; type Props = { forceUpdateKey: string; diff --git a/apps/yaak-client/components/WebsocketResponsePane.tsx b/apps/yaak-client/components/WebsocketResponsePane.tsx index a0f691e0..66f263be 100644 --- a/apps/yaak-client/components/WebsocketResponsePane.tsx +++ b/apps/yaak-client/components/WebsocketResponsePane.tsx @@ -1,4 +1,5 @@ import type { WebsocketEvent, WebsocketRequest } from '@yaakapp-internal/models'; +import { HStack, Icon, LoadingIcon, VStack } from '@yaakapp-internal/ui'; import { hexy } from 'hexy'; import { useAtomValue } from 'jotai'; import { useMemo, useState } from 'react'; @@ -16,8 +17,6 @@ import { Editor } from './core/Editor/LazyEditor'; import { type EventDetailAction, EventDetailHeader, EventViewer } from './core/EventViewer'; import { EventViewerRow } from './core/EventViewerRow'; import { HotkeyList } from './core/HotkeyList'; -import { Icon, LoadingIcon } from '@yaakapp-internal/ui'; -import { HStack, VStack } from './core/Stacks'; import { WebsocketStatusTag } from './core/WebsocketStatusTag'; import { EmptyStateText } from './EmptyStateText'; import { ErrorBoundary } from './ErrorBoundary'; diff --git a/apps/yaak-client/components/Workspace.tsx b/apps/yaak-client/components/Workspace.tsx index 25f89e34..16196538 100644 --- a/apps/yaak-client/components/Workspace.tsx +++ b/apps/yaak-client/components/Workspace.tsx @@ -1,6 +1,6 @@ import { type } from '@tauri-apps/plugin-os'; import { settingsAtom, workspacesAtom } from '@yaakapp-internal/models'; -import { Banner, HeaderSize, SidebarLayout } from '@yaakapp-internal/ui'; +import { Banner, HeaderSize, HStack, SidebarLayout } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { useAtomValue } from 'jotai'; import * as m from 'motion/react-m'; @@ -34,7 +34,6 @@ import { CreateDropdown } from './CreateDropdown'; import { Button } from './core/Button'; import { HotkeyList } from './core/HotkeyList'; import { FeedbackLink } from './core/Link'; -import { HStack } from './core/Stacks'; import { ErrorBoundary } from './ErrorBoundary'; import { FolderLayout } from './FolderLayout'; import { GrpcConnectionLayout } from './GrpcConnectionLayout'; diff --git a/apps/yaak-client/components/WorkspaceEncryptionSetting.tsx b/apps/yaak-client/components/WorkspaceEncryptionSetting.tsx index ac927a0e..1740dec0 100644 --- a/apps/yaak-client/components/WorkspaceEncryptionSetting.tsx +++ b/apps/yaak-client/components/WorkspaceEncryptionSetting.tsx @@ -5,6 +5,7 @@ import { setWorkspaceKey, } from '@yaakapp-internal/crypto'; import type { WorkspaceMeta } from '@yaakapp-internal/models'; +import { Banner, HStack, VStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { useAtomValue } from 'jotai'; import { useEffect, useState } from 'react'; @@ -13,14 +14,12 @@ import { createFastMutation } from '../hooks/useFastMutation'; import { useStateWithDeps } from '../hooks/useStateWithDeps'; import { showConfirm } from '../lib/confirm'; import { CopyIconButton } from './CopyIconButton'; -import { Banner } from '@yaakapp-internal/ui'; import type { ButtonProps } from './core/Button'; import { Button } from './core/Button'; import { IconButton } from './core/IconButton'; import { IconTooltip } from './core/IconTooltip'; import { Label } from './core/Label'; import { PlainInput } from './core/PlainInput'; -import { HStack, VStack } from './core/Stacks'; import { EncryptionHelp } from './EncryptionHelp'; interface Props { diff --git a/apps/yaak-client/components/WorkspaceHeader.tsx b/apps/yaak-client/components/WorkspaceHeader.tsx index 8ef8e30a..b509f0bf 100644 --- a/apps/yaak-client/components/WorkspaceHeader.tsx +++ b/apps/yaak-client/components/WorkspaceHeader.tsx @@ -1,3 +1,4 @@ +import { HStack, Icon } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { useAtom, useAtomValue } from 'jotai'; import { memo } from 'react'; @@ -6,10 +7,8 @@ import { useToggleCommandPalette } from '../hooks/useToggleCommandPalette'; import { workspaceLayoutAtom } from '../lib/atoms'; import { setupOrConfigureEncryption } from '../lib/setupOrConfigureEncryption'; import { CookieDropdown } from './CookieDropdown'; -import { Icon } from '@yaakapp-internal/ui'; import { IconButton } from './core/IconButton'; import { PillButton } from './core/PillButton'; -import { HStack } from './core/Stacks'; import { EnvironmentActionsDropdown } from './EnvironmentActionsDropdown'; import { ImportCurlButton } from './ImportCurlButton'; import { LicenseBadge } from './LicenseBadge'; @@ -23,7 +22,10 @@ interface Props { floatingSidebar?: boolean; } -export const WorkspaceHeader = memo(function WorkspaceHeader({ className, floatingSidebar }: Props) { +export const WorkspaceHeader = memo(function WorkspaceHeader({ + className, + floatingSidebar, +}: Props) { const togglePalette = useToggleCommandPalette(); const [workspaceLayout, setWorkspaceLayout] = useAtom(workspaceLayoutAtom); const workspace = useAtomValue(activeWorkspaceAtom); diff --git a/apps/yaak-client/components/WorkspaceSettingsDialog.tsx b/apps/yaak-client/components/WorkspaceSettingsDialog.tsx index 5ab2be45..dd782826 100644 --- a/apps/yaak-client/components/WorkspaceSettingsDialog.tsx +++ b/apps/yaak-client/components/WorkspaceSettingsDialog.tsx @@ -1,4 +1,5 @@ import { patchModel, workspaceMetasAtom, workspacesAtom } from '@yaakapp-internal/models'; +import { Banner, HStack, InlineCode, VStack } from '@yaakapp-internal/ui'; import { useAtomValue } from 'jotai'; import { useAuthTab } from '../hooks/useAuthTab'; import { useHeadersTab } from '../hooks/useHeadersTab'; @@ -6,11 +7,9 @@ import { useInheritedHeaders } from '../hooks/useInheritedHeaders'; import { deleteModelWithConfirm } from '../lib/deleteModelWithConfirm'; import { router } from '../lib/router'; import { CopyIconButton } from './CopyIconButton'; -import { Banner, InlineCode } from '@yaakapp-internal/ui'; import { Button } from './core/Button'; import { CountBadge } from './core/CountBadge'; import { PlainInput } from './core/PlainInput'; -import { HStack, VStack } from './core/Stacks'; import { TabContent, Tabs } from './core/Tabs/Tabs'; import { DnsOverridesEditor } from './DnsOverridesEditor'; import { HeadersEditor } from './HeadersEditor'; diff --git a/apps/yaak-client/components/core/Alert.tsx b/apps/yaak-client/components/core/Alert.tsx index fbb8368f..8b7c84d5 100644 --- a/apps/yaak-client/components/core/Alert.tsx +++ b/apps/yaak-client/components/core/Alert.tsx @@ -1,6 +1,6 @@ +import { HStack, VStack } from '@yaakapp-internal/ui'; import type { ReactNode } from 'react'; import { Button } from './Button'; -import { HStack, VStack } from './Stacks'; export interface AlertProps { onHide: () => void; diff --git a/apps/yaak-client/components/core/Checkbox.tsx b/apps/yaak-client/components/core/Checkbox.tsx index 34d541c1..595be4a8 100644 --- a/apps/yaak-client/components/core/Checkbox.tsx +++ b/apps/yaak-client/components/core/Checkbox.tsx @@ -1,8 +1,7 @@ +import { HStack, Icon } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import type { ReactNode } from 'react'; -import { Icon } from '@yaakapp-internal/ui'; import { IconTooltip } from './IconTooltip'; -import { HStack } from './Stacks'; export interface CheckboxProps { checked: boolean | 'indeterminate'; diff --git a/apps/yaak-client/components/core/Confirm.tsx b/apps/yaak-client/components/core/Confirm.tsx index 938c9442..a7c0b1f5 100644 --- a/apps/yaak-client/components/core/Confirm.tsx +++ b/apps/yaak-client/components/core/Confirm.tsx @@ -1,10 +1,10 @@ import type { Color } from '@yaakapp-internal/plugins'; +import { HStack } from '@yaakapp-internal/ui'; import type { FormEvent } from 'react'; import { useState } from 'react'; import { CopyIconButton } from '../CopyIconButton'; import { Button } from './Button'; import { PlainInput } from './PlainInput'; -import { HStack } from './Stacks'; export interface ConfirmProps { onHide: () => void; diff --git a/apps/yaak-client/components/core/Dialog.tsx b/apps/yaak-client/components/core/Dialog.tsx index 0dc9c416..5ceb50b4 100644 --- a/apps/yaak-client/components/core/Dialog.tsx +++ b/apps/yaak-client/components/core/Dialog.tsx @@ -1,11 +1,10 @@ +import type { DialogSize } from '@yaakapp-internal/plugins'; +import { Heading, Overlay } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import * as m from 'motion/react-m'; import type { ReactNode } from 'react'; import { useMemo } from 'react'; -import { Overlay } from '@yaakapp-internal/ui'; -import { Heading } from './Heading'; import { IconButton } from './IconButton'; -import type { DialogSize } from '@yaakapp-internal/plugins'; export interface DialogProps { children: ReactNode; diff --git a/apps/yaak-client/components/core/DismissibleBanner.tsx b/apps/yaak-client/components/core/DismissibleBanner.tsx index 92579934..5169e461 100644 --- a/apps/yaak-client/components/core/DismissibleBanner.tsx +++ b/apps/yaak-client/components/core/DismissibleBanner.tsx @@ -1,10 +1,9 @@ import type { Color } from '@yaakapp-internal/plugins'; +import type { BannerProps } from '@yaakapp-internal/ui'; +import { Banner, HStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { useKeyValue } from '../../hooks/useKeyValue'; -import type { BannerProps } from '@yaakapp-internal/ui'; -import { Banner } from '@yaakapp-internal/ui'; import { Button } from './Button'; -import { HStack } from './Stacks'; export function DismissibleBanner({ children, diff --git a/apps/yaak-client/components/core/Dropdown.tsx b/apps/yaak-client/components/core/Dropdown.tsx index e014d799..d022c660 100644 --- a/apps/yaak-client/components/core/Dropdown.tsx +++ b/apps/yaak-client/components/core/Dropdown.tsx @@ -1,3 +1,4 @@ +import { HStack, Icon, type IconProps, LoadingIcon, Overlay, VStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { atom } from 'jotai'; import * as m from 'motion/react-m'; @@ -32,12 +33,9 @@ import { generateId } from '../../lib/generateId'; import { getNodeText } from '../../lib/getNodeText'; import { jotaiStore } from '../../lib/jotai'; import { ErrorBoundary } from '../ErrorBoundary'; -import { Overlay } from '@yaakapp-internal/ui'; import { Button } from './Button'; import { Hotkey } from './Hotkey'; -import { Icon, LoadingIcon, type IconProps } from '@yaakapp-internal/ui'; import { Separator } from './Separator'; -import { HStack, VStack } from './Stacks'; export type DropdownItemSeparator = { type: 'separator'; diff --git a/apps/yaak-client/components/core/Editor/Editor.tsx b/apps/yaak-client/components/core/Editor/Editor.tsx index 01ff2d21..d435ad69 100644 --- a/apps/yaak-client/components/core/Editor/Editor.tsx +++ b/apps/yaak-client/components/core/Editor/Editor.tsx @@ -11,6 +11,7 @@ import { vscodeKeymap } from '@replit/codemirror-vscode-keymap'; import type { EditorKeymap } from '@yaakapp-internal/models'; import { settingsAtom } from '@yaakapp-internal/models'; import type { EditorLanguage, TemplateFunction } from '@yaakapp-internal/plugins'; +import { HStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import type { GraphQLSchema } from 'graphql'; import { useAtomValue } from 'jotai'; @@ -38,7 +39,6 @@ import { jotaiStore } from '../../../lib/jotai'; import { withEncryptionEnabled } from '../../../lib/setupOrConfigureEncryption'; import { TemplateFunctionDialog } from '../../TemplateFunctionDialog'; import { IconButton } from '../IconButton'; -import { HStack } from '../Stacks'; import './Editor.css'; import { baseExtensions, diff --git a/apps/yaak-client/components/core/EventViewer.tsx b/apps/yaak-client/components/core/EventViewer.tsx index 72cfba0c..1716ff85 100644 --- a/apps/yaak-client/components/core/EventViewer.tsx +++ b/apps/yaak-client/components/core/EventViewer.tsx @@ -1,4 +1,6 @@ import type { Virtualizer } from '@tanstack/react-virtual'; +import { Banner, HStack, SplitLayout } from '@yaakapp-internal/ui'; +import classNames from 'classnames'; import { format } from 'date-fns'; import type { ReactNode } from 'react'; import { useCallback, useMemo, useRef, useState } from 'react'; @@ -6,11 +8,8 @@ import { useEventViewerKeyboard } from '../../hooks/useEventViewerKeyboard'; import { CopyIconButton } from '../CopyIconButton'; import { AutoScroller } from './AutoScroller'; import { Button } from './Button'; -import { Separator } from './Separator'; -import { Banner, SplitLayout } from '@yaakapp-internal/ui'; -import { HStack } from './Stacks'; import { IconButton } from './IconButton'; -import classNames from 'classnames'; +import { Separator } from './Separator'; interface EventViewerProps { /** Array of events to display */ @@ -188,7 +187,11 @@ export function EventViewer({
- {renderDetail({ event: activeEvent, index: activeIndex ?? 0, onClose: handleClose })} + {renderDetail({ + event: activeEvent, + index: activeIndex ?? 0, + onClose: handleClose, + })}
) @@ -248,8 +251,21 @@ export function EventDetailHeader({ {formattedTime && ( {formattedTime} )} -
0 && "border-l border-l-surface-highlight ml-2 pl-3")}> - +
0 && 'border-l border-l-surface-highlight ml-2 pl-3'), + )} + > +
diff --git a/apps/yaak-client/components/core/Hotkey.tsx b/apps/yaak-client/components/core/Hotkey.tsx index 4a556a83..95e6910f 100644 --- a/apps/yaak-client/components/core/Hotkey.tsx +++ b/apps/yaak-client/components/core/Hotkey.tsx @@ -1,7 +1,7 @@ +import { HStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import type { HotkeyAction } from '../../hooks/useHotKey'; import { useFormattedHotkey } from '../../hooks/useHotKey'; -import { HStack } from './Stacks'; interface Props { action: HotkeyAction | null; diff --git a/apps/yaak-client/components/core/Input.tsx b/apps/yaak-client/components/core/Input.tsx index f36353e9..c165d044 100644 --- a/apps/yaak-client/components/core/Input.tsx +++ b/apps/yaak-client/components/core/Input.tsx @@ -1,5 +1,6 @@ import type { EditorView } from '@codemirror/view'; import type { Color } from '@yaakapp-internal/plugins'; +import { HStack, Icon, type IconProps } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import type { ReactNode } from 'react'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; @@ -22,11 +23,9 @@ import type { DropdownItem } from './Dropdown'; import { Dropdown } from './Dropdown'; import type { EditorProps } from './Editor/Editor'; import { Editor } from './Editor/LazyEditor'; -import { Icon, type IconProps } from '@yaakapp-internal/ui'; import { IconButton } from './IconButton'; import { IconTooltip } from './IconTooltip'; import { Label } from './Label'; -import { HStack } from './Stacks'; export type InputProps = Pick< EditorProps, diff --git a/apps/yaak-client/components/core/PlainInput.tsx b/apps/yaak-client/components/core/PlainInput.tsx index 96a96787..3b1c6949 100644 --- a/apps/yaak-client/components/core/PlainInput.tsx +++ b/apps/yaak-client/components/core/PlainInput.tsx @@ -1,3 +1,4 @@ +import { HStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import type { FocusEvent, HTMLAttributes, ReactNode } from 'react'; import { @@ -14,7 +15,6 @@ import { generateId } from '../../lib/generateId'; import { IconButton } from './IconButton'; import type { InputProps } from './Input'; import { Label } from './Label'; -import { HStack } from './Stacks'; export type PlainInputProps = Omit< InputProps, diff --git a/apps/yaak-client/components/core/Prompt.tsx b/apps/yaak-client/components/core/Prompt.tsx index f75b39af..4cba0082 100644 --- a/apps/yaak-client/components/core/Prompt.tsx +++ b/apps/yaak-client/components/core/Prompt.tsx @@ -1,10 +1,10 @@ import type { FormInput, JsonPrimitive } from '@yaakapp-internal/plugins'; +import { HStack } from '@yaakapp-internal/ui'; import type { FormEvent } from 'react'; import { useCallback, useEffect, useRef, useState } from 'react'; import { generateId } from '../../lib/generateId'; import { DynamicForm } from '../DynamicForm'; import { Button } from './Button'; -import { HStack } from './Stacks'; export interface PromptProps { inputs: FormInput[]; diff --git a/apps/yaak-client/components/core/SegmentedControl.tsx b/apps/yaak-client/components/core/SegmentedControl.tsx index 114d7384..39e24eb3 100644 --- a/apps/yaak-client/components/core/SegmentedControl.tsx +++ b/apps/yaak-client/components/core/SegmentedControl.tsx @@ -1,12 +1,12 @@ +import type { IconProps } from '@yaakapp-internal/ui'; +import { HStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { type ReactNode, useRef } from 'react'; import { useStateWithDeps } from '../../hooks/useStateWithDeps'; import { generateId } from '../../lib/generateId'; import { Button } from './Button'; -import type { IconProps } from '@yaakapp-internal/ui'; import { IconButton, type IconButtonProps } from './IconButton'; import { Label } from './Label'; -import { HStack } from './Stacks'; interface Props { options: { value: T; label: string; icon?: IconProps['icon'] }[]; diff --git a/apps/yaak-client/components/core/Select.tsx b/apps/yaak-client/components/core/Select.tsx index de8d7690..7b948a36 100644 --- a/apps/yaak-client/components/core/Select.tsx +++ b/apps/yaak-client/components/core/Select.tsx @@ -1,4 +1,5 @@ import { type } from '@tauri-apps/plugin-os'; +import { HStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import type { CSSProperties, ReactNode } from 'react'; import { useState } from 'react'; @@ -7,7 +8,6 @@ import { Button } from './Button'; import { Label } from './Label'; import type { RadioDropdownItem } from './RadioDropdown'; import { RadioDropdown } from './RadioDropdown'; -import { HStack } from './Stacks'; export interface SelectProps { name: string; diff --git a/apps/yaak-client/components/core/Toast.tsx b/apps/yaak-client/components/core/Toast.tsx index 9451f69e..9396240e 100644 --- a/apps/yaak-client/components/core/Toast.tsx +++ b/apps/yaak-client/components/core/Toast.tsx @@ -1,12 +1,10 @@ import type { ShowToastRequest } from '@yaakapp-internal/plugins'; +import { Icon, type IconProps, VStack } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import * as m from 'motion/react-m'; import type { ReactNode } from 'react'; - import { useKey } from 'react-use'; -import { Icon, type IconProps } from '@yaakapp-internal/ui'; import { IconButton } from './IconButton'; -import { VStack } from './Stacks'; export interface ToastProps { children: ReactNode; diff --git a/apps/yaak-client/components/git/BranchSelectionDialog.tsx b/apps/yaak-client/components/git/BranchSelectionDialog.tsx index e2287913..6a5279c6 100644 --- a/apps/yaak-client/components/git/BranchSelectionDialog.tsx +++ b/apps/yaak-client/components/git/BranchSelectionDialog.tsx @@ -1,7 +1,7 @@ +import { HStack, VStack } from '@yaakapp-internal/ui'; import { useState } from 'react'; import { Button } from '../core/Button'; import { Select } from '../core/Select'; -import { HStack, VStack } from '../core/Stacks'; interface Props { branches: string[]; diff --git a/apps/yaak-client/components/git/GitCommitDialog.tsx b/apps/yaak-client/components/git/GitCommitDialog.tsx index 7aed055d..f8c1e62f 100644 --- a/apps/yaak-client/components/git/GitCommitDialog.tsx +++ b/apps/yaak-client/components/git/GitCommitDialog.tsx @@ -1,4 +1,3 @@ - import type { GitStatusEntry } from '@yaakapp-internal/git'; import { useGit } from '@yaakapp-internal/git'; import type { @@ -9,6 +8,7 @@ import type { WebsocketRequest, Workspace, } from '@yaakapp-internal/models'; +import { Banner, HStack, Icon, InlineCode, SplitLayout } from '@yaakapp-internal/ui'; import classNames from 'classnames'; import { useCallback, useMemo, useState } from 'react'; import { modelToYaml } from '../../lib/diffYaml'; @@ -18,10 +18,8 @@ import { Button } from '../core/Button'; import type { CheckboxProps } from '../core/Checkbox'; import { Checkbox } from '../core/Checkbox'; import { DiffViewer } from '../core/Editor/DiffViewer'; -import { Banner, Icon, InlineCode, SplitLayout } from '@yaakapp-internal/ui'; import { Input } from '../core/Input'; import { Separator } from '../core/Separator'; -import { HStack } from '../core/Stacks'; import { EmptyStateText } from '../EmptyStateText'; import { gitCallbacks } from './callbacks'; import { handlePushResult } from './git-util'; diff --git a/apps/yaak-client/components/git/diverged.tsx b/apps/yaak-client/components/git/diverged.tsx index 9d16d465..46b98f86 100644 --- a/apps/yaak-client/components/git/diverged.tsx +++ b/apps/yaak-client/components/git/diverged.tsx @@ -1,10 +1,9 @@ import type { DivergedStrategy } from '@yaakapp-internal/git'; +import { HStack, InlineCode } from '@yaakapp-internal/ui'; import { useState } from 'react'; import { showDialog } from '../../lib/dialog'; -import { InlineCode } from '@yaakapp-internal/ui'; import { Button } from '../core/Button'; import { RadioCards } from '../core/RadioCards'; -import { HStack } from '../core/Stacks'; type Resolution = 'force_reset' | 'merge'; @@ -40,7 +39,8 @@ function DivergedDialog({ remote, branch, onResult, onHide }: DivergedDialogProp Your local branch has diverged from{' '} {remote}/{branch} - . How would you like to resolve this? + + . How would you like to resolve this?

("show_toast", (event) => { + listenToTauriEvent('show_toast', (event) => { showToast({ ...event.payload }); }); // Show errors for any plugins that failed to load during startup - invokeCmd<[string, string][]>("cmd_plugin_init_errors").then((errors) => { + invokeCmd<[string, string][]>('cmd_plugin_init_errors').then((errors) => { for (const [dir, err] of errors) { const name = dir.split(/[/\\]/).pop() ?? dir; showToast({ id: `plugin-init-error-${name}`, - color: "danger", + color: 'danger', timeout: null, message: `Failed to load plugin "${name}": ${err}`, }); } }); - listenToTauriEvent("settings", () => openSettings.mutate(null)); + listenToTauriEvent('settings', () => openSettings.mutate(null)); // Track active dynamic form dialogs so follow-up input updates can reach them const activeForms = new Map void>(); // Listen for plugin events - listenToTauriEvent( - "plugin_event", - async ({ payload: event }) => { - if (event.payload.type === "prompt_text_request") { - const value = await showPrompt(event.payload); + listenToTauriEvent('plugin_event', async ({ payload: event }) => { + if (event.payload.type === 'prompt_text_request') { + const value = await showPrompt(event.payload); + const result: InternalEvent = { + id: generateId(), + replyId: event.id, + pluginName: event.pluginName, + pluginRefId: event.pluginRefId, + context: event.context, + payload: { + type: 'prompt_text_response', + value, + }, + }; + await emit(event.id, result); + } else if (event.payload.type === 'prompt_form_request') { + if (event.replyId != null) { + // Follow-up update from plugin runtime — update the active dialog's inputs + const updateInputs = activeForms.get(event.replyId); + if (updateInputs) { + updateInputs(event.payload.inputs); + } + return; + } + + // Initial request — show the dialog with bidirectional support + const emitFormResponse = (values: Record | null, done: boolean) => { const result: InternalEvent = { id: generateId(), replyId: event.id, @@ -67,105 +88,66 @@ export function initGlobalListeners() { pluginRefId: event.pluginRefId, context: event.context, payload: { - type: "prompt_text_response", - value, + type: 'prompt_form_response', + values, + done, }, }; - await emit(event.id, result); - } else if (event.payload.type === "prompt_form_request") { - if (event.replyId != null) { - // Follow-up update from plugin runtime — update the active dialog's inputs - const updateInputs = activeForms.get(event.replyId); - if (updateInputs) { - updateInputs(event.payload.inputs); - } - return; - } + emit(event.id, result); + }; - // Initial request — show the dialog with bidirectional support - const emitFormResponse = ( - values: Record | null, - done: boolean, - ) => { - const result: InternalEvent = { - id: generateId(), - replyId: event.id, - pluginName: event.pluginName, - pluginRefId: event.pluginRefId, - context: event.context, - payload: { - type: "prompt_form_response", - values, - done, - }, - }; - emit(event.id, result); - }; + const values = await showPromptForm({ + id: event.payload.id, + title: event.payload.title, + description: event.payload.description, + size: event.payload.size, + inputs: event.payload.inputs, + confirmText: event.payload.confirmText, + cancelText: event.payload.cancelText, + onValuesChange: debounce((values) => emitFormResponse(values, false), 150), + onInputsUpdated: (cb) => activeForms.set(event.id, cb), + }); - const values = await showPromptForm({ - id: event.payload.id, - title: event.payload.title, - description: event.payload.description, - size: event.payload.size, - inputs: event.payload.inputs, - confirmText: event.payload.confirmText, - cancelText: event.payload.cancelText, - onValuesChange: debounce( - (values) => emitFormResponse(values, false), - 150, - ), - onInputsUpdated: (cb) => activeForms.set(event.id, cb), - }); + // Clean up and send final response + activeForms.delete(event.id); + emitFormResponse(values, true); + } + }); - // Clean up and send final response - activeForms.delete(event.id); - emitFormResponse(values, true); - } - }, - ); - - listenToTauriEvent( - "update_installed", - async ({ payload: version }) => { - console.log("Got update installed event", version); - showUpdateInstalledToast(version); - }, - ); + listenToTauriEvent('update_installed', async ({ payload: version }) => { + console.log('Got update installed event', version); + showUpdateInstalledToast(version); + }); // Listen for update events - listenToTauriEvent("update_available", async ({ payload }) => { - console.log("Got update available", payload); + listenToTauriEvent('update_available', async ({ payload }) => { + console.log('Got update available', payload); showUpdateAvailableToast(payload); }); - listenToTauriEvent("notification", ({ payload }) => { - console.log("Got notification event", payload); + listenToTauriEvent('notification', ({ payload }) => { + console.log('Got notification event', payload); showNotificationToast(payload); }); // Listen for plugin update events - listenToTauriEvent( - "plugin_updates_available", - ({ payload }) => { - console.log("Got plugin updates event", payload); - showPluginUpdatesToast(payload); - }, - ); + listenToTauriEvent('plugin_updates_available', ({ payload }) => { + console.log('Got plugin updates event', payload); + showPluginUpdatesToast(payload); + }); } function showUpdateInstalledToast(version: string) { - const UPDATE_TOAST_ID = "update-info"; + const UPDATE_TOAST_ID = 'update-info'; showToast({ id: UPDATE_TOAST_ID, - color: "primary", + color: 'primary', timeout: null, message: (

Yaak {version} was installed

-

- Start using the new version now? -

+

Start using the new version now?

), action: ({ hide }) => ( @@ -176,7 +158,7 @@ function showUpdateInstalledToast(version: string) { loadingChildren="Restarting..." onClick={() => { hide(); - setTimeout(() => invokeCmd("cmd_restart", {}), 200); + setTimeout(() => invokeCmd('cmd_restart', {}), 200); }} > Relaunch Yaak @@ -186,24 +168,23 @@ function showUpdateInstalledToast(version: string) { } async function showUpdateAvailableToast(updateInfo: UpdateInfo) { - const UPDATE_TOAST_ID = "update-info"; + const UPDATE_TOAST_ID = 'update-info'; const { version, replyEventId, downloaded } = updateInfo; jotaiStore.set(updateAvailableAtom, { version, downloaded }); // Acknowledge the event, so we don't time out and try the fallback update logic - await emit(replyEventId, { type: "ack" }); + await emit(replyEventId, { type: 'ack' }); showToast({ id: UPDATE_TOAST_ID, - color: "info", + color: 'info', timeout: null, message: (

Yaak {version} is available

- {downloaded ? "Do you want to install" : "Download and install"} the - update? + {downloaded ? 'Do you want to install' : 'Download and install'} the update?

), @@ -213,15 +194,15 @@ async function showUpdateAvailableToast(updateInfo: UpdateInfo) { size="xs" color="info" className="min-w-[10rem]" - loadingChildren={downloaded ? "Installing..." : "Downloading..."} + loadingChildren={downloaded ? 'Installing...' : 'Downloading...'} onClick={async () => { await emit(replyEventId, { - type: "action", - action: "install", + type: 'action', + action: 'install', }); }} > - {downloaded ? "Install Now" : "Download and Install"} + {downloaded ? 'Install Now' : 'Download and Install'}