Commit Graph

418 Commits

Author SHA1 Message Date
Henrik Giesel
7655f14859 Satisfy svelte_check 2021-03-22 15:41:43 +01:00
Henrik Giesel
a418d36c7f Add type signatures to asyncReactive 2021-03-22 15:30:35 +01:00
Henrik Giesel
6ec721d550 Satisfy formatter 2021-03-22 15:25:49 +01:00
Henrik Giesel
4cd60da7b8 Fix asyncReactive detection of loading
- Removed `success` store as it wouldn't work
- We should check for a value in error instead
2021-03-22 15:23:48 +01:00
Henrik Giesel
e23b1b77b7 Partially revert "Make sure RangeBox does not trigger update on stores on creation"
This reverts commit 15b19e44b9.
2021-03-22 15:11:36 +01:00
Henrik Giesel
9bbdc616c4 Remove assignment to preferencesPromise: getPreferences will only be called once 2021-03-22 04:03:52 +01:00
Henrik Giesel
10b8a1c3cb Move async and asyncReactive to sveltelib
- sveltelib is a lib for component-agnostic svelte utils
2021-03-22 03:06:53 +01:00
Henrik Giesel
3c5233297a Avoid duplicate initial fetching with asyncReactive 2021-03-22 02:58:19 +01:00
Henrik Giesel
15b19e44b9 Make sure RangeBox does not trigger update on stores on creation 2021-03-22 02:50:16 +01:00
Henrik Giesel
0bbe38ebde Create search and days writable in GraphsPage to allow browserSearch to work 2021-03-22 02:44:08 +01:00
Henrik Giesel
9a864120b2 Fix syntax error introduced by rebase 2021-03-22 01:44:07 +01:00
Henrik Giesel
7dc74004ae Create BrowserSearch component, because we cannot read from stores within slotted content 2021-03-22 01:42:23 +01:00
Henrik Giesel
6d546b0bca Remove pending, and resort to checking for value
- once value is set, it won't be unset
2021-03-22 01:42:23 +01:00
Henrik Giesel
b3851172ba Use preferencesPromise, as refreshing is handled over stores 2021-03-22 01:42:23 +01:00
Henrik Giesel
3363c574c9 Use $-assignments instead of store.set 2021-03-22 01:42:23 +01:00
Henrik Giesel
dd2e180f9b Rename search and days to initialSearch and intitialDays in GraphsPage 2021-03-22 01:42:23 +01:00
Henrik Giesel
672eb20321 Get it to work, if you change the input
- there's still an issue on initial load
2021-03-22 01:42:23 +01:00
Henrik Giesel
3f37153558 Compiles with WithGraphData 2021-03-22 01:42:23 +01:00
Henrik Giesel
c107090906 Move Graph-specific html from GraphsPage to Graph.svelte 2021-03-22 01:42:21 +01:00
Henrik Giesel
36e14cd525 Add WithGraphData 2021-03-22 01:40:51 +01:00
Henrik Giesel
e11b31c29d Rename asyncRefresh to asyncReactive 2021-03-22 01:40:51 +01:00
Henrik Giesel
75a8b7d318 Improve implementation of asyncRefresh 2021-03-22 01:40:51 +01:00
Henrik Giesel
a9c16a3cd8 Add (probably non-working) asyncRefresh 2021-03-22 01:40:51 +01:00
Henrik Giesel
f82a02bd2e Add Svelte async hook 2021-03-22 01:40:51 +01:00
Henrik Giesel
5b9981e04a Add comment where to find global styles 2021-03-21 16:04:38 +01:00
Henrik Giesel
af307a6c4a Move ticks.scss directly into Graph.svelte 2021-03-21 15:59:11 +01:00
Damien Elmes
7d8f19e6e4 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
95ccfc1ed3 move some cumulative-overlay-specific styling out of shared css 2021-03-21 20:18:05 +10:00
Damien Elmes
9dc6e059f2 add HoverColumns.svelte for hoverzone styling 2021-03-21 19:58:39 +10:00
Damien Elmes
7bc41366e8 add CumulativeOverlay.svelte for area styling 2021-03-21 19:50:35 +10:00
Damien Elmes
6e12348cfd add Tooltip.svelte so we can encapsulating styling 2021-03-21 19:35:38 +10:00
Damien Elmes
dbe5d43ba0 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
1e14384d88 add support for declaring css output in esbuild call 2021-03-21 16:06:36 +10:00
Damien Elmes
860ae5464c 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
a581c082f6 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
5403f704d0 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:
e60eb27184
2021-03-21 16:06:07 +10:00
Damien Elmes
e857aa2ea9 output embedded Svelte css into separate .css file for bundling 2021-03-21 16:06:01 +10:00
Damien Elmes
2658d9992e 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
e0b85865f4 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
aabcc8a7db use ts language service for much faster Svelte compiles 2021-03-20 23:49:10 +10:00
Damien Elmes
554081cee3 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
0cc06ad03b 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
8cfd28bd00 clarify comment 2021-03-20 16:25:50 +10:00
Damien Elmes
e60eb27184 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
ea7611d8cc 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
1e57a753da update rules_nodejs 2021-03-20 10:54:18 +10:00
Damien Elmes
afc2892f2e 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
30c7cf1fdd fade out webview when pending updates; do some reviewer updates immediately
Issues that need fixing:
- when the editor saves the note with perform_op(), if it isn't modified,
no new undo entry is created, and perform_op then returns the changes
made by the previous operation instead
- the approach of fetching the last action in a subsequent backend
method is unsound, as another queued operation may sneak in first before
we have a chance to query the result - it would be better if it were
returned in a single atomic action
- redrawing the current card while editing is likely to make sound
autoplay annoyingly, and it has an unpleasant redraw. We may be better off
fading it out instead

Side note: the editor cursor moves to the start of the field when the
note is updated in another window - it might be nicer to have it move
the cursor to the end instead.
2021-03-19 19:45:21 +10:00
Henrik Giesel
76102db2a9 Fix bug with initially enabled toolbar in browser 2021-03-10 19:28:08 +01:00
Henrik Giesel
2905881dcf Fix another import 2021-03-09 14:02:41 +01:00