Compare commits
8 Commits
v1.0.7
...
api-deux-p
Author | SHA1 | Date | |
---|---|---|---|
48beef4ae5 | |||
f49cf8281c | |||
7de27c648f | |||
344fb6f84d | |||
df808b3e58 | |||
e1ab6bbc48 | |||
0a1f35b89a | |||
78278d6889 |
2
.github/workflows/build-apps.yml
vendored
2
.github/workflows/build-apps.yml
vendored
@ -362,7 +362,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Authenticate to Google Cloud
|
- name: Authenticate to Google Cloud
|
||||||
if: ${{ env.IS_STAGING == 'true' }}
|
if: ${{ env.IS_STAGING == 'true' }}
|
||||||
uses: 'google-github-actions/auth@v2.1.8'
|
uses: 'google-github-actions/auth@v2.1.10'
|
||||||
with:
|
with:
|
||||||
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
|
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
|
||||||
|
|
||||||
|
2
.github/workflows/kcl-language-server.yml
vendored
2
.github/workflows/kcl-language-server.yml
vendored
@ -328,7 +328,7 @@ jobs:
|
|||||||
mkdir -p releases/language-server/${{ env.TAG }}
|
mkdir -p releases/language-server/${{ env.TAG }}
|
||||||
cp -r build/* releases/language-server/${{ env.TAG }}
|
cp -r build/* releases/language-server/${{ env.TAG }}
|
||||||
- name: "Authenticate to Google Cloud"
|
- name: "Authenticate to Google Cloud"
|
||||||
uses: "google-github-actions/auth@v2.1.8"
|
uses: "google-github-actions/auth@v2.1.10"
|
||||||
with:
|
with:
|
||||||
credentials_json: "${{ secrets.GOOGLE_CLOUD_DL_SA }}"
|
credentials_json: "${{ secrets.GOOGLE_CLOUD_DL_SA }}"
|
||||||
- name: Set up Cloud SDK
|
- name: Set up Cloud SDK
|
||||||
|
2
.github/workflows/publish-apps-release.yml
vendored
2
.github/workflows/publish-apps-release.yml
vendored
@ -108,7 +108,7 @@ jobs:
|
|||||||
run: npm run files:set-notes
|
run: npm run files:set-notes
|
||||||
|
|
||||||
- name: Authenticate to Google Cloud
|
- name: Authenticate to Google Cloud
|
||||||
uses: 'google-github-actions/auth@v2.1.8'
|
uses: 'google-github-actions/auth@v2.1.10'
|
||||||
with:
|
with:
|
||||||
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
|
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
|
||||||
|
|
||||||
|
3
Makefile
3
Makefile
@ -62,7 +62,10 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
public/kcl-samples/manifest.json: $(KCL_SOURCES)
|
public/kcl-samples/manifest.json: $(KCL_SOURCES)
|
||||||
|
ifndef WINDOWS
|
||||||
cd rust/kcl-lib && EXPECTORATE=overwrite cargo test generate_manifest
|
cd rust/kcl-lib && EXPECTORATE=overwrite cargo test generate_manifest
|
||||||
|
@ touch $@
|
||||||
|
endif
|
||||||
|
|
||||||
.vite/build/main.js: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
|
.vite/build/main.js: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
|
||||||
npm run tronb:vite:dev
|
npm run tronb:vite:dev
|
||||||
|
@ -12,7 +12,7 @@ test.describe('Point and click for boolean workflows', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'subtract',
|
name: 'subtract',
|
||||||
code: 'subtract([extrude001], tools = [extrude006])',
|
code: 'subtract(extrude001, tools = extrude006)',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'intersect',
|
name: 'intersect',
|
||||||
@ -81,6 +81,8 @@ test.describe('Point and click for boolean workflows', () => {
|
|||||||
if (operationName !== 'subtract') {
|
if (operationName !== 'subtract') {
|
||||||
// should down shift key to select multiple objects
|
// should down shift key to select multiple objects
|
||||||
await page.keyboard.down('Shift')
|
await page.keyboard.down('Shift')
|
||||||
|
} else {
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select second object
|
// Select second object
|
||||||
@ -103,8 +105,8 @@ test.describe('Point and click for boolean workflows', () => {
|
|||||||
await cmdBar.expectState({
|
await cmdBar.expectState({
|
||||||
stage: 'review',
|
stage: 'review',
|
||||||
headerArguments: {
|
headerArguments: {
|
||||||
Tool: '1 path',
|
Solids: '1 path',
|
||||||
Target: '1 path',
|
Tools: '1 path',
|
||||||
},
|
},
|
||||||
commandName,
|
commandName,
|
||||||
})
|
})
|
||||||
|
@ -288,7 +288,7 @@ a1 = startSketchOn(offsetPlane(XY, offset = 10))
|
|||||||
// error text on hover
|
// error text on hover
|
||||||
await page.hover('.cm-lint-marker-info')
|
await page.hover('.cm-lint-marker-info')
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText('Identifiers must be lowerCamelCase').first()
|
page.getByText('Identifiers should be lowerCamelCase').first()
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
|
|
||||||
await page.locator('#code-pane button:first-child').click()
|
await page.locator('#code-pane button:first-child').click()
|
||||||
@ -314,7 +314,7 @@ sketch_001 = startSketchOn(XY)
|
|||||||
// error text on hover
|
// error text on hover
|
||||||
await page.hover('.cm-lint-marker-info')
|
await page.hover('.cm-lint-marker-info')
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText('Identifiers must be lowerCamelCase').first()
|
page.getByText('Identifiers should be lowerCamelCase').first()
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ sketch_001 = startSketchOn(XY)
|
|||||||
// error text on hover
|
// error text on hover
|
||||||
await page.hover('.cm-lint-marker-info')
|
await page.hover('.cm-lint-marker-info')
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText('Identifiers must be lowerCamelCase').first()
|
page.getByText('Identifiers should be lowerCamelCase').first()
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
|
|
||||||
// focus the editor
|
// focus the editor
|
||||||
@ -539,7 +539,7 @@ sketch_001 = startSketchOn(XY)
|
|||||||
// error text on hover
|
// error text on hover
|
||||||
await page.hover('.cm-lint-marker-info')
|
await page.hover('.cm-lint-marker-info')
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText('Identifiers must be lowerCamelCase').first()
|
page.getByText('Identifiers should be lowerCamelCase').first()
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -681,7 +681,7 @@ a1 = startSketchOn(offsetPlane(XY, offset = 10))
|
|||||||
// error text on hover
|
// error text on hover
|
||||||
await page.hover('.cm-lint-marker-info')
|
await page.hover('.cm-lint-marker-info')
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText('Identifiers must be lowerCamelCase').first()
|
page.getByText('Identifiers should be lowerCamelCase').first()
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
|
|
||||||
// select the line that's causing the error and delete it
|
// select the line that's causing the error and delete it
|
||||||
|
@ -7,6 +7,7 @@ import type { SceneFixture } from '@e2e/playwright/fixtures/sceneFixture'
|
|||||||
import type { ToolbarFixture } from '@e2e/playwright/fixtures/toolbarFixture'
|
import type { ToolbarFixture } from '@e2e/playwright/fixtures/toolbarFixture'
|
||||||
import { expect, test } from '@e2e/playwright/zoo-test'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
import { bracket } from '@e2e/playwright/fixtures/bracket'
|
import { bracket } from '@e2e/playwright/fixtures/bracket'
|
||||||
|
import type { CmdBarSerialised } from '@e2e/playwright/fixtures/cmdBarFixture'
|
||||||
|
|
||||||
// test file is for testing point an click code gen functionality that's not sketch mode related
|
// test file is for testing point an click code gen functionality that's not sketch mode related
|
||||||
|
|
||||||
@ -1141,6 +1142,20 @@ openSketch = startSketchOn(XY)
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initialCmdBarStateHelix: CmdBarSerialised = {
|
||||||
|
stage: 'arguments',
|
||||||
|
currentArgKey: 'mode',
|
||||||
|
currentArgValue: '',
|
||||||
|
headerArguments: {
|
||||||
|
Mode: '',
|
||||||
|
AngleStart: '',
|
||||||
|
Revolutions: '',
|
||||||
|
Radius: '',
|
||||||
|
},
|
||||||
|
highlightedHeaderArg: 'mode',
|
||||||
|
commandName: 'Helix',
|
||||||
|
}
|
||||||
|
|
||||||
test('Helix point-and-click on default axis', async ({
|
test('Helix point-and-click on default axis', async ({
|
||||||
context,
|
context,
|
||||||
page,
|
page,
|
||||||
@ -1150,30 +1165,14 @@ openSketch = startSketchOn(XY)
|
|||||||
toolbar,
|
toolbar,
|
||||||
cmdBar,
|
cmdBar,
|
||||||
}) => {
|
}) => {
|
||||||
// One dumb hardcoded screen pixel value
|
const expectedOutput = `helix001 = helix( axis = X, radius = 5, length = 5, revolutions = 1, angleStart = 270,)`
|
||||||
const testPoint = { x: 620, y: 257 }
|
|
||||||
const expectedOutput = `helix001 = helix( axis = X, radius = 5, length = 5, revolutions = 1, angleStart = 270, ccw = false,)`
|
|
||||||
const expectedLine = `axis=X,`
|
const expectedLine = `axis=X,`
|
||||||
|
|
||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
await scene.connectionEstablished()
|
await scene.connectionEstablished()
|
||||||
|
|
||||||
await test.step(`Go through the command bar flow`, async () => {
|
await test.step(`Go through the command bar flow`, async () => {
|
||||||
await toolbar.helixButton.click()
|
await toolbar.helixButton.click()
|
||||||
await cmdBar.expectState({
|
await cmdBar.expectState(initialCmdBarStateHelix)
|
||||||
stage: 'arguments',
|
|
||||||
currentArgKey: 'mode',
|
|
||||||
currentArgValue: '',
|
|
||||||
headerArguments: {
|
|
||||||
Mode: '',
|
|
||||||
AngleStart: '',
|
|
||||||
Revolutions: '',
|
|
||||||
Radius: '',
|
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
|
||||||
highlightedHeaderArg: 'mode',
|
|
||||||
commandName: 'Helix',
|
|
||||||
})
|
|
||||||
await cmdBar.progressCmdBar()
|
await cmdBar.progressCmdBar()
|
||||||
await expect.poll(() => page.getByText('Axis').count()).toBe(6)
|
await expect.poll(() => page.getByText('Axis').count()).toBe(6)
|
||||||
await cmdBar.progressCmdBar()
|
await cmdBar.progressCmdBar()
|
||||||
@ -1190,7 +1189,6 @@ openSketch = startSketchOn(XY)
|
|||||||
AngleStart: '',
|
AngleStart: '',
|
||||||
Length: '',
|
Length: '',
|
||||||
Radius: '',
|
Radius: '',
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
},
|
||||||
commandName: 'Helix',
|
commandName: 'Helix',
|
||||||
})
|
})
|
||||||
@ -1207,11 +1205,10 @@ openSketch = startSketchOn(XY)
|
|||||||
Revolutions: '1',
|
Revolutions: '1',
|
||||||
Length: '5',
|
Length: '5',
|
||||||
Radius: '5',
|
Radius: '5',
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
},
|
||||||
commandName: 'Helix',
|
commandName: 'Helix',
|
||||||
})
|
})
|
||||||
await cmdBar.progressCmdBar()
|
await cmdBar.submit()
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
|
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
|
||||||
@ -1221,8 +1218,6 @@ openSketch = startSketchOn(XY)
|
|||||||
activeLines: [expectedLine],
|
activeLines: [expectedLine],
|
||||||
highlightedCode: '',
|
highlightedCode: '',
|
||||||
})
|
})
|
||||||
// Red plane is now gone, white helix is there
|
|
||||||
await scene.expectPixelColor([250, 250, 250], testPoint, 15)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step(`Edit helix through the feature tree`, async () => {
|
await test.step(`Edit helix through the feature tree`, async () => {
|
||||||
@ -1234,21 +1229,18 @@ openSketch = startSketchOn(XY)
|
|||||||
await cmdBar.expectState({
|
await cmdBar.expectState({
|
||||||
commandName: 'Helix',
|
commandName: 'Helix',
|
||||||
stage: 'arguments',
|
stage: 'arguments',
|
||||||
currentArgKey: 'CounterClockWise',
|
currentArgKey: 'length',
|
||||||
currentArgValue: '',
|
currentArgValue: '5',
|
||||||
headerArguments: {
|
headerArguments: {
|
||||||
Axis: 'X',
|
Axis: 'X',
|
||||||
AngleStart: '270',
|
AngleStart: '270',
|
||||||
Revolutions: '1',
|
Revolutions: '1',
|
||||||
Radius: '5',
|
Radius: '5',
|
||||||
Length: initialInput,
|
Length: initialInput,
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
},
|
||||||
highlightedHeaderArg: 'CounterClockWise',
|
highlightedHeaderArg: 'length',
|
||||||
})
|
})
|
||||||
await page.keyboard.press('Shift+Backspace')
|
await page.keyboard.insertText(newInput)
|
||||||
await expect(cmdBar.currentArgumentInput).toBeVisible()
|
|
||||||
await cmdBar.currentArgumentInput.locator('.cm-content').fill(newInput)
|
|
||||||
await cmdBar.progressCmdBar()
|
await cmdBar.progressCmdBar()
|
||||||
await cmdBar.expectState({
|
await cmdBar.expectState({
|
||||||
stage: 'review',
|
stage: 'review',
|
||||||
@ -1258,11 +1250,10 @@ openSketch = startSketchOn(XY)
|
|||||||
Revolutions: '1',
|
Revolutions: '1',
|
||||||
Radius: '5',
|
Radius: '5',
|
||||||
Length: newInput,
|
Length: newInput,
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
},
|
||||||
commandName: 'Helix',
|
commandName: 'Helix',
|
||||||
})
|
})
|
||||||
await cmdBar.progressCmdBar()
|
await cmdBar.submit()
|
||||||
await toolbar.closeFeatureTreePane()
|
await toolbar.closeFeatureTreePane()
|
||||||
await editor.openPane()
|
await editor.openPane()
|
||||||
await editor.expectEditor.toContain('length = ' + newInput)
|
await editor.expectEditor.toContain('length = ' + newInput)
|
||||||
@ -1273,174 +1264,238 @@ openSketch = startSketchOn(XY)
|
|||||||
const operationButton = await toolbar.getFeatureTreeOperation('Helix', 0)
|
const operationButton = await toolbar.getFeatureTreeOperation('Helix', 0)
|
||||||
await operationButton.click({ button: 'left' })
|
await operationButton.click({ button: 'left' })
|
||||||
await page.keyboard.press('Delete')
|
await page.keyboard.press('Delete')
|
||||||
// Red plane is back
|
await scene.settled(cmdBar)
|
||||||
await scene.expectPixelColor([96, 52, 52], testPoint, 15)
|
await editor.expectEditor.not.toContain('helix')
|
||||||
|
await expect(
|
||||||
|
await toolbar.getFeatureTreeOperation('Helix', 0)
|
||||||
|
).not.toBeVisible()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const helixCases = [
|
test(`Helix point-and-click around segment`, async ({
|
||||||
{
|
context,
|
||||||
selectionType: 'segment',
|
page,
|
||||||
testPoint: { x: 513, y: 221 },
|
homePage,
|
||||||
expectedOutput: `helix001 = helix( axis = seg01, radius = 1, revolutions = 20, angleStart = 0, ccw = false,)`,
|
scene,
|
||||||
expectedEditedOutput: `helix001 = helix( axis = seg01, radius = 5, revolutions = 20, angleStart = 0, ccw = false,)`,
|
editor,
|
||||||
},
|
toolbar,
|
||||||
{
|
cmdBar,
|
||||||
selectionType: 'sweepEdge',
|
}) => {
|
||||||
testPoint: { x: 564, y: 364 },
|
const initialCode = `sketch001 = startSketchOn(XZ)
|
||||||
expectedOutput: `helix001 = helix( axis = getOppositeEdge(seg01), radius = 1, revolutions = 20, angleStart = 0, ccw = false,)`,
|
profile001 = startProfile(sketch001, at = [0, 0])
|
||||||
expectedEditedOutput: `helix001 = helix( axis = getOppositeEdge(seg01), radius = 5, revolutions = 20, angleStart = 0, ccw = false,)`,
|
|> yLine(length = 100)
|
||||||
},
|
|> line(endAbsolute = [100, 0])
|
||||||
]
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
helixCases.map(
|
|> close()`
|
||||||
({ selectionType, testPoint, expectedOutput, expectedEditedOutput }) => {
|
await context.addInitScript((initialCode) => {
|
||||||
test(`Helix point-and-click around ${selectionType}`, async ({
|
localStorage.setItem('persistCode', initialCode)
|
||||||
context,
|
}, initialCode)
|
||||||
page,
|
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||||
homePage,
|
await homePage.goToModelingScene()
|
||||||
scene,
|
await scene.settled(cmdBar)
|
||||||
editor,
|
|
||||||
toolbar,
|
|
||||||
cmdBar,
|
|
||||||
}) => {
|
|
||||||
page.on('console', console.log)
|
|
||||||
const initialCode = `sketch001 = startSketchOn(XZ)
|
|
||||||
profile001 = startProfile(sketch001, at = [0, 0])
|
|
||||||
|> yLine(length = 100)
|
|
||||||
|> line(endAbsolute = [100, 0])
|
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
||||||
|> close()
|
|
||||||
extrude001 = extrude(profile001, length = 100)`
|
|
||||||
|
|
||||||
// One dumb hardcoded screen pixel value
|
await test.step(`Go through the command bar flow`, async () => {
|
||||||
const [clickOnEdge] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
|
await toolbar.closePane('code')
|
||||||
|
await toolbar.helixButton.click()
|
||||||
await context.addInitScript((initialCode) => {
|
await cmdBar.expectState(initialCmdBarStateHelix)
|
||||||
localStorage.setItem('persistCode', initialCode)
|
await cmdBar.selectOption({ name: 'Edge' }).click()
|
||||||
}, initialCode)
|
await editor.selectText('yLine(length = 100)')
|
||||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
await cmdBar.progressCmdBar()
|
||||||
await homePage.goToModelingScene()
|
await page.keyboard.insertText('1')
|
||||||
await scene.settled(cmdBar)
|
await cmdBar.progressCmdBar()
|
||||||
|
await page.keyboard.insertText('2')
|
||||||
await test.step(`Go through the command bar flow`, async () => {
|
await cmdBar.progressCmdBar()
|
||||||
await toolbar.closePane('code')
|
await page.keyboard.insertText('3')
|
||||||
await toolbar.helixButton.click()
|
await cmdBar.progressCmdBar()
|
||||||
await cmdBar.expectState({
|
await cmdBar.expectState({
|
||||||
stage: 'arguments',
|
stage: 'review',
|
||||||
currentArgKey: 'mode',
|
headerArguments: {
|
||||||
currentArgValue: '',
|
Mode: 'Edge',
|
||||||
headerArguments: {
|
Edge: `1 segment`,
|
||||||
AngleStart: '',
|
AngleStart: '2',
|
||||||
Mode: '',
|
Revolutions: '1',
|
||||||
CounterClockWise: '',
|
Radius: '3',
|
||||||
Radius: '',
|
},
|
||||||
Revolutions: '',
|
commandName: 'Helix',
|
||||||
},
|
|
||||||
highlightedHeaderArg: 'mode',
|
|
||||||
commandName: 'Helix',
|
|
||||||
})
|
|
||||||
await cmdBar.selectOption({ name: 'Edge' }).click()
|
|
||||||
await expect
|
|
||||||
.poll(() => page.getByText('Please select one').count())
|
|
||||||
.toBe(1)
|
|
||||||
await clickOnEdge()
|
|
||||||
await page.waitForTimeout(1000)
|
|
||||||
await cmdBar.progressCmdBar()
|
|
||||||
await page.waitForTimeout(1000)
|
|
||||||
await cmdBar.argumentInput.focus()
|
|
||||||
await page.waitForTimeout(1000)
|
|
||||||
await page.keyboard.insertText('20')
|
|
||||||
await cmdBar.progressCmdBar()
|
|
||||||
await page.keyboard.insertText('0')
|
|
||||||
await cmdBar.progressCmdBar()
|
|
||||||
await page.keyboard.insertText('1')
|
|
||||||
await cmdBar.progressCmdBar()
|
|
||||||
await page.keyboard.insertText('100')
|
|
||||||
await cmdBar.expectState({
|
|
||||||
stage: 'review',
|
|
||||||
headerArguments: {
|
|
||||||
Mode: 'Edge',
|
|
||||||
Edge: `1 ${selectionType}`,
|
|
||||||
AngleStart: '0',
|
|
||||||
Revolutions: '20',
|
|
||||||
Radius: '1',
|
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
|
||||||
commandName: 'Helix',
|
|
||||||
})
|
|
||||||
await cmdBar.progressCmdBar()
|
|
||||||
await page.waitForTimeout(1000)
|
|
||||||
})
|
|
||||||
|
|
||||||
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
|
|
||||||
await toolbar.openPane('code')
|
|
||||||
await editor.expectEditor.toContain(expectedOutput)
|
|
||||||
await toolbar.closePane('code')
|
|
||||||
})
|
|
||||||
|
|
||||||
await test.step(`Edit helix through the feature tree`, async () => {
|
|
||||||
await toolbar.openPane('feature-tree')
|
|
||||||
const operationButton = await toolbar.getFeatureTreeOperation(
|
|
||||||
'Helix',
|
|
||||||
0
|
|
||||||
)
|
|
||||||
await operationButton.dblclick()
|
|
||||||
const initialInput = '1'
|
|
||||||
const newInput = '5'
|
|
||||||
await cmdBar.expectState({
|
|
||||||
commandName: 'Helix',
|
|
||||||
stage: 'arguments',
|
|
||||||
currentArgKey: 'CounterClockWise',
|
|
||||||
currentArgValue: '',
|
|
||||||
headerArguments: {
|
|
||||||
AngleStart: '0',
|
|
||||||
Revolutions: '20',
|
|
||||||
Radius: initialInput,
|
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
|
||||||
highlightedHeaderArg: 'CounterClockWise',
|
|
||||||
})
|
|
||||||
await page
|
|
||||||
.getByRole('button', { name: 'radius', exact: false })
|
|
||||||
.click()
|
|
||||||
await expect(cmdBar.currentArgumentInput).toBeVisible()
|
|
||||||
await cmdBar.currentArgumentInput
|
|
||||||
.locator('.cm-content')
|
|
||||||
.fill(newInput)
|
|
||||||
await cmdBar.progressCmdBar()
|
|
||||||
await cmdBar.expectState({
|
|
||||||
stage: 'review',
|
|
||||||
headerArguments: {
|
|
||||||
AngleStart: '0',
|
|
||||||
Revolutions: '20',
|
|
||||||
Radius: newInput,
|
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
|
||||||
commandName: 'Helix',
|
|
||||||
})
|
|
||||||
await cmdBar.progressCmdBar()
|
|
||||||
await toolbar.closePane('feature-tree')
|
|
||||||
await toolbar.openPane('code')
|
|
||||||
await editor.expectEditor.toContain(expectedEditedOutput)
|
|
||||||
await toolbar.closePane('code')
|
|
||||||
})
|
|
||||||
|
|
||||||
await test.step('Delete helix via feature tree selection', async () => {
|
|
||||||
await toolbar.openPane('feature-tree')
|
|
||||||
const operationButton = await toolbar.getFeatureTreeOperation(
|
|
||||||
'Helix',
|
|
||||||
0
|
|
||||||
)
|
|
||||||
await operationButton.click({ button: 'left' })
|
|
||||||
await page.keyboard.press('Delete')
|
|
||||||
await editor.expectEditor.not.toContain(expectedEditedOutput)
|
|
||||||
await expect(
|
|
||||||
await toolbar.getFeatureTreeOperation('Helix', 0)
|
|
||||||
).not.toBeVisible()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
await cmdBar.submit()
|
||||||
)
|
await scene.settled(cmdBar)
|
||||||
|
})
|
||||||
|
|
||||||
|
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
|
||||||
|
await toolbar.openPane('code')
|
||||||
|
await editor.expectEditor.toContain(
|
||||||
|
`
|
||||||
|
helix001 = helix(
|
||||||
|
axis = seg01,
|
||||||
|
radius = 3,
|
||||||
|
revolutions = 1,
|
||||||
|
angleStart = 2,
|
||||||
|
)`,
|
||||||
|
{ shouldNormalise: true }
|
||||||
|
)
|
||||||
|
await toolbar.closePane('code')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
test(`Helix point-and-click around sweepEdge with edit and delete flows`, async ({
|
||||||
|
context,
|
||||||
|
page,
|
||||||
|
homePage,
|
||||||
|
scene,
|
||||||
|
editor,
|
||||||
|
toolbar,
|
||||||
|
cmdBar,
|
||||||
|
}) => {
|
||||||
|
const initialCode = `sketch001 = startSketchOn(XZ)
|
||||||
|
profile001 = startProfile(sketch001, at = [0, 0])
|
||||||
|
|> yLine(length = 100)
|
||||||
|
|> line(endAbsolute = [100, 0])
|
||||||
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|
|> close()
|
||||||
|
extrude001 = extrude(profile001, length = 100)`
|
||||||
|
|
||||||
|
// One dumb hardcoded screen pixel value to click on the sweepEdge, can't think of another way?
|
||||||
|
const testPoint = { x: 564, y: 364 }
|
||||||
|
const [clickOnEdge] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
|
||||||
|
|
||||||
|
await context.addInitScript((initialCode) => {
|
||||||
|
localStorage.setItem('persistCode', initialCode)
|
||||||
|
}, initialCode)
|
||||||
|
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||||
|
await homePage.goToModelingScene()
|
||||||
|
await scene.settled(cmdBar)
|
||||||
|
|
||||||
|
await test.step(`Go through the command bar flow`, async () => {
|
||||||
|
await toolbar.closePane('code')
|
||||||
|
await toolbar.helixButton.click()
|
||||||
|
await cmdBar.expectState(initialCmdBarStateHelix)
|
||||||
|
await cmdBar.selectOption({ name: 'Edge' }).click()
|
||||||
|
await expect
|
||||||
|
.poll(() => page.getByText('Please select one').count())
|
||||||
|
.toBe(1)
|
||||||
|
await clickOnEdge()
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await cmdBar.argumentInput.focus()
|
||||||
|
await page.keyboard.insertText('20')
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await page.keyboard.insertText('0')
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await page.keyboard.insertText('1')
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await page.keyboard.insertText('100')
|
||||||
|
await cmdBar.expectState({
|
||||||
|
stage: 'review',
|
||||||
|
headerArguments: {
|
||||||
|
Mode: 'Edge',
|
||||||
|
Edge: `1 sweepEdge`,
|
||||||
|
AngleStart: '0',
|
||||||
|
Revolutions: '20',
|
||||||
|
Radius: '1',
|
||||||
|
},
|
||||||
|
commandName: 'Helix',
|
||||||
|
})
|
||||||
|
await cmdBar.submit()
|
||||||
|
await scene.settled(cmdBar)
|
||||||
|
})
|
||||||
|
|
||||||
|
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
|
||||||
|
await toolbar.openPane('code')
|
||||||
|
await editor.expectEditor.toContain(
|
||||||
|
`
|
||||||
|
helix001 = helix(
|
||||||
|
axis = getOppositeEdge(seg01),
|
||||||
|
radius = 1,
|
||||||
|
revolutions = 20,
|
||||||
|
angleStart = 0,
|
||||||
|
)`,
|
||||||
|
{ shouldNormalise: true }
|
||||||
|
)
|
||||||
|
await toolbar.closePane('code')
|
||||||
|
})
|
||||||
|
|
||||||
|
await test.step(`Edit helix through the feature tree`, async () => {
|
||||||
|
await toolbar.openPane('feature-tree')
|
||||||
|
const operationButton = await toolbar.getFeatureTreeOperation('Helix', 0)
|
||||||
|
await operationButton.dblclick()
|
||||||
|
const initialInput = '1'
|
||||||
|
const newInput = '5'
|
||||||
|
await cmdBar.expectState({
|
||||||
|
commandName: 'Helix',
|
||||||
|
stage: 'arguments',
|
||||||
|
currentArgKey: 'radius',
|
||||||
|
currentArgValue: initialInput,
|
||||||
|
headerArguments: {
|
||||||
|
AngleStart: '0',
|
||||||
|
Revolutions: '20',
|
||||||
|
Radius: initialInput,
|
||||||
|
},
|
||||||
|
highlightedHeaderArg: 'radius',
|
||||||
|
})
|
||||||
|
await page.keyboard.insertText(newInput)
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
|
await cmdBar.expectState({
|
||||||
|
stage: 'review',
|
||||||
|
headerArguments: {
|
||||||
|
AngleStart: '0',
|
||||||
|
Revolutions: '20',
|
||||||
|
Radius: newInput,
|
||||||
|
},
|
||||||
|
commandName: 'Helix',
|
||||||
|
})
|
||||||
|
await cmdBar.clickOptionalArgument('ccw')
|
||||||
|
await cmdBar.expectState({
|
||||||
|
commandName: 'Helix',
|
||||||
|
stage: 'arguments',
|
||||||
|
currentArgKey: 'CounterClockWise',
|
||||||
|
currentArgValue: '',
|
||||||
|
headerArguments: {
|
||||||
|
AngleStart: '0',
|
||||||
|
Revolutions: '20',
|
||||||
|
Radius: newInput,
|
||||||
|
CounterClockWise: '',
|
||||||
|
},
|
||||||
|
highlightedHeaderArg: 'CounterClockWise',
|
||||||
|
})
|
||||||
|
await cmdBar.selectOption({ name: 'True' }).click()
|
||||||
|
await cmdBar.expectState({
|
||||||
|
stage: 'review',
|
||||||
|
headerArguments: {
|
||||||
|
AngleStart: '0',
|
||||||
|
Revolutions: '20',
|
||||||
|
Radius: newInput,
|
||||||
|
CounterClockWise: '',
|
||||||
|
},
|
||||||
|
commandName: 'Helix',
|
||||||
|
})
|
||||||
|
await cmdBar.submit()
|
||||||
|
await toolbar.closePane('feature-tree')
|
||||||
|
await toolbar.openPane('code')
|
||||||
|
await editor.expectEditor.toContain(
|
||||||
|
`
|
||||||
|
helix001 = helix(
|
||||||
|
axis = getOppositeEdge(seg01),
|
||||||
|
radius = 5,
|
||||||
|
revolutions = 20,
|
||||||
|
angleStart = 0,
|
||||||
|
ccw = true,
|
||||||
|
)`,
|
||||||
|
{ shouldNormalise: true }
|
||||||
|
)
|
||||||
|
await toolbar.closePane('code')
|
||||||
|
})
|
||||||
|
|
||||||
|
await test.step('Delete helix via feature tree selection', async () => {
|
||||||
|
await toolbar.openPane('feature-tree')
|
||||||
|
const operationButton = await toolbar.getFeatureTreeOperation('Helix', 0)
|
||||||
|
await operationButton.click({ button: 'left' })
|
||||||
|
await page.keyboard.press('Delete')
|
||||||
|
await editor.expectEditor.not.toContain('helix')
|
||||||
|
await expect(
|
||||||
|
await toolbar.getFeatureTreeOperation('Helix', 0)
|
||||||
|
).not.toBeVisible()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
test('Helix point-and-click on cylinder', async ({
|
test('Helix point-and-click on cylinder', async ({
|
||||||
context,
|
context,
|
||||||
@ -1470,26 +1525,12 @@ extrude001 = extrude(profile001, length = 100)
|
|||||||
// One dumb hardcoded screen pixel value
|
// One dumb hardcoded screen pixel value
|
||||||
const testPoint = { x: 620, y: 257 }
|
const testPoint = { x: 620, y: 257 }
|
||||||
const [clickOnWall] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
|
const [clickOnWall] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
|
||||||
const expectedOutput = `helix001 = helix( cylinder = extrude001, revolutions = 1, angleStart = 360, ccw = false,)`
|
const expectedOutput = `helix001 = helix(cylinder = extrude001, revolutions = 1, angleStart = 360)`
|
||||||
const expectedLine = `cylinder = extrude001,`
|
const expectedEditedOutput = `helix001 = helix(cylinder = extrude001, revolutions = 1, angleStart = 10)`
|
||||||
const expectedEditedOutput = `helix001 = helix( cylinder = extrude001, revolutions = 1, angleStart = 360, ccw = true,)`
|
|
||||||
|
|
||||||
await test.step(`Go through the command bar flow`, async () => {
|
await test.step(`Go through the command bar flow`, async () => {
|
||||||
await toolbar.helixButton.click()
|
await toolbar.helixButton.click()
|
||||||
await cmdBar.expectState({
|
await cmdBar.expectState(initialCmdBarStateHelix)
|
||||||
stage: 'arguments',
|
|
||||||
currentArgKey: 'mode',
|
|
||||||
currentArgValue: '',
|
|
||||||
headerArguments: {
|
|
||||||
Mode: '',
|
|
||||||
AngleStart: '',
|
|
||||||
Revolutions: '',
|
|
||||||
Radius: '',
|
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
|
||||||
highlightedHeaderArg: 'mode',
|
|
||||||
commandName: 'Helix',
|
|
||||||
})
|
|
||||||
await cmdBar.selectOption({ name: 'Cylinder' }).click()
|
await cmdBar.selectOption({ name: 'Cylinder' }).click()
|
||||||
await cmdBar.expectState({
|
await cmdBar.expectState({
|
||||||
stage: 'arguments',
|
stage: 'arguments',
|
||||||
@ -1500,7 +1541,6 @@ extrude001 = extrude(profile001, length = 100)
|
|||||||
Cylinder: '',
|
Cylinder: '',
|
||||||
AngleStart: '',
|
AngleStart: '',
|
||||||
Revolutions: '',
|
Revolutions: '',
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
},
|
||||||
highlightedHeaderArg: 'cylinder',
|
highlightedHeaderArg: 'cylinder',
|
||||||
commandName: 'Helix',
|
commandName: 'Helix',
|
||||||
@ -1516,18 +1556,17 @@ extrude001 = extrude(profile001, length = 100)
|
|||||||
Cylinder: '1 face',
|
Cylinder: '1 face',
|
||||||
AngleStart: '360',
|
AngleStart: '360',
|
||||||
Revolutions: '1',
|
Revolutions: '1',
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
},
|
||||||
commandName: 'Helix',
|
commandName: 'Helix',
|
||||||
})
|
})
|
||||||
await cmdBar.progressCmdBar()
|
await cmdBar.submit()
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
|
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
|
||||||
await editor.expectEditor.toContain(expectedOutput)
|
await editor.expectEditor.toContain(expectedOutput)
|
||||||
await editor.expectState({
|
await editor.expectState({
|
||||||
diagnostics: [],
|
diagnostics: [],
|
||||||
activeLines: [expectedLine],
|
activeLines: [expectedOutput],
|
||||||
highlightedCode: '',
|
highlightedCode: '',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -1539,22 +1578,21 @@ extrude001 = extrude(profile001, length = 100)
|
|||||||
await cmdBar.expectState({
|
await cmdBar.expectState({
|
||||||
commandName: 'Helix',
|
commandName: 'Helix',
|
||||||
stage: 'arguments',
|
stage: 'arguments',
|
||||||
currentArgKey: 'CounterClockWise',
|
currentArgKey: 'angleStart',
|
||||||
currentArgValue: '',
|
currentArgValue: '360',
|
||||||
headerArguments: {
|
headerArguments: {
|
||||||
AngleStart: '360',
|
AngleStart: '360',
|
||||||
Revolutions: '1',
|
Revolutions: '1',
|
||||||
CounterClockWise: '',
|
|
||||||
},
|
},
|
||||||
highlightedHeaderArg: 'CounterClockWise',
|
highlightedHeaderArg: 'angleStart',
|
||||||
})
|
})
|
||||||
await cmdBar.selectOption({ name: 'True' }).click()
|
await page.keyboard.insertText('10')
|
||||||
|
await cmdBar.progressCmdBar()
|
||||||
await cmdBar.expectState({
|
await cmdBar.expectState({
|
||||||
stage: 'review',
|
stage: 'review',
|
||||||
headerArguments: {
|
headerArguments: {
|
||||||
AngleStart: '360',
|
AngleStart: '10',
|
||||||
Revolutions: '1',
|
Revolutions: '1',
|
||||||
CounterClockWise: 'true',
|
|
||||||
},
|
},
|
||||||
commandName: 'Helix',
|
commandName: 'Helix',
|
||||||
})
|
})
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
Binary file not shown.
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
@ -74,7 +74,7 @@
|
|||||||
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
|
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
|
||||||
ELECTRON_OVERRIDE_DIST_PATH =
|
ELECTRON_OVERRIDE_DIST_PATH =
|
||||||
if pkgs.stdenv.isDarwin
|
if pkgs.stdenv.isDarwin
|
||||||
then "${pkgs.electron}/Applications/Electron.app/Contents/MacOS/"
|
then "${pkgs.electron}/Applications"
|
||||||
else "${pkgs.electron}/bin";
|
else "${pkgs.electron}/bin";
|
||||||
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = true;
|
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = true;
|
||||||
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH = "${pkgs.playwright-driver.browsers}/chromium-1091/chrome-linux/chrome";
|
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH = "${pkgs.playwright-driver.browsers}/chromium-1091/chrome-linux/chrome";
|
||||||
|
20
rust/Cargo.lock
generated
20
rust/Cargo.lock
generated
@ -1814,7 +1814,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-bumper"
|
name = "kcl-bumper"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1825,7 +1825,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-derive-docs"
|
name = "kcl-derive-docs"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -1834,7 +1834,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-directory-test-macro"
|
name = "kcl-directory-test-macro"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case",
|
"convert_case",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@ -1844,7 +1844,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-language-server"
|
name = "kcl-language-server"
|
||||||
version = "0.2.82"
|
version = "0.2.83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1865,7 +1865,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-language-server-release"
|
name = "kcl-language-server-release"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1885,7 +1885,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
version = "0.2.82"
|
version = "0.2.83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"approx 0.5.1",
|
"approx 0.5.1",
|
||||||
@ -1962,7 +1962,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-python-bindings"
|
name = "kcl-python-bindings"
|
||||||
version = "0.3.82"
|
version = "0.3.83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"kcl-lib",
|
"kcl-lib",
|
||||||
@ -1977,7 +1977,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-test-server"
|
name = "kcl-test-server"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"hyper 0.14.32",
|
"hyper 0.14.32",
|
||||||
@ -1990,7 +1990,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-to-core"
|
name = "kcl-to-core"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -2004,7 +2004,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-wasm-lib"
|
name = "kcl-wasm-lib"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bson",
|
"bson",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "kcl-bumper"
|
name = "kcl-bumper"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://github.com/KittyCAD/modeling-api"
|
repository = "https://github.com/KittyCAD/modeling-api"
|
||||||
rust-version = "1.76"
|
rust-version = "1.76"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-derive-docs"
|
name = "kcl-derive-docs"
|
||||||
description = "A tool for generating documentation from Rust derive macros"
|
description = "A tool for generating documentation from Rust derive macros"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-directory-test-macro"
|
name = "kcl-directory-test-macro"
|
||||||
description = "A tool for generating tests from a directory of kcl files"
|
description = "A tool for generating tests from a directory of kcl files"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-language-server-release"
|
name = "kcl-language-server-release"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "kcl-language-server"
|
name = "kcl-language-server"
|
||||||
description = "A language server for KCL."
|
description = "A language server for KCL."
|
||||||
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
||||||
version = "0.2.82"
|
version = "0.2.83"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
description = "KittyCAD Language implementation and tools"
|
description = "KittyCAD Language implementation and tools"
|
||||||
version = "0.2.82"
|
version = "0.2.83"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -11,10 +11,10 @@ use crate::{
|
|||||||
|
|
||||||
def_finding!(
|
def_finding!(
|
||||||
Z0001,
|
Z0001,
|
||||||
"Identifiers must be lowerCamelCase",
|
"Identifiers should be lowerCamelCase",
|
||||||
"\
|
"\
|
||||||
By convention, variable names are lowerCamelCase, not snake_case, kebab-case,
|
By convention, variable names are lowerCamelCase, not snake_case, kebab-case,
|
||||||
nor CammelCase. 🐪
|
nor upper CamelCase (aka PascalCase). 🐪
|
||||||
|
|
||||||
For instance, a good identifier for the variable representing 'box height'
|
For instance, a good identifier for the variable representing 'box height'
|
||||||
would be 'boxHeight', not 'BOX_HEIGHT', 'box_height' nor 'BoxHeight'. For
|
would be 'boxHeight', not 'BOX_HEIGHT', 'box_height' nor 'BoxHeight'. For
|
||||||
|
@ -2359,7 +2359,7 @@ async fn test_kcl_lsp_diagnostic_has_lints() {
|
|||||||
assert_eq!(diagnostics.full_document_diagnostic_report.items.len(), 1);
|
assert_eq!(diagnostics.full_document_diagnostic_report.items.len(), 1);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
diagnostics.full_document_diagnostic_report.items[0].message,
|
diagnostics.full_document_diagnostic_report.items[0].message,
|
||||||
"Identifiers must be lowerCamelCase"
|
"Identifiers should be lowerCamelCase"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
panic!("Expected full diagnostics");
|
panic!("Expected full diagnostics");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-python-bindings"
|
name = "kcl-python-bindings"
|
||||||
version = "0.3.82"
|
version = "0.3.83"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://github.com/kittycad/modeling-app"
|
repository = "https://github.com/kittycad/modeling-app"
|
||||||
exclude = ["tests/*", "files/*", "venv/*"]
|
exclude = ["tests/*", "files/*", "venv/*"]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-test-server"
|
name = "kcl-test-server"
|
||||||
description = "A test server for KCL"
|
description = "A test server for KCL"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-to-core"
|
name = "kcl-to-core"
|
||||||
description = "Utility methods to convert kcl to engine core executable tests"
|
description = "Utility methods to convert kcl to engine core executable tests"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-wasm-lib"
|
name = "kcl-wasm-lib"
|
||||||
version = "0.1.82"
|
version = "0.1.83"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
rust-version = "1.83"
|
rust-version = "1.83"
|
||||||
|
@ -590,7 +590,7 @@ export function addHelix({
|
|||||||
angleStart: Expr
|
angleStart: Expr
|
||||||
radius?: Expr
|
radius?: Expr
|
||||||
length?: Expr
|
length?: Expr
|
||||||
ccw: boolean
|
ccw?: boolean
|
||||||
insertIndex?: number
|
insertIndex?: number
|
||||||
variableName?: string
|
variableName?: string
|
||||||
}): { modifiedAst: Node<Program>; pathToNode: PathToNode } {
|
}): { modifiedAst: Node<Program>; pathToNode: PathToNode } {
|
||||||
@ -610,6 +610,9 @@ export function addHelix({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extra labeled args expressions
|
||||||
|
const ccwExpr = ccw ? [createLabeledArg('ccw', createLiteral(ccw))] : []
|
||||||
|
|
||||||
const variable = createVariableDeclaration(
|
const variable = createVariableDeclaration(
|
||||||
name,
|
name,
|
||||||
createCallExpressionStdLibKw(
|
createCallExpressionStdLibKw(
|
||||||
@ -619,7 +622,7 @@ export function addHelix({
|
|||||||
...modeArgs,
|
...modeArgs,
|
||||||
createLabeledArg('revolutions', revolutions),
|
createLabeledArg('revolutions', revolutions),
|
||||||
createLabeledArg('angleStart', angleStart),
|
createLabeledArg('angleStart', angleStart),
|
||||||
createLabeledArg('ccw', createLiteral(ccw)),
|
...ccwExpr,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -23,13 +23,13 @@ import type {
|
|||||||
VariableDeclaration,
|
VariableDeclaration,
|
||||||
} from '@src/lang/wasm'
|
} from '@src/lang/wasm'
|
||||||
import { EXECUTION_TYPE_REAL } from '@src/lib/constants'
|
import { EXECUTION_TYPE_REAL } from '@src/lib/constants'
|
||||||
import type { Selection, Selections } from '@src/lib/selections'
|
import type { Selections } from '@src/lib/selections'
|
||||||
import { err } from '@src/lib/trap'
|
import { err } from '@src/lib/trap'
|
||||||
import { isArray } from '@src/lib/utils'
|
import { isArray } from '@src/lib/utils'
|
||||||
|
|
||||||
export async function applySubtractFromTargetOperatorSelections(
|
export async function applySubtractFromTargetOperatorSelections(
|
||||||
target: Selection,
|
solids: Selections,
|
||||||
tool: Selection,
|
tools: Selections,
|
||||||
dependencies: {
|
dependencies: {
|
||||||
kclManager: KclManager
|
kclManager: KclManager
|
||||||
engineCommandManager: EngineCommandManager
|
engineCommandManager: EngineCommandManager
|
||||||
@ -38,28 +38,28 @@ export async function applySubtractFromTargetOperatorSelections(
|
|||||||
}
|
}
|
||||||
): Promise<Error | void> {
|
): Promise<Error | void> {
|
||||||
const ast = dependencies.kclManager.ast
|
const ast = dependencies.kclManager.ast
|
||||||
if (!target.artifact || !tool.artifact) {
|
const lastSolidsVars = getLastVariableDeclarationsFromSelections(
|
||||||
return new Error('No artifact found')
|
solids,
|
||||||
}
|
ast,
|
||||||
const orderedChildrenTarget = findAllChildrenAndOrderByPlaceInCode(
|
|
||||||
target.artifact,
|
|
||||||
dependencies.kclManager.artifactGraph
|
dependencies.kclManager.artifactGraph
|
||||||
)
|
)
|
||||||
const orderedChildrenTool = findAllChildrenAndOrderByPlaceInCode(
|
if (err(lastSolidsVars) || lastSolidsVars.length < 1) {
|
||||||
tool.artifact,
|
return new Error('Not enough or invalid solids variables found')
|
||||||
|
}
|
||||||
|
|
||||||
|
const lastToolsVars = getLastVariableDeclarationsFromSelections(
|
||||||
|
tools,
|
||||||
|
ast,
|
||||||
dependencies.kclManager.artifactGraph
|
dependencies.kclManager.artifactGraph
|
||||||
)
|
)
|
||||||
|
if (err(lastToolsVars) || lastToolsVars.length < 1) {
|
||||||
const lastVarTarget = getLastVariable(orderedChildrenTarget, ast)
|
return new Error('Not enough or invalid tools variables found')
|
||||||
const lastVarTool = getLastVariable(orderedChildrenTool, ast)
|
|
||||||
|
|
||||||
if (!lastVarTarget || !lastVarTool) {
|
|
||||||
return new Error('No variable found')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const modifiedAst = booleanSubtractAstMod({
|
const modifiedAst = booleanSubtractAstMod({
|
||||||
ast,
|
ast,
|
||||||
targets: [lastVarTarget?.variableDeclaration?.node],
|
solids: lastSolidsVars,
|
||||||
tools: [lastVarTool?.variableDeclaration.node],
|
tools: lastToolsVars,
|
||||||
})
|
})
|
||||||
|
|
||||||
await updateModelingState(modifiedAst, EXECUTION_TYPE_REAL, dependencies)
|
await updateModelingState(modifiedAst, EXECUTION_TYPE_REAL, dependencies)
|
||||||
@ -75,34 +75,13 @@ export async function applyUnionFromTargetOperatorSelections(
|
|||||||
}
|
}
|
||||||
): Promise<Error | void> {
|
): Promise<Error | void> {
|
||||||
const ast = dependencies.kclManager.ast
|
const ast = dependencies.kclManager.ast
|
||||||
|
const lastVars = getLastVariableDeclarationsFromSelections(
|
||||||
const artifacts: Artifact[] = []
|
solids,
|
||||||
for (const selection of solids.graphSelections) {
|
ast,
|
||||||
if (selection.artifact) {
|
dependencies.kclManager.artifactGraph
|
||||||
artifacts.push(selection.artifact)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (artifacts.length < 2) {
|
|
||||||
return new Error('Not enough artifacts selected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const orderedChildrenEach = artifacts.map((artifact) =>
|
|
||||||
findAllChildrenAndOrderByPlaceInCode(
|
|
||||||
artifact,
|
|
||||||
dependencies.kclManager.artifactGraph
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
if (err(lastVars) || lastVars.length < 2) {
|
||||||
const lastVars: VariableDeclaration[] = []
|
return new Error('Not enough or invalid solids variables found')
|
||||||
for (const orderedArtifactLeaves of orderedChildrenEach) {
|
|
||||||
const lastVar = getLastVariable(orderedArtifactLeaves, ast)
|
|
||||||
if (!lastVar) continue
|
|
||||||
lastVars.push(lastVar.variableDeclaration.node)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastVars.length < 2) {
|
|
||||||
return new Error('Not enough variables found')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const modifiedAst = booleanUnionAstMod({
|
const modifiedAst = booleanUnionAstMod({
|
||||||
@ -122,23 +101,36 @@ export async function applyIntersectFromTargetOperatorSelections(
|
|||||||
}
|
}
|
||||||
): Promise<Error | void> {
|
): Promise<Error | void> {
|
||||||
const ast = dependencies.kclManager.ast
|
const ast = dependencies.kclManager.ast
|
||||||
|
const lastVars = getLastVariableDeclarationsFromSelections(
|
||||||
|
solids,
|
||||||
|
ast,
|
||||||
|
dependencies.kclManager.artifactGraph
|
||||||
|
)
|
||||||
|
if (err(lastVars) || lastVars.length < 2) {
|
||||||
|
return new Error('Not enough or invalid solids variables found')
|
||||||
|
}
|
||||||
|
|
||||||
|
const modifiedAst = booleanIntersectAstMod({
|
||||||
|
ast,
|
||||||
|
solids: lastVars,
|
||||||
|
})
|
||||||
|
await updateModelingState(modifiedAst, EXECUTION_TYPE_REAL, dependencies)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLastVariableDeclarationsFromSelections(
|
||||||
|
selections: Selections,
|
||||||
|
ast: Node<Program>,
|
||||||
|
artifactGraph: ArtifactGraph
|
||||||
|
): Error | VariableDeclaration[] {
|
||||||
const artifacts: Artifact[] = []
|
const artifacts: Artifact[] = []
|
||||||
for (const selection of solids.graphSelections) {
|
for (const selection of selections.graphSelections) {
|
||||||
if (selection.artifact) {
|
if (selection.artifact) {
|
||||||
artifacts.push(selection.artifact)
|
artifacts.push(selection.artifact)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (artifacts.length < 2) {
|
|
||||||
return new Error('Not enough artifacts selected')
|
|
||||||
}
|
|
||||||
|
|
||||||
const orderedChildrenEach = artifacts.map((artifact) =>
|
const orderedChildrenEach = artifacts.map((artifact) =>
|
||||||
findAllChildrenAndOrderByPlaceInCode(
|
findAllChildrenAndOrderByPlaceInCode(artifact, artifactGraph)
|
||||||
artifact,
|
|
||||||
dependencies.kclManager.artifactGraph
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const lastVars: VariableDeclaration[] = []
|
const lastVars: VariableDeclaration[] = []
|
||||||
@ -148,15 +140,7 @@ export async function applyIntersectFromTargetOperatorSelections(
|
|||||||
lastVars.push(lastVar.variableDeclaration.node)
|
lastVars.push(lastVar.variableDeclaration.node)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastVars.length < 2) {
|
return lastVars
|
||||||
return new Error('Not enough variables found')
|
|
||||||
}
|
|
||||||
|
|
||||||
const modifiedAst = booleanIntersectAstMod({
|
|
||||||
ast,
|
|
||||||
solids: lastVars,
|
|
||||||
})
|
|
||||||
await updateModelingState(modifiedAst, EXECUTION_TYPE_REAL, dependencies)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** returns all children of a given artifact, and sorts them DESC by start sourceRange
|
/** returns all children of a given artifact, and sorts them DESC by start sourceRange
|
||||||
@ -271,25 +255,27 @@ export function getLastVariable(
|
|||||||
|
|
||||||
export function booleanSubtractAstMod({
|
export function booleanSubtractAstMod({
|
||||||
ast,
|
ast,
|
||||||
targets,
|
solids,
|
||||||
tools,
|
tools,
|
||||||
}: {
|
}: {
|
||||||
ast: Node<Program>
|
ast: Node<Program>
|
||||||
targets: VariableDeclaration[]
|
solids: VariableDeclaration[]
|
||||||
tools: VariableDeclaration[]
|
tools: VariableDeclaration[]
|
||||||
}): Node<Program> {
|
}): Node<Program> {
|
||||||
const newAst = structuredClone(ast)
|
const newAst = structuredClone(ast)
|
||||||
const newVarName = findUniqueName(newAst, 'solid')
|
const newVarName = findUniqueName(newAst, 'solid')
|
||||||
const createArrExpr = (varDecs: VariableDeclaration[]) =>
|
const createArrExpr = (varDecs: VariableDeclaration[]) => {
|
||||||
createArrayExpression(
|
const names = varDecs.map((varDec) =>
|
||||||
varDecs.map((varDec) => createLocalName(varDec.declaration.id.name))
|
createLocalName(varDec.declaration.id.name)
|
||||||
)
|
)
|
||||||
const targetsArrayExpression = createArrExpr(targets)
|
return names.length === 1 ? names[0] : createArrayExpression(names)
|
||||||
|
}
|
||||||
|
const solidsArrayExpression = createArrExpr(solids)
|
||||||
const toolsArrayExpression = createArrExpr(tools)
|
const toolsArrayExpression = createArrExpr(tools)
|
||||||
|
|
||||||
const newVarDec = createVariableDeclaration(
|
const newVarDec = createVariableDeclaration(
|
||||||
newVarName,
|
newVarName,
|
||||||
createCallExpressionStdLibKw('subtract', targetsArrayExpression, [
|
createCallExpressionStdLibKw('subtract', solidsArrayExpression, [
|
||||||
createLabeledArg('tools', toolsArrayExpression),
|
createLabeledArg('tools', toolsArrayExpression),
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
@ -204,8 +204,8 @@ export type ModelingCommandSchema = {
|
|||||||
variableName: string
|
variableName: string
|
||||||
}
|
}
|
||||||
'Boolean Subtract': {
|
'Boolean Subtract': {
|
||||||
target: Selections
|
solids: Selections
|
||||||
tool: Selections
|
tools: Selections
|
||||||
}
|
}
|
||||||
'Boolean Union': {
|
'Boolean Union': {
|
||||||
solids: Selections
|
solids: Selections
|
||||||
@ -595,23 +595,21 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
icon: 'booleanSubtract',
|
icon: 'booleanSubtract',
|
||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
target: {
|
solids: {
|
||||||
inputType: 'selection',
|
inputType: 'selection',
|
||||||
selectionTypes: ['path'],
|
selectionTypes: ['path'],
|
||||||
selectionFilter: ['object'],
|
selectionFilter: ['object'],
|
||||||
multiple: false,
|
multiple: true,
|
||||||
required: true,
|
required: true,
|
||||||
skip: true,
|
|
||||||
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
||||||
},
|
},
|
||||||
tool: {
|
tools: {
|
||||||
clearSelectionFirst: true,
|
clearSelectionFirst: true,
|
||||||
inputType: 'selection',
|
inputType: 'selection',
|
||||||
selectionTypes: ['path'],
|
selectionTypes: ['path'],
|
||||||
selectionFilter: ['object'],
|
selectionFilter: ['object'],
|
||||||
multiple: false,
|
multiple: true,
|
||||||
required: true,
|
required: true,
|
||||||
skip: false,
|
|
||||||
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -690,32 +688,35 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
},
|
},
|
||||||
axis: {
|
axis: {
|
||||||
inputType: 'options',
|
inputType: 'options',
|
||||||
required: (commandContext) =>
|
|
||||||
['Axis'].includes(commandContext.argumentsToSubmit.mode as string),
|
|
||||||
options: [
|
options: [
|
||||||
{ name: 'X Axis', value: 'X' },
|
{ name: 'X Axis', value: 'X' },
|
||||||
{ name: 'Y Axis', value: 'Y' },
|
{ name: 'Y Axis', value: 'Y' },
|
||||||
{ name: 'Z Axis', value: 'Z' },
|
{ name: 'Z Axis', value: 'Z' },
|
||||||
],
|
],
|
||||||
hidden: false, // for consistency here, we can actually edit here since it's not a selection
|
required: (context) =>
|
||||||
|
['Axis'].includes(context.argumentsToSubmit.mode as string),
|
||||||
|
hidden: (context) =>
|
||||||
|
!['Axis'].includes(context.argumentsToSubmit.mode as string),
|
||||||
},
|
},
|
||||||
edge: {
|
edge: {
|
||||||
required: (commandContext) =>
|
|
||||||
['Edge'].includes(commandContext.argumentsToSubmit.mode as string),
|
|
||||||
inputType: 'selection',
|
inputType: 'selection',
|
||||||
selectionTypes: ['segment', 'sweepEdge'],
|
selectionTypes: ['segment', 'sweepEdge'],
|
||||||
multiple: false,
|
multiple: false,
|
||||||
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
required: (context) =>
|
||||||
|
['Edge'].includes(context.argumentsToSubmit.mode as string),
|
||||||
|
hidden: (context) =>
|
||||||
|
Boolean(context.argumentsToSubmit.nodeToEdit) ||
|
||||||
|
!['Edge'].includes(context.argumentsToSubmit.mode as string),
|
||||||
},
|
},
|
||||||
cylinder: {
|
cylinder: {
|
||||||
required: (commandContext) =>
|
|
||||||
['Cylinder'].includes(
|
|
||||||
commandContext.argumentsToSubmit.mode as string
|
|
||||||
),
|
|
||||||
inputType: 'selection',
|
inputType: 'selection',
|
||||||
selectionTypes: ['wall'],
|
selectionTypes: ['wall'],
|
||||||
multiple: false,
|
multiple: false,
|
||||||
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
required: (context) =>
|
||||||
|
['Cylinder'].includes(context.argumentsToSubmit.mode as string),
|
||||||
|
hidden: (context) =>
|
||||||
|
Boolean(context.argumentsToSubmit.nodeToEdit) ||
|
||||||
|
!['Cylinder'].includes(context.argumentsToSubmit.mode as string),
|
||||||
},
|
},
|
||||||
revolutions: {
|
revolutions: {
|
||||||
inputType: 'kcl',
|
inputType: 'kcl',
|
||||||
@ -730,34 +731,30 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
radius: {
|
radius: {
|
||||||
inputType: 'kcl',
|
inputType: 'kcl',
|
||||||
defaultValue: KCL_DEFAULT_LENGTH,
|
defaultValue: KCL_DEFAULT_LENGTH,
|
||||||
required: (commandContext) =>
|
required: (context) =>
|
||||||
!['Cylinder'].includes(
|
!['Cylinder'].includes(context.argumentsToSubmit.mode as string),
|
||||||
commandContext.argumentsToSubmit.mode as string
|
hidden: (context) =>
|
||||||
),
|
['Cylinder'].includes(context.argumentsToSubmit.mode as string),
|
||||||
},
|
},
|
||||||
length: {
|
length: {
|
||||||
inputType: 'kcl',
|
inputType: 'kcl',
|
||||||
defaultValue: KCL_DEFAULT_LENGTH,
|
defaultValue: KCL_DEFAULT_LENGTH,
|
||||||
required: (commandContext) =>
|
required: (commandContext) =>
|
||||||
['Axis'].includes(commandContext.argumentsToSubmit.mode as string),
|
['Axis'].includes(commandContext.argumentsToSubmit.mode as string),
|
||||||
|
// No need for hidden here, as it works with all modes
|
||||||
},
|
},
|
||||||
ccw: {
|
ccw: {
|
||||||
inputType: 'options',
|
inputType: 'options',
|
||||||
skip: true,
|
required: false,
|
||||||
required: true,
|
|
||||||
defaultValue: false,
|
|
||||||
valueSummary: (value) => String(value),
|
|
||||||
displayName: 'CounterClockWise',
|
displayName: 'CounterClockWise',
|
||||||
options: (commandContext) => [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'False',
|
name: 'False',
|
||||||
value: false,
|
value: false,
|
||||||
isCurrent: !Boolean(commandContext.argumentsToSubmit.ccw),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'True',
|
name: 'True',
|
||||||
value: true,
|
value: true,
|
||||||
isCurrent: Boolean(commandContext.argumentsToSubmit.ccw),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -222,3 +222,6 @@ export const CODE_QUERY_PARAM = 'code'
|
|||||||
/** A query parameter to skip the sign-on view if unnecessary. */
|
/** A query parameter to skip the sign-on view if unnecessary. */
|
||||||
export const IMMEDIATE_SIGN_IN_IF_NECESSARY_QUERY_PARAM =
|
export const IMMEDIATE_SIGN_IN_IF_NECESSARY_QUERY_PARAM =
|
||||||
'immediate-sign-in-if-necessary'
|
'immediate-sign-in-if-necessary'
|
||||||
|
|
||||||
|
// Only used by the desktop app
|
||||||
|
export const OAUTH2_DEVICE_CLIENT_ID = '2af127fb-e14e-400a-9c57-a9ed08d1a5b7'
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
} from '@src/env'
|
} from '@src/env'
|
||||||
import { assign, fromPromise, setup } from 'xstate'
|
import { assign, fromPromise, setup } from 'xstate'
|
||||||
|
|
||||||
import { COOKIE_NAME } from '@src/lib/constants'
|
import { COOKIE_NAME, OAUTH2_DEVICE_CLIENT_ID } from '@src/lib/constants'
|
||||||
import {
|
import {
|
||||||
getUser as getUserDesktop,
|
getUser as getUserDesktop,
|
||||||
readTokenFile,
|
readTokenFile,
|
||||||
@ -254,8 +254,32 @@ async function getAndSyncStoredToken(input: {
|
|||||||
async function logout() {
|
async function logout() {
|
||||||
localStorage.removeItem(TOKEN_PERSIST_KEY)
|
localStorage.removeItem(TOKEN_PERSIST_KEY)
|
||||||
if (isDesktop()) {
|
if (isDesktop()) {
|
||||||
await writeTokenFile('')
|
try {
|
||||||
return Promise.resolve(null)
|
let token = await readTokenFile()
|
||||||
|
|
||||||
|
if (token) {
|
||||||
|
try {
|
||||||
|
await fetch(withBaseUrl('/oauth2/token/revoke'), {
|
||||||
|
method: 'POST',
|
||||||
|
credentials: 'include',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
body: new URLSearchParams({
|
||||||
|
token: token,
|
||||||
|
client_id: OAUTH2_DEVICE_CLIENT_ID,
|
||||||
|
}).toString(),
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error revoking token:', e)
|
||||||
|
}
|
||||||
|
|
||||||
|
await writeTokenFile('')
|
||||||
|
return Promise.resolve(null)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error reading token during logout (ignoring):', e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fetch(withBaseUrl('/logout'), {
|
return fetch(withBaseUrl('/logout'), {
|
||||||
|
@ -3570,17 +3570,17 @@ export const modelingMachine = setup({
|
|||||||
return Promise.reject(new Error(NO_INPUT_PROVIDED_MESSAGE))
|
return Promise.reject(new Error(NO_INPUT_PROVIDED_MESSAGE))
|
||||||
}
|
}
|
||||||
|
|
||||||
const { target, tool } = input
|
const { solids, tools } = input
|
||||||
if (
|
if (
|
||||||
!target.graphSelections[0].artifact ||
|
!solids.graphSelections.some((selection) => selection.artifact) ||
|
||||||
!tool.graphSelections[0].artifact
|
!tools.graphSelections.some((selection) => selection.artifact)
|
||||||
) {
|
) {
|
||||||
return Promise.reject(new Error('No artifact in selections found'))
|
return Promise.reject(new Error('No artifact in selections found'))
|
||||||
}
|
}
|
||||||
|
|
||||||
await applySubtractFromTargetOperatorSelections(
|
const result = await applySubtractFromTargetOperatorSelections(
|
||||||
target.graphSelections[0],
|
solids,
|
||||||
tool.graphSelections[0],
|
tools,
|
||||||
{
|
{
|
||||||
kclManager,
|
kclManager,
|
||||||
codeManager,
|
codeManager,
|
||||||
@ -3588,6 +3588,9 @@ export const modelingMachine = setup({
|
|||||||
editorManager,
|
editorManager,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
if (err(result)) {
|
||||||
|
return Promise.reject(result)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
boolUnionAstMod: fromPromise(
|
boolUnionAstMod: fromPromise(
|
||||||
@ -3605,12 +3608,15 @@ export const modelingMachine = setup({
|
|||||||
return Promise.reject(new Error('No artifact in selections found'))
|
return Promise.reject(new Error('No artifact in selections found'))
|
||||||
}
|
}
|
||||||
|
|
||||||
await applyUnionFromTargetOperatorSelections(solids, {
|
const result = await applyUnionFromTargetOperatorSelections(solids, {
|
||||||
kclManager,
|
kclManager,
|
||||||
codeManager,
|
codeManager,
|
||||||
engineCommandManager,
|
engineCommandManager,
|
||||||
editorManager,
|
editorManager,
|
||||||
})
|
})
|
||||||
|
if (err(result)) {
|
||||||
|
return Promise.reject(result)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
boolIntersectAstMod: fromPromise(
|
boolIntersectAstMod: fromPromise(
|
||||||
@ -3628,12 +3634,18 @@ export const modelingMachine = setup({
|
|||||||
return Promise.reject(new Error('No artifact in selections found'))
|
return Promise.reject(new Error('No artifact in selections found'))
|
||||||
}
|
}
|
||||||
|
|
||||||
await applyIntersectFromTargetOperatorSelections(solids, {
|
const result = await applyIntersectFromTargetOperatorSelections(
|
||||||
kclManager,
|
solids,
|
||||||
codeManager,
|
{
|
||||||
engineCommandManager,
|
kclManager,
|
||||||
editorManager,
|
codeManager,
|
||||||
})
|
engineCommandManager,
|
||||||
|
editorManager,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (err(result)) {
|
||||||
|
return Promise.reject(result)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
||||||
|
24
src/main.ts
24
src/main.ts
@ -15,6 +15,7 @@ import {
|
|||||||
dialog,
|
dialog,
|
||||||
ipcMain,
|
ipcMain,
|
||||||
nativeTheme,
|
nativeTheme,
|
||||||
|
session,
|
||||||
screen,
|
screen,
|
||||||
shell,
|
shell,
|
||||||
systemPreferences,
|
systemPreferences,
|
||||||
@ -28,7 +29,10 @@ import {
|
|||||||
parseCLIArgs,
|
parseCLIArgs,
|
||||||
} from '@src/commandLineArgs'
|
} from '@src/commandLineArgs'
|
||||||
import { initPromiseNode } from '@src/lang/wasmUtilsNode'
|
import { initPromiseNode } from '@src/lang/wasmUtilsNode'
|
||||||
import { ZOO_STUDIO_PROTOCOL } from '@src/lib/constants'
|
import {
|
||||||
|
ZOO_STUDIO_PROTOCOL,
|
||||||
|
OAUTH2_DEVICE_CLIENT_ID,
|
||||||
|
} from '@src/lib/constants'
|
||||||
import getCurrentProjectFile from '@src/lib/getCurrentProjectFile'
|
import getCurrentProjectFile from '@src/lib/getCurrentProjectFile'
|
||||||
import { reportRejection } from '@src/lib/trap'
|
import { reportRejection } from '@src/lib/trap'
|
||||||
import {
|
import {
|
||||||
@ -293,7 +297,21 @@ app.on('window-all-closed', () => {
|
|||||||
// This method will be called when Electron has finished
|
// This method will be called when Electron has finished
|
||||||
// initialization and is ready to create browser windows.
|
// initialization and is ready to create browser windows.
|
||||||
// Some APIs can only be used after this event occurs.
|
// Some APIs can only be used after this event occurs.
|
||||||
app.on('ready', (event, data) => {
|
app.on('ready', async (event, data) => {
|
||||||
|
try {
|
||||||
|
await session.defaultSession.cookies.set({
|
||||||
|
url: 'https://api.dev.zoo.dev',
|
||||||
|
name: 'preview-pr-2718',
|
||||||
|
value: 'always',
|
||||||
|
domain: '.dev.zoo.dev',
|
||||||
|
path: '/',
|
||||||
|
secure: true,
|
||||||
|
sameSite: 'no_restriction',
|
||||||
|
})
|
||||||
|
console.log('[preview] cookie seeded')
|
||||||
|
} catch (err) {
|
||||||
|
console.error('[preview] failed to set cookie', err)
|
||||||
|
}
|
||||||
// Avoid potentially 2 ready fires
|
// Avoid potentially 2 ready fires
|
||||||
if (mainWindow) return
|
if (mainWindow) return
|
||||||
// Create the mainWindow
|
// Create the mainWindow
|
||||||
@ -402,7 +420,7 @@ ipcMain.handle('startDeviceFlow', async (_, host: string) => {
|
|||||||
// We can hardcode the client ID.
|
// We can hardcode the client ID.
|
||||||
// This value is safe to be embedded in version control.
|
// This value is safe to be embedded in version control.
|
||||||
// This is the client ID of the KittyCAD app.
|
// This is the client ID of the KittyCAD app.
|
||||||
client_id: '2af127fb-e14e-400a-9c57-a9ed08d1a5b7',
|
client_id: OAUTH2_DEVICE_CLIENT_ID,
|
||||||
token_endpoint_auth_method: 'none',
|
token_endpoint_auth_method: 'none',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user