Move svelte lib components into a flat directory

This commit is contained in:
Mattias Granlund 2023-11-01 11:45:36 +01:00
parent fb7a327cef
commit f10a443606
49 changed files with 71 additions and 74 deletions

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { onMount, type ComponentType } from 'svelte';
import { IconLoading } from '../../icons';
import { IconLoading } from '../icons';
let classes = '';
export { classes as class };

View File

@ -1,2 +0,0 @@
import Button from './Button.svelte';
export default Button;

View File

@ -1,2 +0,0 @@
import Checkbox from './Checkbox.svelte';
export default Checkbox;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { onMount } from 'svelte';
import { IconExternalLink } from '../../icons';
import { IconExternalLink } from '../icons';
import { open } from '@tauri-apps/api/shell';
let classes = '';

View File

@ -1,2 +0,0 @@
import Link from './Link.svelte';
export default Link;

View File

@ -4,8 +4,7 @@
import { userStore } from '$lib/stores/user';
import { derived, writable } from '@square/svelte-store';
import { open } from '@tauri-apps/api/shell';
import Button from './Button';
import { goto } from '$app/navigation';
import Button from './Button.svelte';
const cloud = getCloudApiClient();
const user = userStore;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import Button from '../Button/Button.svelte';
import Overlay from '../Overlay/Overlay.svelte';
import Button from './Button.svelte';
import Overlay from './Overlay.svelte';
import { IconClose } from '$lib/icons';
import type { ComponentType } from 'svelte';

View File

@ -1,2 +0,0 @@
import Modal from './Modal.svelte';
export default Modal;

View File

@ -1,2 +0,0 @@
import Tooltip from './Tooltip.svelte';
export default Tooltip;

View File

@ -1,10 +0,0 @@
export { default as Login } from './Login.svelte';
export { default as Modal } from './Modal';
export { default as Tooltip } from './Tooltip';
export { default as Button } from './Button';
export { default as Link } from './Link';
export { default as Differ } from './Differ';
export { default as DeltasViewer } from './DeltasViewer.svelte';
export { default as DiffContext } from './DiffContext.svelte';
export { default as Checkbox } from './Checkbox';
export { default as Stats } from './Stats.svelte';

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { LayoutData } from './$types';
import { Button } from '$lib/components';
import Button from '$lib/components/Button.svelte';
import * as events from '$lib/events';
export let data: LayoutData;

View File

@ -1,6 +1,5 @@
<script lang="ts">
import leven from 'leven';
import { Button, Modal } from '$lib/components';
import { asyncDerived } from '@square/svelte-store';
import { compareDesc, formatDistanceToNow } from 'date-fns';
import { IconFolder, IconLoading } from '$lib/icons';
@ -10,6 +9,8 @@
import * as toasts from '$lib/toasts';
import IconFolderPlus from '$lib/icons/IconFolderPlus.svelte';
import { goto } from '$app/navigation';
import Modal from '$lib/components/Modal.svelte';
import Button from '$lib/components/Button.svelte';
export let projects: typeof projectsStore;
export let cloud: ReturnType<typeof getCloudApiClient>;

View File

@ -1,9 +1,11 @@
<script lang="ts">
import * as toasts from '$lib/toasts';
import * as zip from '$lib/api/ipc/zip';
import { Button, Checkbox, Modal } from '$lib/components';
import { page } from '$app/stores';
import type { User, getCloudApiClient } from '$lib/api/cloud/api';
import Modal from '$lib/components/Modal.svelte';
import Checkbox from '$lib/components/Checkbox.svelte';
import Button from '$lib/components/Button.svelte';
export let user: User | undefined;
export let cloud: ReturnType<typeof getCloudApiClient>;

View File

@ -1,7 +1,6 @@
<script lang="ts">
import Board from './Board.svelte';
import type { PageData } from './$types';
import { Button, Link } from '$lib/components';
import { BranchController } from '$lib/vbranches/branchController';
import { getContext, onMount } from 'svelte';
import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/userSettings';
@ -29,6 +28,8 @@
import type { GitHubIntegrationContext } from '$lib/github/types';
import { getAuthenticatedWithCache } from '$lib/github/user';
import Navigation from './Navigation.svelte';
import Link from '$lib/components/Link.svelte';
import Button from '$lib/components/Button.svelte';
export let data: PageData;
let { projectId, project, cloud, update } = data;

View File

@ -1,10 +1,12 @@
<script lang="ts">
import { Button, Modal, Tooltip } from '$lib/components';
import type { BaseBranch } from '$lib/vbranches/types';
import CommitCard from './CommitCard.svelte';
import type { BranchController } from '$lib/vbranches/branchController';
import Scrollbar from '$lib/components/Scrollbar.svelte';
import { projectMergeUpstreamWarningDismissed } from '$lib/config/config';
import Tooltip from '$lib/components/Tooltip.svelte';
import Button from '$lib/components/Button.svelte';
import Modal from '$lib/components/Modal.svelte';
export let base: BaseBranch;
export let projectId: string;

View File

@ -1,7 +1,7 @@
<script async lang="ts">
import { goto } from '$app/navigation';
import BackButton from '$lib/components/BackButton.svelte';
import Button from '$lib/components/Button/Button.svelte';
import Button from '$lib/components/Button.svelte';
import IconChevronLeft from '$lib/icons/IconChevronLeft.svelte';
import IconExternalLink from '$lib/icons/IconExternalLink.svelte';
import IconLoading from '$lib/icons/IconLoading.svelte';

View File

@ -3,7 +3,7 @@
import { IconTriangleUp, IconTriangleDown } from '$lib/icons';
import type { BaseBranch } from '$lib/vbranches/types';
import type { SettingsStore } from '$lib/userSettings';
import TimeAgo from '$lib/components/TimeAgo/TimeAgo.svelte';
import TimeAgo from '$lib/components/TimeAgo.svelte';
import Resizer from '$lib/components/Resizer.svelte';
export let base: BaseBranch | undefined;

View File

@ -3,7 +3,6 @@
import type { BaseBranch, Branch } from '$lib/vbranches/types';
import { getContext, onDestroy, onMount } from 'svelte';
import { Ownership } from '$lib/vbranches/ownership';
import { Button, Link, Modal, Tooltip } from '$lib/components';
import IconKebabMenu from '$lib/icons/IconKebabMenu.svelte';
import CommitCard from './CommitCard.svelte';
import { getExpandedWithCacheFallback, setExpandedWithCache } from './cache';
@ -36,6 +35,10 @@
import { getPullRequestByBranch, createPullRequest } from '$lib/github/pullrequest';
import type { GitHubIntegrationContext } from '$lib/github/types';
import PushButton from './PushButton.svelte';
import Tooltip from '$lib/components/Tooltip.svelte';
import Button from '$lib/components/Button.svelte';
import Link from '$lib/components/Link.svelte';
import Modal from '$lib/components/Modal.svelte';
const [send, receive] = crossfade({
duration: (d) => Math.sqrt(d * 200),

View File

@ -1,6 +1,6 @@
<script lang="ts">
import PopupMenu from '$lib/components/PopupMenu/PopupMenu.svelte';
import PopupMenuItem from '$lib/components/PopupMenu/PopupMenuItem.svelte';
import PopupMenu from '$lib/components/PopupMenu.svelte';
import PopupMenuItem from '$lib/components/PopupMenuItem.svelte';
import type { BranchController } from '$lib/vbranches/branchController';
import { createEventDispatcher } from 'svelte';

View File

@ -1,13 +1,14 @@
<script lang="ts">
import { RemoteFile, type RemoteCommit } from '$lib/vbranches/types';
import TimeAgo from '$lib/components/TimeAgo/TimeAgo.svelte';
import TimeAgo from '$lib/components/TimeAgo.svelte';
import { getVSIFileIcon } from '$lib/ext-icons';
import { ContentSection, HunkSection, parseFileSections } from './fileSections';
import RenderedLine from './RenderedLine.svelte';
import { IconExpandUpDown, IconExpandUp, IconExpandDown } from '$lib/icons';
import { Button, Modal } from '$lib/components';
import { invoke } from '$lib/ipc';
import { plainToInstance } from 'class-transformer';
import Modal from '$lib/components/Modal.svelte';
import Button from '$lib/components/Button.svelte';
export let commit: RemoteCommit;
export let projectId: string;

View File

@ -6,7 +6,6 @@
import type { Branch, File } from '$lib/vbranches/types';
import type { getCloudApiClient } from '$lib/api/cloud/api';
import type { User } from '$lib/api/cloud';
import { Button, Tooltip } from '$lib/components';
import { IconAISparkles, IconLoading, IconTriangleDown, IconTriangleUp } from '$lib/icons';
import {
projectCommitGenerationExtraConcise,
@ -14,6 +13,8 @@
} from '$lib/config/config';
import { createEventDispatcher } from 'svelte';
import type { Ownership } from '$lib/vbranches/ownership';
import Tooltip from '$lib/components/Tooltip.svelte';
import Button from '$lib/components/Button.svelte';
export let projectId: string;
export let branchController: BranchController;

View File

@ -20,7 +20,7 @@
import { slide } from 'svelte/transition';
import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/userSettings';
import { summarizeHunk } from '$lib/summaries';
import Tooltip from '$lib/components/Tooltip/Tooltip.svelte';
import Tooltip from '$lib/components/Tooltip.svelte';
import IconLock from '$lib/icons/IconLock.svelte';
import HunkContextMenu from './HunkContextMenu.svelte';

View File

@ -3,9 +3,9 @@
</script>
<script lang="ts">
import { Checkbox } from '$lib/components';
import Checkbox from '$lib/components/Checkbox.svelte';
import { writable } from 'svelte/store';
import TimeAgo from '$lib/components/TimeAgo/TimeAgo.svelte';
import TimeAgo from '$lib/components/TimeAgo.svelte';
import IconChevronDownSmall from '$lib/icons/IconChevronDownSmall.svelte';
import IconChevronRightSmall from '$lib/icons/IconChevronRightSmall.svelte';
import IconFile from '$lib/icons/IconFile.svelte';

View File

@ -1,6 +1,6 @@
<script lang="ts">
import PopupMenu from '$lib/components/PopupMenu/PopupMenu.svelte';
import PopupMenuItem from '$lib/components/PopupMenu/PopupMenuItem.svelte';
import PopupMenu from '$lib/components/PopupMenu.svelte';
import PopupMenuItem from '$lib/components/PopupMenuItem.svelte';
import type { BranchController } from '$lib/vbranches/branchController';
import type { File } from '$lib/vbranches/types';
import { open } from '@tauri-apps/api/shell';

View File

@ -6,15 +6,15 @@
import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/userSettings';
import { getContext } from 'svelte';
import type { BranchController } from '$lib/vbranches/branchController';
import Tooltip from '$lib/components/Tooltip/Tooltip.svelte';
import Tooltip from '$lib/components/Tooltip.svelte';
import Scrollbar from '$lib/components/Scrollbar.svelte';
import { derived, get, readable, type Loadable, type Readable } from '@square/svelte-store';
import PeekTray from './PeekTray.svelte';
import IconRefresh from '$lib/icons/IconRefresh.svelte';
import IconGithub from '$lib/icons/IconGithub.svelte';
import TimeAgo from '$lib/components/TimeAgo/TimeAgo.svelte';
import Button from '$lib/components/Button/Button.svelte';
import Modal from '$lib/components/Modal/Modal.svelte';
import TimeAgo from '$lib/components/TimeAgo.svelte';
import Button from '$lib/components/Button.svelte';
import Modal from '$lib/components/Modal.svelte';
import Resizer from '$lib/components/Resizer.svelte';
import IconButton from '$lib/components/IconButton.svelte';
import type { User, getCloudApiClient } from '$lib/api/cloud/api';
@ -26,7 +26,7 @@
import { PullRequest } from '$lib/github/types';
import PullRequests from './PullRequests.svelte';
import IconHome from '$lib/icons/IconHome.svelte';
import Link from '$lib/components/Link/Link.svelte';
import Link from '$lib/components/Link.svelte';
import IconSettings from '$lib/icons/IconSettings.svelte';
import UpdateButton from './UpdateButton.svelte';
import type { Update } from '$lib/updater';

View File

@ -1,9 +1,10 @@
<script lang="ts">
import Button from '$lib/components/Button/Button.svelte';
import Button from '$lib/components/Button.svelte';
import type { BranchController } from '$lib/vbranches/branchController';
import { Link, Tooltip } from '$lib/components';
import type { PullRequest } from '$lib/github/types';
import { IconPullRequest, IconDraftPullRequest } from '$lib/icons';
import Link from '$lib/components/Link.svelte';
import Tooltip from '$lib/components/Tooltip.svelte';
export let pullrequest: PullRequest | undefined;
export let branchController: BranchController;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import type { GitHubIntegrationContext } from '$lib/github/types';
import { listPullRequestsWithCache } from '$lib/github/pullrequest';
import TimeAgo from '$lib/components/TimeAgo/TimeAgo.svelte';
import TimeAgo from '$lib/components/TimeAgo.svelte';
import { IconPullRequest, IconDraftPullRequest, IconFilter, IconFilterFilled } from '$lib/icons';
import Scrollbar from '$lib/components/Scrollbar.svelte';
import { accordion } from './accordion';

View File

@ -7,7 +7,7 @@
IconTriangleUp
} from '$lib/icons';
import { projectCreatePullRequestInsteadOfPush } from '$lib/config/config';
import { Tooltip } from '$lib/components';
import Tooltip from '$lib/components/Tooltip.svelte';
import type { GitHubIntegrationContext } from '$lib/github/types';
import { createEventDispatcher } from 'svelte';

View File

@ -1,5 +1,5 @@
<script lang="ts">
import Button from '$lib/components/Button/Button.svelte';
import Button from '$lib/components/Button.svelte';
import type { BranchController } from '$lib/vbranches/branchController';
import type { RemoteBranch } from '$lib/vbranches/types';
import CommitCard from './CommitCard.svelte';

View File

@ -1,11 +1,11 @@
<script lang="ts">
import { Link } from '$lib/components';
import Link from '$lib/components/Link.svelte';
import { IconGitBranch, IconRemote } from '$lib/icons';
import IconHelp from '$lib/icons/IconHelp.svelte';
import Scrollbar from '$lib/components/Scrollbar.svelte';
import Tooltip from '$lib/components/Tooltip/Tooltip.svelte';
import Tooltip from '$lib/components/Tooltip.svelte';
import { IconTriangleDown } from '$lib/icons';
import TimeAgo from '$lib/components/TimeAgo/TimeAgo.svelte';
import TimeAgo from '$lib/components/TimeAgo.svelte';
import { accordion } from './accordion';
import type { CustomStore, RemoteBranch, BaseBranch, Branch } from '$lib/vbranches/types';
import type { Readable } from '@square/svelte-store';

View File

@ -1,7 +1,7 @@
<script lang="ts">
import Button from '$lib/components/Button/Button.svelte';
import Modal from '$lib/components/Modal';
import Tooltip from '$lib/components/Tooltip/Tooltip.svelte';
import Button from '$lib/components/Button.svelte';
import Modal from '$lib/components/Modal.svelte';
import Tooltip from '$lib/components/Tooltip.svelte';
import type { BranchController } from '$lib/vbranches/branchController';
import type { Branch } from '$lib/vbranches/types';
import CommitCard from './CommitCard.svelte';

View File

@ -1,5 +1,4 @@
<script lang="ts">
import { Button, Modal } from '$lib/components';
import * as toasts from '$lib/toasts';
import { userStore } from '$lib/stores/user';
import { goto } from '$app/navigation';
@ -9,8 +8,9 @@
import * as projects from '$lib/api/ipc/projects';
import { projectsStore } from '$lib/api/ipc/projects';
import type { PageData } from './$types';
import IconChevronLeft from '$lib/icons/IconChevronLeft.svelte';
import BackButton from '$lib/components/BackButton.svelte';
import Modal from '$lib/components/Modal.svelte';
import Button from '$lib/components/Button.svelte';
export let data: PageData;
const { project, cloud } = data;

View File

@ -3,8 +3,9 @@
import { getCloudApiClient } from '$lib/api/cloud/api';
import type { Project } from '$lib/api/ipc/projects';
import { userStore } from '$lib/stores/user';
import { Login, Checkbox } from '$lib/components';
import { createEventDispatcher, onMount } from 'svelte';
import Checkbox from '$lib/components/Checkbox.svelte';
import Login from '$lib/components/Login.svelte';
export let project: Project;
const user = userStore;

View File

@ -1,9 +1,10 @@
<script lang="ts">
import type { Key, Project } from '$lib/api/ipc/projects';
import { Button, Link } from '$lib/components';
import { invoke } from '$lib/ipc';
import { copyToClipboard } from '$lib/clipboard';
import { createEventDispatcher } from 'svelte';
import Button from '$lib/components/Button.svelte';
import Link from '$lib/components/Link.svelte';
export let project: Project;

View File

@ -1,9 +1,10 @@
<script lang="ts">
import type { LayoutData } from './$types';
import { Button, Tooltip } from '$lib/components';
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import { IconRewind, IconSearch, IconSettings } from '$lib/icons';
import Tooltip from '$lib/components/Tooltip.svelte';
import Button from '$lib/components/Button.svelte';
export let data: LayoutData;
const { project } = data;

View File

@ -4,7 +4,7 @@
import { IconGitBranch } from '$lib/icons';
import { asyncDerived } from '@square/svelte-store';
import FileSummaries from './FileSummaries.svelte';
import { Tooltip } from '$lib/components';
import Tooltip from '$lib/components/Tooltip.svelte';
export let data: PageData;
const { project, sessions, head } = data;

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { Button } from '$lib/components';
import Button from '$lib/components/Button.svelte';
import { getCloudApiClient } from '$lib/api/cloud/api';
import { userStore } from '$lib/stores/user';
import type { Project } from '$lib/api/ipc/projects';

View File

@ -4,7 +4,7 @@
import { generateBuckets } from './histogram';
import FileActivity from './FileActivity.svelte';
import { page } from '$app/stores';
import { Link } from '$lib/components';
import Link from '$lib/components/Link.svelte';
import { IconRewind, IconPlayerPlayFilled, IconLoading, IconSparkle } from '$lib/icons';
import { collapse } from '$lib/paths';
import type { Session } from '$lib/api/ipc/sessions';

View File

@ -1,8 +1,9 @@
<script lang="ts">
import * as toasts from '$lib/toasts';
import * as bookmarks from '$lib/api/ipc/bookmarks';
import { Button, Modal } from '$lib/components';
import { IconBookmarkFilled } from '$lib/icons';
import Modal from '$lib/components/Modal.svelte';
import Button from '$lib/components/Button.svelte';
export let projectId: string;

View File

@ -7,7 +7,7 @@
import { getBookmarksStore } from '$lib/stores/bookmarks';
import { IconBookmarkFilled } from '$lib/icons';
import { line } from '$lib/diff';
import { Stats } from '$lib/components';
import Stats from '$lib/components/Stats.svelte';
export let isCurrent: boolean;
export let session: Session;

View File

@ -2,8 +2,7 @@
import type { Session } from '$lib/api/ipc/sessions';
import type { Delta } from '$lib/api/ipc/deltas';
import type { Frame } from './frame';
import { DeltasViewer } from '$lib/components';
import type { Loadable, Readable } from '@square/svelte-store';
import DeltasViewer from '$lib/components/DeltasViewer.svelte';
export let context: number;
export let fullContext: boolean;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import type { Delta } from '$lib/api/ipc/deltas';
import { IconPlayerPauseFilled, IconPlayerPlayFilled } from '$lib/icons';
import { DiffContext } from '$lib/components';
import DiffContext from '$lib/components/DiffContext.svelte';
import { unsubscribe } from '$lib/utils';
import { onMount } from 'svelte';
import * as hotkeys from '$lib/hotkeys';

View File

@ -1,5 +1,4 @@
<script lang="ts">
import { Button, Modal, Login, Link } from '$lib/components';
import type { PageData } from './$types';
import * as toasts from '$lib/toasts';
import { initDeviceOauth, checkAuthStatus } from '$lib/api/ipc/github';
@ -13,6 +12,10 @@
import { invoke } from '@tauri-apps/api/tauri';
import { copyToClipboard } from '$lib/clipboard';
import BackButton from '$lib/components/BackButton.svelte';
import Link from '$lib/components/Link.svelte';
import Login from '$lib/components/Login.svelte';
import Button from '$lib/components/Button.svelte';
import Modal from '$lib/components/Modal.svelte';
export let data: PageData;
const { cloud } = data;