Fixed a bug in the login function

This commit is contained in:
Darren Zal 2023-01-18 13:52:41 -08:00
parent ee9fff26c3
commit 19ec820233
19 changed files with 1926 additions and 39 deletions

5
.babelrc Normal file
View File

@ -0,0 +1,5 @@
{
"presets": [
"@babel/preset-env"
]
}

11
dist/index.html vendored Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sh*t Kanye says</title>
</head>
<body>
<script src="/main.js"></script>
</body>
</html>

1429
dist/main.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,6 @@
import { page } from '$app/stores' import { page } from '$app/stores'
import { sessionStore, themeStore } from '../stores' import { sessionStore, themeStore } from '../stores'
import { storeTheme, type Theme } from '$lib/theme' import { storeTheme, type Theme } from '$lib/theme'
import AlphaTag from '$components/nav/AlphaTag.svelte'
import Avatar from '$components/settings/Avatar.svelte' import Avatar from '$components/settings/Avatar.svelte'
import BrandLogo from '$components/icons/BrandLogo.svelte' import BrandLogo from '$components/icons/BrandLogo.svelte'
import BrandWordmark from '$components/icons/BrandWordmark.svelte' import BrandWordmark from '$components/icons/BrandWordmark.svelte'
@ -34,7 +33,6 @@
on:click={() => goto('/')} on:click={() => goto('/')}
> >
<BrandLogo /> <BrandLogo />
<AlphaTag />
</div> </div>
{/if} {/if}
</div> </div>
@ -49,9 +47,6 @@
<div class="hidden lg:inline-block"> <div class="hidden lg:inline-block">
<BrandWordmark /> <BrandWordmark />
</div> </div>
<div class="hidden sm:inline-block">
<AlphaTag />
</div>
</div> </div>
{/if} {/if}

View File

@ -1,8 +1,38 @@
<svg xmlns="http://www.w3.org/2000/svg" width="41" height="40" fill="none"> <svg width="50" height="50" viewBox="0 0 300 300" fill="none" xmlns="http://www.w3.org/2000/svg">
<path <path d="M297.5 151C297.5 225.642 231.662 286.5 150 286.5C68.3377 286.5 2.5 225.642 2.5 151C2.5 76.3576 68.3377 15.5 150 15.5C231.662 15.5 297.5 76.3576 297.5 151Z" stroke="black" stroke-width="5"/>
fill="currentColor" <path d="M120.5 63.5C120.5 74.3495 110.855 83.5 98.5 83.5C86.1451 83.5 76.5 74.3495 76.5 63.5C76.5 52.6505 86.1451 43.5 98.5 43.5C110.855 43.5 120.5 52.6505 120.5 63.5Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
fill-rule="evenodd" <path d="M165.5 284C165.5 291.187 158.845 297.5 150 297.5C141.155 297.5 134.5 291.187 134.5 284C134.5 276.813 141.155 270.5 150 270.5C158.845 270.5 165.5 276.813 165.5 284Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
d="M5.8 0C2.111 0 .5 1.599.5 5.333v29.334C.5 38.255 2.156 40 5.8 40h29.15c3.674 0 5.301-1.678 5.301-5.333V5.333c0-3.67-1.658-5.333-5.3-5.333H5.8Zm3.82 26.397L11.407 8.2c.165-1.681-1.147-3.138-2.825-3.138-2.04 0-3.579 2.19-3.014 4.276.755 2.793 1.486 6.496 1.533 10.49.027 2.326-.207 4.576-.56 6.615-.354 2.05.202 4.187 1.37 5.81 1.167 1.62 2.912 2.687 4.924 2.687h1.037c2.546 0 4.61-2.077 4.61-4.638v-1.935c0-1.164-.84-2.155-1.982-2.339l-1.412-.228a1.018 1.018 0 0 0-1.174.917l-.008.092a2.158 2.158 0 0 1-2.144 1.969 2.161 2.161 0 0 1-2.142-2.38Zm8.862-5.777v-7.53c0-1.03.83-1.867 1.855-1.867s1.856.836 1.856 1.868v16.246c0 3.094 2.493 5.602 5.567 5.602h.237c3.995 0 6.975-4.28 6.242-8.41-.366-2.06-.62-4.339-.62-6.695 0-4.102.771-7.898 1.563-10.716.554-1.97-.9-4.057-2.825-4.057-1.55 0-2.772 1.33-2.65 2.885l1.446 18.476a2.178 2.178 0 0 1-2.163 2.355 2.175 2.175 0 0 1-2.16-1.984l-1.576-17.26c-.232-2.534-2.343-4.472-4.871-4.472-2.539 0-4.656 1.954-4.873 4.5l-1.046 10.886a2.022 2.022 0 0 0 1.715 2.177 2.017 2.017 0 0 0 2.303-2.004Z" <path d="M32.5 216C32.5 223.25 25.9999 229.5 17.5 229.5C9.00014 229.5 2.5 223.25 2.5 216C2.5 208.75 9.00014 202.5 17.5 202.5C25.9999 202.5 32.5 208.75 32.5 216Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
clip-rule="evenodd" <path d="M32.5 86C32.5 93.2497 25.9999 99.5 17.5 99.5C9.00014 99.5 2.5 93.2497 2.5 86C2.5 78.7503 9.00014 72.5 17.5 72.5C25.9999 72.5 32.5 78.7503 32.5 86Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
/> <path d="M165.5 16C165.5 23.1872 158.845 29.5 150 29.5C141.155 29.5 134.5 23.1872 134.5 16C134.5 8.81284 141.155 2.5 150 2.5C158.845 2.5 165.5 8.81284 165.5 16Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
</svg> <path d="M297.5 86C297.5 93.2497 291 99.5 282.5 99.5C274 99.5 267.5 93.2497 267.5 86C267.5 78.7503 274 72.5 282.5 72.5C291 72.5 297.5 78.7503 297.5 86Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path d="M297.5 216C297.5 223.25 291 229.5 282.5 229.5C274 229.5 267.5 223.25 267.5 216C267.5 208.75 274 202.5 282.5 202.5C291 202.5 297.5 208.75 297.5 216Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path d="M221.5 233.5C221.5 244.35 211.855 253.5 199.5 253.5C187.145 253.5 177.5 244.35 177.5 233.5C177.5 222.65 187.145 213.5 199.5 213.5C211.855 213.5 221.5 222.65 221.5 233.5Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path d="M272.5 148C272.5 159.085 262.451 168.5 249.5 168.5C236.549 168.5 226.5 159.085 226.5 148C226.5 136.915 236.549 127.5 249.5 127.5C262.451 127.5 272.5 136.915 272.5 148Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path d="M120.5 233.5C120.5 244.35 110.855 253.5 98.5 253.5C86.1451 253.5 76.5 244.35 76.5 233.5C76.5 222.65 86.1451 213.5 98.5 213.5C110.855 213.5 120.5 222.65 120.5 233.5Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path d="M71.5 148C71.5 159.175 61.8014 168.5 49.5 168.5C37.1986 168.5 27.5 159.175 27.5 148C27.5 136.825 37.1986 127.5 49.5 127.5C61.8014 127.5 71.5 136.825 71.5 148Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path d="M221.5 63.5C221.5 74.3495 211.855 83.5 199.5 83.5C187.145 83.5 177.5 74.3495 177.5 63.5C177.5 52.6505 187.145 43.5 199.5 43.5C211.855 43.5 221.5 52.6505 221.5 63.5Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<line x1="84.5576" y1="217.037" x2="55.8657" y2="168.553" stroke="black" stroke-width="8"/>
<line x1="234.171" y1="130.792" x2="209.445" y2="82.833" stroke="black" stroke-width="8"/>
<line x1="178" y1="235" x2="121" y2="235" stroke="black" stroke-width="8"/>
<path d="M227 149L74 149" stroke="black" stroke-width="8"/>
<line y1="-4" x2="55.354" y2="-4" transform="matrix(-1 -0.00014994 0.000178883 -1 176.441 62.4434)" stroke="black" stroke-width="8"/>
<line x1="241.564" y1="168.817" x2="215.564" y2="219.817" stroke="black" stroke-width="8"/>
<line x1="189.316" y1="82.5077" x2="113.484" y2="216.965" stroke="black" stroke-width="8"/>
<line y1="-4" x2="154.898" y2="-4" transform="matrix(0.507323 0.861756 -0.896761 0.442514 109.72 81.9006)" stroke="black" stroke-width="8"/>
<line x1="23.7977" y1="101.124" x2="37.3826" y2="128.988" stroke="black" stroke-width="4"/>
<line x1="33.5867" y1="82.0356" x2="75.3673" y2="68.1027" stroke="black" stroke-width="4"/>
<line x1="223.402" y1="230.091" x2="267.771" y2="216.191" stroke="black" stroke-width="4"/>
<line x1="272.969" y1="203.08" x2="257.175" y2="167.818" stroke="black" stroke-width="4"/>
<line y1="-2" x2="33.7483" y2="-2" transform="matrix(0.439342 -0.89832 0.925271 0.379307 261.45 128.959)" stroke="black" stroke-width="4"/>
<line x1="222.67" y1="68.1156" x2="267.67" y2="84.1156" stroke="black" stroke-width="4"/>
<line y1="-2" x2="30.3872" y2="-2" transform="matrix(0.699374 0.714756 -0.773204 0.634157 162.603 25.3394)" stroke="black" stroke-width="4"/>
<line y1="-2" x2="32.7185" y2="-2" transform="matrix(0.694859 0.719146 -0.777103 0.629373 112.685 251.584)" stroke="black" stroke-width="4"/>
<line x1="32.5285" y1="220.213" x2="75.4034" y2="229.041" stroke="black" stroke-width="4"/>
<line x1="23.0962" y1="203.387" x2="35.1638" y2="165.903" stroke="black" stroke-width="4"/>
<line x1="111.796" y1="45.403" x2="137.832" y2="25.7735" stroke="black" stroke-width="4"/>
<line x1="161.087" y1="274.383" x2="183.445" y2="246.742" stroke="black" stroke-width="4"/>
<line y1="-4" x2="53.1745" y2="-4" transform="matrix(-0.511202 0.859461 -0.894943 -0.446182 86.491 81.9006)" stroke="black" stroke-width="8"/>
<path d="M184.5 148C184.5 163.495 170.431 176.5 152.5 176.5C134.569 176.5 120.5 163.495 120.5 148C120.5 132.505 134.569 119.5 152.5 119.5C170.431 119.5 184.5 132.505 184.5 148Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 167 B

View File

@ -1,5 +0,0 @@
<span
class="inline-block px-2 py-[2px] !no-underline font-medium text-center text-xs text-neutral bg-gradient-to-r from-orange-600 to-orange-300"
>
ALPHA
</span>

View File

@ -3,7 +3,6 @@
import { page } from '$app/stores' import { page } from '$app/stores'
import { sessionStore } from '$src/stores' import { sessionStore } from '$src/stores'
import About from '$components/icons/About.svelte' import About from '$components/icons/About.svelte'
import AlphaTag from '$components/nav/AlphaTag.svelte'
import BrandLogo from '$components/icons/BrandLogo.svelte' import BrandLogo from '$components/icons/BrandLogo.svelte'
import BrandWordmark from '$components/icons/BrandWordmark.svelte' import BrandWordmark from '$components/icons/BrandWordmark.svelte'
import Home from '$components/icons/Home.svelte' import Home from '$components/icons/Home.svelte'
@ -17,7 +16,7 @@
icon: Home icon: Home
}, },
{ {
label: 'Myseelia', label: 'App',
href: '/gallery/', href: '/gallery/',
icon: PhotoGallery icon: PhotoGallery
}, },
@ -67,7 +66,6 @@
> >
<BrandLogo /> <BrandLogo />
<BrandWordmark /> <BrandWordmark />
<AlphaTag />
</div> </div>
<!-- Menu --> <!-- Menu -->

View File

@ -0,0 +1,186 @@
<script>
import { writable } from 'svelte/store'
import TerminusClient from '@terminusdb/terminusdb-client'
// Connect and configure the TerminusClient
const client = new TerminusClient.WOQLClient(
'https://cloud.terminusdb.com/Myseelia',
{
user: 'zaldarren@gmail.com',
organization: 'Myseelia',
token:
'dGVybWludXNkYjovLy9kYXRhL2tleXNfYXBpLzg5OTY0ZGI5OWFlYjQ1Zjc5OGM5ZTRiZWI2MzExOGJhZjhiOWRiOWNlOTJiNmU2NGI0NDEzZjIzNDFmOGVkMjc=_869e9bd2465ad84126151962994fcfa22d4b7ec9375edf16b4182e7f36e4b2b820075ba22e78f629e0691eddbeae6998a6504d5ce287aa1df2602cb556b58e1730b0b93feb0e9304'
}
)
const bankerSchema = [
{
'@type': 'Class',
'@id': 'BankAccount',
'@key': {
'@type': 'Hash',
'@fields': ['account_id']
},
account_id: 'xsd:string',
owner: 'Person',
balance: 'xsd:decimal'
},
{
'@type': 'Class',
'@id': 'Person',
'@key': {
'@type': 'Lexical',
'@fields': ['name']
},
name: 'xsd:string'
}
]
function handleSubmit() {
alert('submitted')
createDataProduct()
}
export async function createDataProduct() {
try {
//add the schema documents
await client.addDocument(
bankerSchema,
{ graph_type: 'schema' },
'myseelia',
'add new schema'
)
const accountObj = {
'@type': 'BankAccount',
account_id: 'DBZDFGET23456',
owner: {
'@type': 'Person',
name: 'Tom'
},
balance: 1000
}
//add a document instance
await client.addDocument(accountObj)
client.getDocument({ as_list: true, id: 'Person/Tom' })
} catch (err) {
console.error(err.message)
}
}
const fields = writable([]) // store to hold the schema fields
// function to add a new field to the schema
function addField(event) {
event.preventDefault()
const name = event.target.name.value
const type = event.target.type.value
fields.update(fields => [...fields, { name, type }])
event.target.reset()
}
// function to delete a field from the schema
function deleteField(index) {
fields.update(fields => {
fields.splice(index, 1)
return fields
})
}
// function to make an API call to add the schema to the database
async function submitSchema() {
const response = await fetch('/api/add-schema', {
method: 'POST',
body: JSON.stringify({ fields: fields.get() }),
headers: { 'Content-Type': 'application/json' }
})
const result = await response.json()
console.log(result)
}
</script>
<h1>Add a schema</h1>
<form on:submit|preventDefault={addField}>
<label for="name">Field Name:</label>
<input type="text" name="name" required />
<br />
<label for="type">Field Type:</label>
<select name="type">
<option value="text">Text</option>
<option value="number">Number</option>
<option value="date">Date</option>
</select>
<br />
<button type="submit">Add Field</button>
</form>
<table>
<tr>
<th>Field Name</th>
<th>Field Type</th>
<th>Action</th>
</tr>
{#each $fields as field, index}
<tr>
<td>{field.name}</td>
<td>{field.type}</td>
<td>
<button on:click={() => deleteField(index)}>Delete</button>
</td>
</tr>
{/each}
</table>
<button on:click={handleSubmit}>Submit Schema</button>
<style>
/* add some styles for the schema editor */
h1 {
text-align: left;
}
form {
display: flex;
flex-direction: column;
align-items: left;
}
label {
margin: 0.5em 0;
}
input,
select {
margin: 0.5em 0;
padding: 0.5em;
width: 20ch; /* adjust width for inputting text of up to 20 characters */
}
button {
margin: 0.5em 0;
padding: 0.5em;
width: 20ch; /* make the button the same width as the input fields */
background-color: #0070f3;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #0052cc;
}
table {
margin: 1em 0 1em 0; /* adjust top and bottom margins */
border-collapse: collapse;
width: 20ch; /* adjust width for inputting text of up to 20 characters */
margin-left: 0; /* align the table to the left */
}
td,
th {
border: 1px solid #ddd;
padding: 0.5em;
text-align: left; /* align the columns to the left */
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
</style>

View File

@ -8,7 +8,6 @@
import FileUploadCard from '$routes/gallery/components/upload/FileUploadCard.svelte' import FileUploadCard from '$routes/gallery/components/upload/FileUploadCard.svelte'
import ImageCard from '$routes/gallery/components/imageGallery/ImageCard.svelte' import ImageCard from '$routes/gallery/components/imageGallery/ImageCard.svelte'
import ImageModal from '$routes/gallery/components/imageGallery/ImageModal.svelte' import ImageModal from '$routes/gallery/components/imageGallery/ImageModal.svelte'
/** /**
* Open the ImageModal and pass it the selected `image` from the gallery * Open the ImageModal and pass it the selected `image` from the gallery
* @param image * @param image
@ -81,6 +80,26 @@
} }
</script> </script>
<style>
form {
display: grid;
grid-template-columns: 1fr 3fr;
}
label {
text-align: left;
}
button{
background-color: #4CAF50; /* Green */
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
</style>
<section class="overflow-hidden text-gray-700"> <section class="overflow-hidden text-gray-700">
<div class="pt-8 p-6 md:p-8 mx-auto"> <div class="pt-8 p-6 md:p-8 mx-auto">
<div <div
@ -89,32 +108,32 @@
{#each $galleryStore.selectedArea === AREAS.PRIVATE ? $galleryStore.privateImages : $galleryStore.publicImages as image}{/each} {#each $galleryStore.selectedArea === AREAS.PRIVATE ? $galleryStore.privateImages : $galleryStore.publicImages as image}{/each}
</div> </div>
<form on:submit|preventDefault={handleSubmit}> <form on:submit|preventDefault={handleSubmit}>
<label> <label class="label dark:text-white">
Bioregion: Bioregion:
<input type="text" bind:value={bioregion} /> <input type="text" bind:value={bioregion} />
</label> </label>
<br /> <br />
<label> <label class="label dark:text-white">
Ecozone: Ecozone:
<input type="text" bind:value={ecozone} /> <input type="text" bind:value={ecozone} />
</label> </label >
<br /> <br />
<label> <label class="label dark:text-white">
Skills: Skills:
<input type="text" bind:value={skills} /> <input type="text" bind:value={skills} />
</label> </label>
<br /> <br />
<label> <label class="label dark:text-white">
Interests: Interests:
<input type="text" bind:value={interests} /> <input type="text" bind:value={interests} />
</label> </label>
<br /> <br />
<label> <label class="label dark:text-white">
Associated organizations: Associated organizations:
<input type="text" bind:value={associatedOrganizations} /> <input type="text" bind:value={associatedOrganizations} />
</label> </label>
<br /> <br />
<button type="submit">Submit</button> <button class="bg-blue-500 text-white dark:text-black" type="submit">Submit</button>
</form> </form>
</div> </div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,3 +1,42 @@
<svg width="41" height="40" viewBox="0 0 41 40" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="300" height="300" viewBox="0 0 300 300" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.80014 0C2.11147 0 0.5 1.5988 0.5 5.33333V34.6667C0.5 38.2546 2.15638 40 5.80014 40H34.9509C38.6237 40 40.2511 38.3217 40.2511 34.6667V20V5.33333C40.2511 1.66328 38.5933 0 34.9509 0H5.80014ZM9.61977 26.3973L11.4071 8.19874C11.5721 6.51804 10.2601 5.06087 8.5817 5.06087C6.54113 5.06087 5.00311 7.25162 5.56756 9.33737C6.32321 12.1297 7.05409 15.8329 7.1008 19.8269C7.12801 22.1528 6.89382 24.4032 6.5413 26.4418C6.18692 28.4913 6.74291 30.6292 7.91183 32.2521C9.078 33.8711 10.8225 34.939 12.8345 34.939H13.8722C16.4179 34.939 18.4816 32.8623 18.4816 30.3007V28.366C18.4816 27.2024 17.6418 26.2111 16.5001 26.027L15.0877 25.7993C14.5066 25.7056 13.9681 26.1263 13.9142 26.716L13.9058 26.8085C13.804 27.9234 12.8747 28.7766 11.7621 28.7766C10.4895 28.7766 9.49461 27.6717 9.61977 26.3973ZM18.4816 20.6202V13.0906C18.4816 12.0593 19.3125 11.2232 20.3374 11.2232C21.3623 11.2232 22.1931 12.0593 22.1931 13.0906V29.3368C22.1931 32.4308 24.6857 34.939 27.7604 34.939H27.9968C31.9921 34.939 34.9722 30.6591 34.2387 26.5283C33.873 24.4687 33.6186 22.1901 33.6186 19.8342C33.6186 15.7318 34.3901 11.9363 35.1823 9.11807C35.7362 7.14741 34.2829 5.06087 32.3573 5.06087C30.8068 5.06087 29.5853 6.39061 29.707 7.94602L31.1527 26.4221C31.2521 27.6914 30.2552 28.7766 28.9899 28.7766C27.8686 28.7766 26.932 27.9168 26.8294 26.7932L25.2537 9.53259C25.0224 6.99939 22.9109 5.06087 20.3828 5.06087C17.844 5.06087 15.7272 7.01542 15.5095 9.56072L14.4642 20.4466C14.3728 21.5149 15.1249 22.4697 16.1794 22.6241C17.3934 22.8019 18.4816 21.8547 18.4816 20.6202Z" fill="#171717"/> <style>
@media (prefers-color-scheme: dark) {
.a { stroke: white }
}
</style>
<path class="a" d="M297.5 151C297.5 225.642 231.662 286.5 150 286.5C68.3377 286.5 2.5 225.642 2.5 151C2.5 76.3576 68.3377 15.5 150 15.5C231.662 15.5 297.5 76.3576 297.5 151Z" stroke="black" stroke-width="5"/>
<path class="a" d="M120.5 63.5C120.5 74.3495 110.855 83.5 98.5 83.5C86.1451 83.5 76.5 74.3495 76.5 63.5C76.5 52.6505 86.1451 43.5 98.5 43.5C110.855 43.5 120.5 52.6505 120.5 63.5Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path class="a" d="M165.5 284C165.5 291.187 158.845 297.5 150 297.5C141.155 297.5 134.5 291.187 134.5 284C134.5 276.813 141.155 270.5 150 270.5C158.845 270.5 165.5 276.813 165.5 284Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path class="a" d="M32.5 216C32.5 223.25 25.9999 229.5 17.5 229.5C9.00014 229.5 2.5 223.25 2.5 216C2.5 208.75 9.00014 202.5 17.5 202.5C25.9999 202.5 32.5 208.75 32.5 216Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path class="a" d="M32.5 86C32.5 93.2497 25.9999 99.5 17.5 99.5C9.00014 99.5 2.5 93.2497 2.5 86C2.5 78.7503 9.00014 72.5 17.5 72.5C25.9999 72.5 32.5 78.7503 32.5 86Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path class="a" d="M165.5 16C165.5 23.1872 158.845 29.5 150 29.5C141.155 29.5 134.5 23.1872 134.5 16C134.5 8.81284 141.155 2.5 150 2.5C158.845 2.5 165.5 8.81284 165.5 16Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path class="a" d="M297.5 86C297.5 93.2497 291 99.5 282.5 99.5C274 99.5 267.5 93.2497 267.5 86C267.5 78.7503 274 72.5 282.5 72.5C291 72.5 297.5 78.7503 297.5 86Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path class="a" d="M297.5 216C297.5 223.25 291 229.5 282.5 229.5C274 229.5 267.5 223.25 267.5 216C267.5 208.75 274 202.5 282.5 202.5C291 202.5 297.5 208.75 297.5 216Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path class="a" d="M221.5 233.5C221.5 244.35 211.855 253.5 199.5 253.5C187.145 253.5 177.5 244.35 177.5 233.5C177.5 222.65 187.145 213.5 199.5 213.5C211.855 213.5 221.5 222.65 221.5 233.5Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path class="a" d="M272.5 148C272.5 159.085 262.451 168.5 249.5 168.5C236.549 168.5 226.5 159.085 226.5 148C226.5 136.915 236.549 127.5 249.5 127.5C262.451 127.5 272.5 136.915 272.5 148Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path class="a" d="M120.5 233.5C120.5 244.35 110.855 253.5 98.5 253.5C86.1451 253.5 76.5 244.35 76.5 233.5C76.5 222.65 86.1451 213.5 98.5 213.5C110.855 213.5 120.5 222.65 120.5 233.5Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path class="a" d="M71.5 148C71.5 159.175 61.8014 168.5 49.5 168.5C37.1986 168.5 27.5 159.175 27.5 148C27.5 136.825 37.1986 127.5 49.5 127.5C61.8014 127.5 71.5 136.825 71.5 148Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<path class="a" d="M221.5 63.5C221.5 74.3495 211.855 83.5 199.5 83.5C187.145 83.5 177.5 74.3495 177.5 63.5C177.5 52.6505 187.145 43.5 199.5 43.5C211.855 43.5 221.5 52.6505 221.5 63.5Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
<line x1="84.5576" y1="217.037" x2="55.8657" y2="168.553" stroke="black" stroke-width="8"/>
<line x1="234.171" y1="130.792" x2="209.445" y2="82.833" stroke="black" stroke-width="8"/>
<line x1="178" y1="235" x2="121" y2="235" stroke="black" stroke-width="8"/>
<path class="a" d="M227 149L74 149" stroke="black" stroke-width="8"/>
<line y1="-4" x2="55.354" y2="-4" transform="matrix(-1 -0.00014994 0.000178883 -1 176.441 62.4434)" stroke="black" stroke-width="8"/>
<line x1="241.564" y1="168.817" x2="215.564" y2="219.817" stroke="black" stroke-width="8"/>
<line x1="189.316" y1="82.5077" x2="113.484" y2="216.965" stroke="black" stroke-width="8"/>
<line y1="-4" x2="154.898" y2="-4" transform="matrix(0.507323 0.861756 -0.896761 0.442514 109.72 81.9006)" stroke="black" stroke-width="8"/>
<line x1="23.7977" y1="101.124" x2="37.3826" y2="128.988" stroke="black" stroke-width="4"/>
<line x1="33.5867" y1="82.0356" x2="75.3673" y2="68.1027" stroke="black" stroke-width="4"/>
<line x1="223.402" y1="230.091" x2="267.771" y2="216.191" stroke="black" stroke-width="4"/>
<line x1="272.969" y1="203.08" x2="257.175" y2="167.818" stroke="black" stroke-width="4"/>
<line y1="-2" x2="33.7483" y2="-2" transform="matrix(0.439342 -0.89832 0.925271 0.379307 261.45 128.959)" stroke="black" stroke-width="4"/>
<line x1="222.67" y1="68.1156" x2="267.67" y2="84.1156" stroke="black" stroke-width="4"/>
<line y1="-2" x2="30.3872" y2="-2" transform="matrix(0.699374 0.714756 -0.773204 0.634157 162.603 25.3394)" stroke="black" stroke-width="4"/>
<line y1="-2" x2="32.7185" y2="-2" transform="matrix(0.694859 0.719146 -0.777103 0.629373 112.685 251.584)" stroke="black" stroke-width="4"/>
<line x1="32.5285" y1="220.213" x2="75.4034" y2="229.041" stroke="black" stroke-width="4"/>
<line x1="23.0962" y1="203.387" x2="35.1638" y2="165.903" stroke="black" stroke-width="4"/>
<line x1="111.796" y1="45.403" x2="137.832" y2="25.7735" stroke="black" stroke-width="4"/>
<line x1="161.087" y1="274.383" x2="183.445" y2="246.742" stroke="black" stroke-width="4"/>
<line y1="-4" x2="53.1745" y2="-4" transform="matrix(-0.511202 0.859461 -0.894943 -0.446182 86.491 81.9006)" stroke="black" stroke-width="8"/>
<path class="a" d="M184.5 148C184.5 163.495 170.431 176.5 152.5 176.5C134.569 176.5 120.5 163.495 120.5 148C120.5 132.505 134.569 119.5 152.5 119.5C170.431 119.5 184.5 132.505 184.5 148Z" fill="#7AFFDF" stroke="black" stroke-width="5"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

43
webpack.config.cjs Normal file
View File

@ -0,0 +1,43 @@
const path = require('path')
const { merge } = require('webpack-merge')
const parts = require('./webpack.parts.cjs')
const { mode, analyze } = require('webpack-nano/argv')
const common = merge([
{ output: { path: path.resolve(process.cwd(), 'dist') } },
parts.page({ title: 'Sh*t Kanye says' }),
parts.svelte(mode),
parts.extractCSS({ loaders: [parts.postcss()] }),
parts.cleanDist(),
parts.useWebpackBar(),
parts.useDotenv()
])
const development = merge([
{ entry: ['./src/routes/+page.svelte', 'webpack-plugin-serve/client'] },
{ target: 'web' },
parts.generateSourceMaps({ type: 'eval-source-map' }),
parts.esbuild(),
parts.devServer()
])
const production = merge(
[
{ entry: ['./src/routes/+page.svelte'] },
parts.typescript(),
analyze && parts.analyze()
].filter(Boolean)
)
const getConfig = mode => {
switch (mode) {
case 'production':
return merge(common, production, { mode })
case 'development':
return merge(common, development, { mode })
default:
throw new Error(`Unknown mode, ${mode}`)
}
}
module.exports = getConfig(mode)

137
webpack.parts.cjs Normal file
View File

@ -0,0 +1,137 @@
const path = require('path')
const { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin')
const { WebpackPluginServe } = require('webpack-plugin-serve')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const WebpackBar = require('webpackbar')
const DotenvPlugin = require('dotenv-webpack')
const { ESBuildPlugin } = require('esbuild-loader')
exports.devServer = () => ({
watch: true,
plugins: [
new WebpackPluginServe({
port: 3000,
static: path.resolve(process.cwd(), 'dist'),
historyFallback: true
})
]
})
exports.page = ({ title }) => ({
plugins: [new MiniHtmlWebpackPlugin({ publicPath: '/', context: { title } })]
})
exports.generateSourceMaps = ({ type }) => ({ devtool: type })
exports.svelte = mode => {
const prod = mode === 'production'
return {
resolve: {
alias: {
svelte: path.dirname(require.resolve('svelte/package.json'))
},
extensions: ['.mjs', '.js', '.svelte', '.ts'],
mainFields: ['svelte', 'browser', 'module', 'main']
},
module: {
rules: [
{
test: /\.svelte$/,
use: {
loader: 'svelte-loader',
options: {
compilerOptions: {
dev: !prod
},
emitCss: prod,
hotReload: !prod,
// preprocess: preprocess({
// postcss: true
// })
}
}
},
{
test: /node_modules\/svelte\/.*\.mjs$/,
resolve: {
fullySpecified: false
}
}
]
}
}
}
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
// ...
exports.postcss = () => ({
loader: 'postcss-loader'
})
exports.extractCSS = ({ options = {}, loaders = [] } = {}) => {
return {
module: {
rules: [
{
test: /\.(p?css)$/,
use: [{ loader: MiniCssExtractPlugin.loader, options }, 'css-loader'].concat(
loaders
),
sideEffects: true
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css'
})
]
}
}
exports.cleanDist = () => ({
plugins: [new CleanWebpackPlugin()]
})
// show a nice progress bar in the terminal
exports.useWebpackBar = () => ({
plugins: [new WebpackBar()]
})
exports.useDotenv = () => ({
plugins: [new DotenvPlugin()]
})
exports.esbuild = () => {
return {
module: {
rules: [
{
test: /\.js$/,
loader: 'esbuild-loader',
options: {
target: 'es2015'
}
},
{
test: /\.ts$/,
loader: 'esbuild-loader',
options: {
loader: 'ts',
target: 'es2015'
}
}
]
},
plugins: [new ESBuildPlugin()]
}
}
exports.typescript = () => ({
module: { rules: [{ test: /\.ts$/, use: 'ts-loader', exclude: /node_modules/ }] }
})