2021-04-12 06:18:30 +02:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
|
|
|
<script lang="ts">
|
2022-02-04 09:36:34 +01:00
|
|
|
import type { Writable } from "svelte/store";
|
|
|
|
|
update to latest rules_nodejs & switch to ts_project
ts_library() is deprecated and will presumably be dropped from a
future rules_nodejs, and it wasn't working with the jest tests
after updating, so we switch over to ts_project().
There are some downsides:
- It's a bit slower, as the worker mode doesn't appear to function
at the moment.
- Getting it working with a mix of source files and generated files
was quite tricky, especially as things behave differently on Windows,
and differently when editing with VS Code. Solved with a small patch
to the rules, and a wrapper script that copies everything into the
bin folder first. To keep VS Code working correctly as well, the built
files are symlinked into the source folder.
- TS libraries are not implicitly linked to node_modules, so they
can't be imported with an absolute name like "lib/proto" - we need
to use relative paths like "../lib/proto" instead. Adjusting "paths"
in tsconfig.json makes it work for TS compilation, but then it fails
at the esbuild stage. We could resolve it by wrapping the TS
libraries in a subsequent js_library() call, but that has the downside
of losing the transient dependencies, meaning they need to be listed
again. Alternatively we might be able to solve it in the future by
adjusting esbuild, but for now the paths have been made relative to
keep things simple.
Upsides:
- Along with updates to the Svelte tooling, Svelte typing has improved.
All exports made in a Svelte file are now visible to other files that
import them, and we no longer rebuild the Svelte files when TS files
are updated, as the Svelte files do no type checking themselves, and
are just a simple transpilation. Svelte-check now works on Windows again,
and there should be no errors when editing in VS Code after you've
built the project. The only downside seems to be that cmd+clicking
on a Svelte imports jumps to the .d.ts file instead of the original now;
presumably they'll fix that in a future plugin update.
- Each subfolder now has its own tsconfig.json, and tsc can be called
directly for testing purposes (but beware it will place build products
in the source tree): ts/node_modules/.bin/tsc -b ts
- We can drop the custom esbuild_toolchain, as it's included in the
latest rules_nodejs.
Other changes:
- "image_module_support" is moved into lib/, and imported with
<reference types=...>
- Images are now imported directly from their npm package; the
extra copy step has been removed.
Windows users may need to use "bazel clean" before building this,
due to old files lying around in the build folder.
2021-09-30 14:16:29 +02:00
|
|
|
import Container from "../components/Container.svelte";
|
2021-11-17 04:49:52 +01:00
|
|
|
import Row from "../components/Row.svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import type { DynamicSvelteComponent } from "../sveltelib/dynamicComponent";
|
|
|
|
import Addons from "./Addons.svelte";
|
2021-05-29 17:32:12 +02:00
|
|
|
import AdvancedOptions from "./AdvancedOptions.svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import AudioOptions from "./AudioOptions.svelte";
|
2023-12-11 04:47:34 +01:00
|
|
|
import AutoAdvance from "./AutoAdvance.svelte";
|
2021-05-29 17:32:12 +02:00
|
|
|
import BuryOptions from "./BuryOptions.svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import ConfigSelector from "./ConfigSelector.svelte";
|
|
|
|
import DailyLimits from "./DailyLimits.svelte";
|
|
|
|
import DisplayOrder from "./DisplayOrder.svelte";
|
|
|
|
import HtmlAddon from "./HtmlAddon.svelte";
|
2021-05-29 17:32:12 +02:00
|
|
|
import LapseOptions from "./LapseOptions.svelte";
|
2021-04-25 10:40:02 +02:00
|
|
|
import type { DeckOptionsState } from "./lib";
|
2022-02-04 09:36:34 +01:00
|
|
|
import NewOptions from "./NewOptions.svelte";
|
|
|
|
import TimerOptions from "./TimerOptions.svelte";
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-04-25 10:40:02 +02:00
|
|
|
export let state: DeckOptionsState;
|
2022-02-04 09:36:34 +01:00
|
|
|
const addons = state.addonComponents;
|
2021-04-24 02:14:54 +02:00
|
|
|
|
|
|
|
export function auxData(): Writable<Record<string, unknown>> {
|
|
|
|
return state.currentAuxData;
|
|
|
|
}
|
|
|
|
|
2021-04-25 11:24:19 +02:00
|
|
|
export function addSvelteAddon(component: DynamicSvelteComponent): void {
|
|
|
|
$addons = [...$addons, component];
|
|
|
|
}
|
|
|
|
|
2021-04-24 02:14:54 +02:00
|
|
|
export function addHtmlAddon(html: string, mounted: () => void): void {
|
|
|
|
$addons = [
|
|
|
|
...$addons,
|
|
|
|
{
|
|
|
|
component: HtmlAddon,
|
|
|
|
html,
|
|
|
|
mounted,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
2021-05-27 15:50:49 +02:00
|
|
|
|
|
|
|
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 advancedOptions = {};
|
2022-07-19 10:27:25 +02:00
|
|
|
|
|
|
|
let onPresetChange: () => void;
|
2021-04-12 06:18:30 +02:00
|
|
|
</script>
|
|
|
|
|
2022-07-19 10:27:25 +02:00
|
|
|
<ConfigSelector {state} on:presetchange={onPresetChange} />
|
2021-05-29 17:32:12 +02:00
|
|
|
|
2021-11-17 04:49:52 +01:00
|
|
|
<div class="deck-options-page">
|
|
|
|
<Container
|
|
|
|
breakpoint="sm"
|
|
|
|
--gutter-inline="0.25rem"
|
2022-10-25 08:18:50 +02:00
|
|
|
--gutter-block="0.75rem"
|
2021-11-17 04:49:52 +01:00
|
|
|
class="container-columns"
|
|
|
|
>
|
2023-12-08 03:08:22 +01:00
|
|
|
<div>
|
|
|
|
<Row class="row-columns">
|
|
|
|
<DailyLimits {state} api={dailyLimits} bind:onPresetChange />
|
|
|
|
</Row>
|
2022-02-03 05:52:11 +01:00
|
|
|
|
2023-12-08 03:08:22 +01:00
|
|
|
<Row class="row-columns">
|
|
|
|
<NewOptions {state} api={newOptions} />
|
|
|
|
</Row>
|
2022-02-03 05:52:11 +01:00
|
|
|
|
2023-12-08 03:08:22 +01:00
|
|
|
<Row class="row-columns">
|
|
|
|
<LapseOptions {state} api={lapseOptions} />
|
|
|
|
</Row>
|
2022-02-03 05:52:11 +01:00
|
|
|
|
2023-12-08 03:08:22 +01:00
|
|
|
<Row class="row-columns">
|
|
|
|
<DisplayOrder {state} api={displayOrder} />
|
|
|
|
</Row>
|
2022-02-03 05:52:11 +01:00
|
|
|
|
2023-12-08 03:08:22 +01:00
|
|
|
<Row class="row-columns">
|
|
|
|
<BuryOptions {state} api={buryOptions} />
|
|
|
|
</Row>
|
|
|
|
</div>
|
2022-02-03 05:52:11 +01:00
|
|
|
|
2023-12-08 03:08:22 +01:00
|
|
|
<div>
|
2023-12-11 04:47:34 +01:00
|
|
|
<Row class="row-columns">
|
|
|
|
<AudioOptions {state} api={audioOptions} />
|
|
|
|
</Row>
|
|
|
|
|
2023-12-08 03:08:22 +01:00
|
|
|
<Row class="row-columns">
|
|
|
|
<TimerOptions {state} api={timerOptions} />
|
|
|
|
</Row>
|
2022-02-03 05:52:11 +01:00
|
|
|
|
2023-12-08 03:08:22 +01:00
|
|
|
<Row class="row-columns">
|
2023-12-11 04:47:34 +01:00
|
|
|
<AutoAdvance {state} api={timerOptions} />
|
2023-12-08 03:08:22 +01:00
|
|
|
</Row>
|
2022-02-03 05:52:11 +01:00
|
|
|
|
2023-09-05 10:45:05 +02:00
|
|
|
{#if $addons.length}
|
2022-02-03 05:52:11 +01:00
|
|
|
<Row class="row-columns">
|
2023-12-08 03:08:22 +01:00
|
|
|
<Addons {state} />
|
2022-02-03 05:52:11 +01:00
|
|
|
</Row>
|
2023-12-08 03:08:22 +01:00
|
|
|
{/if}
|
|
|
|
|
|
|
|
<Row class="row-columns">
|
|
|
|
<AdvancedOptions {state} api={advancedOptions} />
|
|
|
|
</Row>
|
|
|
|
</div>
|
2021-07-06 03:43:40 +02:00
|
|
|
</Container>
|
|
|
|
</div>
|
2021-06-28 10:06:33 +02:00
|
|
|
|
|
|
|
<style lang="scss">
|
2021-11-17 04:49:52 +01:00
|
|
|
@use "sass/breakpoints" as bp;
|
|
|
|
|
|
|
|
.deck-options-page {
|
|
|
|
overflow-x: hidden;
|
|
|
|
|
2023-12-08 03:08:22 +01:00
|
|
|
:global(.container-columns) {
|
|
|
|
display: grid;
|
|
|
|
gap: 20px;
|
|
|
|
}
|
2021-11-17 04:49:52 +01:00
|
|
|
|
2023-12-08 03:08:22 +01:00
|
|
|
@include bp.with-breakpoint("lg") {
|
2021-11-17 04:49:52 +01:00
|
|
|
:global(.container-columns) {
|
2023-12-08 03:08:22 +01:00
|
|
|
grid-template-columns: repeat(2, 1fr);
|
2021-11-17 04:49:52 +01:00
|
|
|
}
|
2021-06-28 10:06:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|