chore: shuffle files around

This commit is contained in:
Alexander Daichendt 2022-07-30 00:20:24 +02:00
parent 2d7ffaff20
commit 09a29f82cb
18 changed files with 6 additions and 6 deletions

View file

@ -1,77 +0,0 @@
<script lang="ts">
let copied = false;
function copyToClipboard(event: MouseEvent) {
// @ts-ignore
const target = event.target?.innerText.split('\n')[0];
navigator.clipboard.writeText(target);
// select the double clicked node
let sel = document.getSelection();
let range = new Range();
range.selectNode(event.target?.firstChild);
sel?.removeAllRanges();
sel?.addRange(range);
if (!copied) {
copied = true;
setTimeout(() => (copied = false), 3000);
}
}
</script>
<code on:dblclick={copyToClipboard}>
<span class="text">
<slot />
</span>
<div class:copied class="copyWrapper">
{#if copied}
Copied
{:else}
Double click to copy
{/if}
</div>
</code>
<style>
.copied {
background-color: yellowgreen !important;
min-width: 3rem !important;
}
.copyWrapper {
background-color: var(--special-color);
margin-bottom: 0.2rem;
padding: 0.2rem;
border-radius: 3px;
position: absolute;
min-width: 10rem;
visibility: hidden;
z-index: 1;
bottom: 100%;
left: 0;
margin-left: 0px;
}
code:hover .copyWrapper {
visibility: visible;
}
code {
position: relative;
display: inline-block;
background-color: var(--light-color);
border-radius: 5px;
box-shadow: 0 0 5px var(--shadow-color);
padding: 2px;
border: 1px solid var(--border-color);
line-break: anywhere;
}
:global([data-nu-scheme-is='dark'] body code:not([class*='language-'])) {
color: var(--bg-color);
}
:global(pre[class*='language-']) {
margin: 0.5em 1rem !important;
}
:global(code[class*='language-'], pre[class*='language-']) {
font-size: 0.9rem;
}
</style>

View file

@ -1,9 +0,0 @@
<hr />
<style>
hr {
background-color: var(--special-color);
border: none;
height: 1px;
}
</style>

View file

@ -1,51 +0,0 @@
<script lang="ts">
import { mdiLinkVariant } from '@mdi/js';
import { mdiChevronRight } from '@mdi/js';
import Icon from 'mdi-svelte';
export let href: string;
export let disableIcon = false;
export let disablePrefetch = false;
// svelte-ignore unused-export-let
export let rel = '';
const internal = !href.startsWith('http');
// external props
let props: Record<string,string|boolean> = {
rel: "nofollow noreferrer noopener",
target: "_blank"
}
if (internal) {
// internal props
if (!disablePrefetch ){
props = {
"sveltekit:prefetch": true
}
}
}
</script>
<a
{...$$props}
{...props}
{href}
>
{#if !disableIcon && !internal}
<Icon path={internal ? mdiChevronRight : mdiLinkVariant} size="1rem" />
{/if}
<span class="text"><slot /></span>
</a><style>
a {
color: var(--special-color);
text-decoration: none;
font-weight: 550;
}
a:hover {
background-color: var(--outline-color);
color: var(--dark-color)
}
.text {
text-decoration: underline;
line-break: anywhere;
}
</style>

View file

@ -1,11 +0,0 @@
<script lang="ts">
export let id: string | undefined = undefined;
</script>
<li {id}><slot /></li>
<style>
li {
margin: 0.4rem 0;
}
</style>

View file

@ -1,38 +0,0 @@
<script lang="ts">
import { mdiChevronDoubleUp } from '@mdi/js';
import Icon from 'mdi-svelte';
let y: number = 0;
$: enabled = y > 100;
function onClick() {
window.scrollTo({ top: 0, behavior: 'smooth' });
}
</script>
<svelte:window bind:scrollY={y} />
{#if enabled}
<button on:click={onClick}><Icon path={mdiChevronDoubleUp} /></button>
{/if}
<style>
button:focus {
box-shadow: 0 0 5px var(--special-shadow-color);
}
button {
border-radius: 35px;
width: 48px;
height: 48px;
position: fixed;
bottom: 32px;
right: 32px;
color: var(--text-soft-color);
border: 2px solid var(--border-color);
background-color: var(--light-color);
}
button:hover {
color: var(--special-color);
border: 4px solid var(--border-color);
}
</style>

View file

@ -1,51 +0,0 @@
<script>
</script>
<div tabindex="0">
<table id="table">
<slot />
</table>
</div>
<style>
div {
border-radius: 0.5rem;
padding: 1rem;
box-shadow: 0px 0px 2px var(--shadow-color);
border: 1px solid var(--outline-color);
overflow: auto;
}
table {
border-collapse: collapse;
width: 100%;
}
:global(#table thead th) {
padding-bottom: 0.25rem;
padding-left: 1rem;
padding-right: 1rem;
border: solid;
width: 350px;
margin: auto;
border-top: none;
border-left: none;
border-right: none;
border-bottom: none;
background: linear-gradient(var(--special-color), var(--special-color)) bottom
/* left or right or else */ no-repeat;
background-size: 50% 2px;
}
:global(#table tbody tr) {
border-bottom: 1px solid var(--outline-color);
}
:global(#table tbody tr:last-child) {
border-bottom: none;
}
:global(#table tbody td) {
padding: 0.5rem;
}
</style>

View file

@ -1,138 +0,0 @@
<script lang="js">
// @ts-nocheck
import { onMount } from 'svelte';
let checked = false;
onMount(() => {
const ROOT = document.querySelector(':root');
const DARK = 'dark';
const LIGHT = 'light';
const HIGH = 'more';
const LOW = 'no-preference';
const SCHEMES = [DARK, LIGHT];
const CONTRASTS = [HIGH, LOW];
function observeContext(data) {
if (data.find((record) => !record.attributeName.endsWith('-is'))) {
setScheme();
setContrast();
}
}
const schemeMedia = matchMedia('(prefers-color-scheme: dark)');
const contrastMedia = matchMedia('(prefers-contrast: more)');
let globalScheme = schemeMedia.matches ? DARK : LIGHT;
let globalContrast = contrastMedia.matches ? HIGH : LOW;
schemeMedia.addListener((_media) => {
globalScheme = _media.matches ? DARK : LIGHT;
setScheme();
});
contrastMedia.addListener((_media) => {
globalContrast = _media.matches ? HIGH : LOW;
setContrast();
});
function setScheme() {
const setting = ROOT.dataset.nuScheme;
ROOT.dataset.nuSchemeIs =
(setting !== 'auto' && SCHEMES.includes(setting) && setting) || globalScheme;
}
function setContrast() {
const setting = ROOT.dataset.nuContrast;
ROOT.dataset.nuContrastIs =
(setting !== 'auto' && CONTRASTS.includes(setting) && setting) || globalContrast;
}
const observer = new MutationObserver((data) => observeContext(data));
observer.observe(ROOT, {
characterData: false,
attributes: true,
childList: false,
subtree: false,
});
setScheme();
// adjust the theme selector
checked = globalScheme === DARK;
setContrast();
// Switch to dark scheme
// ROOT.dataset.nuContrast = 'more';
// Increase contrast
// ROOT.dataset.nuScheme = 'dark';
});
function toggleTheme() {
const root = document.querySelector(':root');
const theme = root.dataset['nuSchemeIs'];
if (theme === 'light') {
root.dataset['nuScheme'] = 'dark';
} else {
root.dataset['nuScheme'] = 'light';
}
}
</script>
<label class="switch">
<input aria-label="Nightmode" type="checkbox" bind:checked on:change={toggleTheme} />
<span class="slider round" />
</label>
<style>
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: lightskyblue;
transition: 0.4s;
}
.slider:before {
position: absolute;
content: '';
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: gold;
transition: 0.4s;
background: radial-gradient(yellow, orange 63%, transparent calc(63% + 3px) 100%);
}
input:checked + .slider {
background-color: var(--special-mark-color);
}
input:checked + .slider:before {
background-color: white;
background: radial-gradient(circle at 19% 19%, transparent 41%, var(--outline-color) 43%);
}
input:focus + .slider {
box-shadow: 0 0 5px var(--special-shadow-color);
}
input:checked + .slider:before {
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
</style>

View file

@ -1,29 +0,0 @@
<svg
width="1.5rem"
height="1.5rem"
viewBox="0 0 54 54"
style="vertical-align: middle"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M19.4414 3.24C19.4414 1.4506 20.892 0 22.6814 0C34.6108 0 44.2814 9.67065 44.2814 21.6C44.2814 23.3894 42.8308 24.84 41.0414 24.84C39.252 24.84 37.8014 23.3894 37.8014 21.6C37.8014 13.2494 31.032 6.48 22.6814 6.48C20.892 6.48 19.4414 5.0294 19.4414 3.24Z"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M34.5586 50.76C34.5586 52.5494 33.108 54 31.3186 54C19.3893 54 9.71861 44.3294 9.71861 32.4C9.71861 30.6106 11.1692 29.16 12.9586 29.16C14.748 29.16 16.1986 30.6106 16.1986 32.4C16.1986 40.7505 22.9681 47.52 31.3186 47.52C33.108 47.52 34.5586 48.9706 34.5586 50.76Z"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M3.24 34.5601C1.4506 34.5601 -6.34076e-08 33.1095 -1.41625e-07 31.3201C-6.63074e-07 19.3907 9.67065 9.72007 21.6 9.72007C23.3894 9.72007 24.84 11.1707 24.84 12.9601C24.84 14.7495 23.3894 16.2001 21.6 16.2001C13.2495 16.2001 6.48 22.9695 6.48 31.3201C6.48 33.1095 5.0294 34.5601 3.24 34.5601Z"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M50.76 19.4399C52.5494 19.4399 54 20.8905 54 22.6799C54 34.6093 44.3294 44.2799 32.4 44.2799C30.6106 44.2799 29.16 42.8293 29.16 41.0399C29.16 39.2505 30.6106 37.7999 32.4 37.7999C40.7505 37.7999 47.52 31.0305 47.52 22.6799C47.52 20.8905 48.9706 19.4399 50.76 19.4399Z"
/>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -1,14 +0,0 @@
<script lang="ts">
export let id: string | undefined;
</script>
<sup {id}><slot /></sup>
<style>
sup {
vertical-align: top;
position: relative;
top: -0.3em;
left: -0.2em;
}
</style>