lint and typing
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
import type { Page, Locator } from '@playwright/test'
|
import type { Page, Locator } from '@playwright/test'
|
||||||
import { expect } from '@playwright/test'
|
import { expect } from '@playwright/test'
|
||||||
import { uuidv4 } from 'lib/utils'
|
import { isArray, uuidv4 } from 'lib/utils'
|
||||||
import {
|
import {
|
||||||
closeDebugPanel,
|
closeDebugPanel,
|
||||||
doAndWaitForImageDiff,
|
doAndWaitForImageDiff,
|
||||||
@ -255,7 +255,7 @@ export class SceneFixture {
|
|||||||
function isColourArray(
|
function isColourArray(
|
||||||
colour: [number, number, number] | [number, number, number][]
|
colour: [number, number, number] | [number, number, number][]
|
||||||
): colour is [number, number, number][] {
|
): colour is [number, number, number][] {
|
||||||
return Array.isArray(colour[0])
|
return isArray(colour[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function expectPixelColor(
|
export async function expectPixelColor(
|
||||||
|
@ -182,57 +182,38 @@ export const ModelingMachineProvider = ({
|
|||||||
'enable copilot': () => {
|
'enable copilot': () => {
|
||||||
editorManager.setCopilotEnabled(true)
|
editorManager.setCopilotEnabled(true)
|
||||||
},
|
},
|
||||||
// tsc reports this typing as perfectly fine, but eslint is complaining.
|
'sketch exit execute': ({ context: { store } }) => {
|
||||||
// It's actually nonsensical, so I'm quieting.
|
// TODO: Remove this async callback. For some reason eslint wouldn't
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
// let me disable @typescript-eslint/no-misused-promises for the line.
|
||||||
'sketch exit execute': async ({
|
;(async () => {
|
||||||
context: { store },
|
// When cancelling the sketch mode we should disable sketch mode within the engine.
|
||||||
}): Promise<void> => {
|
await engineCommandManager.sendSceneCommand({
|
||||||
// When cancelling the sketch mode we should disable sketch mode within the engine.
|
type: 'modeling_cmd_req',
|
||||||
await engineCommandManager.sendSceneCommand({
|
cmd_id: uuidv4(),
|
||||||
type: 'modeling_cmd_req',
|
cmd: { type: 'sketch_mode_disable' },
|
||||||
cmd_id: uuidv4(),
|
|
||||||
cmd: { type: 'sketch_mode_disable' },
|
|
||||||
})
|
|
||||||
|
|
||||||
sceneInfra.camControls.syncDirection = 'clientToEngine'
|
|
||||||
|
|
||||||
if (cameraProjection.current === 'perspective') {
|
|
||||||
await sceneInfra.camControls.snapToPerspectiveBeforeHandingBackControlToEngine()
|
|
||||||
}
|
|
||||||
|
|
||||||
sceneInfra.camControls.syncDirection = 'engineToClient'
|
|
||||||
|
|
||||||
store.videoElement?.pause()
|
|
||||||
|
|
||||||
return kclManager.executeCode().then(() => {
|
|
||||||
if (engineCommandManager.engineConnection?.idleMode) return
|
|
||||||
|
|
||||||
store.videoElement?.play().catch((e) => {
|
|
||||||
console.warn('Video playing was prevented', e)
|
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
sceneInfra.camControls.syncDirection = 'clientToEngine'
|
sceneInfra.camControls.syncDirection = 'clientToEngine'
|
||||||
|
|
||||||
if (cameraProjection.current === 'perspective') {
|
if (cameraProjection.current === 'perspective') {
|
||||||
await sceneInfra.camControls.snapToPerspectiveBeforeHandingBackControlToEngine()
|
await sceneInfra.camControls.snapToPerspectiveBeforeHandingBackControlToEngine()
|
||||||
}
|
}
|
||||||
|
|
||||||
sceneInfra.camControls.syncDirection = 'engineToClient'
|
sceneInfra.camControls.syncDirection = 'engineToClient'
|
||||||
|
|
||||||
store.videoElement?.pause()
|
store.videoElement?.pause()
|
||||||
|
|
||||||
return kclManager
|
return kclManager
|
||||||
.executeCode()
|
.executeCode()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (engineCommandManager.engineConnection?.idleMode) return
|
if (engineCommandManager.engineConnection?.idleMode) return
|
||||||
|
|
||||||
store.videoElement?.play().catch((e) => {
|
store.videoElement?.play().catch((e) => {
|
||||||
console.warn('Video playing was prevented', e)
|
console.warn('Video playing was prevented', e)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
.catch(reportRejection)
|
||||||
.catch(reportRejection)
|
})().catch(reportRejection)
|
||||||
},
|
},
|
||||||
'Set mouse state': assign(({ context, event }) => {
|
'Set mouse state': assign(({ context, event }) => {
|
||||||
if (event.type !== 'Set mouse state') return {}
|
if (event.type !== 'Set mouse state') return {}
|
||||||
|
@ -38,6 +38,7 @@ import { Node } from 'wasm-lib/kcl/bindings/Node'
|
|||||||
import { findKwArg } from './util'
|
import { findKwArg } from './util'
|
||||||
import { codeRefFromRange } from './std/artifactGraph'
|
import { codeRefFromRange } from './std/artifactGraph'
|
||||||
import { FunctionExpression } from 'wasm-lib/kcl/bindings/FunctionExpression'
|
import { FunctionExpression } from 'wasm-lib/kcl/bindings/FunctionExpression'
|
||||||
|
import { ImportStatement } from 'wasm-lib/kcl/bindings/ImportStatement'
|
||||||
|
|
||||||
export const LABELED_ARG_FIELD = 'LabeledArg -> Arg'
|
export const LABELED_ARG_FIELD = 'LabeledArg -> Arg'
|
||||||
export const ARG_INDEX_FIELD = 'arg index'
|
export const ARG_INDEX_FIELD = 'arg index'
|
||||||
|
Reference in New Issue
Block a user