The adjusted color made it look like the toast was disabled. Having
buttons the same color as the toast is a bit weird but consistent
with the Blueprintjs style for toasts.
This adds a new flag from Pybricks Profile v1.3.0 for documentation
purposes. We currently don't support native modules in Pybricks Code
so we aren't using this for now.
To avoid the Linux feature of pasting on middle click, we need to
consume the mouse up event in the browser on middle click instead of
mouse down.
This also sets the `selectionClipboard` editor option to false which
should disable the feature altogether in the monaco editor but the
setting seems to be broken in the browser[1].
[1]: https://github.com/microsoft/vscode/issues/181050
Fixes: https://github.com/pybricks/support/issues/1046
Since we now have periodic status messages, we don't need to do anything
to get into a known state.
This caused unexpected behavior when connecting to a hub that is already
connected in a second window.
Code depends on always receiving a didWrite/didFailToWrite, however
when a hub disconnected, these tasks were being cancelled. Spawning
protects them from cancellation.
Don't flash progress for short actions like starting repl and stopping
user program. If the hub becomes disconnected, these actions can take
a long time before failing and in that case, we do want to show the
progress indicator.
The Loaded state is not used anywhere else, so we can replace it with
the Unknown state. Then we can make all other command-in-progress
states (start repl/stop user program) the same as download and run.
When the command completes, the hub is in an unknown state until a
status message is received. The Disconnected states overrides all other
states.
- Add check for repl start command success/fail.
- Show error message on fail.
- Rename start repl action.
- Add new did start/did fail to start repl actions.
- Change terminal saga to use did start repl action to focus terminal.
- Add more tests.
WebBluetooth generally uses DomException with name NetworkError to mean
that Bluetooth is disconnected, so we can use that to provide a helpful
error message.
When disconnect is requested, we should not longer allow interacting
with the hub, so we say the runtime state is unknown until it is
confirmed to be disconnected.
Fixes: https://github.com/pybricks/support/issues/1021
useFetch() was trying to actually fetch the license file and mocking
fetch() caused errors about not wrapping code in act(). So instead,
we can avoid all errors by just mocking useFetch() instead.
Since we are using jsdom, the emscripten generated code doesn't use
the node filesystem lookup for .wasm files. But then it falls back to
node for file:// urls, but this doesn't work because node treats file:
as a drive letter.
We can work around this by modifying the node path.normalize() function
to return the correct path.
Fixes: https://github.com/pybricks/pybricks-code/issues/1584
Some user events trigger react dom changes. These need to be wrapped in
act() to avoid a warning printed to the console. To be save, we wrap
all instances.
Also add a new dialog to get user input when file names conflict.
Previously, we were not supplying a list of existing files, so existing
files were silently written over.
Fixes: https://github.com/pybricks/support/issues/833
This will catch some errors. Mainly this is to ensure we show an error
if someone tries to use, e.g. a NXT firmware file that isn't supported
in Pybricks Code yet. Error message isn't great but we don't expect this
to be hit often, if ever, by non-developers.
useCustomFirmware() was called multiple times with the same file which
resulted in the same file being parsed 3 times. Instead we should only
call useCustomFirmware() and pass the results as props instead.
When gotoError fails to activate a file, we need to show an error
message, otherwise it just appears to the user that the button is
broken.
Fixes: https://github.com/pybricks/support/issues/924
This was introduced in Pyodide 0.22 and saves us from having to parse
the message for the type.
Could also affect https://github.com/pybricks/support/issues/772 (but
there is no known reproducible case to check it).
Some new issues with layout when resizing the browser window vertically
were caused either by recent xterm updates or other recent style changes.
This works around those issues.
The pybricks_jedi package was filtering on only pybricks modules but
now has a feature to amend the filter to include user modules.
Fixes: https://github.com/pybricks/support/issues/759
The package we were using was only for Python 3.4 and didn't include
async/await which broke imports in any script that used async/await.
Fixes: https://github.com/pybricks/support/issues/873
"fullscreen" is for immersive apps like games (and is only available
on Android currently which is why we didn't notice the app going
fullscreen on desktop).
Fixes: https://github.com/pybricks/support/issues/867
Characters typed into the terminal are only sent to the hub when a user
program is running. This provides audio and visual feedback to indicate
to the user that keystrokes have no effect when the user program is not
running.
Using styles for changing list starting numbers doesn't have good
cross-browser support. We can set the start count using the start
attribute of the ol element instead.
Issue: https://github.com/pybricks/support/issues/868