Compare commits
66 Commits
achalmers/
...
achalmers/
Author | SHA1 | Date | |
---|---|---|---|
36a5461de5 | |||
6a9a0a8bd7 | |||
90e432b10e | |||
90499e086f | |||
8b398a8dd5 | |||
23d2dc8dc8 | |||
764a73ec8b | |||
b69451d2fe | |||
173d50517c | |||
3b63632005 | |||
2bd3b06178 | |||
9c58cde35f | |||
3eb92bb0c4 | |||
f3083eb59d | |||
cef29013b8 | |||
58d1303468 | |||
7c11b7b739 | |||
9f27f3c1ce | |||
f6cbc752d7 | |||
6df1ae7161 | |||
159ec08211 | |||
6aab9c6e23 | |||
afd8daae15 | |||
1132779b4b | |||
e3a65f5b3f | |||
d53665a12a | |||
447f4f9f8f | |||
859927c06d | |||
b88425efc8 | |||
c37dfc61ef | |||
b170ac739f | |||
d712add4da | |||
d8aad4bd4f | |||
1f1c44e598 | |||
b20e685eea | |||
3690d986c1 | |||
9a7f434ede | |||
6afacd7427 | |||
957001ee88 | |||
8b4cc306af | |||
52d88171ca | |||
9142cf3af7 | |||
361500058c | |||
198479a71a | |||
905784c1e5 | |||
c33aaad800 | |||
d175c75780 | |||
ba348d1222 | |||
1f49ddfc29 | |||
58659652c1 | |||
251971238d | |||
381d0b3bc8 | |||
fa7943d06a | |||
7a384251d4 | |||
8e07ea32a6 | |||
23adf9d905 | |||
9f0ac5f6fd | |||
08dbd2e9c3 | |||
2e2ba5adbd | |||
a21dbf1055 | |||
5ecb176467 | |||
66135636ec | |||
685a16545c | |||
9adb15ee93 | |||
a8c4c97d79 | |||
39e8e1f259 |
18
.eslintrc
18
.eslintrc
@ -1,4 +1,8 @@
|
||||
{
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"plugins": [
|
||||
"css-modules"
|
||||
],
|
||||
@ -11,6 +15,16 @@
|
||||
"semi": [
|
||||
"error",
|
||||
"never"
|
||||
]
|
||||
}
|
||||
],
|
||||
"react-hooks/exhaustive-deps": "off",
|
||||
"@typescript-eslint/no-floating-promises": "warn"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["e2e/**/*.ts"], // Update the pattern based on your file structure
|
||||
"rules": {
|
||||
"testing-library/prefer-screen-queries": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
17
.github/workflows/ci.yml
vendored
17
.github/workflows/ci.yml
vendored
@ -31,7 +31,6 @@ jobs:
|
||||
- run: yarn install
|
||||
- run: yarn fmt-check
|
||||
|
||||
|
||||
check-types:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@ -247,18 +246,14 @@ jobs:
|
||||
with:
|
||||
path: "${{ env.PREFIX }}/${{ env.MODE }}/bundle/*/*"
|
||||
|
||||
- name: Install tauri-driver for e2e tests (linux only)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: install
|
||||
args: tauri-driver
|
||||
|
||||
- name: Run e2e tests (linux only)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: xvfb-run yarn test:e2e
|
||||
run: |
|
||||
cargo install tauri-driver
|
||||
xvfb-run yarn test:e2e:tauri
|
||||
env:
|
||||
MODE: ${{ env.BUILD_RELEASE == 'true' && 'release' || 'debug' }}
|
||||
E2E_APPLICATION: "./src-tauri/target/${{ env.BUILD_RELEASE == 'true' && 'release' || 'debug' }}/kittycad-modeling"
|
||||
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN }}
|
||||
|
||||
|
||||
publish-apps-release:
|
||||
@ -345,7 +340,7 @@ jobs:
|
||||
cat last_download.json
|
||||
|
||||
- name: Authenticate to Google Cloud
|
||||
uses: 'google-github-actions/auth@v1.1.1'
|
||||
uses: 'google-github-actions/auth@v2.0.0'
|
||||
with:
|
||||
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
|
||||
|
||||
|
114
.github/workflows/playwright.yml
vendored
Normal file
114
.github/workflows/playwright.yml
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
name: Playwright Tests
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
jobs:
|
||||
playwright-ubuntu:
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
- name: Install Playwright Browsers
|
||||
run: yarn playwright install --with-deps
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Cache wasm
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src/wasm-lib'
|
||||
- name: build wasm
|
||||
run: yarn build:wasm
|
||||
- name: build web
|
||||
run: yarn build:local
|
||||
- name: Run ubuntu/chrome snapshots
|
||||
run: yarn playwright test --project="Google Chrome" --update-snapshots e2e/playwright/snapshot-tests.spec.ts
|
||||
env:
|
||||
CI: true
|
||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
- name: check for changes
|
||||
id: git-check
|
||||
run: |
|
||||
git add .
|
||||
if git status | grep -q "Changes to be committed"
|
||||
then
|
||||
echo "::set-output name=modified::true"
|
||||
else
|
||||
echo "::set-output name=modified::false"
|
||||
fi
|
||||
- name: Commit changes, if any
|
||||
if: steps.git-check.outputs.modified == 'true'
|
||||
run: |
|
||||
git add .
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
||||
git fetch origin
|
||||
echo ${{ github.head_ref }}
|
||||
git checkout ${{ github.head_ref }}
|
||||
# TODO when safari works on ubuntu remove the os part of the commit message
|
||||
git commit -am "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" || true
|
||||
git push
|
||||
git push origin ${{ github.head_ref }}
|
||||
- name: Run ubuntu/chrome flow
|
||||
run: yarn playwright test --project="Google Chrome" e2e/playwright/flow-tests.spec.ts
|
||||
env:
|
||||
CI: true
|
||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
|
||||
playwright-macos:
|
||||
timeout-minutes: 60
|
||||
runs-on: macos-latest
|
||||
needs: playwright-ubuntu
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
- name: Install Playwright Browsers
|
||||
run: yarn playwright install --with-deps
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Cache wasm
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src/wasm-lib'
|
||||
- name: build wasm
|
||||
run: yarn build:wasm
|
||||
- name: build web
|
||||
run: yarn build:local
|
||||
- name: Run macos/safari flow
|
||||
# safari doesn't work on Ubuntu because of the same reason tauri doesn't (webRTC issues)
|
||||
# TODO remove this and the matrix and run all tests on ubuntu when this is fixed
|
||||
run: yarn playwright test --project="webkit" e2e/playwright/flow-tests.spec.ts
|
||||
env:
|
||||
CI: true
|
||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
8
.gitignore
vendored
8
.gitignore
vendored
@ -33,3 +33,11 @@ src/wasm-lib/bindings
|
||||
src/wasm-lib/kcl/bindings
|
||||
public/wasm_lib_bg.wasm
|
||||
src/wasm-lib/lcov.info
|
||||
|
||||
e2e/playwright/playwright-secrets.env
|
||||
e2e/playwright/temp1.png
|
||||
e2e/playwright/temp2.png
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
/blob-report/
|
||||
/playwright/.cache/
|
||||
|
@ -7,6 +7,7 @@ coverage
|
||||
target
|
||||
src/wasm-lib/pkg
|
||||
src/wasm-lib/kcl/bindings
|
||||
e2e/playwright/export-snapshots
|
||||
|
||||
# XState generated files
|
||||
src/machines/modelingMachine.typegen.ts
|
||||
|
109
README.md
109
README.md
@ -176,3 +176,112 @@ $ cargo +nightly fuzz run parser
|
||||
|
||||
For more information on fuzzing you can check out
|
||||
[this guide](https://rust-fuzz.github.io/book/cargo-fuzz.html).
|
||||
|
||||
|
||||
### Playwright
|
||||
|
||||
First time running plawright locally, you'll need to add the secrets file
|
||||
```bash
|
||||
touch ./e2e/playwright/playwright-secrets.env
|
||||
echo 'token="your-token"' > ./e2e/playwright/playwright-secrets.env
|
||||
```
|
||||
then replace "your-token" with a dev token from dev.kittycad.io/account/api-tokens
|
||||
|
||||
then:
|
||||
run playwright
|
||||
```
|
||||
yarn playwright test
|
||||
```
|
||||
|
||||
run a specific test suite
|
||||
```
|
||||
yarn playwright test src/e2e-tests/example.spec.ts
|
||||
```
|
||||
|
||||
run a specific test change the test from `test('...` to `test.only('...`
|
||||
(note if you commit this, the tests will instantly fail without running any of the tests)
|
||||
|
||||
run headed
|
||||
```
|
||||
yarn playwright test --headed
|
||||
```
|
||||
|
||||
run with step through debugger
|
||||
```
|
||||
PWDEBUG=1 yarn playwright test
|
||||
```
|
||||
However, if you want a debugger I recommend using VSCode and the `playwright` extension, as the above command is a cruder debugger that steps into every function call which is annoying.
|
||||
With the extension you can set a breakpoint after `waitForDefaultPlanesVisibilityChange` in order to skip app loading, then the vscode debugger's "step over" is much better for being able to stay at the right level of abstraction as you debug the code.
|
||||
|
||||
If you want to limit to a single browser use `--project="webkit"` or `firefox`, `Google Chrome`
|
||||
Or comment out browsers in `playwright.config.ts`.
|
||||
|
||||
note chromium has encoder compat issues which is why were testing against the branded 'Google Chrome'
|
||||
|
||||
You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `yarn playwright codegen -b wk --load-storage ./store localhost:3000`
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
|
||||
Where `./store` should look like this
|
||||
|
||||
</summary>
|
||||
|
||||
```JSON
|
||||
{
|
||||
"cookies": [],
|
||||
"origins": [
|
||||
{
|
||||
"origin": "http://localhost:3000",
|
||||
"localStorage": [
|
||||
{
|
||||
"name": "store",
|
||||
"value": "{\"state\":{\"openPanes\":[\"code\"]},\"version\":0}"
|
||||
},
|
||||
{
|
||||
"name": "persistCode",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"name": "TOKEN_PERSIST_KEY",
|
||||
"value": "your-token"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
However because much of our tests involve clicking in the stream at specific locations, it's code-gen looks `await page.locator('video').click();` when really we need to use a pixel coord, so I think it's of limited use.
|
||||
|
||||
#### Some notes on CI
|
||||
|
||||
The tests are broken into snapshot tests and non-snapshot tests, and they run in that order, they automatically commit new snap shots, so if you see an image commit check it was an intended change. If we have non-determinism in the snapshots such that they are always committing new images, hopefully this annoyance makes us fix them asap, if you notice this happening let Kurt know. But for the odd occasion `git reset --hard HEAD~ && git push -f` is your friend.
|
||||
|
||||
How to interpret failing playwright tests?
|
||||
If your tests fail, click through to the action and see that the tests failed on a line that includes `await page.getByTestId('loading').waitFor({ state: 'detached' })`, this means the test fail because the stream never started. It's you choice if you want to re-run the test, or ignore the failure.
|
||||
|
||||
We run on ubuntu and macos, because safari doesn't work on linux because of the dreaded "no RTCPeerConnection variable" error. But linux runs first and then macos for the same reason that we limit the number of parallel tests to 1 because we limit stream connections per user, so tests would start failing we if let them run together.
|
||||
|
||||
If something fails on CI you can download the artifact, unzip it and then open `playwright-report/data/<UUID>.zip` with https://trace.playwright.dev/ to see what happened.
|
||||
|
||||
#### Getting started writing a playwright test in our app
|
||||
|
||||
Besides following the instructions above and using the playwright docs, our app is weird because of the whole stream thing, which means our testing is weird. Because we've just figured out this stuff and therefore docs might go stale quick here's a 15min vid/tutorial
|
||||
|
||||
https://github.com/KittyCAD/modeling-app/assets/29681384/6f5e8e85-1003-4fd9-be7f-f36ce833942d
|
||||
|
||||
<details>
|
||||
|
||||
<summary>
|
||||
Ps for the debug panel, the following JSON is useful for snapping the camera
|
||||
</summary>
|
||||
|
||||
```JSON
|
||||
{"type":"modeling_cmd_req","cmd_id":"054e5472-e5e9-4071-92d7-1ce3bac61956","cmd":{"type":"default_camera_look_at","center":{"x":15,"y":0,"z":0},"up":{"x":0,"y":0,"z":1},"vantage":{"x":30,"y":30,"z":30}}}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
BIN
e2e/playwright/export-snapshots/gltf-binary.gltf
Normal file
BIN
e2e/playwright/export-snapshots/gltf-binary.gltf
Normal file
Binary file not shown.
2459
e2e/playwright/export-snapshots/gltf-embedded.gltf
Normal file
2459
e2e/playwright/export-snapshots/gltf-embedded.gltf
Normal file
File diff suppressed because one or more lines are too long
2459
e2e/playwright/export-snapshots/gltf-standard-2.gltf
Normal file
2459
e2e/playwright/export-snapshots/gltf-standard-2.gltf
Normal file
File diff suppressed because it is too large
Load Diff
BIN
e2e/playwright/export-snapshots/gltf-standard.gltf
Normal file
BIN
e2e/playwright/export-snapshots/gltf-standard.gltf
Normal file
Binary file not shown.
189
e2e/playwright/export-snapshots/obj-.obj
Normal file
189
e2e/playwright/export-snapshots/obj-.obj
Normal file
@ -0,0 +1,189 @@
|
||||
v 0 -4 0
|
||||
v 0 0 0
|
||||
v 0 -4 -1
|
||||
v 0 0 -1
|
||||
v 3.0950184 -4 -1
|
||||
v 3.0950184 0 -1
|
||||
v 5.9513144 -4 -3
|
||||
v 5.9513144 0 -3
|
||||
v 9.5 -4 -3
|
||||
v 9.5 0 -3
|
||||
v 9.5 -4 -2.5
|
||||
v 9.5 0 -2.5
|
||||
v 6.108964 -4 -2.5
|
||||
v 6.108964 0 -2.5
|
||||
v 3.4311862 -4 -0.625
|
||||
v 4.323779 -4 -1.25
|
||||
v 4.323779 -0 -1.25
|
||||
v 3.4311862 -0 -0.625
|
||||
v 2.5385938 0 0
|
||||
v 2.5385938 -4 0
|
||||
v 3.342784 -4 0.375
|
||||
v 4.146974 -4 0.75
|
||||
v 3.342784 -0 0.375
|
||||
v 4.146974 -0 0.75
|
||||
v 5.755354 0 1.5
|
||||
v 5.755354 -4 1.5
|
||||
v 9.5 -4 1.5
|
||||
v 9.5 0 1.5
|
||||
v 9.5 -4 2
|
||||
v 9.5 0 2
|
||||
v 5.644507 -4 2
|
||||
v 5.644507 0 2
|
||||
v 3.5 -4 1
|
||||
v 3.5 0 1
|
||||
v 0 -4 1
|
||||
v 0 0 1
|
||||
vt 0.0127 -0.0508
|
||||
vt 0.0127 0.0508
|
||||
vt -0.0127 -0.0508
|
||||
vt -0.0127 0.0508
|
||||
vt -0.039306734 0.0508
|
||||
vt -0.039306734 -0.0508
|
||||
vt 0.039306734 0.0508
|
||||
vt 0.039306734 -0.0508
|
||||
vt -0.04428355 0.0508
|
||||
vt -0.04428355 -0.0508
|
||||
vt 0.04428355 0.0508
|
||||
vt 0.04428355 -0.0508
|
||||
vt -0.045068305 0.0508
|
||||
vt -0.045068305 -0.0508
|
||||
vt 0.045068305 0.0508
|
||||
vt 0.045068305 -0.0508
|
||||
vt -0.00635 0.0508
|
||||
vt -0.00635 -0.0508
|
||||
vt 0.00635 0.0508
|
||||
vt 0.00635 -0.0508
|
||||
vt 0.04306616 -0.0508
|
||||
vt 0.04306616 0.0508
|
||||
vt -0.04306616 -0.0508
|
||||
vt -0.04306616 0.0508
|
||||
vt -0.027677217 -0.0508
|
||||
vt 0.000000000000000048572257 -0.0508
|
||||
vt 0.000000000000000048572257 0.0508
|
||||
vt 0.055354435 -0.0508
|
||||
vt 0.055354435 0.0508
|
||||
vt -0.027677217 0.0508
|
||||
vt -0.055354435 0.0508
|
||||
vt -0.055354435 -0.0508
|
||||
vt -0.02253807 0.0508
|
||||
vt -0.04507614 0.0508
|
||||
vt -0.04507614 -0.0508
|
||||
vt 0.00000000000000005551115 0.0508
|
||||
vt -0.02253807 -0.0508
|
||||
vt 0.00000000000000005551115 -0.0508
|
||||
vt 0.04507614 -0.0508
|
||||
vt 0.04507614 0.0508
|
||||
vt -0.047557 0.0508
|
||||
vt -0.047557 -0.0508
|
||||
vt 0.047557 0.0508
|
||||
vt 0.047557 -0.0508
|
||||
vt 0.04896476 -0.0508
|
||||
vt 0.04896476 0.0508
|
||||
vt -0.04896476 -0.0508
|
||||
vt -0.04896476 0.0508
|
||||
vt 0.03005076 -0.0508
|
||||
vt 0.03005076 0.0508
|
||||
vt -0.03005076 -0.0508
|
||||
vt -0.03005076 0.0508
|
||||
vt 0.04445 -0.0508
|
||||
vt 0.04445 0.0508
|
||||
vt -0.04445 -0.0508
|
||||
vt -0.04445 0.0508
|
||||
vt 0.08490671 0.009525
|
||||
vt 0.06448028 0
|
||||
vt 0.0889 0.0254
|
||||
vt 0.08715213 -0.015875
|
||||
vt 0.10982399 -0.03175
|
||||
vt 0.07861347 -0.0254
|
||||
vt 0.10533314 0.01905
|
||||
vt 0.15116338 -0.0762
|
||||
vt 0 -0.0254
|
||||
vt 0 0
|
||||
vt 0.2413 -0.0762
|
||||
vt 0.15516768 -0.0635
|
||||
vt 0.2413 -0.0635
|
||||
vt 0.14337048 0.0508
|
||||
vt 0.146186 0.0381
|
||||
vt 0.2413 0.0381
|
||||
vt 0.2413 0.0508
|
||||
vt 0 0.0254
|
||||
vn -1 -0 0
|
||||
vn 0 -0 -1
|
||||
vn -0.57357645 -0 -0.81915206
|
||||
vn 1 -0 0
|
||||
vn 0 -0 1
|
||||
vn 0.57357645 -0 0.81915206
|
||||
vn 0.42261827 -0 -0.9063078
|
||||
vn -0.42261827 -0 0.9063078
|
||||
vn -0 1 -0
|
||||
vn 0 -1 0
|
||||
o Unnamed-0
|
||||
f 1/1/1 2/2/1 3/3/1
|
||||
f 3/3/1 2/2/1 4/4/1
|
||||
f 3/5/2 4/6/2 5/7/2
|
||||
f 5/7/2 4/6/2 6/8/2
|
||||
f 5/9/3 6/10/3 7/11/3
|
||||
f 7/11/3 6/10/3 8/12/3
|
||||
f 7/13/2 8/14/2 9/15/2
|
||||
f 9/15/2 8/14/2 10/16/2
|
||||
f 9/17/4 10/18/4 11/19/4
|
||||
f 11/19/4 10/18/4 12/20/4
|
||||
f 11/21/5 12/22/5 13/23/5
|
||||
f 13/23/5 12/22/5 14/24/5
|
||||
f 15/25/6 16/26/6 17/27/6
|
||||
f 16/26/6 13/28/6 14/29/6
|
||||
f 18/30/6 19/31/6 20/32/6
|
||||
f 15/25/6 18/30/6 20/32/6
|
||||
f 16/26/6 14/29/6 17/27/6
|
||||
f 18/30/6 15/25/6 17/27/6
|
||||
f 21/33/7 20/34/7 19/35/7
|
||||
f 22/36/7 21/33/7 23/37/7
|
||||
f 23/37/7 24/38/7 22/36/7
|
||||
f 24/38/7 25/39/7 26/40/7
|
||||
f 21/33/7 19/35/7 23/37/7
|
||||
f 26/40/7 22/36/7 24/38/7
|
||||
f 26/41/2 25/42/2 27/43/2
|
||||
f 27/43/2 25/42/2 28/44/2
|
||||
f 27/17/4 28/18/4 29/19/4
|
||||
f 29/19/4 28/18/4 30/20/4
|
||||
f 29/45/5 30/46/5 31/47/5
|
||||
f 31/47/5 30/46/5 32/48/5
|
||||
f 31/49/8 32/50/8 33/51/8
|
||||
f 33/51/8 32/50/8 34/52/8
|
||||
f 33/53/5 34/54/5 35/55/5
|
||||
f 35/55/5 34/54/5 36/56/5
|
||||
f 35/1/1 36/2/1 1/3/1
|
||||
f 1/3/1 36/2/1 2/4/1
|
||||
f 23/57/9 19/58/9 34/59/9
|
||||
f 18/60/9 17/61/9 6/62/9
|
||||
f 23/57/9 34/59/9 24/63/9
|
||||
f 17/61/9 8/64/9 6/62/9
|
||||
f 4/65/9 19/58/9 6/62/9
|
||||
f 4/65/9 2/66/9 19/58/9
|
||||
f 10/67/9 14/68/9 12/69/9
|
||||
f 10/67/9 8/64/9 14/68/9
|
||||
f 8/64/9 17/61/9 14/68/9
|
||||
f 32/70/9 25/71/9 24/63/9
|
||||
f 6/62/9 19/58/9 18/60/9
|
||||
f 24/63/9 34/59/9 32/70/9
|
||||
f 28/72/9 25/71/9 30/73/9
|
||||
f 25/71/9 32/70/9 30/73/9
|
||||
f 19/58/9 2/66/9 36/74/9
|
||||
f 34/59/9 19/58/9 36/74/9
|
||||
f 21/57/10 33/59/10 20/58/10
|
||||
f 22/63/10 33/59/10 21/57/10
|
||||
f 15/60/10 5/62/10 16/61/10
|
||||
f 22/63/10 26/71/10 31/70/10
|
||||
f 35/74/10 20/58/10 33/59/10
|
||||
f 35/74/10 1/66/10 20/58/10
|
||||
f 31/70/10 26/71/10 29/73/10
|
||||
f 29/73/10 26/71/10 27/72/10
|
||||
f 22/63/10 31/70/10 33/59/10
|
||||
f 20/58/10 5/62/10 15/60/10
|
||||
f 16/61/10 5/62/10 7/64/10
|
||||
f 13/68/10 16/61/10 7/64/10
|
||||
f 11/69/10 13/68/10 9/67/10
|
||||
f 13/68/10 7/64/10 9/67/10
|
||||
f 20/58/10 3/65/10 5/62/10
|
||||
f 3/65/10 20/58/10 1/66/10
|
282
e2e/playwright/export-snapshots/ply-ascii.ply
Normal file
282
e2e/playwright/export-snapshots/ply-ascii.ply
Normal file
@ -0,0 +1,282 @@
|
||||
ply
|
||||
format ascii 1.0
|
||||
comment Generated by kittycad.io
|
||||
element vertex 204
|
||||
property float x
|
||||
property float y
|
||||
property float z
|
||||
element face 68
|
||||
property list uchar uint vertex_indices
|
||||
end_header
|
||||
0 0 4
|
||||
0 0 0
|
||||
0 -1 4
|
||||
0 -1 4
|
||||
0 0 0
|
||||
0 -1 0
|
||||
0 -1 4
|
||||
0 -1 0
|
||||
3.0950184 -1 4
|
||||
3.0950184 -1 4
|
||||
0 -1 0
|
||||
3.0950184 -1 0
|
||||
3.0950184 -1 4
|
||||
3.0950184 -1 0
|
||||
5.9513144 -3 4
|
||||
5.9513144 -3 4
|
||||
3.0950184 -1 0
|
||||
5.9513144 -3 0
|
||||
5.9513144 -3 4
|
||||
5.9513144 -3 0
|
||||
9.5 -3 4
|
||||
9.5 -3 4
|
||||
5.9513144 -3 0
|
||||
9.5 -3 0
|
||||
9.5 -3 4
|
||||
9.5 -3 0
|
||||
9.5 -2.5 4
|
||||
9.5 -2.5 4
|
||||
9.5 -3 0
|
||||
9.5 -2.5 0
|
||||
9.5 -2.5 4
|
||||
9.5 -2.5 0
|
||||
6.108964 -2.5 4
|
||||
6.108964 -2.5 4
|
||||
9.5 -2.5 0
|
||||
6.108964 -2.5 0
|
||||
3.4311862 -0.625 4
|
||||
4.323779 -1.25 4
|
||||
4.323779 -1.25 0
|
||||
4.323779 -1.25 4
|
||||
6.108964 -2.5 4
|
||||
6.108964 -2.5 0
|
||||
3.4311862 -0.625 0
|
||||
2.5385938 0 0
|
||||
2.5385938 0 4
|
||||
3.4311862 -0.625 4
|
||||
3.4311862 -0.625 0
|
||||
2.5385938 0 4
|
||||
4.323779 -1.25 4
|
||||
6.108964 -2.5 0
|
||||
4.323779 -1.25 0
|
||||
3.4311862 -0.625 0
|
||||
3.4311862 -0.625 4
|
||||
4.323779 -1.25 0
|
||||
3.342784 0.375 4
|
||||
2.5385938 0 4
|
||||
2.5385938 0 0
|
||||
4.146974 0.75 4
|
||||
3.342784 0.375 4
|
||||
3.342784 0.375 0
|
||||
3.342784 0.375 0
|
||||
4.146974 0.75 0
|
||||
4.146974 0.75 4
|
||||
4.146974 0.75 0
|
||||
5.755354 1.5 0
|
||||
5.755354 1.5 4
|
||||
3.342784 0.375 4
|
||||
2.5385938 0 0
|
||||
3.342784 0.375 0
|
||||
5.755354 1.5 4
|
||||
4.146974 0.75 4
|
||||
4.146974 0.75 0
|
||||
5.755354 1.5 4
|
||||
5.755354 1.5 0
|
||||
9.5 1.5 4
|
||||
9.5 1.5 4
|
||||
5.755354 1.5 0
|
||||
9.5 1.5 0
|
||||
9.5 1.5 4
|
||||
9.5 1.5 0
|
||||
9.5 2 4
|
||||
9.5 2 4
|
||||
9.5 1.5 0
|
||||
9.5 2 0
|
||||
9.5 2 4
|
||||
9.5 2 0
|
||||
5.644507 2 4
|
||||
5.644507 2 4
|
||||
9.5 2 0
|
||||
5.644507 2 0
|
||||
5.644507 2 4
|
||||
5.644507 2 0
|
||||
3.5 1 4
|
||||
3.5 1 4
|
||||
5.644507 2 0
|
||||
3.5 1 0
|
||||
3.5 1 4
|
||||
3.5 1 0
|
||||
0 1 4
|
||||
0 1 4
|
||||
3.5 1 0
|
||||
0 1 0
|
||||
0 1 4
|
||||
0 1 0
|
||||
0 0 4
|
||||
0 0 4
|
||||
0 1 0
|
||||
0 0 0
|
||||
3.342784 0.375 0
|
||||
2.5385938 0 0
|
||||
3.5 1 0
|
||||
3.4311862 -0.625 0
|
||||
4.323779 -1.25 0
|
||||
3.0950184 -1 0
|
||||
3.342784 0.375 0
|
||||
3.5 1 0
|
||||
4.146974 0.75 0
|
||||
4.323779 -1.25 0
|
||||
5.9513144 -3 0
|
||||
3.0950184 -1 0
|
||||
0 -1 0
|
||||
2.5385938 0 0
|
||||
3.0950184 -1 0
|
||||
0 -1 0
|
||||
0 0 0
|
||||
2.5385938 0 0
|
||||
9.5 -3 0
|
||||
6.108964 -2.5 0
|
||||
9.5 -2.5 0
|
||||
9.5 -3 0
|
||||
5.9513144 -3 0
|
||||
6.108964 -2.5 0
|
||||
5.9513144 -3 0
|
||||
4.323779 -1.25 0
|
||||
6.108964 -2.5 0
|
||||
5.644507 2 0
|
||||
5.755354 1.5 0
|
||||
4.146974 0.75 0
|
||||
3.0950184 -1 0
|
||||
2.5385938 0 0
|
||||
3.4311862 -0.625 0
|
||||
4.146974 0.75 0
|
||||
3.5 1 0
|
||||
5.644507 2 0
|
||||
9.5 1.5 0
|
||||
5.755354 1.5 0
|
||||
9.5 2 0
|
||||
5.755354 1.5 0
|
||||
5.644507 2 0
|
||||
9.5 2 0
|
||||
2.5385938 0 0
|
||||
0 0 0
|
||||
0 1 0
|
||||
3.5 1 0
|
||||
2.5385938 0 0
|
||||
0 1 0
|
||||
3.342784 0.375 4
|
||||
3.5 1 4
|
||||
2.5385938 0 4
|
||||
4.146974 0.75 4
|
||||
3.5 1 4
|
||||
3.342784 0.375 4
|
||||
3.4311862 -0.625 4
|
||||
3.0950184 -1 4
|
||||
4.323779 -1.25 4
|
||||
4.146974 0.75 4
|
||||
5.755354 1.5 4
|
||||
5.644507 2 4
|
||||
0 1 4
|
||||
2.5385938 0 4
|
||||
3.5 1 4
|
||||
0 1 4
|
||||
0 0 4
|
||||
2.5385938 0 4
|
||||
5.644507 2 4
|
||||
5.755354 1.5 4
|
||||
9.5 2 4
|
||||
9.5 2 4
|
||||
5.755354 1.5 4
|
||||
9.5 1.5 4
|
||||
4.146974 0.75 4
|
||||
5.644507 2 4
|
||||
3.5 1 4
|
||||
2.5385938 0 4
|
||||
3.0950184 -1 4
|
||||
3.4311862 -0.625 4
|
||||
4.323779 -1.25 4
|
||||
3.0950184 -1 4
|
||||
5.9513144 -3 4
|
||||
6.108964 -2.5 4
|
||||
4.323779 -1.25 4
|
||||
5.9513144 -3 4
|
||||
9.5 -2.5 4
|
||||
6.108964 -2.5 4
|
||||
9.5 -3 4
|
||||
6.108964 -2.5 4
|
||||
5.9513144 -3 4
|
||||
9.5 -3 4
|
||||
2.5385938 0 4
|
||||
0 -1 4
|
||||
3.0950184 -1 4
|
||||
0 -1 4
|
||||
2.5385938 0 4
|
||||
0 0 4
|
||||
3 0 1 2
|
||||
3 3 4 5
|
||||
3 6 7 8
|
||||
3 9 10 11
|
||||
3 12 13 14
|
||||
3 15 16 17
|
||||
3 18 19 20
|
||||
3 21 22 23
|
||||
3 24 25 26
|
||||
3 27 28 29
|
||||
3 30 31 32
|
||||
3 33 34 35
|
||||
3 36 37 38
|
||||
3 39 40 41
|
||||
3 42 43 44
|
||||
3 45 46 47
|
||||
3 48 49 50
|
||||
3 51 52 53
|
||||
3 54 55 56
|
||||
3 57 58 59
|
||||
3 60 61 62
|
||||
3 63 64 65
|
||||
3 66 67 68
|
||||
3 69 70 71
|
||||
3 72 73 74
|
||||
3 75 76 77
|
||||
3 78 79 80
|
||||
3 81 82 83
|
||||
3 84 85 86
|
||||
3 87 88 89
|
||||
3 90 91 92
|
||||
3 93 94 95
|
||||
3 96 97 98
|
||||
3 99 100 101
|
||||
3 102 103 104
|
||||
3 105 106 107
|
||||
3 108 109 110
|
||||
3 111 112 113
|
||||
3 114 115 116
|
||||
3 117 118 119
|
||||
3 120 121 122
|
||||
3 123 124 125
|
||||
3 126 127 128
|
||||
3 129 130 131
|
||||
3 132 133 134
|
||||
3 135 136 137
|
||||
3 138 139 140
|
||||
3 141 142 143
|
||||
3 144 145 146
|
||||
3 147 148 149
|
||||
3 150 151 152
|
||||
3 153 154 155
|
||||
3 156 157 158
|
||||
3 159 160 161
|
||||
3 162 163 164
|
||||
3 165 166 167
|
||||
3 168 169 170
|
||||
3 171 172 173
|
||||
3 174 175 176
|
||||
3 177 178 179
|
||||
3 180 181 182
|
||||
3 183 184 185
|
||||
3 186 187 188
|
||||
3 189 190 191
|
||||
3 192 193 194
|
||||
3 195 196 197
|
||||
3 198 199 200
|
||||
3 201 202 203
|
BIN
e2e/playwright/export-snapshots/ply-binary_big_endian.ply
Normal file
BIN
e2e/playwright/export-snapshots/ply-binary_big_endian.ply
Normal file
Binary file not shown.
BIN
e2e/playwright/export-snapshots/ply-binary_little_endian.ply
Normal file
BIN
e2e/playwright/export-snapshots/ply-binary_little_endian.ply
Normal file
Binary file not shown.
494
e2e/playwright/export-snapshots/step-.step
Normal file
494
e2e/playwright/export-snapshots/step-.step
Normal file
@ -0,0 +1,494 @@
|
||||
ISO-10303-21;
|
||||
HEADER;
|
||||
FILE_DESCRIPTION((('kittycad.io export')), '2;1');
|
||||
FILE_NAME('dump.step', '1970-01-01T00:00:00.0+00:00', ('Author unknown'), ('Organization unknown'), 'kittycad.io beta', 'kittycad.io', 'Authorization unknown');
|
||||
FILE_SCHEMA(('AP203_CONFIGURATION_CONTROLLED_3D_DESIGN_OF_MECHANICAL_PARTS_AND_ASSEMBLIES_MIM_LF'));
|
||||
ENDSEC;
|
||||
DATA;
|
||||
#1 = (
|
||||
LENGTH_UNIT()
|
||||
NAMED_UNIT(*)
|
||||
SI_UNIT($, .METRE.)
|
||||
);
|
||||
#2 = UNCERTAINTY_MEASURE_WITH_UNIT(0.00001, #1, 'DISTANCE_ACCURACY_VALUE', $);
|
||||
#3 = (
|
||||
GEOMETRIC_REPRESENTATION_CONTEXT(3)
|
||||
GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#2))
|
||||
GLOBAL_UNIT_ASSIGNED_CONTEXT((#1))
|
||||
REPRESENTATION_CONTEXT('', '3D')
|
||||
);
|
||||
#4 = CARTESIAN_POINT('NONE', (0, 0, -0));
|
||||
#5 = VERTEX_POINT('NONE', #4);
|
||||
#6 = CARTESIAN_POINT('NONE', (0, -0.0254, -0));
|
||||
#7 = VERTEX_POINT('NONE', #6);
|
||||
#8 = CARTESIAN_POINT('NONE', (0, -0.0254, 0.1016));
|
||||
#9 = VERTEX_POINT('NONE', #8);
|
||||
#10 = CARTESIAN_POINT('NONE', (0, 0, 0.1016));
|
||||
#11 = VERTEX_POINT('NONE', #10);
|
||||
#12 = CARTESIAN_POINT('NONE', (0.07861346939195568, -0.0254, -0));
|
||||
#13 = VERTEX_POINT('NONE', #12);
|
||||
#14 = CARTESIAN_POINT('NONE', (0.07861346939195568, -0.0254, 0.1016));
|
||||
#15 = VERTEX_POINT('NONE', #14);
|
||||
#16 = CARTESIAN_POINT('NONE', (0.1511633881344551, -0.07619999999999998, -0));
|
||||
#17 = VERTEX_POINT('NONE', #16);
|
||||
#18 = CARTESIAN_POINT('NONE', (0.1511633881344551, -0.07619999999999998, 0.1016));
|
||||
#19 = VERTEX_POINT('NONE', #18);
|
||||
#20 = CARTESIAN_POINT('NONE', (0.2413, -0.0762, -0));
|
||||
#21 = VERTEX_POINT('NONE', #20);
|
||||
#22 = CARTESIAN_POINT('NONE', (0.2413, -0.0762, 0.1016));
|
||||
#23 = VERTEX_POINT('NONE', #22);
|
||||
#24 = CARTESIAN_POINT('NONE', (0.2413, -0.0635, -0));
|
||||
#25 = VERTEX_POINT('NONE', #24);
|
||||
#26 = CARTESIAN_POINT('NONE', (0.2413, -0.0635, 0.1016));
|
||||
#27 = VERTEX_POINT('NONE', #26);
|
||||
#28 = CARTESIAN_POINT('NONE', (0.1551676827532182, -0.0635, -0));
|
||||
#29 = VERTEX_POINT('NONE', #28);
|
||||
#30 = CARTESIAN_POINT('NONE', (0.1551676827532182, -0.0635, 0.1016));
|
||||
#31 = VERTEX_POINT('NONE', #30);
|
||||
#32 = CARTESIAN_POINT('NONE', (0.06448028432509392, 0, -0));
|
||||
#33 = VERTEX_POINT('NONE', #32);
|
||||
#34 = CARTESIAN_POINT('NONE', (0.06448028432509392, 0, 0.1016));
|
||||
#35 = VERTEX_POINT('NONE', #34);
|
||||
#36 = CARTESIAN_POINT('NONE', (0.14618599799650817, 0.03810000000000001, -0));
|
||||
#37 = VERTEX_POINT('NONE', #36);
|
||||
#38 = CARTESIAN_POINT('NONE', (0.14618599799650817, 0.03810000000000001, 0.1016));
|
||||
#39 = VERTEX_POINT('NONE', #38);
|
||||
#40 = CARTESIAN_POINT('NONE', (0.2413, 0.0381, -0));
|
||||
#41 = VERTEX_POINT('NONE', #40);
|
||||
#42 = CARTESIAN_POINT('NONE', (0.2413, 0.0381, 0.1016));
|
||||
#43 = VERTEX_POINT('NONE', #42);
|
||||
#44 = CARTESIAN_POINT('NONE', (0.2413, 0.0508, -0));
|
||||
#45 = VERTEX_POINT('NONE', #44);
|
||||
#46 = CARTESIAN_POINT('NONE', (0.2413, 0.0508, 0.1016));
|
||||
#47 = VERTEX_POINT('NONE', #46);
|
||||
#48 = CARTESIAN_POINT('NONE', (0.14337047578094278, 0.0508, -0));
|
||||
#49 = VERTEX_POINT('NONE', #48);
|
||||
#50 = CARTESIAN_POINT('NONE', (0.14337047578094278, 0.0508, 0.1016));
|
||||
#51 = VERTEX_POINT('NONE', #50);
|
||||
#52 = CARTESIAN_POINT('NONE', (0.08889999999999999, 0.0254, -0));
|
||||
#53 = VERTEX_POINT('NONE', #52);
|
||||
#54 = CARTESIAN_POINT('NONE', (0.08889999999999999, 0.0254, 0.1016));
|
||||
#55 = VERTEX_POINT('NONE', #54);
|
||||
#56 = CARTESIAN_POINT('NONE', (0, 0.0254, -0));
|
||||
#57 = VERTEX_POINT('NONE', #56);
|
||||
#58 = CARTESIAN_POINT('NONE', (0, 0.0254, 0.1016));
|
||||
#59 = VERTEX_POINT('NONE', #58);
|
||||
#60 = DIRECTION('NONE', (0, -1, 0));
|
||||
#61 = VECTOR('NONE', #60, 0.0254);
|
||||
#62 = CARTESIAN_POINT('NONE', (0, 0, -0));
|
||||
#63 = LINE('NONE', #62, #61);
|
||||
#64 = DIRECTION('NONE', (0, 0, 1));
|
||||
#65 = VECTOR('NONE', #64, 0.1016);
|
||||
#66 = CARTESIAN_POINT('NONE', (0, -0.0254, -0));
|
||||
#67 = LINE('NONE', #66, #65);
|
||||
#68 = DIRECTION('NONE', (0, -1, 0));
|
||||
#69 = VECTOR('NONE', #68, 0.0254);
|
||||
#70 = CARTESIAN_POINT('NONE', (0, 0, 0.1016));
|
||||
#71 = LINE('NONE', #70, #69);
|
||||
#72 = DIRECTION('NONE', (0, 0, 1));
|
||||
#73 = VECTOR('NONE', #72, 0.1016);
|
||||
#74 = CARTESIAN_POINT('NONE', (0, 0, -0));
|
||||
#75 = LINE('NONE', #74, #73);
|
||||
#76 = DIRECTION('NONE', (1, 0, 0));
|
||||
#77 = VECTOR('NONE', #76, 0.07861346939195568);
|
||||
#78 = CARTESIAN_POINT('NONE', (0, -0.0254, -0));
|
||||
#79 = LINE('NONE', #78, #77);
|
||||
#80 = DIRECTION('NONE', (0, 0, 1));
|
||||
#81 = VECTOR('NONE', #80, 0.1016);
|
||||
#82 = CARTESIAN_POINT('NONE', (0.07861346939195568, -0.0254, -0));
|
||||
#83 = LINE('NONE', #82, #81);
|
||||
#84 = DIRECTION('NONE', (1, 0, 0));
|
||||
#85 = VECTOR('NONE', #84, 0.07861346939195568);
|
||||
#86 = CARTESIAN_POINT('NONE', (0, -0.0254, 0.1016));
|
||||
#87 = LINE('NONE', #86, #85);
|
||||
#88 = DIRECTION('NONE', (0.8191520442889919, -0.5735764363510459, 0));
|
||||
#89 = VECTOR('NONE', #88, 0.08856709721755177);
|
||||
#90 = CARTESIAN_POINT('NONE', (0.07861346939195568, -0.0254, -0));
|
||||
#91 = LINE('NONE', #90, #89);
|
||||
#92 = DIRECTION('NONE', (0, 0, 1));
|
||||
#93 = VECTOR('NONE', #92, 0.1016);
|
||||
#94 = CARTESIAN_POINT('NONE', (0.1511633881344551, -0.07619999999999998, -0));
|
||||
#95 = LINE('NONE', #94, #93);
|
||||
#96 = DIRECTION('NONE', (0.8191520442889919, -0.5735764363510459, 0));
|
||||
#97 = VECTOR('NONE', #96, 0.08856709721755177);
|
||||
#98 = CARTESIAN_POINT('NONE', (0.07861346939195568, -0.0254, 0.1016));
|
||||
#99 = LINE('NONE', #98, #97);
|
||||
#100 = DIRECTION('NONE', (1, -0.0000000000000003079278779307945, 0));
|
||||
#101 = VECTOR('NONE', #100, 0.09013661186554489);
|
||||
#102 = CARTESIAN_POINT('NONE', (0.1511633881344551, -0.07619999999999998, -0));
|
||||
#103 = LINE('NONE', #102, #101);
|
||||
#104 = DIRECTION('NONE', (0, 0, 1));
|
||||
#105 = VECTOR('NONE', #104, 0.1016);
|
||||
#106 = CARTESIAN_POINT('NONE', (0.2413, -0.0762, -0));
|
||||
#107 = LINE('NONE', #106, #105);
|
||||
#108 = DIRECTION('NONE', (1, -0.0000000000000003079278779307945, 0));
|
||||
#109 = VECTOR('NONE', #108, 0.09013661186554489);
|
||||
#110 = CARTESIAN_POINT('NONE', (0.1511633881344551, -0.07619999999999998, 0.1016));
|
||||
#111 = LINE('NONE', #110, #109);
|
||||
#112 = DIRECTION('NONE', (0, 1, 0));
|
||||
#113 = VECTOR('NONE', #112, 0.012700000000000003);
|
||||
#114 = CARTESIAN_POINT('NONE', (0.2413, -0.0762, -0));
|
||||
#115 = LINE('NONE', #114, #113);
|
||||
#116 = DIRECTION('NONE', (0, 0, 1));
|
||||
#117 = VECTOR('NONE', #116, 0.1016);
|
||||
#118 = CARTESIAN_POINT('NONE', (0.2413, -0.0635, -0));
|
||||
#119 = LINE('NONE', #118, #117);
|
||||
#120 = DIRECTION('NONE', (0, 1, 0));
|
||||
#121 = VECTOR('NONE', #120, 0.012700000000000003);
|
||||
#122 = CARTESIAN_POINT('NONE', (0.2413, -0.0762, 0.1016));
|
||||
#123 = LINE('NONE', #122, #121);
|
||||
#124 = DIRECTION('NONE', (-1, 0, 0));
|
||||
#125 = VECTOR('NONE', #124, 0.08613231724678178);
|
||||
#126 = CARTESIAN_POINT('NONE', (0.2413, -0.0635, -0));
|
||||
#127 = LINE('NONE', #126, #125);
|
||||
#128 = DIRECTION('NONE', (0, 0, 1));
|
||||
#129 = VECTOR('NONE', #128, 0.1016);
|
||||
#130 = CARTESIAN_POINT('NONE', (0.1551676827532182, -0.0635, -0));
|
||||
#131 = LINE('NONE', #130, #129);
|
||||
#132 = DIRECTION('NONE', (-1, 0, 0));
|
||||
#133 = VECTOR('NONE', #132, 0.08613231724678178);
|
||||
#134 = CARTESIAN_POINT('NONE', (0.2413, -0.0635, 0.1016));
|
||||
#135 = LINE('NONE', #134, #133);
|
||||
#136 = DIRECTION('NONE', (-0.8191520442889918, 0.573576436351046, 0));
|
||||
#137 = VECTOR('NONE', #136, 0.11070887152193974);
|
||||
#138 = CARTESIAN_POINT('NONE', (0.1551676827532182, -0.0635, -0));
|
||||
#139 = LINE('NONE', #138, #137);
|
||||
#140 = DIRECTION('NONE', (0, 0, 1));
|
||||
#141 = VECTOR('NONE', #140, 0.1016);
|
||||
#142 = CARTESIAN_POINT('NONE', (0.06448028432509392, 0, -0));
|
||||
#143 = LINE('NONE', #142, #141);
|
||||
#144 = DIRECTION('NONE', (-0.8191520442889918, 0.573576436351046, 0));
|
||||
#145 = VECTOR('NONE', #144, 0.11070887152193974);
|
||||
#146 = CARTESIAN_POINT('NONE', (0.1551676827532182, -0.0635, 0.1016));
|
||||
#147 = LINE('NONE', #146, #145);
|
||||
#148 = DIRECTION('NONE', (0.90630778703665, 0.4226182617406993, 0));
|
||||
#149 = VECTOR('NONE', #148, 0.09015228031811025);
|
||||
#150 = CARTESIAN_POINT('NONE', (0.06448028432509392, 0, -0));
|
||||
#151 = LINE('NONE', #150, #149);
|
||||
#152 = DIRECTION('NONE', (0, 0, 1));
|
||||
#153 = VECTOR('NONE', #152, 0.1016);
|
||||
#154 = CARTESIAN_POINT('NONE', (0.14618599799650817, 0.03810000000000001, -0));
|
||||
#155 = LINE('NONE', #154, #153);
|
||||
#156 = DIRECTION('NONE', (0.90630778703665, 0.4226182617406993, 0));
|
||||
#157 = VECTOR('NONE', #156, 0.09015228031811025);
|
||||
#158 = CARTESIAN_POINT('NONE', (0.06448028432509392, 0, 0.1016));
|
||||
#159 = LINE('NONE', #158, #157);
|
||||
#160 = DIRECTION('NONE', (1, -0.00000000000000007295344279228718, 0));
|
||||
#161 = VECTOR('NONE', #160, 0.09511400200349182);
|
||||
#162 = CARTESIAN_POINT('NONE', (0.14618599799650817, 0.03810000000000001, -0));
|
||||
#163 = LINE('NONE', #162, #161);
|
||||
#164 = DIRECTION('NONE', (0, 0, 1));
|
||||
#165 = VECTOR('NONE', #164, 0.1016);
|
||||
#166 = CARTESIAN_POINT('NONE', (0.2413, 0.0381, -0));
|
||||
#167 = LINE('NONE', #166, #165);
|
||||
#168 = DIRECTION('NONE', (1, -0.00000000000000007295344279228718, 0));
|
||||
#169 = VECTOR('NONE', #168, 0.09511400200349182);
|
||||
#170 = CARTESIAN_POINT('NONE', (0.14618599799650817, 0.03810000000000001, 0.1016));
|
||||
#171 = LINE('NONE', #170, #169);
|
||||
#172 = DIRECTION('NONE', (0, 1, 0));
|
||||
#173 = VECTOR('NONE', #172, 0.012699999999999996);
|
||||
#174 = CARTESIAN_POINT('NONE', (0.2413, 0.0381, -0));
|
||||
#175 = LINE('NONE', #174, #173);
|
||||
#176 = DIRECTION('NONE', (0, 0, 1));
|
||||
#177 = VECTOR('NONE', #176, 0.1016);
|
||||
#178 = CARTESIAN_POINT('NONE', (0.2413, 0.0508, -0));
|
||||
#179 = LINE('NONE', #178, #177);
|
||||
#180 = DIRECTION('NONE', (0, 1, 0));
|
||||
#181 = VECTOR('NONE', #180, 0.012699999999999996);
|
||||
#182 = CARTESIAN_POINT('NONE', (0.2413, 0.0381, 0.1016));
|
||||
#183 = LINE('NONE', #182, #181);
|
||||
#184 = DIRECTION('NONE', (-1, 0, 0));
|
||||
#185 = VECTOR('NONE', #184, 0.0979295242190572);
|
||||
#186 = CARTESIAN_POINT('NONE', (0.2413, 0.0508, -0));
|
||||
#187 = LINE('NONE', #186, #185);
|
||||
#188 = DIRECTION('NONE', (0, 0, 1));
|
||||
#189 = VECTOR('NONE', #188, 0.1016);
|
||||
#190 = CARTESIAN_POINT('NONE', (0.14337047578094278, 0.0508, -0));
|
||||
#191 = LINE('NONE', #190, #189);
|
||||
#192 = DIRECTION('NONE', (-1, 0, 0));
|
||||
#193 = VECTOR('NONE', #192, 0.0979295242190572);
|
||||
#194 = CARTESIAN_POINT('NONE', (0.2413, 0.0508, 0.1016));
|
||||
#195 = LINE('NONE', #194, #193);
|
||||
#196 = DIRECTION('NONE', (-0.9063077870366499, -0.42261826174069944, 0));
|
||||
#197 = VECTOR('NONE', #196, 0.06010152021207346);
|
||||
#198 = CARTESIAN_POINT('NONE', (0.14337047578094278, 0.0508, -0));
|
||||
#199 = LINE('NONE', #198, #197);
|
||||
#200 = DIRECTION('NONE', (0, 0, 1));
|
||||
#201 = VECTOR('NONE', #200, 0.1016);
|
||||
#202 = CARTESIAN_POINT('NONE', (0.08889999999999999, 0.0254, -0));
|
||||
#203 = LINE('NONE', #202, #201);
|
||||
#204 = DIRECTION('NONE', (-0.9063077870366499, -0.42261826174069944, 0));
|
||||
#205 = VECTOR('NONE', #204, 0.06010152021207346);
|
||||
#206 = CARTESIAN_POINT('NONE', (0.14337047578094278, 0.0508, 0.1016));
|
||||
#207 = LINE('NONE', #206, #205);
|
||||
#208 = DIRECTION('NONE', (-1, 0, 0));
|
||||
#209 = VECTOR('NONE', #208, 0.08889999999999999);
|
||||
#210 = CARTESIAN_POINT('NONE', (0.08889999999999999, 0.0254, -0));
|
||||
#211 = LINE('NONE', #210, #209);
|
||||
#212 = DIRECTION('NONE', (0, 0, 1));
|
||||
#213 = VECTOR('NONE', #212, 0.1016);
|
||||
#214 = CARTESIAN_POINT('NONE', (0, 0.0254, -0));
|
||||
#215 = LINE('NONE', #214, #213);
|
||||
#216 = DIRECTION('NONE', (-1, 0, 0));
|
||||
#217 = VECTOR('NONE', #216, 0.08889999999999999);
|
||||
#218 = CARTESIAN_POINT('NONE', (0.08889999999999999, 0.0254, 0.1016));
|
||||
#219 = LINE('NONE', #218, #217);
|
||||
#220 = DIRECTION('NONE', (0, -1, 0));
|
||||
#221 = VECTOR('NONE', #220, 0.0254);
|
||||
#222 = CARTESIAN_POINT('NONE', (0, 0.0254, -0));
|
||||
#223 = LINE('NONE', #222, #221);
|
||||
#224 = DIRECTION('NONE', (0, -1, 0));
|
||||
#225 = VECTOR('NONE', #224, 0.0254);
|
||||
#226 = CARTESIAN_POINT('NONE', (0, 0.0254, 0.1016));
|
||||
#227 = LINE('NONE', #226, #225);
|
||||
#228 = EDGE_CURVE('NONE', #5, #7, #63, .T.);
|
||||
#229 = EDGE_CURVE('NONE', #7, #9, #67, .T.);
|
||||
#230 = EDGE_CURVE('NONE', #11, #9, #71, .T.);
|
||||
#231 = EDGE_CURVE('NONE', #5, #11, #75, .T.);
|
||||
#232 = EDGE_CURVE('NONE', #7, #13, #79, .T.);
|
||||
#233 = EDGE_CURVE('NONE', #13, #15, #83, .T.);
|
||||
#234 = EDGE_CURVE('NONE', #9, #15, #87, .T.);
|
||||
#235 = EDGE_CURVE('NONE', #13, #17, #91, .T.);
|
||||
#236 = EDGE_CURVE('NONE', #17, #19, #95, .T.);
|
||||
#237 = EDGE_CURVE('NONE', #15, #19, #99, .T.);
|
||||
#238 = EDGE_CURVE('NONE', #17, #21, #103, .T.);
|
||||
#239 = EDGE_CURVE('NONE', #21, #23, #107, .T.);
|
||||
#240 = EDGE_CURVE('NONE', #19, #23, #111, .T.);
|
||||
#241 = EDGE_CURVE('NONE', #21, #25, #115, .T.);
|
||||
#242 = EDGE_CURVE('NONE', #25, #27, #119, .T.);
|
||||
#243 = EDGE_CURVE('NONE', #23, #27, #123, .T.);
|
||||
#244 = EDGE_CURVE('NONE', #25, #29, #127, .T.);
|
||||
#245 = EDGE_CURVE('NONE', #29, #31, #131, .T.);
|
||||
#246 = EDGE_CURVE('NONE', #27, #31, #135, .T.);
|
||||
#247 = EDGE_CURVE('NONE', #29, #33, #139, .T.);
|
||||
#248 = EDGE_CURVE('NONE', #33, #35, #143, .T.);
|
||||
#249 = EDGE_CURVE('NONE', #31, #35, #147, .T.);
|
||||
#250 = EDGE_CURVE('NONE', #33, #37, #151, .T.);
|
||||
#251 = EDGE_CURVE('NONE', #37, #39, #155, .T.);
|
||||
#252 = EDGE_CURVE('NONE', #35, #39, #159, .T.);
|
||||
#253 = EDGE_CURVE('NONE', #37, #41, #163, .T.);
|
||||
#254 = EDGE_CURVE('NONE', #41, #43, #167, .T.);
|
||||
#255 = EDGE_CURVE('NONE', #39, #43, #171, .T.);
|
||||
#256 = EDGE_CURVE('NONE', #41, #45, #175, .T.);
|
||||
#257 = EDGE_CURVE('NONE', #45, #47, #179, .T.);
|
||||
#258 = EDGE_CURVE('NONE', #43, #47, #183, .T.);
|
||||
#259 = EDGE_CURVE('NONE', #45, #49, #187, .T.);
|
||||
#260 = EDGE_CURVE('NONE', #49, #51, #191, .T.);
|
||||
#261 = EDGE_CURVE('NONE', #47, #51, #195, .T.);
|
||||
#262 = EDGE_CURVE('NONE', #49, #53, #199, .T.);
|
||||
#263 = EDGE_CURVE('NONE', #53, #55, #203, .T.);
|
||||
#264 = EDGE_CURVE('NONE', #51, #55, #207, .T.);
|
||||
#265 = EDGE_CURVE('NONE', #53, #57, #211, .T.);
|
||||
#266 = EDGE_CURVE('NONE', #57, #59, #215, .T.);
|
||||
#267 = EDGE_CURVE('NONE', #55, #59, #219, .T.);
|
||||
#268 = EDGE_CURVE('NONE', #57, #5, #223, .T.);
|
||||
#269 = EDGE_CURVE('NONE', #59, #11, #227, .T.);
|
||||
#270 = ORIENTED_EDGE('NONE', *, *, #228, .T.);
|
||||
#271 = ORIENTED_EDGE('NONE', *, *, #229, .T.);
|
||||
#272 = ORIENTED_EDGE('NONE', *, *, #230, .F.);
|
||||
#273 = ORIENTED_EDGE('NONE', *, *, #231, .F.);
|
||||
#274 = EDGE_LOOP('NONE', (#270, #271, #272, #273));
|
||||
#275 = ORIENTED_EDGE('NONE', *, *, #232, .T.);
|
||||
#276 = ORIENTED_EDGE('NONE', *, *, #233, .T.);
|
||||
#277 = ORIENTED_EDGE('NONE', *, *, #234, .F.);
|
||||
#278 = ORIENTED_EDGE('NONE', *, *, #229, .F.);
|
||||
#279 = EDGE_LOOP('NONE', (#275, #276, #277, #278));
|
||||
#280 = ORIENTED_EDGE('NONE', *, *, #235, .T.);
|
||||
#281 = ORIENTED_EDGE('NONE', *, *, #236, .T.);
|
||||
#282 = ORIENTED_EDGE('NONE', *, *, #237, .F.);
|
||||
#283 = ORIENTED_EDGE('NONE', *, *, #233, .F.);
|
||||
#284 = EDGE_LOOP('NONE', (#280, #281, #282, #283));
|
||||
#285 = ORIENTED_EDGE('NONE', *, *, #238, .T.);
|
||||
#286 = ORIENTED_EDGE('NONE', *, *, #239, .T.);
|
||||
#287 = ORIENTED_EDGE('NONE', *, *, #240, .F.);
|
||||
#288 = ORIENTED_EDGE('NONE', *, *, #236, .F.);
|
||||
#289 = EDGE_LOOP('NONE', (#285, #286, #287, #288));
|
||||
#290 = ORIENTED_EDGE('NONE', *, *, #241, .T.);
|
||||
#291 = ORIENTED_EDGE('NONE', *, *, #242, .T.);
|
||||
#292 = ORIENTED_EDGE('NONE', *, *, #243, .F.);
|
||||
#293 = ORIENTED_EDGE('NONE', *, *, #239, .F.);
|
||||
#294 = EDGE_LOOP('NONE', (#290, #291, #292, #293));
|
||||
#295 = ORIENTED_EDGE('NONE', *, *, #244, .T.);
|
||||
#296 = ORIENTED_EDGE('NONE', *, *, #245, .T.);
|
||||
#297 = ORIENTED_EDGE('NONE', *, *, #246, .F.);
|
||||
#298 = ORIENTED_EDGE('NONE', *, *, #242, .F.);
|
||||
#299 = EDGE_LOOP('NONE', (#295, #296, #297, #298));
|
||||
#300 = ORIENTED_EDGE('NONE', *, *, #247, .T.);
|
||||
#301 = ORIENTED_EDGE('NONE', *, *, #248, .T.);
|
||||
#302 = ORIENTED_EDGE('NONE', *, *, #249, .F.);
|
||||
#303 = ORIENTED_EDGE('NONE', *, *, #245, .F.);
|
||||
#304 = EDGE_LOOP('NONE', (#300, #301, #302, #303));
|
||||
#305 = ORIENTED_EDGE('NONE', *, *, #250, .T.);
|
||||
#306 = ORIENTED_EDGE('NONE', *, *, #251, .T.);
|
||||
#307 = ORIENTED_EDGE('NONE', *, *, #252, .F.);
|
||||
#308 = ORIENTED_EDGE('NONE', *, *, #248, .F.);
|
||||
#309 = EDGE_LOOP('NONE', (#305, #306, #307, #308));
|
||||
#310 = ORIENTED_EDGE('NONE', *, *, #253, .T.);
|
||||
#311 = ORIENTED_EDGE('NONE', *, *, #254, .T.);
|
||||
#312 = ORIENTED_EDGE('NONE', *, *, #255, .F.);
|
||||
#313 = ORIENTED_EDGE('NONE', *, *, #251, .F.);
|
||||
#314 = EDGE_LOOP('NONE', (#310, #311, #312, #313));
|
||||
#315 = ORIENTED_EDGE('NONE', *, *, #256, .T.);
|
||||
#316 = ORIENTED_EDGE('NONE', *, *, #257, .T.);
|
||||
#317 = ORIENTED_EDGE('NONE', *, *, #258, .F.);
|
||||
#318 = ORIENTED_EDGE('NONE', *, *, #254, .F.);
|
||||
#319 = EDGE_LOOP('NONE', (#315, #316, #317, #318));
|
||||
#320 = ORIENTED_EDGE('NONE', *, *, #259, .T.);
|
||||
#321 = ORIENTED_EDGE('NONE', *, *, #260, .T.);
|
||||
#322 = ORIENTED_EDGE('NONE', *, *, #261, .F.);
|
||||
#323 = ORIENTED_EDGE('NONE', *, *, #257, .F.);
|
||||
#324 = EDGE_LOOP('NONE', (#320, #321, #322, #323));
|
||||
#325 = ORIENTED_EDGE('NONE', *, *, #262, .T.);
|
||||
#326 = ORIENTED_EDGE('NONE', *, *, #263, .T.);
|
||||
#327 = ORIENTED_EDGE('NONE', *, *, #264, .F.);
|
||||
#328 = ORIENTED_EDGE('NONE', *, *, #260, .F.);
|
||||
#329 = EDGE_LOOP('NONE', (#325, #326, #327, #328));
|
||||
#330 = ORIENTED_EDGE('NONE', *, *, #265, .T.);
|
||||
#331 = ORIENTED_EDGE('NONE', *, *, #266, .T.);
|
||||
#332 = ORIENTED_EDGE('NONE', *, *, #267, .F.);
|
||||
#333 = ORIENTED_EDGE('NONE', *, *, #263, .F.);
|
||||
#334 = EDGE_LOOP('NONE', (#330, #331, #332, #333));
|
||||
#335 = ORIENTED_EDGE('NONE', *, *, #268, .T.);
|
||||
#336 = ORIENTED_EDGE('NONE', *, *, #231, .T.);
|
||||
#337 = ORIENTED_EDGE('NONE', *, *, #269, .F.);
|
||||
#338 = ORIENTED_EDGE('NONE', *, *, #266, .F.);
|
||||
#339 = EDGE_LOOP('NONE', (#335, #336, #337, #338));
|
||||
#340 = ORIENTED_EDGE('NONE', *, *, #228, .T.);
|
||||
#341 = ORIENTED_EDGE('NONE', *, *, #232, .T.);
|
||||
#342 = ORIENTED_EDGE('NONE', *, *, #235, .T.);
|
||||
#343 = ORIENTED_EDGE('NONE', *, *, #238, .T.);
|
||||
#344 = ORIENTED_EDGE('NONE', *, *, #241, .T.);
|
||||
#345 = ORIENTED_EDGE('NONE', *, *, #244, .T.);
|
||||
#346 = ORIENTED_EDGE('NONE', *, *, #247, .T.);
|
||||
#347 = ORIENTED_EDGE('NONE', *, *, #250, .T.);
|
||||
#348 = ORIENTED_EDGE('NONE', *, *, #253, .T.);
|
||||
#349 = ORIENTED_EDGE('NONE', *, *, #256, .T.);
|
||||
#350 = ORIENTED_EDGE('NONE', *, *, #259, .T.);
|
||||
#351 = ORIENTED_EDGE('NONE', *, *, #262, .T.);
|
||||
#352 = ORIENTED_EDGE('NONE', *, *, #265, .T.);
|
||||
#353 = ORIENTED_EDGE('NONE', *, *, #268, .T.);
|
||||
#354 = EDGE_LOOP('NONE', (#340, #341, #342, #343, #344, #345, #346, #347, #348, #349, #350, #351, #352, #353));
|
||||
#355 = ORIENTED_EDGE('NONE', *, *, #230, .T.);
|
||||
#356 = ORIENTED_EDGE('NONE', *, *, #234, .T.);
|
||||
#357 = ORIENTED_EDGE('NONE', *, *, #237, .T.);
|
||||
#358 = ORIENTED_EDGE('NONE', *, *, #240, .T.);
|
||||
#359 = ORIENTED_EDGE('NONE', *, *, #243, .T.);
|
||||
#360 = ORIENTED_EDGE('NONE', *, *, #246, .T.);
|
||||
#361 = ORIENTED_EDGE('NONE', *, *, #249, .T.);
|
||||
#362 = ORIENTED_EDGE('NONE', *, *, #252, .T.);
|
||||
#363 = ORIENTED_EDGE('NONE', *, *, #255, .T.);
|
||||
#364 = ORIENTED_EDGE('NONE', *, *, #258, .T.);
|
||||
#365 = ORIENTED_EDGE('NONE', *, *, #261, .T.);
|
||||
#366 = ORIENTED_EDGE('NONE', *, *, #264, .T.);
|
||||
#367 = ORIENTED_EDGE('NONE', *, *, #267, .T.);
|
||||
#368 = ORIENTED_EDGE('NONE', *, *, #269, .T.);
|
||||
#369 = EDGE_LOOP('NONE', (#355, #356, #357, #358, #359, #360, #361, #362, #363, #364, #365, #366, #367, #368));
|
||||
#370 = CARTESIAN_POINT('NONE', (0, -0.0127, 0.0508));
|
||||
#371 = DIRECTION('NONE', (-1, 0, -0));
|
||||
#372 = AXIS2_PLACEMENT_3D('NONE', #370, #371, $);
|
||||
#373 = PLANE('NONE', #372);
|
||||
#374 = CARTESIAN_POINT('NONE', (0.039306734695977924, -0.025399999999999995, 0.0508));
|
||||
#375 = DIRECTION('NONE', (0, -1, -0));
|
||||
#376 = AXIS2_PLACEMENT_3D('NONE', #374, #375, $);
|
||||
#377 = PLANE('NONE', #376);
|
||||
#378 = CARTESIAN_POINT('NONE', (0.11488842876320533, -0.05079999999999996, 0.05079999999999999));
|
||||
#379 = DIRECTION('NONE', (-0.5735764363510459, -0.819152044288992, 0));
|
||||
#380 = AXIS2_PLACEMENT_3D('NONE', #378, #379, $);
|
||||
#381 = PLANE('NONE', #380);
|
||||
#382 = CARTESIAN_POINT('NONE', (0.19623169406722757, -0.07619999999999999, 0.0508));
|
||||
#383 = DIRECTION('NONE', (0, -1, -0));
|
||||
#384 = AXIS2_PLACEMENT_3D('NONE', #382, #383, $);
|
||||
#385 = PLANE('NONE', #384);
|
||||
#386 = CARTESIAN_POINT('NONE', (0.2413, -0.06985, 0.0508));
|
||||
#387 = DIRECTION('NONE', (1, 0, -0));
|
||||
#388 = AXIS2_PLACEMENT_3D('NONE', #386, #387, $);
|
||||
#389 = PLANE('NONE', #388);
|
||||
#390 = CARTESIAN_POINT('NONE', (0.19823384137660915, -0.0635, 0.0508));
|
||||
#391 = DIRECTION('NONE', (0, 1, -0));
|
||||
#392 = AXIS2_PLACEMENT_3D('NONE', #390, #391, $);
|
||||
#393 = PLANE('NONE', #392);
|
||||
#394 = CARTESIAN_POINT('NONE', (0.10982398353915601, -0.03174999999999997, 0.0508));
|
||||
#395 = DIRECTION('NONE', (0.573576436351046, 0.8191520442889918, -0));
|
||||
#396 = AXIS2_PLACEMENT_3D('NONE', #394, #395, $);
|
||||
#397 = PLANE('NONE', #396);
|
||||
#398 = CARTESIAN_POINT('NONE', (0.105333141160801, 0.019049999999999987, 0.0508));
|
||||
#399 = DIRECTION('NONE', (0.4226182617406993, -0.90630778703665, -0));
|
||||
#400 = AXIS2_PLACEMENT_3D('NONE', #398, #399, $);
|
||||
#401 = PLANE('NONE', #400);
|
||||
#402 = CARTESIAN_POINT('NONE', (0.19374299899825406, 0.0381, 0.0508));
|
||||
#403 = DIRECTION('NONE', (0, -1, -0));
|
||||
#404 = AXIS2_PLACEMENT_3D('NONE', #402, #403, $);
|
||||
#405 = PLANE('NONE', #404);
|
||||
#406 = CARTESIAN_POINT('NONE', (0.2413, 0.044449999999999996, 0.0508));
|
||||
#407 = DIRECTION('NONE', (1, 0, -0));
|
||||
#408 = AXIS2_PLACEMENT_3D('NONE', #406, #407, $);
|
||||
#409 = PLANE('NONE', #408);
|
||||
#410 = CARTESIAN_POINT('NONE', (0.19233523789047138, 0.0508, 0.0508));
|
||||
#411 = DIRECTION('NONE', (0, 1, -0));
|
||||
#412 = AXIS2_PLACEMENT_3D('NONE', #410, #411, $);
|
||||
#413 = PLANE('NONE', #412);
|
||||
#414 = CARTESIAN_POINT('NONE', (0.11613523789047137, 0.0381, 0.05079999999999999));
|
||||
#415 = DIRECTION('NONE', (-0.42261826174069966, 0.90630778703665, -0));
|
||||
#416 = AXIS2_PLACEMENT_3D('NONE', #414, #415, $);
|
||||
#417 = PLANE('NONE', #416);
|
||||
#418 = CARTESIAN_POINT('NONE', (0.044449999999999996, 0.0254, 0.0508));
|
||||
#419 = DIRECTION('NONE', (0, 1, -0));
|
||||
#420 = AXIS2_PLACEMENT_3D('NONE', #418, #419, $);
|
||||
#421 = PLANE('NONE', #420);
|
||||
#422 = CARTESIAN_POINT('NONE', (0, 0.0127, 0.0508));
|
||||
#423 = DIRECTION('NONE', (-1, 0, -0));
|
||||
#424 = AXIS2_PLACEMENT_3D('NONE', #422, #423, $);
|
||||
#425 = PLANE('NONE', #424);
|
||||
#426 = CARTESIAN_POINT('NONE', (0, 0, -0));
|
||||
#427 = DIRECTION('NONE', (0, 0, 1));
|
||||
#428 = AXIS2_PLACEMENT_3D('NONE', #426, #427, $);
|
||||
#429 = PLANE('NONE', #428);
|
||||
#430 = CARTESIAN_POINT('NONE', (0, 0, 0.1016));
|
||||
#431 = DIRECTION('NONE', (0, 0, 1));
|
||||
#432 = AXIS2_PLACEMENT_3D('NONE', #430, #431, $);
|
||||
#433 = PLANE('NONE', #432);
|
||||
#434 = FACE_OUTER_BOUND('NONE', #274, .T.);
|
||||
#435 = ADVANCED_FACE('NONE', (#434), #373, .T.);
|
||||
#436 = FACE_OUTER_BOUND('NONE', #279, .T.);
|
||||
#437 = ADVANCED_FACE('NONE', (#436), #377, .T.);
|
||||
#438 = FACE_OUTER_BOUND('NONE', #284, .T.);
|
||||
#439 = ADVANCED_FACE('NONE', (#438), #381, .T.);
|
||||
#440 = FACE_OUTER_BOUND('NONE', #289, .T.);
|
||||
#441 = ADVANCED_FACE('NONE', (#440), #385, .T.);
|
||||
#442 = FACE_OUTER_BOUND('NONE', #294, .T.);
|
||||
#443 = ADVANCED_FACE('NONE', (#442), #389, .T.);
|
||||
#444 = FACE_OUTER_BOUND('NONE', #299, .T.);
|
||||
#445 = ADVANCED_FACE('NONE', (#444), #393, .T.);
|
||||
#446 = FACE_OUTER_BOUND('NONE', #304, .T.);
|
||||
#447 = ADVANCED_FACE('NONE', (#446), #397, .T.);
|
||||
#448 = FACE_OUTER_BOUND('NONE', #309, .T.);
|
||||
#449 = ADVANCED_FACE('NONE', (#448), #401, .T.);
|
||||
#450 = FACE_OUTER_BOUND('NONE', #314, .T.);
|
||||
#451 = ADVANCED_FACE('NONE', (#450), #405, .T.);
|
||||
#452 = FACE_OUTER_BOUND('NONE', #319, .T.);
|
||||
#453 = ADVANCED_FACE('NONE', (#452), #409, .T.);
|
||||
#454 = FACE_OUTER_BOUND('NONE', #324, .T.);
|
||||
#455 = ADVANCED_FACE('NONE', (#454), #413, .T.);
|
||||
#456 = FACE_OUTER_BOUND('NONE', #329, .T.);
|
||||
#457 = ADVANCED_FACE('NONE', (#456), #417, .T.);
|
||||
#458 = FACE_OUTER_BOUND('NONE', #334, .T.);
|
||||
#459 = ADVANCED_FACE('NONE', (#458), #421, .T.);
|
||||
#460 = FACE_OUTER_BOUND('NONE', #339, .T.);
|
||||
#461 = ADVANCED_FACE('NONE', (#460), #425, .T.);
|
||||
#462 = FACE_OUTER_BOUND('NONE', #354, .T.);
|
||||
#463 = ADVANCED_FACE('NONE', (#462), #429, .F.);
|
||||
#464 = FACE_OUTER_BOUND('NONE', #369, .T.);
|
||||
#465 = ADVANCED_FACE('NONE', (#464), #433, .T.);
|
||||
#466 = CLOSED_SHELL('NONE', (#435, #437, #439, #441, #443, #445, #447, #449, #451, #453, #455, #457, #459, #461, #463, #465));
|
||||
#467 = ORIENTED_CLOSED_SHELL('NONE', *, #466, .T.);
|
||||
#468 = MANIFOLD_SOLID_BREP('NONE', #467);
|
||||
#469 = APPLICATION_CONTEXT('configuration controlled 3D design of mechanical parts and assemblies');
|
||||
#470 = PRODUCT_DEFINITION_CONTEXT('part definition', #469, 'design');
|
||||
#471 = PRODUCT('UNIDENTIFIED_PRODUCT', 'NONE', $, ());
|
||||
#472 = PRODUCT_DEFINITION_FORMATION('', $, #471);
|
||||
#473 = PRODUCT_DEFINITION('design', $, #472, #470);
|
||||
#474 = PRODUCT_DEFINITION_SHAPE('NONE', $, #473);
|
||||
#475 = ADVANCED_BREP_SHAPE_REPRESENTATION('NONE', (#468), #3);
|
||||
#476 = SHAPE_DEFINITION_REPRESENTATION(#474, #475);
|
||||
ENDSEC;
|
||||
END-ISO-10303-21;
|
478
e2e/playwright/export-snapshots/stl-ascii.stl
Normal file
478
e2e/playwright/export-snapshots/stl-ascii.stl
Normal file
@ -0,0 +1,478 @@
|
||||
solid unnamed
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex 0 -4 0
|
||||
vertex 0 -0 0
|
||||
vertex 0 -4 -1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex 0 -4 -1
|
||||
vertex 0 -0 0
|
||||
vertex 0 -0 -1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 0 -4 -1
|
||||
vertex 0 -0 -1
|
||||
vertex 3.0950184 -4 -1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 3.0950184 -4 -1
|
||||
vertex 0 -0 -1
|
||||
vertex 3.0950184 -0 -1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.57357645 0 -0.81915206
|
||||
outer loop
|
||||
vertex 3.0950184 -4 -1
|
||||
vertex 3.0950184 -0 -1
|
||||
vertex 5.9513144 -4 -3
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.57357645 0 -0.81915206
|
||||
outer loop
|
||||
vertex 5.9513144 -4 -3
|
||||
vertex 3.0950184 -0 -1
|
||||
vertex 5.9513144 -0 -3
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 5.9513144 -4 -3
|
||||
vertex 5.9513144 -0 -3
|
||||
vertex 9.5 -4 -3
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 9.5 -4 -3
|
||||
vertex 5.9513144 -0 -3
|
||||
vertex 9.5 -0 -3
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex 9.5 -4 -3
|
||||
vertex 9.5 -0 -3
|
||||
vertex 9.5 -4 -2.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 -0 0
|
||||
outer loop
|
||||
vertex 9.5 -4 -2.5
|
||||
vertex 9.5 -0 -3
|
||||
vertex 9.5 -0 -2.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -0 0.99999994
|
||||
outer loop
|
||||
vertex 9.5 -4 -2.5
|
||||
vertex 9.5 -0 -2.5
|
||||
vertex 6.108964 -4 -2.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 0.99999994
|
||||
outer loop
|
||||
vertex 6.108964 -4 -2.5
|
||||
vertex 9.5 -0 -2.5
|
||||
vertex 6.108964 -0 -2.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.5735763 0 0.8191522
|
||||
outer loop
|
||||
vertex 3.4311862 -4 -0.625
|
||||
vertex 4.323779 -4 -1.25
|
||||
vertex 4.323779 -0 -1.25
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.57357645 0 0.819152
|
||||
outer loop
|
||||
vertex 4.323779 -4 -1.25
|
||||
vertex 6.108964 -4 -2.5
|
||||
vertex 6.108964 -0 -2.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.57357645 0 0.819152
|
||||
outer loop
|
||||
vertex 3.4311862 -0 -0.625
|
||||
vertex 2.5385938 -0 0
|
||||
vertex 2.5385938 -4 0
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.57357645 -0 0.819152
|
||||
outer loop
|
||||
vertex 3.4311862 -4 -0.625
|
||||
vertex 3.4311862 -0 -0.625
|
||||
vertex 2.5385938 -4 0
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.57357645 -0 0.819152
|
||||
outer loop
|
||||
vertex 4.323779 -4 -1.25
|
||||
vertex 6.108964 -0 -2.5
|
||||
vertex 4.323779 -0 -1.25
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.5735763 0 0.8191522
|
||||
outer loop
|
||||
vertex 3.4311862 -0 -0.625
|
||||
vertex 3.4311862 -4 -0.625
|
||||
vertex 4.323779 -0 -1.25
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.42261824 0 -0.9063078
|
||||
outer loop
|
||||
vertex 3.342784 -4 0.375
|
||||
vertex 2.5385938 -4 0
|
||||
vertex 2.5385938 -0 0
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.42261824 0 -0.9063078
|
||||
outer loop
|
||||
vertex 4.146974 -4 0.75
|
||||
vertex 3.342784 -4 0.375
|
||||
vertex 3.342784 -0 0.375
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.42261824 0 -0.9063078
|
||||
outer loop
|
||||
vertex 3.342784 -0 0.375
|
||||
vertex 4.146974 -0 0.75
|
||||
vertex 4.146974 -4 0.75
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.42261833 0 -0.90630776
|
||||
outer loop
|
||||
vertex 4.146974 -0 0.75
|
||||
vertex 5.755354 -0 1.5
|
||||
vertex 5.755354 -4 1.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.42261824 0 -0.9063078
|
||||
outer loop
|
||||
vertex 3.342784 -4 0.375
|
||||
vertex 2.5385938 -0 0
|
||||
vertex 3.342784 -0 0.375
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.42261833 0 -0.90630776
|
||||
outer loop
|
||||
vertex 5.755354 -4 1.5
|
||||
vertex 4.146974 -4 0.75
|
||||
vertex 4.146974 -0 0.75
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 5.755354 -4 1.5
|
||||
vertex 5.755354 -0 1.5
|
||||
vertex 9.5 -4 1.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 9.5 -4 1.5
|
||||
vertex 5.755354 -0 1.5
|
||||
vertex 9.5 -0 1.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex 9.5 -4 1.5
|
||||
vertex 9.5 -0 1.5
|
||||
vertex 9.5 -4 2
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 -0 0
|
||||
outer loop
|
||||
vertex 9.5 -4 2
|
||||
vertex 9.5 -0 1.5
|
||||
vertex 9.5 -0 2
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -0 1
|
||||
outer loop
|
||||
vertex 9.5 -4 2
|
||||
vertex 9.5 -0 2
|
||||
vertex 5.644507 -4 2
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 1
|
||||
outer loop
|
||||
vertex 5.644507 -4 2
|
||||
vertex 9.5 -0 2
|
||||
vertex 5.644507 -0 2
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.42261824 0 0.90630776
|
||||
outer loop
|
||||
vertex 5.644507 -4 2
|
||||
vertex 5.644507 -0 2
|
||||
vertex 3.5 -4 1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.42261824 0 0.90630776
|
||||
outer loop
|
||||
vertex 3.5 -4 1
|
||||
vertex 5.644507 -0 2
|
||||
vertex 3.5 -0 1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -0 1
|
||||
outer loop
|
||||
vertex 3.5 -4 1
|
||||
vertex 3.5 -0 1
|
||||
vertex 0 -4 1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 1
|
||||
outer loop
|
||||
vertex 0 -4 1
|
||||
vertex 3.5 -0 1
|
||||
vertex 0 -0 1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex 0 -4 1
|
||||
vertex 0 -0 1
|
||||
vertex 0 -4 0
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex 0 -4 0
|
||||
vertex 0 -0 1
|
||||
vertex 0 -0 0
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 -0
|
||||
outer loop
|
||||
vertex 3.342784 -0 0.375
|
||||
vertex 2.5385938 -0 0
|
||||
vertex 3.5 -0 1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 3.4311862 -0 -0.625
|
||||
vertex 4.323779 -0 -1.25
|
||||
vertex 3.0950184 -0 -1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 3.342784 -0 0.375
|
||||
vertex 3.5 -0 1
|
||||
vertex 4.146974 -0 0.75
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0.99999994 0
|
||||
outer loop
|
||||
vertex 4.323779 -0 -1.25
|
||||
vertex 5.9513144 -0 -3
|
||||
vertex 3.0950184 -0 -1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 0 -0 -1
|
||||
vertex 2.5385938 -0 0
|
||||
vertex 3.0950184 -0 -1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 0 -0 -1
|
||||
vertex 0 -0 0
|
||||
vertex 2.5385938 -0 0
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0.99999994 -0
|
||||
outer loop
|
||||
vertex 9.5 -0 -3
|
||||
vertex 6.108964 -0 -2.5
|
||||
vertex 9.5 -0 -2.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 9.5 -0 -3
|
||||
vertex 5.9513144 -0 -3
|
||||
vertex 6.108964 -0 -2.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 -0
|
||||
outer loop
|
||||
vertex 5.9513144 -0 -3
|
||||
vertex 4.323779 -0 -1.25
|
||||
vertex 6.108964 -0 -2.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 5.644507 -0 2
|
||||
vertex 5.755354 -0 1.5
|
||||
vertex 4.146974 -0 0.75
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0.99999994 -0
|
||||
outer loop
|
||||
vertex 3.0950184 -0 -1
|
||||
vertex 2.5385938 -0 0
|
||||
vertex 3.4311862 -0 -0.625
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 -0
|
||||
outer loop
|
||||
vertex 4.146974 -0 0.75
|
||||
vertex 3.5 -0 1
|
||||
vertex 5.644507 -0 2
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 -0
|
||||
outer loop
|
||||
vertex 9.5 -0 1.5
|
||||
vertex 5.755354 -0 1.5
|
||||
vertex 9.5 -0 2
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 -0
|
||||
outer loop
|
||||
vertex 5.755354 -0 1.5
|
||||
vertex 5.644507 -0 2
|
||||
vertex 9.5 -0 2
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 2.5385938 -0 0
|
||||
vertex 0 -0 0
|
||||
vertex 0 -0 1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 3.5 -0 1
|
||||
vertex 2.5385938 -0 0
|
||||
vertex 0 -0 1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 -1 0
|
||||
outer loop
|
||||
vertex 3.342784 -4 0.375
|
||||
vertex 3.5 -4 1
|
||||
vertex 2.5385938 -4 0
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 -1 0
|
||||
outer loop
|
||||
vertex 4.146974 -4 0.75
|
||||
vertex 3.5 -4 1
|
||||
vertex 3.342784 -4 0.375
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 -0
|
||||
outer loop
|
||||
vertex 3.4311862 -4 -0.625
|
||||
vertex 3.0950184 -4 -1
|
||||
vertex 4.323779 -4 -1.25
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -0.99999994 0
|
||||
outer loop
|
||||
vertex 4.146974 -4 0.75
|
||||
vertex 5.755354 -4 1.5
|
||||
vertex 5.644507 -4 2
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex 0 -4 1
|
||||
vertex 2.5385938 -4 0
|
||||
vertex 3.5 -4 1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex 0 -4 1
|
||||
vertex 0 -4 0
|
||||
vertex 2.5385938 -4 0
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex 5.644507 -4 2
|
||||
vertex 5.755354 -4 1.5
|
||||
vertex 9.5 -4 2
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 -0
|
||||
outer loop
|
||||
vertex 9.5 -4 2
|
||||
vertex 5.755354 -4 1.5
|
||||
vertex 9.5 -4 1.5
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex 4.146974 -4 0.75
|
||||
vertex 5.644507 -4 2
|
||||
vertex 3.5 -4 1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -0.99999994 0
|
||||
outer loop
|
||||
vertex 2.5385938 -4 0
|
||||
vertex 3.0950184 -4 -1
|
||||
vertex 3.4311862 -4 -0.625
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 -0.99999994 -0
|
||||
outer loop
|
||||
vertex 4.323779 -4 -1.25
|
||||
vertex 3.0950184 -4 -1
|
||||
vertex 5.9513144 -4 -3
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 -1 0
|
||||
outer loop
|
||||
vertex 6.108964 -4 -2.5
|
||||
vertex 4.323779 -4 -1.25
|
||||
vertex 5.9513144 -4 -3
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 -0.99999994 -0
|
||||
outer loop
|
||||
vertex 9.5 -4 -2.5
|
||||
vertex 6.108964 -4 -2.5
|
||||
vertex 9.5 -4 -3
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 -0
|
||||
outer loop
|
||||
vertex 6.108964 -4 -2.5
|
||||
vertex 5.9513144 -4 -3
|
||||
vertex 9.5 -4 -3
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 -0
|
||||
outer loop
|
||||
vertex 2.5385938 -4 0
|
||||
vertex 0 -4 -1
|
||||
vertex 3.0950184 -4 -1
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex 0 -4 -1
|
||||
vertex 2.5385938 -4 0
|
||||
vertex 0 -4 0
|
||||
endloop
|
||||
endfacet
|
||||
endsolid unnamed
|
BIN
e2e/playwright/export-snapshots/stl-binary.stl
Normal file
BIN
e2e/playwright/export-snapshots/stl-binary.stl
Normal file
Binary file not shown.
615
e2e/playwright/flow-tests.spec.ts
Normal file
615
e2e/playwright/flow-tests.spec.ts
Normal file
@ -0,0 +1,615 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
import { secrets } from './secrets'
|
||||
import { EngineCommand } from '../../src/lang/std/engineConnection'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { getUtils } from './test-utils'
|
||||
import waitOn from 'wait-on'
|
||||
import { Models } from '@kittycad/lib'
|
||||
import fsp from 'fs/promises'
|
||||
|
||||
/*
|
||||
debug helper: unfortunately we do rely on exact coord mouse clicks in a few places
|
||||
just from the nature of the stream, running the test with debugger and pasting the below
|
||||
into the console can be useful to get coords
|
||||
|
||||
document.addEventListener('mousemove', (e) =>
|
||||
console.log(`await page.mouse.click(${e.clientX}, ${e.clientY})`)
|
||||
)
|
||||
*/
|
||||
|
||||
test.beforeEach(async ({ context, page }) => {
|
||||
// wait for Vite preview server to be up
|
||||
await waitOn({
|
||||
resources: ['tcp:3000'],
|
||||
timeout: 5000,
|
||||
})
|
||||
await context.addInitScript(async (token) => {
|
||||
localStorage.setItem('TOKEN_PERSIST_KEY', token)
|
||||
localStorage.setItem('persistCode', ``)
|
||||
localStorage.setItem(
|
||||
'SETTINGS_PERSIST_KEY',
|
||||
JSON.stringify({
|
||||
baseUnit: 'in',
|
||||
cameraControls: 'KittyCAD',
|
||||
defaultDirectory: '',
|
||||
defaultProjectName: 'project-$nnn',
|
||||
onboardingStatus: 'dismissed',
|
||||
showDebugPanel: true,
|
||||
textWrapping: 'On',
|
||||
theme: 'system',
|
||||
unitSystem: 'imperial',
|
||||
})
|
||||
)
|
||||
}, secrets.token)
|
||||
// kill animations, speeds up tests and reduced flakiness
|
||||
await page.emulateMedia({ reducedMotion: 'reduce' })
|
||||
})
|
||||
|
||||
test.setTimeout(60000)
|
||||
|
||||
test('Basic sketch', async ({ page }) => {
|
||||
const u = getUtils(page)
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
const PUR = 400 / 37.5 //pixeltoUnitRatio
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await u.openDebugPanel()
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
|
||||
await expect(page.getByRole('button', { name: 'Start Sketch' })).toBeVisible()
|
||||
|
||||
// click on "Start Sketch" button
|
||||
await u.clearCommandLogs()
|
||||
await Promise.all([
|
||||
u.doAndWaitForImageDiff(
|
||||
() => page.getByRole('button', { name: 'Start Sketch' }).click(),
|
||||
200
|
||||
),
|
||||
u.waitForDefaultPlanesVisibilityChange(),
|
||||
])
|
||||
|
||||
// select a plane
|
||||
await u.doAndWaitForCmd(() => page.mouse.click(700, 200), 'edit_mode_enter')
|
||||
await u.waitForCmdReceive('set_tool')
|
||||
|
||||
await u.doAndWaitForCmd(
|
||||
() => page.getByRole('button', { name: 'Line' }).click(),
|
||||
'set_tool'
|
||||
)
|
||||
|
||||
const startXPx = 600
|
||||
await u.doAndWaitForCmd(
|
||||
() => page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10),
|
||||
'mouse_click',
|
||||
false
|
||||
)
|
||||
|
||||
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
|
||||
|
||||
const startAt = '[10.97, -14.79]'
|
||||
const tenish = '11.07'
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('-XZ')
|
||||
|> startProfileAt(${startAt}, %)
|
||||
|> line([${tenish}, 0], %)`)
|
||||
|
||||
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('-XZ')
|
||||
|> startProfileAt(${startAt}, %)
|
||||
|> line([${tenish}, 0], %)
|
||||
|> line([0, ${tenish}], %)`)
|
||||
await page.mouse.click(startXPx, 500 - PUR * 20)
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('-XZ')
|
||||
|> startProfileAt(${startAt}, %)
|
||||
|> line([${tenish}, 0], %)
|
||||
|> line([0, ${tenish}], %)
|
||||
|> line([-22.04, 0], %)`)
|
||||
|
||||
// deselect line tool
|
||||
await u.doAndWaitForCmd(
|
||||
() => page.getByRole('button', { name: 'Line' }).click(),
|
||||
'set_tool'
|
||||
)
|
||||
|
||||
// click between first two clicks to get center of the line
|
||||
await u.doAndWaitForCmd(
|
||||
() => page.mouse.click(startXPx + PUR * 15, 500 - PUR * 10),
|
||||
'select_with_point'
|
||||
)
|
||||
await u.closeDebugPanel()
|
||||
|
||||
// hold down shift
|
||||
await page.keyboard.down('Shift')
|
||||
// click between the latest two clicks to get center of the line
|
||||
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 20)
|
||||
|
||||
// selected two lines therefore there should be two cursors
|
||||
await expect(page.locator('.cm-cursor')).toHaveCount(2)
|
||||
|
||||
await page.getByRole('button', { name: 'Equal Length' }).click()
|
||||
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('-XZ')
|
||||
|> startProfileAt(${startAt}, %)
|
||||
|> line({ to: [${tenish}, 0], tag: 'seg01' }, %)
|
||||
|> line([0, ${tenish}], %)
|
||||
|> angledLine([180, segLen('seg01', %)], %)`)
|
||||
})
|
||||
|
||||
test('if you write invalid kcl you get inlined errors', async ({ page }) => {
|
||||
const u = getUtils(page)
|
||||
await page.setViewportSize({ width: 1000, height: 500 })
|
||||
await page.goto('/')
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
// check no error to begin with
|
||||
await expect(page.locator('.cm-lint-marker-error')).not.toBeVisible()
|
||||
|
||||
/* add the following code to the editor (# error is not a valid line)
|
||||
# error
|
||||
const topAng = 30
|
||||
const bottomAng = 25
|
||||
*/
|
||||
await page.click('.cm-content')
|
||||
await page.keyboard.type('# error')
|
||||
|
||||
// press arrows to clear autocomplete
|
||||
await page.keyboard.press('ArrowLeft')
|
||||
await page.keyboard.press('ArrowRight')
|
||||
|
||||
await page.keyboard.press('Enter')
|
||||
await page.keyboard.type('const topAng = 30')
|
||||
await page.keyboard.press('Enter')
|
||||
await page.keyboard.type('const bottomAng = 25')
|
||||
await page.keyboard.press('Enter')
|
||||
|
||||
// error in guter
|
||||
await expect(page.locator('.cm-lint-marker-error')).toBeVisible()
|
||||
|
||||
// error text on hover
|
||||
await page.hover('.cm-lint-marker-error')
|
||||
await expect(page.getByText("found unknown token '#'")).toBeVisible()
|
||||
|
||||
// select the line that's causing the error and delete it
|
||||
await page.getByText('# error').click()
|
||||
await page.keyboard.press('End')
|
||||
await page.keyboard.down('Shift')
|
||||
await page.keyboard.press('Home')
|
||||
await page.keyboard.up('Shift')
|
||||
await page.keyboard.press('Backspace')
|
||||
|
||||
// wait for .cm-lint-marker-error not to be visible
|
||||
await expect(page.locator('.cm-lint-marker-error')).not.toBeVisible()
|
||||
})
|
||||
|
||||
test('executes on load', async ({ page, context }) => {
|
||||
const u = getUtils(page)
|
||||
await context.addInitScript(async (token) => {
|
||||
localStorage.setItem(
|
||||
'persistCode',
|
||||
`const part001 = startSketchOn('-XZ')
|
||||
|> startProfileAt([-6.95, 4.98], %)
|
||||
|> line([25.1, 0.41], %)
|
||||
|> line([0.73, -14.93], %)
|
||||
|> line([-23.44, 0.52], %)`
|
||||
)
|
||||
})
|
||||
await page.setViewportSize({ width: 1000, height: 500 })
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
// expand variables section
|
||||
await page.getByText('Variables').click()
|
||||
|
||||
// can find part001 in the variables summary (pretty-json-container, makes sure we're not looking in the code editor)
|
||||
// part001 only shows up in the variables summary if it's been executed
|
||||
await page.waitForFunction(() => {
|
||||
const variablesElement = document.querySelector(
|
||||
'.pretty-json-container'
|
||||
) as HTMLDivElement
|
||||
return variablesElement.innerHTML.includes('part001')
|
||||
})
|
||||
await expect(
|
||||
page.locator('.pretty-json-container >> text=part001')
|
||||
).toBeVisible()
|
||||
})
|
||||
|
||||
test('re-executes', async ({ page, context }) => {
|
||||
const u = getUtils(page)
|
||||
await context.addInitScript(async (token) => {
|
||||
localStorage.setItem('persistCode', `const myVar = 5`)
|
||||
})
|
||||
await page.setViewportSize({ width: 1000, height: 500 })
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
await page.getByText('Variables').click()
|
||||
// expect to see "myVar:5"
|
||||
await expect(
|
||||
page.locator('.pretty-json-container >> text=myVar:5')
|
||||
).toBeVisible()
|
||||
|
||||
// change 5 to 67
|
||||
await page.getByText('const myVar').click()
|
||||
await page.keyboard.press('End')
|
||||
await page.keyboard.press('Backspace')
|
||||
await page.keyboard.type('67')
|
||||
|
||||
await expect(
|
||||
page.locator('.pretty-json-container >> text=myVar:67')
|
||||
).toBeVisible()
|
||||
})
|
||||
|
||||
test('Can create sketches on all planes and their back sides', async ({
|
||||
page,
|
||||
}) => {
|
||||
const u = getUtils(page)
|
||||
const PUR = 400 / 37.5 //pixeltoUnitRatio
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await u.openDebugPanel()
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
|
||||
const camCmd: EngineCommand = {
|
||||
type: 'modeling_cmd_req',
|
||||
cmd_id: uuidv4(),
|
||||
cmd: {
|
||||
type: 'default_camera_look_at',
|
||||
center: { x: 15, y: 0, z: 0 },
|
||||
up: { x: 0, y: 0, z: 1 },
|
||||
vantage: { x: 30, y: 30, z: 30 },
|
||||
},
|
||||
}
|
||||
|
||||
const TestSinglePlane = async ({
|
||||
viewCmd,
|
||||
expectedCode,
|
||||
clickCoords,
|
||||
}: {
|
||||
viewCmd: EngineCommand
|
||||
expectedCode: string
|
||||
clickCoords: { x: number; y: number }
|
||||
}) => {
|
||||
await u.openDebugPanel()
|
||||
await u.sendCustomCmd(viewCmd)
|
||||
await u.clearCommandLogs()
|
||||
// await page.waitForTimeout(200)
|
||||
await page.getByRole('button', { name: 'Start Sketch' }).click()
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
|
||||
await u.closeDebugPanel()
|
||||
await page.mouse.click(clickCoords.x, clickCoords.y)
|
||||
await u.openDebugPanel()
|
||||
|
||||
await expect(page.getByRole('button', { name: 'Line' })).toBeVisible()
|
||||
|
||||
// draw a line
|
||||
const startXPx = 600
|
||||
await u.clearCommandLogs()
|
||||
await page.getByRole('button', { name: 'Line' }).click()
|
||||
await u.waitForCmdReceive('set_tool')
|
||||
await u.clearCommandLogs()
|
||||
await u.closeDebugPanel()
|
||||
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
|
||||
await u.openDebugPanel()
|
||||
await u.waitForCmdReceive('mouse_click')
|
||||
await u.closeDebugPanel()
|
||||
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
|
||||
await u.openDebugPanel()
|
||||
|
||||
await expect(page.locator('.cm-content')).toHaveText(expectedCode)
|
||||
|
||||
await page.getByRole('button', { name: 'Line' }).click()
|
||||
await u.clearCommandLogs()
|
||||
await page.getByRole('button', { name: 'Exit Sketch' }).click()
|
||||
await u.expectCmdLog('[data-message-type="execution-done"]')
|
||||
|
||||
await u.clearCommandLogs()
|
||||
await u.removeCurrentCode()
|
||||
}
|
||||
|
||||
const codeTemplate = (
|
||||
plane = 'XY',
|
||||
sign = ''
|
||||
) => `const part001 = startSketchOn('${plane}')
|
||||
|> startProfileAt([${sign}6.88, -9.29], %)
|
||||
|> line([${sign}6.95, 0], %)`
|
||||
await TestSinglePlane({
|
||||
viewCmd: camCmd,
|
||||
expectedCode: codeTemplate('XY'),
|
||||
clickCoords: { x: 700, y: 350 }, // red plane
|
||||
})
|
||||
await TestSinglePlane({
|
||||
viewCmd: camCmd,
|
||||
expectedCode: codeTemplate('YZ'),
|
||||
clickCoords: { x: 1000, y: 200 }, // green plane
|
||||
})
|
||||
await TestSinglePlane({
|
||||
viewCmd: camCmd,
|
||||
expectedCode: codeTemplate('XZ', '-'),
|
||||
clickCoords: { x: 630, y: 130 }, // blue plane
|
||||
})
|
||||
|
||||
// new camera angle to click the back side of all three planes
|
||||
const camCmdBackSide: EngineCommand = {
|
||||
type: 'modeling_cmd_req',
|
||||
cmd_id: uuidv4(),
|
||||
cmd: {
|
||||
type: 'default_camera_look_at',
|
||||
center: { x: -15, y: 0, z: 0 },
|
||||
up: { x: 0, y: 0, z: 1 },
|
||||
vantage: { x: -30, y: -30, z: -30 },
|
||||
},
|
||||
}
|
||||
await TestSinglePlane({
|
||||
viewCmd: camCmdBackSide,
|
||||
expectedCode: codeTemplate('-XY', '-'),
|
||||
clickCoords: { x: 705, y: 136 }, // back of red plane
|
||||
})
|
||||
await TestSinglePlane({
|
||||
viewCmd: camCmdBackSide,
|
||||
expectedCode: codeTemplate('-YZ', '-'),
|
||||
clickCoords: { x: 1000, y: 350 }, // back of green plane
|
||||
})
|
||||
await TestSinglePlane({
|
||||
viewCmd: camCmdBackSide,
|
||||
expectedCode: codeTemplate('-XZ'),
|
||||
clickCoords: { x: 600, y: 400 }, // back of blue plane
|
||||
})
|
||||
})
|
||||
|
||||
test('Auto complete works', async ({ page }) => {
|
||||
const u = getUtils(page)
|
||||
// const PUR = 400 / 37.5 //pixeltoUnitRatio
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
|
||||
// this test might be brittle as we add and remove functions
|
||||
// but should also be easy to update.
|
||||
// tests clicking on an option, selection the first option
|
||||
// and arrowing down to an option
|
||||
|
||||
await page.click('.cm-content')
|
||||
await page.keyboard.type('const part001 = start')
|
||||
|
||||
// expect there to be three auto complete options
|
||||
await expect(page.locator('.cm-completionLabel')).toHaveCount(3)
|
||||
await page.getByText('startSketchOn').click()
|
||||
await page.keyboard.type("('XY')")
|
||||
await page.keyboard.press('Enter')
|
||||
await page.keyboard.type(' |> startProfi')
|
||||
// expect there be a single auto complete option that we can just hit enter on
|
||||
await expect(page.locator('.cm-completionLabel')).toBeVisible()
|
||||
await page.keyboard.press('Enter') // accepting the auto complete, not a new line
|
||||
|
||||
await page.keyboard.type('([0,0], %)')
|
||||
await page.keyboard.press('Enter')
|
||||
await page.keyboard.type(' |> lin')
|
||||
|
||||
await expect(page.locator('.cm-tooltip-autocomplete')).toBeVisible()
|
||||
// press arrow down twice then enter to accept xLine
|
||||
await page.keyboard.press('ArrowDown')
|
||||
await page.keyboard.press('ArrowDown')
|
||||
await page.keyboard.press('Enter')
|
||||
await page.keyboard.type('(5, %)')
|
||||
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('XY')
|
||||
|> startProfileAt([0,0], %)
|
||||
|> xLine(5, %)`)
|
||||
})
|
||||
|
||||
// Onboarding tests
|
||||
test('Onboarding redirects and code updating', async ({ page, context }) => {
|
||||
const u = getUtils(page)
|
||||
|
||||
// Override beforeEach test setup
|
||||
await context.addInitScript(async () => {
|
||||
// Give some initial code, so we can test that it's cleared
|
||||
localStorage.setItem('persistCode', 'const sigmaAllow = 15000')
|
||||
|
||||
const storedSettings = JSON.parse(
|
||||
localStorage.getItem('SETTINGS_PERSIST_KEY') || '{}'
|
||||
)
|
||||
storedSettings.onboardingStatus = '/export'
|
||||
localStorage.setItem('SETTINGS_PERSIST_KEY', JSON.stringify(storedSettings))
|
||||
})
|
||||
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
// Test that the redirect happened
|
||||
await expect(page.url().split(':3000').slice(-1)[0]).toBe(
|
||||
`/file/new/onboarding/export`
|
||||
)
|
||||
|
||||
// Test that you come back to this page when you refresh
|
||||
await page.reload()
|
||||
await expect(page.url().split(':3000').slice(-1)[0]).toBe(
|
||||
`/file/new/onboarding/export`
|
||||
)
|
||||
|
||||
// Test that the onboarding pane loaded
|
||||
const title = page.locator('[data-testid="onboarding-content"]')
|
||||
await expect(title).toBeAttached()
|
||||
|
||||
// Test that the code changes when you advance to the next step
|
||||
await page.locator('[data-testid="onboarding-next"]').click()
|
||||
await expect(page.locator('.cm-content')).toHaveText('')
|
||||
|
||||
// Test that the code is not empty when you click on the next step
|
||||
await page.locator('[data-testid="onboarding-next"]').click()
|
||||
await expect(page.locator('.cm-content')).toHaveText(/.+/)
|
||||
})
|
||||
|
||||
test('Selections work on fresh and edited sketch', async ({ page }) => {
|
||||
// tests mapping works on fresh sketch and edited sketch
|
||||
// tests using hovers which is the same as selections, because if
|
||||
// source ranges are wrong, hovers won't work
|
||||
const u = getUtils(page)
|
||||
const PUR = 400 / 37.5 //pixeltoUnitRatio
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await u.openDebugPanel()
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
|
||||
const xAxisClick = () => page.mouse.click(700, 250)
|
||||
const emptySpaceClick = () => page.mouse.click(700, 300)
|
||||
const topHorzSegmentClick = () => page.mouse.click(700, 285)
|
||||
const bottomHorzSegmentClick = () => page.mouse.click(750, 393)
|
||||
|
||||
await u.clearCommandLogs()
|
||||
await page.getByRole('button', { name: 'Start Sketch' }).click()
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
|
||||
// select a plane
|
||||
await u.doAndWaitForCmd(() => page.mouse.click(700, 200), 'edit_mode_enter')
|
||||
await u.waitForCmdReceive('set_tool')
|
||||
|
||||
await u.doAndWaitForCmd(
|
||||
() => page.getByRole('button', { name: 'Line' }).click(),
|
||||
'set_tool'
|
||||
)
|
||||
|
||||
const startXPx = 600
|
||||
await u.doAndWaitForCmd(
|
||||
() => page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10),
|
||||
'mouse_click',
|
||||
false
|
||||
)
|
||||
|
||||
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
|
||||
|
||||
const startAt = '[10.97, -14.79]'
|
||||
const tenish = '11.07'
|
||||
const twentyish = '22.04'
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('-XZ')
|
||||
|> startProfileAt(${startAt}, %)
|
||||
|> line([${tenish}, 0], %)`)
|
||||
|
||||
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('-XZ')
|
||||
|> startProfileAt(${startAt}, %)
|
||||
|> line([${tenish}, 0], %)
|
||||
|> line([0, ${tenish}], %)`)
|
||||
await page.mouse.click(startXPx, 500 - PUR * 20)
|
||||
await expect(page.locator('.cm-content'))
|
||||
.toHaveText(`const part001 = startSketchOn('-XZ')
|
||||
|> startProfileAt(${startAt}, %)
|
||||
|> line([${tenish}, 0], %)
|
||||
|> line([0, ${tenish}], %)
|
||||
|> line([-${twentyish}, 0], %)`)
|
||||
|
||||
// deselect line tool
|
||||
await u.doAndWaitForCmd(
|
||||
() => page.getByRole('button', { name: 'Line' }).click(),
|
||||
'set_tool'
|
||||
)
|
||||
|
||||
await u.closeDebugPanel()
|
||||
const selectionSequence = async () => {
|
||||
await expect(page.getByTestId('hover-highlight')).not.toBeVisible()
|
||||
|
||||
await page.mouse.move(startXPx + PUR * 15, 500 - PUR * 10)
|
||||
|
||||
await expect(page.getByTestId('hover-highlight')).toBeVisible()
|
||||
// bg-yellow-200 is more brittle than hover-highlight, but is closer to the user experience
|
||||
// and will be an easy fix if it breaks because we change the colour
|
||||
await expect(page.locator('.bg-yellow-200')).toBeVisible()
|
||||
|
||||
// check mousing off, than mousing onto another line
|
||||
await page.mouse.move(startXPx + PUR * 10, 500 - PUR * 15) // mouse off
|
||||
await expect(page.getByTestId('hover-highlight')).not.toBeVisible()
|
||||
await page.mouse.move(startXPx + PUR * 10, 500 - PUR * 20) // mouse onto another line
|
||||
await expect(page.getByTestId('hover-highlight')).toBeVisible()
|
||||
|
||||
// now check clicking works including axis
|
||||
|
||||
// click a segment hold shift and click an axis, see that a relevant constraint is enabled
|
||||
await u.doAndWaitForCmd(topHorzSegmentClick, 'select_with_point', false)
|
||||
await page.keyboard.down('Shift')
|
||||
const absYButton = page.getByRole('button', { name: 'ABS Y' })
|
||||
await expect(absYButton).toBeDisabled()
|
||||
await u.doAndWaitForCmd(xAxisClick, 'select_with_point', false)
|
||||
await page.keyboard.up('Shift')
|
||||
await absYButton.and(page.locator(':not([disabled])')).waitFor()
|
||||
await expect(absYButton).not.toBeDisabled()
|
||||
|
||||
// clear selection by clicking on nothing
|
||||
await u.doAndWaitForCmd(emptySpaceClick, 'select_clear', false)
|
||||
|
||||
// same selection but click the axis first
|
||||
await u.doAndWaitForCmd(xAxisClick, 'select_with_point', false)
|
||||
await expect(absYButton).toBeDisabled()
|
||||
await page.keyboard.down('Shift')
|
||||
await u.doAndWaitForCmd(topHorzSegmentClick, 'select_with_point', false)
|
||||
await page.keyboard.up('Shift')
|
||||
await expect(absYButton).not.toBeDisabled()
|
||||
|
||||
// clear selection by clicking on nothing
|
||||
await u.doAndWaitForCmd(emptySpaceClick, 'select_clear', false)
|
||||
|
||||
// check the same selection again by putting cursor in code first then selecting axis
|
||||
await u.doAndWaitForCmd(
|
||||
() => page.getByText(` |> line([-${twentyish}, 0], %)`).click(),
|
||||
'select_clear',
|
||||
false
|
||||
)
|
||||
await page.keyboard.down('Shift')
|
||||
await expect(absYButton).toBeDisabled()
|
||||
await u.doAndWaitForCmd(xAxisClick, 'select_with_point', false)
|
||||
await page.keyboard.up('Shift')
|
||||
await expect(absYButton).not.toBeDisabled()
|
||||
|
||||
// clear selection by clicking on nothing
|
||||
await u.doAndWaitForCmd(emptySpaceClick, 'select_clear', false)
|
||||
|
||||
// select segment in editor than another segment in scene and check there are two cursors
|
||||
await u.doAndWaitForCmd(
|
||||
() => page.getByText(` |> line([-${twentyish}, 0], %)`).click(),
|
||||
'select_clear',
|
||||
false
|
||||
)
|
||||
await page.keyboard.down('Shift')
|
||||
await expect(page.locator('.cm-cursor')).toHaveCount(1)
|
||||
await u.doAndWaitForCmd(bottomHorzSegmentClick, 'select_with_point', false) // another segment, bottom one
|
||||
await page.keyboard.up('Shift')
|
||||
await expect(page.locator('.cm-cursor')).toHaveCount(2)
|
||||
|
||||
// clear selection by clicking on nothing
|
||||
await u.doAndWaitForCmd(emptySpaceClick, 'select_clear', false)
|
||||
}
|
||||
|
||||
await selectionSequence()
|
||||
|
||||
// hovering in fresh sketch worked, lets try exiting and re-entering
|
||||
await u.doAndWaitForCmd(
|
||||
() => page.getByRole('button', { name: 'Exit Sketch' }).click(),
|
||||
'edit_mode_exit'
|
||||
)
|
||||
// wait for execution done
|
||||
await u.expectCmdLog('[data-message-type="execution-done"]')
|
||||
|
||||
// select a line
|
||||
await u.doAndWaitForCmd(topHorzSegmentClick, 'select_clear', false)
|
||||
|
||||
// enter sketch again
|
||||
await u.doAndWaitForCmd(
|
||||
() => page.getByRole('button', { name: 'Start Sketch' }).click(),
|
||||
'edit_mode_enter',
|
||||
false
|
||||
)
|
||||
|
||||
// hover again and check it works
|
||||
await selectionSequence()
|
||||
})
|
20
e2e/playwright/secrets.ts
Normal file
20
e2e/playwright/secrets.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { readFileSync } from 'fs'
|
||||
|
||||
const secrets: Record<string, string> = {}
|
||||
try {
|
||||
const file = readFileSync('./e2e/playwright/playwright-secrets.env', 'utf8')
|
||||
file
|
||||
.split('\n')
|
||||
.filter((line) => line && line.length > 1)
|
||||
.forEach((line) => {
|
||||
const [key, value] = line.split('=')
|
||||
// prefer env vars over secrets file
|
||||
secrets[key] = process.env[key] || (value as any).replaceAll('"', '')
|
||||
})
|
||||
} catch (err) {
|
||||
// probably running in CI
|
||||
secrets.token = process.env.token || ''
|
||||
// add more env vars here to make them available in CI
|
||||
}
|
||||
|
||||
export { secrets }
|
324
e2e/playwright/snapshot-tests.spec.ts
Normal file
324
e2e/playwright/snapshot-tests.spec.ts
Normal file
@ -0,0 +1,324 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
import { secrets } from './secrets'
|
||||
import { EngineCommand } from '../../src/lang/std/engineConnection'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { getUtils } from './test-utils'
|
||||
import { Models } from '@kittycad/lib'
|
||||
import fsp from 'fs/promises'
|
||||
|
||||
test.beforeEach(async ({ context, page }) => {
|
||||
await context.addInitScript(async (token) => {
|
||||
localStorage.setItem('TOKEN_PERSIST_KEY', token)
|
||||
localStorage.setItem('persistCode', ``)
|
||||
localStorage.setItem(
|
||||
'SETTINGS_PERSIST_KEY',
|
||||
JSON.stringify({
|
||||
baseUnit: 'in',
|
||||
cameraControls: 'KittyCAD',
|
||||
defaultDirectory: '',
|
||||
defaultProjectName: 'project-$nnn',
|
||||
onboardingStatus: 'dismissed',
|
||||
showDebugPanel: true,
|
||||
textWrapping: 'On',
|
||||
theme: 'system',
|
||||
unitSystem: 'imperial',
|
||||
})
|
||||
)
|
||||
}, secrets.token)
|
||||
// reducedMotion kills animations, which speeds up tests and reduces flakiness
|
||||
await page.emulateMedia({ reducedMotion: 'reduce' })
|
||||
})
|
||||
|
||||
test.setTimeout(60000)
|
||||
|
||||
test('change camera, show planes', async ({ page, context }) => {
|
||||
const u = getUtils(page)
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await u.openAndClearDebugPanel()
|
||||
|
||||
const camCmd: EngineCommand = {
|
||||
type: 'modeling_cmd_req',
|
||||
cmd_id: uuidv4(),
|
||||
cmd: {
|
||||
type: 'default_camera_look_at',
|
||||
center: { x: 0, y: 0, z: 0 },
|
||||
up: { x: 0, y: 0, z: 1 },
|
||||
vantage: { x: 0, y: 50, z: 50 },
|
||||
},
|
||||
}
|
||||
|
||||
await u.sendCustomCmd(camCmd)
|
||||
await u.waitForCmdReceive('default_camera_look_at')
|
||||
|
||||
// rotate
|
||||
await u.closeDebugPanel()
|
||||
await page.mouse.move(700, 200)
|
||||
await page.mouse.down({ button: 'right' })
|
||||
await page.mouse.move(600, 300)
|
||||
await page.mouse.up({ button: 'right' })
|
||||
|
||||
await u.openDebugPanel()
|
||||
await u.waitForCmdReceive('camera_drag_end')
|
||||
await page.waitForTimeout(500)
|
||||
await u.clearCommandLogs()
|
||||
|
||||
await page.getByRole('button', { name: 'Start Sketch' }).click()
|
||||
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
await u.closeDebugPanel()
|
||||
|
||||
await expect(page).toHaveScreenshot({
|
||||
maxDiffPixels: 100,
|
||||
})
|
||||
|
||||
await u.openAndClearDebugPanel()
|
||||
await page.getByRole('button', { name: 'Exit Sketch' }).click()
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
|
||||
await u.sendCustomCmd(camCmd)
|
||||
await u.waitForCmdReceive('default_camera_look_at')
|
||||
|
||||
await u.clearCommandLogs()
|
||||
await u.closeDebugPanel()
|
||||
// pan
|
||||
await page.keyboard.down('Shift')
|
||||
await page.mouse.move(600, 200)
|
||||
await page.mouse.down({ button: 'right' })
|
||||
await page.mouse.move(700, 200)
|
||||
await page.mouse.up({ button: 'right' })
|
||||
await page.keyboard.up('Shift')
|
||||
|
||||
await u.openDebugPanel()
|
||||
await u.waitForCmdReceive('camera_drag_end')
|
||||
await page.waitForTimeout(300)
|
||||
await u.clearCommandLogs()
|
||||
|
||||
await page.getByRole('button', { name: 'Start Sketch' }).click()
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
await u.closeDebugPanel()
|
||||
|
||||
await expect(page).toHaveScreenshot({
|
||||
maxDiffPixels: 100,
|
||||
})
|
||||
|
||||
await u.openAndClearDebugPanel()
|
||||
await page.getByRole('button', { name: 'Exit Sketch' }).click()
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
|
||||
await u.sendCustomCmd(camCmd)
|
||||
await u.waitForCmdReceive('default_camera_look_at')
|
||||
|
||||
await u.clearCommandLogs()
|
||||
await u.closeDebugPanel()
|
||||
|
||||
// zoom
|
||||
await page.keyboard.down('Control')
|
||||
await page.mouse.move(700, 400)
|
||||
await page.mouse.down({ button: 'right' })
|
||||
await page.mouse.move(700, 350)
|
||||
await page.mouse.up({ button: 'right' })
|
||||
await page.keyboard.up('Control')
|
||||
|
||||
await u.openDebugPanel()
|
||||
await u.waitForCmdReceive('camera_drag_end')
|
||||
await page.waitForTimeout(300)
|
||||
await u.clearCommandLogs()
|
||||
|
||||
await page.getByRole('button', { name: 'Start Sketch' }).click()
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
await u.closeDebugPanel()
|
||||
|
||||
await expect(page).toHaveScreenshot({
|
||||
maxDiffPixels: 100,
|
||||
})
|
||||
})
|
||||
|
||||
test('exports of each format should work', async ({ page, context }) => {
|
||||
// FYI this test doesn't work with only engine running locally
|
||||
const u = getUtils(page)
|
||||
await context.addInitScript(async () => {
|
||||
;(window as any).playwrightSkipFilePicker = true
|
||||
localStorage.setItem(
|
||||
'persistCode',
|
||||
`const topAng = 25
|
||||
const bottomAng = 35
|
||||
const baseLen = 3.5
|
||||
const baseHeight = 1
|
||||
const totalHeightHalf = 2
|
||||
const armThick = 0.5
|
||||
const totalLen = 9.5
|
||||
const part001 = startSketchOn('-XZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> yLine(baseHeight, %)
|
||||
|> xLine(baseLen, %)
|
||||
|> angledLineToY({
|
||||
angle: topAng,
|
||||
to: totalHeightHalf,
|
||||
tag: 'seg04'
|
||||
}, %)
|
||||
|> xLineTo({ to: totalLen, tag: 'seg03' }, %)
|
||||
|> yLine({ length: -armThick, tag: 'seg01' }, %)
|
||||
|> angledLineThatIntersects({
|
||||
angle: _180,
|
||||
offset: -armThick,
|
||||
intersectTag: 'seg04'
|
||||
}, %)
|
||||
|> angledLineToY([segAng('seg04', %) + 180, _0], %)
|
||||
|> angledLineToY({
|
||||
angle: -bottomAng,
|
||||
to: -totalHeightHalf - armThick,
|
||||
tag: 'seg02'
|
||||
}, %)
|
||||
|> xLineTo(segEndX('seg03', %) + 0, %)
|
||||
|> yLine(-segLen('seg01', %), %)
|
||||
|> angledLineThatIntersects({
|
||||
angle: _180,
|
||||
offset: -armThick,
|
||||
intersectTag: 'seg02'
|
||||
}, %)
|
||||
|> angledLineToY([segAng('seg02', %) + 180, -baseHeight], %)
|
||||
|> xLineTo(_0, %)
|
||||
|> close(%)
|
||||
|> extrude(4, %)`
|
||||
)
|
||||
})
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
await page.goto('/')
|
||||
await u.waitForAuthSkipAppStart()
|
||||
await u.openDebugPanel()
|
||||
await u.waitForDefaultPlanesVisibilityChange()
|
||||
await u.expectCmdLog('[data-message-type="execution-done"]')
|
||||
await u.waitForCmdReceive('extrude')
|
||||
await page.waitForTimeout(1000)
|
||||
await u.clearAndCloseDebugPanel()
|
||||
|
||||
await page.getByRole('button', { name: 'KittyCAD Modeling App' }).click()
|
||||
|
||||
const doExport = async (output: Models['OutputFormat_type']) => {
|
||||
await page.getByRole('button', { name: 'Export Model' }).click()
|
||||
|
||||
const exportSelect = page.getByTestId('export-type')
|
||||
await exportSelect.selectOption({ label: output.type })
|
||||
|
||||
if ('storage' in output) {
|
||||
const storageSelect = page.getByTestId('export-storage')
|
||||
await storageSelect.selectOption({ label: output.storage })
|
||||
}
|
||||
|
||||
const downloadPromise = page.waitForEvent('download')
|
||||
await page.getByRole('button', { name: 'Export', exact: true }).click()
|
||||
const download = await downloadPromise
|
||||
const downloadLocationer = (extra = '') =>
|
||||
`./e2e/playwright/export-snapshots/${output.type}-${
|
||||
'storage' in output ? output.storage : ''
|
||||
}${extra}.${output.type}`
|
||||
const downloadLocation = downloadLocationer()
|
||||
const downloadLocation2 = downloadLocationer('-2')
|
||||
|
||||
if (output.type === 'gltf' && output.storage === 'standard') {
|
||||
// wait for second download
|
||||
const download2 = await page.waitForEvent('download')
|
||||
await download.saveAs(downloadLocation)
|
||||
await download2.saveAs(downloadLocation2)
|
||||
|
||||
// rewrite uri to reference our file name
|
||||
const fileContents = await fsp.readFile(downloadLocation, 'utf-8')
|
||||
const isJson = fileContents.includes('buffers')
|
||||
let contents = fileContents
|
||||
let reWriteLocation = downloadLocation
|
||||
let uri = downloadLocation2.split('/').pop()
|
||||
if (!isJson) {
|
||||
contents = await fsp.readFile(downloadLocation2, 'utf-8')
|
||||
reWriteLocation = downloadLocation2
|
||||
uri = downloadLocation.split('/').pop()
|
||||
}
|
||||
contents = contents.replace(/"uri": ".*"/g, `"uri": "${uri}"`)
|
||||
await fsp.writeFile(reWriteLocation, contents)
|
||||
} else {
|
||||
await download.saveAs(downloadLocation)
|
||||
}
|
||||
|
||||
if (output.type === 'step') {
|
||||
// stable timestamps for step files
|
||||
const fileContents = await fsp.readFile(downloadLocation, 'utf-8')
|
||||
const newFileContents = fileContents.replace(
|
||||
/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+[0-9]+[0-9]\+[0-9]{2}:[0-9]{2}/g,
|
||||
'1970-01-01T00:00:00.0+00:00'
|
||||
)
|
||||
await fsp.writeFile(downloadLocation, newFileContents)
|
||||
}
|
||||
}
|
||||
const axisDirectionPair: Models['AxisDirectionPair_type'] = {
|
||||
axis: 'z',
|
||||
direction: 'positive',
|
||||
}
|
||||
const sysType: Models['System_type'] = {
|
||||
forward: axisDirectionPair,
|
||||
up: axisDirectionPair,
|
||||
}
|
||||
// NOTE it was easiest to leverage existing types and have doExport take Models['OutputFormat_type'] as in input
|
||||
// just note that only `type` and `storage` are used for selecting the drop downs is the app
|
||||
// the rest are only there to make typescript happy
|
||||
await doExport({
|
||||
type: 'step',
|
||||
coords: sysType,
|
||||
})
|
||||
await doExport({
|
||||
type: 'gltf',
|
||||
storage: 'embedded',
|
||||
presentation: 'pretty',
|
||||
})
|
||||
await doExport({
|
||||
type: 'gltf',
|
||||
storage: 'binary',
|
||||
presentation: 'pretty',
|
||||
})
|
||||
await doExport({
|
||||
type: 'gltf',
|
||||
storage: 'standard',
|
||||
presentation: 'pretty',
|
||||
})
|
||||
await doExport({
|
||||
type: 'ply',
|
||||
coords: sysType,
|
||||
selection: { type: 'default_scene' },
|
||||
storage: 'ascii',
|
||||
units: 'in',
|
||||
})
|
||||
await doExport({
|
||||
type: 'ply',
|
||||
storage: 'binary_little_endian',
|
||||
coords: sysType,
|
||||
selection: { type: 'default_scene' },
|
||||
units: 'in',
|
||||
})
|
||||
await doExport({
|
||||
type: 'ply',
|
||||
storage: 'binary_big_endian',
|
||||
coords: sysType,
|
||||
selection: { type: 'default_scene' },
|
||||
units: 'in',
|
||||
})
|
||||
await doExport({
|
||||
type: 'stl',
|
||||
storage: 'ascii',
|
||||
coords: sysType,
|
||||
units: 'in',
|
||||
selection: { type: 'default_scene' },
|
||||
})
|
||||
await doExport({
|
||||
type: 'stl',
|
||||
storage: 'binary',
|
||||
coords: sysType,
|
||||
units: 'in',
|
||||
selection: { type: 'default_scene' },
|
||||
})
|
||||
await doExport({
|
||||
// obj seems to be a little flaky, times out tests sometimes
|
||||
type: 'obj',
|
||||
coords: sysType,
|
||||
units: 'in',
|
||||
})
|
||||
})
|
Binary file not shown.
After Width: | Height: | Size: 118 KiB |
Binary file not shown.
After Width: | Height: | Size: 80 KiB |
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
156
e2e/playwright/test-utils.ts
Normal file
156
e2e/playwright/test-utils.ts
Normal file
@ -0,0 +1,156 @@
|
||||
import { expect, Page } from '@playwright/test'
|
||||
import { EngineCommand } from '../../src/lang/std/engineConnection'
|
||||
import fsp from 'fs/promises'
|
||||
import pixelMatch from 'pixelmatch'
|
||||
import { PNG } from 'pngjs'
|
||||
|
||||
async function waitForPageLoad(page: Page) {
|
||||
// wait for 'Loading stream...' spinner
|
||||
await page.getByTestId('loading-stream').waitFor()
|
||||
// wait for all spinners to be gone
|
||||
await page.getByTestId('loading').waitFor({ state: 'detached' })
|
||||
|
||||
await page.getByTestId('start-sketch').waitFor()
|
||||
}
|
||||
|
||||
async function removeCurrentCode(page: Page) {
|
||||
const hotkey = process.platform === 'darwin' ? 'Meta' : 'Control'
|
||||
await page.click('.cm-content')
|
||||
await page.keyboard.down(hotkey)
|
||||
await page.keyboard.press('a')
|
||||
await page.keyboard.up(hotkey)
|
||||
await page.keyboard.press('Backspace')
|
||||
await expect(page.locator('.cm-content')).toHaveText('')
|
||||
}
|
||||
|
||||
async function sendCustomCmd(page: Page, cmd: EngineCommand) {
|
||||
await page.fill('[data-testid="custom-cmd-input"]', JSON.stringify(cmd))
|
||||
await page.click('[data-testid="custom-cmd-send-button"]')
|
||||
}
|
||||
|
||||
async function clearCommandLogs(page: Page) {
|
||||
await page.click('[data-testid="clear-commands"]')
|
||||
}
|
||||
|
||||
async function expectCmdLog(page: Page, locatorStr: string) {
|
||||
await expect(page.locator(locatorStr)).toBeVisible()
|
||||
}
|
||||
|
||||
async function waitForDefaultPlanesToBeVisible(page: Page) {
|
||||
await page.waitForFunction(
|
||||
() =>
|
||||
document.querySelectorAll('[data-receive-command-type="object_visible"]')
|
||||
.length >= 3
|
||||
)
|
||||
}
|
||||
|
||||
async function openDebugPanel(page: Page) {
|
||||
const isOpen =
|
||||
(await page
|
||||
.locator('[data-testid="debug-panel"]')
|
||||
?.getAttribute('open')) === ''
|
||||
|
||||
if (!isOpen) {
|
||||
await page.getByText('Debug').click()
|
||||
await page.getByTestId('debug-panel').and(page.locator('[open]')).waitFor()
|
||||
}
|
||||
}
|
||||
|
||||
async function closeDebugPanel(page: Page) {
|
||||
const isOpen =
|
||||
(await page.getByTestId('debug-panel')?.getAttribute('open')) === ''
|
||||
if (isOpen) {
|
||||
await page.getByText('Debug').click()
|
||||
await page
|
||||
.getByTestId('debug-panel')
|
||||
.and(page.locator(':not([open])'))
|
||||
.waitFor()
|
||||
}
|
||||
}
|
||||
|
||||
async function waitForCmdReceive(page: Page, commandType: string) {
|
||||
return page
|
||||
.locator(`[data-receive-command-type="${commandType}"]`)
|
||||
.first()
|
||||
.waitFor()
|
||||
}
|
||||
|
||||
export function getUtils(page: Page) {
|
||||
return {
|
||||
waitForAuthSkipAppStart: () => waitForPageLoad(page),
|
||||
removeCurrentCode: () => removeCurrentCode(page),
|
||||
sendCustomCmd: (cmd: EngineCommand) => sendCustomCmd(page, cmd),
|
||||
clearCommandLogs: () => clearCommandLogs(page),
|
||||
expectCmdLog: (locatorStr: string) => expectCmdLog(page, locatorStr),
|
||||
waitForDefaultPlanesVisibilityChange: () =>
|
||||
waitForDefaultPlanesToBeVisible(page),
|
||||
openDebugPanel: () => openDebugPanel(page),
|
||||
closeDebugPanel: () => closeDebugPanel(page),
|
||||
openAndClearDebugPanel: async () => {
|
||||
await openDebugPanel(page)
|
||||
return clearCommandLogs(page)
|
||||
},
|
||||
clearAndCloseDebugPanel: async () => {
|
||||
await clearCommandLogs(page)
|
||||
return closeDebugPanel(page)
|
||||
},
|
||||
waitForCmdReceive: (commandType: string) =>
|
||||
waitForCmdReceive(page, commandType),
|
||||
doAndWaitForCmd: async (
|
||||
fn: () => Promise<void>,
|
||||
commandType: string,
|
||||
endWithDebugPanelOpen = true
|
||||
) => {
|
||||
await openDebugPanel(page)
|
||||
await clearCommandLogs(page)
|
||||
await closeDebugPanel(page)
|
||||
await fn()
|
||||
await openDebugPanel(page)
|
||||
await waitForCmdReceive(page, commandType)
|
||||
if (!endWithDebugPanelOpen) {
|
||||
await closeDebugPanel(page)
|
||||
}
|
||||
},
|
||||
doAndWaitForImageDiff: (fn: () => Promise<any>, diffCount = 200) =>
|
||||
new Promise(async (resolve) => {
|
||||
await page.screenshot({
|
||||
path: './e2e/playwright/temp1.png',
|
||||
fullPage: true,
|
||||
})
|
||||
await fn()
|
||||
const isImageDiff = async () => {
|
||||
await page.screenshot({
|
||||
path: './e2e/playwright/temp2.png',
|
||||
fullPage: true,
|
||||
})
|
||||
const screenshot1 = PNG.sync.read(
|
||||
await fsp.readFile('./e2e/playwright/temp1.png')
|
||||
)
|
||||
const screenshot2 = PNG.sync.read(
|
||||
await fsp.readFile('./e2e/playwright/temp2.png')
|
||||
)
|
||||
const actualDiffCount = pixelMatch(
|
||||
screenshot1.data,
|
||||
screenshot2.data,
|
||||
null,
|
||||
screenshot1.width,
|
||||
screenshot2.height
|
||||
)
|
||||
return actualDiffCount > diffCount
|
||||
}
|
||||
|
||||
// run isImageDiff every 50ms until it returns true or 5 seconds have passed (100 times)
|
||||
let count = 0
|
||||
const interval = setInterval(async () => {
|
||||
count++
|
||||
if (await isImageDiff()) {
|
||||
clearInterval(interval)
|
||||
resolve(true)
|
||||
} else if (count > 100) {
|
||||
clearInterval(interval)
|
||||
resolve(false)
|
||||
}
|
||||
}, 50)
|
||||
}),
|
||||
}
|
||||
}
|
62
e2e/tauri/specs/auth.e2e.ts
Normal file
62
e2e/tauri/specs/auth.e2e.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import { browser, $, expect } from '@wdio/globals'
|
||||
import fs from 'fs/promises'
|
||||
|
||||
describe('KCMA (Tauri, Linux)', () => {
|
||||
it('opens the auth page, signs in, and signs out', async () => {
|
||||
// Clean up previous tests
|
||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||
await fs.rm('/tmp/kittycad_user_code', { force: true })
|
||||
await browser.execute('window.localStorage.clear()')
|
||||
|
||||
const signInButton = await $('[data-testid="sign-in-button"]')
|
||||
expect(await signInButton.getText()).toEqual('Sign in')
|
||||
|
||||
// Workaround for .click(), see https://github.com/tauri-apps/tauri/issues/6541
|
||||
await signInButton.waitForClickable()
|
||||
await browser.execute('arguments[0].click();', signInButton)
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
|
||||
// Get from main.rs
|
||||
const userCode = await (
|
||||
await fs.readFile('/tmp/kittycad_user_code')
|
||||
).toString()
|
||||
console.log(`Found user code ${userCode}`)
|
||||
|
||||
// Device flow: verify
|
||||
const token = process.env.KITTYCAD_API_TOKEN
|
||||
const headers = {
|
||||
Authorization: `Bearer ${token}`,
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
const verifyUrl = `https://api.kittycad.io/oauth2/device/verify?user_code=${userCode}`
|
||||
console.log(`GET ${verifyUrl}`)
|
||||
const vr = await fetch(verifyUrl, { headers })
|
||||
console.log(vr.status)
|
||||
|
||||
// Device flow: confirm
|
||||
const confirmUrl = 'https://api.kittycad.io/oauth2/device/confirm'
|
||||
const data = JSON.stringify({ user_code: userCode })
|
||||
console.log(`POST ${confirmUrl} ${data}`)
|
||||
const cr = await fetch(confirmUrl, {
|
||||
headers,
|
||||
method: 'POST',
|
||||
body: data,
|
||||
})
|
||||
console.log(cr.status)
|
||||
|
||||
// Now should be signed in
|
||||
const newFileButton = await $('[data-testid="home-new-file"]')
|
||||
expect(await newFileButton.getText()).toEqual('New file')
|
||||
|
||||
// So let's sign out!
|
||||
const menuButton = await $('[data-testid="user-sidebar-toggle"]')
|
||||
await menuButton.waitForClickable()
|
||||
await browser.execute('arguments[0].click();', menuButton)
|
||||
const signoutButton = await $('[data-testid="user-sidebar-sign-out"]')
|
||||
await signoutButton.waitForClickable()
|
||||
await browser.execute('arguments[0].click();', signoutButton)
|
||||
const newSignInButton = await $('[data-testid="sign-in-button"]')
|
||||
expect(await newSignInButton.getText()).toEqual('Sign in')
|
||||
})
|
||||
})
|
@ -1,11 +0,0 @@
|
||||
describe('Modeling App', () => {
|
||||
it('open the sign in page', async () => {
|
||||
const button = await $('#signin')
|
||||
expect(button).toHaveText('Sign in')
|
||||
|
||||
// Workaround for .click(), see https://github.com/tauri-apps/tauri/issues/6541
|
||||
await button.waitForClickable()
|
||||
await browser.execute('arguments[0].click();', button)
|
||||
// TODO: handle auth
|
||||
})
|
||||
})
|
49
package.json
49
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "untitled-app",
|
||||
"version": "0.11.3",
|
||||
"version": "0.12.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.10.2",
|
||||
@ -8,10 +8,10 @@
|
||||
"@fortawesome/free-brands-svg-icons": "^6.4.2",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.4.2",
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"@headlessui/react": "^1.7.13",
|
||||
"@headlessui/react": "^1.7.17",
|
||||
"@headlessui/tailwindcss": "^0.2.0",
|
||||
"@kittycad/lib": "^0.0.45",
|
||||
"@lezer/javascript": "^1.4.7",
|
||||
"@kittycad/lib": "^0.0.46",
|
||||
"@lezer/javascript": "^1.4.9",
|
||||
"@open-rpc/client-js": "^1.8.1",
|
||||
"@react-hook/resize-observer": "^1.2.6",
|
||||
"@replit/codemirror-interact": "^6.3.0",
|
||||
@ -22,7 +22,7 @@
|
||||
"@testing-library/user-event": "^14.5.1",
|
||||
"@ts-stack/markdown": "^1.5.0",
|
||||
"@types/node": "^16.7.13",
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/react": "^18.2.41",
|
||||
"@types/react-dom": "^18.0.0",
|
||||
"@uiw/react-codemirror": "^4.21.20",
|
||||
"@xstate/inspect": "^0.8.0",
|
||||
@ -30,7 +30,7 @@
|
||||
"crypto-js": "^4.2.0",
|
||||
"debounce-promise": "^3.1.2",
|
||||
"formik": "^2.4.3",
|
||||
"fuse.js": "^6.6.2",
|
||||
"fuse.js": "^7.0.0",
|
||||
"http-server": "^14.1.1",
|
||||
"json-rpc-2.0": "^1.6.0",
|
||||
"re-resizable": "^6.9.11",
|
||||
@ -60,6 +60,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"serve": "vite serve --port=3000",
|
||||
"build": "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source \"$HOME/.cargo/env\" && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -y && yarn build:wasm && vite build",
|
||||
"build:local": "vite build",
|
||||
"build:both": "vite build",
|
||||
@ -69,11 +70,11 @@
|
||||
"test:nowatch": "vitest run --mode development",
|
||||
"test:rust": "(cd src/wasm-lib && cargo test --all && cargo clippy --all --tests --benches)",
|
||||
"test:cov": "vitest run --coverage --mode development",
|
||||
"test:e2e": "wdio run wdio.conf.js",
|
||||
"test:e2e:tauri": "E2E_TAURI_ENABLED=true TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' wdio run wdio.conf.ts",
|
||||
"simpleserver:ci": "yarn pretest && http-server ./public --cors -p 3000 &",
|
||||
"simpleserver": "yarn pretest && http-server ./public --cors -p 3000",
|
||||
"fmt": "prettier --write ./src",
|
||||
"fmt-check": "prettier --check ./src",
|
||||
"fmt": "prettier --write ./src && prettier --write ./e2e",
|
||||
"fmt-check": "prettier --check ./src && prettier --check ./e2e",
|
||||
"build:wasm-dev": "(cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && cp src/wasm-lib/pkg/wasm_lib_bg.wasm public && yarn fmt",
|
||||
"build:wasm": "(cd src/wasm-lib && wasm-pack build --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && cp src/wasm-lib/pkg/wasm_lib_bg.wasm public && yarn fmt",
|
||||
"build:wasm-clean": "yarn wasm-prep && yarn build:wasm",
|
||||
@ -102,34 +103,42 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
||||
"@babel/preset-env": "^7.22.9",
|
||||
"@babel/preset-env": "^7.23.3",
|
||||
"@playwright/test": "^1.39.0",
|
||||
"@tauri-apps/cli": "^1.5.6",
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/debounce-promise": "^3.1.8",
|
||||
"@types/isomorphic-fetch": "^0.0.36",
|
||||
"@types/react-modal": "^3.16.0",
|
||||
"@types/pixelmatch": "^5.2.6",
|
||||
"@types/pngjs": "^6.0.4",
|
||||
"@types/react-modal": "^3.16.3",
|
||||
"@types/uuid": "^9.0.4",
|
||||
"@types/wait-on": "^5.3.4",
|
||||
"@types/wicg-file-system-access": "^2020.9.6",
|
||||
"@types/ws": "^8.5.5",
|
||||
"@vitejs/plugin-react": "^4.0.3",
|
||||
"@vitest/coverage-istanbul": "^0.34.1",
|
||||
"@vitejs/plugin-react": "^4.1.1",
|
||||
"@vitest/coverage-istanbul": "^0.34.6",
|
||||
"@wdio/cli": "^8.24.3",
|
||||
"@wdio/globals": "^8.24.3",
|
||||
"@wdio/local-runner": "^8.24.3",
|
||||
"@wdio/mocha-framework": "^8.24.3",
|
||||
"@wdio/spec-reporter": "^8.24.2",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-config-react-app": "^7.0.1",
|
||||
"eslint-plugin-css-modules": "^2.11.0",
|
||||
"eslint-plugin-css-modules": "^2.12.0",
|
||||
"happy-dom": "^10.8.0",
|
||||
"husky": "^8.0.3",
|
||||
"pixelmatch": "^5.3.0",
|
||||
"pngjs": "^7.0.0",
|
||||
"postcss": "^8.4.31",
|
||||
"prettier": "^2.8.0",
|
||||
"setimmediate": "^1.0.5",
|
||||
"tailwindcss": "^3.2.4",
|
||||
"tailwindcss": "^3.3.5",
|
||||
"vite": "^4.5.0",
|
||||
"vite-plugin-eslint": "^1.8.1",
|
||||
"vite-tsconfig-paths": "^4.2.1",
|
||||
"yarn": "^1.22.19",
|
||||
"@wdio/cli": "^7.7.3",
|
||||
"@wdio/local-runner": "^7.7.3",
|
||||
"@wdio/mocha-framework": "^7.7.3",
|
||||
"@wdio/spec-reporter": "^7.7.3"
|
||||
"wait-on": "^7.2.0",
|
||||
"yarn": "^1.22.19"
|
||||
}
|
||||
}
|
||||
|
82
playwright.config.ts
Normal file
82
playwright.config.ts
Normal file
@ -0,0 +1,82 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Read environment variables from file.
|
||||
* https://github.com/motdotla/dotenv
|
||||
*/
|
||||
// require('dotenv').config();
|
||||
|
||||
/**
|
||||
* See https://playwright.dev/docs/test-configuration.
|
||||
*/
|
||||
export default defineConfig({
|
||||
testDir: './e2e/playwright',
|
||||
/* Run tests in files in parallel */
|
||||
fullyParallel: true,
|
||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||
forbidOnly: !!process.env.CI,
|
||||
/* Retry on CI only */
|
||||
retries: process.env.CI ? 3 : 0,
|
||||
/* Opt out of parallel tests on CI. */
|
||||
workers: process.env.CI ? 1 : 1,
|
||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||
reporter: 'html',
|
||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||
use: {
|
||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||
baseURL: 'http://localhost:3000',
|
||||
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: 'on-first-retry',
|
||||
},
|
||||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
{
|
||||
name: 'Google Chrome',
|
||||
use: { ...devices['Desktop Chrome'], channel: 'chrome' }, // or 'chrome-beta'
|
||||
},
|
||||
{
|
||||
name: 'webkit',
|
||||
use: { ...devices['Desktop Safari'] },
|
||||
},
|
||||
// {
|
||||
// name: 'firefox',
|
||||
// use: { ...devices['Desktop Firefox'] },
|
||||
// },
|
||||
// {
|
||||
// name: 'chromium', // compat issue with encoding atm, so we're using the branded 'Google Chrome' instead
|
||||
// use: { ...devices['Desktop Chrome'] },
|
||||
// },
|
||||
|
||||
|
||||
|
||||
/* Test against mobile viewports. */
|
||||
// {
|
||||
// name: 'Mobile Chrome',
|
||||
// use: { ...devices['Pixel 5'] },
|
||||
// },
|
||||
// {
|
||||
// name: 'Mobile Safari',
|
||||
// use: { ...devices['iPhone 12'] },
|
||||
// },
|
||||
|
||||
/* Test against branded browsers. */
|
||||
// {
|
||||
// name: 'Microsoft Edge',
|
||||
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
||||
// },
|
||||
// {
|
||||
// name: 'Google Chrome',
|
||||
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
||||
// },
|
||||
],
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: {
|
||||
command: 'yarn serve',
|
||||
// url: 'http://127.0.0.1:3000',
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
});
|
||||
|
61
src-tauri/Cargo.lock
generated
61
src-tauri/Cargo.lock
generated
@ -1664,9 +1664,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kittycad"
|
||||
version = "0.2.41"
|
||||
version = "0.2.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "874914cd40bfd43674406683bb3f0924d41780698a4ade96f2e180a73678bdd1"
|
||||
checksum = "6aa554d86b6dbbd976a659c912ae25ce817b4378eb12a5684907e263410f0a7b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -1732,9 +1732,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.148"
|
||||
version = "0.2.150"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
|
||||
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
@ -1913,12 +1913,6 @@ version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "minisign-verify"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "933dca44d65cdd53b355d0b73d380a2ff5da71f87f036053188bf1eab6a19881"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.6.2"
|
||||
@ -1940,9 +1934,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.8.8"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
|
||||
checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
@ -3112,9 +3106,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "schemars"
|
||||
version = "0.8.15"
|
||||
version = "0.8.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c"
|
||||
checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29"
|
||||
dependencies = [
|
||||
"bigdecimal",
|
||||
"bytes",
|
||||
@ -3129,9 +3123,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "schemars_derive"
|
||||
version = "0.8.15"
|
||||
version = "0.8.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c"
|
||||
checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3215,9 +3209,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.192"
|
||||
version = "1.0.193"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001"
|
||||
checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@ -3233,9 +3227,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.192"
|
||||
version = "1.0.193"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1"
|
||||
checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3438,9 +3432,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.5.4"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e"
|
||||
checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.48.0",
|
||||
@ -3745,7 +3739,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bfe673cf125ef364d6f56b15e8ce7537d9ca7e4dae1cf6fbbdeed2e024db3d9"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.21.2",
|
||||
"bytes",
|
||||
"cocoa",
|
||||
"dirs-next",
|
||||
@ -3759,7 +3752,6 @@ dependencies = [
|
||||
"heck 0.4.1",
|
||||
"http",
|
||||
"ignore",
|
||||
"minisign-verify",
|
||||
"objc",
|
||||
"once_cell",
|
||||
"open",
|
||||
@ -3784,14 +3776,12 @@ dependencies = [
|
||||
"tauri-utils",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"time",
|
||||
"tokio",
|
||||
"url",
|
||||
"uuid",
|
||||
"webkit2gtk",
|
||||
"webview2-com",
|
||||
"windows 0.39.0",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3856,7 +3846,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-fs-extra"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v1#6865299149ffd183365e3ff291acf3edac78ca61"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v1#537053d3171a7374a1a86fed422523e7b45a4fb8"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
@ -4035,9 +4025,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.33.0"
|
||||
version = "1.34.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653"
|
||||
checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
@ -4045,7 +4035,7 @@ dependencies = [
|
||||
"mio",
|
||||
"num_cpus",
|
||||
"pin-project-lite",
|
||||
"socket2 0.5.4",
|
||||
"socket2 0.5.5",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
@ -5012,14 +5002,3 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
|
||||
dependencies = [
|
||||
"linked-hash-map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "0.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"crc32fast",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
@ -16,13 +16,13 @@ tauri-build = { version = "1.5.0", features = [] }
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
kittycad = "0.2.41"
|
||||
kittycad = "0.2.42"
|
||||
oauth2 = "4.4.2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
tauri = { version = "1.5.2", features = [ "os-all", "dialog-all", "fs-all", "http-request", "path-all", "shell-open", "shell-open-api", "updater", "devtools"] }
|
||||
tauri = { version = "1.5.2", features = [ "os-all", "dialog-all", "fs-all", "http-request", "path-all", "shell-open", "shell-open-api", "devtools"] }
|
||||
tauri-plugin-fs-extra = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
|
||||
tokio = { version = "1.33.0", features = ["time"] }
|
||||
tokio = { version = "1.34.0", features = ["time"] }
|
||||
toml = "0.8.2"
|
||||
|
||||
[features]
|
||||
|
@ -1,6 +1,8 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::io::Read;
|
||||
|
||||
use anyhow::Result;
|
||||
@ -70,8 +72,24 @@ async fn login(app: tauri::AppHandle, host: &str) -> Result<String, InvokeError>
|
||||
// Open the system browser with the auth_uri.
|
||||
// We do this in the browser and not a separate window because we want 1password and
|
||||
// other crap to work well.
|
||||
tauri::api::shell::open(&app.shell_scope(), auth_uri.secret(), None)
|
||||
.map_err(|e| InvokeError::from_anyhow(e.into()))?;
|
||||
// TODO: find a better way to share this value with tauri e2e tests
|
||||
// Here we're using an env var to enable the /tmp file (windows not supported for now)
|
||||
// and bypass the shell::open call as it fails on GitHub Actions.
|
||||
let e2e_tauri_enabled = env::var("E2E_TAURI_ENABLED").is_ok();
|
||||
if (e2e_tauri_enabled) {
|
||||
println!(
|
||||
"E2E_TAURI_ENABLED is set, won't open {} externally",
|
||||
auth_uri.secret()
|
||||
);
|
||||
fs::write(
|
||||
"/tmp/kittycad_user_code",
|
||||
details.user_code().secret().to_string(),
|
||||
)
|
||||
.expect("Unable to write /tmp/kittycad_user_code file");
|
||||
} else {
|
||||
tauri::api::shell::open(&app.shell_scope(), auth_uri.secret(), None)
|
||||
.map_err(|e| InvokeError::from_anyhow(e.into()))?;
|
||||
}
|
||||
|
||||
// Wait for the user to login.
|
||||
let token = auth_client
|
||||
|
@ -8,7 +8,7 @@
|
||||
},
|
||||
"package": {
|
||||
"productName": "kittycad-modeling",
|
||||
"version": "0.11.3"
|
||||
"version": "0.12.0"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
|
@ -226,7 +226,7 @@ export function App() {
|
||||
<Stream className="absolute inset-0 z-0" />
|
||||
{showDebugPanel && (
|
||||
<DebugPanel
|
||||
title="Debug (AST Explorer)"
|
||||
title="Debug"
|
||||
className={
|
||||
'transition-opacity transition-duration-75 ' +
|
||||
paneOpacity +
|
||||
|
@ -7,7 +7,9 @@ export const Auth = ({ children }: React.PropsWithChildren) => {
|
||||
const isLoggingIn = auth?.state.matches('checkIfLoggedIn')
|
||||
|
||||
return isLoggingIn ? (
|
||||
<Loading>Loading KittyCAD Modeling App...</Loading>
|
||||
<Loading>
|
||||
<span data-testid="initial-load">Loading KittyCAD Modeling App...</span>
|
||||
</Loading>
|
||||
) : (
|
||||
<>{children}</>
|
||||
)
|
||||
|
@ -48,7 +48,7 @@ export const Toolbar = () => {
|
||||
className="group"
|
||||
>
|
||||
<ActionIcon icon="sketch" className="!p-0.5" size="md" />
|
||||
Start Sketch
|
||||
<span data-testid="start-sketch">Start Sketch</span>
|
||||
</button>
|
||||
)}
|
||||
{state.nextEvents.includes('Enter sketch') && pathId && (
|
||||
@ -109,6 +109,21 @@ export const Toolbar = () => {
|
||||
eventName.includes('Make segment') ||
|
||||
eventName.includes('Constrain')
|
||||
)
|
||||
.sort((a, b) => {
|
||||
const aisEnabled = state.nextEvents
|
||||
.filter((event) => state.can(event as any))
|
||||
.includes(a)
|
||||
const bIsEnabled = state.nextEvents
|
||||
.filter((event) => state.can(event as any))
|
||||
.includes(b)
|
||||
if (aisEnabled && !bIsEnabled) {
|
||||
return -1
|
||||
}
|
||||
if (!aisEnabled && bIsEnabled) {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
})
|
||||
.map((eventName) => (
|
||||
<button
|
||||
key={eventName}
|
||||
|
@ -9,6 +9,7 @@ export interface CollapsiblePanelProps
|
||||
icon?: IconDefinition
|
||||
open?: boolean
|
||||
menu?: React.ReactNode
|
||||
detailsTestId?: string
|
||||
iconClassNames?: {
|
||||
bg?: string
|
||||
icon?: string
|
||||
@ -51,11 +52,13 @@ export const CollapsiblePanel = ({
|
||||
className,
|
||||
iconClassNames,
|
||||
menu,
|
||||
detailsTestId,
|
||||
...props
|
||||
}: CollapsiblePanelProps) => {
|
||||
return (
|
||||
<details
|
||||
{...props}
|
||||
data-testid={detailsTestId}
|
||||
className={styles.panel + ' group ' + (className || '')}
|
||||
>
|
||||
<PanelHeader
|
||||
|
@ -1,17 +1,20 @@
|
||||
import { CollapsiblePanel, CollapsiblePanelProps } from './CollapsiblePanel'
|
||||
import { AstExplorer } from './AstExplorer'
|
||||
import { EngineCommands } from './EngineCommands'
|
||||
|
||||
export const DebugPanel = ({ className, ...props }: CollapsiblePanelProps) => {
|
||||
return (
|
||||
<CollapsiblePanel
|
||||
{...props}
|
||||
className={
|
||||
'!absolute overflow-hidden !h-auto bottom-5 right-5 ' + className
|
||||
'!absolute overflow-auto !h-auto bottom-5 right-5 ' + className
|
||||
}
|
||||
// header height, top-5, and bottom-5
|
||||
style={{ maxHeight: 'calc(100% - 3rem - 1.25rem - 1.25rem)' }}
|
||||
detailsTestId="debug-panel"
|
||||
>
|
||||
<section className="p-4 flex flex-col gap-4">
|
||||
<EngineCommands />
|
||||
<div style={{ height: '400px' }} className="overflow-y-auto">
|
||||
<AstExplorer />
|
||||
</div>
|
||||
|
85
src/components/EngineCommands.tsx
Normal file
85
src/components/EngineCommands.tsx
Normal file
@ -0,0 +1,85 @@
|
||||
import { CommandLog, engineCommandManager } from 'lang/std/engineConnection'
|
||||
import { useState, useEffect } from 'react'
|
||||
|
||||
function useEngineCommands(): [CommandLog[], () => void] {
|
||||
const [engineCommands, setEngineCommands] = useState<CommandLog[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
engineCommandManager.registerCommandLogCallback((commands) =>
|
||||
setEngineCommands(commands)
|
||||
)
|
||||
}, [])
|
||||
|
||||
return [engineCommands, () => engineCommandManager.clearCommandLogs()]
|
||||
}
|
||||
|
||||
export const EngineCommands = () => {
|
||||
const [engineCommands, clearEngineCommands] = useEngineCommands()
|
||||
const [containsFilter, setContainsFilter] = useState('')
|
||||
const [customCmd, setCustomCmd] = useState('')
|
||||
return (
|
||||
<div>
|
||||
<input
|
||||
className="text-gray-800 bg-slate-300 px-2"
|
||||
data-testid="filter-input"
|
||||
type="text"
|
||||
value={containsFilter}
|
||||
onChange={(e) => setContainsFilter(e.target.value)}
|
||||
placeholder="Filter"
|
||||
/>
|
||||
<div className="max-w-xl max-h-36 overflow-auto">
|
||||
{engineCommands.map((command, index) => {
|
||||
const stringer = JSON.stringify(command)
|
||||
if (containsFilter && !stringer.includes(containsFilter)) return null
|
||||
return (
|
||||
<pre className="text-xs" key={index}>
|
||||
<code
|
||||
key={index}
|
||||
data-message-type={command.type}
|
||||
data-command-type={
|
||||
(command.type === 'send-modeling' ||
|
||||
command.type === 'send-scene') &&
|
||||
command.data.type === 'modeling_cmd_req'
|
||||
? command?.data?.cmd?.type
|
||||
: ''
|
||||
}
|
||||
data-command-id={
|
||||
(command.type === 'send-modeling' ||
|
||||
command.type === 'send-scene') &&
|
||||
command.data.type === 'modeling_cmd_req'
|
||||
? command.data.cmd_id
|
||||
: ''
|
||||
}
|
||||
data-receive-command-type={
|
||||
command.type === 'receive-reliable' ? command.cmd_type : ''
|
||||
}
|
||||
>
|
||||
{JSON.stringify(command, null, 2)}
|
||||
</code>
|
||||
</pre>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<button data-testid="clear-commands" onClick={clearEngineCommands}>
|
||||
Clear
|
||||
</button>
|
||||
<br />
|
||||
<input
|
||||
className="text-gray-800 bg-slate-300 px-2"
|
||||
type="text"
|
||||
value={customCmd}
|
||||
onChange={(e) => setCustomCmd(e.target.value)}
|
||||
placeholder="JSON command"
|
||||
data-testid="custom-cmd-input"
|
||||
/>
|
||||
<button
|
||||
data-testid="custom-cmd-send-button"
|
||||
onClick={() =>
|
||||
engineCommandManager.sendSceneCommand(JSON.parse(customCmd))
|
||||
}
|
||||
>
|
||||
Send custom command
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
@ -75,7 +75,11 @@ export const ExportButton = ({ children, className }: ExportButtonProps) => {
|
||||
},
|
||||
}
|
||||
}
|
||||
if (values.type === 'obj' || values.type === 'stl') {
|
||||
if (
|
||||
values.type === 'obj' ||
|
||||
values.type === 'stl' ||
|
||||
values.type === 'ply'
|
||||
) {
|
||||
values.units = baseUnit
|
||||
}
|
||||
if (
|
||||
@ -86,6 +90,9 @@ export const ExportButton = ({ children, className }: ExportButtonProps) => {
|
||||
// Set the storage type.
|
||||
values.storage = storage
|
||||
}
|
||||
if (values.type === 'ply' || values.type === 'stl') {
|
||||
values.selection = { type: 'default_scene' }
|
||||
}
|
||||
engineCommandManager.sendSceneCommand({
|
||||
type: 'modeling_cmd_req',
|
||||
cmd: {
|
||||
@ -133,6 +140,7 @@ export const ExportButton = ({ children, className }: ExportButtonProps) => {
|
||||
<select
|
||||
id="type"
|
||||
name="type"
|
||||
data-testid="export-type"
|
||||
onChange={(e) => {
|
||||
setType(e.target.value as OutputTypeKey)
|
||||
if (e.target.value === 'gltf') {
|
||||
@ -162,6 +170,7 @@ export const ExportButton = ({ children, className }: ExportButtonProps) => {
|
||||
<select
|
||||
id="storage"
|
||||
name="storage"
|
||||
data-testid="export-storage"
|
||||
onChange={(e) => {
|
||||
setStorage(e.target.value as StorageUnion)
|
||||
formik.handleChange(e)
|
||||
@ -175,13 +184,13 @@ export const ExportButton = ({ children, className }: ExportButtonProps) => {
|
||||
<option value="standard">standard</option>
|
||||
</>
|
||||
)}
|
||||
{type === 'ply' && (
|
||||
{type === 'stl' && (
|
||||
<>
|
||||
<option value="ascii">ascii</option>
|
||||
<option value="binary">binary</option>
|
||||
</>
|
||||
)}
|
||||
{type === 'stl' && (
|
||||
{type === 'ply' && (
|
||||
<>
|
||||
<option value="ascii">ascii</option>
|
||||
<option value="binary_little_endian">
|
||||
|
@ -9,7 +9,6 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
import { faChevronRight, faTrashAlt } from '@fortawesome/free-solid-svg-icons'
|
||||
import { useFileContext } from 'hooks/useFileContext'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { kclManager } from 'lang/KclSinglton'
|
||||
import styles from './FileTree.module.css'
|
||||
import { sortProject } from 'lib/tauriFS'
|
||||
|
||||
|
@ -10,7 +10,10 @@ const Loading = ({ children }: React.PropsWithChildren) => {
|
||||
return () => clearTimeout(timer)
|
||||
}, [setHasLongLoadTime])
|
||||
return (
|
||||
<div className="body-bg flex flex-col items-center justify-center h-screen">
|
||||
<div
|
||||
className="body-bg flex flex-col items-center justify-center h-screen"
|
||||
data-testid="loading"
|
||||
>
|
||||
<svg viewBox="0 0 10 10" className="w-8 h-8">
|
||||
<circle cx="5" cy="5" r="4" stroke="var(--liquid-20)" fill="none" />
|
||||
<circle
|
||||
|
@ -31,13 +31,17 @@ import {
|
||||
} from 'lang/std/sketch'
|
||||
import { kclManager } from 'lang/KclSinglton'
|
||||
import { applyConstraintHorzVertDistance } from './Toolbar/SetHorzVertDistance'
|
||||
import { applyConstraintAngleBetween } from './Toolbar/SetAngleBetween'
|
||||
import {
|
||||
angleBetweenInfo,
|
||||
applyConstraintAngleBetween,
|
||||
} from './Toolbar/SetAngleBetween'
|
||||
import { applyConstraintAngleLength } from './Toolbar/setAngleLength'
|
||||
import { toast } from 'react-hot-toast'
|
||||
import { pathMapToSelections } from 'lang/util'
|
||||
import { useStore } from 'useStore'
|
||||
import { handleSelectionBatch, handleSelectionWithShift } from 'lib/selections'
|
||||
import { applyConstraintIntersect } from './Toolbar/Intersect'
|
||||
import { applyConstraintAbsDistance } from './Toolbar/SetAbsDistance'
|
||||
|
||||
type MachineContext<T extends AnyStateMachine> = {
|
||||
state: StateFrom<T>
|
||||
@ -262,17 +266,62 @@ export const ModelingMachineProvider = ({
|
||||
'Set selection': assign(({ selectionRanges }, event) => {
|
||||
if (event.type !== 'Set selection') return {} // this was needed for ts after adding 'Set selection' action to on done modal events
|
||||
const setSelections = event.data
|
||||
if (!editorView) return {}
|
||||
if (setSelections.selectionType === 'mirrorCodeMirrorSelections')
|
||||
return { selectionRanges: setSelections.selection }
|
||||
else if (setSelections.selectionType === 'otherSelection')
|
||||
else if (setSelections.selectionType === 'otherSelection') {
|
||||
// TODO KittyCAD/engine/issues/1620: send axis highlight when it's working (if that's what we settle on)
|
||||
// const axisAddCmd: EngineCommand = {
|
||||
// type: 'modeling_cmd_req',
|
||||
// cmd: {
|
||||
// type: 'highlight_set_entities',
|
||||
// entities: [
|
||||
// setSelections.selection === 'x-axis'
|
||||
// ? X_AXIS_UUID
|
||||
// : Y_AXIS_UUID,
|
||||
// ],
|
||||
// },
|
||||
// cmd_id: uuidv4(),
|
||||
// }
|
||||
|
||||
// if (!isShiftDown) {
|
||||
// engineCommandManager
|
||||
// .sendSceneCommand({
|
||||
// type: 'modeling_cmd_req',
|
||||
// cmd: {
|
||||
// type: 'select_clear',
|
||||
// },
|
||||
// cmd_id: uuidv4(),
|
||||
// })
|
||||
// .then(() => {
|
||||
// engineCommandManager.sendSceneCommand(axisAddCmd)
|
||||
// })
|
||||
// } else {
|
||||
// engineCommandManager.sendSceneCommand(axisAddCmd)
|
||||
// }
|
||||
|
||||
const {
|
||||
codeMirrorSelection,
|
||||
selectionRangeTypeMap,
|
||||
otherSelections,
|
||||
} = handleSelectionWithShift({
|
||||
otherSelection: setSelections.selection,
|
||||
currentSelections: selectionRanges,
|
||||
isShiftDown,
|
||||
})
|
||||
setTimeout(() => {
|
||||
editorView.dispatch({
|
||||
selection: codeMirrorSelection,
|
||||
})
|
||||
})
|
||||
return {
|
||||
selectionRangeTypeMap,
|
||||
selectionRanges: {
|
||||
...selectionRanges,
|
||||
otherSelections: [setSelections.selection],
|
||||
codeBasedSelections: selectionRanges.codeBasedSelections,
|
||||
otherSelections,
|
||||
},
|
||||
}
|
||||
else if (!editorView) return {}
|
||||
else if (setSelections.selectionType === 'singleCodeCursor') {
|
||||
} else if (setSelections.selectionType === 'singleCodeCursor') {
|
||||
// This DOES NOT set the `selectionRanges` in xstate context
|
||||
// instead it updates/dispatches to the editor, which in turn updates the xstate context
|
||||
// I've found this the best way to deal with the editor without causing an infinite loop
|
||||
@ -280,12 +329,16 @@ export const ModelingMachineProvider = ({
|
||||
// because we want to respect the user manually placing the cursor too.
|
||||
|
||||
// for more details on how selections see `src/lib/selections.ts`.
|
||||
const { codeMirrorSelection, selectionRangeTypeMap } =
|
||||
handleSelectionWithShift({
|
||||
codeSelection: setSelections.selection,
|
||||
currestSelections: selectionRanges,
|
||||
isShiftDown,
|
||||
})
|
||||
|
||||
const {
|
||||
codeMirrorSelection,
|
||||
selectionRangeTypeMap,
|
||||
otherSelections,
|
||||
} = handleSelectionWithShift({
|
||||
codeSelection: setSelections.selection,
|
||||
currentSelections: selectionRanges,
|
||||
isShiftDown,
|
||||
})
|
||||
if (codeMirrorSelection) {
|
||||
setTimeout(() => {
|
||||
editorView.dispatch({
|
||||
@ -293,7 +346,22 @@ export const ModelingMachineProvider = ({
|
||||
})
|
||||
})
|
||||
}
|
||||
return { selectionRangeTypeMap }
|
||||
if (!setSelections.selection) {
|
||||
return {
|
||||
selectionRangeTypeMap,
|
||||
selectionRanges: {
|
||||
codeBasedSelections: selectionRanges.codeBasedSelections,
|
||||
otherSelections,
|
||||
},
|
||||
}
|
||||
}
|
||||
return {
|
||||
selectionRangeTypeMap,
|
||||
selectionRanges: {
|
||||
codeBasedSelections: selectionRanges.codeBasedSelections,
|
||||
otherSelections,
|
||||
},
|
||||
}
|
||||
}
|
||||
// This DOES NOT set the `selectionRanges` in xstate context
|
||||
// same as comment above
|
||||
@ -363,10 +431,16 @@ export const ModelingMachineProvider = ({
|
||||
}
|
||||
},
|
||||
'Get angle info': async ({ selectionRanges }): Promise<SetSelections> => {
|
||||
const { modifiedAst, pathToNodeMap } =
|
||||
await applyConstraintAngleBetween({
|
||||
selectionRanges,
|
||||
})
|
||||
const { modifiedAst, pathToNodeMap } = await (angleBetweenInfo({
|
||||
selectionRanges,
|
||||
}).enabled
|
||||
? applyConstraintAngleBetween({
|
||||
selectionRanges,
|
||||
})
|
||||
: applyConstraintAngleLength({
|
||||
selectionRanges,
|
||||
angleOrLength: 'setAngle',
|
||||
}))
|
||||
await kclManager.updateAst(modifiedAst, true)
|
||||
return {
|
||||
selectionType: 'completeSelection',
|
||||
@ -409,6 +483,40 @@ export const ModelingMachineProvider = ({
|
||||
),
|
||||
}
|
||||
},
|
||||
'Get ABS X info': async ({ selectionRanges }): Promise<SetSelections> => {
|
||||
const { modifiedAst, pathToNodeMap } = await applyConstraintAbsDistance(
|
||||
{
|
||||
constraint: 'xAbs',
|
||||
selectionRanges,
|
||||
}
|
||||
)
|
||||
await kclManager.updateAst(modifiedAst, true)
|
||||
return {
|
||||
selectionType: 'completeSelection',
|
||||
selection: pathMapToSelections(
|
||||
kclManager.ast,
|
||||
selectionRanges,
|
||||
pathToNodeMap
|
||||
),
|
||||
}
|
||||
},
|
||||
'Get ABS Y info': async ({ selectionRanges }): Promise<SetSelections> => {
|
||||
const { modifiedAst, pathToNodeMap } = await applyConstraintAbsDistance(
|
||||
{
|
||||
constraint: 'yAbs',
|
||||
selectionRanges,
|
||||
}
|
||||
)
|
||||
await kclManager.updateAst(modifiedAst, true)
|
||||
return {
|
||||
selectionType: 'completeSelection',
|
||||
selection: pathMapToSelections(
|
||||
kclManager.ast,
|
||||
selectionRanges,
|
||||
pathToNodeMap
|
||||
),
|
||||
}
|
||||
},
|
||||
},
|
||||
devTools: true,
|
||||
})
|
||||
|
@ -356,6 +356,8 @@ export const Stream = ({ className = '' }) => {
|
||||
|
||||
kclManager.executeAstMock(modifiedAst, true)
|
||||
})
|
||||
} else {
|
||||
engineCommandManager.sendSceneCommand(command)
|
||||
}
|
||||
|
||||
setDidDragInStream(false)
|
||||
@ -394,7 +396,9 @@ export const Stream = ({ className = '' }) => {
|
||||
/>
|
||||
{isLoading && (
|
||||
<div className="text-center absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
|
||||
<Loading>Loading stream...</Loading>
|
||||
<Loading>
|
||||
<span data-testid="loading-stream">Loading stream...</span>
|
||||
</Loading>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
@ -42,13 +42,19 @@ export const TextEditor = ({
|
||||
}: {
|
||||
theme: Themes.Light | Themes.Dark
|
||||
}) => {
|
||||
const { editorView, isLSPServerReady, setEditorView, setIsLSPServerReady } =
|
||||
useStore((s) => ({
|
||||
editorView: s.editorView,
|
||||
isLSPServerReady: s.isLSPServerReady,
|
||||
setEditorView: s.setEditorView,
|
||||
setIsLSPServerReady: s.setIsLSPServerReady,
|
||||
}))
|
||||
const {
|
||||
editorView,
|
||||
isLSPServerReady,
|
||||
setEditorView,
|
||||
setIsLSPServerReady,
|
||||
isShiftDown,
|
||||
} = useStore((s) => ({
|
||||
editorView: s.editorView,
|
||||
isLSPServerReady: s.isLSPServerReady,
|
||||
setEditorView: s.setEditorView,
|
||||
setIsLSPServerReady: s.setIsLSPServerReady,
|
||||
isShiftDown: s.isShiftDown,
|
||||
}))
|
||||
const { code, errors } = useKclContext()
|
||||
|
||||
const {
|
||||
@ -113,6 +119,7 @@ export const TextEditor = ({
|
||||
codeMirrorRanges: viewUpdate.state.selection.ranges,
|
||||
selectionRanges,
|
||||
selectionRangeTypeMap,
|
||||
isShiftDown,
|
||||
})
|
||||
if (!eventInfo) return
|
||||
|
||||
|
@ -59,6 +59,7 @@ export function angleBetweenInfo({
|
||||
)
|
||||
|
||||
const _enableEqual =
|
||||
selectionRanges.otherSelections.length === 0 &&
|
||||
secondaryVarDecs.length === 1 &&
|
||||
isAllTooltips &&
|
||||
isOthersLinkedToPrimary &&
|
||||
|
@ -25,7 +25,7 @@ import { kclManager } from 'lang/KclSinglton'
|
||||
|
||||
const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal)
|
||||
|
||||
export function setAngleLengthInfo({
|
||||
export function angleLengthInfo({
|
||||
selectionRanges,
|
||||
angleOrLength = 'setLength',
|
||||
}: {
|
||||
@ -50,7 +50,10 @@ export function setAngleLengthInfo({
|
||||
kclManager.ast,
|
||||
angleOrLength
|
||||
)
|
||||
const enabled = isAllTooltips && transforms.every(Boolean)
|
||||
const enabled =
|
||||
selectionRanges.codeBasedSelections.length <= 1 &&
|
||||
isAllTooltips &&
|
||||
transforms.every(Boolean)
|
||||
return { enabled, transforms }
|
||||
}
|
||||
|
||||
@ -64,7 +67,7 @@ export async function applyConstraintAngleLength({
|
||||
modifiedAst: Program
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}> {
|
||||
const { transforms } = setAngleLengthInfo({ selectionRanges, angleOrLength })
|
||||
const { transforms } = angleLengthInfo({ selectionRanges, angleOrLength })
|
||||
const { valueUsedInTransform } = transformAstSketchLines({
|
||||
ast: JSON.parse(JSON.stringify(kclManager.ast)),
|
||||
selectionRanges,
|
||||
|
@ -165,6 +165,7 @@ const UserSidebarMenu = ({ user }: { user?: User }) => {
|
||||
'text-destroy-20 group-hover:text-destroy-10 hover:text-destroy-10',
|
||||
}}
|
||||
className="border-transparent dark:border-transparent hover:border-destroy-40 dark:hover:border-destroy-60"
|
||||
data-testid="user-sidebar-sign-out"
|
||||
>
|
||||
Sign out
|
||||
</ActionButton>
|
||||
|
@ -27,4 +27,7 @@ export const lineHighlightField = StateField.define({
|
||||
provide: (f) => EditorView.decorations.from(f),
|
||||
})
|
||||
|
||||
const matchDeco = Decoration.mark({ class: 'bg-yellow-200' })
|
||||
const matchDeco = Decoration.mark({
|
||||
class: 'bg-yellow-200',
|
||||
attributes: { 'data-testid': 'hover-highlight' },
|
||||
})
|
||||
|
@ -82,9 +82,14 @@ export function useSetupEngineManager(
|
||||
}
|
||||
|
||||
function getDimensions(streamWidth?: number, streamHeight?: number) {
|
||||
const maxResolution = 2000
|
||||
const width = streamWidth ? streamWidth : 0
|
||||
const quadWidth = Math.round(width / 4) * 4
|
||||
const height = streamHeight ? streamHeight : 0
|
||||
const quadHeight = Math.round(height / 4) * 4
|
||||
const ratio = Math.min(
|
||||
Math.min(maxResolution / width, maxResolution / height),
|
||||
1.0
|
||||
)
|
||||
const quadWidth = Math.round((width * ratio) / 4) * 4
|
||||
const quadHeight = Math.round((height * ratio) / 4) * 4
|
||||
return { width: quadWidth, height: quadHeight }
|
||||
}
|
||||
|
@ -7,10 +7,11 @@ import { HotkeysProvider } from 'react-hotkeys-hook'
|
||||
import { inspect } from '@xstate/inspect'
|
||||
import { DEV } from 'env'
|
||||
|
||||
if (DEV)
|
||||
inspect({
|
||||
iframe: false,
|
||||
})
|
||||
// uncomment for xstate inspector
|
||||
// if (DEV)
|
||||
// inspect({
|
||||
// iframe: false,
|
||||
// })
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
|
||||
|
||||
|
@ -246,6 +246,10 @@ class KclManager {
|
||||
this.code = recast(ast)
|
||||
}
|
||||
this._executeCallback()
|
||||
engineCommandManager.addCommandLog({
|
||||
type: 'execution-done',
|
||||
data: null,
|
||||
})
|
||||
}
|
||||
async executeAstMock(ast: Program = this._ast, updateCode = false) {
|
||||
await this.ensureWasmInit()
|
||||
|
@ -169,16 +169,24 @@ describe('testing function declaration', () => {
|
||||
end: 39,
|
||||
params: [
|
||||
{
|
||||
type: 'Identifier',
|
||||
start: 12,
|
||||
end: 13,
|
||||
name: 'a',
|
||||
type: 'Parameter',
|
||||
identifier: {
|
||||
type: 'Identifier',
|
||||
start: 12,
|
||||
end: 13,
|
||||
name: 'a',
|
||||
},
|
||||
optional: false,
|
||||
},
|
||||
{
|
||||
type: 'Identifier',
|
||||
start: 15,
|
||||
end: 16,
|
||||
name: 'b',
|
||||
type: 'Parameter',
|
||||
identifier: {
|
||||
type: 'Identifier',
|
||||
start: 15,
|
||||
end: 16,
|
||||
name: 'b',
|
||||
},
|
||||
optional: false,
|
||||
},
|
||||
],
|
||||
body: {
|
||||
@ -244,16 +252,24 @@ const myVar = funcN(1, 2)`
|
||||
end: 37,
|
||||
params: [
|
||||
{
|
||||
type: 'Identifier',
|
||||
start: 12,
|
||||
end: 13,
|
||||
name: 'a',
|
||||
type: 'Parameter',
|
||||
identifier: {
|
||||
type: 'Identifier',
|
||||
start: 12,
|
||||
end: 13,
|
||||
name: 'a',
|
||||
},
|
||||
optional: false,
|
||||
},
|
||||
{
|
||||
type: 'Identifier',
|
||||
start: 15,
|
||||
end: 16,
|
||||
name: 'b',
|
||||
type: 'Parameter',
|
||||
identifier: {
|
||||
type: 'Identifier',
|
||||
start: 15,
|
||||
end: 16,
|
||||
name: 'b',
|
||||
},
|
||||
optional: false,
|
||||
},
|
||||
],
|
||||
body: {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { getNodePathFromSourceRange, getNodeFromPath } from './queryAst'
|
||||
import { Identifier, parse, initPromise } from './wasm'
|
||||
import { Identifier, parse, initPromise, Parameter } from './wasm'
|
||||
|
||||
beforeAll(() => initPromise)
|
||||
|
||||
@ -46,7 +46,7 @@ const b1 = cube([0,0], 10)`
|
||||
|
||||
const ast = parse(code)
|
||||
const nodePath = getNodePathFromSourceRange(ast, sourceRange)
|
||||
const node = getNodeFromPath<Identifier>(ast, nodePath).node
|
||||
const node = getNodeFromPath<Parameter>(ast, nodePath).node
|
||||
|
||||
expect(nodePath).toEqual([
|
||||
['body', ''],
|
||||
@ -57,8 +57,8 @@ const b1 = cube([0,0], 10)`
|
||||
['params', 'FunctionExpression'],
|
||||
[0, 'index'],
|
||||
])
|
||||
expect(node.type).toBe('Identifier')
|
||||
expect(node.name).toBe('pos')
|
||||
expect(node.type).toBe('Parameter')
|
||||
expect(node.identifier.name).toBe('pos')
|
||||
})
|
||||
it('gets path right for deep within function definition body', () => {
|
||||
const code = `fn cube = (pos, scale) => {
|
||||
|
@ -247,10 +247,10 @@ function moreNodePathFromSourceRange(
|
||||
if (_node.type === 'FunctionExpression' && isInRange) {
|
||||
for (let i = 0; i < _node.params.length; i++) {
|
||||
const param = _node.params[i]
|
||||
if (param.start <= start && param.end >= end) {
|
||||
if (param.identifier.start <= start && param.identifier.end >= end) {
|
||||
path.push(['params', 'FunctionExpression'])
|
||||
path.push([i, 'index'])
|
||||
return moreNodePathFromSourceRange(param, sourceRange, path)
|
||||
return moreNodePathFromSourceRange(param.identifier, sourceRange, path)
|
||||
}
|
||||
}
|
||||
if (_node.body.start <= start && _node.body.end >= end) {
|
||||
|
@ -51,7 +51,7 @@ type ClientMetrics = Models['ClientMetrics_type']
|
||||
// EngineConnection encapsulates the connection(s) to the Engine
|
||||
// for the EngineCommandManager; namely, the underlying WebSocket
|
||||
// and WebRTC connections.
|
||||
export class EngineConnection {
|
||||
class EngineConnection {
|
||||
websocket?: WebSocket
|
||||
pc?: RTCPeerConnection
|
||||
unreliableDataChannel?: RTCDataChannel
|
||||
@ -216,6 +216,26 @@ export class EngineConnection {
|
||||
}
|
||||
})
|
||||
|
||||
this.pc.addEventListener('icecandidateerror', (_event) => {
|
||||
const event = _event as RTCPeerConnectionIceErrorEvent
|
||||
console.error(
|
||||
`ICE candidate returned an error: ${event.errorCode}: ${event.errorText} for ${event.url}`
|
||||
)
|
||||
})
|
||||
|
||||
this.pc.addEventListener('connectionstatechange', (event) => {
|
||||
if (this.pc?.iceConnectionState === 'connected') {
|
||||
if (this.shouldTrace()) {
|
||||
iceSpan.resolve?.()
|
||||
}
|
||||
} else if (this.pc?.iceConnectionState === 'failed') {
|
||||
// failed is a terminal state; let's explicitly kill the
|
||||
// connection to the server at this point.
|
||||
console.log('failed to negotiate ice connection; restarting')
|
||||
this.close()
|
||||
}
|
||||
})
|
||||
|
||||
this.websocket.addEventListener('open', (event) => {
|
||||
if (this.shouldTrace()) {
|
||||
websocketSpan.resolve?.()
|
||||
@ -351,19 +371,6 @@ export class EngineConnection {
|
||||
// until the end of this function is setup of our end of the
|
||||
// PeerConnection and waiting for events to fire our callbacks.
|
||||
|
||||
this.pc.addEventListener('connectionstatechange', (event) => {
|
||||
if (this.pc?.iceConnectionState === 'connected') {
|
||||
if (this.shouldTrace()) {
|
||||
iceSpan.resolve?.()
|
||||
}
|
||||
} else if (this.pc?.iceConnectionState === 'failed') {
|
||||
// failed is a terminal state; let's explicitly kill the
|
||||
// connection to the server at this point.
|
||||
console.log('failed to negotiate ice connection; restarting')
|
||||
this.close()
|
||||
}
|
||||
})
|
||||
|
||||
this.pc.addEventListener('icecandidate', (event) => {
|
||||
if (!this.pc || !this.websocket) return
|
||||
if (event.candidate !== null) {
|
||||
@ -583,12 +590,35 @@ interface Subscription<T extends ModelTypes> {
|
||||
) => void
|
||||
}
|
||||
|
||||
export type CommandLog =
|
||||
| {
|
||||
type: 'send-modeling'
|
||||
data: EngineCommand
|
||||
}
|
||||
| {
|
||||
type: 'send-scene'
|
||||
data: EngineCommand
|
||||
}
|
||||
| {
|
||||
type: 'receive-reliable'
|
||||
data: WebSocketResponse
|
||||
id: string
|
||||
cmd_type?: string
|
||||
}
|
||||
| {
|
||||
type: 'execution-done'
|
||||
data: null
|
||||
}
|
||||
|
||||
export class EngineCommandManager {
|
||||
artifactMap: ArtifactMap = {}
|
||||
lastArtifactMap: ArtifactMap = {}
|
||||
outSequence = 1
|
||||
inSequence = 1
|
||||
engineConnection?: EngineConnection
|
||||
defaultPlanes: DefaultPlanes = { xy: '', yz: '', xz: '' }
|
||||
_commandLogs: CommandLog[] = []
|
||||
_commandLogCallBack: (command: CommandLog[]) => void = () => {}
|
||||
// Folks should realize that wait for ready does not get called _everytime_
|
||||
// the connection resets and restarts, it only gets called the first time.
|
||||
// Be careful what you put here.
|
||||
@ -633,7 +663,10 @@ export class EngineCommandManager {
|
||||
|
||||
// If we already have an engine connection, just need to resize the stream.
|
||||
if (this.engineConnection) {
|
||||
this.handleResize({ streamWidth: width, streamHeight: height })
|
||||
this.handleResize({
|
||||
streamWidth: width,
|
||||
streamHeight: height,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@ -776,11 +809,17 @@ export class EngineCommandManager {
|
||||
return
|
||||
}
|
||||
const modelingResponse = message.data.modeling_response
|
||||
const command = this.artifactMap[id]
|
||||
this.addCommandLog({
|
||||
type: 'receive-reliable',
|
||||
data: message,
|
||||
id,
|
||||
cmd_type: command?.commandType || this.lastArtifactMap[id]?.commandType,
|
||||
})
|
||||
Object.values(this.subscriptions[modelingResponse.type] || {}).forEach(
|
||||
(callback) => callback(modelingResponse)
|
||||
)
|
||||
|
||||
const command = this.artifactMap[id]
|
||||
if (command && command.type === 'pending') {
|
||||
const resolve = command.resolve
|
||||
this.artifactMap[id] = {
|
||||
@ -844,6 +883,7 @@ export class EngineCommandManager {
|
||||
this.engineConnection?.tearDown()
|
||||
}
|
||||
startNewSession() {
|
||||
this.lastArtifactMap = this.artifactMap
|
||||
this.artifactMap = {}
|
||||
}
|
||||
subscribeTo<T extends ModelTypes>({
|
||||
@ -913,6 +953,21 @@ export class EngineCommandManager {
|
||||
this.engineConnection?.send(deletCmd)
|
||||
})
|
||||
}
|
||||
addCommandLog(message: CommandLog) {
|
||||
if (this._commandLogs.length > 500) {
|
||||
this._commandLogs.shift()
|
||||
}
|
||||
this._commandLogs.push(message)
|
||||
|
||||
this._commandLogCallBack([...this._commandLogs])
|
||||
}
|
||||
clearCommandLogs() {
|
||||
this._commandLogs = []
|
||||
this._commandLogCallBack(this._commandLogs)
|
||||
}
|
||||
registerCommandLogCallback(callback: (command: CommandLog[]) => void) {
|
||||
this._commandLogCallBack = callback
|
||||
}
|
||||
sendSceneCommand(command: EngineCommand): Promise<any> {
|
||||
if (this.engineConnection === undefined) {
|
||||
return Promise.resolve()
|
||||
@ -922,6 +977,20 @@ export class EngineCommandManager {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
if (
|
||||
!(
|
||||
command.type === 'modeling_cmd_req' &&
|
||||
(command.cmd.type === 'highlight_set_entity' ||
|
||||
command.cmd.type === 'mouse_move')
|
||||
)
|
||||
) {
|
||||
// highlight_set_entity and mouse_move are sent over the unreliable channel and are too noisy
|
||||
this.addCommandLog({
|
||||
type: 'send-scene',
|
||||
data: command,
|
||||
})
|
||||
}
|
||||
|
||||
if (
|
||||
command.type === 'modeling_cmd_req' &&
|
||||
command.cmd.type !== lastMessage
|
||||
@ -977,6 +1046,17 @@ export class EngineCommandManager {
|
||||
if (!this.engineConnection?.isReady()) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
if (typeof command !== 'string') {
|
||||
this.addCommandLog({
|
||||
type: 'send-modeling',
|
||||
data: command,
|
||||
})
|
||||
} else {
|
||||
this.addCommandLog({
|
||||
type: 'send-modeling',
|
||||
data: JSON.parse(command),
|
||||
})
|
||||
}
|
||||
this.engineConnection?.send(command)
|
||||
if (typeof command !== 'string' && command.type === 'modeling_cmd_req') {
|
||||
return this.handlePendingCommand(id, command?.cmd, range)
|
||||
|
@ -334,10 +334,7 @@ const setAbsDistanceForAngleLineCreateNode =
|
||||
): TransformInfo['createNode'] =>
|
||||
({ tag, forceValueUsedInTransform, varValA }) => {
|
||||
return (args, referencedSegment) => {
|
||||
const valueUsedInTransform = roundOff(
|
||||
getArgLiteralVal(args?.[1]) - (referencedSegment?.to?.[index] || 0),
|
||||
2
|
||||
)
|
||||
const valueUsedInTransform = roundOff(getArgLiteralVal(args?.[1]), 2)
|
||||
const val =
|
||||
(forceValueUsedInTransform as BinaryPart) ||
|
||||
createLiteral(valueUsedInTransform)
|
||||
|
@ -20,6 +20,7 @@ export type { ObjectExpression } from '../wasm-lib/kcl/bindings/ObjectExpression
|
||||
export type { MemberExpression } from '../wasm-lib/kcl/bindings/MemberExpression'
|
||||
export type { PipeExpression } from '../wasm-lib/kcl/bindings/PipeExpression'
|
||||
export type { VariableDeclaration } from '../wasm-lib/kcl/bindings/VariableDeclaration'
|
||||
export type { Parameter } from '../wasm-lib/kcl/bindings/Parameter'
|
||||
export type { PipeSubstitution } from '../wasm-lib/kcl/bindings/PipeSubstitution'
|
||||
export type { Identifier } from '../wasm-lib/kcl/bindings/Identifier'
|
||||
export type { UnaryExpression } from '../wasm-lib/kcl/bindings/UnaryExpression'
|
||||
|
@ -15,7 +15,11 @@ export const browserSaveFile = async (blob: Blob, suggestedName: string) => {
|
||||
}
|
||||
})()
|
||||
// If the File System Access API is supported…
|
||||
if (supportsFileSystemAccess && window.showSaveFilePicker) {
|
||||
if (
|
||||
supportsFileSystemAccess &&
|
||||
window.showSaveFilePicker &&
|
||||
!(window as any).playwrightSkipFilePicker
|
||||
) {
|
||||
try {
|
||||
// Show the file save dialog.
|
||||
const handle = await window.showSaveFilePicker({
|
||||
@ -30,8 +34,8 @@ export const browserSaveFile = async (blob: Blob, suggestedName: string) => {
|
||||
// Fail silently if the user has simply canceled the dialog.
|
||||
if (err.name !== 'AbortError') {
|
||||
console.error(err.name, err.message)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
// Fallback if the File System Access API is not supported…
|
||||
|
@ -34,7 +34,7 @@ export async function exportSave(data: ArrayBuffer) {
|
||||
// Create a new blob.
|
||||
const blob = new Blob([new Uint8Array(file.contents)])
|
||||
// Save the file.
|
||||
browserSaveFile(blob, file.name)
|
||||
await browserSaveFile(blob, file.name)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
@ -8,6 +8,9 @@ import { kclManager } from 'lang/KclSinglton'
|
||||
import { SelectionRange } from '@uiw/react-codemirror'
|
||||
import { isOverlap } from 'lib/utils'
|
||||
|
||||
export const X_AXIS_UUID = 'ad792545-7fd3-482a-a602-a93924e3055b'
|
||||
export const Y_AXIS_UUID = '680fd157-266f-4b8a-984f-cdf46b8bdf01'
|
||||
|
||||
/*
|
||||
How selections work is complex due to the nature that we rely on the engine
|
||||
to tell what has been selected after we send a click command. But than the
|
||||
@ -110,6 +113,15 @@ export async function getEventForSelectWithPoint(
|
||||
data: { selectionType: 'singleCodeCursor' },
|
||||
}
|
||||
}
|
||||
if ([X_AXIS_UUID, Y_AXIS_UUID].includes(data.entity_id)) {
|
||||
return {
|
||||
type: 'Set selection',
|
||||
data: {
|
||||
selectionType: 'otherSelection',
|
||||
selection: X_AXIS_UUID === data.entity_id ? 'x-axis' : 'y-axis',
|
||||
},
|
||||
}
|
||||
}
|
||||
const sourceRange = engineCommandManager.artifactMap[data.entity_id]?.range
|
||||
if (engineCommandManager.artifactMap[data.entity_id]) {
|
||||
return {
|
||||
@ -164,6 +176,7 @@ export function handleSelectionBatch({
|
||||
}): {
|
||||
selectionRangeTypeMap: SelectionRangeTypeMap
|
||||
codeMirrorSelection?: EditorSelection
|
||||
otherSelections: Axis[]
|
||||
} {
|
||||
const ranges: ReturnType<typeof EditorSelection.cursor>[] = []
|
||||
const selectionRangeTypeMap: SelectionRangeTypeMap = {}
|
||||
@ -180,43 +193,74 @@ export function handleSelectionBatch({
|
||||
ranges,
|
||||
selections.codeBasedSelections.length - 1
|
||||
),
|
||||
otherSelections: selections.otherSelections,
|
||||
}
|
||||
|
||||
return {
|
||||
selectionRangeTypeMap,
|
||||
otherSelections: selections.otherSelections,
|
||||
}
|
||||
}
|
||||
|
||||
export function handleSelectionWithShift({
|
||||
codeSelection,
|
||||
currestSelections,
|
||||
otherSelection,
|
||||
currentSelections,
|
||||
isShiftDown,
|
||||
}: {
|
||||
codeSelection?: Selection
|
||||
currestSelections: Selections
|
||||
otherSelection?: Axis
|
||||
currentSelections: Selections
|
||||
isShiftDown: boolean
|
||||
}): {
|
||||
selectionRangeTypeMap: SelectionRangeTypeMap
|
||||
otherSelections: Axis[]
|
||||
codeMirrorSelection?: EditorSelection
|
||||
} {
|
||||
const code = kclManager.code
|
||||
if (!codeSelection)
|
||||
if (codeSelection && otherSelection) {
|
||||
throw new Error('cannot have both code and other selection')
|
||||
}
|
||||
if (!codeSelection && !otherSelection) {
|
||||
return handleSelectionBatch({
|
||||
selections: {
|
||||
otherSelections: currestSelections.otherSelections,
|
||||
otherSelections: [],
|
||||
codeBasedSelections: [
|
||||
{
|
||||
range: [0, code.length ? code.length - 1 : 0],
|
||||
range: [0, code.length ? code.length : 0],
|
||||
type: 'default',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
}
|
||||
if (otherSelection) {
|
||||
console.log('otherSelection in handleSelectionWithShift', otherSelection)
|
||||
return handleSelectionBatch({
|
||||
selections: {
|
||||
codeBasedSelections: isShiftDown
|
||||
? currentSelections.codeBasedSelections
|
||||
: [
|
||||
{
|
||||
range: [0, code.length ? code.length : 0],
|
||||
type: 'default',
|
||||
},
|
||||
],
|
||||
otherSelections: [otherSelection],
|
||||
},
|
||||
})
|
||||
}
|
||||
const isEndOfFileDumbySelection =
|
||||
currentSelections.codeBasedSelections.length === 1 &&
|
||||
currentSelections.codeBasedSelections[0].range[0] === kclManager.code.length
|
||||
const newCodeBasedSelections = !isShiftDown
|
||||
? [codeSelection!]
|
||||
: isEndOfFileDumbySelection
|
||||
? [codeSelection!]
|
||||
: [...currentSelections.codeBasedSelections, codeSelection!]
|
||||
const selections: Selections = {
|
||||
...currestSelections,
|
||||
codeBasedSelections: isShiftDown
|
||||
? [...currestSelections.codeBasedSelections, codeSelection]
|
||||
: [codeSelection],
|
||||
otherSelections: isShiftDown ? currentSelections.otherSelections : [],
|
||||
codeBasedSelections: newCodeBasedSelections,
|
||||
}
|
||||
return handleSelectionBatch({ selections })
|
||||
}
|
||||
@ -227,10 +271,12 @@ export function processCodeMirrorRanges({
|
||||
codeMirrorRanges,
|
||||
selectionRanges,
|
||||
selectionRangeTypeMap,
|
||||
isShiftDown,
|
||||
}: {
|
||||
codeMirrorRanges: readonly SelectionRange[]
|
||||
selectionRanges: Selections
|
||||
selectionRangeTypeMap: SelectionRangeTypeMap
|
||||
isShiftDown: boolean
|
||||
}): null | {
|
||||
modelingEvent: ModelingMachineEvent
|
||||
engineEvents: Models['WebSocketRequest_type'][]
|
||||
@ -291,7 +337,7 @@ export function processCodeMirrorRanges({
|
||||
data: {
|
||||
selectionType: 'mirrorCodeMirrorSelections',
|
||||
selection: {
|
||||
...selectionRanges,
|
||||
otherSelections: isShiftDown ? selectionRanges.otherSelections : [],
|
||||
codeBasedSelections,
|
||||
},
|
||||
},
|
||||
@ -300,7 +346,7 @@ export function processCodeMirrorRanges({
|
||||
}
|
||||
}
|
||||
|
||||
export function resetAndSetEngineEntitySelectionCmds(
|
||||
function resetAndSetEngineEntitySelectionCmds(
|
||||
selections: SelectionToEngine[]
|
||||
): Models['WebSocketRequest_type'][] {
|
||||
if (!engineCommandManager.engineConnection?.isReady()) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -5,11 +5,15 @@
|
||||
'@@xstate/typegen': true;
|
||||
internalEvents: {
|
||||
"": { type: "" };
|
||||
"done.invoke.get-abs-x-info": { type: "done.invoke.get-abs-x-info"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.get-abs-y-info": { type: "done.invoke.get-abs-y-info"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.get-angle-info": { type: "done.invoke.get-angle-info"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.get-horizontal-info": { type: "done.invoke.get-horizontal-info"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.get-length-info": { type: "done.invoke.get-length-info"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.get-perpendicular-distance-info": { type: "done.invoke.get-perpendicular-distance-info"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"done.invoke.get-vertical-info": { type: "done.invoke.get-vertical-info"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
|
||||
"error.platform.get-abs-x-info": { type: "error.platform.get-abs-x-info"; data: unknown };
|
||||
"error.platform.get-abs-y-info": { type: "error.platform.get-abs-y-info"; data: unknown };
|
||||
"error.platform.get-angle-info": { type: "error.platform.get-angle-info"; data: unknown };
|
||||
"error.platform.get-horizontal-info": { type: "error.platform.get-horizontal-info"; data: unknown };
|
||||
"error.platform.get-length-info": { type: "error.platform.get-length-info"; data: unknown };
|
||||
@ -19,7 +23,9 @@
|
||||
"xstate.stop": { type: "xstate.stop" };
|
||||
};
|
||||
invokeSrcNameMap: {
|
||||
"Get angle info": "done.invoke.get-angle-info";
|
||||
"Get ABS X info": "done.invoke.get-abs-x-info";
|
||||
"Get ABS Y info": "done.invoke.get-abs-y-info";
|
||||
"Get angle info": "done.invoke.get-angle-info";
|
||||
"Get horizontal info": "done.invoke.get-horizontal-info";
|
||||
"Get length info": "done.invoke.get-length-info";
|
||||
"Get perpendicular distance info": "done.invoke.get-perpendicular-distance-info";
|
||||
@ -29,7 +35,7 @@
|
||||
actions: "AST add line segment" | "AST start new sketch" | "Modify AST" | "Set selection" | "Update code selection cursors" | "create path" | "set tool" | "show default planes" | "sketch exit execute" | "toast extrude failed";
|
||||
delays: never;
|
||||
guards: "Selection contains axis" | "Selection contains edge" | "Selection contains face" | "Selection contains line" | "Selection contains point" | "Selection is not empty" | "Selection is one face";
|
||||
services: "Get angle info" | "Get horizontal info" | "Get length info" | "Get perpendicular distance info" | "Get vertical info";
|
||||
services: "Get ABS X info" | "Get ABS Y info" | "Get angle info" | "Get horizontal info" | "Get length info" | "Get perpendicular distance info" | "Get vertical info";
|
||||
};
|
||||
eventsCausingActions: {
|
||||
"AST add line segment": "Add point";
|
||||
@ -42,19 +48,21 @@
|
||||
"Constrain horizontally align": "Constrain horizontally align";
|
||||
"Constrain parallel": "Constrain parallel";
|
||||
"Constrain remove constraints": "Constrain remove constraints";
|
||||
"Constrain snap to X": "Constrain snap to X";
|
||||
"Constrain snap to Y": "Constrain snap to Y";
|
||||
"Constrain vertically align": "Constrain vertically align";
|
||||
"Make selection horizontal": "Make segment horizontal";
|
||||
"Make selection vertical": "Make segment vertical";
|
||||
"Modify AST": "Complete line";
|
||||
"Remove from code-based selection": "Deselect edge" | "Deselect face" | "Deselect point";
|
||||
"Remove from other selection": "Deselect axis";
|
||||
"Set selection": "Set selection" | "done.invoke.get-angle-info" | "done.invoke.get-horizontal-info" | "done.invoke.get-length-info" | "done.invoke.get-perpendicular-distance-info" | "done.invoke.get-vertical-info";
|
||||
"Set selection": "Set selection" | "done.invoke.get-abs-x-info" | "done.invoke.get-abs-y-info" | "done.invoke.get-angle-info" | "done.invoke.get-horizontal-info" | "done.invoke.get-length-info" | "done.invoke.get-perpendicular-distance-info" | "done.invoke.get-vertical-info";
|
||||
"Update code selection cursors": "Complete line" | "Deselect all" | "Deselect axis" | "Deselect edge" | "Deselect face" | "Deselect point" | "Deselect segment" | "Select edge" | "Select face" | "Select point" | "Select segment";
|
||||
"create path": "Select default plane";
|
||||
"default_camera_disable_sketch_mode": "Cancel";
|
||||
"edit mode enter": "Enter sketch" | "Re-execute";
|
||||
"edit_mode_exit": "Cancel";
|
||||
"equip select": "CancelSketch" | "Constrain equal length" | "Constrain horizontally align" | "Constrain parallel" | "Constrain remove constraints" | "Constrain vertically align" | "Deselect point" | "Deselect segment" | "Enter sketch" | "Make segment horizontal" | "Make segment vertical" | "Re-execute" | "Select default plane" | "Select point" | "Select segment" | "Set selection" | "done.invoke.get-angle-info" | "done.invoke.get-horizontal-info" | "done.invoke.get-length-info" | "done.invoke.get-perpendicular-distance-info" | "done.invoke.get-vertical-info" | "error.platform.get-angle-info" | "error.platform.get-horizontal-info" | "error.platform.get-length-info" | "error.platform.get-perpendicular-distance-info" | "error.platform.get-vertical-info";
|
||||
"equip select": "CancelSketch" | "Constrain equal length" | "Constrain horizontally align" | "Constrain parallel" | "Constrain remove constraints" | "Constrain snap to X" | "Constrain snap to Y" | "Constrain vertically align" | "Deselect point" | "Deselect segment" | "Enter sketch" | "Make segment horizontal" | "Make segment vertical" | "Re-execute" | "Select default plane" | "Select point" | "Select segment" | "Set selection" | "done.invoke.get-abs-x-info" | "done.invoke.get-abs-y-info" | "done.invoke.get-angle-info" | "done.invoke.get-horizontal-info" | "done.invoke.get-length-info" | "done.invoke.get-perpendicular-distance-info" | "done.invoke.get-vertical-info" | "error.platform.get-abs-x-info" | "error.platform.get-abs-y-info" | "error.platform.get-angle-info" | "error.platform.get-horizontal-info" | "error.platform.get-length-info" | "error.platform.get-perpendicular-distance-info" | "error.platform.get-vertical-info";
|
||||
"hide default planes": "Cancel" | "Select default plane" | "xstate.stop";
|
||||
"reset sketch metadata": "Cancel" | "Select default plane";
|
||||
"set default plane id": "Select default plane";
|
||||
@ -73,6 +81,8 @@
|
||||
};
|
||||
eventsCausingGuards: {
|
||||
"Can canstrain parallel": "Constrain parallel";
|
||||
"Can constrain ABS X": "Constrain ABS X";
|
||||
"Can constrain ABS Y": "Constrain ABS Y";
|
||||
"Can constrain angle": "Constrain angle";
|
||||
"Can constrain equal length": "Constrain equal length";
|
||||
"Can constrain horizontal distance": "Constrain horizontal distance";
|
||||
@ -80,6 +90,8 @@
|
||||
"Can constrain length": "Constrain length";
|
||||
"Can constrain perpendicular distance": "Constrain perpendicular distance";
|
||||
"Can constrain remove constraints": "Constrain remove constraints";
|
||||
"Can constrain snap to X": "Constrain snap to X";
|
||||
"Can constrain snap to Y": "Constrain snap to Y";
|
||||
"Can constrain vertical distance": "Constrain vertical distance";
|
||||
"Can constrain vertically align": "Constrain vertically align";
|
||||
"Can make selection horizontal": "Make segment horizontal";
|
||||
@ -98,13 +110,15 @@
|
||||
"is editing existing sketch": "";
|
||||
};
|
||||
eventsCausingServices: {
|
||||
"Get angle info": "Constrain angle";
|
||||
"Get ABS X info": "Constrain ABS X";
|
||||
"Get ABS Y info": "Constrain ABS Y";
|
||||
"Get angle info": "Constrain angle";
|
||||
"Get horizontal info": "Constrain horizontal distance";
|
||||
"Get length info": "Constrain length";
|
||||
"Get perpendicular distance info": "Constrain perpendicular distance";
|
||||
"Get vertical info": "Constrain vertical distance";
|
||||
};
|
||||
matchesStates: "Sketch" | "Sketch no face" | "Sketch.Await angle info" | "Sketch.Await horizontal distance info" | "Sketch.Await length info" | "Sketch.Await perpendicular distance info" | "Sketch.Await vertical distance info" | "Sketch.Line Tool" | "Sketch.Line Tool.Done" | "Sketch.Line Tool.Init" | "Sketch.Line Tool.No Points" | "Sketch.Line Tool.Point Added" | "Sketch.Line Tool.Segment Added" | "Sketch.Move Tool" | "Sketch.Move Tool.Move init" | "Sketch.Move Tool.Move with execute" | "Sketch.Move Tool.Move without re-execute" | "Sketch.Move Tool.No move" | "Sketch.SketchIdle" | "awaiting selection" | "checking selection" | "idle" | { "Sketch"?: "Await angle info" | "Await horizontal distance info" | "Await length info" | "Await perpendicular distance info" | "Await vertical distance info" | "Line Tool" | "Move Tool" | "SketchIdle" | { "Line Tool"?: "Done" | "Init" | "No Points" | "Point Added" | "Segment Added";
|
||||
matchesStates: "Sketch" | "Sketch no face" | "Sketch.Await ABS X info" | "Sketch.Await ABS Y info" | "Sketch.Await angle info" | "Sketch.Await horizontal distance info" | "Sketch.Await length info" | "Sketch.Await perpendicular distance info" | "Sketch.Await vertical distance info" | "Sketch.Line Tool" | "Sketch.Line Tool.Done" | "Sketch.Line Tool.Init" | "Sketch.Line Tool.No Points" | "Sketch.Line Tool.Point Added" | "Sketch.Line Tool.Segment Added" | "Sketch.Move Tool" | "Sketch.Move Tool.Move init" | "Sketch.Move Tool.Move with execute" | "Sketch.Move Tool.Move without re-execute" | "Sketch.Move Tool.No move" | "Sketch.SketchIdle" | "awaiting selection" | "checking selection" | "idle" | { "Sketch"?: "Await ABS X info" | "Await ABS Y info" | "Await angle info" | "Await horizontal distance info" | "Await length info" | "Await perpendicular distance info" | "Await vertical distance info" | "Line Tool" | "Move Tool" | "SketchIdle" | { "Line Tool"?: "Done" | "Init" | "No Points" | "Point Added" | "Segment Added";
|
||||
"Move Tool"?: "Move init" | "Move with execute" | "Move without re-execute" | "No move"; }; };
|
||||
tags: never;
|
||||
}
|
||||
|
@ -255,6 +255,7 @@ const Home = () => {
|
||||
Element="button"
|
||||
onClick={() => send('Create project')}
|
||||
icon={{ icon: faPlus }}
|
||||
data-testid="home-new-file"
|
||||
>
|
||||
New file
|
||||
</ActionButton>
|
||||
|
@ -62,6 +62,7 @@ export default function Export() {
|
||||
Element="button"
|
||||
onClick={next}
|
||||
icon={{ icon: faArrowRight }}
|
||||
data-testid="onboarding-next"
|
||||
>
|
||||
Next: Sketching
|
||||
</ActionButton>
|
||||
|
@ -57,6 +57,7 @@ export default function Sketching() {
|
||||
Element="button"
|
||||
onClick={next}
|
||||
icon={{ icon: faArrowRight }}
|
||||
data-testid="onboarding-next"
|
||||
>
|
||||
Next: Future Work
|
||||
</ActionButton>
|
||||
|
@ -125,9 +125,9 @@ const Onboarding = () => {
|
||||
useHotkeys('esc', dismiss)
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="content" data-testid="onboarding-content">
|
||||
<Outlet />
|
||||
</>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ const SignIn = () => {
|
||||
onClick={signInTauri}
|
||||
icon={{ icon: faSignInAlt }}
|
||||
className="w-fit mt-4"
|
||||
id="signin"
|
||||
data-testid="sign-in-button"
|
||||
>
|
||||
Sign in
|
||||
</ActionButton>
|
||||
|
95
src/wasm-lib/Cargo.lock
generated
95
src/wasm-lib/Cargo.lock
generated
@ -447,9 +447,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.4.7"
|
||||
version = "4.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b"
|
||||
checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@ -457,9 +457,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.4.7"
|
||||
version = "4.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663"
|
||||
checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@ -683,21 +683,20 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
|
||||
|
||||
[[package]]
|
||||
name = "databake"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "959b676312ba1aaafb2219c475560082e6b20c3bc572ec1483f93cecd748cf3d"
|
||||
checksum = "82175d72e69414ceafbe2b49686794d3a8bed846e0d50267355f83ea8fdd953a"
|
||||
dependencies = [
|
||||
"databake-derive",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "databake-derive"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f0694dfe255f1af0289d3d1b40787bb955e8603d96e96a6b14b225926e108fb"
|
||||
checksum = "377af281d8f23663862a7c84623bc5dcf7f8c44b13c7496a590bdc157f941a43"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -823,6 +822,16 @@ dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "execution-plan"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"kittycad",
|
||||
"serde",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "expectorate"
|
||||
version = "1.1.0"
|
||||
@ -1383,9 +1392,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.11.0"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
|
||||
checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
@ -1427,7 +1436,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kcl-lib"
|
||||
version = "0.1.35"
|
||||
version = "0.1.40"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-recursion",
|
||||
@ -1441,7 +1450,7 @@ dependencies = [
|
||||
"expectorate",
|
||||
"futures",
|
||||
"insta",
|
||||
"itertools 0.11.0",
|
||||
"itertools 0.12.0",
|
||||
"js-sys",
|
||||
"kittycad",
|
||||
"lazy_static",
|
||||
@ -1463,11 +1472,23 @@ dependencies = [
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kcl-macros"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"databake",
|
||||
"kcl-lib",
|
||||
"pretty_assertions",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kittycad"
|
||||
version = "0.2.41"
|
||||
version = "0.2.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "874914cd40bfd43674406683bb3f0924d41780698a4ade96f2e180a73678bdd1"
|
||||
checksum = "41ab6de34cc4ab06519d65a613d4030ade14036ac619d8fee5ce6f35d1766c11"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -1772,7 +1793,7 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
|
||||
[[package]]
|
||||
name = "openapitor"
|
||||
version = "0.0.9"
|
||||
source = "git+https://github.com/KittyCAD/kittycad.rs?branch=main#1b2562f4b3ecd26a3683c3fc48a0d33707097a36"
|
||||
source = "git+https://github.com/KittyCAD/kittycad.rs?branch=main#920ba7c69fa167d74e4cc1be4f2ed96635893e89"
|
||||
dependencies = [
|
||||
"Inflector",
|
||||
"anyhow",
|
||||
@ -1942,7 +1963,7 @@ dependencies = [
|
||||
"bincode",
|
||||
"either",
|
||||
"fnv",
|
||||
"itertools 0.11.0",
|
||||
"itertools 0.10.5",
|
||||
"lazy_static",
|
||||
"nom",
|
||||
"quick-xml",
|
||||
@ -2081,9 +2102,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.69"
|
||||
version = "1.0.70"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
|
||||
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@ -2509,9 +2530,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "schemars"
|
||||
version = "0.8.15"
|
||||
version = "0.8.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c"
|
||||
checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29"
|
||||
dependencies = [
|
||||
"bigdecimal",
|
||||
"bytes",
|
||||
@ -2526,9 +2547,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "schemars_derive"
|
||||
version = "0.8.15"
|
||||
version = "0.8.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c"
|
||||
checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2583,9 +2604,9 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.192"
|
||||
version = "1.0.193"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001"
|
||||
checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@ -2601,9 +2622,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.192"
|
||||
version = "1.0.193"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1"
|
||||
checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3127,9 +3148,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.33.0"
|
||||
version = "1.34.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653"
|
||||
checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
@ -3146,9 +3167,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.1.0"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
|
||||
checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3536,9 +3557,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.5.0"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc"
|
||||
checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560"
|
||||
dependencies = [
|
||||
"atomic",
|
||||
"getrandom",
|
||||
@ -3616,9 +3637,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.37"
|
||||
version = "0.4.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
|
||||
checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-core",
|
||||
@ -3711,9 +3732,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.64"
|
||||
version = "0.3.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
|
||||
checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
|
@ -15,9 +15,9 @@ gloo-utils = "0.2.0"
|
||||
kcl-lib = { path = "kcl" }
|
||||
kittycad = { workspace = true }
|
||||
serde_json = "1.0.108"
|
||||
uuid = { version = "1.5.0", features = ["v4", "js", "serde"] }
|
||||
uuid = { version = "1.6.1", features = ["v4", "js", "serde"] }
|
||||
wasm-bindgen = "0.2.88"
|
||||
wasm-bindgen-futures = "0.4.37"
|
||||
wasm-bindgen-futures = "0.4.38"
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = "1"
|
||||
@ -25,9 +25,9 @@ image = "0.24.7"
|
||||
kittycad = { workspace = true, default-features = true }
|
||||
pretty_assertions = "1.4.0"
|
||||
reqwest = { version = "0.11.22", default-features = false }
|
||||
tokio = { version = "1.33.0", features = ["rt-multi-thread", "macros", "time"] }
|
||||
tokio = { version = "1.34.0", features = ["rt-multi-thread", "macros", "time"] }
|
||||
twenty-twenty = "0.6.1"
|
||||
uuid = { version = "1.5.0", features = ["v4", "js", "serde"] }
|
||||
uuid = { version = "1.6.1", features = ["v4", "js", "serde"] }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
futures = "0.3.29"
|
||||
@ -37,7 +37,7 @@ wasm-bindgen-futures = { version = "0.4.37", features = ["futures-core-03-stream
|
||||
wasm-streams = "0.4.0"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
|
||||
version = "0.3.57"
|
||||
version = "0.3.65"
|
||||
features = [
|
||||
"console",
|
||||
"HtmlTextAreaElement",
|
||||
@ -53,10 +53,12 @@ debug = true
|
||||
members = [
|
||||
"derive-docs",
|
||||
"kcl",
|
||||
"kcl-macros",
|
||||
"execution-plan",
|
||||
]
|
||||
|
||||
[workspace.dependencies]
|
||||
kittycad = { version = "0.2.41", default-features = false, features = ["js"] }
|
||||
kittycad = { version = "0.2.43", default-features = false, features = ["js"] }
|
||||
|
||||
[[test]]
|
||||
name = "executor"
|
||||
|
@ -16,7 +16,7 @@ proc-macro = true
|
||||
convert_case = "0.6.0"
|
||||
proc-macro2 = "1"
|
||||
quote = "1"
|
||||
serde = { version = "1.0.192", features = ["derive"] }
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
serde_tokenstream = "0.2"
|
||||
syn = { version = "2.0.39", features = ["full"] }
|
||||
|
||||
|
13
src/wasm-lib/execution-plan/Cargo.toml
Normal file
13
src/wasm-lib/execution-plan/Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "execution-plan"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
repository = "https://github.com/KittyCAD/modeling-app"
|
||||
rust-version = "1.73"
|
||||
description = "A DSL for composing KittyCAD API queries"
|
||||
|
||||
[dependencies]
|
||||
bytes = "1.5"
|
||||
kittycad = { workspace = true, features = ["requests"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
thiserror = "1"
|
27
src/wasm-lib/execution-plan/src/composite.rs
Normal file
27
src/wasm-lib/execution-plan/src/composite.rs
Normal file
@ -0,0 +1,27 @@
|
||||
use crate::{ExecutionError, NumericValue, Value};
|
||||
|
||||
/// Types that can be written to or read from KCEP program memory,
|
||||
/// but require multiple values to store.
|
||||
/// They get laid out into multiple consecutive memory addresses.
|
||||
pub trait Composite<const SIZE: usize>: Sized {
|
||||
/// Store the value in memory.
|
||||
fn into_parts(self) -> [Value; SIZE];
|
||||
/// Read the value from memory.
|
||||
fn from_parts(values: [Value; SIZE]) -> Result<Self, ExecutionError>;
|
||||
}
|
||||
|
||||
impl Composite<3> for kittycad::types::Point3D {
|
||||
fn into_parts(self) -> [Value; 3] {
|
||||
[self.x, self.y, self.z]
|
||||
.map(NumericValue::Float)
|
||||
.map(Value::NumericValue)
|
||||
}
|
||||
|
||||
fn from_parts(values: [Value; 3]) -> Result<Self, ExecutionError> {
|
||||
let [x, y, z] = values;
|
||||
let x = x.try_into()?;
|
||||
let y = y.try_into()?;
|
||||
let z = z.try_into()?;
|
||||
Ok(Self { x, y, z })
|
||||
}
|
||||
}
|
288
src/wasm-lib/execution-plan/src/lib.rs
Normal file
288
src/wasm-lib/execution-plan/src/lib.rs
Normal file
@ -0,0 +1,288 @@
|
||||
//! A KittyCAD execution plan (KCEP) is a list of
|
||||
//! - KittyCAD API requests to make
|
||||
//! - Values to send in API requests
|
||||
//! - Values to assign from API responses
|
||||
//! - Computation to perform on values
|
||||
//! You can think of it as a domain-specific language for making KittyCAD API calls and using
|
||||
//! the results to make other API calls.
|
||||
|
||||
use std::{collections::HashMap, fmt};
|
||||
|
||||
use composite::Composite;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
mod composite;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
/// KCEP's program memory. A flat, linear list of values.
|
||||
#[derive(Default, Debug)]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
pub struct Memory(HashMap<usize, Value>);
|
||||
|
||||
/// An address in KCEP's program memory.
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||
pub struct Address(usize);
|
||||
|
||||
impl fmt::Display for Address {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.0.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<usize> for Address {
|
||||
fn from(value: usize) -> Self {
|
||||
Self(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl Memory {
|
||||
/// Get a value from KCEP's program memory.
|
||||
pub fn get(&self, addr: &Address) -> Option<&Value> {
|
||||
self.0.get(&addr.0)
|
||||
}
|
||||
|
||||
/// Store a value in KCEP's program memory.
|
||||
pub fn set(&mut self, addr: Address, value: Value) {
|
||||
self.0.insert(addr.0, value);
|
||||
}
|
||||
|
||||
/// Store a composite value (i.e. a value which takes up multiple addresses in memory).
|
||||
/// Store its parts in consecutive memory addresses starting at `start`.
|
||||
pub fn set_composite<T: Composite<{ N }>, const N: usize>(&mut self, composite_value: T, start: Address) {
|
||||
let parts = composite_value.into_parts().into_iter();
|
||||
for (value, addr) in parts.zip(start.0..) {
|
||||
self.0.insert(addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// Get a composite value (i.e. a value which takes up multiple addresses in memory).
|
||||
/// Its parts are stored in consecutive memory addresses starting at `start`.
|
||||
pub fn get_composite<T: Composite<{ N }>, const N: usize>(&self, start: Address) -> Result<T, ExecutionError> {
|
||||
let addrs: [Address; N] = core::array::from_fn(|i| Address(i + start.0));
|
||||
let values: [Value; N] = arr_res_to_res_array(addrs.map(|addr| {
|
||||
self.get(&addr)
|
||||
.map(|x| x.to_owned())
|
||||
.ok_or(ExecutionError::MemoryEmpty { addr })
|
||||
}))?;
|
||||
|
||||
T::from_parts(values)
|
||||
}
|
||||
}
|
||||
|
||||
/// A value stored in KCEP program memory.
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub enum Value {
|
||||
String(String),
|
||||
NumericValue(NumericValue),
|
||||
}
|
||||
|
||||
impl TryFrom<Value> for f64 {
|
||||
type Error = ExecutionError;
|
||||
|
||||
fn try_from(value: Value) -> Result<Self, Self::Error> {
|
||||
if let Value::NumericValue(NumericValue::Float(x)) = value {
|
||||
Ok(x)
|
||||
} else {
|
||||
Err(ExecutionError::MemoryWrongType {
|
||||
expected: "float",
|
||||
actual: format!("{value:?}"),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl From<f64> for Value {
|
||||
fn from(value: f64) -> Self {
|
||||
Self::NumericValue(NumericValue::Float(value))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl From<usize> for Value {
|
||||
fn from(value: usize) -> Self {
|
||||
Self::NumericValue(NumericValue::Integer(value))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub enum NumericValue {
|
||||
Integer(usize),
|
||||
Float(f64),
|
||||
}
|
||||
|
||||
/// One step of the execution plan.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum Instruction {
|
||||
/// Call the KittyCAD API.
|
||||
ApiRequest {
|
||||
/// Which ModelingCmd to call.
|
||||
/// It's a composite value starting at the given address.
|
||||
endpoint: Address,
|
||||
/// Which address should the response be stored in?
|
||||
store_response: Option<usize>,
|
||||
/// Look up each API request in this register number.
|
||||
arguments: Vec<Address>,
|
||||
},
|
||||
/// Set a value in memory.
|
||||
Set {
|
||||
/// Which memory address to set.
|
||||
address: Address,
|
||||
/// What value to set the memory address to.
|
||||
value: Value,
|
||||
},
|
||||
/// Perform arithmetic on values in memory.
|
||||
Arithmetic {
|
||||
/// What to do.
|
||||
arithmetic: Arithmetic,
|
||||
/// Write the output to this memory address.
|
||||
destination: Address,
|
||||
},
|
||||
}
|
||||
|
||||
/// Instruction to perform arithmetic on values in memory.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct Arithmetic {
|
||||
/// Apply this operation
|
||||
pub operation: Operation,
|
||||
/// First operand for the operation
|
||||
pub operand0: Operand,
|
||||
/// Second operand for the operation
|
||||
pub operand1: Operand,
|
||||
}
|
||||
|
||||
macro_rules! arithmetic_body {
|
||||
($arith:ident, $mem:ident, $method:ident) => {
|
||||
match (
|
||||
$arith.operand0.eval(&$mem)?.clone(),
|
||||
$arith.operand1.eval(&$mem)?.clone(),
|
||||
) {
|
||||
// If both operands are numeric, then do the arithmetic operation.
|
||||
(Value::NumericValue(x), Value::NumericValue(y)) => {
|
||||
let num = match (x, y) {
|
||||
(NumericValue::Integer(x), NumericValue::Integer(y)) => NumericValue::Integer(x.$method(y)),
|
||||
(NumericValue::Integer(x), NumericValue::Float(y)) => NumericValue::Float((x as f64).$method(y)),
|
||||
(NumericValue::Float(x), NumericValue::Integer(y)) => NumericValue::Float(x.$method(y as f64)),
|
||||
(NumericValue::Float(x), NumericValue::Float(y)) => NumericValue::Float(x.$method(y)),
|
||||
};
|
||||
Ok(Value::NumericValue(num))
|
||||
}
|
||||
// This operation can only be done on numeric types.
|
||||
_ => Err(ExecutionError::CannotApplyOperation {
|
||||
op: $arith.operation,
|
||||
operands: vec![
|
||||
$arith.operand0.eval(&$mem)?.clone().to_owned(),
|
||||
$arith.operand1.eval(&$mem)?.clone().to_owned(),
|
||||
],
|
||||
}),
|
||||
}
|
||||
};
|
||||
}
|
||||
impl Arithmetic {
|
||||
/// Calculate the the arithmetic equation.
|
||||
/// May read values from the given memory.
|
||||
fn calculate(self, mem: &Memory) -> Result<Value, ExecutionError> {
|
||||
use std::ops::{Add, Div, Mul, Sub};
|
||||
match self.operation {
|
||||
Operation::Add => {
|
||||
arithmetic_body!(self, mem, add)
|
||||
}
|
||||
Operation::Mul => {
|
||||
arithmetic_body!(self, mem, mul)
|
||||
}
|
||||
Operation::Sub => {
|
||||
arithmetic_body!(self, mem, sub)
|
||||
}
|
||||
Operation::Div => {
|
||||
arithmetic_body!(self, mem, div)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Operations that can be applied to values in memory.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum Operation {
|
||||
Add,
|
||||
Mul,
|
||||
Sub,
|
||||
Div,
|
||||
}
|
||||
|
||||
impl fmt::Display for Operation {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Operation::Add => "+",
|
||||
Operation::Mul => "*",
|
||||
Operation::Sub => "-",
|
||||
Operation::Div => "/",
|
||||
}
|
||||
.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
/// Argument to an operation.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum Operand {
|
||||
Literal(Value),
|
||||
Reference(Address),
|
||||
}
|
||||
|
||||
impl Operand {
|
||||
/// Evaluate the operand, getting its value.
|
||||
fn eval(&self, mem: &Memory) -> Result<Value, ExecutionError> {
|
||||
match self {
|
||||
Operand::Literal(v) => Ok(v.to_owned()),
|
||||
Operand::Reference(addr) => match mem.get(addr) {
|
||||
None => Err(ExecutionError::MemoryEmpty { addr: *addr }),
|
||||
Some(v) => Ok(v.to_owned()),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Execute the plan.
|
||||
pub fn execute(mem: &mut Memory, plan: Vec<Instruction>) -> Result<(), ExecutionError> {
|
||||
for step in plan {
|
||||
match step {
|
||||
Instruction::ApiRequest { .. } => todo!("Execute API calls"),
|
||||
Instruction::Set { address, value } => {
|
||||
mem.set(address, value);
|
||||
}
|
||||
Instruction::Arithmetic {
|
||||
arithmetic,
|
||||
destination,
|
||||
} => {
|
||||
let out = arithmetic.calculate(mem)?;
|
||||
mem.set(destination, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Errors that could occur when executing a KittyCAD execution plan.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum ExecutionError {
|
||||
#[error("Memory address {addr} was not set")]
|
||||
MemoryEmpty { addr: Address },
|
||||
#[error("Cannot apply operation {op} to operands {operands:?}")]
|
||||
CannotApplyOperation { op: Operation, operands: Vec<Value> },
|
||||
#[error("Tried to read a '{expected}' from KCEP program memory, found an '{actual}' instead")]
|
||||
MemoryWrongType { expected: &'static str, actual: String },
|
||||
}
|
||||
|
||||
/// Take an array of result and return a result of array.
|
||||
/// If all members of the array are Ok(T), returns Ok with an array of the T values.
|
||||
/// If any member of the array was Err(E), return Err with the first E value.
|
||||
fn arr_res_to_res_array<T, E, const N: usize>(arr: [Result<T, E>; N]) -> Result<[T; N], E> {
|
||||
let mut out = core::array::from_fn(|_| None);
|
||||
for (i, res) in arr.into_iter().enumerate() {
|
||||
out[i] = match res {
|
||||
Ok(x) => Some(x),
|
||||
Err(e) => return Err(e),
|
||||
};
|
||||
}
|
||||
Ok(out.map(|opt| opt.unwrap()))
|
||||
}
|
94
src/wasm-lib/execution-plan/src/tests.rs
Normal file
94
src/wasm-lib/execution-plan/src/tests.rs
Normal file
@ -0,0 +1,94 @@
|
||||
use kittycad::types::Point3D;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn write_addr_to_memory() {
|
||||
let plan = vec![Instruction::Set {
|
||||
address: Address(0),
|
||||
value: 3.4.into(),
|
||||
}];
|
||||
let mut mem = Memory::default();
|
||||
execute(&mut mem, plan).unwrap();
|
||||
assert_eq!(mem.get(&Address(0)), Some(&3.4.into()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn add_literals() {
|
||||
let plan = vec![Instruction::Arithmetic {
|
||||
arithmetic: Arithmetic {
|
||||
operation: Operation::Add,
|
||||
operand0: Operand::Literal(3.into()),
|
||||
operand1: Operand::Literal(2.into()),
|
||||
},
|
||||
destination: Address(1),
|
||||
}];
|
||||
let mut mem = Memory::default();
|
||||
execute(&mut mem, plan).unwrap();
|
||||
assert_eq!(mem.get(&Address(1)), Some(&5.into()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn add_literal_to_reference() {
|
||||
let plan = vec![
|
||||
// Memory addr 0 contains 450
|
||||
Instruction::Set {
|
||||
address: Address(0),
|
||||
value: 450.into(),
|
||||
},
|
||||
// Add 20 to addr 0
|
||||
Instruction::Arithmetic {
|
||||
arithmetic: Arithmetic {
|
||||
operation: Operation::Add,
|
||||
operand0: Operand::Reference(Address(0)),
|
||||
operand1: Operand::Literal(20.into()),
|
||||
},
|
||||
destination: Address(1),
|
||||
},
|
||||
];
|
||||
// 20 + 450 = 470
|
||||
let mut mem = Memory::default();
|
||||
execute(&mut mem, plan).unwrap();
|
||||
assert_eq!(mem.get(&Address(1)), Some(&470.into()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn add_to_composite_value() {
|
||||
let mut mem = Memory::default();
|
||||
|
||||
// Write a point to memory.
|
||||
let point_before = Point3D { x: 2.0, y: 3.0, z: 4.0 };
|
||||
let start_addr = Address(100);
|
||||
mem.set_composite(point_before, start_addr);
|
||||
assert_eq!(
|
||||
mem,
|
||||
Memory(HashMap::from(
|
||||
[(100, 2.0.into()), (101, 3.0.into()), (102, 4.0.into()),]
|
||||
))
|
||||
);
|
||||
|
||||
// Update the point's x-value in memory.
|
||||
execute(
|
||||
&mut mem,
|
||||
vec![Instruction::Arithmetic {
|
||||
arithmetic: Arithmetic {
|
||||
operation: Operation::Add,
|
||||
operand0: Operand::Reference(start_addr),
|
||||
operand1: Operand::Literal(40.into()),
|
||||
},
|
||||
destination: start_addr,
|
||||
}],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Read the point out of memory, validate it.
|
||||
let point_after: Point3D = mem.get_composite(start_addr).unwrap();
|
||||
assert_eq!(
|
||||
point_after,
|
||||
Point3D {
|
||||
x: 42.0,
|
||||
y: 3.0,
|
||||
z: 4.0
|
||||
}
|
||||
)
|
||||
}
|
22
src/wasm-lib/kcl-macros/Cargo.toml
Normal file
22
src/wasm-lib/kcl-macros/Cargo.toml
Normal file
@ -0,0 +1,22 @@
|
||||
[package]
|
||||
name = "kcl-macros"
|
||||
description = "Macro for compiling KCL to its AST during Rust compile-time"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/KittyCAD/modeling-app"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
databake = "0.1.7"
|
||||
kcl-lib = { path = "../kcl" }
|
||||
proc-macro2 = "1"
|
||||
quote = "1"
|
||||
syn = { version = "2.0.39", features = ["full"] }
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "1.4.0"
|
23
src/wasm-lib/kcl-macros/src/lib.rs
Normal file
23
src/wasm-lib/kcl-macros/src/lib.rs
Normal file
@ -0,0 +1,23 @@
|
||||
//! This crate contains macros for parsing KCL at Rust compile-time.
|
||||
use databake::*;
|
||||
use proc_macro::TokenStream;
|
||||
use quote::quote;
|
||||
use syn::{parse_macro_input, LitStr};
|
||||
|
||||
/// Parses KCL into its AST at compile-time.
|
||||
/// This macro takes exactly one argument: A string literal containing KCL.
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// extern crate alloc;
|
||||
/// use kcl_compile_macro::parse_kcl;
|
||||
/// let ast: kcl_lib::ast::types::Program = parse_kcl!("const y = 4");
|
||||
/// ```
|
||||
#[proc_macro]
|
||||
pub fn parse(input: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(input as LitStr);
|
||||
let kcl_src = input.value();
|
||||
let tokens = kcl_lib::token::lexer(&kcl_src);
|
||||
let ast = kcl_lib::parser::Parser::new(tokens).ast().unwrap();
|
||||
let ast_struct = ast.bake(&Default::default());
|
||||
quote!(#ast_struct).into()
|
||||
}
|
38
src/wasm-lib/kcl-macros/tests/macro_test.rs
Normal file
38
src/wasm-lib/kcl-macros/tests/macro_test.rs
Normal file
@ -0,0 +1,38 @@
|
||||
extern crate alloc;
|
||||
use kcl_lib::ast::types::{
|
||||
BodyItem, Identifier, Literal, LiteralValue, NonCodeMeta, Program, Value, VariableDeclaration, VariableDeclarator,
|
||||
VariableKind,
|
||||
};
|
||||
use kcl_macros::parse;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn basic() {
|
||||
let actual = parse!("const y = 4");
|
||||
let expected = Program {
|
||||
start: 0,
|
||||
end: 11,
|
||||
body: vec![BodyItem::VariableDeclaration(VariableDeclaration {
|
||||
start: 0,
|
||||
end: 11,
|
||||
declarations: vec![VariableDeclarator {
|
||||
start: 6,
|
||||
end: 11,
|
||||
id: Identifier {
|
||||
start: 6,
|
||||
end: 7,
|
||||
name: "y".to_owned(),
|
||||
},
|
||||
init: Value::Literal(Box::new(Literal {
|
||||
start: 10,
|
||||
end: 11,
|
||||
value: LiteralValue::IInteger(4),
|
||||
raw: "4".to_owned(),
|
||||
})),
|
||||
}],
|
||||
kind: VariableKind::Const,
|
||||
})],
|
||||
non_code_meta: NonCodeMeta::default(),
|
||||
};
|
||||
assert_eq!(expected, actual);
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
[package]
|
||||
name = "kcl-lib"
|
||||
description = "KittyCAD Language"
|
||||
version = "0.1.35"
|
||||
description = "KittyCAD Language implementation and tools"
|
||||
version = "0.1.40"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/KittyCAD/modeling-app"
|
||||
rust-version = "1.73"
|
||||
authors = ["Jess Frazelle", "Adam Chalmers", "KittyCAD, Inc"]
|
||||
keywords = ["kcl", "KittyCAD", "CAD"]
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -13,34 +15,34 @@ rust-version = "1.73"
|
||||
anyhow = { version = "1.0.75", features = ["backtrace"] }
|
||||
async-recursion = "1.0.5"
|
||||
async-trait = "0.1.73"
|
||||
clap = { version = "4.4.7", features = ["cargo", "derive", "env", "unicode"], optional = true }
|
||||
clap = { version = "4.4.8", features = ["cargo", "derive", "env", "unicode"], optional = true }
|
||||
dashmap = "5.5.3"
|
||||
databake = { version = "0.1.6", features = ["derive"] }
|
||||
databake = { version = "0.1.7", features = ["derive"] }
|
||||
derive-docs = { version = "0.1.4" }
|
||||
#derive-docs = { path = "../derive-docs" }
|
||||
kittycad = { workspace = true }
|
||||
lazy_static = "1.4.0"
|
||||
parse-display = "0.8.2"
|
||||
schemars = { version = "0.8", features = ["impl_json_schema", "url", "uuid1"] }
|
||||
serde = { version = "1.0.192", features = ["derive"] }
|
||||
schemars = { version = "0.8.16", features = ["impl_json_schema", "url", "uuid1"] }
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
serde_json = "1.0.108"
|
||||
thiserror = "1.0.50"
|
||||
ts-rs = { version = "7", package = "ts-rs-json-value", features = ["serde-json-impl", "schemars-impl", "uuid-impl"] }
|
||||
uuid = { version = "1.5.0", features = ["v4", "js", "serde"] }
|
||||
uuid = { version = "1.6.1", features = ["v4", "js", "serde"] }
|
||||
winnow = "0.5.18"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
js-sys = { version = "0.3.65" }
|
||||
tower-lsp = { version = "0.20.0", default-features = false, features = ["runtime-agnostic"] }
|
||||
wasm-bindgen = "0.2.88"
|
||||
wasm-bindgen-futures = "0.4.37"
|
||||
web-sys = { version = "0.3.64", features = ["console"] }
|
||||
wasm-bindgen-futures = "0.4.38"
|
||||
web-sys = { version = "0.3.65", features = ["console"] }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
bson = { version = "2.7.0", features = ["uuid-1", "chrono"] }
|
||||
futures = { version = "0.3.29" }
|
||||
reqwest = { version = "0.11.22", default-features = false }
|
||||
tokio = { version = "1.33.0", features = ["full"] }
|
||||
tokio = { version = "1.34.0", features = ["full"] }
|
||||
tokio-tungstenite = { version = "0.20.0", features = ["rustls-tls-native-roots"] }
|
||||
tower-lsp = { version = "0.20.0", features = ["proposed"] }
|
||||
|
||||
@ -60,9 +62,9 @@ debug = true # Flamegraphs of benchmarks require accurate debug symbols
|
||||
criterion = "0.5.1"
|
||||
expectorate = "1.1.0"
|
||||
insta = { version = "1.34.0", features = ["json"] }
|
||||
itertools = "0.11.0"
|
||||
itertools = "0.12.0"
|
||||
pretty_assertions = "1.4.0"
|
||||
tokio = { version = "1.33.0", features = ["rt-multi-thread", "macros", "time"] }
|
||||
tokio = { version = "1.34.0", features = ["rt-multi-thread", "macros", "time"] }
|
||||
|
||||
[[bench]]
|
||||
name = "compiler_benchmark"
|
||||
|
@ -22,7 +22,7 @@ use crate::{
|
||||
mod literal_value;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Program {
|
||||
@ -221,11 +221,11 @@ impl Program {
|
||||
if let Some(Value::FunctionExpression(ref mut function_expression)) = &mut value {
|
||||
// Check if the params to the function expression contain the position.
|
||||
for param in &mut function_expression.params {
|
||||
let param_source_range: SourceRange = param.clone().into();
|
||||
let param_source_range: SourceRange = (¶m.identifier).into();
|
||||
if param_source_range.contains(pos) {
|
||||
let old_name = param.name.clone();
|
||||
let old_name = param.identifier.name.clone();
|
||||
// Rename the param.
|
||||
param.rename(&old_name, new_name);
|
||||
param.identifier.rename(&old_name, new_name);
|
||||
// Now rename all the identifiers in the rest of the program.
|
||||
function_expression.body.rename_identifiers(&old_name, new_name);
|
||||
return;
|
||||
@ -352,7 +352,7 @@ macro_rules! impl_value_meta {
|
||||
pub(crate) use impl_value_meta;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum BodyItem {
|
||||
@ -392,7 +392,7 @@ impl From<&BodyItem> for SourceRange {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum Value {
|
||||
@ -556,7 +556,7 @@ impl From<&Value> for SourceRange {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum BinaryPart {
|
||||
@ -713,7 +713,7 @@ impl BinaryPart {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct NonCodeNode {
|
||||
@ -762,7 +762,7 @@ impl NonCodeNode {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum CommentStyle {
|
||||
@ -773,7 +773,7 @@ pub enum CommentStyle {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type", rename_all = "camelCase")]
|
||||
pub enum NonCodeValue {
|
||||
@ -810,7 +810,8 @@ pub enum NonCodeValue {
|
||||
NewLine,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||
#[derive(Debug, Default, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct NonCodeMeta {
|
||||
@ -818,19 +819,6 @@ pub struct NonCodeMeta {
|
||||
pub start: Vec<NonCodeNode>,
|
||||
}
|
||||
|
||||
impl Bake for NonCodeMeta {
|
||||
fn bake(&self, env: &CrateEnv) -> TokenStream {
|
||||
env.insert("kcl_lib");
|
||||
let start = self.start.bake(env);
|
||||
databake::quote! {
|
||||
kcl_lib::NonCodeMeta {
|
||||
non_code_nodes: HashMap::new(),
|
||||
start: #start,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// implement Deserialize manually because we to force the keys of non_code_nodes to be usize
|
||||
// and by default the ts type { [statementIndex: number]: NonCodeNode } serializes to a string i.e. "0", "1", etc.
|
||||
impl<'de> Deserialize<'de> for NonCodeMeta {
|
||||
@ -865,7 +853,7 @@ impl NonCodeMeta {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct ExpressionStatement {
|
||||
@ -877,7 +865,7 @@ pub struct ExpressionStatement {
|
||||
impl_value_meta!(ExpressionStatement);
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct CallExpression {
|
||||
@ -1014,7 +1002,11 @@ impl CallExpression {
|
||||
// Add the arguments to the memory.
|
||||
let mut fn_memory = memory.clone();
|
||||
for (index, param) in function_expression.params.iter().enumerate() {
|
||||
fn_memory.add(¶m.name, fn_args.get(index).unwrap().clone(), param.into())?;
|
||||
fn_memory.add(
|
||||
¶m.identifier.name,
|
||||
fn_args.get(index).unwrap().clone(),
|
||||
param.identifier.clone().into(),
|
||||
)?;
|
||||
}
|
||||
|
||||
// Call the stdlib function
|
||||
@ -1146,7 +1138,7 @@ impl PartialEq for Function {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct VariableDeclaration {
|
||||
@ -1249,10 +1241,10 @@ impl VariableDeclaration {
|
||||
symbol_kind = SymbolKind::FUNCTION;
|
||||
let mut children = vec![];
|
||||
for param in &function_expression.params {
|
||||
let param_source_range: SourceRange = param.into();
|
||||
let param_source_range: SourceRange = (¶m.identifier).into();
|
||||
#[allow(deprecated)]
|
||||
children.push(DocumentSymbol {
|
||||
name: param.name.clone(),
|
||||
name: param.identifier.name.clone(),
|
||||
detail: None,
|
||||
kind: SymbolKind::VARIABLE,
|
||||
range: param_source_range.to_lsp_range(code),
|
||||
@ -1297,7 +1289,7 @@ impl VariableDeclaration {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, FromStr, Display, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[display(style = "snake_case")]
|
||||
@ -1342,7 +1334,7 @@ impl VariableKind {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct VariableDeclarator {
|
||||
@ -1372,7 +1364,7 @@ impl VariableDeclarator {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct Literal {
|
||||
@ -1442,8 +1434,8 @@ impl From<&Box<Literal>> for MemoryItem {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake, Eq)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct Identifier {
|
||||
@ -1480,7 +1472,7 @@ impl Identifier {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct PipeSubstitution {
|
||||
@ -1509,7 +1501,7 @@ impl From<PipeSubstitution> for Value {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct ArrayExpression {
|
||||
@ -1670,7 +1662,7 @@ impl ArrayExpression {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct ObjectExpression {
|
||||
@ -1828,7 +1820,7 @@ impl ObjectExpression {
|
||||
impl_value_meta!(ObjectExpression);
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct ObjectProperty {
|
||||
@ -1871,7 +1863,7 @@ impl ObjectProperty {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum MemberObject {
|
||||
@ -1918,7 +1910,7 @@ impl From<&MemberObject> for SourceRange {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum LiteralIdentifier {
|
||||
@ -1955,7 +1947,7 @@ impl From<&LiteralIdentifier> for SourceRange {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct MemberExpression {
|
||||
@ -2119,7 +2111,7 @@ pub struct ObjectKeyInfo {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct BinaryExpression {
|
||||
@ -2299,7 +2291,7 @@ pub fn parse_json_value_as_string(j: &serde_json::Value) -> Option<String> {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, FromStr, Display, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[display(style = "snake_case")]
|
||||
@ -2368,7 +2360,7 @@ impl BinaryOperator {
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct UnaryExpression {
|
||||
@ -2447,7 +2439,7 @@ impl UnaryExpression {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, FromStr, Display, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[display(style = "snake_case")]
|
||||
@ -2463,7 +2455,7 @@ pub enum UnaryOperator {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "camelCase", tag = "type")]
|
||||
pub struct PipeExpression {
|
||||
@ -2621,14 +2613,26 @@ async fn execute_pipe_body(
|
||||
}
|
||||
}
|
||||
|
||||
/// Parameter of a KCL function.
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct Parameter {
|
||||
/// The parameter's label or name.
|
||||
pub identifier: Identifier,
|
||||
/// Is the parameter optional?
|
||||
pub optional: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct FunctionExpression {
|
||||
pub start: usize,
|
||||
pub end: usize,
|
||||
pub params: Vec<Identifier>,
|
||||
pub params: Vec<Parameter>,
|
||||
pub body: Program,
|
||||
}
|
||||
|
||||
@ -2654,7 +2658,7 @@ impl FunctionExpression {
|
||||
"({}) => {{\n{}{}\n}}",
|
||||
self.params
|
||||
.iter()
|
||||
.map(|param| param.name.clone())
|
||||
.map(|param| param.identifier.name.clone())
|
||||
.collect::<Vec<String>>()
|
||||
.join(", "),
|
||||
options.get_indentation(indentation_level + 1),
|
||||
@ -2673,7 +2677,7 @@ impl FunctionExpression {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct ReturnStatement {
|
||||
|
@ -6,7 +6,7 @@ use serde_json::Value as JValue;
|
||||
use super::{Literal, Value};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
#[serde(untagged, rename_all = "snake_case")]
|
||||
pub enum LiteralValue {
|
||||
|
@ -69,7 +69,16 @@ impl EngineConnection {
|
||||
async fn start_write_actor(mut tcp_write: WebSocketTcpWrite, mut engine_req_rx: mpsc::Receiver<ToEngineReq>) {
|
||||
while let Some(req) = engine_req_rx.recv().await {
|
||||
let ToEngineReq { req, request_sent } = req;
|
||||
let res = Self::inner_send_to_engine(req, &mut tcp_write).await;
|
||||
let res = if let kittycad::types::WebSocketRequest::ModelingCmdReq { cmd, cmd_id: _ } = &req {
|
||||
if let kittycad::types::ModelingCmd::ImportFiles { .. } = cmd {
|
||||
// Send it as binary.
|
||||
Self::inner_send_to_engine_binary(req, &mut tcp_write).await
|
||||
} else {
|
||||
Self::inner_send_to_engine(req, &mut tcp_write).await
|
||||
}
|
||||
} else {
|
||||
Self::inner_send_to_engine(req, &mut tcp_write).await
|
||||
};
|
||||
let _ = request_sent.send(res);
|
||||
}
|
||||
}
|
||||
@ -84,15 +93,21 @@ impl EngineConnection {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Send the given `request` to the engine via the WebSocket connection `tcp_write` as binary.
|
||||
async fn inner_send_to_engine_binary(request: WebSocketRequest, tcp_write: &mut WebSocketTcpWrite) -> Result<()> {
|
||||
let msg = bson::to_vec(&request).map_err(|e| anyhow!("could not serialize bson: {e}"))?;
|
||||
tcp_write
|
||||
.send(WsMsg::Binary(msg))
|
||||
.await
|
||||
.map_err(|e| anyhow!("could not send json over websocket: {e}"))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn new(ws: reqwest::Upgraded) -> Result<EngineConnection> {
|
||||
let ws_stream = tokio_tungstenite::WebSocketStream::from_raw_socket(
|
||||
ws,
|
||||
tokio_tungstenite::tungstenite::protocol::Role::Client,
|
||||
Some(tokio_tungstenite::tungstenite::protocol::WebSocketConfig {
|
||||
write_buffer_size: 1024 * 128,
|
||||
max_write_buffer_size: 1024 * 256,
|
||||
..Default::default()
|
||||
}),
|
||||
Some(tokio_tungstenite::tungstenite::protocol::WebSocketConfig { ..Default::default() }),
|
||||
)
|
||||
.await;
|
||||
|
||||
@ -191,7 +206,7 @@ impl EngineManager for EngineConnection {
|
||||
}
|
||||
|
||||
Err(KclError::Engine(KclErrorDetails {
|
||||
message: format!("Modeling command timed out `{}`: {:?}", id, cmd),
|
||||
message: format!("Modeling command timed out `{}`", id),
|
||||
source_ranges: vec![source_range],
|
||||
}))
|
||||
}
|
||||
|
@ -908,9 +908,9 @@ pub async fn execute(
|
||||
// Add the arguments to the memory.
|
||||
for (index, param) in function_expression.params.iter().enumerate() {
|
||||
fn_memory.add(
|
||||
¶m.name,
|
||||
¶m.identifier.name,
|
||||
args.get(index).unwrap().clone(),
|
||||
param.into(),
|
||||
(¶m.identifier).into(),
|
||||
)?;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
//! Rust support for KCL (aka the KittyCAD Language).
|
||||
//!
|
||||
//! KCL is written in Rust. This crate contains the compiler tooling (e.g. parser, lexer, code generation),
|
||||
//! the standard library implementation, a LSP implementation, generator for the docs, and more.
|
||||
#![recursion_limit = "1024"]
|
||||
|
||||
pub mod ast;
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
ast::types::Program,
|
||||
errors::KclError,
|
||||
errors::KclErrorDetails,
|
||||
errors::{KclError, KclErrorDetails},
|
||||
executor::SourceRange,
|
||||
token::{Token, TokenType},
|
||||
};
|
||||
|
@ -117,9 +117,8 @@ impl From<BinaryOperator> for BinaryExpressionToken {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::ast::types::Literal;
|
||||
|
||||
use super::*;
|
||||
use crate::ast::types::Literal;
|
||||
|
||||
#[test]
|
||||
fn parse_and_evaluate() {
|
||||
|
@ -12,7 +12,7 @@ use crate::{
|
||||
ArrayExpression, BinaryExpression, BinaryOperator, BinaryPart, BodyItem, CallExpression, CommentStyle,
|
||||
ExpressionStatement, FunctionExpression, Identifier, Literal, LiteralIdentifier, LiteralValue,
|
||||
MemberExpression, MemberObject, NonCodeMeta, NonCodeNode, NonCodeValue, ObjectExpression, ObjectProperty,
|
||||
PipeExpression, PipeSubstitution, Program, ReturnStatement, UnaryExpression, UnaryOperator, Value,
|
||||
Parameter, PipeExpression, PipeSubstitution, Program, ReturnStatement, UnaryExpression, UnaryOperator, Value,
|
||||
VariableDeclaration, VariableDeclarator, VariableKind,
|
||||
},
|
||||
errors::{KclError, KclErrorDetails},
|
||||
@ -1208,26 +1208,62 @@ fn arguments(i: TokenSlice) -> PResult<Vec<Value>> {
|
||||
.parse_next(i)
|
||||
}
|
||||
|
||||
fn not_close_paren(i: TokenSlice) -> PResult<Token> {
|
||||
fn required_param(i: TokenSlice) -> PResult<Token> {
|
||||
any.verify(|token: &Token| !matches!(token.token_type, TokenType::Brace) || token.value != ")")
|
||||
.parse_next(i)
|
||||
}
|
||||
|
||||
fn optional_param(i: TokenSlice) -> PResult<Token> {
|
||||
let token = required_param.parse_next(i)?;
|
||||
let _question_mark = one_of(TokenType::QuestionMark).parse_next(i)?;
|
||||
Ok(token)
|
||||
}
|
||||
|
||||
/// Parameters are declared in a function signature, and used within a function.
|
||||
fn parameters(i: TokenSlice) -> PResult<Vec<Identifier>> {
|
||||
fn parameters(i: TokenSlice) -> PResult<Vec<Parameter>> {
|
||||
// Get all tokens until the next ), because that ends the parameter list.
|
||||
let candidates: Vec<Token> = separated(0.., not_close_paren, comma_sep)
|
||||
.context(expected("function parameters"))
|
||||
.parse_next(i)?;
|
||||
let candidates: Vec<_> = separated(
|
||||
0..,
|
||||
alt((optional_param.map(|t| (t, true)), required_param.map(|t| (t, false)))),
|
||||
comma_sep,
|
||||
)
|
||||
.context(expected("function parameters"))
|
||||
.parse_next(i)?;
|
||||
|
||||
// Make sure all those tokens are valid parameters.
|
||||
let params = candidates
|
||||
let params: Vec<Parameter> = candidates
|
||||
.into_iter()
|
||||
.map(|token| Identifier::try_from(token).and_then(Identifier::into_valid_binding_name))
|
||||
.map(|(token, optional)| {
|
||||
let identifier = Identifier::try_from(token).and_then(Identifier::into_valid_binding_name)?;
|
||||
Ok(Parameter { identifier, optional })
|
||||
})
|
||||
.collect::<Result<_, _>>()
|
||||
.map_err(|e| ErrMode::Backtrack(ContextError::from(e)))?;
|
||||
.map_err(|e: KclError| ErrMode::Backtrack(ContextError::from(e)))?;
|
||||
|
||||
// Make sure optional parameters are last.
|
||||
if let Err(e) = optional_after_required(¶ms) {
|
||||
return Err(ErrMode::Cut(ContextError::from(e)));
|
||||
}
|
||||
Ok(params)
|
||||
}
|
||||
|
||||
fn optional_after_required(params: &[Parameter]) -> Result<(), KclError> {
|
||||
let mut found_optional = false;
|
||||
for p in params {
|
||||
if p.optional {
|
||||
found_optional = true;
|
||||
}
|
||||
if !p.optional && found_optional {
|
||||
let e = KclError::Syntax(KclErrorDetails {
|
||||
source_ranges: vec![(&p.identifier).into()],
|
||||
message: "mandatory parameters must be declared before optional parameters".to_owned(),
|
||||
});
|
||||
return Err(e);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl Identifier {
|
||||
fn into_valid_binding_name(self) -> Result<Identifier, KclError> {
|
||||
// Make sure they are not assigning a variable to a stdlib function.
|
||||
@ -1895,7 +1931,7 @@ const mySk1 = startSketchAt([0, 0])"#;
|
||||
let tokens = crate::token::lexer(input);
|
||||
let actual = parameters.parse(&tokens);
|
||||
assert!(actual.is_ok(), "could not parse test {i}");
|
||||
let actual_ids: Vec<_> = actual.unwrap().into_iter().map(|id| id.name).collect();
|
||||
let actual_ids: Vec<_> = actual.unwrap().into_iter().map(|p| p.identifier.name).collect();
|
||||
assert_eq!(actual_ids, expected);
|
||||
}
|
||||
}
|
||||
@ -2322,6 +2358,82 @@ e
|
||||
assert!(result.err().unwrap().to_string().contains("Unexpected token"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_optional_param_order() {
|
||||
for (i, (params, expect_ok)) in [
|
||||
(
|
||||
vec![Parameter {
|
||||
identifier: Identifier {
|
||||
start: 0,
|
||||
end: 0,
|
||||
name: "a".to_owned(),
|
||||
},
|
||||
optional: true,
|
||||
}],
|
||||
true,
|
||||
),
|
||||
(
|
||||
vec![Parameter {
|
||||
identifier: Identifier {
|
||||
start: 0,
|
||||
end: 0,
|
||||
name: "a".to_owned(),
|
||||
},
|
||||
optional: false,
|
||||
}],
|
||||
true,
|
||||
),
|
||||
(
|
||||
vec![
|
||||
Parameter {
|
||||
identifier: Identifier {
|
||||
start: 0,
|
||||
end: 0,
|
||||
name: "a".to_owned(),
|
||||
},
|
||||
optional: false,
|
||||
},
|
||||
Parameter {
|
||||
identifier: Identifier {
|
||||
start: 0,
|
||||
end: 0,
|
||||
name: "b".to_owned(),
|
||||
},
|
||||
optional: true,
|
||||
},
|
||||
],
|
||||
true,
|
||||
),
|
||||
(
|
||||
vec![
|
||||
Parameter {
|
||||
identifier: Identifier {
|
||||
start: 0,
|
||||
end: 0,
|
||||
name: "a".to_owned(),
|
||||
},
|
||||
optional: true,
|
||||
},
|
||||
Parameter {
|
||||
identifier: Identifier {
|
||||
start: 0,
|
||||
end: 0,
|
||||
name: "b".to_owned(),
|
||||
},
|
||||
optional: false,
|
||||
},
|
||||
],
|
||||
false,
|
||||
),
|
||||
]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
{
|
||||
let actual = optional_after_required(¶ms);
|
||||
assert_eq!(actual.is_ok(), expect_ok, "failed test {i}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_expand_array() {
|
||||
let code = "const myArray = [0..10]";
|
||||
@ -2801,4 +2913,5 @@ mod snapshot_tests {
|
||||
snapshot_test!(ar, r#"5 + "a""#);
|
||||
snapshot_test!(at, "line([0, l], %)");
|
||||
snapshot_test!(au, include_str!("../../../tests/executor/inputs/cylinder.kcl"));
|
||||
snapshot_test!(av, "fn f = (angle?) => { return default(angle, 360) }");
|
||||
}
|
||||
|
@ -29,10 +29,14 @@ expression: actual
|
||||
"end": 49,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 12,
|
||||
"end": 17,
|
||||
"name": "param"
|
||||
"type": "Parameter",
|
||||
"identifier": {
|
||||
"type": "Identifier",
|
||||
"start": 12,
|
||||
"end": 17,
|
||||
"name": "param"
|
||||
},
|
||||
"optional": false
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
|
@ -0,0 +1,98 @@
|
||||
---
|
||||
source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 49,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 49,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 3,
|
||||
"end": 49,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 3,
|
||||
"end": 4,
|
||||
"name": "f"
|
||||
},
|
||||
"init": {
|
||||
"type": "FunctionExpression",
|
||||
"type": "FunctionExpression",
|
||||
"start": 7,
|
||||
"end": 49,
|
||||
"params": [
|
||||
{
|
||||
"type": "Parameter",
|
||||
"identifier": {
|
||||
"type": "Identifier",
|
||||
"start": 8,
|
||||
"end": 13,
|
||||
"name": "angle"
|
||||
},
|
||||
"optional": true
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"start": 19,
|
||||
"end": 49,
|
||||
"body": [
|
||||
{
|
||||
"type": "ReturnStatement",
|
||||
"type": "ReturnStatement",
|
||||
"start": 21,
|
||||
"end": 47,
|
||||
"argument": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 28,
|
||||
"end": 47,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 28,
|
||||
"end": 35,
|
||||
"name": "default"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"start": 36,
|
||||
"end": 41,
|
||||
"name": "angle"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 43,
|
||||
"end": 46,
|
||||
"value": 360,
|
||||
"raw": "360"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {},
|
||||
"start": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "fn"
|
||||
}
|
||||
],
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {},
|
||||
"start": []
|
||||
}
|
||||
}
|
@ -4,14 +4,13 @@ use anyhow::Result;
|
||||
use derive_docs::stdlib;
|
||||
use schemars::JsonSchema;
|
||||
|
||||
use super::utils::between;
|
||||
use crate::{
|
||||
errors::{KclError, KclErrorDetails},
|
||||
executor::{MemoryItem, SketchGroup},
|
||||
std::Args,
|
||||
};
|
||||
|
||||
use super::utils::between;
|
||||
|
||||
/// Returns the segment end of x.
|
||||
pub async fn segment_end_x(args: Args) -> Result<MemoryItem, KclError> {
|
||||
let (segment_name, sketch_group) = args.get_segment_name_sketch_group()?;
|
||||
|
@ -47,6 +47,8 @@ pub enum TokenType {
|
||||
Function,
|
||||
/// Unknown lexemes.
|
||||
Unknown,
|
||||
/// The ? symbol, used for optional values.
|
||||
QuestionMark,
|
||||
}
|
||||
|
||||
/// Most KCL tokens correspond to LSP semantic tokens (but not all).
|
||||
@ -58,6 +60,7 @@ impl TryFrom<TokenType> for SemanticTokenType {
|
||||
TokenType::Word => Self::VARIABLE,
|
||||
TokenType::Keyword => Self::KEYWORD,
|
||||
TokenType::Operator => Self::OPERATOR,
|
||||
TokenType::QuestionMark => Self::OPERATOR,
|
||||
TokenType::String => Self::STRING,
|
||||
TokenType::LineComment => Self::COMMENT,
|
||||
TokenType::BlockComment => Self::COMMENT,
|
||||
|
@ -21,6 +21,7 @@ pub fn token(i: &mut Located<&str>) -> PResult<Token> {
|
||||
'{' | '(' | '[' => brace_start,
|
||||
'}' | ')' | ']' => brace_end,
|
||||
',' => comma,
|
||||
'?' => question_mark,
|
||||
'0'..='9' => number,
|
||||
':' => colon,
|
||||
'.' => alt((number, double_period, period)),
|
||||
@ -108,6 +109,11 @@ fn comma(i: &mut Located<&str>) -> PResult<Token> {
|
||||
Ok(Token::from_range(range, TokenType::Comma, value.to_string()))
|
||||
}
|
||||
|
||||
fn question_mark(i: &mut Located<&str>) -> PResult<Token> {
|
||||
let (value, range) = '?'.with_span().parse_next(i)?;
|
||||
Ok(Token::from_range(range, TokenType::QuestionMark, value.to_string()))
|
||||
}
|
||||
|
||||
fn colon(i: &mut Located<&str>) -> PResult<Token> {
|
||||
let (value, range) = ':'.with_span().parse_next(i)?;
|
||||
Ok(Token::from_range(range, TokenType::Colon, value.to_string()))
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 87 KiB |
@ -4,7 +4,7 @@
|
||||
"paths": {
|
||||
"/*": ["src/*"]
|
||||
},
|
||||
"types": ["vite/client", "@types/wicg-file-system-access"],
|
||||
"types": ["vite/client", "@types/wicg-file-system-access", "node", "@wdio/globals/types"],
|
||||
"target": "esnext",
|
||||
"lib": [
|
||||
"dom",
|
||||
@ -26,7 +26,8 @@
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
"src",
|
||||
"e2e"
|
||||
],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import react from '@vitejs/plugin-react'
|
||||
import viteTsconfigPaths from 'vite-tsconfig-paths'
|
||||
import eslint from 'vite-plugin-eslint'
|
||||
import dns from 'dns'
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import { defineConfig, configDefaults } from 'vitest/config';
|
||||
|
||||
// Only needed because we run Node < 17
|
||||
// and we want to open `localhost` not `127.0.0.1` on server start
|
||||
@ -21,6 +21,7 @@ const config = defineConfig({
|
||||
coverage: {
|
||||
provider: 'istanbul' // or 'v8'
|
||||
},
|
||||
exclude: [...configDefaults.exclude, '**/e2e/playwright/**/*'],
|
||||
},
|
||||
build: {
|
||||
outDir: 'build',
|
||||
|
@ -1,19 +1,15 @@
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const { spawn } = require('child_process')
|
||||
import os from 'os'
|
||||
import path from 'path'
|
||||
import { spawn, ChildProcess } from 'child_process'
|
||||
|
||||
let tauriDriver: ChildProcess
|
||||
|
||||
|
||||
// keep track of the `tauri-driver` child process
|
||||
let tauriDriver
|
||||
|
||||
const mode = process.env.MODE
|
||||
const application =
|
||||
process.env.E2E_APPLICATION || `./src-tauri/target/${mode}/kittycad-modeling`
|
||||
process.env.E2E_APPLICATION || `./src-tauri/target/release/kittycad-modeling`
|
||||
|
||||
exports.config = {
|
||||
export const config = {
|
||||
port: 4444,
|
||||
specs: ['./e2e/tauri/specs/**/*.js'],
|
||||
specs: ['./e2e/tauri/specs/**/*.ts'],
|
||||
maxInstances: 1,
|
||||
capabilities: [
|
||||
{
|
Reference in New Issue
Block a user