1
0
forked from mirror/misskey

refactor(client): use css modules

This commit is contained in:
syuilo 2023-01-14 17:23:49 +09:00
parent 99bdb11d24
commit c41879c542
10 changed files with 139 additions and 147 deletions

View File

@ -8,7 +8,7 @@
</template> </template>
<template #default="{ items: notifications }"> <template #default="{ items: notifications }">
<MkDateSeparatedList v-slot="{ item: notification }" class="elsfgstc" :items="notifications" :no-gap="true"> <MkDateSeparatedList v-slot="{ item: notification }" :class="$style.list" :items="notifications" :no-gap="true">
<XNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :key="notification.id" :note="notification.note"/> <XNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :key="notification.id" :note="notification.note"/>
<XNotification v-else :key="notification.id" :notification="notification" :with-time="true" :full="true" class="_panel notification"/> <XNotification v-else :key="notification.id" :notification="notification" :with-time="true" :full="true" class="_panel notification"/>
</MkDateSeparatedList> </MkDateSeparatedList>
@ -97,8 +97,8 @@ onUnmounted(() => {
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.elsfgstc { .list {
background: var(--panel); background: var(--panel);
} }
</style> </style>

View File

@ -17,7 +17,7 @@
</template> </template>
</template> </template>
<div class="yrolvcoq" :style="{ background: pageMetadata?.value?.bg }" style="container-type: inline-size;"> <div :class="$style.root" :style="{ background: pageMetadata?.value?.bg }" style="container-type: inline-size;">
<RouterView :router="router"/> <RouterView :router="router"/>
</div> </div>
</MkWindow> </MkWindow>
@ -133,8 +133,8 @@ defineExpose({
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.yrolvcoq { .root {
min-height: 100%; min-height: 100%;
background: var(--bg); background: var(--bg);

View File

@ -1,6 +1,6 @@
<template> <template>
<div :class="$style.root" :style="{ zIndex, top: `${y - 64}px`, left: `${x - 64}px` }"> <div :class="$style.root" :style="{ zIndex, top: `${y - 64}px`, left: `${x - 64}px` }">
<span class="text" :class="{ up }"> <span :class="[$style.text, { [$style.up]: up }]">
<MkReactionIcon class="icon" :reaction="reaction"/> <MkReactionIcon class="icon" :reaction="reaction"/>
</span> </span>
</div> </div>
@ -43,30 +43,28 @@ onMounted(() => {
position: fixed; position: fixed;
width: 128px; width: 128px;
height: 128px; height: 128px;
}
&:global { .text {
> .text { display: block;
display: block; height: 1em;
height: 1em; text-align: center;
text-align: center; position: absolute;
position: absolute; top: 0;
top: 0; left: 0;
left: 0; right: 0;
right: 0; bottom: 0;
bottom: 0; margin: auto;
margin: auto; color: var(--accent);
color: var(--accent); font-size: 18px;
font-size: 18px; font-weight: bold;
font-weight: bold; transform: translateY(-30px);
transform: translateY(-30px); transition: transform 1s cubic-bezier(0,.5,0,1), opacity 1s cubic-bezier(.5,0,1,.5);
transition: transform 1s cubic-bezier(0,.5,0,1), opacity 1s cubic-bezier(.5,0,1,.5); will-change: opacity, transform;
will-change: opacity, transform;
&.up { &.up {
opacity: 0; opacity: 0;
transform: translateY(-50px) rotateZ(v-bind(angle)); transform: translateY(-50px) rotateZ(v-bind(angle));
}
}
} }
} }
</style> </style>

View File

@ -1,8 +1,8 @@
<template> <template>
<MkTooltip ref="tooltip" :showing="showing" :target-element="targetElement" :max-width="340" @closed="emit('closed')"> <MkTooltip ref="tooltip" :showing="showing" :target-element="targetElement" :max-width="340" @closed="emit('closed')">
<div class="beeadbfb"> <div :class="$style.root">
<MkReactionIcon :reaction="reaction" class="icon" :no-style="true"/> <MkReactionIcon :reaction="reaction" :class="$style.icon" :no-style="true"/>
<div class="name">{{ reaction.replace('@.', '') }}</div> <div :class="$style.name">{{ reaction.replace('@.', '') }}</div>
</div> </div>
</MkTooltip> </MkTooltip>
</template> </template>
@ -23,20 +23,20 @@ const emit = defineEmits<{
}>(); }>();
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.beeadbfb { .root {
text-align: center; text-align: center;
}
> .icon { .icon {
display: block; display: block;
width: 60px; width: 60px;
font-size: 60px; // unicodewidth font-size: 60px; // unicodewidth
margin: 0 auto; margin: 0 auto;
object-fit: contain; object-fit: contain;
} }
> .name { .name {
font-size: 0.9em; font-size: 0.9em;
}
} }
</style> </style>

View File

@ -1,16 +1,16 @@
<template> <template>
<MkTooltip ref="tooltip" :showing="showing" :target-element="targetElement" :max-width="340" @closed="emit('closed')"> <MkTooltip ref="tooltip" :showing="showing" :target-element="targetElement" :max-width="340" @closed="emit('closed')">
<div class="bqxuuuey"> <div :class="$style.root">
<div class="reaction"> <div :class="$style.reaction">
<MkReactionIcon :reaction="reaction" class="icon" :no-style="true"/> <MkReactionIcon :reaction="reaction" :class="$style.reactionIcon" :no-style="true"/>
<div class="name">{{ getReactionName(reaction) }}</div> <div :class="$style.reactionName">{{ getReactionName(reaction) }}</div>
</div> </div>
<div class="users"> <div :class="$style.users">
<div v-for="u in users" :key="u.id" class="user"> <div v-for="u in users" :key="u.id" :class="$style.user">
<MkAvatar class="avatar" :user="u"/> <MkAvatar :class="$style.avatar" :user="u"/>
<MkUserName class="name" :user="u" :nowrap="true"/> <MkUserName :user="u" :nowrap="true"/>
</div> </div>
<div v-if="users.length > 10" class="omitted">+{{ count - 10 }}</div> <div v-if="users.length > 10">+{{ count - 10 }}</div>
</div> </div>
</div> </div>
</MkTooltip> </MkTooltip>
@ -43,53 +43,53 @@ function getReactionName(reaction: string): string {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.bqxuuuey { .root {
display: flex; display: flex;
}
> .reaction { .reaction {
max-width: 100px; max-width: 100px;
text-align: center; text-align: center;
}
> .icon { .reactionIcon {
display: block; display: block;
width: 60px; width: 60px;
font-size: 60px; // unicodewidth font-size: 60px; // unicodewidth
object-fit: contain; object-fit: contain;
margin: 0 auto; margin: 0 auto;
} }
> .name { .reactionName {
font-size: 1em; font-size: 1em;
} }
}
> .users { .users {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
font-size: 0.95em; font-size: 0.95em;
border-left: solid 0.5px var(--divider); border-left: solid 0.5px var(--divider);
padding-left: 10px; padding-left: 10px;
margin-left: 10px; margin-left: 10px;
margin-right: 14px; margin-right: 14px;
text-align: left; text-align: left;
}
> .user { .user {
line-height: 24px; line-height: 24px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
&:not(:last-child) { &:not(:last-child) {
margin-bottom: 3px; margin-bottom: 3px;
}
> .avatar {
width: 24px;
height: 24px;
margin-right: 3px;
}
}
} }
} }
.avatar {
width: 24px;
height: 24px;
margin-right: 3px;
}
</style> </style>

View File

@ -2,12 +2,12 @@
<button <button
ref="buttonEl" ref="buttonEl"
v-ripple="canToggle" v-ripple="canToggle"
class="hkzvhatu _button" class="_button"
:class="{ reacted: note.myReaction == reaction, canToggle }" :class="[$style.root, { [$style.reacted]: note.myReaction == reaction, [$style.canToggle]: canToggle }]"
@click="toggleReaction()" @click="toggleReaction()"
> >
<MkReactionIcon class="icon" :reaction="reaction"/> <MkReactionIcon :class="$style.icon" :reaction="reaction"/>
<span class="count">{{ count }}</span> <span :class="$style.count">{{ count }}</span>
</button> </button>
</template> </template>
@ -92,8 +92,8 @@ useTooltip(buttonEl, async (showing) => {
}, 100); }, 100);
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.hkzvhatu { .root {
display: inline-block; display: inline-block;
height: 32px; height: 32px;
margin: 2px; margin: 2px;
@ -127,11 +127,11 @@ useTooltip(buttonEl, async (showing) => {
filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)); filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
} }
} }
}
> .count { .count {
font-size: 0.9em; font-size: 0.9em;
line-height: 32px; line-height: 32px;
margin: 0 0 0 4px; margin: 0 0 0 4px;
}
} }
</style> </style>

View File

@ -1,5 +1,12 @@
<template> <template>
<TransitionGroup :name="$store.state.animation ? 'x' : ''" tag="div" class="tdflqwzn" :class="{ isMe }"> <TransitionGroup
:enter-active-class="$store.state.animation ? $style.transition_x_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_x_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_x_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_x_leaveTo : ''"
:move-class="$store.state.animation ? $style.transition_x_move : ''"
tag="div" :class="$style.root"
>
<XReaction v-for="(count, reaction) in note.reactions" :key="reaction" :reaction="reaction" :count="count" :is-initial="initialReactions.has(reaction)" :note="note"/> <XReaction v-for="(count, reaction) in note.reactions" :key="reaction" :reaction="reaction" :count="count" :is-initial="initialReactions.has(reaction)" :note="note"/>
</TransitionGroup> </TransitionGroup>
</template> </template>
@ -19,29 +26,26 @@ const initialReactions = new Set(Object.keys(props.note.reactions));
const isMe = computed(() => $i && $i.id === props.note.userId); const isMe = computed(() => $i && $i.id === props.note.userId);
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.x-move, .x-enter-active, .x-leave-active { .transition_x_move,
.transition_x_enterActive,
.transition_x_leaveActive {
transition: opacity 0.2s cubic-bezier(0,.5,.5,1), transform 0.2s cubic-bezier(0,.5,.5,1) !important; transition: opacity 0.2s cubic-bezier(0,.5,.5,1), transform 0.2s cubic-bezier(0,.5,.5,1) !important;
} }
.x-enter-from, .x-leave-to { .transition_x_enterFrom,
.transition_x_leaveTo {
opacity: 0; opacity: 0;
transform: scale(0.7); transform: scale(0.7);
} }
.x-leave-active { .transition_x_leaveActive {
position: absolute; position: absolute;
} }
.tdflqwzn { .root {
margin: 4px -2px 0 -2px; margin: 4px -2px 0 -2px;
&:empty { &:empty {
display: none; display: none;
} }
&.isMe {
> span {
cursor: default !important;
}
}
} }
</style> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="jmgmzlwq"><i class="ti ti-alert-triangle" style="margin-right: 8px;"></i>{{ i18n.ts.remoteUserCaution }}<a class="link" :href="href" rel="nofollow noopener" target="_blank">{{ i18n.ts.showOnRemote }}</a></div> <div :class="$style.root"><i class="ti ti-alert-triangle" style="margin-right: 8px;"></i>{{ i18n.ts.remoteUserCaution }}<a :class="$style.link" :href="href" rel="nofollow noopener" target="_blank">{{ i18n.ts.showOnRemote }}</a></div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -10,18 +10,18 @@ defineProps<{
}>(); }>();
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.jmgmzlwq { .root {
font-size: 0.8em; font-size: 0.8em;
padding: 16px; padding: 16px;
background: var(--infoWarnBg); background: var(--infoWarnBg);
color: var(--infoWarnFg); color: var(--infoWarnFg);
border-radius: var(--radius); border-radius: var(--radius);
overflow: clip; overflow: clip;
}
> .link { .link {
margin-left: 4px; margin-left: 4px;
color: var(--accent); color: var(--accent);
}
} }
</style> </style>

View File

@ -1,6 +1,6 @@
<template> <template>
<span class="mk-sparkle"> <span :class="$style.root">
<span ref="el"> <span ref="el" style="display: inline-block;">
<slot></slot> <slot></slot>
</span> </span>
<!-- なぜか path に対する key が機能しないため <!-- なぜか path に対する key が機能しないため
@ -32,7 +32,7 @@
</path> </path>
</svg> </svg>
--> -->
<svg v-for="particle in particles" :key="particle.id" :width="width" :height="height" :viewBox="`0 0 ${width} ${height}`" xmlns="http://www.w3.org/2000/svg"> <svg v-for="particle in particles" :key="particle.id" :width="width" :height="height" :viewBox="`0 0 ${width} ${height}`" xmlns="http://www.w3.org/2000/svg" style="position: absolute; top: -32px; left: -32px;">
<path <path
style="transform-origin: center; transform-box: fill-box;" style="transform-origin: center; transform-box: fill-box;"
:transform="`translate(${particle.x} ${particle.y})`" :transform="`translate(${particle.x} ${particle.y})`"
@ -111,20 +111,10 @@ onUnmounted(() => {
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.mk-sparkle { .root {
position: relative; position: relative;
display: inline-block; display: inline-block;
pointer-events: none;
> span {
display: inline-block;
}
> svg {
position: absolute;
top: -32px;
left: -32px;
pointer-events: none;
}
} }
</style> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div v-tooltip="text" class="fzgwjkgc" :class="user.onlineStatus"></div> <div v-tooltip="text" :class="[$style.root, $style['status_' + user.onlineStatus]]"></div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -21,24 +21,24 @@ const text = $computed(() => {
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.fzgwjkgc { .root {
box-shadow: 0 0 0 3px var(--panel); box-shadow: 0 0 0 3px var(--panel);
border-radius: 120%; // Blink100% border-radius: 120%; // Blink100%
&.online { &.status_online {
background: #58d4c9; background: #58d4c9;
} }
&.active { &.status_active {
background: #e4bc48; background: #e4bc48;
} }
&.offline { &.status_offline {
background: #ea5353; background: #ea5353;
} }
&.unknown { &.status_unknown {
background: #888; background: #888;
} }
} }