Merge pull request 'Accessible Form Inputs!' (#10130) from Freeplay/calckey:settings into develop
Reviewed-on: https://codeberg.org/calckey/calckey/pulls/10130
This commit is contained in:
commit
3bf08a9610
18 changed files with 582 additions and 684 deletions
|
@ -526,6 +526,7 @@ total: "Total"
|
|||
weekOverWeekChanges: "Changes to last week"
|
||||
dayOverDayChanges: "Changes to yesterday"
|
||||
appearance: "Appearance"
|
||||
accessibility: "Accessibility"
|
||||
clientSettings: "Client Settings"
|
||||
accountSettings: "Account Settings"
|
||||
promotion: "Promoted"
|
||||
|
|
|
@ -81,7 +81,7 @@ export default defineComponent({
|
|||
|
||||
> .title {
|
||||
opacity: 0.7;
|
||||
margin: 0 0 8px 0;
|
||||
margin: 0 12px 8px;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="dwzlatin" :class="{ opened }">
|
||||
<button class="header _button" @click="toggle">
|
||||
<details class="dwzlatin" :open="defaultOpen">
|
||||
<summary class="header _button">
|
||||
<span class="icon"><slot name="icon"></slot></span>
|
||||
<span class="text"><slot name="label"></slot></span>
|
||||
<span class="right">
|
||||
|
@ -8,41 +8,26 @@
|
|||
<i v-if="opened" class="ph-caret-up ph-bold ph-lg icon"></i>
|
||||
<i v-else class="ph-caret-down ph-bold ph-lg icon"></i>
|
||||
</span>
|
||||
</button>
|
||||
<KeepAlive>
|
||||
<div v-if="openedAtLeastOnce" v-show="opened" class="body">
|
||||
<MkSpacer :margin-min="14" :margin-max="22">
|
||||
<slot></slot>
|
||||
</MkSpacer>
|
||||
</div>
|
||||
</KeepAlive>
|
||||
</div>
|
||||
</summary>
|
||||
<div class="body">
|
||||
<MkSpacer :margin-min="14" :margin-max="22">
|
||||
<slot></slot>
|
||||
</MkSpacer>
|
||||
</div>
|
||||
</details>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
defaultOpen: boolean;
|
||||
}>(),
|
||||
{
|
||||
defaultOpen: false,
|
||||
}
|
||||
);
|
||||
|
||||
let opened: boolean = $ref(props.defaultOpen);
|
||||
let openedAtLeastOnce: boolean = $ref(props.defaultOpen);
|
||||
|
||||
const toggle = (): void => {
|
||||
opened = !opened;
|
||||
if (opened) {
|
||||
openedAtLeastOnce = true;
|
||||
}
|
||||
};
|
||||
defineProps<{
|
||||
defaultOpen: boolean;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dwzlatin {
|
||||
display: block;
|
||||
overflow: clip;
|
||||
border-radius: 6px;
|
||||
|
||||
> .header {
|
||||
display: flex;
|
||||
|
@ -51,7 +36,6 @@ const toggle = (): void => {
|
|||
box-sizing: border-box;
|
||||
padding: 12px 14px 12px 14px;
|
||||
background: var(--buttonBg);
|
||||
border-radius: 6px;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
|
@ -100,11 +84,5 @@ const toggle = (): void => {
|
|||
background: var(--panel);
|
||||
border-radius: 0 0 6px 6px;
|
||||
}
|
||||
|
||||
&.opened {
|
||||
> .header {
|
||||
border-radius: 6px 6px 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,33 +1,35 @@
|
|||
<template>
|
||||
<div class="matxzzsk">
|
||||
<div class="label" @click="focus"><slot name="label"></slot></div>
|
||||
<div class="input" :class="{ inline, disabled, focused }">
|
||||
<div ref="prefixEl" class="prefix"><slot name="prefix"></slot></div>
|
||||
<input
|
||||
ref="inputEl"
|
||||
v-model="v"
|
||||
v-adaptive-border
|
||||
:type="type"
|
||||
:disabled="disabled"
|
||||
:required="required"
|
||||
:readonly="readonly"
|
||||
:placeholder="placeholder"
|
||||
:pattern="pattern"
|
||||
:autocomplete="autocomplete"
|
||||
:spellcheck="spellcheck"
|
||||
:step="step"
|
||||
:list="id"
|
||||
@focus="focused = true"
|
||||
@blur="focused = false"
|
||||
@keydown="onKeydown($event)"
|
||||
@input="onInput"
|
||||
/>
|
||||
<datalist v-if="datalist" :id="id">
|
||||
<option v-for="data in datalist" :value="data" />
|
||||
</datalist>
|
||||
<div ref="suffixEl" class="suffix"><slot name="suffix"></slot></div>
|
||||
</div>
|
||||
<div class="caption"><slot name="caption"></slot></div>
|
||||
<label>
|
||||
<div class="label"><slot name="label"></slot></div>
|
||||
<div class="input" :class="{ inline, disabled, focused }">
|
||||
<div ref="prefixEl" class="prefix"><slot name="prefix"></slot></div>
|
||||
<input
|
||||
ref="inputEl"
|
||||
v-model="v"
|
||||
v-adaptive-border
|
||||
:type="type"
|
||||
:disabled="disabled"
|
||||
:required="required"
|
||||
:readonly="readonly"
|
||||
:placeholder="placeholder"
|
||||
:pattern="pattern"
|
||||
:autocomplete="autocomplete"
|
||||
:spellcheck="spellcheck"
|
||||
:step="step"
|
||||
:list="id"
|
||||
@focus="focused = true"
|
||||
@blur="focused = false"
|
||||
@keydown="onKeydown($event)"
|
||||
@input="onInput"
|
||||
/>
|
||||
<datalist v-if="datalist" :id="id">
|
||||
<option v-for="data in datalist" :value="data" />
|
||||
</datalist>
|
||||
<div ref="suffixEl" class="suffix"><slot name="suffix"></slot></div>
|
||||
</div>
|
||||
<div class="caption"><slot name="caption"></slot></div>
|
||||
</label>
|
||||
|
||||
<MkButton
|
||||
v-if="manualSave && changed"
|
||||
|
@ -176,108 +178,110 @@ onMounted(() => {
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.matxzzsk {
|
||||
> .label {
|
||||
font-size: 0.85em;
|
||||
padding: 0 0 8px 0;
|
||||
user-select: none;
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> .caption {
|
||||
font-size: 0.85em;
|
||||
padding: 8px 0 0 0;
|
||||
color: var(--fgTransparentWeak);
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> .input {
|
||||
position: relative;
|
||||
|
||||
> input {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
height: v-bind("height + 'px'");
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0 12px;
|
||||
font: inherit;
|
||||
font-weight: normal;
|
||||
font-size: 1em;
|
||||
color: var(--fg);
|
||||
background: var(--panel);
|
||||
border: solid 1px var(--panel);
|
||||
border-radius: 6px;
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
box-sizing: border-box;
|
||||
transition: border-color 0.1s ease-out;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--inputBorderHover) !important;
|
||||
}
|
||||
}
|
||||
|
||||
> .prefix,
|
||||
> .suffix {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
padding: 0 12px;
|
||||
font-size: 1em;
|
||||
height: v-bind("height + 'px'");
|
||||
pointer-events: none;
|
||||
> label {
|
||||
> .label {
|
||||
font-size: 0.85em;
|
||||
padding: 0 0 8px 0;
|
||||
user-select: none;
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> * {
|
||||
display: inline-block;
|
||||
min-width: 16px;
|
||||
max-width: 150px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
> .caption {
|
||||
font-size: 0.85em;
|
||||
padding: 8px 0 0 0;
|
||||
color: var(--fgTransparentWeak);
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> .prefix {
|
||||
left: 0;
|
||||
padding-right: 6px;
|
||||
}
|
||||
> .input {
|
||||
position: relative;
|
||||
|
||||
> .suffix {
|
||||
right: 0;
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
&.inline {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&.focused {
|
||||
> input {
|
||||
border-color: var(--accent) !important;
|
||||
//box-shadow: 0 0 0 4px var(--focus);
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
height: v-bind("height + 'px'");
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0 12px;
|
||||
font: inherit;
|
||||
font-weight: normal;
|
||||
font-size: 1em;
|
||||
color: var(--fg);
|
||||
background: var(--panel);
|
||||
border: solid 1px var(--panel);
|
||||
border-radius: 6px;
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
box-sizing: border-box;
|
||||
transition: border-color 0.1s ease-out;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--inputBorderHover) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
opacity: 0.7;
|
||||
> .prefix,
|
||||
> .suffix {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
padding: 0 12px;
|
||||
font-size: 1em;
|
||||
height: v-bind("height + 'px'");
|
||||
pointer-events: none;
|
||||
|
||||
&,
|
||||
* {
|
||||
cursor: not-allowed !important;
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
> * {
|
||||
display: inline-block;
|
||||
min-width: 16px;
|
||||
max-width: 150px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
> .prefix {
|
||||
left: 0;
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
> .suffix {
|
||||
right: 0;
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
&.inline {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&.focused {
|
||||
> input {
|
||||
border-color: var(--accent) !important;
|
||||
//box-shadow: 0 0 0 4px var(--focus);
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
opacity: 0.7;
|
||||
|
||||
&,
|
||||
* {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
<template>
|
||||
<div
|
||||
<label
|
||||
v-adaptive-border
|
||||
class="novjtctn"
|
||||
:class="{ disabled, checked }"
|
||||
:aria-checked="checked"
|
||||
:aria-disabled="disabled"
|
||||
@click="toggle"
|
||||
>
|
||||
<input type="radio" :disabled="disabled" />
|
||||
<input
|
||||
type="radio"
|
||||
:disabled="disabled"
|
||||
:checked="checked"
|
||||
v-on:change="(x) => toggle(x)"
|
||||
/>
|
||||
<span class="button">
|
||||
<span></span>
|
||||
</span>
|
||||
<span class="label"><slot></slot></span>
|
||||
</div>
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
@ -30,7 +32,7 @@ const emit = defineEmits<{
|
|||
|
||||
let checked = $computed(() => props.modelValue === props.value);
|
||||
|
||||
function toggle(): void {
|
||||
function toggle(x) {
|
||||
if (props.disabled) return;
|
||||
emit("update:modelValue", props.value);
|
||||
}
|
||||
|
@ -93,8 +95,8 @@ function toggle(): void {
|
|||
|
||||
> input {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
opacity: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
@ -107,6 +109,7 @@ function toggle(): void {
|
|||
border: solid 2px var(--inputBorder);
|
||||
border-radius: 100%;
|
||||
transition: inherit;
|
||||
pointer-events: none;
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
|
|
|
@ -31,7 +31,7 @@ export default defineComponent({
|
|||
options = options[0].children;
|
||||
|
||||
return h(
|
||||
"div",
|
||||
"fieldset",
|
||||
{
|
||||
class: "novjtcto",
|
||||
},
|
||||
|
@ -39,7 +39,7 @@ export default defineComponent({
|
|||
...(label
|
||||
? [
|
||||
h(
|
||||
"div",
|
||||
"legend",
|
||||
{
|
||||
class: "label",
|
||||
},
|
||||
|
@ -86,6 +86,8 @@ export default defineComponent({
|
|||
|
||||
<style lang="scss">
|
||||
.novjtcto {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
> .label {
|
||||
font-size: 0.85em;
|
||||
padding: 0 0 8px 0;
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
<template>
|
||||
<div class="timctyfi" :class="{ disabled, easing }">
|
||||
<label class="timctyfi" :class="{ disabled, easing }">
|
||||
<div class="label"><slot name="label"></slot></div>
|
||||
<div v-adaptive-border class="body">
|
||||
<div ref="containerEl" class="container">
|
||||
<div class="track">
|
||||
<div
|
||||
class="highlight"
|
||||
:style="{ width: steppedRawValue * 100 + '%' }"
|
||||
></div>
|
||||
</div>
|
||||
<div v-if="steps && showTicks" class="ticks">
|
||||
<div
|
||||
<div class="container">
|
||||
<input
|
||||
ref="inputEl"
|
||||
type="range"
|
||||
:min="min"
|
||||
:max="max"
|
||||
:step="step"
|
||||
:list="id"
|
||||
:value="modelValue"
|
||||
:disabled="disabled"
|
||||
v-on:change="(x) => onChange(x)"
|
||||
@focus="tooltipShow"
|
||||
@blur="tooltipHide"
|
||||
@mouseenter="tooltipShow"
|
||||
@mouseleave="tooltipHide"
|
||||
@input="(x) => inputVal = x.target.value"
|
||||
/>
|
||||
<datalist
|
||||
v-if="showTicks && steps"
|
||||
:id="id"
|
||||
>
|
||||
<option
|
||||
v-for="i in steps + 1"
|
||||
class="tick"
|
||||
:style="{ left: ((i - 1) / steps) * 100 + '%' }"
|
||||
></div>
|
||||
</div>
|
||||
<div
|
||||
ref="thumbEl"
|
||||
v-tooltip="textConverter(finalValue)"
|
||||
class="thumb"
|
||||
:style="{ left: thumbPosition + 'px' }"
|
||||
@mousedown="onMousedown"
|
||||
@touchstart="onMousedown"
|
||||
></div>
|
||||
:value="i"
|
||||
:label="i.toString()"
|
||||
></option>
|
||||
</datalist>
|
||||
</div>
|
||||
</div>
|
||||
<div class="caption"><slot name="caption"></slot></div>
|
||||
</div>
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
computed,
|
||||
defineAsyncComponent,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
ref,
|
||||
watch,
|
||||
} from "vue";
|
||||
import { ref, computed, defineAsyncComponent } from "vue";
|
||||
import * as os from "@/os";
|
||||
|
||||
const id = os.getUniqueId();
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: number;
|
||||
|
@ -59,61 +59,13 @@ const props = withDefaults(
|
|||
}
|
||||
);
|
||||
|
||||
const inputEl = ref<HTMLElement>();
|
||||
let inputVal = $ref(props.modelValue);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: "update:modelValue", value: number): void;
|
||||
}>();
|
||||
|
||||
const containerEl = ref<HTMLElement>();
|
||||
const thumbEl = ref<HTMLElement>();
|
||||
|
||||
const rawValue = ref((props.modelValue - props.min) / (props.max - props.min));
|
||||
const steppedRawValue = computed(() => {
|
||||
if (props.step) {
|
||||
const step = props.step / (props.max - props.min);
|
||||
return step * Math.round(rawValue.value / step);
|
||||
} else {
|
||||
return rawValue.value;
|
||||
}
|
||||
});
|
||||
const finalValue = computed(() => {
|
||||
if (Number.isInteger(props.step)) {
|
||||
return Math.round(
|
||||
steppedRawValue.value * (props.max - props.min) + props.min
|
||||
);
|
||||
} else {
|
||||
return steppedRawValue.value * (props.max - props.min) + props.min;
|
||||
}
|
||||
});
|
||||
|
||||
const thumbWidth = computed(() => {
|
||||
if (thumbEl.value == null) return 0;
|
||||
return thumbEl.value!.offsetWidth;
|
||||
});
|
||||
const thumbPosition = ref(0);
|
||||
const calcThumbPosition = () => {
|
||||
if (containerEl.value == null) {
|
||||
thumbPosition.value = 0;
|
||||
} else {
|
||||
thumbPosition.value =
|
||||
(containerEl.value.offsetWidth - thumbWidth.value) *
|
||||
steppedRawValue.value;
|
||||
}
|
||||
};
|
||||
watch([steppedRawValue, containerEl], calcThumbPosition);
|
||||
|
||||
let ro: ResizeObserver | undefined;
|
||||
|
||||
onMounted(() => {
|
||||
ro = new ResizeObserver((entries, observer) => {
|
||||
calcThumbPosition();
|
||||
});
|
||||
ro.observe(containerEl.value);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (ro) ro.disconnect();
|
||||
});
|
||||
|
||||
const steps = computed(() => {
|
||||
if (props.step) {
|
||||
return (props.max - props.min) / props.step;
|
||||
|
@ -122,71 +74,30 @@ const steps = computed(() => {
|
|||
}
|
||||
});
|
||||
|
||||
const onMousedown = (ev: MouseEvent | TouchEvent) => {
|
||||
ev.preventDefault();
|
||||
function onChange(x) {
|
||||
emit("update:modelValue", inputVal);
|
||||
}
|
||||
|
||||
const tooltipShowing = ref(true);
|
||||
const tooltipShowing = ref(false);
|
||||
function tooltipShow() {
|
||||
tooltipShowing.value = true;
|
||||
os.popup(
|
||||
defineAsyncComponent(() => import("@/components/MkTooltip.vue")),
|
||||
{
|
||||
showing: tooltipShowing,
|
||||
text: computed(() => {
|
||||
return props.textConverter(finalValue.value);
|
||||
return props.textConverter(inputVal);
|
||||
}),
|
||||
targetElement: thumbEl,
|
||||
targetElement: inputEl,
|
||||
},
|
||||
{},
|
||||
"closed"
|
||||
);
|
||||
}
|
||||
function tooltipHide() {
|
||||
tooltipShowing.value = false;
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.appendChild(
|
||||
document.createTextNode(
|
||||
"* { cursor: grabbing !important; } body * { pointer-events: none !important; }"
|
||||
)
|
||||
);
|
||||
document.head.appendChild(style);
|
||||
|
||||
const onDrag = (ev: MouseEvent | TouchEvent) => {
|
||||
ev.preventDefault();
|
||||
const containerRect = containerEl.value!.getBoundingClientRect();
|
||||
const pointerX =
|
||||
ev.touches && ev.touches.length > 0
|
||||
? ev.touches[0].clientX
|
||||
: ev.clientX;
|
||||
const pointerPositionOnContainer =
|
||||
pointerX - (containerRect.left + thumbWidth.value / 2);
|
||||
rawValue.value = Math.min(
|
||||
1,
|
||||
Math.max(
|
||||
0,
|
||||
pointerPositionOnContainer /
|
||||
(containerEl.value!.offsetWidth - thumbWidth.value)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
let beforeValue = finalValue.value;
|
||||
|
||||
const onMouseup = () => {
|
||||
document.head.removeChild(style);
|
||||
tooltipShowing.value = false;
|
||||
window.removeEventListener("mousemove", onDrag);
|
||||
window.removeEventListener("touchmove", onDrag);
|
||||
window.removeEventListener("mouseup", onMouseup);
|
||||
window.removeEventListener("touchend", onMouseup);
|
||||
|
||||
// 値が変わってたら通知
|
||||
if (beforeValue !== finalValue.value) {
|
||||
emit("update:modelValue", finalValue.value);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("mousemove", onDrag);
|
||||
window.addEventListener("touchmove", onDrag);
|
||||
window.addEventListener("mouseup", onMouseup, { once: true });
|
||||
window.addEventListener("touchend", onMouseup, { once: true });
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -228,56 +139,19 @@ const onMousedown = (ev: MouseEvent | TouchEvent) => {
|
|||
position: relative;
|
||||
height: $thumbHeight;
|
||||
|
||||
> .track {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: auto;
|
||||
width: calc(100% - #{$thumbWidth});
|
||||
@mixin track {
|
||||
height: 3px;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
border-radius: 999px;
|
||||
overflow: clip;
|
||||
|
||||
> .highlight {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
background: var(--accent);
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
> .ticks {
|
||||
$tickWidth: 3px;
|
||||
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: auto;
|
||||
width: calc(100% - #{$thumbWidth});
|
||||
|
||||
> .tick {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: $tickWidth;
|
||||
height: 3px;
|
||||
margin-left: math.div($tickWidth, 2);
|
||||
background: var(--divider);
|
||||
border-radius: 999px;
|
||||
}
|
||||
@mixin fill {
|
||||
background-color: var(--accent);
|
||||
}
|
||||
|
||||
> .thumb {
|
||||
position: absolute;
|
||||
@mixin thumb {
|
||||
width: $thumbWidth;
|
||||
height: $thumbHeight;
|
||||
cursor: grab;
|
||||
background: var(--accent);
|
||||
border-radius: 999px;
|
||||
|
||||
|
@ -285,6 +159,24 @@ const onMousedown = (ev: MouseEvent | TouchEvent) => {
|
|||
background: var(--accentLighten);
|
||||
}
|
||||
}
|
||||
> input {
|
||||
width: 100%;
|
||||
background: none;
|
||||
|
||||
&::-webkit-slider-runnable-track { @include track }
|
||||
&::-moz-range-track { @include track }
|
||||
&::-ms-track { @include track }
|
||||
|
||||
&::-moz-range-progress { @include fill }
|
||||
&::-ms-fill-lower { @include fill }
|
||||
|
||||
&::-webkit-slider-thumb {
|
||||
margin-top: -6.5px;
|
||||
@include thumb
|
||||
}
|
||||
&::-moz-range-thumb { @include thumb }
|
||||
&::-ms-thumb { @include thumb }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,33 +1,36 @@
|
|||
<template>
|
||||
<div class="vblkjoeq">
|
||||
<div class="label" @click="focus"><slot name="label"></slot></div>
|
||||
<div
|
||||
ref="container"
|
||||
class="input"
|
||||
:class="{ inline, disabled, focused }"
|
||||
@click.prevent="onClick"
|
||||
>
|
||||
<div ref="prefixEl" class="prefix"><slot name="prefix"></slot></div>
|
||||
<select
|
||||
ref="inputEl"
|
||||
v-model="v"
|
||||
v-adaptive-border
|
||||
class="select"
|
||||
:disabled="disabled"
|
||||
:required="required"
|
||||
:readonly="readonly"
|
||||
:placeholder="placeholder"
|
||||
@focus="focused = true"
|
||||
@blur="focused = false"
|
||||
@input="onInput"
|
||||
<label>
|
||||
<div class="label"><slot name="label"></slot></div>
|
||||
<div
|
||||
ref="container"
|
||||
class="input"
|
||||
:class="{ inline, disabled, focused }"
|
||||
@click.prevent="onClick"
|
||||
tabindex="-1"
|
||||
>
|
||||
<slot></slot>
|
||||
</select>
|
||||
<div ref="suffixEl" class="suffix">
|
||||
<i class="ph-caret-down ph-bold ph-lg"></i>
|
||||
<div ref="prefixEl" class="prefix"><slot name="prefix"></slot></div>
|
||||
<select
|
||||
ref="inputEl"
|
||||
v-model="v"
|
||||
v-adaptive-border
|
||||
class="select"
|
||||
:disabled="disabled"
|
||||
:required="required"
|
||||
:readonly="readonly"
|
||||
:placeholder="placeholder"
|
||||
@focus="focused = true"
|
||||
@blur="focused = false"
|
||||
@input="onInput"
|
||||
>
|
||||
<slot></slot>
|
||||
</select>
|
||||
<div ref="suffixEl" class="suffix">
|
||||
<i class="ph-caret-down ph-bold ph-lg"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="caption"><slot name="caption"></slot></div>
|
||||
<div class="caption"><slot name="caption"></slot></div>
|
||||
</label>
|
||||
|
||||
<MkButton v-if="manualSave && changed" primary @click="updated"
|
||||
><i class="ph-floppy-disk-back ph-bold ph-lg"></i>
|
||||
|
@ -191,115 +194,117 @@ const onClick = (ev: MouseEvent) => {
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.vblkjoeq {
|
||||
> .label {
|
||||
font-size: 0.85em;
|
||||
padding: 0 0 8px 0;
|
||||
user-select: none;
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> .caption {
|
||||
font-size: 0.85em;
|
||||
padding: 8px 0 0 0;
|
||||
color: var(--fgTransparentWeak);
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> .input {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
margin-left: 0.2rem;
|
||||
margin-right: 0.2rem;
|
||||
|
||||
&:hover {
|
||||
> .select {
|
||||
border-color: var(--inputBorderHover) !important;
|
||||
}
|
||||
}
|
||||
|
||||
> .select {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
height: v-bind("height + 'px'");
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0 12px;
|
||||
font: inherit;
|
||||
font-weight: normal;
|
||||
font-size: 1em;
|
||||
color: var(--fg);
|
||||
background: var(--panel);
|
||||
border: solid 1px var(--panel);
|
||||
border-radius: 6px;
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.1s ease-out;
|
||||
pointer-events: none;
|
||||
> label {
|
||||
> .label {
|
||||
font-size: 0.85em;
|
||||
padding: 0 0 8px 0;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
> .prefix,
|
||||
> .suffix {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
padding: 0 12px;
|
||||
font-size: 1em;
|
||||
height: v-bind("height + 'px'");
|
||||
pointer-events: none;
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> * {
|
||||
> .caption {
|
||||
font-size: 0.85em;
|
||||
padding: 8px 0 0 0;
|
||||
color: var(--fgTransparentWeak);
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> .input {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
margin-left: 0.2rem;
|
||||
margin-right: 0.2rem;
|
||||
|
||||
&:hover {
|
||||
> .select {
|
||||
border-color: var(--inputBorderHover) !important;
|
||||
}
|
||||
}
|
||||
|
||||
> .select {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
height: v-bind("height + 'px'");
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0 12px;
|
||||
font: inherit;
|
||||
font-weight: normal;
|
||||
font-size: 1em;
|
||||
color: var(--fg);
|
||||
background: var(--panel);
|
||||
border: solid 1px var(--panel);
|
||||
border-radius: 6px;
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.1s ease-out;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
> .prefix,
|
||||
> .suffix {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
padding: 0 12px;
|
||||
font-size: 1em;
|
||||
height: v-bind("height + 'px'");
|
||||
pointer-events: none;
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
> * {
|
||||
display: inline-block;
|
||||
min-width: 16px;
|
||||
max-width: 150px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
> .prefix {
|
||||
left: 0;
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
> .suffix {
|
||||
right: 0;
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
&.inline {
|
||||
display: inline-block;
|
||||
min-width: 16px;
|
||||
max-width: 150px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
> .prefix {
|
||||
left: 0;
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
> .suffix {
|
||||
right: 0;
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
&.inline {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&.focused {
|
||||
> select {
|
||||
border-color: var(--accent) !important;
|
||||
&.focused {
|
||||
> select {
|
||||
border-color: var(--accent) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
opacity: 0.7;
|
||||
&.disabled {
|
||||
opacity: 0.7;
|
||||
|
||||
&,
|
||||
* {
|
||||
cursor: not-allowed !important;
|
||||
&,
|
||||
* {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,26 @@
|
|||
<template>
|
||||
<div class="ziffeomt" :class="{ disabled, checked }">
|
||||
<label class="ziffeomt">
|
||||
<input
|
||||
ref="input"
|
||||
type="checkbox"
|
||||
:checked="modelValue"
|
||||
:disabled="disabled"
|
||||
@keydown.enter="toggle"
|
||||
v-on:change="(x) => toggle(x)"
|
||||
/>
|
||||
<span
|
||||
ref="button"
|
||||
v-tooltip="checked ? i18n.ts.itsOn : i18n.ts.itsOff"
|
||||
<div
|
||||
class="button"
|
||||
@click.prevent="toggle"
|
||||
>
|
||||
<div class="knob"></div>
|
||||
</span>
|
||||
</div>
|
||||
<span class="label">
|
||||
<!-- TODO: 無名slotの方は廃止 -->
|
||||
<span @click="toggle"><slot name="label"></slot><slot></slot></span>
|
||||
<span><slot name="label"></slot><slot></slot></span>
|
||||
<p class="caption"><slot name="caption"></slot></p>
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { toRefs, Ref } from "vue";
|
||||
import * as os from "@/os";
|
||||
import { i18n } from "@/i18n";
|
||||
import { Ref } from "vue";
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean | Ref<boolean>;
|
||||
|
@ -36,15 +31,10 @@ const emit = defineEmits<{
|
|||
(ev: "update:modelValue", v: boolean): void;
|
||||
}>();
|
||||
|
||||
let button = $ref<HTMLElement>();
|
||||
const checked = toRefs(props).modelValue;
|
||||
const toggle = () => {
|
||||
function toggle(x) {
|
||||
if (props.disabled) return;
|
||||
emit("update:modelValue", !checked.value);
|
||||
|
||||
if (!checked.value) {
|
||||
}
|
||||
};
|
||||
emit("update:modelValue", x.target.checked);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -59,8 +49,8 @@ const toggle = () => {
|
|||
|
||||
> input {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
width: 32px;
|
||||
height: 23px;
|
||||
opacity: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
@ -78,9 +68,9 @@ const toggle = () => {
|
|||
background-clip: content-box;
|
||||
border: solid 1px var(--swutchOffBg);
|
||||
border-radius: 999px;
|
||||
cursor: pointer;
|
||||
transition: inherit;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
|
||||
> .knob {
|
||||
position: absolute;
|
||||
|
@ -128,20 +118,18 @@ const toggle = () => {
|
|||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
> input:disabled ~ * {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&.checked {
|
||||
> .button {
|
||||
background-color: var(--swutchOnBg) !important;
|
||||
border-color: var(--swutchOnBg) !important;
|
||||
> input:checked ~ .button {
|
||||
background-color: var(--swutchOnBg) !important;
|
||||
border-color: var(--swutchOnBg) !important;
|
||||
|
||||
> .knob {
|
||||
left: 12px;
|
||||
background: var(--swutchOnFg);
|
||||
}
|
||||
> .knob {
|
||||
left: 12px;
|
||||
background: var(--swutchOnFg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,30 @@
|
|||
<template>
|
||||
<div class="adhpbeos">
|
||||
<div class="label" @click="focus"><slot name="label"></slot></div>
|
||||
<div class="input" :class="{ disabled, focused, tall, pre }">
|
||||
<textarea
|
||||
ref="inputEl"
|
||||
v-model="v"
|
||||
v-adaptive-border
|
||||
:class="{ code, _monospace: code }"
|
||||
:disabled="disabled"
|
||||
:required="required"
|
||||
:readonly="readonly"
|
||||
:placeholder="placeholder"
|
||||
:pattern="pattern"
|
||||
:autocomplete="autocomplete"
|
||||
:spellcheck="spellcheck"
|
||||
@focus="focused = true"
|
||||
@blur="focused = false"
|
||||
@keydown="onKeydown($event)"
|
||||
@input="onInput"
|
||||
></textarea>
|
||||
</div>
|
||||
<div class="caption"><slot name="caption"></slot></div>
|
||||
<label>
|
||||
<span class="label">
|
||||
<slot name="label"></slot>
|
||||
</span>
|
||||
<div class="input" :class="{ disabled, focused, tall, pre }">
|
||||
<textarea
|
||||
ref="inputEl"
|
||||
v-model="v"
|
||||
v-adaptive-border
|
||||
:class="{ code, _monospace: code }"
|
||||
:disabled="disabled"
|
||||
:required="required"
|
||||
:readonly="readonly"
|
||||
:placeholder="placeholder"
|
||||
:pattern="pattern"
|
||||
:autocomplete="autocomplete"
|
||||
:spellcheck="spellcheck"
|
||||
@focus="focused = true"
|
||||
@blur="focused = false"
|
||||
@keydown="onKeydown($event)"
|
||||
@input="onInput"
|
||||
></textarea>
|
||||
</div>
|
||||
<div class="caption"><slot name="caption"></slot></div>
|
||||
</label>
|
||||
|
||||
<MkButton
|
||||
v-if="manualSave && changed"
|
||||
|
@ -192,83 +196,83 @@ export default defineComponent({
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.adhpbeos {
|
||||
> .label {
|
||||
font-size: 0.85em;
|
||||
padding: 0 0 8px 0;
|
||||
user-select: none;
|
||||
> label {
|
||||
> .label {
|
||||
font-size: 0.85em;
|
||||
padding: 0 0 8px 0;
|
||||
user-select: none;
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
> .caption {
|
||||
font-size: 0.85em;
|
||||
padding: 8px 0 0 0;
|
||||
color: var(--fgTransparentWeak);
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
> .input {
|
||||
position: relative;
|
||||
|
||||
> textarea {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
min-height: 130px;
|
||||
margin: 0;
|
||||
padding: 12px;
|
||||
font: inherit;
|
||||
font-weight: normal;
|
||||
font-size: 1em;
|
||||
color: var(--fg);
|
||||
background: var(--panel);
|
||||
border: solid 1px var(--panel);
|
||||
border-radius: 6px;
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
box-sizing: border-box;
|
||||
transition: border-color 0.1s ease-out;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--inputBorderHover) !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.focused {
|
||||
> textarea {
|
||||
border-color: var(--accent) !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
opacity: 0.7;
|
||||
|
||||
&,
|
||||
* {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.tall {
|
||||
> textarea {
|
||||
min-height: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
&.pre {
|
||||
> textarea {
|
||||
white-space: pre;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> .caption {
|
||||
font-size: 0.85em;
|
||||
padding: 8px 0 0 0;
|
||||
color: var(--fgTransparentWeak);
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> .input {
|
||||
position: relative;
|
||||
|
||||
> textarea {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
min-height: 130px;
|
||||
margin: 0;
|
||||
padding: 12px;
|
||||
font: inherit;
|
||||
font-weight: normal;
|
||||
font-size: 1em;
|
||||
color: var(--fg);
|
||||
background: var(--panel);
|
||||
border: solid 1px var(--panel);
|
||||
border-radius: 6px;
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
box-sizing: border-box;
|
||||
transition: border-color 0.1s ease-out;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--inputBorderHover) !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.focused {
|
||||
> textarea {
|
||||
border-color: var(--accent) !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
opacity: 0.7;
|
||||
|
||||
&,
|
||||
* {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.tall {
|
||||
> textarea {
|
||||
min-height: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
&.pre {
|
||||
> textarea {
|
||||
white-space: pre;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> .save {
|
||||
margin: 8px 0 0 0;
|
||||
|
|
|
@ -191,6 +191,11 @@ export function claimZIndex(
|
|||
return zIndexes[priority];
|
||||
}
|
||||
|
||||
let uniqueId = 0;
|
||||
export function getUniqueId(): string {
|
||||
return uniqueId++ + '';
|
||||
}
|
||||
|
||||
export async function popup(
|
||||
component: Component,
|
||||
props: Record<string, any>,
|
||||
|
|
|
@ -43,10 +43,6 @@
|
|||
</option>
|
||||
</FormRadios>
|
||||
|
||||
<FormSwitch v-model="showFixedPostForm" class="_formBlock">{{
|
||||
i18n.ts.showFixedPostForm
|
||||
}}</FormSwitch>
|
||||
|
||||
<FormSection>
|
||||
<template #label>{{ i18n.ts.behavior }}</template>
|
||||
<FormSwitch v-model="imageNewTab" class="_formBlock">{{
|
||||
|
@ -69,6 +65,13 @@
|
|||
<FormSwitch v-model="disablePagesScript" class="_formBlock">{{
|
||||
i18n.ts.disablePagesScript
|
||||
}}</FormSwitch>
|
||||
<FormSwitch v-model="profile.showTimelineReplies" class="_formBlock"
|
||||
>{{ i18n.ts.flagShowTimelineReplies
|
||||
}}<template #caption
|
||||
>{{ i18n.ts.flagShowTimelineRepliesDescription }}
|
||||
{{ i18n.ts.reflectMayTakeTime }}</template
|
||||
></FormSwitch
|
||||
>
|
||||
|
||||
<FormSelect v-model="serverDisconnectedBehavior" class="_formBlock">
|
||||
<template #label>{{ i18n.ts.whenServerDisconnected }}</template>
|
||||
|
@ -88,10 +91,7 @@
|
|||
</FormSection>
|
||||
|
||||
<FormSection>
|
||||
<template #label>{{ i18n.ts.appearance }}</template>
|
||||
<FormSwitch v-model="showAds" class="_formBlock">{{
|
||||
i18n.ts.showAds
|
||||
}}</FormSwitch>
|
||||
<template #label>{{ i18n.ts.accessibility }}</template>
|
||||
<FormSwitch v-model="autoplayMfm" class="_formBlock">
|
||||
{{ i18n.ts._mfm.alwaysPlay }}
|
||||
<template #caption>
|
||||
|
@ -105,6 +105,33 @@
|
|||
<FormSwitch v-model="reduceAnimation" class="_formBlock">{{
|
||||
i18n.ts.reduceUiAnimation
|
||||
}}</FormSwitch>
|
||||
<FormSwitch
|
||||
v-model="disableShowingAnimatedImages"
|
||||
class="_formBlock"
|
||||
>{{ i18n.ts.disableShowingAnimatedImages }}</FormSwitch
|
||||
>
|
||||
<FormRadios v-model="fontSize" class="_formBlock">
|
||||
<template #label>{{ i18n.ts.fontSize }}</template>
|
||||
<option :value="null">
|
||||
<span style="font-size: 14px">Aa</span>
|
||||
</option>
|
||||
<option value="1">
|
||||
<span style="font-size: 15px">Aa</span>
|
||||
</option>
|
||||
<option value="2">
|
||||
<span style="font-size: 16px">Aa</span>
|
||||
</option>
|
||||
<option value="3">
|
||||
<span style="font-size: 17px">Aa</span>
|
||||
</option>
|
||||
</FormRadios>
|
||||
</FormSection>
|
||||
|
||||
<FormSection>
|
||||
<template #label>{{ i18n.ts.appearance }}</template>
|
||||
<FormSwitch v-model="showAds" class="_formBlock">{{
|
||||
i18n.ts.showAds
|
||||
}}</FormSwitch>
|
||||
<FormSwitch v-model="useBlurEffect" class="_formBlock">{{
|
||||
i18n.ts.useBlurEffect
|
||||
}}</FormSwitch>
|
||||
|
@ -119,11 +146,6 @@
|
|||
<FormSwitch v-model="loadRawImages" class="_formBlock">{{
|
||||
i18n.ts.loadRawImages
|
||||
}}</FormSwitch>
|
||||
<FormSwitch
|
||||
v-model="disableShowingAnimatedImages"
|
||||
class="_formBlock"
|
||||
>{{ i18n.ts.disableShowingAnimatedImages }}</FormSwitch
|
||||
>
|
||||
<FormSwitch v-model="squareAvatars" class="_formBlock">{{
|
||||
i18n.ts.squareAvatars
|
||||
}}</FormSwitch>
|
||||
|
@ -145,44 +167,30 @@
|
|||
<FormSwitch v-model="showUpdates" class="_formBlock">{{
|
||||
i18n.ts.showUpdates
|
||||
}}</FormSwitch>
|
||||
<FormSwitch v-model="showFixedPostForm" class="_formBlock">{{
|
||||
i18n.ts.showFixedPostForm
|
||||
}}</FormSwitch>
|
||||
<FormSwitch
|
||||
v-if="$i?.isAdmin"
|
||||
v-model="showAdminUpdates"
|
||||
class="_formBlock"
|
||||
>{{ i18n.ts.showAdminUpdates }}</FormSwitch
|
||||
>
|
||||
<FormSelect v-model="instanceTicker" class="_formBlock">
|
||||
<template #label>{{ i18n.ts.instanceTicker }}</template>
|
||||
<option value="none">{{ i18n.ts._instanceTicker.none }}</option>
|
||||
<option value="remote">{{ i18n.ts._instanceTicker.remote }}</option>
|
||||
<option value="always">{{ i18n.ts._instanceTicker.always }}</option>
|
||||
</FormSelect>
|
||||
|
||||
<FormRadios v-model="fontSize" class="_formBlock">
|
||||
<template #label>{{ i18n.ts.fontSize }}</template>
|
||||
<option :value="null">
|
||||
<span style="font-size: 14px">Aa</span>
|
||||
</option>
|
||||
<option value="1">
|
||||
<span style="font-size: 15px">Aa</span>
|
||||
</option>
|
||||
<option value="2">
|
||||
<span style="font-size: 16px">Aa</span>
|
||||
</option>
|
||||
<option value="3">
|
||||
<span style="font-size: 17px">Aa</span>
|
||||
</option>
|
||||
</FormRadios>
|
||||
<FormSelect v-model="nsfw" class="_formBlock">
|
||||
<template #label>{{ i18n.ts.nsfw }}</template>
|
||||
<option value="respect">{{ i18n.ts._nsfw.respect }}</option>
|
||||
<option value="ignore">{{ i18n.ts._nsfw.ignore }}</option>
|
||||
<option value="force">{{ i18n.ts._nsfw.force }}</option>
|
||||
</FormSelect>
|
||||
</FormSection>
|
||||
|
||||
<FormSelect v-model="instanceTicker" class="_formBlock">
|
||||
<template #label>{{ i18n.ts.instanceTicker }}</template>
|
||||
<option value="none">{{ i18n.ts._instanceTicker.none }}</option>
|
||||
<option value="remote">{{ i18n.ts._instanceTicker.remote }}</option>
|
||||
<option value="always">{{ i18n.ts._instanceTicker.always }}</option>
|
||||
</FormSelect>
|
||||
|
||||
<FormSelect v-model="nsfw" class="_formBlock">
|
||||
<template #label>{{ i18n.ts.nsfw }}</template>
|
||||
<option value="respect">{{ i18n.ts._nsfw.respect }}</option>
|
||||
<option value="ignore">{{ i18n.ts._nsfw.ignore }}</option>
|
||||
<option value="force">{{ i18n.ts._nsfw.force }}</option>
|
||||
</FormSelect>
|
||||
|
||||
<FormRange
|
||||
v-model="numberOfPageCache"
|
||||
:min="1"
|
||||
|
@ -201,11 +209,6 @@
|
|||
i18n.ts.deck
|
||||
}}</FormLink>
|
||||
|
||||
<FormLink to="/settings/custom-css" class="_formBlock"
|
||||
><template #icon><i class="ph-code ph-bold ph-lg"></i></template
|
||||
>{{ i18n.ts.customCss }}</FormLink
|
||||
>
|
||||
|
||||
<FormLink to="/settings/custom-katex-macro" class="_formBlock"
|
||||
><template #icon><i class="ph-radical ph-bold ph-lg"></i></template
|
||||
>{{ i18n.ts.customKaTeXMacro }}</FormLink
|
||||
|
@ -214,7 +217,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { reactive, computed, ref, watch } from "vue";
|
||||
import { $i } from "@/account";
|
||||
import FormSwitch from "@/components/form/switch.vue";
|
||||
import FormSelect from "@/components/form/select.vue";
|
||||
|
@ -234,6 +237,24 @@ const lang = ref(localStorage.getItem("lang"));
|
|||
const fontSize = ref(localStorage.getItem("fontSize"));
|
||||
const useSystemFont = ref(localStorage.getItem("useSystemFont") != null);
|
||||
|
||||
const profile = reactive({
|
||||
showTimelineReplies: $i?.showTimelineReplies,
|
||||
});
|
||||
watch(
|
||||
() => profile,
|
||||
() => {
|
||||
save();
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
function save() {
|
||||
os.apiWithDialog("i/update", {
|
||||
showTimelineReplies: !!profile.showTimelineReplies,
|
||||
});
|
||||
}
|
||||
|
||||
async function reloadAsk() {
|
||||
const { canceled } = await os.confirm({
|
||||
type: "info",
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
><i class="ph-airplane-takeoff ph-bold ph-lg"></i
|
||||
></template>
|
||||
<template #label>{{ i18n.ts.moveToLabel }}</template>
|
||||
<template #caption>{{ i18n.ts.moveAccountDescription }}</template>
|
||||
</FormInput>
|
||||
<FormButton primary danger @click="move(moveToAccount)">
|
||||
{{ i18n.ts.moveAccount }}
|
||||
</FormButton>
|
||||
<div class="description">{{ i18n.ts.moveAccountDescription }}</div>
|
||||
</FormSection>
|
||||
|
||||
<FormSection>
|
||||
|
@ -21,6 +21,7 @@
|
|||
><i class="ph-airplane-landing ph-bold ph-lg"></i
|
||||
></template>
|
||||
<template #label>{{ i18n.ts.moveFromLabel }}</template>
|
||||
<template #caption>{{ i18n.ts.moveFromDescription }}</template>
|
||||
</FormInput>
|
||||
<FormButton
|
||||
class="button"
|
||||
|
@ -31,7 +32,6 @@
|
|||
<i class="ph-floppy-disk-back ph-bold ph-lg"></i>
|
||||
{{ i18n.ts.save }}
|
||||
</FormButton>
|
||||
<div class="description">{{ i18n.ts.moveFromDescription }}</div>
|
||||
</FormSection>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -69,10 +69,3 @@ definePageMetadata({
|
|||
icon: "ph-lock ph-bold ph-lg",
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.description {
|
||||
font-size: 0.85em;
|
||||
padding: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -145,13 +145,6 @@
|
|||
i18n.ts.flagSpeakAsCatDescription
|
||||
}}</template></FormSwitch
|
||||
>
|
||||
<FormSwitch v-model="profile.showTimelineReplies" class="_formBlock"
|
||||
>{{ i18n.ts.flagShowTimelineReplies
|
||||
}}<template #caption
|
||||
>{{ i18n.ts.flagShowTimelineRepliesDescription }}
|
||||
{{ i18n.ts.reflectMayTakeTime }}</template
|
||||
></FormSwitch
|
||||
>
|
||||
<FormSwitch v-model="profile.isBot" class="_formBlock"
|
||||
>{{ i18n.ts.flagAsBot
|
||||
}}<template #caption>{{
|
||||
|
@ -190,7 +183,6 @@ const profile = reactive({
|
|||
isBot: $i?.isBot,
|
||||
isCat: $i?.isCat,
|
||||
speakAsCat: $i?.speakAsCat,
|
||||
showTimelineReplies: $i?.showTimelineReplies,
|
||||
});
|
||||
|
||||
const props = withDefaults(
|
||||
|
@ -245,7 +237,6 @@ function save() {
|
|||
isBot: !!profile.isBot,
|
||||
isCat: !!profile.isCat,
|
||||
speakAsCat: !!profile.speakAsCat,
|
||||
showTimelineReplies: !!profile.showTimelineReplies,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -13,20 +13,21 @@
|
|||
|
||||
<FormSection>
|
||||
<template #label>{{ i18n.ts.sounds }}</template>
|
||||
<FormButton
|
||||
v-for="type in Object.keys(sounds)"
|
||||
:key="type"
|
||||
style="margin-bottom: 8px"
|
||||
@click="edit(type)"
|
||||
>
|
||||
{{ i18n.t("_sfx." + type) }}
|
||||
<template #suffix>{{
|
||||
sounds[type].type || i18n.ts.none
|
||||
}}</template>
|
||||
<template #suffixIcon
|
||||
><i class="ph-caret-down ph-bold ph-lg"></i
|
||||
></template>
|
||||
</FormButton>
|
||||
<div class="_formLinksGrid">
|
||||
<FormButton
|
||||
v-for="type in Object.keys(sounds)"
|
||||
:key="type"
|
||||
@click="edit(type)"
|
||||
>
|
||||
{{ i18n.t("_sfx." + type) }}
|
||||
<template #suffix>{{
|
||||
sounds[type].type || i18n.ts.none
|
||||
}}</template>
|
||||
<template #suffixIcon
|
||||
><i class="ph-caret-down ph-bold ph-lg"></i
|
||||
></template>
|
||||
</FormButton>
|
||||
</div>
|
||||
</FormSection>
|
||||
|
||||
<FormButton danger class="_formBlock" @click="reset()"
|
||||
|
|
|
@ -135,6 +135,12 @@
|
|||
>
|
||||
</div>
|
||||
</FormSection>
|
||||
<FormSection>
|
||||
<FormLink to="/settings/custom-css" class="_formBlock"
|
||||
><template #icon><i class="ph-code ph-bold ph-lg"></i></template
|
||||
>{{ i18n.ts.customCss }}</FormLink
|
||||
>
|
||||
</FormSection>
|
||||
|
||||
<FormButton
|
||||
v-if="wallpaper == null"
|
||||
|
|
|
@ -433,6 +433,9 @@ hr {
|
|||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
grid-gap: 12px;
|
||||
> button {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
._formLinks {
|
||||
|
@ -653,6 +656,7 @@ hr {
|
|||
font-size: 1.3333em;
|
||||
line-height: 0.75em;
|
||||
vertical-align: -0.0667em;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.ph-xl {
|
||||
|
|
|
@ -530,7 +530,7 @@ console.log(mainRouter.currentRoute.value.name);
|
|||
}
|
||||
:deep(.tl),
|
||||
:deep(.notes) {
|
||||
background: none !important;
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue