aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2023-09-29 10:11:33 -0500
committerMatt Strapp <matt@mattstrapp.net>2023-09-29 10:11:33 -0500
commit11ece69e006b446b9ca4e06eb5af5662bc811469 (patch)
tree29dbb0b4b88aa9eae29d80f5ebc08b8f710f51f8 /app
parentUpdate dep + fix build (diff)
downloadtrinkets-11ece69e006b446b9ca4e06eb5af5662bc811469.tar
trinkets-11ece69e006b446b9ca4e06eb5af5662bc811469.tar.gz
trinkets-11ece69e006b446b9ca4e06eb5af5662bc811469.tar.bz2
trinkets-11ece69e006b446b9ca4e06eb5af5662bc811469.tar.lz
trinkets-11ece69e006b446b9ca4e06eb5af5662bc811469.tar.xz
trinkets-11ece69e006b446b9ca4e06eb5af5662bc811469.tar.zst
trinkets-11ece69e006b446b9ca4e06eb5af5662bc811469.zip
Formatting
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to 'app')
-rw-r--r--app/.eslintrc.cjs16
-rw-r--r--app/.prettierrc3
-rw-r--r--app/postcss.config.cjs6
-rw-r--r--app/src/app.d.ts2
-rw-r--r--app/src/app.html1
-rw-r--r--app/src/hooks.server.ts18
-rw-r--r--app/src/lib/svelte/Navigation.svelte20
-rw-r--r--app/src/lib/svelte/ReloadPrompt.svelte60
-rw-r--r--app/src/lib/ts/download.ts32
-rw-r--r--app/src/lib/ts/truncate.worker.ts14
-rw-r--r--app/src/lib/types/truncate-worker.ts10
-rw-r--r--app/src/routes/+layout.svelte24
-rw-r--r--app/src/routes/+layout.ts2
-rw-r--r--app/src/routes/+page.svelte9
-rw-r--r--app/src/routes/truncate/+page.svelte48
-rw-r--r--app/svelte.config.js12
-rw-r--r--app/tailwind.config.ts28
-rw-r--r--app/tsconfig.json7
-rw-r--r--app/vite.config.ts32
19 files changed, 173 insertions, 171 deletions
diff --git a/app/.eslintrc.cjs b/app/.eslintrc.cjs
index 4b29a01..aa4b532 100644
--- a/app/.eslintrc.cjs
+++ b/app/.eslintrc.cjs
@@ -4,27 +4,27 @@ module.exports = {
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
- 'prettier'
+ 'prettier',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
- extraFileExtensions: ['.svelte']
+ extraFileExtensions: ['.svelte'],
},
env: {
browser: true,
es2017: true,
- node: true
+ node: true,
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
- parser: '@typescript-eslint/parser'
- }
- }
- ]
-};
+ parser: '@typescript-eslint/parser',
+ },
+ },
+ ],
+}
diff --git a/app/.prettierrc b/app/.prettierrc
index 0580f3e..0a1cfd7 100644
--- a/app/.prettierrc
+++ b/app/.prettierrc
@@ -1,7 +1,8 @@
{
"useTabs": false,
"singleQuote": true,
- "trailingComma": "none",
+ "semi": false,
+ "trailingComma": "es5",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
diff --git a/app/postcss.config.cjs b/app/postcss.config.cjs
index 5cbc2c7..33ad091 100644
--- a/app/postcss.config.cjs
+++ b/app/postcss.config.cjs
@@ -1,6 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
- autoprefixer: {}
- }
-};
+ autoprefixer: {},
+ },
+}
diff --git a/app/src/app.d.ts b/app/src/app.d.ts
index bf2855f..bbacd79 100644
--- a/app/src/app.d.ts
+++ b/app/src/app.d.ts
@@ -2,7 +2,7 @@
// for information about these interfaces
// and what to do when importing types
-import 'vite-plugin-pwa/info';
+import 'vite-plugin-pwa/info'
declare namespace App {
// interface Locals {}
diff --git a/app/src/app.html b/app/src/app.html
index 4950b86..2ce4c3b 100644
--- a/app/src/app.html
+++ b/app/src/app.html
@@ -7,6 +7,7 @@
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
+
<body data-sveltekit-preload-data="hover" data-theme="wintry">
<div style="display: contents" class="h-full overflow-hidden">%sveltekit.body%</div>
</body>
diff --git a/app/src/hooks.server.ts b/app/src/hooks.server.ts
index bf7121a..3abdfb3 100644
--- a/app/src/hooks.server.ts
+++ b/app/src/hooks.server.ts
@@ -1,5 +1,5 @@
-import { minify } from 'html-minifier-terser';
-import { building } from '$app/environment';
+import { minify } from 'html-minifier-terser'
+import { building } from '$app/environment'
const minification_options = {
collapseBooleanAttributes: true,
@@ -18,19 +18,19 @@ const minification_options = {
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
sortAttributes: true,
- sortClassName: true
-};
+ sortClassName: true,
+}
/** @type {import('@sveltejs/kit').Handle} */
export async function handle({ event, resolve }) {
- let page = '';
+ let page = ''
return resolve(event, {
transformPageChunk: ({ html, done }) => {
- page += html;
+ page += html
if (done) {
- return building ? minify(page, minification_options) : page;
+ return building ? minify(page, minification_options) : page
}
- }
- });
+ },
+ })
}
diff --git a/app/src/lib/svelte/Navigation.svelte b/app/src/lib/svelte/Navigation.svelte
index 9246c28..fa9182f 100644
--- a/app/src/lib/svelte/Navigation.svelte
+++ b/app/src/lib/svelte/Navigation.svelte
@@ -1,22 +1,22 @@
<script lang="ts">
- import { page } from '$app/stores';
+ import { page } from '$app/stores'
- import Icon from '@iconify/svelte';
- import homeIcon from '@iconify/icons-carbon/home';
- import logoGithub from '@iconify/icons-carbon/logo-github';
- import menuIcon from '@iconify/icons-carbon/menu';
- import pageBreak from '@iconify/icons-carbon/page-break';
+ import Icon from '@iconify/svelte'
+ import homeIcon from '@iconify/icons-carbon/home'
+ import logoGithub from '@iconify/icons-carbon/logo-github'
+ import menuIcon from '@iconify/icons-carbon/menu'
+ import pageBreak from '@iconify/icons-carbon/page-break'
- import { AppRail, AppRailAnchor, getDrawerStore } from '@skeletonlabs/skeleton';
+ import { AppRail, AppRailAnchor, getDrawerStore } from '@skeletonlabs/skeleton'
- const drawerStore = getDrawerStore();
+ const drawerStore = getDrawerStore()
function drawerClose(): void {
- drawerStore.close();
+ drawerStore.close()
}
// Hamburgers
- export let menu = false;
+ export let menu = false
</script>
<AppRail>
diff --git a/app/src/lib/svelte/ReloadPrompt.svelte b/app/src/lib/svelte/ReloadPrompt.svelte
index d54a202..e6effbb 100644
--- a/app/src/lib/svelte/ReloadPrompt.svelte
+++ b/app/src/lib/svelte/ReloadPrompt.svelte
@@ -1,34 +1,32 @@
<script lang="ts">
- import { getToastStore } from "@skeletonlabs/skeleton";
- import { useRegisterSW } from "virtual:pwa-register/svelte";
+ import { getToastStore } from '@skeletonlabs/skeleton'
+ import { useRegisterSW } from 'virtual:pwa-register/svelte'
- const toastStore = getToastStore();
+ const toastStore = getToastStore()
- const {
- updateServiceWorker,
- } = useRegisterSW({
- onRegisteredSW(r) {
- console.log("SW Registered: ", r)
- },
- onNeedRefresh() {
- toastStore.trigger({
- message: 'A new version of the application is available.',
- autohide: false,
- action: {
- label: 'Refresh',
- response: updateServiceWorker
- }
- });
- },
- onOfflineReady() {
- toastStore.trigger({
- background: 'variant-filled-success',
- message: 'Now ready for offline use!',
- timeout: 5000
- });
- },
- onRegisterError(err) {
- console.error("SW Registration Error: ", err)
- }
- })
-</script> \ No newline at end of file
+ const { updateServiceWorker } = useRegisterSW({
+ onRegisteredSW(r) {
+ console.log('SW Registered: ', r)
+ },
+ onNeedRefresh() {
+ toastStore.trigger({
+ message: 'A new version of the application is available.',
+ autohide: false,
+ action: {
+ label: 'Refresh',
+ response: updateServiceWorker,
+ },
+ })
+ },
+ onOfflineReady() {
+ toastStore.trigger({
+ background: 'variant-filled-success',
+ message: 'Now ready for offline use!',
+ timeout: 5000,
+ })
+ },
+ onRegisterError(err) {
+ console.error('SW Registration Error: ', err)
+ },
+ })
+</script>
diff --git a/app/src/lib/ts/download.ts b/app/src/lib/ts/download.ts
index c3e98b0..48debec 100644
--- a/app/src/lib/ts/download.ts
+++ b/app/src/lib/ts/download.ts
@@ -5,33 +5,33 @@ export default async function saveFile(blob: ArrayBuffer, suggestedName: string
'showSaveFilePicker' in window &&
(() => {
try {
- return window.self === window.top;
+ return window.self === window.top
} catch {
- return false;
+ return false
}
- })();
+ })()
if (supportsFSAccess) {
try {
const handle = await window.showSaveFilePicker({
- suggestedName: suggestedName
- });
- const writable = await handle.createWritable();
- await writable.write(blob);
- await writable.close();
- return;
+ suggestedName: suggestedName,
+ })
+ const writable = await handle.createWritable()
+ await writable.write(blob)
+ await writable.close()
+ return
} catch (err: unknown) {
// TypeScript
if ((err as Error)?.name !== 'AbortError') {
- return Promise.reject(err);
+ return Promise.reject(err)
}
}
} else {
- const anchor = document.createElement('a');
- anchor.download = suggestedName ?? 'truncated';
- anchor.href = URL.createObjectURL(new Blob([blob]));
- anchor.click();
- URL.revokeObjectURL(anchor.href);
- document.body.removeChild(anchor);
+ const anchor = document.createElement('a')
+ anchor.download = suggestedName ?? 'truncated'
+ anchor.href = URL.createObjectURL(new Blob([blob]))
+ anchor.click()
+ URL.revokeObjectURL(anchor.href)
+ document.body.removeChild(anchor)
}
}
diff --git a/app/src/lib/ts/truncate.worker.ts b/app/src/lib/ts/truncate.worker.ts
index 9ddf63c..da75041 100644
--- a/app/src/lib/ts/truncate.worker.ts
+++ b/app/src/lib/ts/truncate.worker.ts
@@ -1,9 +1,9 @@
-import type { TruncateRequest, TruncateResponse } from '../types/truncate-worker';
+import type { TruncateRequest, TruncateResponse } from '../types/truncate-worker'
onmessage = async (message: MessageEvent<TruncateRequest>) => {
- console.log('File received. Truncating...');
- const file = message.data.file;
- const buffer = await file.arrayBuffer();
- const truncated = buffer.slice(0, message.data.size);
- postMessage({ file: truncated } as TruncateResponse);
-};
+ console.log('File received. Truncating...')
+ const file = message.data.file
+ const buffer = await file.arrayBuffer()
+ const truncated = buffer.slice(0, message.data.size)
+ postMessage({ file: truncated } as TruncateResponse)
+}
diff --git a/app/src/lib/types/truncate-worker.ts b/app/src/lib/types/truncate-worker.ts
index 7052d17..2691ccb 100644
--- a/app/src/lib/types/truncate-worker.ts
+++ b/app/src/lib/types/truncate-worker.ts
@@ -1,8 +1,8 @@
export type TruncateRequest = {
- file: File;
- size: number;
-};
+ file: File
+ size: number
+}
export type TruncateResponse = {
- file: ArrayBuffer;
-};
+ file: ArrayBuffer
+}
diff --git a/app/src/routes/+layout.svelte b/app/src/routes/+layout.svelte
index 087465b..df0f707 100644
--- a/app/src/routes/+layout.svelte
+++ b/app/src/routes/+layout.svelte
@@ -1,34 +1,34 @@
<script lang="ts">
- import Navigation from '$lib/svelte/Navigation.svelte';
- import Icon from '@iconify/svelte';
- import menuIcon from '@iconify/icons-carbon/menu';
+ import Navigation from '$lib/svelte/Navigation.svelte'
+ import Icon from '@iconify/svelte'
+ import menuIcon from '@iconify/icons-carbon/menu'
import {
AppBar,
AppShell,
Drawer,
Toast,
getDrawerStore,
- initializeStores
- } from '@skeletonlabs/skeleton';
- import { pwaInfo } from 'virtual:pwa-info';
- import '../app.postcss';
+ initializeStores,
+ } from '@skeletonlabs/skeleton'
+ import { pwaInfo } from 'virtual:pwa-info'
+ import '../app.postcss'
// Floating UI for Popups
// import { computePosition, autoUpdate, flip, shift, offset, arrow } from '@floating-ui/dom';
// import { storePopup } from '@skeletonlabs/skeleton';
// storePopup.set({ computePosition, autoUpdate, flip, shift, offset, arrow });
- initializeStores();
+ initializeStores()
- const drawerStore = getDrawerStore();
+ const drawerStore = getDrawerStore()
function drawerOpen() {
drawerStore.open({
- width: 'w-[80px]'
- });
+ width: 'w-[80px]',
+ })
}
- $: webManifestLink = pwaInfo ? pwaInfo.webManifest.linkTag : '';
+ $: webManifestLink = pwaInfo ? pwaInfo.webManifest.linkTag : ''
</script>
<svelte:head>
diff --git a/app/src/routes/+layout.ts b/app/src/routes/+layout.ts
index 189f71e..176ae64 100644
--- a/app/src/routes/+layout.ts
+++ b/app/src/routes/+layout.ts
@@ -1 +1 @@
-export const prerender = true;
+export const prerender = true
diff --git a/app/src/routes/+page.svelte b/app/src/routes/+page.svelte
index e34c31e..123282c 100644
--- a/app/src/routes/+page.svelte
+++ b/app/src/routes/+page.svelte
@@ -1,15 +1,14 @@
<svelte:head>
- <title>Coming Soon(TM)</title>
+ <title>Coming Soon(TM)</title>
</svelte:head>
<!-- YOU CAN DELETE EVERYTHING IN THIS PAGE -->
<div class="container h-full mx-auto flex justify-center items-center">
- <div class="space-y-10 text-center flex flex-col items-center">
- <h2 class="h2">Welcome to a placeholder.</h2>
- </div>
+ <div class="space-y-10 text-center flex flex-col items-center">
+ <h2 class="h2">Welcome to a placeholder.</h2>
+ </div>
</div>
<style lang="postcss">
-
</style>
diff --git a/app/src/routes/truncate/+page.svelte b/app/src/routes/truncate/+page.svelte
index 635b6bc..6db6d25 100644
--- a/app/src/routes/truncate/+page.svelte
+++ b/app/src/routes/truncate/+page.svelte
@@ -1,36 +1,36 @@
<script lang="ts">
- import saveFile from '$lib/ts/download';
- import type { TruncateRequest, TruncateResponse } from '$lib/types/truncate-worker';
- import Icon from '@iconify/svelte';
- import fileStorage from '@iconify/icons-carbon/file-storage';
- import { FileDropzone, ProgressBar } from '@skeletonlabs/skeleton';
- import { onDestroy, onMount } from 'svelte';
+ import saveFile from '$lib/ts/download'
+ import type { TruncateRequest, TruncateResponse } from '$lib/types/truncate-worker'
+ import Icon from '@iconify/svelte'
+ import fileStorage from '@iconify/icons-carbon/file-storage'
+ import { FileDropzone, ProgressBar } from '@skeletonlabs/skeleton'
+ import { onDestroy, onMount } from 'svelte'
- let disableInput = false;
- let files: FileList;
- let form: HTMLFormElement;
- let worker: Worker;
- $: truncateTo = 1;
- let originalName: string;
+ let disableInput = false
+ let files: FileList
+ let form: HTMLFormElement
+ let worker: Worker
+ $: truncateTo = 1
+ let originalName: string
function onUpload() {
- disableInput = true;
- originalName = files[0].name;
+ disableInput = true
+ originalName = files[0].name
worker.postMessage({
file: files[0],
- size: truncateTo
- } as TruncateRequest);
+ size: truncateTo,
+ } as TruncateRequest)
}
onMount(async () => {
- worker = new Worker(new URL('$lib/ts/truncate.worker.ts', import.meta.url), { type: 'module' });
+ worker = new Worker(new URL('$lib/ts/truncate.worker.ts', import.meta.url), { type: 'module' })
worker.onmessage = async (e: MessageEvent<TruncateResponse>) => {
- await saveFile(e.data.file, `trunc-${originalName}`).catch((e) => console.error(e));
- disableInput = false;
- form.reset();
- truncateTo = 1;
- };
- });
+ await saveFile(e.data.file, `trunc-${originalName}`).catch((e) => console.error(e))
+ disableInput = false
+ form.reset()
+ truncateTo = 1
+ }
+ })
onDestroy(() => {
worker?.terminate()
@@ -60,7 +60,7 @@
>
<svelte:fragment slot="lead">
<div class="flex justify-center items-center">
- <Icon icon={fileStorage} width="50" />
+ <Icon icon={fileStorage} width="50" />
</div>
</svelte:fragment>
<svelte:fragment slot="meta">Drop a file here to truncate it.</svelte:fragment>
diff --git a/app/svelte.config.js b/app/svelte.config.js
index 463ceee..722e99b 100644
--- a/app/svelte.config.js
+++ b/app/svelte.config.js
@@ -1,5 +1,5 @@
-import adapter from '@sveltejs/adapter-static';
-import { vitePreprocess } from '@sveltejs/kit/vite';
+import adapter from '@sveltejs/adapter-static'
+import { vitePreprocess } from '@sveltejs/kit/vite'
/** @type {import('@sveltejs/kit').Config} */
const config = {
@@ -12,7 +12,7 @@ const config = {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
- adapter: adapter()
- }
-};
-export default config;
+ adapter: adapter(),
+ },
+}
+export default config
diff --git a/app/tailwind.config.ts b/app/tailwind.config.ts
index 5bb3fde..d87e5b6 100644
--- a/app/tailwind.config.ts
+++ b/app/tailwind.config.ts
@@ -1,17 +1,17 @@
-import { join } from 'path';
-import type { Config } from 'tailwindcss';
-import forms from '@tailwindcss/forms';
-import typography from '@tailwindcss/typography';
-import { skeleton } from '@skeletonlabs/tw-plugin';
+import { join } from 'path'
+import type { Config } from 'tailwindcss'
+import forms from '@tailwindcss/forms'
+import typography from '@tailwindcss/typography'
+import { skeleton } from '@skeletonlabs/tw-plugin'
export default {
darkMode: 'class',
content: [
'./src/**/*.{html,js,svelte,ts}',
- join(require.resolve('@skeletonlabs/skeleton'), '../**/*.{html,js,svelte,ts}')
+ join(require.resolve('@skeletonlabs/skeleton'), '../**/*.{html,js,svelte,ts}'),
],
theme: {
- extend: {}
+ extend: {},
},
plugins: [
forms,
@@ -21,10 +21,10 @@ export default {
preset: [
{
name: 'wintry',
- enhancements: true
- }
- ]
- }
- })
- ]
-} satisfies Config;
+ enhancements: true,
+ },
+ ],
+ },
+ }),
+ ],
+} satisfies Config
diff --git a/app/tsconfig.json b/app/tsconfig.json
index 8cac8a3..82919d2 100644
--- a/app/tsconfig.json
+++ b/app/tsconfig.json
@@ -9,10 +9,13 @@
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
- "types": ["vite-plugin-pwa/client", "@types/wicg-file-system-access"]
+ "types": [
+ "vite-plugin-pwa/client",
+ "@types/wicg-file-system-access"
+ ]
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
-}
+} \ No newline at end of file
diff --git a/app/vite.config.ts b/app/vite.config.ts
index e34d72a..ec95532 100644
--- a/app/vite.config.ts
+++ b/app/vite.config.ts
@@ -1,14 +1,14 @@
-import { purgeCss } from 'vite-plugin-tailwind-purgecss';
-import { sveltekit } from '@sveltejs/kit/vite';
-import { defineConfig } from 'vite';
-import { SvelteKitPWA } from '@vite-pwa/sveltekit';
+import { purgeCss } from 'vite-plugin-tailwind-purgecss'
+import { sveltekit } from '@sveltejs/kit/vite'
+import { defineConfig } from 'vite'
+import { SvelteKitPWA } from '@vite-pwa/sveltekit'
export default defineConfig({
build: {
- sourcemap: true
+ sourcemap: true,
},
css: {
- devSourcemap: true
+ devSourcemap: true,
},
plugins: [
sveltekit(),
@@ -16,7 +16,7 @@ export default defineConfig({
SvelteKitPWA({
devOptions: {
enabled: true,
- type: 'module'
+ type: 'module',
},
manifest: {
name: "RossTheRoss' Personal Tools",
@@ -28,22 +28,22 @@ export default defineConfig({
src: '/favicon.svg',
sizes: 'any',
type: 'image/svg+xml',
- purpose: 'maskable'
+ purpose: 'maskable',
},
{
src: '/pwa-512x512.png',
sizes: '512x512',
- type: 'image/png'
- }
+ type: 'image/png',
+ },
],
id: '/',
- theme_color: '#000000'
+ theme_color: '#000000',
},
registerType: 'autoUpdate',
workbox: {
globPatterns: ['client/**/*.{js,css,html,svg}'],
- cleanupOutdatedCaches: true
- }
- })
- ]
-});
+ cleanupOutdatedCaches: true,
+ },
+ }),
+ ],
+})