anki/ts/graphs/index.ts
Henrik Giesel 1d72599a37 Rename anki/ to lib/ for export
import _ from "anki/x";

will become

import _ from "lib/x";

to fit the directory name.
2021-04-23 10:02:28 +10:00

49 lines
1.6 KiB
TypeScript

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import type { SvelteComponent } from "svelte/internal";
import { setupI18n, ModuleName } from "lib/i18n";
import { checkNightMode } from "lib/nightmode";
import GraphsPage from "./GraphsPage.svelte";
export { default as RangeBox } from "./RangeBox.svelte";
export { default as IntervalsGraph } from "./IntervalsGraph.svelte";
export { default as EaseGraph } from "./EaseGraph.svelte";
export { default as AddedGraph } from "./AddedGraph.svelte";
export { default as TodayStats } from "./TodayStats.svelte";
export { default as ButtonsGraph } from "./ButtonsGraph.svelte";
export { default as CardCounts } from "./CardCounts.svelte";
export { default as HourGraph } from "./HourGraph.svelte";
export { default as FutureDue } from "./FutureDue.svelte";
export { default as ReviewsGraph } from "./ReviewsGraph.svelte";
export { default as CalendarGraph } from "./CalendarGraph.svelte";
export { RevlogRange } from "./graph-helpers";
export function graphs(
target: HTMLDivElement,
graphs: SvelteComponent[],
{
search = "deck:current",
days = 365,
controller = null as SvelteComponent | null,
} = {}
): void {
const nightMode = checkNightMode();
setupI18n({ modules: [ModuleName.STATISTICS, ModuleName.SCHEDULING] }).then(() => {
new GraphsPage({
target,
props: {
graphs,
nightMode,
initialSearch: search,
initialDays: days,
controller,
},
});
});
}