Commit graph

9865 commits

Author SHA1 Message Date
Damien Elmes
0a5bb6439b Bump version 2022-12-16 22:18:27 +10:00
Damien Elmes
778e02415b Move more of the graph processing into the backend
The existing architecture serializes all cards and revlog entries in
the search range into a protobuf message, which the web frontend needs
to decode and then process. The thinking at the time was that this would
make it easier for add-ons to add extra graphs, but in the ~2.5 years
since the new graphs were introduced, no add-ons appear to have taken
advantage of it.

The cards and revlog entries can grow quite large on large collections -
on a collection I tested with approximately 2.5M reviews, the serialized
data is about 110MB, which is a lot to have to deserialize in JavaScript.

This commit shifts the preliminary processing of the data to the Rust end,
which means the data is able to be processed faster, and less needs to
be sent to the frontend. On the test collection above, this reduces the
serialized data from about 110MB to about 160KB, resulting in a more
than 2x performance improvement, and reducing frontend memory usage from
about 400MB to about 40MB.

This also makes #2043 more feasible - while it is still about 50-100%
slower than protobufjs, with the much smaller message size, the difference
is only about 10ms.
2022-12-16 21:42:17 +10:00
Damien Elmes
786eef6d79 Minor Rust cleanups (#2272)
* Run cargo +nightly fmt

* Latest prost-build includes clippy workaround

* Tweak Rust protobuf imports

- Avoid use of stringify!(), as JetBrains editors get confused by it
- Stop merging all protobuf symbols into a single namespace

* Remove some unnecessary qualifications

Found via IntelliJ lint

* Migrate some asserts to assert_eq/ne

* Remove mention of node_modules exclusion

This no longer seems to be necessary after migrating away from Bazel,
and excluding it means TS/Svelte files can't be edited properly.
2022-12-16 21:40:27 +10:00
Damien Elmes
0fb1b0034e Merge pull request #2255 from RumovZ/replace-pct-str-2
Replace pct-str with local percent_encoding crate
2022-12-16 11:21:04 +00:00
Damien Elmes
3b53be29bd Fix wrong Qt version in macOS bundle 2022-12-16 16:53:58 +10:00
Damien Elmes
7bf30ccfae Revert "Always scan for media changes"
This reverts commit e20b93e1c1.

Overhead on larger folders/slower devices is more than I originally
anticipated, and can run into multiple seconds. This seems to be
particularly egregious on mobile, which I presume is due to sandboxing
overhead.
2022-12-15 20:40:20 +10:00
Damien Elmes
ada53855b9 Fix sync spinner not showing
Regressed in #2137

Closes #2270
2022-12-15 19:10:05 +10:00
Damien Elmes
24abd88dff Revert to Qt 6.3.1 on macOS
Due to flicker reported on #2263. 6.3.1 was used in the 2.1.54 and is
the more conservative choice; we can trial 6.3.2 after release.
2022-12-14 15:25:10 +10:00
Damien Elmes
fa5244556f Update translations 2022-12-14 14:35:40 +10:00
Hikaru Y
8dbe436b91 Fix MathJax popup fails to appear (#2268)
* Fix MathJax popup fails to appear when adding MathJax via Fx button

* Revert "Fix MathJax popup fails to appear when adding MathJax via Fx button"

This reverts commit 11115f59bc.

* Fix MathJax popup fails to appear when adding MathJax via Fx button

Use setTimeout() according to the PR review
2022-12-14 14:10:23 +10:00
Damien Elmes
d17c487259 Use 6 digit hex codes for default colors
The color selector prints a warning otherwise.
2022-12-13 11:35:21 +10:00
Damien Elmes
06d8f4502b Another attempt at fixing reversed toolbar on first startup
May close https://github.com/ankitects/anki/issues/2269
2022-12-13 10:51:13 +10:00
Damien Elmes
29b1bde928 Revert "Avoid setting RTL on first run"
This reverts commit 1bb6afb394.

I appear to have been confused in my earlier testing, as reverting
this change seems to make no difference the top bar on first startup,
and fixes a bunch of other regressions that the original change introduced.

https://github.com/ankitects/anki/issues/2269
2022-12-13 10:45:36 +10:00
Matthias Metelka
ee065485ad Add slight inset shadow to hovered buttons (#2267)
* Replace border-with inset shadow on button hover

* Align gradient-end with base color for primary buttons too

to achieve a more natural hover effect.
2022-12-12 15:41:23 +10:00
Damien Elmes
de1f6488cc Add a small unit test
pct-str encoded the / character as well, but the difference shouldn't
matter in our case.
2022-12-12 14:54:11 +10:00
Matthias Metelka
e38886a3c9 Do not append description button for filtered deck (#2266) 2022-12-11 15:03:11 +10:00
Matthias Metelka
4f48fb3c41 Add style for disabled DropdownItem (#2265)
* Add style for disabled DropdownItem

* Switch back to using disabled as attribute instead of class
2022-12-11 13:06:18 +10:00
Damien Elmes
625d725f0f Fix color defaulting to black
Closes #2261
2022-12-11 11:58:21 +10:00
Damien Elmes
9cb57bebcb Update certifi to fix security alert 2022-12-11 11:42:08 +10:00
Damien Elmes
728683ffcb Fix cursor moving to field start when closing MathJax editor
Closes #2258
2022-12-11 11:39:03 +10:00
Matthias Metelka
32ac6dc5a0 Remove dark theme exclusive inset shadow from FloatingArrow (#2257) 2022-12-11 11:18:59 +10:00
RumovZ
5e89e1f795 Replace pct-str with local ascii_percent_encoding 2022-12-09 11:49:39 +01:00
RumovZ
11bb42e447 Ignore non-ASCII chars in ascii_percent_encoding 2022-12-09 11:47:59 +01:00
RumovZ
ef7bfa3e3b Add local copy of percent_encoding crate 2022-12-09 11:46:00 +01:00
Matthias Metelka
da5796bb9e Fix dropdown items wrapping (#2252) 2022-12-09 13:44:06 +10:00
Damien Elmes
ba521bbd1b Update translations 2022-12-09 12:37:27 +10:00
Damien Elmes
02d0f714e0 Increase initial add-on dialog size
I can't reproduce the reported issue, but this will probably help.

https://forums.ankiweb.net/t/anki-2-1-55-beta-7/25130/10
2022-12-09 12:36:28 +10:00
Henrik Giesel
0b57cc8482 Fix overwrite surround (#2247)
* Revert "Revert to setFormat() to fix color setting"

This reverts commit ed77c9d4fa.

* Fix overwrite-surround
2022-12-09 10:10:58 +10:00
Damien Elmes
db0fc7f334 Fix MathJax editor not hiding on blur again
Originally fixed with 39b021f54e,
accidentally reverted in #2070
2022-12-08 22:46:23 +10:00
Matthias Metelka
1564a4994a Fix popover animation causing placement switching loop (#2246) 2022-12-08 22:35:55 +10:00
Matthias Metelka
82962c8e29 Make SpinBox chevrons more subtle (#2243)
* Make SpinBox chevrons more subtle

and keep showing them when input is focused.

* Show chevrons only on hover

* Revert "Show chevrons only on hover"

This reverts commit 20e5ec1691.
2022-12-08 22:32:35 +10:00
Matthias Metelka
ffa3e1e0b3 Fix some more RTL issues (#2244)
* Swap flag and mark indicator position in RTL mode

* Make buttons of bottom toolbar align to edge of screen in RTL mode

* Use start instead of left and end instead of right
2022-12-08 22:29:56 +10:00
Damien Elmes
53cbdc82c8 Deck options: hide webview after showing dialog
This seems to reduce flicker, presumably because the webview doesn't pick
up the correct geometry until the dialog is shown.
2022-12-08 22:18:28 +10:00
Damien Elmes
ae26cdfb62 Set night-mode class on web page initialization
Ensures the background is the correct color by the time the webview
is shown. We keep the #night check for now, as it's useful when testing
in an external browser.
2022-12-08 22:02:12 +10:00
Damien Elmes
aabd29879d Add default_size argument to restoreGeom(); fix missing dialogs
The starting size of a webview seems to be 640x480, but if it is hidden
without retainSizeWhenHidden being set, the dialog it contains can end
up with a height of 0, which prevents the dialog from being shown.

By being explicit about our desired starting size, we can use a more
useful default, and avoid the issue of missing dialogs.
2022-12-08 22:02:12 +10:00
Damien Elmes
7c12bbf04a Avoid setting path when invoking git
We don't need the amended path, and it seems to break things for
a user:

https://forums.ankiweb.net/t/anki-2-1-55-beta-5-6/24870/89
2022-12-08 12:44:39 +10:00
RumovZ
40b008ec3f Update Chrono Crate (#2242)
* Remove deprecated `and_hms()`

* Update chrono

* Update licenses and fix script

* Remove deprecated Date struct

* Remove chrono pin

* Skip format check on .vscode

Was failing for no reason.

* Replace deprecated chrono functions

* Add cargo-deny to update-licenses & pin versions (dae)

* Remove time 0.1 dependency  (dae)

We don't need to wait for chrono 0.5; it was provided behind a legacy
feature flag.
2022-12-07 17:00:14 +10:00
Yoshi
5037968470 Facilitate hook updating/replacement (#2213)
* Facilitate updating of hooks

- Add instructions in contributing.md
- Change addon_config_editor_will_update_json hook to work with the new
  hookslib code

* Fix typo in docs

* Always run replaced hook

* Use lowercase list for typing

* Forbid defining both a replaced and a legacy hook
2022-12-07 15:39:57 +10:00
Matthias Metelka
a480a1c91f Persist field states with SessionOptions object (#2241)
* Persist collapsed- and field states with SessionOptions object

* Format types.ts

* Replace format function with f-string

* Give setters more descriptive parameter names

* Do not use default prefix for descriptions and fonts

since they are not meant to be changed via Svelte.
2022-12-07 15:37:46 +10:00
Matthias Metelka
6565939db6 Improve Select component and add it back to Change Notetype screen (#2239)
* Do not include oldIdx in Select change event

I included it due to confusion about the variable names in the Change Notetype components.

* Remove redundant on:change listener from NotetypeSelector

* Use Select component in Change Notetype MapperRow (again)

* Remove redundant --cols and --col-size definitions

Bootstrap divides rows into columns of equal width by default.

* Add highlight to active DropdownItem

* Remove bootstrap dropdown item styling

* Fix JS error on dropdown accept action

cause: When closing the dropdown, buttonRef was removed before the callback in setTimeout was run.
2022-12-07 15:31:37 +10:00
Damien Elmes
45387f708c Switch back to winrt to see if it fixes slow TTS
https://forums.ankiweb.net/t/slow-tts-and-duplicated-voices/25157/7

winrt blocks an upgrade from Python 3.9, so this will be a temporary
solution at best.
2022-12-06 20:30:54 +10:00
Abdo
baae784583 Fix Esc not closing TS pages (#2240) 2022-12-06 20:03:34 +10:00
Damien Elmes
ed77c9d4fa Revert to setFormat() to fix color setting
The surrounder code is somewhat complicated, and it could do with either
more documentation, or a simplification.

Closes #2121
2022-12-05 17:00:47 +10:00
Abdo
7beffe3529 Close MathJax editor when Esc is pressed (#2237) 2022-12-05 15:08:38 +10:00
Damien Elmes
a34a7c72b7 Fix the wrong notetype being selected by default
Regressed in #2082

https://forums.ankiweb.net/t/anki-2-1-55-beta-7/25130/7
2022-12-05 15:08:00 +10:00
Damien Elmes
af44926fb6 Tweak graph margins again
76901b7436 (commitcomment-91940936)
2022-12-04 21:50:58 +10:00
Damien Elmes
133300bb7c Avoid hiding webview when refreshing
When opening the graphs screen in dark mode, we want to load the
page first and then reveal the webview, to prevent a flash of white
that can appear as the page loads. Previously we did this for any
call to load_ts_page(), but this results in flicker when refreshing
an existing webview, such as the move from deck list to congrats screen.
In those cases, at least on the machines I have to test with here, the
refresh is smoother without the hide and show step.

The new window case is still not ideal - while the hide+show prevents a
flash of white, there is a flash of black instead, presumably as the
webview draws the initially-blank framebuffer with the contents of the
webview.
2022-12-04 21:17:57 +10:00
Damien Elmes
fcdd7dc23d Exempt MathJax images from image shrinking
https://forums.ankiweb.net/t/anki-2-1-55-beta-mathjax-preview/23529/18
2022-12-04 20:03:27 +10:00
Damien Elmes
76901b7436 Fix graphs not taking up full width 2022-12-04 19:48:18 +10:00
Damien Elmes
757f55cb6d Collapse margins on narrow screens 2022-12-04 19:47:03 +10:00