fix: ninja test errors

This commit is contained in:
David Brenn 2025-08-14 16:03:52 +02:00
parent 5f3aa818f7
commit bd9854c80e
9 changed files with 25 additions and 10 deletions

View file

@ -232,6 +232,11 @@ Spiritual Father <https://github.com/spiritualfather>
Emmanuel Ferdman <https://github.com/emmanuel-ferdman> Emmanuel Ferdman <https://github.com/emmanuel-ferdman>
Sunong2008 <https://github.com/Sunrongguo2008> Sunong2008 <https://github.com/Sunrongguo2008>
Marvin Kopf <marvinkopf@outlook.com> Marvin Kopf <marvinkopf@outlook.com>
David Brenn <davidbrenn@t-online.de>
Felix Kühne <flxkhn0602@gmail.com>
Matthis Ehrhardt <matthis-ehrhardt@gmx.de>
Billy Julian Lesmana <hunter140797@gmail.com>
******************** ********************
The text of the 3 clause BSD license follows: The text of the 3 clause BSD license follows:

View file

@ -146,7 +146,6 @@ class Preferences(QDialog):
form.render_latex.setChecked(editing.render_latex) form.render_latex.setChecked(editing.render_latex)
form.default_search_text.setText(editing.default_search_text) form.default_search_text.setText(editing.default_search_text)
form.backup_explanation.setText( form.backup_explanation.setText(
anki.lang.with_collapsed_whitespace(tr.preferences_backup_explanation()) anki.lang.with_collapsed_whitespace(tr.preferences_backup_explanation())
) )

View file

@ -3,7 +3,7 @@ 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
--> -->
<script lang="ts"> <script lang="ts">
import { colorBlindColors, type GraphBounds } from "./graph-helpers"; import { colorBlindColors } from "./graph-helpers";
import * as tr from "@generated/ftl"; import * as tr from "@generated/ftl";
import { localizedNumber } from "@tslib/i18n"; import { localizedNumber } from "@tslib/i18n";
import { type RevlogRange } from "./graph-helpers"; import { type RevlogRange } from "./graph-helpers";

View file

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { colorBlindColors, type GraphBounds } from "./graph-helpers"; import { colorBlindColors } from "./graph-helpers";
import * as tr from "@generated/ftl"; import * as tr from "@generated/ftl";
import { type RevlogRange } from "./graph-helpers"; import { type RevlogRange } from "./graph-helpers";
import { import {

View file

@ -21,7 +21,7 @@ import {
sum, sum,
} from "d3"; } from "d3";
import { colorBlindColors, type GraphBounds } from "./graph-helpers"; import {type GraphBounds } from "./graph-helpers";
import { GraphRange } from "./graph-helpers"; import { GraphRange } from "./graph-helpers";
import { setDataAvailable } from "./graph-helpers"; import { setDataAvailable } from "./graph-helpers";
import { hideTooltip, showTooltip } from "./tooltip-utils.svelte"; import { hideTooltip, showTooltip } from "./tooltip-utils.svelte";

View file

@ -138,9 +138,21 @@ export function renderCalendar(
} }
const data = Array.from(dayMap.values()); const data = Array.from(dayMap.values());
const cappedRange = scaleLinear().range([1,0]); const cappedRange = scaleLinear().range([1,0]);
const blues = scaleSequentialSqrt()
const isColorBlindMode = (window as any).colorBlindMode;
let gradient;
if (isColorBlindMode) {
gradient = scaleSequentialSqrt()
.domain([0, maxCount]) .domain([0, maxCount])
.interpolator((n) => interpolateMagma(cappedRange(n)!)); .interpolator((n) => interpolateMagma(cappedRange(n)!));
} else {
gradient = scaleSequentialSqrt()
.domain([0, maxCount])
.interpolator((n) => interpolateBlues(cappedRange(n)!));
}
function tooltipText(d: DayDatum): string { function tooltipText(d: DayDatum): string {
const date = localizedDate(d.date, { const date = localizedDate(d.date, {
@ -204,7 +216,7 @@ export function renderCalendar(
}) })
.transition() .transition()
.duration(800) .duration(800)
.attr("fill", (d: DayDatum) => (d.count === 0 ? emptyColour : blues(d.count)!)); .attr("fill", (d: DayDatum) => (d.count === 0 ? emptyColour : gradient(d.count)!));
} }
function timeFunctionForDay(firstDayOfWeek: Weekday): CountableTimeInterval { function timeFunctionForDay(firstDayOfWeek: Weekday): CountableTimeInterval {

View file

@ -8,7 +8,7 @@
import type { GraphsResponse } from "@generated/anki/stats_pb"; import type { GraphsResponse } from "@generated/anki/stats_pb";
import * as tr from "@generated/ftl"; import * as tr from "@generated/ftl";
import { localizedNumber } from "@tslib/i18n"; import { localizedNumber } from "@tslib/i18n";
import type { Bin, ScaleLinear, ScaleSequential } from "d3"; import type { Bin, ScaleLinear } from "d3";
import { bin, extent, interpolateRdYlGn, interpolateViridis, scaleLinear, scaleSequential, sum } from "d3"; import { bin, extent, interpolateRdYlGn, interpolateViridis, scaleLinear, scaleSequential, sum } from "d3";
import type { SearchDispatch, TableDatum } from "./graph-helpers"; import type { SearchDispatch, TableDatum } from "./graph-helpers";

View file

@ -10,7 +10,7 @@ import * as tr from "@generated/ftl";
import { localizedNumber } from "@tslib/i18n"; import { localizedNumber } from "@tslib/i18n";
import { dayLabel } from "@tslib/time"; import { dayLabel } from "@tslib/time";
import type { Bin } from "d3"; import type { Bin } from "d3";
import { bin, extent, interpolateGreens, scaleLinear, scaleSequential, sum, interpolateViridis, interpolateInferno, interpolateMagma, interpolatePlasma,interpolateCividis } from "d3"; import { bin, extent, interpolateGreens, scaleLinear, scaleSequential, sum, interpolateViridis} from "d3";
import type { SearchDispatch, TableDatum } from "./graph-helpers"; import type { SearchDispatch, TableDatum } from "./graph-helpers";
import { getNumericMapBinValue, GraphRange, numericMap } from "./graph-helpers"; import { getNumericMapBinValue, GraphRange, numericMap } from "./graph-helpers";

View file

@ -27,7 +27,6 @@ import {
min, min,
pointer, pointer,
scaleLinear, scaleLinear,
scaleOrdinal,
scaleSequential, scaleSequential,
select, select,
sum, sum,
@ -197,7 +196,7 @@ export function renderReviews(
function makeColorBlindGradient(baseHex: string, satAdjust = 0.02, lightAdjust = 0.02) { function makeColorBlindGradient(baseHex: string, satAdjust = 0.02, lightAdjust = 0.02) {
const base = color(baseHex); const base = color(baseHex);
if (!base) throw new Error(`Invalid color: ${baseHex}`); if (!base) {throw new Error(`Invalid color: ${baseHex}`)};
const lighter = hsl(base); const lighter = hsl(base);
lighter.s = Math.min(1, lighter.s + satAdjust); lighter.s = Math.min(1, lighter.s + satAdjust);