Commit graph

9627 commits

Author SHA1 Message Date
Matthias Metelka
cd726049a1 Return CSS var by default and add palette-of function for raw value 2022-08-31 21:19:53 +02:00
Matthias Metelka
1498ba2c29 Use old --frame-bg color and use darker tone for canvas-default 2022-08-30 19:17:11 +02:00
Matthias Metelka
98f8ab7344 Improve uses of default-themed variables 2022-08-30 18:54:25 +02:00
Matthias Metelka
cb4afed825
Merge branch 'main' into color-palette 2022-08-30 18:17:38 +02:00
Matthias Metelka
4881f16eba Add vars_lib as dependency to base_lib and button_mixins_lib 2022-08-30 18:15:50 +02:00
Matthias Metelka
ac0d2c8954 Add functions and colors to base_lib 2022-08-30 17:56:00 +02:00
Matthias Metelka
7451b67f2a Tweak light theme border and shadow colors 2022-08-30 17:42:12 +02:00
Matthias Metelka
1b8e32e363 Fix focus box shadow transition and remove default shadow for a cleaner look
I couldn't quite get the inset look the way I wanted, because inset box-shadows do not respect the border radius, therefore causing aliasing.
2022-08-30 17:41:36 +02:00
Matthias Metelka
644ff49966 Showcase use of access functions in several locations
@hgiesel in buttons.scss I access the color palette directly. Is this what you meant by "... keep it local to the component, and possibly make it global at a later time ..."?
2022-08-30 17:17:15 +02:00
Matthias Metelka
e9f75e1756 Add Sass functions to access color palette and semantic variables
in response to https://github.com/ankitects/anki/pull/2016#issuecomment-1220571076
2022-08-30 17:14:28 +02:00
Damien Elmes
966d7f3760 Experimentally remove webview recycling
It was originally introduced for WebKit, and may no longer be pertinent
for Chromium.WebEngine.

https://forums.ankiweb.net/t/anki-glitch-showing-previous-card-answer-instead-of-new-card/12482/13
2022-08-30 21:52:22 +10:00
Matthias Metelka
bb172edf05 Adjust box-shadow of EditingArea to make fields look inset 2022-08-30 10:06:05 +02:00
Matthias Metelka
ec290a23cb Tweak gray tones 2022-08-30 10:05:59 +02:00
Matthias Metelka
b7cc8edcae Saturate highlight-bg in light theme 2022-08-29 16:04:08 +02:00
Matthias Metelka
f2d5abb95d Improve categorization of global colors
by renaming almost all of them and sorting them into separate maps.
2022-08-29 15:43:02 +02:00
Matthias Metelka
017c3938ef Replace gray tones with more neutral values 2022-08-29 06:37:16 +02:00
Matthias Metelka
b91ee5bbf7 Use --slightly-grey-text for options tab color 2022-08-29 06:35:31 +02:00
Matthias Metelka
dfe3aba2d8
Merge branch 'main' into color-palette 2022-08-29 05:08:27 +02:00
Damien Elmes
4a884d379f Fix build failing on macOS
I suspect the PyQt maintainer uploaded a new wheel and yanked the old
one, which made pip fall back on a source install which failed. If that's
the case, he really should have used a new version number, as this makes
building/bisecting older releases more cumbersome.
2022-08-25 18:04:37 +10:00
Damien Elmes
89c4441837 Fix scheduler change not reflected after normal sync 2022-08-24 18:37:58 +10:00
Aristotelis
46746e3e34
Move VS Code settings to .vscode.dist and update docs (#2029) 2022-08-24 16:08:58 +10:00
Aristotelis
825c88b6e8
Make all Anki-native exceptions inherit from the same base class (#2028)
* Make all Anki-native exceptions inherit from same base class

Allows add-ons to easily catch all Anki-native exceptions without being coupled to the currently implemented exceptions.

* Satisfy pylint
2022-08-24 16:07:44 +10:00
RumovZ
79fbb6c8d8
Keep content of unmapped fields when importing (#2023)
* Keep content of unmapped fields when importing

* Test new behaviour

* Fix typo in `canonify_tags_without_resgistering`

* Log updated note instead of original one

* Revert merging imported tags

But keep old note tags if no new ones are provided.
2022-08-24 16:04:32 +10:00
Sam Penny
45f2502e5b
fix line break in sync link in the toolbar (#2022) 2022-08-22 11:26:57 +10:00
Damien Elmes
fc93ea3ecc Show a pop-up when the user tries to study with V1
Closes #1991
2022-08-19 12:43:17 +10:00
Damien Elmes
0809812c1d Preserve background-color when pasting external content in light mode
Closes #1964
2022-08-19 12:31:26 +10:00
Sam Bradshaw
92171e25e6
Add MessageBox class and associated funcs to aqt.utils and update the first few callers (#2010)
* Add MessageBox class and associated funcs to aqt.utils and update some callers in aqt.sync and aqt.addons

* Cleanup imports in aqt.sync

* Fix return values for ask_user and ask_user_dialog

* Fix wrong argument name in aqt.utils.ask_user

* Add type annotations to **kwargs in utils.py

* Type annotation for callback in aqt.sync.full_sync

* MessageBox accepts StandardButton in addition to str, fix linting issues

* Assess default buttons in correct order and return correct button name in MessageBox

* Add explicit Optionals in aqt.utils

* Pass button index to callback in MessageBox

* Update type hints for aqt.utils.MessageBox

* Use Sequence for aqt.utils.MessageBox buttons arg

* default_button > default_yes in aqt.utils.ask_user

* Dark mode question icon  in aqt.utils.MessageBox
2022-08-19 10:04:58 +10:00
Matthias Metelka
5f6ac1a916
Field redesign (#2002)
* Adjust size of legacy buttons

* Revert "Adjust size of legacy buttons"

This reverts commit fb888fe1db.

* Remove unused function from #1476

* Use outline version for tag icon

* Add chevron icons

* Remove code icons, keep one pin icon version

* Add code-bg color

* Redesign fields

* Remove unused import

* Fix imports

* Move PlainTextBadge between editing inputs

where it belongs :)

* Make whole separator line clickable

* Fix transition

and format

* Don't show toggle when field is collapsed

* Show toggle only on hover

for mobile I'd like to implement a swipe mechanism.

* Use tweened SVG for triangle instead of CSS hack

* Implement more obvious HTML toggle on bottom right

* Reduce field height by a few pixels

* Reduce field height by two pixels

* Show HTML toggle when PlainTextInput is active, regardless of hover/focus

* Remove RichTextBadge.svelte

* Create separate collapsed field state

this means users can collapse fields with the HTML editor open and it will stay open when the field is expanded again.

* Add slide out animation to EditingArea, RichTextInput and PlainTextInput

only for collapsing, because it is choppy on expansion (common issue with Svelte transitions).

* Fix aliasing issue on focused field corners

* Make StickyBadge feel more responsive

* Move StickyBadge closer to field border

* Adjust field gutter/margins

* Make LabelContainer sticky

to make field operations accessible on fields with a lot of content.

* Add back html icons, remove visual editor icons

* Revert "Add code-bg color"

This reverts commit 4200f35419.

* Add rich text icon, remove strikethrough code icon

* Revert PlainTextBadge to original position

* Adjust margins in FieldState

* Rename PlainTextBadge to SecondaryInputBadge

in preparation for #1987

* Run eslint and prettier

* Make whole LabelContainer clickable area for collapse/expand

* Revert "Add slide out animation to EditingArea, RichTextInput and PlainTextInput"

This reverts commit 9a2b3410d0.

* Fix error on collapse/expansion

this was caused by the {#if} blocks, which resulted in the deletion of original EditingAreas.

* Refocus when toggling chevron and secondary input badge

* Revert "Revert "Add code-bg color""

This reverts commit 1cfd3bda65.

* Use single rotating chevron icon and make it RTL-compatible

* Remove redundant CSS transition rule

* Introduce animated Collapsible component and fix refocus on toggle

* Do not try to force repaint, as it is not required

* Remove RTL store from LabelContainer

the direction is already applied globally.

* Collapse secondary input with field

* Add focusedField to NoteEditorAPI

* Replace :global CSS selector with class .visible

thus removing the assumption that the component is used inside an EditorField.

https://github.com/ankitects/anki/pull/2002#discussion_r944876448

* Use named function syntax instead of function expressions

* Add explanation comment

* Remove unnecessary :bind directive

* Create CollapseBadge component

* Move :global selector into .plain-text-input

* Add comment explaining box-shadow pseudo-element

* Move Collapsible from EditingArea, PlainTextInput and RichTextInput into user components

* Rename SecondaryInputBadge to PlainTextBadge and remove generalization logic

I kept the rich text icon inside icons.ts for future use.

* Sort imports

* Fix background-color for duplicates not showing

with yet another pseudo-element :)

The pseudo-element that covers up field borders on scroll caused this issue. Fighting fire with fire here.

* Increase size of plain text toggle to original value again

This makes the clickable area a bit bigger and looks slightly more consistent with StickyBadge.

* Scrap pseudo-element mess in LabelContainer and tackle the actual issue

* Add class .visible to StickyBadge too

This introduces a peculiar bug: The active prop of StickyBadge resets to false when the mouse leaves the field - regardless of the actual back-end value.

* Fix sticky badge resetting on mouseleave/blur

* Apply overflow: hidden only during transition

fixes MathJax handle getting cut off by fields

* Remove unused variable

* Fix visual bug caused by overflow:hidden not applying in time

I tried several asynchronous approaches, but they all caused issues: either they prevented the CSS transition or they made field inputs lose focus.

In the end I resorted to direct, synchronous DOM-manipulation and added an explanatory comment.

* Decrease Collapsible load time by blocking first transition

I noticed the sliding animation has a hefty performance impact when a large number of fields is loaded simultaneously.

Blocking the first transition (which isn't even visible) results in a big boost in load time.

* Replace usages of gap with margins for children

* Revert unnecessary removal of grid-gap definition

* Correct comments about flex-gap property

mistook that for grid-gap.

* Resolve style issues

* Add minimum targets to gap comment

Co-authored-by: Henrik Giesel <hengiesel@gmail.com>
2022-08-19 10:02:28 +10:00
Damien Elmes
19deb7ad25 Access certificates periodically
Tentatively closes #1965
2022-08-19 10:00:38 +10:00
Matthias Metelka
f8f3f28d08 Adjust light theme 2022-08-18 12:38:32 +02:00
Matthias Metelka
068c2c10cf Align gray color palette more with macOS 2022-08-18 11:20:58 +02:00
Matthias Metelka
b6f9c9a64e Revert QComboBox stylesheet override 2022-08-18 11:20:58 +02:00
Matthias Metelka
ac4c88afdc Merge branch 'main' into color-palette 2022-08-18 11:20:58 +02:00
Matthias Metelka
e036edd584 Move custom QLineEdit styles out of searchbar.py 2022-08-18 11:20:58 +02:00
Matthias Metelka
59d618851d Use different map structure for _vars.scss
after @hgiesel's idea: https://github.com/ankitects/anki/pull/2016#discussion_r947087871
2022-08-18 11:20:58 +02:00
Matthias Metelka
d480e5ce5a Experiment with CSS filter for inline-colors
Inside darker inputs, some colors like dark blue will be hard to read, so we could try to improve text-color contrast with global adjustments depending on the theme.
2022-08-18 11:20:58 +02:00
Matthias Metelka
7517af4942
Fix not being able to scroll when mouse hovers PlainTextInput (#2019)
* Remove overscroll-behavior: none for * (all elements)

* Revert "Remove overscroll-behavior: none for * (all elements)"

This reverts commit 189358908c.

* Use body instead of *, but keep CSS rule

* Unify two CSS rules
2022-08-18 12:48:28 +10:00
Matthias Metelka
d1cbb86178
Default input setting in fields dialog (#1987)
* Introduce field setting to use plain text editor by default

* Remove leftover function from #1476

* Use boolean instead of string

* Simplify clear_other_field_duplicates

* Convert plain text key to camelCase

* Move HTML item below the existing checkbox, instead of to the right (dae)

Showing it on the right is more space efficient, but feels a bit
cluttered IMHO.
2022-08-18 12:30:18 +10:00
Damien Elmes
75723d7c9c
Add option in math dropdown to toggle MathJax rendering (#2014)
* Add option in math dropdown to toggle MathJax rendering

Closes #1942

* Hackily redraw the page when toggling MathJax

* Add Fluent string
2022-08-18 12:06:06 +10:00
Henrik Giesel
678c354fed
Fix field descriptions blocking cursor from being set (#2018)
- happens when focus is in HTML editor
2022-08-17 17:21:13 +10:00
Henrik Giesel
c7f3bae738
Last polishes for Surrounder class (#2017)
* Make private properties in Surrounder truly private

* Fix remove logic of Surrounder

* No reason for toggleTriggerRemove to be async

* Allow using alt-shift to set all remove formats but this one

* modifyFormat => updateFormat

* Fix formatting
2022-08-17 16:00:37 +10:00
Matthias Metelka
bcf8992a9d Define styling for QComboBox and QLineEdit globally 2022-08-16 22:35:34 +02:00
Matthias Metelka
dfe06c0643 Give deck browser entries --frame-bg as background color 2022-08-16 22:34:20 +02:00
Matthias Metelka
08553e0009 Adjust frame- window- and border colors 2022-08-16 22:33:27 +02:00
Matthias Metelka
eba1fc18b6 Skew color palette for more dark values
by removing gray[3], which wasn't used anywhere. Slight adjustments were made to the darker tones.
2022-08-16 22:32:24 +02:00
Matthias Metelka
04781de828 Use same placeholder color for all inputs 2022-08-16 19:27:44 +02:00
Matthias Metelka
cb9b452666 Use custom colors for note view switch 2022-08-16 14:54:48 +02:00
Matthias Metelka
6c48dbcc7f Implement color palette using Sass maps
I hand-picked the gray tones, the other colors are from the Tailwind CSS v3 palette.

Significant changes:
- light theme is brighter
- dark theme is darker
- borders are softer

I also deleted some platform- and night-mode-specific code.
2022-08-16 14:54:12 +02:00
Matthias Metelka
fb197aa32e Remove --medium-border variable 2022-08-16 14:16:22 +02:00
Damien Elmes
4b3332bdb8 Disable auto-closing of HTML tags
https://forums.ankiweb.net/t/set-html-editor-as-a-default-editor-instead-of-visual-editor/20988/3

Closes #1963
2022-08-16 12:43:43 +10:00