anki/ts/lib
Damien Elmes 6941bccde4 Add support for proto3 optional scalars
Protobuf 3.15 introduced support for marking scalar fields like
uint32 as optional, and all of our tooling appears to support it
now. This allows us to use simple optional/null checks in our Rust/
TypeScript code, without having to resort to an inner message.

I had to apply a minor patch to protobufjs to get this working with
the json-module output; this has also been submitted upstream:
https://github.com/protobufjs/protobuf.js/pull/1693

I've modified CardStatsResponse as an example of the new syntax.

One thing to note: while the Rust and TypeScript bindings use optional/
null fields, as that is the norm in those languages, Google's Python
bindings are not very Pythonic. Referencing an optional field that is
missing will yield the default value, and a separate HasField() call
is required, eg:

```
>>> from anki.stats_pb2 import CardStatsResponse as R
... msg = R.FromString(b"")
... print(msg.first_review)
... print(msg.HasField("first_review"))
0
False
```
2022-02-27 19:42:06 +10:00
..
i18n Consider using --force-message for ts/protobuf.bzl (#1694) 2022-02-27 17:35:07 +10:00
bridgecommand.ts Improved add-on extension API (#1626) 2022-02-03 14:52:11 +10:00
BUILD.bazel Reverse-engineer surrounding with execCommand (#1377) 2021-11-18 19:18:39 +10:00
cards.ts fix inverted SchedBuried and UserBuried in cards.ts 2021-12-20 12:57:35 +10:00
children-access.ts Improved add-on extension API (#1626) 2022-02-03 14:52:11 +10:00
context-keys.ts Translate Editor entirely to Svelte (#1403) 2021-10-18 22:01:15 +10:00
cross-browser.ts Fix bug when selecting text next to frame by clicking three times (#1604) 2022-01-19 10:15:53 +10:00
dom.ts Move all buttons to our custom inline surrounding (#1682) 2022-02-22 22:17:22 +10:00
events.ts Mathjax editor improvements (#1502) 2021-11-23 10:27:32 +10:00
functional.ts Fix some Mathjax issues (#1547) 2022-01-08 11:46:01 +10:00
genfluent.py Refactor i18n (#1405) 2021-10-07 23:31:49 +10:00
globals.ts Split/Merge editor.py for its three use cases (#1581) 2022-01-12 14:51:43 +10:00
helpers.ts Improved add-on extension API (#1626) 2022-02-03 14:52:11 +10:00
image-import.d.ts update to latest rules_nodejs & switch to ts_project 2021-10-01 12:52:53 +10:00
keys.ts Move all buttons to our custom inline surrounding (#1682) 2022-02-22 22:17:22 +10:00
nightmode.ts Live theme changes (#1497) 2021-11-25 07:17:41 +10:00
node.ts Reverse-engineer surrounding with execCommand (#1377) 2021-11-18 19:18:39 +10:00
platform.ts use different toolbar size on Mac 2021-06-05 11:28:36 +10:00
postrequest.ts Use trailingComma: all setting in .prettierrc (#1435) 2021-10-19 09:06:00 +10:00
promise.ts Set "no-non-null-assertion: off" by default (#1475) 2021-11-04 11:42:51 +10:00
proto.ts Add support for proto3 optional scalars 2022-02-27 19:42:06 +10:00
runtime-require.ts Fix plain text (#1689) 2022-02-25 11:14:26 +10:00
shadow-dom.d.ts Reverse-engineer surrounding with execCommand (#1377) 2021-11-18 19:18:39 +10:00
shortcuts.ts Use eslint for sorting our imports (#1637) 2022-02-04 18:36:34 +10:00
time.test.ts add missing copyright headers to *.ts 2021-04-13 18:57:08 +10:00
time.ts Use trailingComma: all setting in .prettierrc (#1435) 2021-10-19 09:06:00 +10:00
tsconfig.json Reverse-engineer surrounding with execCommand (#1377) 2021-11-18 19:18:39 +10:00
typing.ts Fix insert media always insert at the start (on Windows) (#1684) 2022-02-25 10:59:06 +10:00
ui.ts Improved add-on extension API (#1626) 2022-02-03 14:52:11 +10:00
uuid.ts Mathjax editor improvements (#1502) 2021-11-23 10:27:32 +10:00
wrap.ts Fix setting of caret when creating clozes (#1688) 2022-02-25 11:07:44 +10:00