Currently, syntax/semantic errors in the user's source code result in vanilla JS exceptions being thrown, so they show up in the console. Instead, this PR:
- Adds a new type KCLError
- KCL syntax/semantic errors when parsing/executing the source code now throw KCLErrors instead of vanilla JS exceptions.
- KCL errors are caught and logged to a new "Errors" panel, instead of the browser console.
* Basic CRA to Vite conversion
* Restore ESLint support
* Remove semicolons from vite config
* Add vite client types to tsconfig
* Migrate to Vitest for testing (not working on Mac)
* some test progress (#175)
* some test progress
* something maybe working
* remove local lib
* small clean up
* tweaks
* fix dependency
* clean up deps
* remove vitest import
* vitest config is needed even though we're not using vitest
* more tweaks to vite config
---------
Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
* port recast to rust with massaged serialisation
* remove logs
* fix the last of white space test failures
* remove ts recastor
* clean up imports
* use serde serialise features
* unneeded async
* final clean up recast.ts
* more clean up tweaks
* improve Rust BinaryPart types
* Comments, fix warnings
* Run clippy --fix
* Remove unused variable
* serialise none_code_nodes manual to force strings to numbers
---------
Co-authored-by: Adam Chalmers <adam.s.chalmers@gmail.com>
* Add theme colors from Figma
* Rough-in of AppHeader
* Add styled ActionButton
* Add react-router and placeholder Settings page
* Add ability to set persistent defaultDir
* Add react-hot-toast for save success message
* Add defaultProjectName setting
* Handle case of stale empty defaultDir in storage
* Wrap app in BrowserRouter
* Wrap test App in BrowserRouter
* Don't need BrowserRouter outside of testing
because we use RouterProvider
We can create a enginelessExecutor that can be used for many of the
executor tests that will be much more performant for tests that don't
need the engine to actually do any modeling work.
* Intital async of executor
The execture now sends websocket message instead of calling functions
directly from the engine, When it does so it holds onto the id.
The engine is still returning geo/polys directly but I'm working make it
so that the UI doesn't need to know about that, so that we can switch
over the streaming ui.
Things left to do:
- it is still making both direct function calls and websockets, and the former should be removed.
- It does highlighting of segments and sourceRanges not through websockets and that needs to be fixed.
- Tests have not been adjusted for these changes.
- Selecting the head of a segment is not working correctly again yet.
* Rough engine prep changes (#135)
* rough changes for engine prep
* mouse movements working again
* connect to engine for startsketch, line, close and extrude
* setup to get path to nodes back from ast-mods
* fix cursor setting for constraint buttons that use transformSecondarySketchLinesTagFirst
* fix cursors for constraints that use transformAstSketchLines
* some clean up
* Change perpendicular-distance constraint to something more intuitive to setting parallel distance
* delete
* add back
* force rename
* change name back
* try renaming again
If you have a yLine(-5, %) i.e. it's values is negative -5 than when constraining it to the length of another line, it should take the sign into account and transform it to yLine(-segLen('someSeg', %), %), currently it always does it positively i.e. yLine(segLen('someSeg', %), %) which is jaring for users to see the line they are constraining to flip direction.
* Refactor getNodePathFromSourceRange
getNodePathFromSourceRange wouldn't go as deep as it should have,
stopping at pipe expressions, when it should have followed as deep
into the ast as possible.
The fact that it stopped early then had other part of the code base that
expected this behaviour and it effected a lot, so a rather large refactor
* overhaul of getNodePathFromSourceRange
* quick fix for moreNodePathFromSourceRange
* minor bugs in moreNodePathFromSourceRange
* couple more tests
* add moveValueIntoNewVariable
* add UI for replacing valuse with variable
* update button text