mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
fix external consumption of ts rules, and simplify import path
This commit is contained in:
parent
f93f01b3e9
commit
264dd8f1ea
34 changed files with 89 additions and 86 deletions
|
@ -1,5 +1,5 @@
|
||||||
workspace(
|
workspace(
|
||||||
name = "anki",
|
name = "net_ankiweb_anki",
|
||||||
managed_directories = {"@npm": [
|
managed_directories = {"@npm": [
|
||||||
"ts/node_modules",
|
"ts/node_modules",
|
||||||
]},
|
]},
|
||||||
|
|
17
defs.bzl
17
defs.bzl
|
@ -1,7 +1,7 @@
|
||||||
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
|
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
|
||||||
load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
|
load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
|
||||||
load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version")
|
load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version")
|
||||||
load("@anki//cargo:crates.bzl", "raze_fetch_remote_crates")
|
load("@net_ankiweb_anki//cargo:crates.bzl", "raze_fetch_remote_crates")
|
||||||
load(":python.bzl", "setup_local_python")
|
load(":python.bzl", "setup_local_python")
|
||||||
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install")
|
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install")
|
||||||
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
|
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
|
||||||
|
@ -29,15 +29,9 @@ def setup_deps():
|
||||||
|
|
||||||
native.register_toolchains("@python//:python3_toolchain")
|
native.register_toolchains("@python//:python3_toolchain")
|
||||||
|
|
||||||
# pip_install(
|
|
||||||
# name = "py_deps",
|
|
||||||
# python_interpreter_target = "@python//:python",
|
|
||||||
# requirements = "@anki//pip:requirements.txt",
|
|
||||||
# )
|
|
||||||
|
|
||||||
pip_import(
|
pip_import(
|
||||||
name = "py_deps",
|
name = "py_deps",
|
||||||
requirements = "@anki//pip:requirements.txt",
|
requirements = "@net_ankiweb_anki//pip:requirements.txt",
|
||||||
python_runtime = "@python//:python",
|
python_runtime = "@python//:python",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,13 +40,12 @@ def setup_deps():
|
||||||
python_runtime = "@python//:python",
|
python_runtime = "@python//:python",
|
||||||
)
|
)
|
||||||
|
|
||||||
node_repositories(package_json = ["@anki//ts:package.json"])
|
node_repositories(package_json = ["@net_ankiweb_anki//ts:package.json"])
|
||||||
|
|
||||||
yarn_install(
|
yarn_install(
|
||||||
name = "npm",
|
name = "npm",
|
||||||
package_json = "@anki//ts:package.json",
|
package_json = "@net_ankiweb_anki//ts:package.json",
|
||||||
# strict_visibility = True,
|
yarn_lock = "@net_ankiweb_anki//ts:yarn.lock",
|
||||||
yarn_lock = "@anki//ts:yarn.lock",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
sass_repositories()
|
sass_repositories()
|
||||||
|
|
|
@ -79,9 +79,18 @@ not being installed.
|
||||||
|
|
||||||
## More
|
## More
|
||||||
|
|
||||||
For info on running tests, building wheels and so on, please see [Development](./development.md).
|
For info on running tests, building wheels and so on, please see
|
||||||
|
[Development](./development.md).
|
||||||
|
|
||||||
Note that where the instructions on that page say "bazel", please use ".\bazel"
|
Note that where the instructions on that page say "bazel", please use ".\bazel"
|
||||||
instead. This runs bazel.bat inside the Anki source folder, instead of
|
instead. This runs bazel.bat inside the Anki source folder, instead of
|
||||||
calling Bazel directly. This takes care of setting up the path and output folder
|
calling Bazel directly. This takes care of setting up the path and output folder
|
||||||
correctly, which avoids issues with long path names.
|
correctly, which avoids issues with long path names.
|
||||||
|
|
||||||
|
## Cleaning notes
|
||||||
|
|
||||||
|
Unlike the old Make system, a "clean build" should almost never be required
|
||||||
|
unless you are debugging issues with the build system. But if you need to run
|
||||||
|
"bazel clean --expunge", make sure you remove the ts/node_modules folder
|
||||||
|
afterwards, or it will cause a "no such file or directory node_modules/anki"
|
||||||
|
error on the subsequent build on Windows.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { I18n } from "anki/ts/lib/i18n";
|
import { I18n } from "anki/i18n";
|
||||||
import pb from "anki/ts/lib/backend_proto";
|
import pb from "anki/backend_proto";
|
||||||
import { buildNextLearnMsg } from "./lib";
|
import { buildNextLearnMsg } from "./lib";
|
||||||
import { bridgeLink } from "anki/ts/lib/bridgecommand";
|
import { bridgeLink } from "anki/bridgecommand";
|
||||||
|
|
||||||
export let info: pb.BackendProto.CongratsInfoOut;
|
export let info: pb.BackendProto.CongratsInfoOut;
|
||||||
export let i18n: I18n;
|
export let i18n: I18n;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { setupI18n } from "anki/ts/lib/i18n";
|
import { setupI18n } from "anki/i18n";
|
||||||
import CongratsPage from "anki/ts/congrats/CongratsPage.svelte";
|
import CongratsPage from "./CongratsPage.svelte";
|
||||||
import { getCongratsInfo } from "./lib";
|
import { getCongratsInfo } from "./lib";
|
||||||
import { checkNightMode } from "anki/ts/lib/nightmode";
|
import { checkNightMode } from "anki/nightmode";
|
||||||
|
|
||||||
export async function congrats(target: HTMLDivElement): Promise<void> {
|
export async function congrats(target: HTMLDivElement): Promise<void> {
|
||||||
checkNightMode();
|
checkNightMode();
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import pb from "anki/ts/lib/backend_proto";
|
import pb from "anki/backend_proto";
|
||||||
import { postRequest } from "anki/ts/lib/postrequest";
|
import { postRequest } from "anki/postrequest";
|
||||||
import { naturalUnit, unitAmount, unitName } from "anki/ts/lib/time";
|
import { naturalUnit, unitAmount, unitName } from "anki/time";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
|
|
||||||
export async function getCongratsInfo(): Promise<pb.BackendProto.CongratsInfoOut> {
|
export async function getCongratsInfo(): Promise<pb.BackendProto.CongratsInfoOut> {
|
||||||
return pb.BackendProto.CongratsInfoOut.decode(
|
return pb.BackendProto.CongratsInfoOut.decode(
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import { RevlogRange, GraphRange } from "./graph-helpers";
|
import { RevlogRange, GraphRange } from "./graph-helpers";
|
||||||
import type { TableDatum } from "./graph-helpers";
|
import type { TableDatum } from "./graph-helpers";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import type { HistogramData } from "./histogram-graph";
|
import type { HistogramData } from "./histogram-graph";
|
||||||
import { gatherData, buildHistogram } from "./added";
|
import { gatherData, buildHistogram } from "./added";
|
||||||
import type { GraphData } from "./added";
|
import type { GraphData } from "./added";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import HistogramGraph from "./HistogramGraph.svelte";
|
import HistogramGraph from "./HistogramGraph.svelte";
|
||||||
import GraphRangeRadios from "./GraphRangeRadios.svelte";
|
import GraphRangeRadios from "./GraphRangeRadios.svelte";
|
||||||
import TableData from "./TableData.svelte";
|
import TableData from "./TableData.svelte";
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
import { defaultGraphBounds, GraphRange, RevlogRange } from "./graph-helpers";
|
import { defaultGraphBounds, GraphRange, RevlogRange } from "./graph-helpers";
|
||||||
import AxisTicks from "./AxisTicks.svelte";
|
import AxisTicks from "./AxisTicks.svelte";
|
||||||
import { renderButtons } from "./buttons";
|
import { renderButtons } from "./buttons";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import NoDataOverlay from "./NoDataOverlay.svelte";
|
import NoDataOverlay from "./NoDataOverlay.svelte";
|
||||||
import GraphRangeRadios from "./GraphRangeRadios.svelte";
|
import GraphRangeRadios from "./GraphRangeRadios.svelte";
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
import { defaultGraphBounds, RevlogRange } from "./graph-helpers";
|
import { defaultGraphBounds, RevlogRange } from "./graph-helpers";
|
||||||
import { gatherData, renderCalendar } from "./calendar";
|
import { gatherData, renderCalendar } from "./calendar";
|
||||||
import type { GraphData } from "./calendar";
|
import type { GraphData } from "./calendar";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
|
|
||||||
export let sourceData: pb.BackendProto.GraphsOut | null = null;
|
export let sourceData: pb.BackendProto.GraphsOut | null = null;
|
||||||
export let revlogRange: RevlogRange;
|
export let revlogRange: RevlogRange;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
import { defaultGraphBounds } from "./graph-helpers";
|
import { defaultGraphBounds } from "./graph-helpers";
|
||||||
import { gatherData, renderCards } from "./card-counts";
|
import { gatherData, renderCards } from "./card-counts";
|
||||||
import type { GraphData, TableDatum } from "./card-counts";
|
import type { GraphData, TableDatum } from "./card-counts";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
|
|
||||||
export let sourceData: pb.BackendProto.GraphsOut;
|
export let sourceData: pb.BackendProto.GraphsOut;
|
||||||
export let i18n: I18n;
|
export let i18n: I18n;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import type { HistogramData } from "./histogram-graph";
|
import type { HistogramData } from "./histogram-graph";
|
||||||
import { gatherData, prepareData } from "./ease";
|
import { gatherData, prepareData } from "./ease";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import HistogramGraph from "./HistogramGraph.svelte";
|
import HistogramGraph from "./HistogramGraph.svelte";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import type { TableDatum } from "./graph-helpers";
|
import type { TableDatum } from "./graph-helpers";
|
||||||
import TableData from "./TableData.svelte";
|
import TableData from "./TableData.svelte";
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import type { HistogramData } from "./histogram-graph";
|
import type { HistogramData } from "./histogram-graph";
|
||||||
import { GraphRange, RevlogRange } from "./graph-helpers";
|
import { GraphRange, RevlogRange } from "./graph-helpers";
|
||||||
import type { TableDatum } from "./graph-helpers";
|
import type { TableDatum } from "./graph-helpers";
|
||||||
import { gatherData, buildHistogram } from "./future-due";
|
import { gatherData, buildHistogram } from "./future-due";
|
||||||
import type { GraphData } from "./future-due";
|
import type { GraphData } from "./future-due";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import HistogramGraph from "./HistogramGraph.svelte";
|
import HistogramGraph from "./HistogramGraph.svelte";
|
||||||
import GraphRangeRadios from "./GraphRangeRadios.svelte";
|
import GraphRangeRadios from "./GraphRangeRadios.svelte";
|
||||||
import TableData from "./TableData.svelte";
|
import TableData from "./TableData.svelte";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import { RevlogRange, GraphRange } from "./graph-helpers";
|
import { RevlogRange, GraphRange } from "./graph-helpers";
|
||||||
import { timeSpan, MONTH, YEAR } from "anki/ts/lib/time";
|
import { timeSpan, MONTH, YEAR } from "anki/time";
|
||||||
|
|
||||||
export let i18n: I18n;
|
export let i18n: I18n;
|
||||||
export let revlogRange: RevlogRange;
|
export let revlogRange: RevlogRange;
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import { getGraphData, RevlogRange } from "./graph-helpers";
|
import { getGraphData, RevlogRange } from "./graph-helpers";
|
||||||
import IntervalsGraph from "./IntervalsGraph.svelte";
|
import IntervalsGraph from "./IntervalsGraph.svelte";
|
||||||
import EaseGraph from "./EaseGraph.svelte";
|
import EaseGraph from "./EaseGraph.svelte";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import AxisTicks from "./AxisTicks.svelte";
|
import AxisTicks from "./AxisTicks.svelte";
|
||||||
import { defaultGraphBounds } from "./graph-helpers";
|
import { defaultGraphBounds } from "./graph-helpers";
|
||||||
import NoDataOverlay from "./NoDataOverlay.svelte";
|
import NoDataOverlay from "./NoDataOverlay.svelte";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
|
|
||||||
export let data: HistogramData | null = null;
|
export let data: HistogramData | null = null;
|
||||||
export let i18n: I18n;
|
export let i18n: I18n;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
import { defaultGraphBounds, RevlogRange, GraphRange } from "./graph-helpers";
|
import { defaultGraphBounds, RevlogRange, GraphRange } from "./graph-helpers";
|
||||||
import AxisTicks from "./AxisTicks.svelte";
|
import AxisTicks from "./AxisTicks.svelte";
|
||||||
import { renderHours } from "./hours";
|
import { renderHours } from "./hours";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import NoDataOverlay from "./NoDataOverlay.svelte";
|
import NoDataOverlay from "./NoDataOverlay.svelte";
|
||||||
import GraphRangeRadios from "./GraphRangeRadios.svelte";
|
import GraphRangeRadios from "./GraphRangeRadios.svelte";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import { timeSpan, MONTH } from "anki/ts/lib/time";
|
import { timeSpan, MONTH } from "anki/time";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import type { HistogramData } from "./histogram-graph";
|
import type { HistogramData } from "./histogram-graph";
|
||||||
import {
|
import {
|
||||||
gatherIntervalData,
|
gatherIntervalData,
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
prepareIntervalData,
|
prepareIntervalData,
|
||||||
} from "./intervals";
|
} from "./intervals";
|
||||||
import type { IntervalGraphData } from "./intervals";
|
import type { IntervalGraphData } from "./intervals";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import HistogramGraph from "./HistogramGraph.svelte";
|
import HistogramGraph from "./HistogramGraph.svelte";
|
||||||
import type { TableDatum } from "./graph-helpers";
|
import type { TableDatum } from "./graph-helpers";
|
||||||
import TableData from "./TableData.svelte";
|
import TableData from "./TableData.svelte";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import type { GraphBounds } from "./graph-helpers";
|
import type { GraphBounds } from "./graph-helpers";
|
||||||
export let bounds: GraphBounds;
|
export let bounds: GraphBounds;
|
||||||
export let i18n: I18n;
|
export let i18n: I18n;
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
import type { TableDatum } from "./graph-helpers";
|
import type { TableDatum } from "./graph-helpers";
|
||||||
import { gatherData, renderReviews } from "./reviews";
|
import { gatherData, renderReviews } from "./reviews";
|
||||||
import type { GraphData } from "./reviews";
|
import type { GraphData } from "./reviews";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import NoDataOverlay from "./NoDataOverlay.svelte";
|
import NoDataOverlay from "./NoDataOverlay.svelte";
|
||||||
import GraphRangeRadios from "./GraphRangeRadios.svelte";
|
import GraphRangeRadios from "./GraphRangeRadios.svelte";
|
||||||
import TableData from "./TableData.svelte";
|
import TableData from "./TableData.svelte";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import type { TableDatum } from "./graph-helpers";
|
import type { TableDatum } from "./graph-helpers";
|
||||||
|
|
||||||
export let i18n: I18n;
|
export let i18n: I18n;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import { gatherData } from "./today";
|
import { gatherData } from "./today";
|
||||||
import type { TodayData } from "./today";
|
import type { TodayData } from "./today";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
|
|
||||||
export let sourceData: pb.BackendProto.GraphsOut | null = null;
|
export let sourceData: pb.BackendProto.GraphsOut | null = null;
|
||||||
export let i18n: I18n;
|
export let i18n: I18n;
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import { extent, histogram, sum } from "d3-array";
|
import { extent, histogram, sum } from "d3-array";
|
||||||
import { scaleLinear, scaleSequential } from "d3-scale";
|
import { scaleLinear, scaleSequential } from "d3-scale";
|
||||||
import type { HistogramData } from "./histogram-graph";
|
import type { HistogramData } from "./histogram-graph";
|
||||||
import { interpolateBlues } from "d3-scale-chromatic";
|
import { interpolateBlues } from "d3-scale-chromatic";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import { dayLabel } from "anki/ts/lib/time";
|
import { dayLabel } from "anki/time";
|
||||||
import { GraphRange } from "./graph-helpers";
|
import { GraphRange } from "./graph-helpers";
|
||||||
import type { TableDatum } from "./graph-helpers";
|
import type { TableDatum } from "./graph-helpers";
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { setupI18n } from "anki/ts/lib/i18n";
|
import { setupI18n } from "anki/i18n";
|
||||||
import GraphsPage from "anki/ts/graphs/GraphsPage.svelte";
|
import GraphsPage from "./GraphsPage.svelte";
|
||||||
import { checkNightMode } from "anki/ts/lib/nightmode";
|
import { checkNightMode } from "anki/nightmode";
|
||||||
|
|
||||||
export function graphs(target: HTMLDivElement): void {
|
export function graphs(target: HTMLDivElement): void {
|
||||||
setupI18n().then((i18n) => {
|
setupI18n().then((i18n) => {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import pb from "anki/ts/lib/backend_proto";
|
import pb from "anki/backend_proto";
|
||||||
import { interpolateRdYlGn } from "d3-scale-chromatic";
|
import { interpolateRdYlGn } from "d3-scale-chromatic";
|
||||||
import "d3-transition";
|
import "d3-transition";
|
||||||
import { select, mouse } from "d3-selection";
|
import { select, mouse } from "d3-selection";
|
||||||
|
@ -19,7 +19,7 @@ import {
|
||||||
GraphRange,
|
GraphRange,
|
||||||
millisecondCutoffForRange,
|
millisecondCutoffForRange,
|
||||||
} from "./graph-helpers";
|
} from "./graph-helpers";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import { sum } from "d3-array";
|
import { sum } from "d3-array";
|
||||||
|
|
||||||
type ButtonCounts = [number, number, number, number];
|
type ButtonCounts = [number, number, number, number];
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import { interpolateBlues } from "d3-scale-chromatic";
|
import { interpolateBlues } from "d3-scale-chromatic";
|
||||||
import "d3-transition";
|
import "d3-transition";
|
||||||
import { select, mouse } from "d3-selection";
|
import { select, mouse } from "d3-selection";
|
||||||
|
@ -14,7 +14,7 @@ import { scaleLinear, scaleSequential } from "d3-scale";
|
||||||
import { showTooltip, hideTooltip } from "./tooltip";
|
import { showTooltip, hideTooltip } from "./tooltip";
|
||||||
import { GraphBounds, setDataAvailable, RevlogRange } from "./graph-helpers";
|
import { GraphBounds, setDataAvailable, RevlogRange } from "./graph-helpers";
|
||||||
import { timeDay, timeYear, timeWeek } from "d3-time";
|
import { timeDay, timeYear, timeWeek } from "d3-time";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
|
|
||||||
export interface GraphData {
|
export interface GraphData {
|
||||||
// indexed by day, where day is relative to today
|
// indexed by day, where day is relative to today
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CardQueue } from "anki/ts/lib/cards";
|
import { CardQueue } from "anki/cards";
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import { schemeGreens, schemeBlues } from "d3-scale-chromatic";
|
import { schemeGreens, schemeBlues } from "d3-scale-chromatic";
|
||||||
import "d3-transition";
|
import "d3-transition";
|
||||||
import { select } from "d3-selection";
|
import { select } from "d3-selection";
|
||||||
|
@ -16,7 +16,7 @@ import { pie, arc } from "d3-shape";
|
||||||
import { interpolate } from "d3-interpolate";
|
import { interpolate } from "d3-interpolate";
|
||||||
import type { GraphBounds } from "./graph-helpers";
|
import type { GraphBounds } from "./graph-helpers";
|
||||||
import { cumsum } from "d3-array";
|
import { cumsum } from "d3-array";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
|
|
||||||
type Count = [string, number];
|
type Count = [string, number];
|
||||||
export interface GraphData {
|
export interface GraphData {
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import { extent, histogram, sum } from "d3-array";
|
import { extent, histogram, sum } from "d3-array";
|
||||||
import { scaleLinear, scaleSequential } from "d3-scale";
|
import { scaleLinear, scaleSequential } from "d3-scale";
|
||||||
import { CardQueue } from "anki/ts/lib/cards";
|
import { CardQueue } from "anki/cards";
|
||||||
import type { HistogramData } from "./histogram-graph";
|
import type { HistogramData } from "./histogram-graph";
|
||||||
import { interpolateRdYlGn } from "d3-scale-chromatic";
|
import { interpolateRdYlGn } from "d3-scale-chromatic";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import type { TableDatum } from "./graph-helpers";
|
import type { TableDatum } from "./graph-helpers";
|
||||||
|
|
||||||
export interface GraphData {
|
export interface GraphData {
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import { extent, histogram, rollup, sum, Bin } from "d3-array";
|
import { extent, histogram, rollup, sum, Bin } from "d3-array";
|
||||||
import { scaleLinear, scaleSequential } from "d3-scale";
|
import { scaleLinear, scaleSequential } from "d3-scale";
|
||||||
import { CardQueue } from "anki/ts/lib/cards";
|
import { CardQueue } from "anki/cards";
|
||||||
import type { HistogramData } from "./histogram-graph";
|
import type { HistogramData } from "./histogram-graph";
|
||||||
import { interpolateGreens } from "d3-scale-chromatic";
|
import { interpolateGreens } from "d3-scale-chromatic";
|
||||||
import { dayLabel } from "anki/ts/lib/time";
|
import { dayLabel } from "anki/time";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import { GraphRange } from "./graph-helpers";
|
import { GraphRange } from "./graph-helpers";
|
||||||
import type { TableDatum } from "./graph-helpers";
|
import type { TableDatum } from "./graph-helpers";
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
@typescript-eslint/ban-ts-ignore: "off" */
|
@typescript-eslint/ban-ts-ignore: "off" */
|
||||||
|
|
||||||
import pb from "anki/ts/lib/backend_proto";
|
import pb from "anki/backend_proto";
|
||||||
import type { Selection } from "d3-selection";
|
import type { Selection } from "d3-selection";
|
||||||
import { postRequest } from "anki/ts/lib/postrequest";
|
import { postRequest } from "anki/postrequest";
|
||||||
|
|
||||||
export async function getGraphData(
|
export async function getGraphData(
|
||||||
search: string,
|
search: string,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import pb from "anki/ts/lib/backend_proto";
|
import pb from "anki/backend_proto";
|
||||||
import { interpolateBlues } from "d3-scale-chromatic";
|
import { interpolateBlues } from "d3-scale-chromatic";
|
||||||
import "d3-transition";
|
import "d3-transition";
|
||||||
import { select, mouse } from "d3-selection";
|
import { select, mouse } from "d3-selection";
|
||||||
|
@ -20,7 +20,7 @@ import {
|
||||||
millisecondCutoffForRange,
|
millisecondCutoffForRange,
|
||||||
} from "./graph-helpers";
|
} from "./graph-helpers";
|
||||||
import { area, curveBasis } from "d3-shape";
|
import { area, curveBasis } from "d3-shape";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
|
|
||||||
type ButtonCounts = [number, number, number, number];
|
type ButtonCounts = [number, number, number, number];
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,15 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type pb from "anki/ts/lib/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import { extent, histogram, quantile, sum, mean } from "d3-array";
|
import { extent, histogram, quantile, sum, mean } from "d3-array";
|
||||||
import { scaleLinear, scaleSequential } from "d3-scale";
|
import { scaleLinear, scaleSequential } from "d3-scale";
|
||||||
import { CardQueue } from "anki/ts/lib/cards";
|
import { CardQueue } from "anki/cards";
|
||||||
import type { HistogramData } from "./histogram-graph";
|
import type { HistogramData } from "./histogram-graph";
|
||||||
import { interpolateBlues } from "d3-scale-chromatic";
|
import { interpolateBlues } from "d3-scale-chromatic";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import type { TableDatum } from "./graph-helpers";
|
import type { TableDatum } from "./graph-helpers";
|
||||||
import { timeSpan } from "anki/ts/lib/time";
|
import { timeSpan } from "anki/time";
|
||||||
|
|
||||||
export interface IntervalGraphData {
|
export interface IntervalGraphData {
|
||||||
intervals: number[];
|
intervals: number[];
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import pb from "anki/ts/lib/backend_proto";
|
import pb from "anki/backend_proto";
|
||||||
import {
|
import {
|
||||||
interpolateBlues,
|
interpolateBlues,
|
||||||
interpolateGreens,
|
interpolateGreens,
|
||||||
|
@ -22,8 +22,8 @@ import { GraphBounds, setDataAvailable, GraphRange } from "./graph-helpers";
|
||||||
import type { TableDatum } from "./graph-helpers";
|
import type { TableDatum } from "./graph-helpers";
|
||||||
import { area, curveBasis } from "d3-shape";
|
import { area, curveBasis } from "d3-shape";
|
||||||
import { min, histogram, sum, max, Bin, cumsum } from "d3-array";
|
import { min, histogram, sum, max, Bin, cumsum } from "d3-array";
|
||||||
import { timeSpan, dayLabel } from "anki/ts/lib/time";
|
import { timeSpan, dayLabel } from "anki/time";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
|
|
||||||
interface Reviews {
|
interface Reviews {
|
||||||
mature: number;
|
mature: number;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import pb from "anki/ts/lib/backend_proto";
|
import pb from "anki/backend_proto";
|
||||||
import { studiedToday } from "anki/ts/lib/time";
|
import { studiedToday } from "anki/time";
|
||||||
import type { I18n } from "anki/ts/lib/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
|
|
||||||
export interface TodayData {
|
export interface TodayData {
|
||||||
title: string;
|
title: string;
|
||||||
|
|
|
@ -28,6 +28,7 @@ ts_library(
|
||||||
data = [
|
data = [
|
||||||
"backend_proto",
|
"backend_proto",
|
||||||
],
|
],
|
||||||
|
module_name = "anki",
|
||||||
tsconfig = "//:tsconfig.json",
|
tsconfig = "//:tsconfig.json",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
|
|
Loading…
Reference in a new issue