Commit graph

8866 commits

Author SHA1 Message Date
RumovZ
ee10dc26a1 Enable registering of legacy attributes without exact substitutes (#1438)
* Enable registering of legacy attributes without...

... exact substitutes. (See diff for an example.)

* Take new callable instead of old name ...

... so we can ensure existence

* Require old names to be passed as key words

This is a lot simpler, less error prone, and works for all kinds of old
names, not only those which are proper camelcase.
2021-10-20 18:13:55 +10:00
Henrik Giesel
44f0cba3fa Fix Preview button not showing and cloze button not hiding (#1437) 2021-10-20 07:09:12 +10:00
Henrik Giesel
1d77c10b3d Use trailingComma: all setting in .prettierrc (#1435) 2021-10-19 09:06:00 +10:00
Henrik Giesel
6509b18a0d Svelte Editor hotfixes (#1436)
* Fix white on white text in light mode

* Reflect rename to FieldsEditor in class name

* Fix adjusting fields ending in an endless loop
2021-10-19 08:38:06 +10:00
Damien Elmes
b798fa819e docs: the old TS flakiness should be gone, but renames are a problem 2021-10-18 22:24:06 +10:00
Henrik Giesel
96b8f2c32d Translate Editor entirely to Svelte (#1403)
* Translate editor to Svelte

Make editor fields grid rather than flexbox

Refactor ButtonToolbar margins

Remove remaining svelte.d.ts symlinks

Implement saveNow

Fix text surrounding

Remove HTML editor button

Clean up some empty files

Add visual for new field state badges

* Adds new IconConstrain.svelte to generalize the icon handling for
IconButton and Badge

Implement sticky functionality again

Enable Editable and Codable field state badges

Add shortcuts to FieldState badges

Add Shift+F9 shortcut back

Add inline padding back to editor fields, tag editor and toolbar

Make Editable and Codable only "visually hidden"

This way they are still updated in the background
Otherwise reshowing them will always start them up empty

Make empty editing area focusable

Start with moving fieldsKey and currentFieldKey to context.ts

Fix Codable being wrong size when opening for first time

Add back drag'n'drop

Make ButtonItem display: contents again

* This will break the gap between ButtonGroup items, however once we
  have a newer Chromium version we should use CSS gap property anyway

Fix most of typing issues

Use --label-color background color LabelContainer

Add back red color for dupes

Generalize the editor toolbar in the multiroot editor to widgets

Implement Notification.svelte for showing cloze hints

Add colorful icon to notification

Hook up Editable to EditingArea

Move EditingArea into EditorField

Include editorField in editor/context

Fix rebasing issues

Uniformly use SvelteComponentTyped

Take LabelContainer out of EditingArea

Use mirror-dom and node-store to export editable content

Fix editable update mechanism

Prepare passing the editing inputs as slots

Pass in editing inputs as slots

Use codable options again in codemirror

Delete editor/lib.ts

Remove CodableAdapter, Use more generic CodeMirror component

Fix clicking LabelContainer to focus

Use prettier

Rename Editable to ContentEditable

Fix writing Mathjax from Codable to Editable

Correctly adjust output HTML from editable

Refactor EditableStyles out of EditableContainer

Pass Image and Mathjax Handle via slots to Editable

Make Editable add its editingInputApi

Make Editable hideable

Fix font size not being set correctly

Refactor both fieldFocused and focusInCodable to focusInEditable

Fix focusIfField

Bring back $activeInput

Fix ClozeButton

Remove signifyCustomInput

Refactor MathjaxHandle

Refactor out some logic into store-subscribe

Fix Mathjax editor

Use focusTrap instead of focusing div

Delegate focus back to editingInput when refocusing focusTrap

Elegantly move focus between editing inputs when closing/opening

Make Codable tabbable

Automatically move caret to end on editable and codable

+ remove from editingInput api

Fix ButtonDropdown having two rows and missing button margins

Make svelte_check and eslint pass

Satisfy editor svelte_check

Save field updates to db again

Await editable styles before mounting content editable

Remove unused import from OldEditorAdapter

Add copyright header to OldEditorAdapter

Update button active state from contenteditable

* Use activateStickyShortcuts after waiting for noteEditorPromise

* Set fields via stores, make tags correctly set

* Add explaining comment to setFields

* Fix ClozeButton

* Send focus and blur events again

* Fix Codable not correctly updating on blur with invalid HTML

* Remove old code for special Enter behavior in tags

* Do not use logical properties for ButtonToolbar margins

* Remove getCurrentField

Instead use noteEditor->currentField or noteEditor->activeInput

* Remove Extensible type

* Use context-property for NoteEditor, EditorField and EditingArea

* Rename parameter in mirror-dom.allowResubscription

* Fix cutOrCopy

* Refactor context.ts into the individual components

* Move focusing of editingArea up to editorField

* Rename promiseResolve -> promiseWithResolver

* Rename Editable->RichTextInput and Codable->PlainTextInput

* Remove now unnecessary type assertion for `getNoteEditor` and `getEditingArea`

* Refocus field after adding, so subscription to editing area is refreshed
2021-10-18 22:01:15 +10:00
Damien Elmes
0af57b4170 add aliases to run vendored python and node from command line
You can then do './scripts/python -m venv /path/to/venv' to create
a virtual env based on the bundled Python, which can be handy if
you don't happen to have the appropriate version of Python installed
separately.
2021-10-18 19:50:41 +10:00
Damien Elmes
91ac32484a pip/ -> python/ 2021-10-18 19:50:40 +10:00
Damien Elmes
973eef5676 enable eslint on aqt/data/web/js 2021-10-18 19:39:45 +10:00
Damien Elmes
3d14a01a84 use ts_project for aqt/data/web/js
We're now ts_project only, and are less likely to run into issues
with future rules_nodejs updates.
2021-10-18 19:39:45 +10:00
Damien Elmes
7405023b9b convert sql_format to ts_project; move into separate folder 2021-10-18 19:39:45 +10:00
Damien Elmes
e0890e9ad6 Merge pull request #1431 from RumovZ/non-modal-card-info
Non modal card info
2021-10-18 18:09:52 +10:00
RumovZ
45836b2ff8 Use null for missing stats 2021-10-18 09:36:31 +02:00
RumovZ
bde763dcad sentCardId -> requestedCardId 2021-10-18 09:12:10 +02:00
RumovZ
ff9dd841ca Use null for unset cardId 2021-10-18 09:11:00 +02:00
RumovZ
8fb055d72e Default to includeRevlog = true 2021-10-18 09:04:49 +02:00
RumovZ
d0859fa665 Format 2021-10-18 09:01:25 +02:00
RumovZ
b5368a0e23 Center placeholder 2021-10-18 09:01:25 +02:00
RumovZ
73dc7e90f8 Use language that mypy understands 2021-10-18 09:01:25 +02:00
RumovZ
f0512de406 Fix _legacy_card_stats() 2021-10-18 09:01:25 +02:00
RumovZ
424a50dcdc Improve clarity in card info code a tiny little bit 2021-10-18 09:01:25 +02:00
RumovZ
c780203ad4 Keep Card Info Dialog open even if no card is set 2021-10-18 09:01:24 +02:00
RumovZ
ae4677c1c2 Move update logic into CardInfo.svelte
Also use a simpler and faster way to avoid race conditions.
2021-10-18 09:01:24 +02:00
RumovZ
847bf3fe12 Move update logic into CardInfo.svelte 2021-10-18 09:01:24 +02:00
RumovZ
083d2db98b Make CardStats a separate component 2021-10-18 09:01:23 +02:00
RumovZ
7570a0757e Make window titles more user-friendly 2021-10-18 09:01:23 +02:00
RumovZ
e328715e00 Add utility func for setting window icon 2021-10-18 09:01:23 +02:00
RumovZ
3b5f4413f8 Use updating card infos in browser and reviewer 2021-10-18 09:01:23 +02:00
RumovZ
5fae48b612 Add update handler for Card Info Dialog 2021-10-18 09:01:22 +02:00
RumovZ
cb0adbd355 Make Card Info Dialog non-modal 2021-10-18 09:01:22 +02:00
RumovZ
80ae938fc8 Implement reactively updating Card Info 2021-10-18 09:01:22 +02:00
Damien Elmes
70e11640a6 Merge pull request #1434 from ankitects/sveltecheck
Svelte build improvements
2021-10-18 13:13:54 +10:00
Damien Elmes
659a175a13 drop ts_library() requirement in ts/svelte 2021-10-18 13:00:55 +10:00
Damien Elmes
5be9ae5229 pass ts deps into most Svelte packages; remove redundant deps
Henrik, I've left editable/editor alone to avoid causing a conflict;
please add them in your PR instead when you get a chance.
2021-10-18 12:44:31 +10:00
Damien Elmes
a78852d636 Svelte build improvements
1. All Svelte files in a package are compiled in one step now, which
ensures that properties that use types from a different Svelte file in the
same package are typed correctly. The single-file svelte() has been removed,
and compile_svelte() may be renamed to svelte() in the future.

2. The .ts files in the same package are included as part of the Svelte
compilation, so that types imported imported from .ts files in the
same package work.

3. Dependencies passed into the rule are now loaded into the TypeScript
compiler, so that properties referencing types from different packages
work. We'll need to update our compile_svelte() lines to list the
dependencies. For example, before this change:

% cat bazel-bin/ts/congrats/CongratsPage.svelte.d.ts
import { SvelteComponentTyped } from "svelte";
declare const __propDef: {
    props: {
        info: any;
    };
...

After adding //ts/lib to the deps of compile_svelte() in ts/congrats:

% cat bazel-bin/ts/congrats/CongratsPage.svelte.d.ts
import { SvelteComponentTyped } from "svelte";
import type { Scheduler } from "../lib/proto";
declare const __propDef: {
    props: {
        info: Scheduler.CongratsInfoResponse;
    };
...
2021-10-18 12:44:29 +10:00
Damien Elmes
a3deb649e8 unbury when rendering deck list
We were previously relying on the sched_timing_today() call in the
backend, but v3 doesn't call it, leading to cards remaining buried.
2021-10-16 21:11:09 +10:00
Damien Elmes
c63c368062 Merge pull request #1429 from ankitects/apple-arm
Initial aarch64-apple support
2021-10-16 18:22:01 +10:00
Damien Elmes
6411d3768a fix qtwebengineprocess failing to load on darwin-aarch64 2021-10-16 18:07:39 +10:00
Damien Elmes
bbcd403dd5 work around pyqt6.2.0's incorrect architecture label 2021-10-16 18:07:39 +10:00
Damien Elmes
efe02960c7 roll back regex due to unsigned wheel 2021-10-16 18:07:39 +10:00
Damien Elmes
9fd0c4aa55 add aarch64-apple to Rust targets 2021-10-16 18:07:39 +10:00
Damien Elmes
abb695bdeb use x86 binaries for clang format/protobuf on Mac 2021-10-16 18:07:39 +10:00
Damien Elmes
45dc83a79b switch to node 16.x for macOS aarch64 support 2021-10-16 18:07:39 +10:00
Damien Elmes
57ee53d41e get PyQt working directly with ./run on macOS
It's no longer necessary to copy everything into bazel-copy, and you
can safely remove that folder.
2021-10-16 18:07:29 +10:00
Damien Elmes
27a4e7e957 remove unneeded namespace code from install_pyqt5/6.py 2021-10-16 18:07:29 +10:00
Damien Elmes
19cddac8a8 remove duplicate clang format file 2021-10-16 16:54:35 +10:00
Damien Elmes
beaf9153f6 drop rules_pip
Our vendored Python includes a recent pip, so we no longer need rules_pip's
dependencies for our PyQt scripts.
2021-10-16 16:54:35 +10:00
Damien Elmes
405c5b87c0 avoid pulling qt5 in unless requested 2021-10-16 16:54:34 +10:00
Damien Elmes
f949ef63b5 update Python deps 2021-10-16 09:29:11 +10:00
Damien Elmes
8fc77ff294 build all the UI files in one go
On macOS, the overhead of importing PyQt for each file far exceeds
any gains we get from incremental recompilation.
2021-10-16 09:20:20 +10:00