mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fix(browser): fixed settings interface in firefox #166
This commit is contained in:
@@ -95,7 +95,6 @@
|
|||||||
"sortablejs": "^1.15.2",
|
"sortablejs": "^1.15.2",
|
||||||
"svelte": "^5.0.0-next.243",
|
"svelte": "^5.0.0-next.243",
|
||||||
"svelte-hash-router": "^1.0.1",
|
"svelte-hash-router": "^1.0.1",
|
||||||
"svelte-motion": "^0.12.2",
|
|
||||||
"swiper": "latest",
|
"swiper": "latest",
|
||||||
"tailwindcss": "^3.4.10",
|
"tailwindcss": "^3.4.10",
|
||||||
"ts-loader": "^9.5.1",
|
"ts-loader": "^9.5.1",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
let { onClick, text, ...props } = $props<{ onClick: () => void, text: string, [key: string]: any }>();
|
let { onClick, text } = $props<{ onClick: () => void, text: string, [key: string]: any }>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button onclick={onClick} class='px-4 py-1 text-[0.75rem] dark:bg-[#38373D] bg-[#DDDDDD] dark:text-white rounded-md' {...props}>
|
<button onclick={onClick} class='px-4 py-1 text-[0.75rem] dark:bg-[#38373D] bg-[#DDDDDD] dark:text-white rounded-md'>
|
||||||
{text}
|
{text}
|
||||||
</button>
|
</button>
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { onMount, onDestroy, createEventDispatcher } from 'svelte';
|
||||||
|
import { animate as motionAnimate, spring } from 'motion';
|
||||||
|
|
||||||
|
let { initial, animate, exit, transition, children, class: className } = $props<{
|
||||||
|
initial?: any,
|
||||||
|
animate?: any,
|
||||||
|
exit?: any,
|
||||||
|
transition?: any,
|
||||||
|
children?: any,
|
||||||
|
class?: string
|
||||||
|
}>();
|
||||||
|
|
||||||
|
let divElement: HTMLElement;
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
const playAnimation = (keyframe: any) => {
|
||||||
|
if (divElement && keyframe) {
|
||||||
|
let animationOptions = transition;
|
||||||
|
|
||||||
|
// If transition is not defined or is of type 'spring', use spring animations
|
||||||
|
if (!transition || transition.type === 'spring') {
|
||||||
|
animationOptions = {
|
||||||
|
easing: spring(transition || { stiffness: 250, damping: 25 }),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const animation = motionAnimate(divElement, keyframe, animationOptions);
|
||||||
|
return animation.finished;
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
};
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
// Apply initial state if provided
|
||||||
|
if (initial) {
|
||||||
|
await playAnimation(initial);
|
||||||
|
}
|
||||||
|
// Then animate to the `animate` state
|
||||||
|
if (animate) {
|
||||||
|
await playAnimation(animate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dispatch animation end event
|
||||||
|
dispatch('animationend');
|
||||||
|
});
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (animate) {
|
||||||
|
playAnimation(animate);
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatch('animationend');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle unmounting with the `exit` animation
|
||||||
|
onDestroy(async () => {
|
||||||
|
if (exit) {
|
||||||
|
await playAnimation(exit);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class={className} bind:this={divElement} style="will-change: transform, opacity;">
|
||||||
|
{#if children}
|
||||||
|
{@render children()}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// @ts-expect-error umm idk
|
import MotionDiv from './MotionDiv.svelte';
|
||||||
import { MotionDiv } from 'svelte-motion';
|
|
||||||
import './TabbedContainer.css';
|
import './TabbedContainer.css';
|
||||||
import type { Component } from 'svelte'
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
let { tabs } = $props<{ tabs: { title: string, Content: Component }[] }>();
|
let { tabs } = $props<{ tabs: { title: string, Content: any }[] }>();
|
||||||
let activeTab = $state(0);
|
let activeTab = $state(0);
|
||||||
let hoveredTab = $state<number | null>(null);
|
let hoveredTab = $state<number | null>(null);
|
||||||
let containerRef: HTMLElement | null = null;
|
let containerRef: HTMLElement | null = null;
|
||||||
@@ -72,11 +70,11 @@
|
|||||||
animate={{ x: `${-activeTab * 100}%` }}
|
animate={{ x: `${-activeTab * 100}%` }}
|
||||||
transition={springTransition}
|
transition={springTransition}
|
||||||
>
|
>
|
||||||
<div class="flex">
|
<div class="flex h-screen">
|
||||||
{#each tabs as { Content }, index}
|
{#each tabs as { Content }, index}
|
||||||
<div class="absolute w-full transition-opacity duration-300 overflow-y-scroll {activeTab === index ? 'opacity-100' : 'opacity-0'}"
|
<div class="absolute w-full transition-opacity duration-300 overflow-y-scroll {activeTab === index ? 'opacity-100' : 'opacity-0'}"
|
||||||
style="left: {index * 100}%;">
|
style="left: {index * 100}%;">
|
||||||
<Content />
|
{@render Content()}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Switch from "../../components/Switch.svelte"
|
import Switch from "../../components/Switch.svelte"
|
||||||
import Button from "../../components/Button.svelte"
|
import Button from "../../components/Button.svelte"
|
||||||
//import PickerSwatch from "../../components/PickerSwatch.svelte"
|
import PickerSwatch from "../../components/PickerSwatch.svelte"
|
||||||
import Slider from "../../components/Slider.svelte"
|
import Slider from "../../components/Slider.svelte"
|
||||||
|
|
||||||
import browser from "webextension-polyfill"
|
import browser from "webextension-polyfill"
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
onChange: (isOn: boolean) => settingsState.onoff = isOn
|
onChange: (isOn: boolean) => settingsState.onoff = isOn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
] as setting}
|
] as option}
|
||||||
{@render Setting(setting)}
|
{@render Setting(option)}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// @ts-expect-error umm idk
|
import MotionDiv from '@/svelte-interface/components/MotionDiv.svelte';
|
||||||
import { MotionDiv } from 'svelte-motion';
|
|
||||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState.ts"
|
import { settingsState } from "@/seqta/utils/listeners/SettingsState.ts"
|
||||||
import Switch from "@/svelte-interface/components/Switch.svelte"
|
import Switch from "@/svelte-interface/components/Switch.svelte"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user