Commit graph

6806 commits

Author SHA1 Message Date
Damien Elmes
815fd2df0b delay scrolling to answer until images load 2021-03-22 12:05:18 +10:00
Damien Elmes
095d655a50 fix .csv import not using faster QPlainTextEdit 2021-03-22 11:26:49 +10:00
Damien Elmes
2c76e70b32 fix text not appearing after .apkg import 2021-03-22 11:24:53 +10:00
Damien Elmes
b9421ac38b fix note importing detecting changes due to unicode differences
https://forums.ankiweb.net/t/python-checksum-rust-checksum/8195/16
2021-03-22 10:56:24 +10:00
Damien Elmes
e437bec8bc Merge pull request #1083 from hgiesel/pagesrestructure2
Move ticks.scss directly into Graph.svelte
2021-03-22 10:13:42 +10:00
Damien Elmes
3bb8848104 fix profile dumping on platforms other than Macs
https://github.com/ankitects/anki/pull/1082#issuecomment-803660818
2021-03-22 09:44:06 +10:00
Henrik Giesel
5b1eb98b86 Add comment where to find global styles 2021-03-21 16:04:38 +01:00
Henrik Giesel
794642b2f2 Move ticks.scss directly into Graph.svelte 2021-03-21 15:59:11 +01:00
Damien Elmes
7c76693618 merge in Henrik's TS/Svelte refactor with some changes
- The previous commits moved the majority of the remaining global css
into components; move the remaining @emotion/css references into
ticks.scss and the styling of the Graph.svelte. This is not as elegant
as the emotion solution, but builds a whole lot faster, and most of
our styling can be scoped to a component anyway.
- Leave the .html files in ts/ for now. AnkiMobile uses them, and
AnkiDroid likely will in the future too. In the long run we'll likely
move to loading the JS into an existing page instead of loading a
separate page, but at that point we can just exclude the .html file from
copy_files_into_group() without affecting other clients.

Closes #1074
2021-03-21 23:01:18 +10:00
Damien Elmes
13afaaa770 move some cumulative-overlay-specific styling out of shared css 2021-03-21 20:18:05 +10:00
Damien Elmes
ba4e5d834c add HoverColumns.svelte for hoverzone styling 2021-03-21 19:58:39 +10:00
Damien Elmes
cdf326d45d add CumulativeOverlay.svelte for area styling 2021-03-21 19:50:35 +10:00
Damien Elmes
d4f0661e16 add Tooltip.svelte so we can encapsulating styling 2021-03-21 19:35:38 +10:00
Damien Elmes
c02823b488 bundle all Svelte css into separate file
- svelte compilation outputs a separate .css file for each component
- compilation also adds an "import foo.css" to the top of each generated
.mjs file
- when the .mjs files are bundled into app.js, esbuild creates an app.css
as well
- graphs.scss was renamed to graphs_shared.scss and imported in the
top level GraphsPage. Henrik's style refactoring would be a better path
forward, but I needed to make this change for now, as the filenames were
conflicting.
2021-03-21 16:06:36 +10:00
Damien Elmes
2ffb210ca4 add support for declaring css output in esbuild call 2021-03-21 16:06:36 +10:00
Damien Elmes
d5c088175f add upstream esbuild impl so we can add css output support
Taken from 4a26898023/packages/esbuild/esbuild.bzl
2021-03-21 16:06:36 +10:00
Damien Elmes
460a071fe4 switch from rollup to esbuild
brings the 2+ second bundle on a module like the graphs down to 90ms
2021-03-21 16:06:36 +10:00
Damien Elmes
e1233ac156 ESM import issue on Windows came back again
Not sure if I just missed this in the previous change, or whether
the patch_resolver change broke things again.

Previous issue:
7ae6837cfa
2021-03-21 16:06:07 +10:00
Damien Elmes
27feb0688a output embedded Svelte css into separate .css file for bundling 2021-03-21 16:06:01 +10:00
Damien Elmes
b6f95c0e5e fixes for Svelte compilation
- enable resolver patch on worker binary to ensure js imports work
on subsequent worker requests
- cache ts library content, and use unified interface for cache
- prepare for separate css outputs
2021-03-21 16:05:46 +10:00
Damien Elmes
0e136f13de we no longer need to force CI to local 2021-03-21 00:25:59 +10:00
Damien Elmes
cf68717830 avoid temporary .ts file due to lack of sandbox on Windows
Just a quick hack for now to store it in memory, as the temp file
conflicts on Windows due to the lack of a sandbox, and we don't really
have a need to write it to the filesystem anyway.
2021-03-21 00:17:09 +10:00
Damien Elmes
63b621ce9f use ts language service for much faster Svelte compiles 2021-03-20 23:49:10 +10:00
Damien Elmes
52551b629d convert svelte worker to ts
Should make it easier to maintain, and ironically it also fixes
the issue with .mjs files from this morning.
2021-03-20 23:13:27 +10:00
Damien Elmes
b025e92d26 switch Svelte compilation to worker model
based on changes from upstream rules_svelte

Their code was using run_node() instead of ctx.actions.run(), which
seems to create a new worker for every CPU core, instead of respecting
the standard limit of 4.
2021-03-20 22:52:35 +10:00
Damien Elmes
e99c8b8a81 clarify comment 2021-03-20 16:25:50 +10:00
Damien Elmes
7ae6837cfa update Svelte and fix Windows build
Svelte 3.25.0 and onwards bundle compiler.mjs, which seems to be
preferentially used over the .js file. Presumably this is only breaking
on Windows due to the lack of a sandbox. Resolve by explicitly requesting
the .js file.
2021-03-20 16:13:20 +10:00
Damien Elmes
06b0b4d68b vendor Svelte rules
The separate repo made it difficult to update the rules, and made things
more complicated than they needed to be.
2021-03-20 15:04:19 +10:00
Damien Elmes
e06c692f96 Revert "update Svelte"
This reverts commit 113585ee65.

Unfortunately this is breaking the Windows build. It doesn't seem
to break other platforms, so I'm wondering if maybe it's the Windows
path name or some Windows-specific handling in rules_nodejs that is
to blame:

(08:31:03) ERROR: C:/buildkite-agent/builds/win-ci/ankitects/anki-ci/ts/graphs/BUILD.bazel:21:15:
Svelte ts/graphs/FutureDue.svelte.mjs failed: (Exit 1): bash.exe failed: error executing command C:/msys64/usr/bin/bash.exe -c ... (remaining 1 argument(s) skipped)
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\bazel\ankici\base\external\build_bazel_rules_svelte_deps\node_modules\svelte\compiler.mjs
    at Object.Module._extensions..mjs (internal/modules/cjs/loader.js:1007:9)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (C:\bazel\ankici\base\external\build_bazel_rules_svelte\internal\svelte.js:10:16)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
2021-03-20 10:56:20 +10:00
Damien Elmes
7840d773ef update rules_nodejs 2021-03-20 10:54:18 +10:00
Damien Elmes
72885bc710 move to new rules_nodejs protobuf example to unblock upgrade
@hgiesel the tag editor will need to add the following to the rollup
deps:

        "//ts/lib:backend_proto",
        "//ts/lib:fluent_proto",
2021-03-20 10:24:32 +10:00
Damien Elmes
113585ee65 update Svelte 2021-03-20 08:29:45 +10:00
Damien Elmes
76fdfff714 fix spurious warning in db check for v1 scheduler+non-zero lapse ivl%
https://forums.ankiweb.net/t/invalid-property-on-card-not-resolving-via-recommended-check-database/8430
2021-03-19 22:57:43 +10:00
Damien Elmes
41c20a51ce Merge pull request #1072 from ankitects/refresh
Experimental changes to resetting
2021-03-19 19:46:48 +10:00
Damien Elmes
0e925b407d speed up tag drag&drop and finish tag tidyup
approx 4x speedup when reparenting 10-15 tags and their children at once
2021-03-19 19:45:21 +10:00
Damien Elmes
83a9c22186 change bulk_update() into find_and_replace_tag()
Now behaves the same way as standard find&replace:
- Will match substrings
- Regexs can be used to match multiple items; we no longer split
input on spaces.
- The find&replace dialog has been updated to add tags to the field
list.
2021-03-19 19:45:21 +10:00
Damien Elmes
5bb5811b5d speed up "add tags" and avoid usage of regex 2021-03-19 19:45:21 +10:00
Damien Elmes
6ce9297e37 introduce separate routine to remove tags from specific notes
We were (ab)using the bulk update routine to do deletions, but that
code was really intended to be used for finding&replacing, where an
exact match is not a requirement.
2021-03-19 19:45:21 +10:00
Damien Elmes
0555b4398f split tags.rs up 2021-03-19 19:45:21 +10:00
Damien Elmes
af8c6a4ec7 remove temp variable 2021-03-19 19:45:21 +10:00
Damien Elmes
1e80700286 cache card list cell content
Qt is pretty enthusiastic about redrawing the card list when any sort
of activity occurs, and by serving blank cells while the DB was busy,
we were getting ugly flashes, and cells getting stuck blank.

Resolve the issue by calculating a row up front and caching it, then
serving stale content when updates are blocked.
2021-03-19 19:45:21 +10:00
Damien Elmes
1d0fabd859 make tag deletion undoable, and speed it up
- ~4x faster than before on tag tree with 30k notes
- remove the separate clear_tag() backend method
2021-03-19 19:45:21 +10:00
Damien Elmes
c98c553a96 make tag renaming undoable, and speed it up
~3x speedup when renaming a tag that's on 25k notes
2021-03-19 19:45:21 +10:00
Damien Elmes
25e801b481 tidy up flag/mark code 2021-03-19 19:45:21 +10:00
Damien Elmes
5c648ec4c6 make reposition undoable 2021-03-19 19:45:21 +10:00
Damien Elmes
eb761da622 tweak hook names 2021-03-19 19:45:21 +10:00
Damien Elmes
b8bdc5824b clear_unused_tags and browser redraw improvements
- clear_unused_tags() is now undoable, and returns the number of removed
notes
- add a new mw.query_op() helper for immutable queries
- decouple "freeze/unfreeze ui state" hooks from the "interface update
required" hook, so that the former is fired even on error, and can be
made re-entrant
- use a 'block_updates' flag in Python, instead of setUpdatesEnabled(),
as the latter has the side-effect of preventing child windows like
tooltips from appearing, and forces a full redrawn when updates are
enabled again. The new behaviour leads to the card list blanking out
when a long-running op is running, but in the future if we cache the
cell values we can just display them from the cache instead.
- we were indiscriminately saving the note with saveNow(), due to the
call to saveTags(). Changed so that it only saves when the tags field
is focused.
- drain the "on_done" queue on main before launching a new background
task, to lower the chances of something in on_done making a small query
to the DB and hanging until a long op finishes
- the duplicate check in the editor was executed after the webview loads,
leading to it hanging until the sidebar finishes loading. Run it at
set_note() time instead, so that the editor loads first.
- don't throw an error when a long-running op started with with_progress()
finishes after the window it was launched from has closed
- don't throw an error when the browser is closed before the sidebar
has finished loading
2021-03-19 19:45:21 +10:00
Damien Elmes
9c1fe88912 fix mypy treating Qt objects as inheriting from Any
Before this change, mypy would fail to catch mistakes like
mw.does_not_exist(). Also fix a couple of bugs this has uncovered.
2021-03-19 19:45:21 +10:00
Damien Elmes
9ad1e50544 fix a bunch of qt typing issues uncovered by the following commit 2021-03-19 19:45:21 +10:00
Damien Elmes
3fb9c8eb7f fix opening the browser in an empty collection case
_onRowChanged() no longer exists, and super-frustratingly mypy doesn't
seem to notice references to missing properties on mw or mw.browser
2021-03-19 19:45:21 +10:00