anki/ts/deckoptions/DeckOptionsPage.svelte

94 lines
2.7 KiB
Svelte
Raw Normal View History

<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import ConfigSelector from "./ConfigSelector.svelte";
2021-05-29 17:32:12 +02:00
import Container from "components/Container.svelte";
import Item from "components/Item.svelte";
2021-05-29 17:32:12 +02:00
import DailyLimits from "./DailyLimits.svelte";
import DisplayOrder from "./DisplayOrder.svelte";
import NewOptions from "./NewOptions.svelte";
import AdvancedOptions from "./AdvancedOptions.svelte";
import BuryOptions from "./BuryOptions.svelte";
import LapseOptions from "./LapseOptions.svelte";
import TimerOptions from "./TimerOptions.svelte";
import AudioOptions from "./AudioOptions.svelte";
import Addons from "./Addons.svelte";
2021-04-25 10:40:02 +02:00
import type { DeckOptionsState } from "./lib";
import type { Writable } from "svelte/store";
import HtmlAddon from "./HtmlAddon.svelte";
import type { DynamicSvelteComponent } from "sveltelib/dynamicComponent";
2021-04-25 10:40:02 +02:00
export let state: DeckOptionsState;
let addons = state.addonComponents;
export function auxData(): Writable<Record<string, unknown>> {
return state.currentAuxData;
}
export function addSvelteAddon(component: DynamicSvelteComponent): void {
$addons = [...$addons, component];
}
export function addHtmlAddon(html: string, mounted: () => void): void {
$addons = [
...$addons,
{
component: HtmlAddon,
html,
mounted,
},
];
}
export const options = {};
2021-05-29 17:32:12 +02:00
export const dailyLimits = {};
export const newOptions = {};
export const lapseOptions = {};
export const buryOptions = {};
export const displayOrder = {};
export const timerOptions = {};
export const audioOptions = {};
export const addonOptions = {};
export const advancedOptions = {};
</script>
2021-05-18 18:55:22 +02:00
<ConfigSelector {state} />
2021-05-29 17:32:12 +02:00
<Container api={options}>
<Item>
2021-05-29 17:32:12 +02:00
<DailyLimits {state} api={dailyLimits} />
</Item>
2021-05-29 17:32:12 +02:00
<Item>
2021-05-29 17:32:12 +02:00
<NewOptions {state} api={newOptions} />
</Item>
<Item>
2021-05-29 17:32:12 +02:00
<LapseOptions {state} api={lapseOptions} />
</Item>
<Item>
2021-05-29 17:32:12 +02:00
<BuryOptions {state} api={buryOptions} />
</Item>
2021-05-29 17:32:12 +02:00
{#if state.v3Scheduler}
<Item>
2021-05-29 17:32:12 +02:00
<DisplayOrder {state} api={displayOrder} />
</Item>
2021-05-29 17:32:12 +02:00
{/if}
<Item>
2021-05-29 17:32:12 +02:00
<TimerOptions {state} api={timerOptions} />
</Item>
<Item>
2021-05-29 17:32:12 +02:00
<AudioOptions {state} api={audioOptions} />
</Item>
<Item>
2021-05-29 17:32:12 +02:00
<Addons {state} api={addonOptions} />
</Item>
<Item>
2021-05-29 17:32:12 +02:00
<AdvancedOptions {state} api={advancedOptions} />
</Item>
2021-05-29 17:32:12 +02:00
</Container>