Revert "sort imports" (#6100)
Revert "sort imports (#6094)"
This reverts commit 2fc8cb5376
.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { expect, test } from './zoo-test'
|
||||
import { test, expect } from './zoo-test'
|
||||
|
||||
test.describe('Electron app header tests', () => {
|
||||
test(
|
||||
|
@ -1,14 +1,13 @@
|
||||
import { Page } from '@playwright/test'
|
||||
|
||||
import { HomePageFixture } from './fixtures/homePageFixture'
|
||||
import { test, expect } from './zoo-test'
|
||||
import {
|
||||
PERSIST_MODELING_CONTEXT,
|
||||
getUtils,
|
||||
TEST_COLORS,
|
||||
commonPoints,
|
||||
getUtils,
|
||||
PERSIST_MODELING_CONTEXT,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { HomePageFixture } from './fixtures/homePageFixture'
|
||||
|
||||
test.setTimeout(120000)
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
test.describe('Point and click for boolean workflows', () => {
|
||||
// Boolean operations to test
|
||||
const booleanOperations = [
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { Page } from '@playwright/test'
|
||||
import { test, expect } from './zoo-test'
|
||||
import { HomePageFixture } from './fixtures/homePageFixture'
|
||||
import { getUtils } from './test-utils'
|
||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
|
||||
import { HomePageFixture } from './fixtures/homePageFixture'
|
||||
import { SceneFixture } from './fixtures/sceneFixture'
|
||||
import { getUtils } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
test.describe(
|
||||
'Can create sketches on all planes and their back sides',
|
||||
|
@ -1,14 +1,13 @@
|
||||
import fsp from 'fs/promises'
|
||||
import { bracket } from 'lib/exampleKcl'
|
||||
import { join } from 'path'
|
||||
|
||||
import { TEST_CODE_LONG_WITH_ERROR_OUT_OF_VIEW } from './storageStates'
|
||||
import { test, expect } from './zoo-test'
|
||||
import {
|
||||
executorInputPath,
|
||||
getUtils,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
getUtils,
|
||||
executorInputPath,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { join } from 'path'
|
||||
import { bracket } from 'lib/exampleKcl'
|
||||
import { TEST_CODE_LONG_WITH_ERROR_OUT_OF_VIEW } from './storageStates'
|
||||
import fsp from 'fs/promises'
|
||||
|
||||
test.describe('Code pane and errors', { tag: ['@skipWin'] }, () => {
|
||||
test('Typing KCL errors induces a badge on the code pane button', async ({
|
||||
|
@ -1,13 +1,12 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
||||
import path, { join } from 'path'
|
||||
|
||||
import {
|
||||
executorInputPath,
|
||||
getUtils,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
||||
import path, { join } from 'path'
|
||||
|
||||
test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
|
||||
test('Extrude from command bar selects extrude line after', async ({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import { getUtils } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
test.describe('Copilot ghost text', () => {
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
|
||||
import { getUtils } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
function countNewlines(input: string): number {
|
||||
let count = 0
|
||||
|
@ -1,12 +1,11 @@
|
||||
import fsp from 'fs/promises'
|
||||
import { test, expect } from './zoo-test'
|
||||
import path from 'path'
|
||||
|
||||
import {
|
||||
getUtils,
|
||||
executorInputPath,
|
||||
getPlaywrightDownloadDir,
|
||||
getUtils,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import fsp from 'fs/promises'
|
||||
|
||||
test(
|
||||
'export works on the first try',
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import fsp from 'fs/promises'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
import { join } from 'path'
|
||||
|
||||
import {
|
||||
TEST_COLORS,
|
||||
executorInputPath,
|
||||
getUtils,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
TEST_COLORS,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
import { join } from 'path'
|
||||
|
||||
test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
||||
test('can comment out code with ctrl+/', async ({ page, homePage }) => {
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { join } from 'path'
|
||||
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
const FEATURE_TREE_EXAMPLE_CODE = `export fn timesFive(x) {
|
||||
return 5 * x
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
import * as fs from 'fs'
|
||||
import { test, expect } from './zoo-test'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { FILE_EXT } from 'lib/constants'
|
||||
import { join } from 'path'
|
||||
|
||||
import * as fs from 'fs'
|
||||
import {
|
||||
createProject,
|
||||
executorInputPath,
|
||||
@ -10,7 +8,8 @@ import {
|
||||
orRunWhenFullSuiteEnabled,
|
||||
runningOnWindows,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { join } from 'path'
|
||||
import { FILE_EXT } from 'lib/constants'
|
||||
|
||||
test.describe('integrations tests', () => {
|
||||
test(
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { Locator, Page, Request, Route } from '@playwright/test'
|
||||
import { TestInfo, expect } from '@playwright/test'
|
||||
import type { Page, Locator, Route, Request } from '@playwright/test'
|
||||
import { expect, TestInfo } from '@playwright/test'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
import type { Locator, Page } from '@playwright/test'
|
||||
import type { Page, Locator } from '@playwright/test'
|
||||
import { expect } from '@playwright/test'
|
||||
|
||||
import {
|
||||
checkIfPaneIsOpen,
|
||||
closePane,
|
||||
checkIfPaneIsOpen,
|
||||
openPane,
|
||||
sansWhitespace,
|
||||
} from '../test-utils'
|
||||
|
@ -1,27 +1,28 @@
|
||||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
import * as TOML from '@iarna/toml'
|
||||
|
||||
import type {
|
||||
BrowserContext,
|
||||
ElectronApplication,
|
||||
Page,
|
||||
TestInfo,
|
||||
Page,
|
||||
} from '@playwright/test'
|
||||
|
||||
import { _electron as electron } from '@playwright/test'
|
||||
import fsp from 'fs/promises'
|
||||
|
||||
import * as TOML from '@iarna/toml'
|
||||
import { TEST_SETTINGS } from '../storageStates'
|
||||
import { SETTINGS_FILE_NAME } from 'lib/constants'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
import { getUtils, setup } from '../test-utils'
|
||||
import fsp from 'fs/promises'
|
||||
import fs from 'node:fs'
|
||||
import path from 'path'
|
||||
|
||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||
|
||||
import { TEST_SETTINGS } from '../storageStates'
|
||||
import { getUtils, setup } from '../test-utils'
|
||||
import { CmdBarFixture } from './cmdBarFixture'
|
||||
import { EditorFixture } from './editorFixture'
|
||||
import { HomePageFixture } from './homePageFixture'
|
||||
import { SceneFixture } from './sceneFixture'
|
||||
import { ToolbarFixture } from './toolbarFixture'
|
||||
import { SceneFixture } from './sceneFixture'
|
||||
import { HomePageFixture } from './homePageFixture'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||
|
||||
export class AuthenticatedApp {
|
||||
public readonly page: Page
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Locator, Page } from '@playwright/test'
|
||||
import type { Page, Locator } from '@playwright/test'
|
||||
import { expect } from '@playwright/test'
|
||||
|
||||
interface ProjectCardState {
|
||||
|
@ -1,16 +1,15 @@
|
||||
import type { Locator, Page } from '@playwright/test'
|
||||
import type { Page, Locator } from '@playwright/test'
|
||||
import { expect } from '../zoo-test'
|
||||
import { isArray, uuidv4 } from 'lib/utils'
|
||||
|
||||
import { CmdBarFixture } from './cmdBarFixture'
|
||||
import {
|
||||
closeDebugPanel,
|
||||
doAndWaitForImageDiff,
|
||||
getPixelRGBs,
|
||||
getUtils,
|
||||
openAndClearDebugPanel,
|
||||
sendCustomCmd,
|
||||
getUtils,
|
||||
} from '../test-utils'
|
||||
import { expect } from '../zoo-test'
|
||||
import { CmdBarFixture } from './cmdBarFixture'
|
||||
|
||||
type MouseParams = {
|
||||
pixelDiff?: number
|
||||
|
@ -1,15 +1,14 @@
|
||||
import { type Locator, type Page, test } from '@playwright/test'
|
||||
import { SidebarType } from 'components/ModelingSidebar/ModelingPanes'
|
||||
import { SIDEBAR_BUTTON_SUFFIX } from 'lib/constants'
|
||||
import { ToolbarModeName } from 'lib/toolbar'
|
||||
|
||||
import { type Page, type Locator, test } from '@playwright/test'
|
||||
import { expect } from '../zoo-test'
|
||||
import {
|
||||
checkIfPaneIsOpen,
|
||||
closePane,
|
||||
doAndWaitForImageDiff,
|
||||
openPane,
|
||||
} from '../test-utils'
|
||||
import { expect } from '../zoo-test'
|
||||
import { SidebarType } from 'components/ModelingSidebar/ModelingPanes'
|
||||
import { SIDEBAR_BUTTON_SUFFIX } from 'lib/constants'
|
||||
import { ToolbarModeName } from 'lib/toolbar'
|
||||
|
||||
export class ToolbarFixture {
|
||||
public page: Page
|
||||
|
@ -1,8 +1,7 @@
|
||||
import fsp from 'fs/promises'
|
||||
import { join } from 'path'
|
||||
|
||||
import { test, expect } from './zoo-test'
|
||||
import { executorInputPath } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { join } from 'path'
|
||||
import fsp from 'fs/promises'
|
||||
|
||||
test(
|
||||
'When machine-api server not found butt is disabled and shows the reason',
|
||||
|
@ -1,15 +1,13 @@
|
||||
import * as fsp from 'fs/promises'
|
||||
import { test, expect } from './zoo-test'
|
||||
import { PROJECT_SETTINGS_FILE_NAME } from 'lib/constants'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { join } from 'path'
|
||||
|
||||
import { NamedView } from '@rust/kcl-lib/bindings/NamedView'
|
||||
|
||||
import {
|
||||
createProject,
|
||||
perProjectsettingsToToml,
|
||||
tomlToPerProjectSettings,
|
||||
perProjectsettingsToToml,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { NamedView } from '@rust/kcl-lib/bindings/NamedView'
|
||||
|
||||
// Helper function to determine if the file path on disk exists
|
||||
// Specifically this is used to check if project.toml exists on disk
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect, test } from './zoo-test'
|
||||
import { test, expect } from './zoo-test'
|
||||
|
||||
/**
|
||||
* Not all menu actions are tested. Some are default electron menu actions.
|
||||
|
@ -2,7 +2,8 @@
|
||||
// application, check it can make it to the project pane, and nothing more.
|
||||
// It also tests our test wrappers are working.
|
||||
// Additionally this serves as a nice minimal example.
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
import { test, expect } from './zoo-test'
|
||||
|
||||
test.describe('Open the application', () => {
|
||||
test('see the project view', async ({ page, context }) => {
|
||||
|
@ -1,23 +1,22 @@
|
||||
import fsp from 'fs/promises'
|
||||
import { bracket } from 'lib/exampleKcl'
|
||||
import { test, expect } from './zoo-test'
|
||||
import { join } from 'path'
|
||||
import fsp from 'fs/promises'
|
||||
import {
|
||||
getUtils,
|
||||
executorInputPath,
|
||||
createProject,
|
||||
settingsToToml,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
import { bracket } from 'lib/exampleKcl'
|
||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||
|
||||
import { expectPixelColor } from './fixtures/sceneFixture'
|
||||
import {
|
||||
TEST_SETTINGS_KEY,
|
||||
TEST_SETTINGS_ONBOARDING_EXPORT,
|
||||
TEST_SETTINGS_ONBOARDING_START,
|
||||
TEST_SETTINGS_ONBOARDING_EXPORT,
|
||||
TEST_SETTINGS_ONBOARDING_USER_MENU,
|
||||
} from './storageStates'
|
||||
import {
|
||||
createProject,
|
||||
executorInputPath,
|
||||
getUtils,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
settingsToToml,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { expectPixelColor } from './fixtures/sceneFixture'
|
||||
|
||||
// Because our default test settings have the onboardingStatus set to 'dismissed',
|
||||
// we must set it to empty for the tests where we want to see the onboarding immediately.
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
import { test, expect } from '@playwright/test'
|
||||
|
||||
/** @deprecated, import from ./fixtureSetup.ts instead */
|
||||
export const _test = test
|
||||
|
@ -1,13 +1,12 @@
|
||||
import { Page } from '@playwright/test'
|
||||
import { Locator } from '@playwright/test'
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
|
||||
import { test, expect } from './zoo-test'
|
||||
import { EditorFixture } from './fixtures/editorFixture'
|
||||
import { SceneFixture } from './fixtures/sceneFixture'
|
||||
import { ToolbarFixture } from './fixtures/toolbarFixture'
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { Locator } from '@playwright/test'
|
||||
|
||||
// test file is for testing point an click code gen functionality that's not sketch mode related
|
||||
|
||||
|
@ -1,20 +1,19 @@
|
||||
import fs from 'fs'
|
||||
import fsp from 'fs/promises'
|
||||
import { DEFAULT_PROJECT_KCL_FILE } from 'lib/constants'
|
||||
import path from 'path'
|
||||
|
||||
import { test, expect } from './zoo-test'
|
||||
import {
|
||||
Paths,
|
||||
createProject,
|
||||
doExport,
|
||||
executorInputPath,
|
||||
getPlaywrightDownloadDir,
|
||||
getUtils,
|
||||
isOutOfViewInScrollContainer,
|
||||
Paths,
|
||||
createProject,
|
||||
getPlaywrightDownloadDir,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
runningOnWindows,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import fsp from 'fs/promises'
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { DEFAULT_PROJECT_KCL_FILE } from 'lib/constants'
|
||||
|
||||
test(
|
||||
'projects reload if a new one is created, deleted, or renamed externally',
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
import { test, expect } from './zoo-test'
|
||||
/* eslint-disable jest/no-conditional-expect */
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import { orRunWhenFullSuiteEnabled } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
/* eslint-disable jest/no-conditional-expect */
|
||||
|
||||
|
@ -1,18 +1,17 @@
|
||||
import { Page } from '@playwright/test'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { bracket } from 'lib/exampleKcl'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { test, expect } from './zoo-test'
|
||||
import path from 'path'
|
||||
|
||||
import { TEST_CODE_TRIGGER_ENGINE_EXPORT_ERROR } from './storageStates'
|
||||
import * as fsp from 'fs/promises'
|
||||
import {
|
||||
getUtils,
|
||||
TEST_COLORS,
|
||||
TestColor,
|
||||
executorInputPath,
|
||||
getUtils,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { TEST_CODE_TRIGGER_ENGINE_EXPORT_ERROR } from './storageStates'
|
||||
import { bracket } from 'lib/exampleKcl'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
|
||||
test.describe('Regression tests', { tag: ['@skipWin'] }, () => {
|
||||
// bugs we found that don't fit neatly into other categories
|
||||
|
@ -1,20 +1,20 @@
|
||||
import { Page } from '@playwright/test'
|
||||
import { roundOff, uuidv4 } from 'lib/utils'
|
||||
import { test, expect } from './zoo-test'
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
|
||||
import { CmdBarFixture } from './fixtures/cmdBarFixture'
|
||||
import { HomePageFixture } from './fixtures/homePageFixture'
|
||||
import { SceneFixture } from './fixtures/sceneFixture'
|
||||
import { ToolbarFixture } from './fixtures/toolbarFixture'
|
||||
|
||||
import {
|
||||
PERSIST_MODELING_CONTEXT,
|
||||
TEST_COLORS,
|
||||
getMovementUtils,
|
||||
getUtils,
|
||||
PERSIST_MODELING_CONTEXT,
|
||||
TEST_COLORS,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { uuidv4, roundOff } from 'lib/utils'
|
||||
import { SceneFixture } from './fixtures/sceneFixture'
|
||||
import { ToolbarFixture } from './fixtures/toolbarFixture'
|
||||
import { CmdBarFixture } from './fixtures/cmdBarFixture'
|
||||
|
||||
test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
|
||||
test('multi-sketch file shows multiple Edit Sketch buttons', async ({
|
||||
|
@ -1,22 +1,21 @@
|
||||
import { Models } from '@kittycad/lib'
|
||||
import { spawn } from 'child_process'
|
||||
import fsp from 'fs/promises'
|
||||
import JSZip from 'jszip'
|
||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
||||
import path from 'path'
|
||||
|
||||
import { CmdBarFixture } from './fixtures/cmdBarFixture'
|
||||
import { SceneFixture } from './fixtures/sceneFixture'
|
||||
import { test, expect } from './zoo-test'
|
||||
import { secrets } from './secrets'
|
||||
import { TEST_SETTINGS, TEST_SETTINGS_KEY } from './storageStates'
|
||||
import {
|
||||
Paths,
|
||||
doExport,
|
||||
getUtils,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
settingsToToml,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { Models } from '@kittycad/lib'
|
||||
import fsp from 'fs/promises'
|
||||
import { spawn } from 'child_process'
|
||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
||||
import JSZip from 'jszip'
|
||||
import path from 'path'
|
||||
import { TEST_SETTINGS, TEST_SETTINGS_KEY } from './storageStates'
|
||||
import { SceneFixture } from './fixtures/sceneFixture'
|
||||
import { CmdBarFixture } from './fixtures/cmdBarFixture'
|
||||
|
||||
test.beforeEach(async ({ page, context }) => {
|
||||
// Make the user avatar image always 404
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||
import { SaveSettingsPayload } from 'lib/settings/settingsTypes'
|
||||
import { Themes } from 'lib/theme'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||
|
||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||
|
||||
export const IS_PLAYWRIGHT_KEY = 'playwright'
|
||||
|
||||
export const TEST_SETTINGS_KEY = '/settings.toml'
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import { commonPoints, getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
|
||||
import { commonPoints, getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
test.describe('Test network and connection issues', () => {
|
||||
test(
|
||||
'simulate network down and network little widget',
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {
|
||||
orRunWhenFullSuiteEnabled,
|
||||
runningOnLinux,
|
||||
runningOnMac,
|
||||
runningOnWindows,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
|
||||
describe('platform detection utilities', () => {
|
||||
|
@ -1,34 +1,32 @@
|
||||
import * as TOML from '@iarna/toml'
|
||||
import type { Models } from '@kittycad/lib'
|
||||
import {
|
||||
expect,
|
||||
BrowserContext,
|
||||
TestInfo,
|
||||
Locator,
|
||||
Page,
|
||||
TestInfo,
|
||||
expect,
|
||||
} from '@playwright/test'
|
||||
import fsp from 'fs/promises'
|
||||
import { test } from './zoo-test'
|
||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||
import { Configuration } from 'lang/wasm'
|
||||
import { COOKIE_NAME } from 'lib/constants'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
import { isArray } from 'lib/utils'
|
||||
import fsp from 'fs/promises'
|
||||
import path from 'path'
|
||||
import pixelMatch from 'pixelmatch'
|
||||
import { Protocol } from 'playwright-core/types/protocol'
|
||||
import { PNG } from 'pngjs'
|
||||
|
||||
import { ProjectConfiguration } from '@rust/kcl-lib/bindings/ProjectConfiguration'
|
||||
|
||||
import { isErrorWhitelisted } from './lib/console-error-whitelist'
|
||||
import { Protocol } from 'playwright-core/types/protocol'
|
||||
import type { Models } from '@kittycad/lib'
|
||||
import { COOKIE_NAME } from 'lib/constants'
|
||||
import { secrets } from './secrets'
|
||||
import {
|
||||
IS_PLAYWRIGHT_KEY,
|
||||
TEST_SETTINGS,
|
||||
TEST_SETTINGS_KEY,
|
||||
TEST_SETTINGS,
|
||||
IS_PLAYWRIGHT_KEY,
|
||||
} from './storageStates'
|
||||
import { test } from './zoo-test'
|
||||
import * as TOML from '@iarna/toml'
|
||||
import { isErrorWhitelisted } from './lib/console-error-whitelist'
|
||||
import { isArray } from 'lib/utils'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
import { Configuration } from 'lang/wasm'
|
||||
import { ProjectConfiguration } from '@rust/kcl-lib/bindings/ProjectConfiguration'
|
||||
|
||||
const toNormalizedCode = (text: string) => {
|
||||
return text.replace(/\s+/g, '')
|
||||
@ -685,8 +683,8 @@ const _makeTemplate = (
|
||||
isArray(currentOptions)
|
||||
? currentOptions[i]
|
||||
: typeof currentOptions === 'number'
|
||||
? currentOptions
|
||||
: ''
|
||||
? currentOptions
|
||||
: ''
|
||||
)
|
||||
)
|
||||
})
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
|
||||
import { getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
test.describe('Testing Camera Movement', { tag: ['@skipWin'] }, () => {
|
||||
test('Can move camera reliably', async ({ page, context, homePage }) => {
|
||||
|
@ -1,15 +1,14 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import * as fsp from 'fs/promises'
|
||||
import {
|
||||
getUtils,
|
||||
TEST_COLORS,
|
||||
pollEditorLinesSelectedLength,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
import { XOR } from 'lib/utils'
|
||||
import path from 'node:path'
|
||||
|
||||
import {
|
||||
TEST_COLORS,
|
||||
getUtils,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
pollEditorLinesSelectedLength,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
||||
test('Can constrain line length', async ({ page, homePage }) => {
|
||||
await page.addInitScript(async () => {
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
|
||||
import { TEST_CODE_GIZMO } from './storageStates'
|
||||
import { test, expect } from './zoo-test'
|
||||
import { getUtils } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
import { TEST_CODE_GIZMO } from './storageStates'
|
||||
|
||||
test.describe('Testing Gizmo', { tag: ['@skipWin'] }, () => {
|
||||
const cases = [
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import { getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
test.describe('Test toggling perspective', () => {
|
||||
test('via command palette and toggle', async ({ page, homePage }) => {
|
||||
|
@ -1,10 +1,9 @@
|
||||
import * as fsp from 'fs/promises'
|
||||
import { FILE_EXT } from 'lib/constants'
|
||||
import { bracket } from 'lib/exampleKcl'
|
||||
import { join } from 'path'
|
||||
|
||||
import { test, expect } from './zoo-test'
|
||||
import { getUtils } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { bracket } from 'lib/exampleKcl'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { join } from 'path'
|
||||
import { FILE_EXT } from 'lib/constants'
|
||||
|
||||
test.describe('Testing in-app sample loading', () => {
|
||||
/**
|
||||
|
@ -1,15 +1,15 @@
|
||||
import { Page } from '@playwright/test'
|
||||
import { LineInputsType } from 'lang/std/sketchcombos'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
import { test, expect } from './zoo-test'
|
||||
|
||||
import { EditorFixture } from './fixtures/editorFixture'
|
||||
import {
|
||||
deg,
|
||||
getUtils,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
wiggleMove,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { LineInputsType } from 'lang/std/sketchcombos'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
import { EditorFixture } from './fixtures/editorFixture'
|
||||
|
||||
test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
||||
test('Hover over a segment should show its overlay, hovering over the input overlays should show its popover, clicking the input overlay should constrain/unconstrain it:\nfor the following segments', () => {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
|
||||
import { commonPoints, getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
||||
import { Coords2d } from 'lang/std/sketch'
|
||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
|
||||
import { commonPoints, getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
|
||||
test.setTimeout(90_000)
|
||||
test('Selections work on fresh and edited sketch', async ({
|
||||
|
@ -1,26 +1,24 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { PROJECT_SETTINGS_FILE_NAME, SETTINGS_FILE_NAME } from 'lib/constants'
|
||||
import { SettingsLevel } from 'lib/settings/settingsTypes'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
import { join } from 'path'
|
||||
|
||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||
|
||||
import {
|
||||
TEST_SETTINGS,
|
||||
TEST_SETTINGS_CORRUPTED,
|
||||
TEST_SETTINGS_DEFAULT_THEME,
|
||||
TEST_SETTINGS_KEY,
|
||||
} from './storageStates'
|
||||
import {
|
||||
TEST_COLORS,
|
||||
createProject,
|
||||
executorInputPath,
|
||||
getUtils,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
executorInputPath,
|
||||
createProject,
|
||||
tomlToSettings,
|
||||
TEST_COLORS,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { SettingsLevel } from 'lib/settings/settingsTypes'
|
||||
import { SETTINGS_FILE_NAME, PROJECT_SETTINGS_FILE_NAME } from 'lib/constants'
|
||||
import {
|
||||
TEST_SETTINGS_KEY,
|
||||
TEST_SETTINGS_CORRUPTED,
|
||||
TEST_SETTINGS,
|
||||
TEST_SETTINGS_DEFAULT_THEME,
|
||||
} from './storageStates'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||
|
||||
test.describe('Testing settings', () => {
|
||||
test('Stored settings are validated and fall back to defaults', async ({
|
||||
|
@ -1,13 +1,12 @@
|
||||
import { Page } from '@playwright/test'
|
||||
import fs from 'fs'
|
||||
import { join } from 'path'
|
||||
|
||||
import { test, expect } from './zoo-test'
|
||||
import {
|
||||
createProject,
|
||||
getUtils,
|
||||
createProject,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
import { join } from 'path'
|
||||
import fs from 'fs'
|
||||
|
||||
test.describe('Text-to-CAD tests', { tag: ['@skipWin'] }, () => {
|
||||
test('basic lego happy case', async ({ page, homePage }) => {
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
|
||||
import {
|
||||
doExport,
|
||||
getUtils,
|
||||
makeTemplate,
|
||||
orRunWhenFullSuiteEnabled,
|
||||
} from './test-utils'
|
||||
import { expect, test } from './zoo-test'
|
||||
|
||||
test('Units menu', async ({ page, homePage }) => {
|
||||
test.fixme(orRunWhenFullSuiteEnabled())
|
||||
|
@ -1,10 +1,11 @@
|
||||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
|
||||
import { test as playwrightTestFn } from '@playwright/test'
|
||||
|
||||
import {
|
||||
ElectronZoo,
|
||||
Fixtures,
|
||||
fixturesBasedOnProcessEnvPlatform,
|
||||
Fixtures,
|
||||
ElectronZoo,
|
||||
} from './fixtures/fixtureSetup'
|
||||
|
||||
export { expect } from '@playwright/test'
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { FusesPlugin } from '@electron-forge/plugin-fuses'
|
||||
import { VitePlugin } from '@electron-forge/plugin-vite'
|
||||
import type { ForgeConfig } from '@electron-forge/shared-types'
|
||||
import { VitePlugin } from '@electron-forge/plugin-vite'
|
||||
import { FusesPlugin } from '@electron-forge/plugin-fuses'
|
||||
import { FuseV1Options, FuseVersion } from '@electron/fuses'
|
||||
import path from 'path'
|
||||
|
||||
|
2
forge.env.d.ts
vendored
2
forge.env.d.ts
vendored
@ -26,7 +26,7 @@ declare global {
|
||||
|
||||
declare module 'vite' {
|
||||
interface ConfigEnv<
|
||||
K extends keyof VitePluginConfig = keyof VitePluginConfig,
|
||||
K extends keyof VitePluginConfig = keyof VitePluginConfig
|
||||
> {
|
||||
root: string
|
||||
forgeConfig: VitePluginConfig
|
||||
|
12
interface.d.ts
vendored
12
interface.d.ts
vendored
@ -1,13 +1,13 @@
|
||||
import { MachinesListing } from 'components/MachineManagerProvider'
|
||||
import fs from 'node:fs/promises'
|
||||
import fsSync from 'node:fs'
|
||||
import path from 'path'
|
||||
import { dialog, shell } from 'electron'
|
||||
import { MachinesListing } from 'components/MachineManagerProvider'
|
||||
import type { Channel } from 'src/menu/channels'
|
||||
import { Menu, WebContents } from 'electron'
|
||||
import type { WebContentSendPayload } from 'menu/channels'
|
||||
import { ZooLabel, ZooMenuEvents } from 'menu/roles'
|
||||
import type { MenuActionIPC } from 'menu/rules'
|
||||
import fsSync from 'node:fs'
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'path'
|
||||
import type { Channel } from 'src/menu/channels'
|
||||
import type { WebContentSendPayload } from 'menu/channels'
|
||||
|
||||
// Extend the interface with additional custom properties
|
||||
declare module 'electron' {
|
||||
|
@ -135,6 +135,12 @@
|
||||
"test:unit:local": "yarn simpleserver:bg && yarn test:unit; kill-port 3000",
|
||||
"test:unit:kcl-samples:local": "yarn simpleserver:bg && yarn test:unit:kcl-samples; kill-port 3000"
|
||||
},
|
||||
"prettier": {
|
||||
"trailingComma": "es5",
|
||||
"tabWidth": 2,
|
||||
"semi": false,
|
||||
"singleQuote": true
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
@ -161,7 +167,6 @@
|
||||
"@playwright/test": "^1.51.1",
|
||||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"@testing-library/react": "^15.0.2",
|
||||
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
||||
"@types/diff": "^7.0.2",
|
||||
"@types/electron": "^1.6.10",
|
||||
"@types/isomorphic-fetch": "^0.0.39",
|
||||
@ -203,7 +208,7 @@
|
||||
"pngjs": "^7.0.0",
|
||||
"postcss": "^8.4.43",
|
||||
"postinstall-postinstall": "^2.1.0",
|
||||
"prettier": "^3.5.3",
|
||||
"prettier": "^2.8.8",
|
||||
"setimmediate": "^1.0.5",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"ts-node": "^10.0.0",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import dts from 'rollup-plugin-dts'
|
||||
import { lezer } from '@lezer/generator/rollup'
|
||||
import typescript from '@rollup/plugin-typescript'
|
||||
import dts from 'rollup-plugin-dts'
|
||||
|
||||
export default [
|
||||
{
|
||||
|
@ -1,14 +1,14 @@
|
||||
// Base CodeMirror language support for kcl.
|
||||
|
||||
import {
|
||||
LRLanguage,
|
||||
LanguageSupport,
|
||||
indentNodeProp,
|
||||
continuedIndent,
|
||||
delimitedIndent,
|
||||
foldInside,
|
||||
foldNodeProp,
|
||||
indentNodeProp,
|
||||
foldInside,
|
||||
} from '@codemirror/language'
|
||||
|
||||
// @ts-ignore: No types available
|
||||
import { parser } from './kcl.grammar'
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { KclLanguage } from '../src/index'
|
||||
import { fileTests } from '@lezer/generator/dist/test'
|
||||
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
import { KclLanguage } from '../src/index'
|
||||
|
||||
let caseDir = path.dirname(__filename)
|
||||
|
||||
for (let file of fs.readdirSync(caseDir)) {
|
||||
|
@ -1,8 +1,9 @@
|
||||
// Overrides the test options from the modeling-app config.
|
||||
|
||||
import viteTsconfigPaths from 'vite-tsconfig-paths'
|
||||
import { defineConfig, configDefaults } from 'vitest/config'
|
||||
// @ts-ignore: No types available
|
||||
import { lezer } from '@lezer/generator/rollup'
|
||||
import viteTsconfigPaths from 'vite-tsconfig-paths'
|
||||
import { configDefaults, defineConfig } from 'vitest/config'
|
||||
|
||||
const config = defineConfig({
|
||||
test: {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { decoder, encoder } from '../codec'
|
||||
import { encoder, decoder } from '../codec'
|
||||
|
||||
export default class Bytes {
|
||||
static encode(input: string): Uint8Array {
|
||||
@ -10,7 +10,7 @@ export default class Bytes {
|
||||
}
|
||||
|
||||
static append<
|
||||
T extends { length: number; set(arr: T, offset: number): void },
|
||||
T extends { length: number; set(arr: T, offset: number): void }
|
||||
>(constructor: { new (length: number): T }, ...arrays: T[]) {
|
||||
let totalLength = 0
|
||||
for (const arr of arrays) {
|
||||
|
@ -2,9 +2,9 @@ import * as vsrpc from 'vscode-jsonrpc'
|
||||
|
||||
import { Codec } from '.'
|
||||
import Bytes from './bytes'
|
||||
import PromiseMap from './map'
|
||||
import Queue from './queue'
|
||||
import Tracer from './tracer'
|
||||
import PromiseMap from './map'
|
||||
|
||||
export default class StreamDemuxer extends Queue<Uint8Array> {
|
||||
readonly responses: PromiseMap<number | string, vsrpc.ResponseMessage> =
|
||||
|
@ -1,8 +1,8 @@
|
||||
import type * as LSP from 'vscode-languageserver-protocol'
|
||||
|
||||
import { LanguageServerPlugin } from '../plugin/lsp'
|
||||
import { FromServer, IntoServer } from './codec'
|
||||
import Client from './jsonrpc'
|
||||
import { LanguageServerPlugin } from '../plugin/lsp'
|
||||
|
||||
// https://microsoft.github.io/language-server-protocol/specifications/specification-current/
|
||||
|
||||
@ -12,15 +12,15 @@ interface LSPRequestMap {
|
||||
'textDocument/hover': [LSP.HoverParams, LSP.Hover]
|
||||
'textDocument/completion': [
|
||||
LSP.CompletionParams,
|
||||
LSP.CompletionItem[] | LSP.CompletionList | null,
|
||||
LSP.CompletionItem[] | LSP.CompletionList | null
|
||||
]
|
||||
'textDocument/semanticTokens/full': [
|
||||
LSP.SemanticTokensParams,
|
||||
LSP.SemanticTokens,
|
||||
LSP.SemanticTokens
|
||||
]
|
||||
'textDocument/formatting': [
|
||||
LSP.DocumentFormattingParams,
|
||||
LSP.TextEdit[] | null,
|
||||
LSP.TextEdit[] | null
|
||||
]
|
||||
'textDocument/foldingRange': [LSP.FoldingRangeParams, LSP.FoldingRange[]]
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import * as jsrpc from 'json-rpc-2.0'
|
||||
import * as LSP from 'vscode-languageserver-protocol'
|
||||
|
||||
import { Codec, FromServer, IntoServer } from './codec'
|
||||
import {
|
||||
registerServerCapability,
|
||||
unregisterServerCapability,
|
||||
} from './server-capability-registration'
|
||||
import { Codec, FromServer, IntoServer } from './codec'
|
||||
|
||||
const client_capabilities: LSP.ClientCapabilities = {
|
||||
textDocument: {
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { foldService } from '@codemirror/language'
|
||||
import { EditorState, Extension } from '@codemirror/state'
|
||||
import { Extension, EditorState } from '@codemirror/state'
|
||||
import { ViewPlugin } from '@codemirror/view'
|
||||
|
||||
import {
|
||||
LanguageServerOptions,
|
||||
docPathFacet,
|
||||
LanguageServerPlugin,
|
||||
LanguageServerPluginSpec,
|
||||
docPathFacet,
|
||||
languageId,
|
||||
workspaceFolders,
|
||||
LanguageServerOptions,
|
||||
} from './plugin/lsp'
|
||||
|
||||
export type { LanguageServerClientOptions } from './client'
|
||||
|
@ -9,9 +9,9 @@ import {
|
||||
prevSnippetField,
|
||||
startCompletion,
|
||||
} from '@codemirror/autocomplete'
|
||||
import { syntaxTree } from '@codemirror/language'
|
||||
import { Extension, Prec } from '@codemirror/state'
|
||||
import { EditorView, KeyBinding, ViewPlugin, keymap } from '@codemirror/view'
|
||||
import { Prec, Extension } from '@codemirror/state'
|
||||
import { EditorView, keymap, KeyBinding, ViewPlugin } from '@codemirror/view'
|
||||
|
||||
import {
|
||||
CompletionItemKind,
|
||||
CompletionTriggerKind,
|
||||
@ -19,6 +19,7 @@ import {
|
||||
|
||||
import { LanguageServerPlugin } from './lsp'
|
||||
import { offsetToPos } from './util'
|
||||
import { syntaxTree } from '@codemirror/language'
|
||||
|
||||
export const CompletionItemKindMap = Object.fromEntries(
|
||||
Object.entries(CompletionItemKind).map(([key, value]) => [value, key])
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Extension, Prec } from '@codemirror/state'
|
||||
import { EditorView, KeyBinding, ViewPlugin, keymap } from '@codemirror/view'
|
||||
import { EditorView, keymap, KeyBinding, ViewPlugin } from '@codemirror/view'
|
||||
|
||||
import { LanguageServerPlugin } from './lsp'
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { Extension } from '@codemirror/state'
|
||||
import {
|
||||
EditorView,
|
||||
ViewPlugin,
|
||||
hoverTooltip,
|
||||
tooltips,
|
||||
ViewPlugin,
|
||||
EditorView,
|
||||
} from '@codemirror/view'
|
||||
|
||||
import { LanguageServerPlugin } from './lsp'
|
||||
|
@ -4,38 +4,39 @@ import type {
|
||||
CompletionResult,
|
||||
} from '@codemirror/autocomplete'
|
||||
import { completeFromList, snippetCompletion } from '@codemirror/autocomplete'
|
||||
import { linter } from '@codemirror/lint'
|
||||
import {
|
||||
Annotation,
|
||||
Extension,
|
||||
Facet,
|
||||
StateEffect,
|
||||
Extension,
|
||||
Transaction,
|
||||
Annotation,
|
||||
} from '@codemirror/state'
|
||||
import type {
|
||||
PluginSpec,
|
||||
PluginValue,
|
||||
ViewPlugin,
|
||||
ViewUpdate,
|
||||
PluginValue,
|
||||
PluginSpec,
|
||||
ViewPlugin,
|
||||
} from '@codemirror/view'
|
||||
import { EditorView, Tooltip } from '@codemirror/view'
|
||||
import { linter } from '@codemirror/lint'
|
||||
|
||||
import type { PublishDiagnosticsParams } from 'vscode-languageserver-protocol'
|
||||
import type * as LSP from 'vscode-languageserver-protocol'
|
||||
import {
|
||||
CompletionTriggerKind,
|
||||
DiagnosticSeverity,
|
||||
CompletionTriggerKind,
|
||||
} from 'vscode-languageserver-protocol'
|
||||
import { URI } from 'vscode-uri'
|
||||
|
||||
import { LanguageServerClient } from '../client'
|
||||
import { CompletionItemKindMap } from './autocomplete'
|
||||
import { addToken, SemanticToken } from './semantic-tokens'
|
||||
import { posToOffset, formatMarkdownContents } from './util'
|
||||
import lspAutocompleteExt from './autocomplete'
|
||||
import lspFormatExt from './format'
|
||||
import lspHoverExt from './hover'
|
||||
import lspFormatExt from './format'
|
||||
import lspIndentExt from './indent'
|
||||
import { SemanticToken, addToken } from './semantic-tokens'
|
||||
import lspSemanticTokensExt from './semantic-tokens'
|
||||
import { formatMarkdownContents, posToOffset } from './util'
|
||||
|
||||
const useLast = (values: readonly any[]) => values.reduce((_, v) => v, '')
|
||||
export const docPathFacet = Facet.define<string, string>({
|
||||
@ -97,10 +98,7 @@ export class LanguageServerPlugin implements PluginValue {
|
||||
// document.
|
||||
private sendScheduled: number | null = null
|
||||
|
||||
constructor(
|
||||
options: LanguageServerOptions,
|
||||
private view: EditorView
|
||||
) {
|
||||
constructor(options: LanguageServerOptions, private view: EditorView) {
|
||||
this.client = options.client
|
||||
this.documentVersion = 0
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { highlightingFor } from '@codemirror/language'
|
||||
import { Extension, StateEffect, StateField } from '@codemirror/state'
|
||||
import { Decoration, DecorationSet, EditorView } from '@codemirror/view'
|
||||
import { StateEffect, StateField, Extension } from '@codemirror/state'
|
||||
import { EditorView, Decoration, DecorationSet } from '@codemirror/view'
|
||||
|
||||
import { Tag, tags } from '@lezer/highlight'
|
||||
|
||||
import { lspSemanticTokensEvent } from './lsp'
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Text } from '@codemirror/state'
|
||||
import { Marked, MarkedOptions } from '@ts-stack/markdown'
|
||||
import type * as LSP from 'vscode-languageserver-protocol'
|
||||
|
||||
import type * as LSP from 'vscode-languageserver-protocol'
|
||||
import { isArray } from '../lib/utils'
|
||||
|
||||
// takes a function and executes it after the wait time, if the function is called again before the wait time is up, the timer is reset
|
||||
|
@ -1,10 +0,0 @@
|
||||
module.exports = {
|
||||
trailingComma: 'es5',
|
||||
tabWidth: 2,
|
||||
semi: false,
|
||||
singleQuote: true,
|
||||
importOrder: ['<THIRD_PARTY_MODULES>', '^@rust/(.*)$', '^[./]'],
|
||||
importOrderSeparation: true,
|
||||
importOrderSortSpecifiers: true,
|
||||
plugins: ['@trivago/prettier-plugin-sort-imports'],
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||
import { exec } from 'child_process'
|
||||
import * as os from 'os'
|
||||
import * as vscode from 'vscode'
|
||||
|
||||
import * as os from 'os'
|
||||
import type { Config } from './config'
|
||||
import { log, isValidExecutable } from './util'
|
||||
import type { PersistentState } from './persistent_state'
|
||||
import { isValidExecutable, log } from './util'
|
||||
import { exec } from 'child_process'
|
||||
|
||||
export async function bootstrap(
|
||||
context: vscode.ExtensionContext,
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||
import type * as vscode from 'vscode'
|
||||
import * as lc from 'vscode-languageclient/node'
|
||||
import type * as vscode from 'vscode'
|
||||
|
||||
export async function createClient(
|
||||
traceOutputChannel: vscode.OutputChannel,
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||
import { spawnSync } from 'child_process'
|
||||
import * as vscode from 'vscode'
|
||||
|
||||
import type { Cmd, CtxInit } from './ctx'
|
||||
import { spawnSync } from 'child_process'
|
||||
|
||||
export function serverVersion(ctx: CtxInit): Cmd {
|
||||
return async () => {
|
||||
|
@ -1,11 +1,10 @@
|
||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||
import * as Is from 'vscode-languageclient/lib/common/utils/is'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import * as vscode from 'vscode'
|
||||
import * as Is from 'vscode-languageclient/lib/common/utils/is'
|
||||
|
||||
import { log, type Env } from './util'
|
||||
import { expectNotUndefined, unwrapUndefinable } from './undefinable'
|
||||
import { type Env, log } from './util'
|
||||
|
||||
export type RunnableEnvCfgItem = {
|
||||
mask?: string
|
||||
|
@ -1,20 +1,20 @@
|
||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||
import * as vscode from 'vscode'
|
||||
import type * as lc from 'vscode-languageclient/node'
|
||||
import { TransportKind } from 'vscode-languageclient/node'
|
||||
|
||||
import { bootstrap } from './bootstrap'
|
||||
import { createClient } from './client'
|
||||
import { Config, prepareVSCodeConfig } from './config'
|
||||
import type { ServerStatusParams } from './lsp_ext'
|
||||
import { PersistentState } from './persistent_state'
|
||||
import { createClient } from './client'
|
||||
import {
|
||||
type KclEditor,
|
||||
LazyOutputChannel,
|
||||
isKclDocument,
|
||||
isKclEditor,
|
||||
LazyOutputChannel,
|
||||
log,
|
||||
type KclEditor,
|
||||
} from './util'
|
||||
import type { ServerStatusParams } from './lsp_ext'
|
||||
import { PersistentState } from './persistent_state'
|
||||
import { bootstrap } from './bootstrap'
|
||||
import { TransportKind } from 'vscode-languageclient/node'
|
||||
|
||||
// We only support local folders, not eg. Live Share (`vlsl:` scheme), so don't activate if
|
||||
// only those are in use. We use "Empty" to represent these scenarios
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||
import type * as vscode from 'vscode'
|
||||
|
||||
import { log } from './util'
|
||||
|
||||
export class PersistentState {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { runTests } from '@vscode/test-electron'
|
||||
import * as path from 'path'
|
||||
|
||||
import { runTests } from '@vscode/test-electron'
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
// The folder containing the Extension Manifest package.json
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as assert from 'assert'
|
||||
|
||||
// You can import and use all API from the 'vscode' module
|
||||
// as well as import your extension to test it
|
||||
import * as vscode from 'vscode'
|
||||
|
||||
// import * as myExtension from '../../extension';
|
||||
|
||||
suite('Extension Test Suite', () => {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import * as path from 'path'
|
||||
|
||||
const Mocha = require('mocha')
|
||||
const { glob } = require('glob')
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||
import { strict as nativeAssert } from 'assert'
|
||||
import { type ExecOptions, exec, spawnSync } from 'child_process'
|
||||
import { inspect } from 'util'
|
||||
import * as vscode from 'vscode'
|
||||
import { strict as nativeAssert } from 'assert'
|
||||
import { exec, type ExecOptions, spawnSync } from 'child_process'
|
||||
import { inspect } from 'util'
|
||||
|
||||
export interface Env {
|
||||
[name: string]: string
|
||||
|
54
src/App.tsx
54
src/App.tsx
@ -1,38 +1,36 @@
|
||||
import { CameraProjectionToggle } from 'components/CameraProjectionToggle'
|
||||
import { useEngineCommands } from 'components/EngineCommands'
|
||||
import Gizmo from 'components/Gizmo'
|
||||
import { LowerRightControls } from 'components/LowerRightControls'
|
||||
import { useEffect, useMemo, useRef } from 'react'
|
||||
import { useHotKeyListener } from './hooks/useHotKeyListener'
|
||||
import { Stream } from './components/Stream'
|
||||
import { AppHeader } from './components/AppHeader'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { useLoaderData, useNavigate } from 'react-router-dom'
|
||||
import { type IndexLoaderData } from 'lib/types'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||
import { useEngineConnectionSubscriptions } from 'hooks/useEngineConnectionSubscriptions'
|
||||
import { codeManager, engineCommandManager } from 'lib/singletons'
|
||||
import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { useLspContext } from 'components/LspProvider'
|
||||
import { ModelingSidebar } from 'components/ModelingSidebar/ModelingSidebar'
|
||||
import { UnitsMenu } from 'components/UnitsMenu'
|
||||
import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath'
|
||||
import { useCreateFileLinkQuery } from 'hooks/useCreateFileLinkQueryWatcher'
|
||||
import { useEngineConnectionSubscriptions } from 'hooks/useEngineConnectionSubscriptions'
|
||||
import { CoreDumpManager } from 'lib/coredump'
|
||||
import { writeProjectThumbnailFile } from 'lib/desktop'
|
||||
import { LowerRightControls } from 'components/LowerRightControls'
|
||||
import ModalContainer from 'react-modal-promise'
|
||||
import useHotkeyWrapper from 'lib/hotkeyWrapper'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { takeScreenshotOfVideoStreamCanvas } from 'lib/screenshot'
|
||||
import { codeManager, engineCommandManager } from 'lib/singletons'
|
||||
import { rustContext } from 'lib/singletons'
|
||||
import Gizmo from 'components/Gizmo'
|
||||
import { CoreDumpManager } from 'lib/coredump'
|
||||
import { UnitsMenu } from 'components/UnitsMenu'
|
||||
import { CameraProjectionToggle } from 'components/CameraProjectionToggle'
|
||||
import { useCreateFileLinkQuery } from 'hooks/useCreateFileLinkQueryWatcher'
|
||||
import { maybeWriteToDisk } from 'lib/telemetry'
|
||||
import { type IndexLoaderData } from 'lib/types'
|
||||
import { takeScreenshotOfVideoStreamCanvas } from 'lib/screenshot'
|
||||
import { writeProjectThumbnailFile } from 'lib/desktop'
|
||||
import { useRouteLoaderData } from 'react-router-dom'
|
||||
import { useEngineCommands } from 'components/EngineCommands'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { useToken } from 'machines/appMachine'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { useEffect, useMemo, useRef } from 'react'
|
||||
import { rustContext } from 'lib/singletons'
|
||||
import toast from 'react-hot-toast'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import ModalContainer from 'react-modal-promise'
|
||||
import { useLoaderData, useNavigate } from 'react-router-dom'
|
||||
import { useRouteLoaderData } from 'react-router-dom'
|
||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||
|
||||
import { AppHeader } from './components/AppHeader'
|
||||
import { Stream } from './components/Stream'
|
||||
import { useHotKeyListener } from './hooks/useHotKeyListener'
|
||||
|
||||
maybeWriteToDisk()
|
||||
.then(() => {})
|
||||
.catch(() => {})
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ReactNode, createContext, useContext, useState } from 'react'
|
||||
import { createContext, useContext, useState, ReactNode } from 'react'
|
||||
|
||||
/*
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { useAuthState } from 'machines/appMachine'
|
||||
|
||||
import Loading from './components/Loading'
|
||||
|
||||
// Wrapper around protected routes, used in src/Router.tsx
|
||||
|
@ -1,47 +1,46 @@
|
||||
import { AppStateProvider } from 'AppState'
|
||||
import { CommandBar } from 'components/CommandBar/CommandBar'
|
||||
import DownloadAppBanner from 'components/DownloadAppBanner'
|
||||
import FileMachineProvider from 'components/FileMachineProvider'
|
||||
import LspProvider from 'components/LspProvider'
|
||||
import { MachineManagerProvider } from 'components/MachineManagerProvider'
|
||||
import ModelingMachineProvider from 'components/ModelingMachineProvider'
|
||||
import { OpenInDesktopAppHandler } from 'components/OpenInDesktopAppHandler'
|
||||
import { ProjectsContextProvider } from 'components/ProjectsContextProvider'
|
||||
import { RouteProvider } from 'components/RouteProvider'
|
||||
import { WasmErrBanner } from 'components/WasmErrBanner'
|
||||
import { KclContextProvider } from 'lang/KclProvider'
|
||||
import { coreDump } from 'lang/wasm'
|
||||
import { ASK_TO_OPEN_QUERY_PARAM, BROWSER_PROJECT_NAME } from 'lib/constants'
|
||||
import { CoreDumpManager } from 'lib/coredump'
|
||||
import useHotkeyWrapper from 'lib/hotkeyWrapper'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { fileLoader, homeLoader, telemetryLoader } from 'lib/routeLoaders'
|
||||
import { codeManager, engineCommandManager } from 'lib/singletons'
|
||||
import { rustContext } from 'lib/singletons'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { useToken } from 'machines/appMachine'
|
||||
import { useMemo } from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import { App } from './App'
|
||||
import {
|
||||
Outlet,
|
||||
RouterProvider,
|
||||
createBrowserRouter,
|
||||
createHashRouter,
|
||||
Outlet,
|
||||
redirect,
|
||||
RouterProvider,
|
||||
} from 'react-router-dom'
|
||||
|
||||
import { App } from './App'
|
||||
import { Auth } from './Auth'
|
||||
import { ErrorPage } from './components/ErrorPage'
|
||||
import { Settings } from './routes/Settings'
|
||||
import { Telemetry } from './routes/Telemetry'
|
||||
import Onboarding, { onboardingRoutes } from './routes/Onboarding'
|
||||
import SignIn from './routes/SignIn'
|
||||
import { Auth } from './Auth'
|
||||
import { isDesktop } from './lib/isDesktop'
|
||||
import Home from './routes/Home'
|
||||
import { NetworkContext } from './hooks/useNetworkContext'
|
||||
import { useNetworkStatus } from './hooks/useNetworkStatus'
|
||||
import { isDesktop } from './lib/isDesktop'
|
||||
import makeUrlPathRelative from './lib/makeUrlPathRelative'
|
||||
import Home from './routes/Home'
|
||||
import Onboarding, { onboardingRoutes } from './routes/Onboarding'
|
||||
import { Settings } from './routes/Settings'
|
||||
import SignIn from './routes/SignIn'
|
||||
import { Telemetry } from './routes/Telemetry'
|
||||
import DownloadAppBanner from 'components/DownloadAppBanner'
|
||||
import { WasmErrBanner } from 'components/WasmErrBanner'
|
||||
import { CommandBar } from 'components/CommandBar/CommandBar'
|
||||
import ModelingMachineProvider from 'components/ModelingMachineProvider'
|
||||
import FileMachineProvider from 'components/FileMachineProvider'
|
||||
import { MachineManagerProvider } from 'components/MachineManagerProvider'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { fileLoader, homeLoader, telemetryLoader } from 'lib/routeLoaders'
|
||||
import LspProvider from 'components/LspProvider'
|
||||
import { KclContextProvider } from 'lang/KclProvider'
|
||||
import { ASK_TO_OPEN_QUERY_PARAM, BROWSER_PROJECT_NAME } from 'lib/constants'
|
||||
import { CoreDumpManager } from 'lib/coredump'
|
||||
import { codeManager, engineCommandManager } from 'lib/singletons'
|
||||
import useHotkeyWrapper from 'lib/hotkeyWrapper'
|
||||
import toast from 'react-hot-toast'
|
||||
import { coreDump } from 'lang/wasm'
|
||||
import { useMemo } from 'react'
|
||||
import { AppStateProvider } from 'AppState'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { RouteProvider } from 'components/RouteProvider'
|
||||
import { ProjectsContextProvider } from 'components/ProjectsContextProvider'
|
||||
import { useToken } from 'machines/appMachine'
|
||||
import { OpenInDesktopAppHandler } from 'components/OpenInDesktopAppHandler'
|
||||
import { rustContext } from 'lib/singletons'
|
||||
|
||||
const createRouter = isDesktop() ? createHashRouter : createBrowserRouter
|
||||
|
||||
|
@ -1,28 +1,28 @@
|
||||
import { useAppState } from 'AppState'
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import { ActionButtonDropdown } from 'components/ActionButtonDropdown'
|
||||
import { CustomIcon } from 'components/CustomIcon'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { useRef, useMemo, memo, useCallback, useState } from 'react'
|
||||
import { isCursorInSketchCommandRange } from 'lang/util'
|
||||
import { editorManager, kclManager } from 'lib/singletons'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { useNetworkContext } from 'hooks/useNetworkContext'
|
||||
import { NetworkHealthState } from 'hooks/useNetworkStatus'
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import { isCursorInFunctionDefinition } from 'lang/queryAst'
|
||||
import { isCursorInSketchCommandRange } from 'lang/util'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||
import { editorManager, kclManager } from 'lib/singletons'
|
||||
import { ActionButtonDropdown } from 'components/ActionButtonDropdown'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { useAppState } from 'AppState'
|
||||
import { CustomIcon } from 'components/CustomIcon'
|
||||
import {
|
||||
toolbarConfig,
|
||||
ToolbarItem,
|
||||
ToolbarItemCallbackProps,
|
||||
ToolbarItemResolved,
|
||||
ToolbarModeName,
|
||||
toolbarConfig,
|
||||
} from 'lib/toolbar'
|
||||
import { isArray } from 'lib/utils'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||
import { isCursorInFunctionDefinition } from 'lang/queryAst'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { memo, useCallback, useMemo, useRef, useState } from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { isArray } from 'lib/utils'
|
||||
|
||||
export function Toolbar({
|
||||
className = '',
|
||||
|
@ -1,16 +1,4 @@
|
||||
import { CameraDragInteractionType_type } from '@kittycad/lib/dist/types/src/models'
|
||||
import * as TWEEN from '@tweenjs/tween.js'
|
||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||
import {
|
||||
EngineCommandManager,
|
||||
Subscription,
|
||||
UnreliableSubscription,
|
||||
} from 'lang/std/engineConnection'
|
||||
import { MouseGuard, cameraMouseDragGuards } from 'lib/cameraControls'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { getNormalisedCoordinates, toSync, uuidv4 } from 'lib/utils'
|
||||
import { isReducedMotion, roundOff, throttle } from 'lib/utils'
|
||||
import { deg2Rad } from 'lib/utils2d'
|
||||
import { cameraMouseDragGuards, MouseGuard } from 'lib/cameraControls'
|
||||
import {
|
||||
Euler,
|
||||
MathUtils,
|
||||
@ -22,16 +10,26 @@ import {
|
||||
Vector2,
|
||||
Vector3,
|
||||
} from 'three'
|
||||
|
||||
import { CameraProjectionType } from '@rust/kcl-lib/bindings/CameraProjectionType'
|
||||
|
||||
import { isQuaternionVertical } from './helpers'
|
||||
import {
|
||||
DEBUG_SHOW_INTERSECTION_PLANE,
|
||||
INTERSECTION_PLANE_LAYER,
|
||||
SKETCH_LAYER,
|
||||
ZOOM_MAGIC_NUMBER,
|
||||
} from './sceneInfra'
|
||||
import {
|
||||
Subscription,
|
||||
EngineCommandManager,
|
||||
UnreliableSubscription,
|
||||
} from 'lang/std/engineConnection'
|
||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||
import { toSync, uuidv4, getNormalisedCoordinates } from 'lib/utils'
|
||||
import { deg2Rad } from 'lib/utils2d'
|
||||
import { isReducedMotion, roundOff, throttle } from 'lib/utils'
|
||||
import * as TWEEN from '@tweenjs/tween.js'
|
||||
import { isQuaternionVertical } from './helpers'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { CameraProjectionType } from '@rust/kcl-lib/bindings/CameraProjectionType'
|
||||
import { CameraDragInteractionType_type } from '@kittycad/lib/dist/types/src/models'
|
||||
|
||||
const ORTHOGRAPHIC_CAMERA_SIZE = 20
|
||||
const FRAMES_TO_ANIMATE_IN = 30
|
||||
|
@ -1,55 +1,54 @@
|
||||
import { Dialog, Popover, Transition } from '@headlessui/react'
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import { CustomIcon, CustomIconName } from 'components/CustomIcon'
|
||||
import { useRef, useEffect, useState, useMemo, Fragment } from 'react'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { executeAstMock } from 'lang/langHelpers'
|
||||
import {
|
||||
deleteSegmentFromPipeExpression,
|
||||
removeSingleConstraintInfo,
|
||||
} from 'lang/modifyAst'
|
||||
import { findUsesOfTagInPipe, getNodeFromPath } from 'lang/queryAst'
|
||||
import { getConstraintInfo, getConstraintInfoKw } from 'lang/std/sketch'
|
||||
import { ConstrainInfo } from 'lang/std/stdTypes'
|
||||
import {
|
||||
CallExpression,
|
||||
CallExpressionKw,
|
||||
Expr,
|
||||
PathToNode,
|
||||
Program,
|
||||
defaultSourceRange,
|
||||
parse,
|
||||
recast,
|
||||
resultIsOk,
|
||||
topLevelRange,
|
||||
} from 'lang/wasm'
|
||||
|
||||
import { cameraMouseDragGuards } from 'lib/cameraControls'
|
||||
import { ARROWHEAD, DEBUG_SHOW_BOTH_SCENES } from './sceneInfra'
|
||||
import { ReactCameraProperties } from './CameraControls'
|
||||
import { throttle, toSync } from 'lib/utils'
|
||||
import {
|
||||
sceneInfra,
|
||||
kclManager,
|
||||
codeManager,
|
||||
editorManager,
|
||||
engineCommandManager,
|
||||
kclManager,
|
||||
rustContext,
|
||||
sceneEntitiesManager,
|
||||
sceneInfra,
|
||||
engineCommandManager,
|
||||
rustContext,
|
||||
} from 'lib/singletons'
|
||||
import { err, reportRejection, trap } from 'lib/trap'
|
||||
import { throttle, toSync } from 'lib/utils'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { SegmentOverlay, SketchDetails } from 'machines/modelingMachine'
|
||||
import { Fragment, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import { InstanceProps, create } from 'react-modal-promise'
|
||||
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
|
||||
import { ReactCameraProperties } from './CameraControls'
|
||||
import {
|
||||
EXTRA_SEGMENT_HANDLE,
|
||||
PROFILE_START,
|
||||
getParentGroup,
|
||||
} from './sceneEntities'
|
||||
import { ARROWHEAD, DEBUG_SHOW_BOTH_SCENES } from './sceneInfra'
|
||||
import { SegmentOverlay, SketchDetails } from 'machines/modelingMachine'
|
||||
import { findUsesOfTagInPipe, getNodeFromPath } from 'lang/queryAst'
|
||||
import {
|
||||
CallExpression,
|
||||
CallExpressionKw,
|
||||
PathToNode,
|
||||
Program,
|
||||
Expr,
|
||||
parse,
|
||||
recast,
|
||||
defaultSourceRange,
|
||||
resultIsOk,
|
||||
topLevelRange,
|
||||
} from 'lang/wasm'
|
||||
import { CustomIcon, CustomIconName } from 'components/CustomIcon'
|
||||
import { ConstrainInfo } from 'lang/std/stdTypes'
|
||||
import { getConstraintInfo, getConstraintInfoKw } from 'lang/std/sketch'
|
||||
import { Dialog, Popover, Transition } from '@headlessui/react'
|
||||
import toast from 'react-hot-toast'
|
||||
import { InstanceProps, create } from 'react-modal-promise'
|
||||
import { executeAstMock } from 'lang/langHelpers'
|
||||
import {
|
||||
deleteSegmentFromPipeExpression,
|
||||
removeSingleConstraintInfo,
|
||||
} from 'lang/modifyAst'
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import { err, reportRejection, trap } from 'lib/trap'
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
|
||||
function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } {
|
||||
const [isCamMoving, setIsCamMoving] = useState(false)
|
||||
@ -636,8 +635,8 @@ const ConstraintSymbol = ({
|
||||
implicitDesc
|
||||
? 'bg-chalkboard-10 dark:bg-chalkboard-100 border-transparent border-0 rounded'
|
||||
: isConstrained
|
||||
? 'bg-chalkboard-10 dark:bg-chalkboard-90 dark:hover:bg-chalkboard-80 border-chalkboard-40 dark:border-chalkboard-70 rounded-sm'
|
||||
: 'bg-primary/30 dark:bg-primary text-primary dark:text-chalkboard-10 dark:border-transparent group-hover:bg-primary/40 group-hover:border-primary/50 group-hover:brightness-125'
|
||||
? 'bg-chalkboard-10 dark:bg-chalkboard-90 dark:hover:bg-chalkboard-80 border-chalkboard-40 dark:border-chalkboard-70 rounded-sm'
|
||||
: 'bg-primary/30 dark:bg-primary text-primary dark:text-chalkboard-10 dark:border-transparent group-hover:bg-primary/40 group-hover:border-primary/50 group-hover:brightness-125'
|
||||
} h-[26px] w-[26px] rounded-sm relative m-0 p-0`}
|
||||
onMouseEnter={() => {
|
||||
editorManager.setHighlightRange([range])
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Quaternion } from 'three'
|
||||
|
||||
import { isQuaternionVertical } from './helpers'
|
||||
|
||||
describe('isQuaternionVertical', () => {
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { compareVec2Epsilon2 } from 'lang/std/sketch'
|
||||
import {
|
||||
GridHelper,
|
||||
Group,
|
||||
LineBasicMaterial,
|
||||
Mesh,
|
||||
OrthographicCamera,
|
||||
PerspectiveCamera,
|
||||
Group,
|
||||
Mesh,
|
||||
Quaternion,
|
||||
Vector3,
|
||||
} from 'three'
|
||||
|
@ -1,89 +1,8 @@
|
||||
import { Models } from '@kittycad/lib'
|
||||
import { ToolTip, executeAstMock } from 'lang/langHelpers'
|
||||
import { updateModelingState } from 'lang/modelingWorkflows'
|
||||
import {
|
||||
createArrayExpression,
|
||||
createCallExpressionStdLib,
|
||||
createCallExpressionStdLibKw,
|
||||
createLabeledArg,
|
||||
createLiteral,
|
||||
createLocalName,
|
||||
createNodeFromExprSnippet,
|
||||
createPipeExpression,
|
||||
createPipeSubstitution,
|
||||
createVariableDeclaration,
|
||||
findUniqueName,
|
||||
getInsertIndex,
|
||||
insertNewStartProfileAt,
|
||||
updateSketchNodePathsWithInsertIndex,
|
||||
} from 'lang/modifyAst'
|
||||
import { getNodeFromPath } from 'lang/queryAst'
|
||||
import { getNodePathFromSourceRange } from 'lang/queryAstNodePathUtils'
|
||||
import { codeRefFromRange, getArtifactFromRange } from 'lang/std/artifactGraph'
|
||||
import { EngineCommandManager } from 'lang/std/engineConnection'
|
||||
import {
|
||||
ARG_END_ABSOLUTE,
|
||||
Coords2d,
|
||||
addCallExpressionsToPipe,
|
||||
addCloseToPipe,
|
||||
addNewSketchLn,
|
||||
changeSketchArguments,
|
||||
updateStartProfileAtArgs,
|
||||
} from 'lang/std/sketch'
|
||||
import { SegmentInputs } from 'lang/std/stdTypes'
|
||||
import {
|
||||
CallExpression,
|
||||
CallExpressionKw,
|
||||
Path,
|
||||
PathToNode,
|
||||
PipeExpression,
|
||||
Program,
|
||||
Sketch,
|
||||
SourceRange,
|
||||
VariableDeclaration,
|
||||
VariableDeclarator,
|
||||
VariableMap,
|
||||
defaultSourceRange,
|
||||
parse,
|
||||
recast,
|
||||
resultIsOk,
|
||||
sketchFromKclValue,
|
||||
sourceRangeFromRust,
|
||||
topLevelRange,
|
||||
} from 'lang/wasm'
|
||||
import { EXECUTION_TYPE_MOCK } from 'lib/constants'
|
||||
import {
|
||||
getRectangleCallExpressions,
|
||||
updateCenterRectangleSketch,
|
||||
updateRectangleSketch,
|
||||
} from 'lib/rectangleTool'
|
||||
import { Selections, getEventForSegmentSelection } from 'lib/selections'
|
||||
import {
|
||||
codeManager,
|
||||
editorManager,
|
||||
engineCommandManager,
|
||||
kclManager,
|
||||
rustContext,
|
||||
sceneInfra,
|
||||
} from 'lib/singletons'
|
||||
import { Themes, getThemeColorForThreeJs } from 'lib/theme'
|
||||
import { err, reportRejection, trap } from 'lib/trap'
|
||||
import { isArray, isOverlap, roundOff } from 'lib/utils'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
import {
|
||||
SegmentOverlayPayload,
|
||||
SketchDetails,
|
||||
SketchDetailsUpdate,
|
||||
SketchTool,
|
||||
} from 'machines/modelingMachine'
|
||||
import toast from 'react-hot-toast'
|
||||
import {
|
||||
BoxGeometry,
|
||||
DoubleSide,
|
||||
ExtrudeGeometry,
|
||||
Group,
|
||||
Intersection,
|
||||
LineCurve3,
|
||||
Mesh,
|
||||
MeshBasicMaterial,
|
||||
Object3D,
|
||||
@ -93,24 +12,19 @@ import {
|
||||
PlaneGeometry,
|
||||
Points,
|
||||
Quaternion,
|
||||
Shape,
|
||||
Vector2,
|
||||
Vector3,
|
||||
Shape,
|
||||
LineCurve3,
|
||||
ExtrudeGeometry,
|
||||
} from 'three'
|
||||
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||
import { radToDeg } from 'three/src/math/MathUtils'
|
||||
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
import { Point3d } from '@rust/kcl-lib/bindings/Point3d'
|
||||
|
||||
import { isQuaternionVertical, quaternionFromUpNForward } from './helpers'
|
||||
import { createGridHelper, orthoScale, perspScale } from './helpers'
|
||||
import {
|
||||
ANGLE_SNAP_THRESHOLD_DEGREES,
|
||||
ARROWHEAD,
|
||||
AXIS_GROUP,
|
||||
DRAFT_POINT,
|
||||
DRAFT_POINT_GROUP,
|
||||
getSceneScale,
|
||||
INTERSECTION_PLANE_LAYER,
|
||||
OnClickCallbackArgs,
|
||||
OnMouseEnterLeaveArgs,
|
||||
@ -119,14 +33,98 @@ import {
|
||||
SKETCH_LAYER,
|
||||
X_AXIS,
|
||||
Y_AXIS,
|
||||
getSceneScale,
|
||||
} from './sceneInfra'
|
||||
import { isQuaternionVertical, quaternionFromUpNForward } from './helpers'
|
||||
import {
|
||||
CallExpression,
|
||||
parse,
|
||||
Path,
|
||||
PathToNode,
|
||||
PipeExpression,
|
||||
Program,
|
||||
recast,
|
||||
Sketch,
|
||||
VariableDeclaration,
|
||||
VariableDeclarator,
|
||||
sketchFromKclValue,
|
||||
defaultSourceRange,
|
||||
sourceRangeFromRust,
|
||||
resultIsOk,
|
||||
SourceRange,
|
||||
topLevelRange,
|
||||
CallExpressionKw,
|
||||
VariableMap,
|
||||
} from 'lang/wasm'
|
||||
import {
|
||||
engineCommandManager,
|
||||
kclManager,
|
||||
sceneInfra,
|
||||
codeManager,
|
||||
editorManager,
|
||||
rustContext,
|
||||
} from 'lib/singletons'
|
||||
import { getNodeFromPath } from 'lang/queryAst'
|
||||
import { getNodePathFromSourceRange } from 'lang/queryAstNodePathUtils'
|
||||
import { executeAstMock, ToolTip } from 'lang/langHelpers'
|
||||
import {
|
||||
SegmentUtils,
|
||||
createProfileStartHandle,
|
||||
dashedStraight,
|
||||
SegmentUtils,
|
||||
segmentUtils,
|
||||
} from './segments'
|
||||
import {
|
||||
addCallExpressionsToPipe,
|
||||
addCloseToPipe,
|
||||
addNewSketchLn,
|
||||
ARG_END_ABSOLUTE,
|
||||
changeSketchArguments,
|
||||
Coords2d,
|
||||
updateStartProfileAtArgs,
|
||||
} from 'lang/std/sketch'
|
||||
import { isArray, isOverlap, roundOff } from 'lib/utils'
|
||||
import {
|
||||
createArrayExpression,
|
||||
createCallExpressionStdLib,
|
||||
createLocalName,
|
||||
createCallExpressionStdLibKw,
|
||||
createLabeledArg,
|
||||
createLiteral,
|
||||
createNodeFromExprSnippet,
|
||||
createPipeExpression,
|
||||
createPipeSubstitution,
|
||||
createVariableDeclaration,
|
||||
findUniqueName,
|
||||
getInsertIndex,
|
||||
insertNewStartProfileAt,
|
||||
updateSketchNodePathsWithInsertIndex,
|
||||
} from 'lang/modifyAst'
|
||||
import { Selections, getEventForSegmentSelection } from 'lib/selections'
|
||||
import { createGridHelper, orthoScale, perspScale } from './helpers'
|
||||
import { Models } from '@kittycad/lib'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
import {
|
||||
SegmentOverlayPayload,
|
||||
SketchDetails,
|
||||
SketchDetailsUpdate,
|
||||
SketchTool,
|
||||
} from 'machines/modelingMachine'
|
||||
import { EngineCommandManager } from 'lang/std/engineConnection'
|
||||
import {
|
||||
getRectangleCallExpressions,
|
||||
updateRectangleSketch,
|
||||
updateCenterRectangleSketch,
|
||||
} from 'lib/rectangleTool'
|
||||
import { getThemeColorForThreeJs, Themes } from 'lib/theme'
|
||||
import { err, reportRejection, trap } from 'lib/trap'
|
||||
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||
import { Point3d } from '@rust/kcl-lib/bindings/Point3d'
|
||||
import { SegmentInputs } from 'lang/std/stdTypes'
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
import { radToDeg } from 'three/src/math/MathUtils'
|
||||
import toast from 'react-hot-toast'
|
||||
import { getArtifactFromRange, codeRefFromRange } from 'lang/std/artifactGraph'
|
||||
import { updateModelingState } from 'lang/modelingWorkflows'
|
||||
import { EXECUTION_TYPE_MOCK } from 'lib/constants'
|
||||
|
||||
type DraftSegment = 'line' | 'tangentialArcTo'
|
||||
|
||||
@ -760,14 +758,14 @@ export class SceneEntities {
|
||||
segment.type === 'TangentialArcTo'
|
||||
? segmentUtils.tangentialArcTo.init
|
||||
: segment.type === 'Circle'
|
||||
? segmentUtils.circle.init
|
||||
: segment.type === 'Arc'
|
||||
? segmentUtils.arc.init
|
||||
: segment.type === 'CircleThreePoint'
|
||||
? segmentUtils.circleThreePoint.init
|
||||
: segment.type === 'ArcThreePoint'
|
||||
? segmentUtils.threePointArc.init
|
||||
: segmentUtils.straight.init
|
||||
? segmentUtils.circle.init
|
||||
: segment.type === 'Arc'
|
||||
? segmentUtils.arc.init
|
||||
: segment.type === 'CircleThreePoint'
|
||||
? segmentUtils.circleThreePoint.init
|
||||
: segment.type === 'ArcThreePoint'
|
||||
? segmentUtils.threePointArc.init
|
||||
: segmentUtils.straight.init
|
||||
const input: SegmentInputs =
|
||||
segment.type === 'Circle'
|
||||
? {
|
||||
@ -779,27 +777,27 @@ export class SceneEntities {
|
||||
radius: segment.radius,
|
||||
}
|
||||
: segment.type === 'CircleThreePoint' ||
|
||||
segment.type === 'ArcThreePoint'
|
||||
? {
|
||||
type: 'circle-three-point-segment',
|
||||
p1: segment.p1,
|
||||
p2: segment.p2,
|
||||
p3: segment.p3,
|
||||
}
|
||||
: segment.type === 'Arc'
|
||||
? {
|
||||
type: 'arc-segment',
|
||||
from: segment.from,
|
||||
center: segment.center,
|
||||
to: segment.to,
|
||||
ccw: segment.ccw,
|
||||
radius: segment.radius,
|
||||
}
|
||||
: {
|
||||
type: 'straight-segment',
|
||||
from: segment.from,
|
||||
to: segment.to,
|
||||
}
|
||||
segment.type === 'ArcThreePoint'
|
||||
? {
|
||||
type: 'circle-three-point-segment',
|
||||
p1: segment.p1,
|
||||
p2: segment.p2,
|
||||
p3: segment.p3,
|
||||
}
|
||||
: segment.type === 'Arc'
|
||||
? {
|
||||
type: 'arc-segment',
|
||||
from: segment.from,
|
||||
center: segment.center,
|
||||
to: segment.to,
|
||||
ccw: segment.ccw,
|
||||
radius: segment.radius,
|
||||
}
|
||||
: {
|
||||
type: 'straight-segment',
|
||||
from: segment.from,
|
||||
to: segment.to,
|
||||
}
|
||||
const startRange = _node1.node.start
|
||||
const endRange = _node1.node.end
|
||||
const sourceRange: SourceRange = [startRange, endRange, 0]
|
||||
|
@ -1,36 +1,35 @@
|
||||
import * as TWEEN from '@tweenjs/tween.js'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { EngineCommandManager } from 'lang/std/engineConnection'
|
||||
import { Coords2d, compareVec2Epsilon2 } from 'lang/std/sketch'
|
||||
import { Axis, NonCodeSelection } from 'lib/selections'
|
||||
import { type BaseUnit } from 'lib/settings/settingsTypes'
|
||||
import { Themes } from 'lib/theme'
|
||||
import { getAngle, throttle } from 'lib/utils'
|
||||
import { MouseState, SegmentOverlayPayload } from 'machines/modelingMachine'
|
||||
import {
|
||||
AmbientLight,
|
||||
Color,
|
||||
GridHelper,
|
||||
Group,
|
||||
Intersection,
|
||||
LineBasicMaterial,
|
||||
Mesh,
|
||||
MeshBasicMaterial,
|
||||
Object3D,
|
||||
Object3DEventMap,
|
||||
OrthographicCamera,
|
||||
PerspectiveCamera,
|
||||
Raycaster,
|
||||
Scene,
|
||||
Texture,
|
||||
TextureLoader,
|
||||
Vector2,
|
||||
Vector3,
|
||||
WebGLRenderer,
|
||||
Raycaster,
|
||||
Vector2,
|
||||
Group,
|
||||
MeshBasicMaterial,
|
||||
Mesh,
|
||||
Intersection,
|
||||
Object3D,
|
||||
Object3DEventMap,
|
||||
TextureLoader,
|
||||
Texture,
|
||||
} from 'three'
|
||||
import { CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||
|
||||
import { Coords2d, compareVec2Epsilon2 } from 'lang/std/sketch'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import * as TWEEN from '@tweenjs/tween.js'
|
||||
import { Axis, NonCodeSelection } from 'lib/selections'
|
||||
import { type BaseUnit } from 'lib/settings/settingsTypes'
|
||||
import { CameraControls } from './CameraControls'
|
||||
import { EngineCommandManager } from 'lang/std/engineConnection'
|
||||
import { MouseState, SegmentOverlayPayload } from 'machines/modelingMachine'
|
||||
import { getAngle, throttle } from 'lib/utils'
|
||||
import { Themes } from 'lib/theme'
|
||||
import { CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||
import { orthoScale, perspScale } from './helpers'
|
||||
|
||||
type SendType = ReturnType<typeof useModelingContext>['send']
|
||||
|
@ -1,18 +1,4 @@
|
||||
import { Coords2d } from 'lang/std/sketch'
|
||||
import { SegmentInputs } from 'lang/std/stdTypes'
|
||||
import { PathToNode, Sketch, getTangentialArcToInfo } from 'lang/wasm'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { sceneInfra } from 'lib/singletons'
|
||||
import { Themes, getThemeColorForThreeJs } from 'lib/theme'
|
||||
import { err } from 'lib/trap'
|
||||
import { isClockwise, normaliseAngle, roundOff } from 'lib/utils'
|
||||
import { getTangentPointFromPreviousArc } from 'lib/utils2d'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import {
|
||||
SegmentOverlay,
|
||||
SegmentOverlayPayload,
|
||||
SegmentOverlays,
|
||||
} from 'machines/modelingMachine'
|
||||
import {
|
||||
BoxGeometry,
|
||||
BufferGeometry,
|
||||
@ -22,10 +8,10 @@ import {
|
||||
EllipseCurve,
|
||||
ExtrudeGeometry,
|
||||
Group,
|
||||
Line,
|
||||
LineBasicMaterial,
|
||||
LineCurve3,
|
||||
LineBasicMaterial,
|
||||
LineDashedMaterial,
|
||||
Line,
|
||||
Mesh,
|
||||
MeshBasicMaterial,
|
||||
NormalBufferAttributes,
|
||||
@ -37,19 +23,10 @@ import {
|
||||
Vector2,
|
||||
Vector3,
|
||||
} from 'three'
|
||||
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||
import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js'
|
||||
|
||||
import { calculate_circle_from_3_points } from '@rust/kcl-wasm-lib/pkg/kcl_wasm_lib'
|
||||
|
||||
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||
import { PathToNode, Sketch, getTangentialArcToInfo } from 'lang/wasm'
|
||||
import {
|
||||
ARC_ANGLE_END,
|
||||
ARC_ANGLE_REFERENCE_LINE,
|
||||
ARC_CENTER_TO_FROM,
|
||||
ARC_CENTER_TO_TO,
|
||||
ARC_SEGMENT,
|
||||
ARC_SEGMENT_BODY,
|
||||
ARC_SEGMENT_DASH,
|
||||
CIRCLE_CENTER_HANDLE,
|
||||
CIRCLE_SEGMENT,
|
||||
CIRCLE_SEGMENT_BODY,
|
||||
@ -72,21 +49,42 @@ import {
|
||||
TANGENTIAL_ARC_TO_SEGMENT,
|
||||
TANGENTIAL_ARC_TO_SEGMENT_BODY,
|
||||
TANGENTIAL_ARC_TO__SEGMENT_DASH,
|
||||
THREE_POINT_ARC_HANDLE2,
|
||||
THREE_POINT_ARC_HANDLE3,
|
||||
ARC_SEGMENT,
|
||||
ARC_SEGMENT_BODY,
|
||||
ARC_SEGMENT_DASH,
|
||||
ARC_ANGLE_END,
|
||||
getParentGroup,
|
||||
ARC_CENTER_TO_FROM,
|
||||
ARC_CENTER_TO_TO,
|
||||
ARC_ANGLE_REFERENCE_LINE,
|
||||
THREE_POINT_ARC_SEGMENT,
|
||||
THREE_POINT_ARC_SEGMENT_BODY,
|
||||
THREE_POINT_ARC_SEGMENT_DASH,
|
||||
getParentGroup,
|
||||
THREE_POINT_ARC_HANDLE2,
|
||||
THREE_POINT_ARC_HANDLE3,
|
||||
} from './sceneEntities'
|
||||
import { getTangentPointFromPreviousArc } from 'lib/utils2d'
|
||||
import {
|
||||
ARROWHEAD,
|
||||
DRAFT_POINT,
|
||||
SceneInfra,
|
||||
SEGMENT_LENGTH_LABEL,
|
||||
SEGMENT_LENGTH_LABEL_OFFSET_PX,
|
||||
SEGMENT_LENGTH_LABEL_TEXT,
|
||||
SceneInfra,
|
||||
} from './sceneInfra'
|
||||
import { Themes, getThemeColorForThreeJs } from 'lib/theme'
|
||||
import { isClockwise, normaliseAngle, roundOff } from 'lib/utils'
|
||||
import {
|
||||
SegmentOverlay,
|
||||
SegmentOverlayPayload,
|
||||
SegmentOverlays,
|
||||
} from 'machines/modelingMachine'
|
||||
import { SegmentInputs } from 'lang/std/stdTypes'
|
||||
import { err } from 'lib/trap'
|
||||
import { sceneInfra } from 'lib/singletons'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { calculate_circle_from_3_points } from '@rust/kcl-wasm-lib/pkg/kcl_wasm_lib'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
|
||||
const ANGLE_INDICATOR_RADIUS = 30 // in px
|
||||
interface CreateSegmentArgs {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { ActionButton } from './ActionButton'
|
||||
|
||||
describe('ActionButton tests', () => {
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { ActionIcon, ActionIconProps } from './ActionIcon'
|
||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import React, { ForwardedRef, forwardRef } from 'react'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { Link } from 'react-router-dom'
|
||||
import type { LinkProps } from 'react-router-dom'
|
||||
|
||||
import { ActionIcon, ActionIconProps } from './ActionIcon'
|
||||
|
||||
interface BaseActionButtonProps {
|
||||
iconStart?: ActionIconProps
|
||||
iconEnd?: ActionIconProps
|
||||
@ -48,8 +47,8 @@ export const ActionButton = forwardRef((props: ActionButtonProps, ref) => {
|
||||
? 'px-0' // No padding if both icons are present
|
||||
: 'pr-2' // Padding on the right if only the start icon is present
|
||||
: props.iconEnd
|
||||
? 'pl-2' // Padding on the left if only the end icon is present
|
||||
: 'px-2' // Padding on both sides if no icons are present
|
||||
? 'pl-2' // Padding on the left if only the end icon is present
|
||||
: 'px-2' // Padding on both sides if no icons are present
|
||||
} ${props.className ? props.className : ''}`
|
||||
|
||||
switch (props.Element) {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Popover } from '@headlessui/react'
|
||||
|
||||
import { ActionButtonProps } from './ActionButton'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import Tooltip from './Tooltip'
|
||||
|
@ -3,7 +3,6 @@ import {
|
||||
faCircleExclamation,
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
|
||||
import { CustomIcon, CustomIconName } from './CustomIcon'
|
||||
|
||||
const iconSizes = {
|
||||
|
@ -1,13 +1,12 @@
|
||||
import { RefreshButton } from 'components/RefreshButton'
|
||||
import UserSidebarMenu from 'components/UserSidebarMenu'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { type IndexLoaderData } from 'lib/types'
|
||||
import { useUser } from 'machines/appMachine'
|
||||
|
||||
import { Toolbar } from '../Toolbar'
|
||||
import styles from './AppHeader.module.css'
|
||||
import { CommandBarOpenButton } from './CommandBarOpenButton'
|
||||
import UserSidebarMenu from 'components/UserSidebarMenu'
|
||||
import { type IndexLoaderData } from 'lib/types'
|
||||
import ProjectSidebarMenu from './ProjectSidebarMenu'
|
||||
import styles from './AppHeader.module.css'
|
||||
import { RefreshButton } from 'components/RefreshButton'
|
||||
import { CommandBarOpenButton } from './CommandBarOpenButton'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { useUser } from 'machines/appMachine'
|
||||
|
||||
interface AppHeaderProps extends React.PropsWithChildren {
|
||||
showToolbar?: boolean
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { editorManager, kclManager } from 'lib/singletons'
|
||||
import { getNodeFromPath } from 'lang/queryAst'
|
||||
import { getNodePathFromSourceRange } from 'lang/queryAstNodePathUtils'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { trap } from 'lib/trap'
|
||||
import { codeToIdSelections } from 'lib/selections'
|
||||
import { codeRefFromRange } from 'lang/std/artifactGraph'
|
||||
import { defaultSourceRange, topLevelRange } from 'lang/wasm'
|
||||
import { codeToIdSelections } from 'lib/selections'
|
||||
import { editorManager, kclManager } from 'lib/singletons'
|
||||
import { trap } from 'lib/trap'
|
||||
import { isArray } from 'lib/utils'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
||||
export function AstExplorer() {
|
||||
const { context } = useModelingContext()
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { BinaryPart } from '../lang/wasm'
|
||||
import {
|
||||
createLiteral,
|
||||
createLocalName,
|
||||
createLiteral,
|
||||
createUnaryExpression,
|
||||
} from '../lang/modifyAst'
|
||||
import { PrevVariable } from '../lang/queryAst'
|
||||
import { BinaryPart } from '../lang/wasm'
|
||||
|
||||
export const AvailableVars = ({
|
||||
onVarClick,
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { EngineCommandManagerEvents } from 'lang/std/engineConnection'
|
||||
import { engineCommandManager, sceneInfra } from 'lib/singletons'
|
||||
import { throttle, isReducedMotion } from 'lib/utils'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { isReducedMotion, throttle } from 'lib/utils'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
const updateDollyZoom = throttle(
|
||||
(newFov: number) => sceneInfra.camControls.dollyZoom(newFov),
|
||||
|
@ -1,14 +1,13 @@
|
||||
import { Dialog, Popover, Transition } from '@headlessui/react'
|
||||
import { Fragment, useEffect } from 'react'
|
||||
import CommandBarArgument from './CommandBarArgument'
|
||||
import CommandComboBox from '../CommandComboBox'
|
||||
import CommandBarReview from './CommandBarReview'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
import useHotkeyWrapper from 'lib/hotkeyWrapper'
|
||||
import { CustomIcon } from 'components/CustomIcon'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import useHotkeyWrapper from 'lib/hotkeyWrapper'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import { Fragment, useEffect } from 'react'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
|
||||
import CommandComboBox from '../CommandComboBox'
|
||||
import CommandBarArgument from './CommandBarArgument'
|
||||
import CommandBarReview from './CommandBarReview'
|
||||
|
||||
export const COMMAND_PALETTE_HOTKEY = 'mod+k'
|
||||
|
||||
|
@ -1,13 +1,12 @@
|
||||
import { CommandArgument } from 'lib/commandTypes'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
|
||||
import CommandArgOptionInput from './CommandArgOptionInput'
|
||||
import CommandBarBasicInput from './CommandBarBasicInput'
|
||||
import CommandBarHeader from './CommandBarHeader'
|
||||
import CommandBarKclInput from './CommandBarKclInput'
|
||||
import CommandBarSelectionInput from './CommandBarSelectionInput'
|
||||
import CommandBarSelectionMixedInput from './CommandBarSelectionMixedInput'
|
||||
import { CommandArgument } from 'lib/commandTypes'
|
||||
import CommandBarHeader from './CommandBarHeader'
|
||||
import CommandBarKclInput from './CommandBarKclInput'
|
||||
import CommandBarTextareaInput from './CommandBarTextareaInput'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
|
||||
function CommandBarArgument({ stepBack }: { stepBack: () => void }) {
|
||||
const commandBarState = useCommandBarState()
|
||||
|
@ -1,13 +1,12 @@
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { KclCommandValue, KclExpressionWithVariable } from 'lib/commandTypes'
|
||||
import { CustomIcon } from '../CustomIcon'
|
||||
import React, { useMemo, useState } from 'react'
|
||||
import { ActionButton } from '../ActionButton'
|
||||
import { Selections, getSelectionTypeDisplayText } from 'lib/selections'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { KclCommandValue, KclExpressionWithVariable } from 'lib/commandTypes'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { roundOff } from 'lib/utils'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import React, { useMemo, useState } from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
|
||||
import { ActionButton } from '../ActionButton'
|
||||
import { CustomIcon } from '../CustomIcon'
|
||||
|
||||
function CommandBarHeader({ children }: React.PropsWithChildren<object>) {
|
||||
const commandBarState = useCommandBarState()
|
||||
|
@ -1,35 +1,33 @@
|
||||
import {
|
||||
Completion,
|
||||
closeBrackets,
|
||||
closeBracketsKeymap,
|
||||
Completion,
|
||||
completionKeymap,
|
||||
completionStatus,
|
||||
} from '@codemirror/autocomplete'
|
||||
import { EditorView, ViewUpdate, keymap } from '@codemirror/view'
|
||||
import { useSelector } from '@xstate/react'
|
||||
import { EditorView, keymap, ViewUpdate } from '@codemirror/view'
|
||||
import { CustomIcon } from 'components/CustomIcon'
|
||||
import { useCodeMirror } from 'components/ModelingSidebar/ModelingPanes/CodeEditor'
|
||||
import { Spinner } from 'components/Spinner'
|
||||
import { createLocalName, createVariableDeclaration } from 'lang/modifyAst'
|
||||
import { getNodeFromPath } from 'lang/queryAst'
|
||||
import { SourceRange, VariableDeclarator, isPathToNode } from 'lang/wasm'
|
||||
import { CommandArgument, KclCommandValue } from 'lib/commandTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { getSystemTheme } from 'lib/theme'
|
||||
import { err } from 'lib/trap'
|
||||
import { useCalculateKclExpression } from 'lib/useCalculateKclExpression'
|
||||
import { roundOff } from 'lib/utils'
|
||||
import { varMentions } from 'lib/varCompletionExtension'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { AnyStateMachine, SnapshotFrom } from 'xstate'
|
||||
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
|
||||
import styles from './CommandBarKclInput.module.css'
|
||||
import { createLocalName, createVariableDeclaration } from 'lang/modifyAst'
|
||||
import { useCodeMirror } from 'components/ModelingSidebar/ModelingPanes/CodeEditor'
|
||||
import { useSelector } from '@xstate/react'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
import toast from 'react-hot-toast'
|
||||
import { AnyStateMachine, SnapshotFrom } from 'xstate'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { getNodeFromPath } from 'lang/queryAst'
|
||||
import { isPathToNode, SourceRange, VariableDeclarator } from 'lang/wasm'
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
import { err } from 'lib/trap'
|
||||
import { Spinner } from 'components/Spinner'
|
||||
|
||||
// TODO: remove the need for this selector once we decouple all actors from React
|
||||
const machineContextSelector = (snapshot?: SnapshotFrom<AnyStateMachine>) =>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user