mk13 Loader

This commit is contained in:
nelle 2024-07-06 21:23:23 -06:00
parent bf78a1e820
commit e71a1259c7

View file

@ -1,129 +1,113 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template> <template>
<div <div :class="[$style.root, { [$style.inline]: inline, [$style.colored]: colored, [$style.mini]: mini, [$style.em]: em }]">
:class="[ <div :class="$style.container">
$style.root, <svg :class="[$style.spinner, $style.bg]" viewBox="0 0 168 168" xmlns="http://www.w3.org/2000/svg">
{ <g transform="matrix(1.125,0,0,1.125,12,12)">
[$style.inline]: inline, <circle cx="64" cy="64" r="64" style="fill:none;stroke:currentColor;stroke-width:21.33px;"/>
[$style.colored]: colored, </g>
[$style.mini]: mini, </svg>
}, <svg :class="[$style.spinner, $style.fg, { [$style.static]: static }]" viewBox="0 0 168 168" xmlns="http://www.w3.org/2000/svg">
]" <g transform="matrix(1.125,0,0,1.125,12,12)">
> <path d="M128,64C128,28.654 99.346,0 64,0C99.346,0 128,28.654 128,64Z" style="fill:none;stroke:currentColor;stroke-width:21.33px;"/>
<div :class="$style.container" aria-hidden="true"> </g>
<svg
:class="[$style.spinner]"
viewBox="0 0 50 50"
xmlns="http://www.w3.org/2000/svg"
>
<circle
:class="[$style.path]"
cx="25"
cy="25"
r="20"
fill="none"
stroke-width="6px"
style="fill: none; stroke: currentColor; stroke-width: 6px"
></circle>
</svg> </svg>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {} from "vue"; import { } from 'vue';
const props = withDefaults( const props = withDefaults(defineProps<{
defineProps<{ static?: boolean;
inline?: boolean; inline?: boolean;
colored?: boolean; colored?: boolean;
mini?: boolean; mini?: boolean;
em?: boolean; em?: boolean;
}>(), }>(), {
{ static: false,
inline: false, inline: false,
colored: true, colored: true,
mini: false, mini: false,
em: false, em: false,
}, });
); </script>
</script>
<style lang="scss" module> <style lang="scss" module>
/* Credit to https://codepen.io/supah/pen/BjYLdW */ @keyframes spinner {
0% {
@keyframes spin { transform: rotate(0deg);
0% { }
transform: rotate(0deg); 100% {
} transform: rotate(360deg);
100% { }
transform: rotate(360deg);
}
}
@keyframes dash {
0% {
stroke-dasharray: 1, 150;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -35;
}
100% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -124;
}
}
.root {
padding: 32px;
text-align: center;
cursor: wait;
--size: 40px;
&.colored {
color: var(--accent);
} }
&.inline { .root {
display: inline; padding: 32px;
padding: 0; text-align: center;
--size: 32px; cursor: wait;
--size: 38px;
&.colored {
color: var(--accent);
}
&.inline {
display: inline;
padding: 0;
--size: 32px;
}
&.mini {
padding: 16px;
--size: 32px;
}
&.em {
display: inline-block;
vertical-align: middle;
padding: 0;
--size: 1em;
}
} }
&.mini { .container {
padding: 16px; position: relative;
--size: 32px; width: var(--size);
height: var(--size);
margin: 0 auto;
} }
&.em {
display: inline-block; .spinner {
vertical-align: middle; position: absolute;
padding: 0; top: 0;
--size: 1em; left: 0;
width: var(--size);
height: var(--size);
fill-rule: evenodd;
clip-rule: evenodd;
stroke-linecap: round;
stroke-linejoin: round;
stroke-miterlimit: 1.5;
} }
}
.container { .bg {
position: relative; opacity: 0.275;
width: var(--size); }
height: var(--size);
margin: 0 auto;
}
.spinner { .fg {
position: absolute; animation: spinner 0.5s linear infinite;
top: 0;
left: 0; &.static {
z-index: 999; animation-play-state: paused;
width: var(--size); }
height: var(--size); }
animation: spin 2s linear infinite; </style>
}
.path {
stroke: var(--accent);
stroke-linecap: round;
animation: dash 1.2s ease-in-out infinite;
}
</style>