mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fix: settings props not being correctly set
This commit is contained in:
@@ -1,28 +1,34 @@
|
||||
import type { Plugin } from '../../core/types';
|
||||
import { BasePlugin } from '../../core/settings';
|
||||
import { type Plugin } from '@/plugins/core/types';
|
||||
import { defineSettings, numberSetting, Setting } from '@/plugins/core/settingsHelpers';
|
||||
import styles from './styles.css?inline';
|
||||
import { BasePlugin, NumberSetting } from '../../core/settings';
|
||||
|
||||
class AnimatedBackgroundPluginClass extends BasePlugin {
|
||||
@NumberSetting({
|
||||
const settings = defineSettings({
|
||||
speed: numberSetting({
|
||||
default: 1,
|
||||
title: "Animation Speed",
|
||||
description: "Controls the speed of the animated background",
|
||||
description: "Controls how fast the background moves",
|
||||
min: 0.1,
|
||||
max: 2
|
||||
max: 2,
|
||||
step: 0.05
|
||||
})
|
||||
});
|
||||
|
||||
class AnimatedBackgroundPluginClass extends BasePlugin<typeof settings> {
|
||||
@Setting(settings.speed)
|
||||
speed!: number;
|
||||
}
|
||||
|
||||
const settingsInstance = new AnimatedBackgroundPluginClass();
|
||||
const instance = new AnimatedBackgroundPluginClass();
|
||||
|
||||
const animatedBackgroundPlugin: Plugin<typeof settingsInstance.settings> = {
|
||||
const animatedBackgroundPlugin: Plugin<typeof settings> = {
|
||||
id: 'animated-background',
|
||||
name: 'Animated Background',
|
||||
description: 'Adds an animated background to BetterSEQTA+',
|
||||
version: '1.0.0',
|
||||
disableToggle: true,
|
||||
styles,
|
||||
settings: settingsInstance.settings,
|
||||
styles: styles,
|
||||
settings: instance.settings,
|
||||
|
||||
run: async (api) => {
|
||||
// Create the background elements
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
import type { Plugin } from '../../core/types';
|
||||
import { BasePlugin, BooleanSetting } from '../../core/settings';
|
||||
import type { Plugin } from '@/plugins/core/types';
|
||||
import { BasePlugin } from '@/plugins/core/settings';
|
||||
import { defineSettings, booleanSetting, Setting } from '@/plugins/core/settingsHelpers';
|
||||
|
||||
class TestPluginClass extends BasePlugin {
|
||||
@BooleanSetting({
|
||||
// Step 1: Define settings with proper typing
|
||||
const settings = defineSettings({
|
||||
someSetting: booleanSetting({
|
||||
default: true,
|
||||
title: "Test Plugin",
|
||||
description: "Some random setting",
|
||||
})
|
||||
});
|
||||
|
||||
// Step 2: Create the plugin class with @Setting decorators
|
||||
class TestPluginClass extends BasePlugin<typeof settings> {
|
||||
@Setting(settings.someSetting)
|
||||
someSetting!: boolean;
|
||||
}
|
||||
|
||||
// Step 3: Instantiate and plug it in
|
||||
const settingsInstance = new TestPluginClass();
|
||||
|
||||
const testPlugin: Plugin<typeof settingsInstance.settings> = {
|
||||
const testPlugin: Plugin<typeof settings> = {
|
||||
id: 'test',
|
||||
name: 'Test Plugin',
|
||||
description: 'A test plugin for BetterSEQTA+',
|
||||
@@ -24,6 +32,8 @@ const testPlugin: Plugin<typeof settingsInstance.settings> = {
|
||||
|
||||
const { unregister } = api.seqta.onPageChange((page) => {
|
||||
console.log('Page changed to', page);
|
||||
|
||||
console.log('Current setting value:', api.settings.someSetting);
|
||||
});
|
||||
|
||||
return () => {
|
||||
@@ -33,4 +43,4 @@ const testPlugin: Plugin<typeof settingsInstance.settings> = {
|
||||
}
|
||||
};
|
||||
|
||||
export default testPlugin;
|
||||
export default testPlugin;
|
||||
|
||||
Reference in New Issue
Block a user