Skip to content

Commit

Permalink
feat(repository): add import grouping and sorting with prettier
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Shatford <[email protected]>
  • Loading branch information
jordanshatford committed Apr 23, 2024
1 parent c2f54bc commit e198307
Show file tree
Hide file tree
Showing 64 changed files with 673 additions and 340 deletions.
13 changes: 7 additions & 6 deletions apps/extension/src/entrypoints/options/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
import { AudioFormatEnum, DownloadQualityEnum, VideoFormatEnum } from '@yd/client';
import {
Alert,
toast,
Select,
Tabs,
DownloadIcon,
CodeBracketIcon,
LoaderIcon,
DownloadIcon,
Icon,
LoaderIcon,
Select,
Tabs,
toast,
Toggle,
toSelectOptions
} from '@yd/ui';
import { settings } from '~/lib/stores/settings';
import PageLayout from '~/lib/components/PageLayout.svelte';
import { settings } from '~/lib/stores/settings';
let tabs = [
{
Expand Down
1 change: 1 addition & 0 deletions apps/extension/src/entrypoints/options/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '~/assets/tailwind.css';

import App from './App.svelte';

const app = new App({
Expand Down
1 change: 1 addition & 0 deletions apps/extension/src/entrypoints/popup/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '~/assets/tailwind.css';

import App from './App.svelte';

const app = new App({
Expand Down
1 change: 1 addition & 0 deletions apps/extension/src/lib/components/DownloadActions.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import type { Download } from '@yd/client';
import { ActionIcon, ArrowPathIcon, ButtonGroup, Confirm, DownloadIcon, TrashIcon } from '@yd/ui';
import { createContextStore } from '~/lib/stores/context';
export let store: ReturnType<typeof createContextStore>;
Expand Down
5 changes: 3 additions & 2 deletions apps/extension/src/lib/components/PageLayout.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import { IconButton, ExternalLinkIcon, Toasts, Footer, initializeTheme } from '@yd/ui';
import { openWebsite } from '~/lib/website';
import { ExternalLinkIcon, Footer, IconButton, initializeTheme, Toasts } from '@yd/ui';
import config from '~/lib/config';
import { openWebsite } from '~/lib/website';
// Ensure theme is set based on user preferences.
initializeTheme();
Expand Down
7 changes: 4 additions & 3 deletions apps/extension/src/lib/components/PopupLayout.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script lang="ts">
import { IconButton, ExternalLinkIcon, GearIcon, initializeTheme } from '@yd/ui';
import { openWebsite } from '~/lib/website';
import { getContextService } from '~/lib/context-service';
import { ExternalLinkIcon, GearIcon, IconButton, initializeTheme } from '@yd/ui';
import PopupError from '~/lib/components/PopupError.svelte';
import PopupLoader from '~/lib/components/PopupLoader.svelte';
import { getContextService } from '~/lib/context-service';
import { openWebsite } from '~/lib/website';
// Ensure theme is set based on user preferences.
initializeTheme();
Expand Down
8 changes: 5 additions & 3 deletions apps/extension/src/lib/components/PopupMain.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script lang="ts">
import { onMount } from 'svelte';
import { Card, Button, Badge, IconButton, PlusIcon } from '@yd/ui';
import { Badge, Button, Card, IconButton, PlusIcon } from '@yd/ui';
import type { Ctx } from '~/lib/context-service';
import DownloadActions from '~/lib/components/DownloadActions.svelte';
import PopupError from '~/lib/components/PopupError.svelte';
import StateIcon from '~/lib/components/StateIcon.svelte';
import StatusBadge from '~/lib/components/StatusBadge.svelte';
import { createContextStore } from '~/lib/stores/context';
import PopupError from '~/lib/components/PopupError.svelte';
import DownloadActions from '~/lib/components/DownloadActions.svelte';
export let ctx: Ctx;
Expand Down
9 changes: 2 additions & 7 deletions apps/extension/src/lib/components/StateIcon.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<script lang="ts">
import type { DownloadState } from '@yd/client';
import {
CheckCircleIcon,
LoaderIcon,
ExclamationCircleIcon,
Icon,
type IconSource
} from '@yd/ui';
import type { IconSource } from '@yd/ui';
import { CheckCircleIcon, ExclamationCircleIcon, Icon, LoaderIcon } from '@yd/ui';
export let state: DownloadState;
Expand Down
5 changes: 3 additions & 2 deletions apps/extension/src/lib/components/StatusBadge.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import type { DownloadStatus, DownloadState } from '@yd/client';
import { Badge, type BadgeVariants, ProgressBar } from '@yd/ui';
import type { DownloadState, DownloadStatus } from '@yd/client';
import type { BadgeVariants } from '@yd/ui';
import { Badge, ProgressBar } from '@yd/ui';
export let status: DownloadStatus;
Expand Down
4 changes: 3 additions & 1 deletion apps/extension/src/lib/context-menu.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { Tabs, Menus } from 'webextension-polyfill';
import type { Menus, Tabs } from 'webextension-polyfill';

import type { Video } from '@yd/client';

import { getContextService } from './context-service';

export function handleContextMenuClick(info: Menus.OnClickData, tab?: Tabs.Tab): void {
Expand Down
22 changes: 12 additions & 10 deletions apps/extension/src/lib/context-service.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { get } from 'svelte/store';
import { defineProxyService } from '@webext-core/proxy-service';
import { get } from 'svelte/store';
import { Tabs } from 'webextension-polyfill';

import {
OpenAPI,
Video,
Download,
Session,
DownloadOptions,
SessionService,
SearchService,
DownloadsService,
DownloadsStatusService
DownloadsStatusService,
OpenAPI,
SearchService,
Session,
SessionService,
Video
} from '@yd/client';
import { settings } from '~/lib/stores/settings';

import { env } from '~/lib/config';
import { setContextMenus } from '~/lib/context-menu';
import { isYouTubeVideo } from '~/lib/detect';
import { sendMessageIgnoreReturn } from '~/lib/messaging';
import { saveAs } from '~/lib/files';
import { setContextMenus } from '~/lib/context-menu';
import { sendMessageIgnoreReturn } from '~/lib/messaging';
import { settings } from '~/lib/stores/settings';

export type Ctx = {
session?: Session; // Current session.
Expand Down
1 change: 1 addition & 0 deletions apps/extension/src/lib/messaging.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineExtensionMessaging, GetDataType } from '@webext-core/messaging';
import { Tabs } from 'webextension-polyfill';

import { Download, DownloadOptions, Session, Video } from '@yd/client';

/**
Expand Down
6 changes: 4 additions & 2 deletions apps/extension/src/lib/stores/context.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { writable, get } from 'svelte/store';
import { get, writable } from 'svelte/store';
import { Tabs } from 'webextension-polyfill';

import type { Download } from '@yd/client';

import type { Ctx } from '~/lib/context-service';
import { onMessage } from '~/lib/messaging';
import { getContextService } from '~/lib/context-service';
import { onMessage } from '~/lib/messaging';

/**
* Create a store used to manage context in a popup or other location. This store is initialized
Expand Down
1 change: 1 addition & 0 deletions apps/extension/src/lib/stores/settings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DEFAULT_DOWNLOAD_OPTIONS } from '@yd/client';

import { writeableStorage } from '~/lib/stores/writeable-storage';

// Store used for managing preferred settings set by the user.
Expand Down
3 changes: 2 additions & 1 deletion apps/extension/src/lib/stores/writeable-storage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { writable, get, type Updater, type Writable } from 'svelte/store';
import type { Updater, Writable } from 'svelte/store';
import { get, writable } from 'svelte/store';
import { Storage } from 'webextension-polyfill';

export interface WriteableStorage<T> extends Writable<T> {
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/wxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'wxt';
import { svelte, vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { defineConfig } from 'wxt';

// See https://wxt.dev/api/config.html
export default defineConfig({
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { OpenAPI, SessionService } from '@yd/client';
import { toast } from '@yd/ui';
import { env } from '$lib/config';
import { browser } from '$app/environment';
import { env } from '$lib/config';
import { downloads } from '$lib/stores/downloads';

import { OpenAPI, SessionService } from '@yd/client';
import { toast } from '@yd/ui';

// Set the base server address using the environment variable.
OpenAPI.BASE = env.serverAddress;

Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/lib/components/DownloadActions.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import { downloads } from '$lib/stores/downloads';
import type { Download } from '@yd/client';
import { ActionIcon, ArrowPathIcon, ButtonGroup, Confirm, DownloadIcon, TrashIcon } from '@yd/ui';
import { downloads } from '$lib/stores/downloads';
export let download: Download;
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/lib/components/NotFound.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import { Button } from '@yd/ui';
import { RoutePathConstants } from '$lib/routes';
import { Button } from '@yd/ui';
export let title: string = '404';
export let subtitle: string = '';
export let description: string = "We can't find that page.";
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/lib/components/ResultCard.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script lang="ts">
import type { Video } from '@yd/client';
import { Card, PlusIcon, IconButton } from '@yd/ui';
import StateIcon from '$lib/components/StateIcon.svelte';
import { downloads } from '$lib/stores/downloads';
import type { Video } from '@yd/client';
import { Card, IconButton, PlusIcon } from '@yd/ui';
export let result: Video;
</script>

Expand Down
9 changes: 2 additions & 7 deletions apps/web/src/lib/components/StateIcon.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<script lang="ts">
import type { DownloadState } from '@yd/client';
import {
CheckCircleIcon,
LoaderIcon,
ExclamationCircleIcon,
Icon,
type IconSource
} from '@yd/ui';
import type { IconSource } from '@yd/ui';
import { CheckCircleIcon, ExclamationCircleIcon, Icon, LoaderIcon } from '@yd/ui';
export let state: DownloadState;
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/lib/components/StatusBadge.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import type { DownloadState, DownloadStatus } from '@yd/client';
import { Badge, type BadgeVariants, ProgressBar } from '@yd/ui';
import type { BadgeVariants } from '@yd/ui';
import { Badge, ProgressBar } from '@yd/ui';
export let status: DownloadStatus;
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/lib/routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DownloadIcon, GearIcon, MagnifyingGlassIcon, type IconSource } from '@yd/ui';
import type { IconSource } from '@yd/ui';
import { DownloadIcon, GearIcon, MagnifyingGlassIcon } from '@yd/ui';

export class RoutePathConstants {
public static SEARCH = '/';
Expand Down
8 changes: 5 additions & 3 deletions apps/web/src/lib/stores/downloads.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { writable, get } from 'svelte/store';
import { DownloadsService, DownloadsStatusService, type Video, type Download } from '@yd/client';
import { toast } from '@yd/ui';
import { settings, userSettings } from '$lib/stores/settings';
import { saveAs } from '$lib/utils/files';
import { get, writable } from 'svelte/store';

import type { Download, Video } from '@yd/client';
import { DownloadsService, DownloadsStatusService } from '@yd/client';
import { toast } from '@yd/ui';

const DOWNLOADS = writable<Record<string, Download>>({});

Expand Down
4 changes: 3 additions & 1 deletion apps/web/src/lib/stores/search.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { writable } from 'svelte/store';
import { SearchService, type Video } from '@yd/client';

import type { Video } from '@yd/client';
import { SearchService } from '@yd/client';
import { toast } from '@yd/ui';

function createSearchStore() {
Expand Down
9 changes: 5 additions & 4 deletions apps/web/src/lib/stores/settings.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { browser } from '$app/environment';
import { writable } from 'svelte/store';

import type { DownloadOptions } from '@yd/client';
import {
AudioFormatEnum,
DEFAULT_DOWNLOAD_OPTIONS,
DownloadQualityEnum,
VideoFormatEnum,
type DownloadOptions,
DEFAULT_DOWNLOAD_OPTIONS
VideoFormatEnum
} from '@yd/client';
import { browser } from '$app/environment';

const SETTINGS_KEY = 'yd-settings';

Expand Down
10 changes: 6 additions & 4 deletions apps/web/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script lang="ts">
import '../app.css';
import { Toasts, NavBar, Footer, ThemeToggle } from '@yd/ui';
import { page } from '$app/stores';
import { setupSession } from '$lib/api';
import Loading from '$lib/components/Loading.svelte';
import config from '$lib/config';
import { navbarLinks, footerLinks } from '$lib/routes';
import Logo from '$lib/components/Logo.svelte';
import { setupSession } from '$lib/api';
import config from '$lib/config';
import { footerLinks, navbarLinks } from '$lib/routes';
import { Footer, NavBar, ThemeToggle, Toasts } from '@yd/ui';
</script>

<svelte:head>
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script lang="ts">
import { Title, Button, LoaderIcon, Icon, SearchBar } from '@yd/ui';
import { search } from '$lib/stores/search';
import ResultCard from '$lib/components/ResultCard.svelte';
import config from '$lib/config';
import { search } from '$lib/stores/search';
import { Button, Icon, LoaderIcon, SearchBar, Title } from '@yd/ui';
async function searchVideos(event: CustomEvent<{ query: string }>) {
await search.get(event.detail.query);
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/routes/downloads/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script lang="ts">
import { Badge, Pagination, Table, Title } from '@yd/ui';
import { downloads } from '$lib/stores/downloads';
import { userSettings } from '$lib/stores/settings';
import DownloadActions from '$lib/components/DownloadActions.svelte';
import NotFound from '$lib/components/NotFound.svelte';
import StatusBadge from '$lib/components/StatusBadge.svelte';
import config from '$lib/config';
import { downloads } from '$lib/stores/downloads';
import { userSettings } from '$lib/stores/settings';
import { Badge, Pagination, Table, Title } from '@yd/ui';
let page = 1;
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/routes/faq/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import { Title, CollapsibleSection } from '@yd/ui';
import { faqs } from '$lib/utils/faq';
import config from '$lib/config';
import { faqs } from '$lib/utils/faq';
import { CollapsibleSection, Title } from '@yd/ui';
</script>

<svelte:head>
Expand Down
Loading

0 comments on commit e198307

Please sign in to comment.