mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 06:07:11 -05:00
* Add componentHook functionality
* Register package NoteEditor
* Rename OldEditorAdapter to NoteEditor
* Expose instances in component-hook as well
* Rename NoteTypeButtons to NotetypeButtons
* Move PreviewButton initialization to BrowserEditor.svelte
* Remove focusInRichText
- Same thing can be done by inspecting activeInput
* Satisfy formatter
* Fix remaining rebase issues
* Add .bazel to .prettierignore
* Rename currentField and activeInput to focused{Field,Input}
* Move identifier to lib and registration to sveltelib
* Fix Dynamic component insertion
* Simplify editingInputIsRichText
* Give extra warning in svelte/svelte.ts
- This was caused by doing a rename of a files, that only differed in
case: NoteTypeButtons.svelte to NotetypeButtons.svelte
- It was quite tough to figure out, and this console.log might make it
easier if it ever happens again
* Change signature of contextProperty
* Add ts/typings for add-on definition files
* Add Anki types in typings/common/index.d.ts
* Export without .svelte suffix
It conflicts with how Svelte types its packages
* Fix left over .svelte import from editor.py
* Rename NoteTypeButtons to unrelated to ensure case-only rename
* Rename back to NotetypeButtons.svelte
* Remove unused component-hook.ts, Fix typing in lifecycle-hooks
* Merge runtime-require and register-package into one file
+ Give some preliminary types to require
* Rename uiDidLoad to loaded
* Fix eslint / svelte-check
* Rename context imports to noteEditorContext
* Fix import name mismatch
- I wonder why these issues are not caught by svelte-check?
* Rename two missed usages of uiDidLoad
* Fix ButtonDropdown from having wrong border-radius
* Uniformly rename libraries to packages
- I don't have a strong opinion on whether to name them libraries or
packages, I just think we should have a uniform name.
- JS/TS only uses the terms "module" and "namespace", however `package`
is a reserved keyword for future use, whereas `library` is not.
* Refactor registration.ts into dynamic-slotting
- This is part of an effort to refactor the dynamic slotting (extending
buttons) functionality out of components like ButtonGroup.
* Remove dynamically-slottable logic from ButtonToolbar
* Use DynamicallySlottable in editor-toolbar
* Fix no border radius on indentation button dropdown
* Fix AddonButtons
* Remove Item/ButtonGroupItem in deck-options, where it's not necessary
* Remove unnecessary uses of Item and ButtonGroupItem
* Fix remaining tests
* Fix relative imports
* Revert change return value of remapBinToSrcDir to ./bazel/out...
* Remove typings directory
* Adjust comments for dynamic-slottings
153 lines
4.4 KiB
Svelte
153 lines
4.4 KiB
Svelte
<!--
|
|
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";
|
|
import Container from "../components/Container.svelte";
|
|
import Row from "../components/Row.svelte";
|
|
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";
|
|
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
|
import Item from "../components/Item.svelte";
|
|
|
|
import type { DeckOptionsState } from "./lib";
|
|
import type { Writable } from "svelte/store";
|
|
import HtmlAddon from "./HtmlAddon.svelte";
|
|
import type { DynamicSvelteComponent } from "../sveltelib/dynamicComponent";
|
|
|
|
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 = {};
|
|
export const dailyLimits = {};
|
|
export const newOptions = {};
|
|
export const lapseOptions = {};
|
|
export const buryOptions = {};
|
|
export const displayOrder = {};
|
|
export const timerOptions = {};
|
|
export const audioOptions = {};
|
|
export const advancedOptions = {};
|
|
</script>
|
|
|
|
<ConfigSelector {state} />
|
|
|
|
<div class="deck-options-page">
|
|
<Container
|
|
breakpoint="sm"
|
|
--gutter-inline="0.25rem"
|
|
--gutter-block="0.5rem"
|
|
class="container-columns"
|
|
>
|
|
<DynamicallySlottable slotHost={Item} api={options}>
|
|
<Item>
|
|
<Row class="row-columns">
|
|
<DailyLimits {state} api={dailyLimits} />
|
|
</Row>
|
|
</Item>
|
|
|
|
<Item>
|
|
<Row class="row-columns">
|
|
<NewOptions {state} api={newOptions} />
|
|
</Row>
|
|
</Item>
|
|
|
|
<Item>
|
|
<Row class="row-columns">
|
|
<LapseOptions {state} api={lapseOptions} />
|
|
</Row>
|
|
</Item>
|
|
|
|
{#if state.v3Scheduler}
|
|
<Item>
|
|
<Row class="row-columns">
|
|
<DisplayOrder {state} api={displayOrder} />
|
|
</Row>
|
|
</Item>
|
|
{/if}
|
|
|
|
<Item>
|
|
<Row class="row-columns">
|
|
<TimerOptions {state} api={timerOptions} />
|
|
</Row>
|
|
</Item>
|
|
|
|
<Item>
|
|
<Row class="row-columns">
|
|
<BuryOptions {state} api={buryOptions} />
|
|
</Row>
|
|
</Item>
|
|
|
|
<Item>
|
|
<Row class="row-columns">
|
|
<AudioOptions {state} api={audioOptions} />
|
|
</Row>
|
|
</Item>
|
|
|
|
<Item>
|
|
<Row class="row-columns">
|
|
<Addons {state} />
|
|
</Row>
|
|
</Item>
|
|
|
|
<Item>
|
|
<Row class="row-columns">
|
|
<AdvancedOptions {state} api={advancedOptions} />
|
|
</Row>
|
|
</Item>
|
|
</DynamicallySlottable>
|
|
</Container>
|
|
</div>
|
|
|
|
<style lang="scss">
|
|
@use "sass/breakpoints" as bp;
|
|
|
|
.deck-options-page {
|
|
overflow-x: hidden;
|
|
|
|
@include bp.with-breakpoint("lg") {
|
|
:global(.container) {
|
|
display: block;
|
|
}
|
|
|
|
:global(.container-columns) {
|
|
column-count: 2;
|
|
column-gap: 5em;
|
|
|
|
:global(.container) {
|
|
break-inside: avoid;
|
|
}
|
|
}
|
|
|
|
:global(.row-columns) {
|
|
display: block;
|
|
}
|
|
}
|
|
}
|
|
</style>
|