Sort imports (#6101)
* add package.json Signed-off-by: Jess Frazelle <github@jessfraz.com> initial run; Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> more fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> clientsidescne Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> paths Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fix styles Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> combine Signed-off-by: Jess Frazelle <github@jessfraz.com> eslint rule Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> my ocd Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> constants file Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> no more import sceneInfra Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> try fix circular import Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
111
.eslintrc
111
.eslintrc
@ -1,111 +0,0 @@
|
|||||||
{
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"project": "./tsconfig.json"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"react-perf",
|
|
||||||
"css-modules",
|
|
||||||
"jest",
|
|
||||||
"jsx-a11y",
|
|
||||||
"react",
|
|
||||||
"react-hooks",
|
|
||||||
"suggest-no-throw",
|
|
||||||
"testing-library",
|
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"extends": [
|
|
||||||
"plugin:css-modules/recommended",
|
|
||||||
"plugin:jsx-a11y/recommended",
|
|
||||||
"plugin:react-hooks/recommended"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"no-array-constructor": "off", // This is wrong; use the @typescript-eslint one instead.
|
|
||||||
"@typescript-eslint/no-array-constructor": "error",
|
|
||||||
"@typescript-eslint/no-array-delete": "error",
|
|
||||||
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
||||||
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
|
||||||
"@typescript-eslint/no-empty-object-type": "error",
|
|
||||||
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
||||||
"@typescript-eslint/no-floating-promises": "error",
|
|
||||||
"@typescript-eslint/no-for-in-array": "error",
|
|
||||||
"no-implied-eval": "off", // This is wrong; use the @typescript-eslint one instead.
|
|
||||||
"@typescript-eslint/no-implied-eval": "error",
|
|
||||||
"@typescript-eslint/no-misused-new": "error",
|
|
||||||
"@typescript-eslint/no-misused-promises": "error",
|
|
||||||
"@typescript-eslint/no-namespace": "error",
|
|
||||||
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
||||||
"@typescript-eslint/no-redundant-type-constituents": "error",
|
|
||||||
"@typescript-eslint/no-this-alias": "warn",
|
|
||||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
||||||
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
||||||
"no-unused-vars": "off", // This is wrong; use the @typescript-eslint one instead.
|
|
||||||
"@typescript-eslint/no-unused-vars": ["error", {
|
|
||||||
"varsIgnorePattern": "^_",
|
|
||||||
"argsIgnorePattern": "^_",
|
|
||||||
"ignoreRestSiblings": true,
|
|
||||||
"vars": "all",
|
|
||||||
"args": "none"
|
|
||||||
}],
|
|
||||||
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
|
||||||
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
||||||
"no-throw-literal": "off", // Use @typescript-eslint/only-throw-error instead.
|
|
||||||
"@typescript-eslint/only-throw-error": "error",
|
|
||||||
"@typescript-eslint/prefer-as-const": "warn",
|
|
||||||
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
||||||
"@typescript-eslint/restrict-plus-operands": "error",
|
|
||||||
"jsx-a11y/click-events-have-key-events": "off",
|
|
||||||
"jsx-a11y/no-autofocus": "off",
|
|
||||||
"jsx-a11y/no-noninteractive-element-interactions": "off",
|
|
||||||
"no-restricted-globals": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"name": "isNaN",
|
|
||||||
"message": "Use Number.isNaN() instead."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-restricted-syntax": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"selector": "CallExpression[callee.object.name='Array'][callee.property.name='isArray']",
|
|
||||||
"message": "Use isArray() in lib/utils.ts instead of Array.isArray()."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"selector": "CallExpression[callee.object.name='TOML'][callee.property.name='stringify']",
|
|
||||||
"message": "Do not use TOML.stringify directly. Use the wrappers in test-utils instead like settingsToToml."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"selector": "CallExpression[callee.object.name='TOML'][callee.property.name='parse']",
|
|
||||||
"message": "Do not use TOML.parse directly. Use the wrappers in test-utils instead like tomlToSettings."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"semi": [
|
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"react-hooks/exhaustive-deps": "off",
|
|
||||||
"suggest-no-throw/suggest-no-throw": "error"
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": ["e2e/**/*.ts"], // Update the pattern based on your file structure
|
|
||||||
"extends": [
|
|
||||||
"plugin:testing-library/react"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"suggest-no-throw/suggest-no-throw": "off",
|
|
||||||
"testing-library/prefer-screen-queries": "off",
|
|
||||||
"jest/valid-expect": "off"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"files": ["src/**/*.test.ts"],
|
|
||||||
"extends": [
|
|
||||||
"plugin:testing-library/react"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"suggest-no-throw/suggest-no-throw": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
127
.eslintrc.json
Normal file
127
.eslintrc.json
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
{
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"project": "./tsconfig.json"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"react-perf",
|
||||||
|
"css-modules",
|
||||||
|
"jest",
|
||||||
|
"jsx-a11y",
|
||||||
|
"react",
|
||||||
|
"react-hooks",
|
||||||
|
"suggest-no-throw",
|
||||||
|
"testing-library",
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"extends": [
|
||||||
|
"plugin:css-modules/recommended",
|
||||||
|
"plugin:jsx-a11y/recommended",
|
||||||
|
"plugin:react-hooks/recommended"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"no-array-constructor": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||||
|
"@typescript-eslint/no-array-constructor": "error",
|
||||||
|
"@typescript-eslint/no-array-delete": "error",
|
||||||
|
"@typescript-eslint/no-duplicate-enum-values": "error",
|
||||||
|
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
||||||
|
"@typescript-eslint/no-empty-object-type": "error",
|
||||||
|
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
||||||
|
"@typescript-eslint/no-floating-promises": "error",
|
||||||
|
"@typescript-eslint/no-for-in-array": "error",
|
||||||
|
"no-implied-eval": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||||
|
"@typescript-eslint/no-implied-eval": "error",
|
||||||
|
"@typescript-eslint/no-misused-new": "error",
|
||||||
|
"@typescript-eslint/no-misused-promises": "error",
|
||||||
|
"@typescript-eslint/no-namespace": "error",
|
||||||
|
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
||||||
|
"@typescript-eslint/no-redundant-type-constituents": "error",
|
||||||
|
"@typescript-eslint/no-this-alias": "warn",
|
||||||
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||||
|
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
||||||
|
"no-unused-vars": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"varsIgnorePattern": "^_",
|
||||||
|
"argsIgnorePattern": "^_",
|
||||||
|
"ignoreRestSiblings": true,
|
||||||
|
"vars": "all",
|
||||||
|
"args": "none"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
||||||
|
"@typescript-eslint/no-wrapper-object-types": "error",
|
||||||
|
"no-throw-literal": "off", // Use @typescript-eslint/only-throw-error instead.
|
||||||
|
"@typescript-eslint/only-throw-error": "error",
|
||||||
|
"@typescript-eslint/prefer-as-const": "warn",
|
||||||
|
"@typescript-eslint/prefer-namespace-keyword": "error",
|
||||||
|
"@typescript-eslint/consistent-type-imports": "error",
|
||||||
|
"@typescript-eslint/restrict-plus-operands": "error",
|
||||||
|
"jsx-a11y/click-events-have-key-events": "off",
|
||||||
|
"jsx-a11y/no-autofocus": "off",
|
||||||
|
"jsx-a11y/no-noninteractive-element-interactions": "off",
|
||||||
|
"no-restricted-globals": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"name": "isNaN",
|
||||||
|
"message": "Use Number.isNaN() instead."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-restricted-syntax": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"selector": "CallExpression[callee.object.name='Array'][callee.property.name='isArray']",
|
||||||
|
"message": "Use isArray() in lib/utils.ts instead of Array.isArray()."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": "CallExpression[callee.object.name='TOML'][callee.property.name='stringify']",
|
||||||
|
"message": "Do not use TOML.stringify directly. Use the wrappers in test-utils instead like settingsToToml."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": "CallExpression[callee.object.name='TOML'][callee.property.name='parse']",
|
||||||
|
"message": "Do not use TOML.parse directly. Use the wrappers in test-utils instead like tomlToSettings."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-restricted-imports": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"patterns": [
|
||||||
|
// Restrict all relative imports except for .css files.
|
||||||
|
{
|
||||||
|
"group": ["./*", "../*", "!./*.css", "!../*.css"],
|
||||||
|
"message": "Use absolute imports instead."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"semi": ["error", "never"],
|
||||||
|
"react-hooks/exhaustive-deps": "off",
|
||||||
|
"suggest-no-throw/suggest-no-throw": "error"
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["e2e/**/*.ts"], // Update the pattern based on your file structure
|
||||||
|
"extends": ["plugin:testing-library/react"],
|
||||||
|
"rules": {
|
||||||
|
"suggest-no-throw/suggest-no-throw": "off",
|
||||||
|
"testing-library/prefer-screen-queries": "off",
|
||||||
|
"jest/valid-expect": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["src/**/*.test.ts"],
|
||||||
|
"extends": ["plugin:testing-library/react"],
|
||||||
|
"rules": {
|
||||||
|
"suggest-no-throw/suggest-no-throw": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["packages/**/*.ts", "rust/**/*.ts"],
|
||||||
|
"extends": [],
|
||||||
|
"rules": {
|
||||||
|
"no-restricted-imports": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Electron app header tests', () => {
|
test.describe('Electron app header tests', () => {
|
||||||
test(
|
test(
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import { Page } from '@playwright/test'
|
import type { Page } from '@playwright/test'
|
||||||
import { test, expect } from './zoo-test'
|
|
||||||
|
import type { HomePageFixture } from '@e2e/playwright/fixtures/homePageFixture'
|
||||||
import {
|
import {
|
||||||
getUtils,
|
PERSIST_MODELING_CONTEXT,
|
||||||
TEST_COLORS,
|
TEST_COLORS,
|
||||||
commonPoints,
|
commonPoints,
|
||||||
PERSIST_MODELING_CONTEXT,
|
getUtils,
|
||||||
orRunWhenFullSuiteEnabled,
|
orRunWhenFullSuiteEnabled,
|
||||||
} from './test-utils'
|
} from '@e2e/playwright/test-utils'
|
||||||
import { HomePageFixture } from './fixtures/homePageFixture'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.setTimeout(120000)
|
test.setTimeout(120000)
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { test, expect } from './zoo-test'
|
|
||||||
import fs from 'node:fs/promises'
|
import fs from 'node:fs/promises'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
|
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Point and click for boolean workflows', () => {
|
test.describe('Point and click for boolean workflows', () => {
|
||||||
// Boolean operations to test
|
// Boolean operations to test
|
||||||
const booleanOperations = [
|
const booleanOperations = [
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { Page } from '@playwright/test'
|
import type { Page } from '@playwright/test'
|
||||||
import { test, expect } from './zoo-test'
|
import type { EngineCommand } from '@src/lang/std/artifactGraph'
|
||||||
import { HomePageFixture } from './fixtures/homePageFixture'
|
import { uuidv4 } from '@src/lib/utils'
|
||||||
import { getUtils } from './test-utils'
|
|
||||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
import type { HomePageFixture } from '@e2e/playwright/fixtures/homePageFixture'
|
||||||
import { uuidv4 } from 'lib/utils'
|
import type { SceneFixture } from '@e2e/playwright/fixtures/sceneFixture'
|
||||||
import { SceneFixture } from './fixtures/sceneFixture'
|
import { getUtils } from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe(
|
test.describe(
|
||||||
'Can create sketches on all planes and their back sides',
|
'Can create sketches on all planes and their back sides',
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { bracket } from '@src/lib/exampleKcl'
|
||||||
import {
|
|
||||||
orRunWhenFullSuiteEnabled,
|
|
||||||
getUtils,
|
|
||||||
executorInputPath,
|
|
||||||
} from './test-utils'
|
|
||||||
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'
|
import fsp from 'fs/promises'
|
||||||
|
import { join } from 'path'
|
||||||
|
|
||||||
|
import { TEST_CODE_LONG_WITH_ERROR_OUT_OF_VIEW } from '@e2e/playwright/storageStates'
|
||||||
|
import {
|
||||||
|
executorInputPath,
|
||||||
|
getUtils,
|
||||||
|
orRunWhenFullSuiteEnabled,
|
||||||
|
} from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Code pane and errors', { tag: ['@skipWin'] }, () => {
|
test.describe('Code pane and errors', { tag: ['@skipWin'] }, () => {
|
||||||
test('Typing KCL errors induces a badge on the code pane button', async ({
|
test('Typing KCL errors induces a badge on the code pane button', async ({
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { KCL_DEFAULT_LENGTH } from '@src/lib/constants'
|
||||||
import * as fsp from 'fs/promises'
|
import * as fsp from 'fs/promises'
|
||||||
|
import path, { join } from 'path'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
executorInputPath,
|
executorInputPath,
|
||||||
getUtils,
|
getUtils,
|
||||||
orRunWhenFullSuiteEnabled,
|
orRunWhenFullSuiteEnabled,
|
||||||
} from './test-utils'
|
} from '@e2e/playwright/test-utils'
|
||||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
import path, { join } from 'path'
|
|
||||||
|
|
||||||
test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
|
test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
|
||||||
test('Extrude from command bar selects extrude line after', async ({
|
test('Extrude from command bar selects extrude line after', async ({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { getUtils } from '@e2e/playwright/test-utils'
|
||||||
import { getUtils } from './test-utils'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Copilot ghost text', () => {
|
test.describe('Copilot ghost text', () => {
|
||||||
// eslint-disable-next-line jest/valid-title
|
// eslint-disable-next-line jest/valid-title
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { getUtils } from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
import { getUtils } from './test-utils'
|
|
||||||
|
|
||||||
function countNewlines(input: string): number {
|
function countNewlines(input: string): number {
|
||||||
let count = 0
|
let count = 0
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import fsp from 'fs/promises'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getUtils,
|
|
||||||
executorInputPath,
|
executorInputPath,
|
||||||
getPlaywrightDownloadDir,
|
getPlaywrightDownloadDir,
|
||||||
} from './test-utils'
|
getUtils,
|
||||||
import fsp from 'fs/promises'
|
} from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'export works on the first try',
|
'export works on the first try',
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { uuidv4 } from '@src/lib/utils'
|
||||||
import fsp from 'fs/promises'
|
import fsp from 'fs/promises'
|
||||||
import { uuidv4 } from 'lib/utils'
|
import { join } from 'path'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
TEST_COLORS,
|
||||||
executorInputPath,
|
executorInputPath,
|
||||||
getUtils,
|
getUtils,
|
||||||
orRunWhenFullSuiteEnabled,
|
orRunWhenFullSuiteEnabled,
|
||||||
TEST_COLORS,
|
} from '@e2e/playwright/test-utils'
|
||||||
} from './test-utils'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
import { join } from 'path'
|
|
||||||
|
|
||||||
test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
||||||
test('can comment out code with ctrl+/', async ({ page, homePage }) => {
|
test('can comment out code with ctrl+/', async ({ page, homePage }) => {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { test, expect } from './zoo-test'
|
|
||||||
import * as fsp from 'fs/promises'
|
import * as fsp from 'fs/promises'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
const FEATURE_TREE_EXAMPLE_CODE = `export fn timesFive(x) {
|
const FEATURE_TREE_EXAMPLE_CODE = `export fn timesFive(x) {
|
||||||
return 5 * x
|
return 5 * x
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { FILE_EXT } from '@src/lib/constants'
|
||||||
import * as fsp from 'fs/promises'
|
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
import * as fsp from 'fs/promises'
|
||||||
|
import { join } from 'path'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createProject,
|
createProject,
|
||||||
executorInputPath,
|
executorInputPath,
|
||||||
getUtils,
|
getUtils,
|
||||||
orRunWhenFullSuiteEnabled,
|
orRunWhenFullSuiteEnabled,
|
||||||
runningOnWindows,
|
runningOnWindows,
|
||||||
} from './test-utils'
|
} from '@e2e/playwright/test-utils'
|
||||||
import { join } from 'path'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
import { FILE_EXT } from 'lib/constants'
|
|
||||||
|
|
||||||
test.describe('integrations tests', () => {
|
test.describe('integrations tests', () => {
|
||||||
test(
|
test(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { Page, Locator, Route, Request } from '@playwright/test'
|
import type { Locator, Page, Request, Route, TestInfo } from '@playwright/test'
|
||||||
import { expect, TestInfo } from '@playwright/test'
|
import { expect } from '@playwright/test'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import type { Page, Locator } from '@playwright/test'
|
import type { Locator, Page } from '@playwright/test'
|
||||||
import { expect } from '@playwright/test'
|
import { expect } from '@playwright/test'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
closePane,
|
|
||||||
checkIfPaneIsOpen,
|
checkIfPaneIsOpen,
|
||||||
|
closePane,
|
||||||
openPane,
|
openPane,
|
||||||
sansWhitespace,
|
sansWhitespace,
|
||||||
} from '../test-utils'
|
} from '@e2e/playwright/test-utils'
|
||||||
|
|
||||||
interface EditorState {
|
interface EditorState {
|
||||||
activeLines: Array<string>
|
activeLines: Array<string>
|
||||||
|
@ -2,25 +2,27 @@
|
|||||||
import type {
|
import type {
|
||||||
BrowserContext,
|
BrowserContext,
|
||||||
ElectronApplication,
|
ElectronApplication,
|
||||||
TestInfo,
|
|
||||||
Page,
|
Page,
|
||||||
|
TestInfo,
|
||||||
} from '@playwright/test'
|
} from '@playwright/test'
|
||||||
|
|
||||||
import { _electron as electron } from '@playwright/test'
|
import { _electron as electron } from '@playwright/test'
|
||||||
|
|
||||||
import { TEST_SETTINGS } from '../storageStates'
|
import { SETTINGS_FILE_NAME } from '@src/lib/constants'
|
||||||
import { SETTINGS_FILE_NAME } from 'lib/constants'
|
import type { DeepPartial } from '@src/lib/types'
|
||||||
import { getUtils, setup, settingsToToml } from '../test-utils'
|
|
||||||
import fsp from 'fs/promises'
|
import fsp from 'fs/promises'
|
||||||
import fs from 'node:fs'
|
import fs from 'node:fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { CmdBarFixture } from './cmdBarFixture'
|
|
||||||
import { EditorFixture } from './editorFixture'
|
import type { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||||
import { ToolbarFixture } from './toolbarFixture'
|
|
||||||
import { SceneFixture } from './sceneFixture'
|
import { CmdBarFixture } from '@e2e/playwright/fixtures/cmdBarFixture'
|
||||||
import { HomePageFixture } from './homePageFixture'
|
import { EditorFixture } from '@e2e/playwright/fixtures/editorFixture'
|
||||||
import { DeepPartial } from 'lib/types'
|
import { HomePageFixture } from '@e2e/playwright/fixtures/homePageFixture'
|
||||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
import { SceneFixture } from '@e2e/playwright/fixtures/sceneFixture'
|
||||||
|
import { ToolbarFixture } from '@e2e/playwright/fixtures/toolbarFixture'
|
||||||
|
|
||||||
|
import { TEST_SETTINGS } from '@e2e/playwright/storageStates'
|
||||||
|
import { getUtils, settingsToToml, setup } from '@e2e/playwright/test-utils'
|
||||||
|
|
||||||
export class AuthenticatedApp {
|
export class AuthenticatedApp {
|
||||||
public readonly page: Page
|
public readonly page: Page
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { Page, Locator } from '@playwright/test'
|
import type { Locator, Page } from '@playwright/test'
|
||||||
import { expect } from '@playwright/test'
|
import { expect } from '@playwright/test'
|
||||||
|
|
||||||
interface ProjectCardState {
|
interface ProjectCardState {
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
import type { Page, Locator } from '@playwright/test'
|
import type { Locator, Page } from '@playwright/test'
|
||||||
import { expect } from '../zoo-test'
|
import { isArray, uuidv4 } from '@src/lib/utils'
|
||||||
import { isArray, uuidv4 } from 'lib/utils'
|
|
||||||
import { CmdBarFixture } from './cmdBarFixture'
|
import type { CmdBarFixture } from '@e2e/playwright/fixtures/cmdBarFixture'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
closeDebugPanel,
|
closeDebugPanel,
|
||||||
doAndWaitForImageDiff,
|
doAndWaitForImageDiff,
|
||||||
getPixelRGBs,
|
getPixelRGBs,
|
||||||
|
getUtils,
|
||||||
openAndClearDebugPanel,
|
openAndClearDebugPanel,
|
||||||
sendCustomCmd,
|
sendCustomCmd,
|
||||||
getUtils,
|
} from '@e2e/playwright/test-utils'
|
||||||
} from '../test-utils'
|
import { expect } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
type MouseParams = {
|
type MouseParams = {
|
||||||
pixelDiff?: number
|
pixelDiff?: number
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
import { type Page, type Locator, test } from '@playwright/test'
|
import { type Locator, type Page, test } from '@playwright/test'
|
||||||
import { expect } from '../zoo-test'
|
import type { SidebarType } from '@src/components/ModelingSidebar/ModelingPanes'
|
||||||
|
import { SIDEBAR_BUTTON_SUFFIX } from '@src/lib/constants'
|
||||||
|
import type { ToolbarModeName } from '@src/lib/toolbar'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
checkIfPaneIsOpen,
|
checkIfPaneIsOpen,
|
||||||
closePane,
|
closePane,
|
||||||
doAndWaitForImageDiff,
|
doAndWaitForImageDiff,
|
||||||
openPane,
|
openPane,
|
||||||
} from '../test-utils'
|
} from '@e2e/playwright/test-utils'
|
||||||
import { SidebarType } from 'components/ModelingSidebar/ModelingPanes'
|
import { expect } from '@e2e/playwright/zoo-test'
|
||||||
import { SIDEBAR_BUTTON_SUFFIX } from 'lib/constants'
|
|
||||||
import { ToolbarModeName } from 'lib/toolbar'
|
|
||||||
|
|
||||||
export class ToolbarFixture {
|
export class ToolbarFixture {
|
||||||
public page: Page
|
public page: Page
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { test, expect } from './zoo-test'
|
|
||||||
import { executorInputPath } from './test-utils'
|
|
||||||
import { join } from 'path'
|
|
||||||
import fsp from 'fs/promises'
|
import fsp from 'fs/promises'
|
||||||
|
import { join } from 'path'
|
||||||
|
|
||||||
|
import { executorInputPath } from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'When machine-api server not found butt is disabled and shows the reason',
|
'When machine-api server not found butt is disabled and shows the reason',
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { PROJECT_SETTINGS_FILE_NAME } from '@src/lib/constants'
|
||||||
import { PROJECT_SETTINGS_FILE_NAME } from 'lib/constants'
|
|
||||||
import * as fsp from 'fs/promises'
|
import * as fsp from 'fs/promises'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
|
import type { NamedView } from '@rust/kcl-lib/bindings/NamedView'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createProject,
|
createProject,
|
||||||
tomlToPerProjectSettings,
|
|
||||||
perProjectsettingsToToml,
|
perProjectsettingsToToml,
|
||||||
} from './test-utils'
|
tomlToPerProjectSettings,
|
||||||
import { NamedView } from '@rust/kcl-lib/bindings/NamedView'
|
} from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
// Helper function to determine if the file path on disk exists
|
// Helper function to determine if the file path on disk exists
|
||||||
// Specifically this is used to check if project.toml exists on disk
|
// Specifically this is used to check if project.toml exists on disk
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not all menu actions are tested. Some are default electron menu actions.
|
* Not all menu actions are tested. Some are default electron menu actions.
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
// application, check it can make it to the project pane, and nothing more.
|
// application, check it can make it to the project pane, and nothing more.
|
||||||
// It also tests our test wrappers are working.
|
// It also tests our test wrappers are working.
|
||||||
// Additionally this serves as a nice minimal example.
|
// Additionally this serves as a nice minimal example.
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
import { test, expect } from './zoo-test'
|
|
||||||
|
|
||||||
test.describe('Open the application', () => {
|
test.describe('Open the application', () => {
|
||||||
test('see the project view', async ({ page, context }) => {
|
test('see the project view', async ({ page, context }) => {
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { bracket } from '@src/lib/exampleKcl'
|
||||||
import { join } from 'path'
|
import { onboardingPaths } from '@src/routes/Onboarding/paths'
|
||||||
import fsp from 'fs/promises'
|
import fsp from 'fs/promises'
|
||||||
import {
|
import { join } from 'path'
|
||||||
getUtils,
|
|
||||||
executorInputPath,
|
import { expectPixelColor } from '@e2e/playwright/fixtures/sceneFixture'
|
||||||
createProject,
|
|
||||||
settingsToToml,
|
|
||||||
orRunWhenFullSuiteEnabled,
|
|
||||||
} from './test-utils'
|
|
||||||
import { bracket } from 'lib/exampleKcl'
|
|
||||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
|
||||||
import {
|
import {
|
||||||
TEST_SETTINGS_KEY,
|
TEST_SETTINGS_KEY,
|
||||||
TEST_SETTINGS_ONBOARDING_START,
|
|
||||||
TEST_SETTINGS_ONBOARDING_EXPORT,
|
TEST_SETTINGS_ONBOARDING_EXPORT,
|
||||||
|
TEST_SETTINGS_ONBOARDING_START,
|
||||||
TEST_SETTINGS_ONBOARDING_USER_MENU,
|
TEST_SETTINGS_ONBOARDING_USER_MENU,
|
||||||
} from './storageStates'
|
} from '@e2e/playwright/storageStates'
|
||||||
import { expectPixelColor } from './fixtures/sceneFixture'
|
import {
|
||||||
|
createProject,
|
||||||
|
executorInputPath,
|
||||||
|
getUtils,
|
||||||
|
orRunWhenFullSuiteEnabled,
|
||||||
|
settingsToToml,
|
||||||
|
} from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
// Because our default test settings have the onboardingStatus set to 'dismissed',
|
// 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.
|
// we must set it to empty for the tests where we want to see the onboarding immediately.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { test, expect } from '@playwright/test'
|
import { expect, test } from '@playwright/test'
|
||||||
|
|
||||||
/** @deprecated, import from ./fixtureSetup.ts instead */
|
/** @deprecated, import from ./fixtureSetup.ts instead */
|
||||||
export const _test = test
|
export const _test = test
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { Page } from '@playwright/test'
|
import type { Locator, Page } from '@playwright/test'
|
||||||
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 fs from 'node:fs/promises'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import { getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
|
||||||
import { Locator } from '@playwright/test'
|
import type { EditorFixture } from '@e2e/playwright/fixtures/editorFixture'
|
||||||
|
import type { SceneFixture } from '@e2e/playwright/fixtures/sceneFixture'
|
||||||
|
import type { ToolbarFixture } from '@e2e/playwright/fixtures/toolbarFixture'
|
||||||
|
import { getUtils, orRunWhenFullSuiteEnabled } from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
// test file is for testing point an click code gen functionality that's not sketch mode related
|
// test file is for testing point an click code gen functionality that's not sketch mode related
|
||||||
|
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { DEFAULT_PROJECT_KCL_FILE } from '@src/lib/constants'
|
||||||
|
import fs from 'fs'
|
||||||
|
import fsp from 'fs/promises'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
|
import type { Paths } from '@e2e/playwright/test-utils'
|
||||||
import {
|
import {
|
||||||
|
createProject,
|
||||||
doExport,
|
doExport,
|
||||||
executorInputPath,
|
executorInputPath,
|
||||||
|
getPlaywrightDownloadDir,
|
||||||
getUtils,
|
getUtils,
|
||||||
isOutOfViewInScrollContainer,
|
isOutOfViewInScrollContainer,
|
||||||
Paths,
|
|
||||||
createProject,
|
|
||||||
getPlaywrightDownloadDir,
|
|
||||||
orRunWhenFullSuiteEnabled,
|
orRunWhenFullSuiteEnabled,
|
||||||
runningOnWindows,
|
runningOnWindows,
|
||||||
} from './test-utils'
|
} from '@e2e/playwright/test-utils'
|
||||||
import fsp from 'fs/promises'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
import fs from 'fs'
|
|
||||||
import path from 'path'
|
|
||||||
import { DEFAULT_PROJECT_KCL_FILE } from 'lib/constants'
|
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'projects reload if a new one is created, deleted, or renamed externally',
|
'projects reload if a new one is created, deleted, or renamed externally',
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
/* eslint-disable jest/no-conditional-expect */
|
/* eslint-disable jest/no-conditional-expect */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { orRunWhenFullSuiteEnabled } from '@e2e/playwright/test-utils'
|
||||||
import { orRunWhenFullSuiteEnabled } from './test-utils'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
/* eslint-disable jest/no-conditional-expect */
|
/* eslint-disable jest/no-conditional-expect */
|
||||||
|
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
import { Page } from '@playwright/test'
|
import type { Page } from '@playwright/test'
|
||||||
import { test, expect } from './zoo-test'
|
import { bracket } from '@src/lib/exampleKcl'
|
||||||
import path from 'path'
|
import { reportRejection } from '@src/lib/trap'
|
||||||
import * as fsp from 'fs/promises'
|
import * as fsp from 'fs/promises'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
|
import { TEST_CODE_TRIGGER_ENGINE_EXPORT_ERROR } from '@e2e/playwright/storageStates'
|
||||||
|
import type { TestColor } from '@e2e/playwright/test-utils'
|
||||||
import {
|
import {
|
||||||
getUtils,
|
|
||||||
TEST_COLORS,
|
TEST_COLORS,
|
||||||
TestColor,
|
|
||||||
executorInputPath,
|
executorInputPath,
|
||||||
|
getUtils,
|
||||||
orRunWhenFullSuiteEnabled,
|
orRunWhenFullSuiteEnabled,
|
||||||
} from './test-utils'
|
} from '@e2e/playwright/test-utils'
|
||||||
import { TEST_CODE_TRIGGER_ENGINE_EXPORT_ERROR } from './storageStates'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
import { bracket } from 'lib/exampleKcl'
|
|
||||||
import { reportRejection } from 'lib/trap'
|
|
||||||
|
|
||||||
test.describe('Regression tests', { tag: ['@skipWin'] }, () => {
|
test.describe('Regression tests', { tag: ['@skipWin'] }, () => {
|
||||||
// bugs we found that don't fit neatly into other categories
|
// bugs we found that don't fit neatly into other categories
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
import { Page } from '@playwright/test'
|
import type { Page } from '@playwright/test'
|
||||||
import { test, expect } from './zoo-test'
|
import { roundOff, uuidv4 } from '@src/lib/utils'
|
||||||
import fs from 'node:fs/promises'
|
import fs from 'node:fs/promises'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import { HomePageFixture } from './fixtures/homePageFixture'
|
|
||||||
|
|
||||||
|
import type { CmdBarFixture } from '@e2e/playwright/fixtures/cmdBarFixture'
|
||||||
|
import type { HomePageFixture } from '@e2e/playwright/fixtures/homePageFixture'
|
||||||
|
import type { SceneFixture } from '@e2e/playwright/fixtures/sceneFixture'
|
||||||
|
import type { ToolbarFixture } from '@e2e/playwright/fixtures/toolbarFixture'
|
||||||
import {
|
import {
|
||||||
getMovementUtils,
|
|
||||||
getUtils,
|
|
||||||
PERSIST_MODELING_CONTEXT,
|
PERSIST_MODELING_CONTEXT,
|
||||||
TEST_COLORS,
|
TEST_COLORS,
|
||||||
|
getMovementUtils,
|
||||||
|
getUtils,
|
||||||
orRunWhenFullSuiteEnabled,
|
orRunWhenFullSuiteEnabled,
|
||||||
} from './test-utils'
|
} from '@e2e/playwright/test-utils'
|
||||||
import { uuidv4, roundOff } from 'lib/utils'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
import { SceneFixture } from './fixtures/sceneFixture'
|
|
||||||
import { ToolbarFixture } from './fixtures/toolbarFixture'
|
|
||||||
import { CmdBarFixture } from './fixtures/cmdBarFixture'
|
|
||||||
|
|
||||||
test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
|
test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
|
||||||
test('multi-sketch file shows multiple Edit Sketch buttons', async ({
|
test('multi-sketch file shows multiple Edit Sketch buttons', async ({
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import type { Models } from '@kittycad/lib'
|
||||||
import { secrets } from './secrets'
|
import { KCL_DEFAULT_LENGTH } from '@src/lib/constants'
|
||||||
import {
|
|
||||||
Paths,
|
|
||||||
doExport,
|
|
||||||
getUtils,
|
|
||||||
settingsToToml,
|
|
||||||
orRunWhenFullSuiteEnabled,
|
|
||||||
} from './test-utils'
|
|
||||||
import { Models } from '@kittycad/lib'
|
|
||||||
import fsp from 'fs/promises'
|
|
||||||
import { spawn } from 'child_process'
|
import { spawn } from 'child_process'
|
||||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
import fsp from 'fs/promises'
|
||||||
import JSZip from 'jszip'
|
import JSZip from 'jszip'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { TEST_SETTINGS, TEST_SETTINGS_KEY } from './storageStates'
|
|
||||||
import { SceneFixture } from './fixtures/sceneFixture'
|
import type { CmdBarFixture } from '@e2e/playwright/fixtures/cmdBarFixture'
|
||||||
import { CmdBarFixture } from './fixtures/cmdBarFixture'
|
import type { SceneFixture } from '@e2e/playwright/fixtures/sceneFixture'
|
||||||
|
import { secrets } from '@e2e/playwright/secrets'
|
||||||
|
import { TEST_SETTINGS, TEST_SETTINGS_KEY } from '@e2e/playwright/storageStates'
|
||||||
|
import type { Paths } from '@e2e/playwright/test-utils'
|
||||||
|
import {
|
||||||
|
doExport,
|
||||||
|
getUtils,
|
||||||
|
orRunWhenFullSuiteEnabled,
|
||||||
|
settingsToToml,
|
||||||
|
} from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.beforeEach(async ({ page, context }) => {
|
test.beforeEach(async ({ page, context }) => {
|
||||||
// Make the user avatar image always 404
|
// Make the user avatar image always 404
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
import type { SaveSettingsPayload } from '@src/lib/settings/settingsTypes'
|
||||||
import { SaveSettingsPayload } from 'lib/settings/settingsTypes'
|
import { Themes } from '@src/lib/theme'
|
||||||
import { Themes } from 'lib/theme'
|
import type { DeepPartial } from '@src/lib/types'
|
||||||
import { DeepPartial } from 'lib/types'
|
import { onboardingPaths } from '@src/routes/Onboarding/paths'
|
||||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
|
||||||
|
import type { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||||
|
|
||||||
export const IS_PLAYWRIGHT_KEY = 'playwright'
|
export const IS_PLAYWRIGHT_KEY = 'playwright'
|
||||||
|
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import type { EngineCommand } from '@src/lang/std/artifactGraph'
|
||||||
import { commonPoints, getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
import { uuidv4 } from '@src/lib/utils'
|
||||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
|
||||||
import { uuidv4 } from 'lib/utils'
|
import {
|
||||||
|
commonPoints,
|
||||||
|
getUtils,
|
||||||
|
orRunWhenFullSuiteEnabled,
|
||||||
|
} from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Test network and connection issues', () => {
|
test.describe('Test network and connection issues', () => {
|
||||||
test(
|
test(
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
|
orRunWhenFullSuiteEnabled,
|
||||||
runningOnLinux,
|
runningOnLinux,
|
||||||
runningOnMac,
|
runningOnMac,
|
||||||
runningOnWindows,
|
runningOnWindows,
|
||||||
orRunWhenFullSuiteEnabled,
|
} from '@e2e/playwright/test-utils'
|
||||||
} from './test-utils'
|
|
||||||
|
|
||||||
describe('platform detection utilities', () => {
|
describe('platform detection utilities', () => {
|
||||||
const originalPlatform = process.platform
|
const originalPlatform = process.platform
|
||||||
|
@ -1,32 +1,29 @@
|
|||||||
import {
|
import * as TOML from '@iarna/toml'
|
||||||
expect,
|
import type { Models } from '@kittycad/lib'
|
||||||
BrowserContext,
|
import type { BrowserContext, Locator, Page, TestInfo } from '@playwright/test'
|
||||||
TestInfo,
|
import { expect } from '@playwright/test'
|
||||||
Locator,
|
import type { EngineCommand } from '@src/lang/std/artifactGraph'
|
||||||
Page,
|
import type { Configuration } from '@src/lang/wasm'
|
||||||
} from '@playwright/test'
|
import { COOKIE_NAME } from '@src/lib/constants'
|
||||||
import { test } from './zoo-test'
|
import { reportRejection } from '@src/lib/trap'
|
||||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
import type { DeepPartial } from '@src/lib/types'
|
||||||
|
import { isArray } from '@src/lib/utils'
|
||||||
import fsp from 'fs/promises'
|
import fsp from 'fs/promises'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import pixelMatch from 'pixelmatch'
|
import pixelMatch from 'pixelmatch'
|
||||||
|
import type { Protocol } from 'playwright-core/types/protocol'
|
||||||
import { PNG } from 'pngjs'
|
import { PNG } from 'pngjs'
|
||||||
import { Protocol } from 'playwright-core/types/protocol'
|
|
||||||
import type { Models } from '@kittycad/lib'
|
import type { ProjectConfiguration } from '@rust/kcl-lib/bindings/ProjectConfiguration'
|
||||||
import { COOKIE_NAME } from 'lib/constants'
|
|
||||||
import { secrets } from './secrets'
|
import { isErrorWhitelisted } from '@e2e/playwright/lib/console-error-whitelist'
|
||||||
|
import { secrets } from '@e2e/playwright/secrets'
|
||||||
import {
|
import {
|
||||||
TEST_SETTINGS_KEY,
|
|
||||||
TEST_SETTINGS,
|
|
||||||
IS_PLAYWRIGHT_KEY,
|
IS_PLAYWRIGHT_KEY,
|
||||||
} from './storageStates'
|
TEST_SETTINGS,
|
||||||
import * as TOML from '@iarna/toml'
|
TEST_SETTINGS_KEY,
|
||||||
import { isErrorWhitelisted } from './lib/console-error-whitelist'
|
} from '@e2e/playwright/storageStates'
|
||||||
import { isArray } from 'lib/utils'
|
import { test } from '@e2e/playwright/zoo-test'
|
||||||
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) => {
|
const toNormalizedCode = (text: string) => {
|
||||||
return text.replace(/\s+/g, '')
|
return text.replace(/\s+/g, '')
|
||||||
@ -683,8 +680,8 @@ const _makeTemplate = (
|
|||||||
isArray(currentOptions)
|
isArray(currentOptions)
|
||||||
? currentOptions[i]
|
? currentOptions[i]
|
||||||
: typeof currentOptions === 'number'
|
: typeof currentOptions === 'number'
|
||||||
? currentOptions
|
? currentOptions
|
||||||
: ''
|
: ''
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import type { EngineCommand } from '@src/lang/std/artifactGraph'
|
||||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
import { uuidv4 } from '@src/lib/utils'
|
||||||
import { uuidv4 } from 'lib/utils'
|
|
||||||
import { getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
import { getUtils, orRunWhenFullSuiteEnabled } from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Testing Camera Movement', { tag: ['@skipWin'] }, () => {
|
test.describe('Testing Camera Movement', { tag: ['@skipWin'] }, () => {
|
||||||
test('Can move camera reliably', async ({ page, context, homePage }) => {
|
test('Can move camera reliably', async ({ page, context, homePage }) => {
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { XOR } from '@src/lib/utils'
|
||||||
import * as fsp from 'fs/promises'
|
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 path from 'node:path'
|
||||||
|
|
||||||
|
import {
|
||||||
|
TEST_COLORS,
|
||||||
|
getUtils,
|
||||||
|
orRunWhenFullSuiteEnabled,
|
||||||
|
pollEditorLinesSelectedLength,
|
||||||
|
} from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
|
||||||
test('Can constrain line length', async ({ page, homePage }) => {
|
test('Can constrain line length', async ({ page, homePage }) => {
|
||||||
await page.addInitScript(async () => {
|
await page.addInitScript(async () => {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { uuidv4 } from '@src/lib/utils'
|
||||||
import { getUtils } from './test-utils'
|
|
||||||
import { uuidv4 } from 'lib/utils'
|
import { TEST_CODE_GIZMO } from '@e2e/playwright/storageStates'
|
||||||
import { TEST_CODE_GIZMO } from './storageStates'
|
import { getUtils } from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Testing Gizmo', { tag: ['@skipWin'] }, () => {
|
test.describe('Testing Gizmo', { tag: ['@skipWin'] }, () => {
|
||||||
const cases = [
|
const cases = [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { getUtils, orRunWhenFullSuiteEnabled } from '@e2e/playwright/test-utils'
|
||||||
import { getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Test toggling perspective', () => {
|
test.describe('Test toggling perspective', () => {
|
||||||
test('via command palette and toggle', async ({ page, homePage }) => {
|
test('via command palette and toggle', async ({ page, homePage }) => {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import { FILE_EXT } from '@src/lib/constants'
|
||||||
import { getUtils } from './test-utils'
|
import { bracket } from '@src/lib/exampleKcl'
|
||||||
import { bracket } from 'lib/exampleKcl'
|
|
||||||
import * as fsp from 'fs/promises'
|
import * as fsp from 'fs/promises'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { FILE_EXT } from 'lib/constants'
|
|
||||||
|
import { getUtils } from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Testing in-app sample loading', () => {
|
test.describe('Testing in-app sample loading', () => {
|
||||||
/**
|
/**
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { Page } from '@playwright/test'
|
import type { Page } from '@playwright/test'
|
||||||
import { test, expect } from './zoo-test'
|
import type { LineInputsType } from '@src/lang/std/sketchcombos'
|
||||||
|
import { uuidv4 } from '@src/lib/utils'
|
||||||
|
|
||||||
|
import type { EditorFixture } from '@e2e/playwright/fixtures/editorFixture'
|
||||||
import {
|
import {
|
||||||
deg,
|
deg,
|
||||||
getUtils,
|
getUtils,
|
||||||
wiggleMove,
|
|
||||||
orRunWhenFullSuiteEnabled,
|
orRunWhenFullSuiteEnabled,
|
||||||
} from './test-utils'
|
wiggleMove,
|
||||||
import { LineInputsType } from 'lang/std/sketchcombos'
|
} from '@e2e/playwright/test-utils'
|
||||||
import { uuidv4 } from 'lib/utils'
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
import { EditorFixture } from './fixtures/editorFixture'
|
|
||||||
|
|
||||||
test.describe('Testing segment overlays', { tag: ['@skipWin'] }, () => {
|
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', () => {
|
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,9 +1,13 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import type { Coords2d } from '@src/lang/std/sketch'
|
||||||
|
import { KCL_DEFAULT_LENGTH } from '@src/lib/constants'
|
||||||
|
import { uuidv4 } from '@src/lib/utils'
|
||||||
|
|
||||||
import { commonPoints, getUtils, orRunWhenFullSuiteEnabled } from './test-utils'
|
import {
|
||||||
import { Coords2d } from 'lang/std/sketch'
|
commonPoints,
|
||||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
getUtils,
|
||||||
import { uuidv4 } from 'lib/utils'
|
orRunWhenFullSuiteEnabled,
|
||||||
|
} from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
|
test.describe('Testing selections', { tag: ['@skipWin'] }, () => {
|
||||||
test.setTimeout(90_000)
|
test.setTimeout(90_000)
|
||||||
|
@ -1,24 +1,29 @@
|
|||||||
import { test, expect } from './zoo-test'
|
import {
|
||||||
|
PROJECT_SETTINGS_FILE_NAME,
|
||||||
|
SETTINGS_FILE_NAME,
|
||||||
|
} from '@src/lib/constants'
|
||||||
|
import type { SettingsLevel } from '@src/lib/settings/settingsTypes'
|
||||||
|
import type { DeepPartial } from '@src/lib/types'
|
||||||
import * as fsp from 'fs/promises'
|
import * as fsp from 'fs/promises'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
|
import type { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getUtils,
|
|
||||||
executorInputPath,
|
|
||||||
createProject,
|
|
||||||
tomlToSettings,
|
|
||||||
TEST_COLORS,
|
|
||||||
orRunWhenFullSuiteEnabled,
|
|
||||||
} from './test-utils'
|
|
||||||
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,
|
||||||
|
TEST_SETTINGS_CORRUPTED,
|
||||||
TEST_SETTINGS_DEFAULT_THEME,
|
TEST_SETTINGS_DEFAULT_THEME,
|
||||||
} from './storageStates'
|
TEST_SETTINGS_KEY,
|
||||||
import { DeepPartial } from 'lib/types'
|
} from '@e2e/playwright/storageStates'
|
||||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
import {
|
||||||
|
TEST_COLORS,
|
||||||
|
createProject,
|
||||||
|
executorInputPath,
|
||||||
|
getUtils,
|
||||||
|
orRunWhenFullSuiteEnabled,
|
||||||
|
tomlToSettings,
|
||||||
|
} from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Testing settings', () => {
|
test.describe('Testing settings', () => {
|
||||||
test('Stored settings are validated and fall back to defaults', async ({
|
test('Stored settings are validated and fall back to defaults', async ({
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import { Page } from '@playwright/test'
|
import type { Page } from '@playwright/test'
|
||||||
import { test, expect } from './zoo-test'
|
|
||||||
import {
|
|
||||||
getUtils,
|
|
||||||
createProject,
|
|
||||||
orRunWhenFullSuiteEnabled,
|
|
||||||
} from './test-utils'
|
|
||||||
import { join } from 'path'
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
import { join } from 'path'
|
||||||
|
|
||||||
|
import {
|
||||||
|
createProject,
|
||||||
|
getUtils,
|
||||||
|
orRunWhenFullSuiteEnabled,
|
||||||
|
} from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test.describe('Text-to-CAD tests', { tag: ['@skipWin'] }, () => {
|
test.describe('Text-to-CAD tests', { tag: ['@skipWin'] }, () => {
|
||||||
test('basic lego happy case', async ({ page, homePage }) => {
|
test('basic lego happy case', async ({ page, homePage }) => {
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import { test, expect } from './zoo-test'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
doExport,
|
doExport,
|
||||||
getUtils,
|
getUtils,
|
||||||
makeTemplate,
|
makeTemplate,
|
||||||
orRunWhenFullSuiteEnabled,
|
orRunWhenFullSuiteEnabled,
|
||||||
} from './test-utils'
|
} from '@e2e/playwright/test-utils'
|
||||||
|
import { expect, test } from '@e2e/playwright/zoo-test'
|
||||||
|
|
||||||
test('Units menu', async ({ page, homePage }) => {
|
test('Units menu', async ({ page, homePage }) => {
|
||||||
test.fixme(orRunWhenFullSuiteEnabled())
|
test.fixme(orRunWhenFullSuiteEnabled())
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
/* eslint-disable react-hooks/rules-of-hooks */
|
/* eslint-disable react-hooks/rules-of-hooks */
|
||||||
|
|
||||||
import { test as playwrightTestFn } from '@playwright/test'
|
import { test as playwrightTestFn } from '@playwright/test'
|
||||||
|
|
||||||
|
import type { Fixtures } from '@e2e/playwright/fixtures/fixtureSetup'
|
||||||
import {
|
import {
|
||||||
fixturesBasedOnProcessEnvPlatform,
|
|
||||||
Fixtures,
|
|
||||||
ElectronZoo,
|
ElectronZoo,
|
||||||
} from './fixtures/fixtureSetup'
|
fixturesBasedOnProcessEnvPlatform,
|
||||||
|
} from '@e2e/playwright/fixtures/fixtureSetup'
|
||||||
|
|
||||||
export { expect } from '@playwright/test'
|
export { expect } from '@playwright/test'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { ForgeConfig } from '@electron-forge/shared-types'
|
|
||||||
import { VitePlugin } from '@electron-forge/plugin-vite'
|
|
||||||
import { FusesPlugin } from '@electron-forge/plugin-fuses'
|
import { FusesPlugin } from '@electron-forge/plugin-fuses'
|
||||||
|
import { VitePlugin } from '@electron-forge/plugin-vite'
|
||||||
|
import type { ForgeConfig } from '@electron-forge/shared-types'
|
||||||
import { FuseV1Options, FuseVersion } from '@electron/fuses'
|
import { FuseV1Options, FuseVersion } from '@electron/fuses'
|
||||||
import path from 'path'
|
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' {
|
declare module 'vite' {
|
||||||
interface ConfigEnv<
|
interface ConfigEnv<
|
||||||
K extends keyof VitePluginConfig = keyof VitePluginConfig
|
K extends keyof VitePluginConfig = keyof VitePluginConfig,
|
||||||
> {
|
> {
|
||||||
root: string
|
root: string
|
||||||
forgeConfig: VitePluginConfig
|
forgeConfig: VitePluginConfig
|
||||||
|
13
interface.d.ts
vendored
13
interface.d.ts
vendored
@ -1,13 +1,10 @@
|
|||||||
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 { MachinesListing } from 'components/MachineManagerProvider'
|
||||||
import type { Channel } from 'src/menu/channels'
|
import 'electron'
|
||||||
import { Menu, WebContents } from 'electron'
|
import { dialog, shell } from 'electron'
|
||||||
import { ZooLabel, ZooMenuEvents } from 'menu/roles'
|
|
||||||
import type { MenuActionIPC } from 'menu/rules'
|
|
||||||
import type { WebContentSendPayload } from 'menu/channels'
|
import type { WebContentSendPayload } from 'menu/channels'
|
||||||
|
import { ZooLabel } from 'menu/roles'
|
||||||
|
import fs from 'node:fs/promises'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
// Extend the interface with additional custom properties
|
// Extend the interface with additional custom properties
|
||||||
declare module 'electron' {
|
declare module 'electron' {
|
||||||
|
27
package.json
27
package.json
@ -88,9 +88,9 @@
|
|||||||
"simpleserver:ci": "yarn pretest && http-server ./public --cors -p 3000 &",
|
"simpleserver:ci": "yarn pretest && http-server ./public --cors -p 3000 &",
|
||||||
"simpleserver:bg": "yarn pretest && http-server ./public --cors -p 3000 &",
|
"simpleserver:bg": "yarn pretest && http-server ./public --cors -p 3000 &",
|
||||||
"simpleserver:stop": "kill-port 3000",
|
"simpleserver:stop": "kill-port 3000",
|
||||||
"fmt": "prettier --write ./src *.ts *.json *.js ./e2e ./packages ./rust/kcl-language-server ./rust/kcl-lib/bindings ./rust/kcl-wasm-lib/pkg",
|
"fmt": "prettier --write .eslintrc.json ./src *.ts *.json *.js ./e2e ./packages ./rust/kcl-language-server ./rust/kcl-lib/bindings ./rust/kcl-wasm-lib/pkg",
|
||||||
"fmt:generated": "prettier --write *.ts *.json *.js ./rust/kcl-lib/bindings ./rust/kcl-wasm-lib/pkg",
|
"fmt:generated": "prettier --write .eslintrc.json *.ts *.json *.js ./rust/kcl-lib/bindings ./rust/kcl-wasm-lib/pkg",
|
||||||
"fmt-check": "prettier --check ./src *.ts *.json *.js ./e2e ./packages ./rust/kcl-language-server",
|
"fmt-check": "prettier --check .eslintrc.json ./src *.ts *.json *.js ./e2e ./packages ./rust/kcl-language-server",
|
||||||
"fetch:wasm": "./scripts/get-latest-wasm-bundle.sh",
|
"fetch:wasm": "./scripts/get-latest-wasm-bundle.sh",
|
||||||
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
|
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
|
||||||
"fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/achalmers/kw-args-xylineto.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples",
|
"fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/achalmers/kw-args-xylineto.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples",
|
||||||
@ -102,6 +102,7 @@
|
|||||||
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\" || echo \"sed for both mac and linux\"",
|
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\" || echo \"sed for both mac and linux\"",
|
||||||
"lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
"lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
||||||
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
||||||
|
"circular-deps": "dpdm --no-warning --no-tree -T --skip-dynamic-imports=circular src/index.tsx",
|
||||||
"files:set-version": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json",
|
"files:set-version": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json",
|
||||||
"files:set-notes": "./scripts/set-files-notes.sh",
|
"files:set-notes": "./scripts/set-files-notes.sh",
|
||||||
"files:flip-to-nightly": "./scripts/flip-files-to-nightly.sh",
|
"files:flip-to-nightly": "./scripts/flip-files-to-nightly.sh",
|
||||||
@ -139,7 +140,20 @@
|
|||||||
"trailingComma": "es5",
|
"trailingComma": "es5",
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"semi": false,
|
"semi": false,
|
||||||
"singleQuote": true
|
"singleQuote": true,
|
||||||
|
"importOrder": [
|
||||||
|
"<THIRD_PARTY_MODULES>",
|
||||||
|
"^@rust/(.*)$",
|
||||||
|
"^@e2e/(.*)$",
|
||||||
|
"^@src/(.*)$",
|
||||||
|
"^[./]"
|
||||||
|
],
|
||||||
|
"importOrderSeparation": true,
|
||||||
|
"importOrderSortSpecifiers": true,
|
||||||
|
"plugins": [
|
||||||
|
"@trivago/prettier-plugin-sort-imports",
|
||||||
|
"prettier-plugin-organize-imports"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
@ -167,6 +181,7 @@
|
|||||||
"@playwright/test": "^1.51.1",
|
"@playwright/test": "^1.51.1",
|
||||||
"@testing-library/jest-dom": "^5.14.1",
|
"@testing-library/jest-dom": "^5.14.1",
|
||||||
"@testing-library/react": "^15.0.2",
|
"@testing-library/react": "^15.0.2",
|
||||||
|
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
||||||
"@types/diff": "^7.0.2",
|
"@types/diff": "^7.0.2",
|
||||||
"@types/electron": "^1.6.10",
|
"@types/electron": "^1.6.10",
|
||||||
"@types/isomorphic-fetch": "^0.0.39",
|
"@types/isomorphic-fetch": "^0.0.39",
|
||||||
@ -187,6 +202,7 @@
|
|||||||
"@vitest/web-worker": "^1.5.0",
|
"@vitest/web-worker": "^1.5.0",
|
||||||
"@xstate/cli": "^0.5.17",
|
"@xstate/cli": "^0.5.17",
|
||||||
"autoprefixer": "^10.4.21",
|
"autoprefixer": "^10.4.21",
|
||||||
|
"dpdm": "^3.14.0",
|
||||||
"electron": "^34.1.1",
|
"electron": "^34.1.1",
|
||||||
"electron-builder": "^26.0.12",
|
"electron-builder": "^26.0.12",
|
||||||
"eslint": "^8.0.1",
|
"eslint": "^8.0.1",
|
||||||
@ -208,7 +224,8 @@
|
|||||||
"pngjs": "^7.0.0",
|
"pngjs": "^7.0.0",
|
||||||
"postcss": "^8.4.43",
|
"postcss": "^8.4.43",
|
||||||
"postinstall-postinstall": "^2.1.0",
|
"postinstall-postinstall": "^2.1.0",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^3.5.3",
|
||||||
|
"prettier-plugin-organize-imports": "^4.1.0",
|
||||||
"setimmediate": "^1.0.5",
|
"setimmediate": "^1.0.5",
|
||||||
"tailwindcss": "^3.4.17",
|
"tailwindcss": "^3.4.17",
|
||||||
"ts-node": "^10.0.0",
|
"ts-node": "^10.0.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import dts from 'rollup-plugin-dts'
|
|
||||||
import { lezer } from '@lezer/generator/rollup'
|
import { lezer } from '@lezer/generator/rollup'
|
||||||
import typescript from '@rollup/plugin-typescript'
|
import typescript from '@rollup/plugin-typescript'
|
||||||
|
import dts from 'rollup-plugin-dts'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
// Base CodeMirror language support for kcl.
|
// Base CodeMirror language support for kcl.
|
||||||
|
|
||||||
import {
|
import {
|
||||||
LRLanguage,
|
LRLanguage,
|
||||||
LanguageSupport,
|
LanguageSupport,
|
||||||
indentNodeProp,
|
|
||||||
continuedIndent,
|
continuedIndent,
|
||||||
delimitedIndent,
|
delimitedIndent,
|
||||||
foldNodeProp,
|
|
||||||
foldInside,
|
foldInside,
|
||||||
|
foldNodeProp,
|
||||||
|
indentNodeProp,
|
||||||
} from '@codemirror/language'
|
} from '@codemirror/language'
|
||||||
|
|
||||||
// @ts-ignore: No types available
|
// @ts-ignore: No types available
|
||||||
import { parser } from './kcl.grammar'
|
import { parser } from './kcl.grammar'
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { KclLanguage } from '../src/index'
|
|
||||||
import { fileTests } from '@lezer/generator/dist/test'
|
import { fileTests } from '@lezer/generator/dist/test'
|
||||||
|
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
|
import { KclLanguage } from '../src/index'
|
||||||
|
|
||||||
let caseDir = path.dirname(__filename)
|
let caseDir = path.dirname(__filename)
|
||||||
|
|
||||||
for (let file of fs.readdirSync(caseDir)) {
|
for (let file of fs.readdirSync(caseDir)) {
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
// Overrides the test options from the modeling-app config.
|
// 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
|
// @ts-ignore: No types available
|
||||||
import { lezer } from '@lezer/generator/rollup'
|
import { lezer } from '@lezer/generator/rollup'
|
||||||
|
import viteTsconfigPaths from 'vite-tsconfig-paths'
|
||||||
|
import { defineConfig } from 'vitest/config'
|
||||||
|
|
||||||
const config = defineConfig({
|
const config = defineConfig({
|
||||||
test: {
|
test: {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { encoder, decoder } from '../codec'
|
import { decoder, encoder } from './encode-decode'
|
||||||
|
|
||||||
export default class Bytes {
|
export default class Bytes {
|
||||||
static encode(input: string): Uint8Array {
|
static encode(input: string): Uint8Array {
|
||||||
@ -10,7 +10,7 @@ export default class Bytes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static append<
|
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[]) {
|
>(constructor: { new (length: number): T }, ...arrays: T[]) {
|
||||||
let totalLength = 0
|
let totalLength = 0
|
||||||
for (const arr of arrays) {
|
for (const arr of arrays) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import * as vsrpc from 'vscode-jsonrpc'
|
import * as vsrpc from 'vscode-jsonrpc'
|
||||||
|
|
||||||
import { Codec } from '.'
|
|
||||||
import Bytes from './bytes'
|
import Bytes from './bytes'
|
||||||
|
import PromiseMap from './map'
|
||||||
import Queue from './queue'
|
import Queue from './queue'
|
||||||
import Tracer from './tracer'
|
import Tracer from './tracer'
|
||||||
import PromiseMap from './map'
|
import { Codec } from './utils'
|
||||||
|
|
||||||
export default class StreamDemuxer extends Queue<Uint8Array> {
|
export default class StreamDemuxer extends Queue<Uint8Array> {
|
||||||
readonly responses: PromiseMap<number | string, vsrpc.ResponseMessage> =
|
readonly responses: PromiseMap<number | string, vsrpc.ResponseMessage> =
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
export const encoder = new TextEncoder()
|
||||||
|
export const decoder = new TextDecoder()
|
@ -1,8 +1,7 @@
|
|||||||
import * as jsrpc from 'json-rpc-2.0'
|
import type * as vsrpc from 'vscode-jsonrpc'
|
||||||
import * as vsrpc from 'vscode-jsonrpc'
|
|
||||||
|
|
||||||
import Bytes from './bytes'
|
|
||||||
import StreamDemuxer from './demuxer'
|
import StreamDemuxer from './demuxer'
|
||||||
|
import { decoder } from './encode-decode'
|
||||||
import Headers from './headers'
|
import Headers from './headers'
|
||||||
import Queue from './queue'
|
import Queue from './queue'
|
||||||
import Tracer from './tracer'
|
import Tracer from './tracer'
|
||||||
@ -12,25 +11,6 @@ export enum LspWorkerEventType {
|
|||||||
Call = 'call',
|
Call = 'call',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const encoder = new TextEncoder()
|
|
||||||
export const decoder = new TextDecoder()
|
|
||||||
|
|
||||||
export class Codec {
|
|
||||||
static encode(
|
|
||||||
json: jsrpc.JSONRPCRequest | jsrpc.JSONRPCResponse
|
|
||||||
): Uint8Array {
|
|
||||||
const message = JSON.stringify(json)
|
|
||||||
const delimited = Headers.add(message)
|
|
||||||
return Bytes.encode(delimited)
|
|
||||||
}
|
|
||||||
|
|
||||||
static decode<T>(data: Uint8Array): T {
|
|
||||||
const delimited = Bytes.decode(data)
|
|
||||||
const message = Headers.remove(delimited)
|
|
||||||
return JSON.parse(message) as T
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: tracing efficiency
|
// FIXME: tracing efficiency
|
||||||
export class IntoServer
|
export class IntoServer
|
||||||
extends Queue<Uint8Array>
|
extends Queue<Uint8Array>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Message } from 'vscode-languageserver-protocol'
|
import type { Message } from 'vscode-languageserver-protocol'
|
||||||
|
|
||||||
export default class Tracer {
|
export default class Tracer {
|
||||||
static client(message: string): void {
|
static client(message: string): void {
|
||||||
|
20
packages/codemirror-lsp-client/src/client/codec/utils.ts
Normal file
20
packages/codemirror-lsp-client/src/client/codec/utils.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import type * as jsrpc from 'json-rpc-2.0'
|
||||||
|
|
||||||
|
import Bytes from './bytes'
|
||||||
|
import Headers from './headers'
|
||||||
|
|
||||||
|
export class Codec {
|
||||||
|
static encode(
|
||||||
|
json: jsrpc.JSONRPCRequest | jsrpc.JSONRPCResponse
|
||||||
|
): Uint8Array {
|
||||||
|
const message = JSON.stringify(json)
|
||||||
|
const delimited = Headers.add(message)
|
||||||
|
return Bytes.encode(delimited)
|
||||||
|
}
|
||||||
|
|
||||||
|
static decode<T>(data: Uint8Array): T {
|
||||||
|
const delimited = Bytes.decode(data)
|
||||||
|
const message = Headers.remove(delimited)
|
||||||
|
return JSON.parse(message) as T
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
import type * as LSP from 'vscode-languageserver-protocol'
|
import type * as LSP from 'vscode-languageserver-protocol'
|
||||||
|
|
||||||
import { FromServer, IntoServer } from './codec'
|
import type { LanguageServerPlugin } from '../plugin/lsp'
|
||||||
|
import type { FromServer, IntoServer } from './codec'
|
||||||
import Client from './jsonrpc'
|
import Client from './jsonrpc'
|
||||||
import { LanguageServerPlugin } from '../plugin/lsp'
|
|
||||||
|
|
||||||
// https://microsoft.github.io/language-server-protocol/specifications/specification-current/
|
// https://microsoft.github.io/language-server-protocol/specifications/specification-current/
|
||||||
|
|
||||||
@ -12,15 +12,15 @@ interface LSPRequestMap {
|
|||||||
'textDocument/hover': [LSP.HoverParams, LSP.Hover]
|
'textDocument/hover': [LSP.HoverParams, LSP.Hover]
|
||||||
'textDocument/completion': [
|
'textDocument/completion': [
|
||||||
LSP.CompletionParams,
|
LSP.CompletionParams,
|
||||||
LSP.CompletionItem[] | LSP.CompletionList | null
|
LSP.CompletionItem[] | LSP.CompletionList | null,
|
||||||
]
|
]
|
||||||
'textDocument/semanticTokens/full': [
|
'textDocument/semanticTokens/full': [
|
||||||
LSP.SemanticTokensParams,
|
LSP.SemanticTokensParams,
|
||||||
LSP.SemanticTokens
|
LSP.SemanticTokens,
|
||||||
]
|
]
|
||||||
'textDocument/formatting': [
|
'textDocument/formatting': [
|
||||||
LSP.DocumentFormattingParams,
|
LSP.DocumentFormattingParams,
|
||||||
LSP.TextEdit[] | null
|
LSP.TextEdit[] | null,
|
||||||
]
|
]
|
||||||
'textDocument/foldingRange': [LSP.FoldingRangeParams, LSP.FoldingRange[]]
|
'textDocument/foldingRange': [LSP.FoldingRangeParams, LSP.FoldingRange[]]
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import * as jsrpc from 'json-rpc-2.0'
|
import * as jsrpc from 'json-rpc-2.0'
|
||||||
import * as LSP from 'vscode-languageserver-protocol'
|
import * as LSP from 'vscode-languageserver-protocol'
|
||||||
|
|
||||||
|
import type { FromServer, IntoServer } from './codec'
|
||||||
|
import { Codec } from './codec/utils'
|
||||||
import {
|
import {
|
||||||
registerServerCapability,
|
registerServerCapability,
|
||||||
unregisterServerCapability,
|
unregisterServerCapability,
|
||||||
} from './server-capability-registration'
|
} from './server-capability-registration'
|
||||||
import { Codec, FromServer, IntoServer } from './codec'
|
|
||||||
|
|
||||||
const client_capabilities: LSP.ClientCapabilities = {
|
const client_capabilities: LSP.ClientCapabilities = {
|
||||||
textDocument: {
|
textDocument: {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {
|
import type {
|
||||||
Registration,
|
Registration,
|
||||||
ServerCapabilities,
|
ServerCapabilities,
|
||||||
Unregistration,
|
Unregistration,
|
||||||
|
@ -1,36 +1,34 @@
|
|||||||
import { foldService } from '@codemirror/language'
|
import { foldService } from '@codemirror/language'
|
||||||
import { Extension, EditorState } from '@codemirror/state'
|
import type { EditorState, Extension } from '@codemirror/state'
|
||||||
import { ViewPlugin } from '@codemirror/view'
|
import { ViewPlugin } from '@codemirror/view'
|
||||||
|
|
||||||
|
import type { LanguageServerOptions } from './plugin/lsp'
|
||||||
import {
|
import {
|
||||||
docPathFacet,
|
|
||||||
LanguageServerPlugin,
|
LanguageServerPlugin,
|
||||||
LanguageServerPluginSpec,
|
LanguageServerPluginSpec,
|
||||||
|
docPathFacet,
|
||||||
languageId,
|
languageId,
|
||||||
workspaceFolders,
|
workspaceFolders,
|
||||||
LanguageServerOptions,
|
|
||||||
} from './plugin/lsp'
|
} from './plugin/lsp'
|
||||||
|
|
||||||
export type { LanguageServerClientOptions } from './client'
|
|
||||||
export { LanguageServerClient } from './client'
|
export { LanguageServerClient } from './client'
|
||||||
|
export type { LanguageServerClientOptions } from './client'
|
||||||
|
export { FromServer, IntoServer, LspWorkerEventType } from './client/codec'
|
||||||
|
export { Codec } from './client/codec/utils'
|
||||||
export {
|
export {
|
||||||
Codec,
|
lspDiagnosticsEvent,
|
||||||
FromServer,
|
lspFormatCodeEvent,
|
||||||
IntoServer,
|
lspSemanticTokensEvent,
|
||||||
LspWorkerEventType,
|
} from './plugin/annotation'
|
||||||
} from './client/codec'
|
|
||||||
export type { LanguageServerOptions } from './plugin/lsp'
|
|
||||||
export {
|
export {
|
||||||
LanguageServerPlugin,
|
LanguageServerPlugin,
|
||||||
LanguageServerPluginSpec,
|
LanguageServerPluginSpec,
|
||||||
docPathFacet,
|
docPathFacet,
|
||||||
languageId,
|
languageId,
|
||||||
workspaceFolders,
|
workspaceFolders,
|
||||||
lspSemanticTokensEvent,
|
|
||||||
lspDiagnosticsEvent,
|
|
||||||
lspFormatCodeEvent,
|
|
||||||
} from './plugin/lsp'
|
} from './plugin/lsp'
|
||||||
export { posToOffset, offsetToPos } from './plugin/util'
|
export type { LanguageServerOptions } from './plugin/lsp'
|
||||||
|
export { offsetToPos, posToOffset } from './plugin/util'
|
||||||
|
|
||||||
export function lspPlugin(options: LanguageServerOptions): Extension {
|
export function lspPlugin(options: LanguageServerOptions): Extension {
|
||||||
let plugin: LanguageServerPlugin | null = null
|
let plugin: LanguageServerPlugin | null = null
|
||||||
|
12
packages/codemirror-lsp-client/src/plugin/annotation.ts
Normal file
12
packages/codemirror-lsp-client/src/plugin/annotation.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { Annotation } from '@codemirror/state'
|
||||||
|
|
||||||
|
export enum LspAnnotation {
|
||||||
|
SemanticTokens = 'semantic-tokens',
|
||||||
|
FormatCode = 'format-code',
|
||||||
|
Diagnostics = 'diagnostics',
|
||||||
|
}
|
||||||
|
|
||||||
|
const lspEvent = Annotation.define<LspAnnotation>()
|
||||||
|
export const lspSemanticTokensEvent = lspEvent.of(LspAnnotation.SemanticTokens)
|
||||||
|
export const lspFormatCodeEvent = lspEvent.of(LspAnnotation.FormatCode)
|
||||||
|
export const lspDiagnosticsEvent = lspEvent.of(LspAnnotation.Diagnostics)
|
@ -9,17 +9,18 @@ import {
|
|||||||
prevSnippetField,
|
prevSnippetField,
|
||||||
startCompletion,
|
startCompletion,
|
||||||
} from '@codemirror/autocomplete'
|
} from '@codemirror/autocomplete'
|
||||||
import { Prec, Extension } from '@codemirror/state'
|
import { syntaxTree } from '@codemirror/language'
|
||||||
import { EditorView, keymap, KeyBinding, ViewPlugin } from '@codemirror/view'
|
import type { Extension } from '@codemirror/state'
|
||||||
|
import { Prec } from '@codemirror/state'
|
||||||
|
import type { EditorView, KeyBinding, ViewPlugin } from '@codemirror/view'
|
||||||
|
import { keymap } from '@codemirror/view'
|
||||||
import {
|
import {
|
||||||
CompletionItemKind,
|
CompletionItemKind,
|
||||||
CompletionTriggerKind,
|
CompletionTriggerKind,
|
||||||
} from 'vscode-languageserver-protocol'
|
} from 'vscode-languageserver-protocol'
|
||||||
|
|
||||||
import { LanguageServerPlugin } from './lsp'
|
import type { LanguageServerPlugin } from './lsp'
|
||||||
import { offsetToPos } from './util'
|
import { offsetToPos } from './util'
|
||||||
import { syntaxTree } from '@codemirror/language'
|
|
||||||
|
|
||||||
export const CompletionItemKindMap = Object.fromEntries(
|
export const CompletionItemKindMap = Object.fromEntries(
|
||||||
Object.entries(CompletionItemKind).map(([key, value]) => [value, key])
|
Object.entries(CompletionItemKind).map(([key, value]) => [value, key])
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import { Extension, Prec } from '@codemirror/state'
|
import type { Extension } from '@codemirror/state'
|
||||||
import { EditorView, keymap, KeyBinding, ViewPlugin } from '@codemirror/view'
|
import { Prec } from '@codemirror/state'
|
||||||
|
import type { EditorView, KeyBinding, ViewPlugin } from '@codemirror/view'
|
||||||
|
import { keymap } from '@codemirror/view'
|
||||||
|
|
||||||
import { LanguageServerPlugin } from './lsp'
|
import type { LanguageServerPlugin } from './lsp'
|
||||||
|
|
||||||
export default function lspFormatExt(
|
export default function lspFormatExt(
|
||||||
plugin: ViewPlugin<LanguageServerPlugin>
|
plugin: ViewPlugin<LanguageServerPlugin>
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
import { Extension } from '@codemirror/state'
|
import type { Extension } from '@codemirror/state'
|
||||||
import {
|
import type { ViewPlugin } from '@codemirror/view'
|
||||||
hoverTooltip,
|
import { EditorView, hoverTooltip, tooltips } from '@codemirror/view'
|
||||||
tooltips,
|
|
||||||
ViewPlugin,
|
|
||||||
EditorView,
|
|
||||||
} from '@codemirror/view'
|
|
||||||
|
|
||||||
import { LanguageServerPlugin } from './lsp'
|
import type { LanguageServerPlugin } from './lsp'
|
||||||
import { offsetToPos } from './util'
|
import { offsetToPos } from './util'
|
||||||
|
|
||||||
export default function lspHoverExt(
|
export default function lspHoverExt(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { indentService } from '@codemirror/language'
|
import { indentService } from '@codemirror/language'
|
||||||
import { Extension } from '@codemirror/state'
|
import type { Extension } from '@codemirror/state'
|
||||||
|
|
||||||
export default function lspIndentExt(): Extension {
|
export default function lspIndentExt(): Extension {
|
||||||
// Match the indentation of the previous line (if present).
|
// Match the indentation of the previous line (if present).
|
||||||
|
@ -4,39 +4,34 @@ import type {
|
|||||||
CompletionResult,
|
CompletionResult,
|
||||||
} from '@codemirror/autocomplete'
|
} from '@codemirror/autocomplete'
|
||||||
import { completeFromList, snippetCompletion } from '@codemirror/autocomplete'
|
import { completeFromList, snippetCompletion } from '@codemirror/autocomplete'
|
||||||
import {
|
|
||||||
Facet,
|
|
||||||
StateEffect,
|
|
||||||
Extension,
|
|
||||||
Transaction,
|
|
||||||
Annotation,
|
|
||||||
} from '@codemirror/state'
|
|
||||||
import type {
|
|
||||||
ViewUpdate,
|
|
||||||
PluginValue,
|
|
||||||
PluginSpec,
|
|
||||||
ViewPlugin,
|
|
||||||
} from '@codemirror/view'
|
|
||||||
import { EditorView, Tooltip } from '@codemirror/view'
|
|
||||||
import { linter } from '@codemirror/lint'
|
import { linter } from '@codemirror/lint'
|
||||||
|
import type { Extension, StateEffect } from '@codemirror/state'
|
||||||
import type { PublishDiagnosticsParams } from 'vscode-languageserver-protocol'
|
import { Facet, Transaction } from '@codemirror/state'
|
||||||
|
import type {
|
||||||
|
EditorView,
|
||||||
|
PluginSpec,
|
||||||
|
PluginValue,
|
||||||
|
Tooltip,
|
||||||
|
ViewPlugin,
|
||||||
|
ViewUpdate,
|
||||||
|
} from '@codemirror/view'
|
||||||
import type * as LSP from 'vscode-languageserver-protocol'
|
import type * as LSP from 'vscode-languageserver-protocol'
|
||||||
import {
|
import type {
|
||||||
DiagnosticSeverity,
|
|
||||||
CompletionTriggerKind,
|
CompletionTriggerKind,
|
||||||
|
PublishDiagnosticsParams,
|
||||||
} from 'vscode-languageserver-protocol'
|
} from 'vscode-languageserver-protocol'
|
||||||
|
import { DiagnosticSeverity } from 'vscode-languageserver-protocol'
|
||||||
import { URI } from 'vscode-uri'
|
import { URI } from 'vscode-uri'
|
||||||
|
|
||||||
import { LanguageServerClient } from '../client'
|
import type { LanguageServerClient } from '../client'
|
||||||
import { CompletionItemKindMap } from './autocomplete'
|
import { lspFormatCodeEvent, lspSemanticTokensEvent } from './annotation'
|
||||||
import { addToken, SemanticToken } from './semantic-tokens'
|
import lspAutocompleteExt, { CompletionItemKindMap } from './autocomplete'
|
||||||
import { posToOffset, formatMarkdownContents } from './util'
|
|
||||||
import lspAutocompleteExt from './autocomplete'
|
|
||||||
import lspHoverExt from './hover'
|
|
||||||
import lspFormatExt from './format'
|
import lspFormatExt from './format'
|
||||||
|
import lspHoverExt from './hover'
|
||||||
import lspIndentExt from './indent'
|
import lspIndentExt from './indent'
|
||||||
import lspSemanticTokensExt from './semantic-tokens'
|
import type { SemanticToken } from './semantic-tokens'
|
||||||
|
import lspSemanticTokensExt, { addToken } from './semantic-tokens'
|
||||||
|
import { formatMarkdownContents, posToOffset } from './util'
|
||||||
|
|
||||||
const useLast = (values: readonly any[]) => values.reduce((_, v) => v, '')
|
const useLast = (values: readonly any[]) => values.reduce((_, v) => v, '')
|
||||||
export const docPathFacet = Facet.define<string, string>({
|
export const docPathFacet = Facet.define<string, string>({
|
||||||
@ -48,17 +43,6 @@ export const workspaceFolders = Facet.define<
|
|||||||
LSP.WorkspaceFolder[]
|
LSP.WorkspaceFolder[]
|
||||||
>({ combine: useLast })
|
>({ combine: useLast })
|
||||||
|
|
||||||
export enum LspAnnotation {
|
|
||||||
SemanticTokens = 'semantic-tokens',
|
|
||||||
FormatCode = 'format-code',
|
|
||||||
Diagnostics = 'diagnostics',
|
|
||||||
}
|
|
||||||
|
|
||||||
const lspEvent = Annotation.define<LspAnnotation>()
|
|
||||||
export const lspSemanticTokensEvent = lspEvent.of(LspAnnotation.SemanticTokens)
|
|
||||||
export const lspFormatCodeEvent = lspEvent.of(LspAnnotation.FormatCode)
|
|
||||||
export const lspDiagnosticsEvent = lspEvent.of(LspAnnotation.Diagnostics)
|
|
||||||
|
|
||||||
export interface LanguageServerOptions {
|
export interface LanguageServerOptions {
|
||||||
// We assume this is the main project directory, we are currently working in.
|
// We assume this is the main project directory, we are currently working in.
|
||||||
workspaceFolders: LSP.WorkspaceFolder[]
|
workspaceFolders: LSP.WorkspaceFolder[]
|
||||||
@ -98,7 +82,10 @@ export class LanguageServerPlugin implements PluginValue {
|
|||||||
// document.
|
// document.
|
||||||
private sendScheduled: number | null = null
|
private sendScheduled: number | null = null
|
||||||
|
|
||||||
constructor(options: LanguageServerOptions, private view: EditorView) {
|
constructor(
|
||||||
|
options: LanguageServerOptions,
|
||||||
|
private view: EditorView
|
||||||
|
) {
|
||||||
this.client = options.client
|
this.client = options.client
|
||||||
this.documentVersion = 0
|
this.documentVersion = 0
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { highlightingFor } from '@codemirror/language'
|
import { highlightingFor } from '@codemirror/language'
|
||||||
import { StateEffect, StateField, Extension } from '@codemirror/state'
|
import type { Extension } from '@codemirror/state'
|
||||||
import { EditorView, Decoration, DecorationSet } from '@codemirror/view'
|
import { StateEffect, StateField } from '@codemirror/state'
|
||||||
|
import type { DecorationSet } from '@codemirror/view'
|
||||||
|
import { Decoration, EditorView } from '@codemirror/view'
|
||||||
|
import type { Tag } from '@lezer/highlight'
|
||||||
|
import { tags } from '@lezer/highlight'
|
||||||
|
|
||||||
import { Tag, tags } from '@lezer/highlight'
|
import { lspSemanticTokensEvent } from './annotation'
|
||||||
|
|
||||||
import { lspSemanticTokensEvent } from './lsp'
|
|
||||||
|
|
||||||
export interface SemanticToken {
|
export interface SemanticToken {
|
||||||
from: number
|
from: number
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Text } from '@codemirror/state'
|
import type { Text } from '@codemirror/state'
|
||||||
import { Marked, MarkedOptions } from '@ts-stack/markdown'
|
import type { MarkedOptions } from '@ts-stack/markdown'
|
||||||
|
import { Marked } 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'
|
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
|
// 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 +1,11 @@
|
|||||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||||
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 { exec } from 'child_process'
|
import { exec } from 'child_process'
|
||||||
|
import * as os from 'os'
|
||||||
|
import * as vscode from 'vscode'
|
||||||
|
|
||||||
|
import type { Config } from './config'
|
||||||
|
import type { PersistentState } from './persistent_state'
|
||||||
|
import { isValidExecutable, log } from './util'
|
||||||
|
|
||||||
export async function bootstrap(
|
export async function bootstrap(
|
||||||
context: vscode.ExtensionContext,
|
context: vscode.ExtensionContext,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||||
import * as lc from 'vscode-languageclient/node'
|
|
||||||
import type * as vscode from 'vscode'
|
import type * as vscode from 'vscode'
|
||||||
|
import * as lc from 'vscode-languageclient/node'
|
||||||
|
|
||||||
export async function createClient(
|
export async function createClient(
|
||||||
traceOutputChannel: vscode.OutputChannel,
|
traceOutputChannel: vscode.OutputChannel,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||||
|
import { spawnSync } from 'child_process'
|
||||||
import * as vscode from 'vscode'
|
import * as vscode from 'vscode'
|
||||||
|
|
||||||
import type { Cmd, CtxInit } from './ctx'
|
import type { Cmd, CtxInit } from './ctx'
|
||||||
import { spawnSync } from 'child_process'
|
|
||||||
|
|
||||||
export function serverVersion(ctx: CtxInit): Cmd {
|
export function serverVersion(ctx: CtxInit): Cmd {
|
||||||
return async () => {
|
return async () => {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
/* 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 os from 'os'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as vscode from 'vscode'
|
import * as vscode from 'vscode'
|
||||||
import { log, type Env } from './util'
|
import * as Is from 'vscode-languageclient/lib/common/utils/is'
|
||||||
|
|
||||||
import { expectNotUndefined, unwrapUndefinable } from './undefinable'
|
import { expectNotUndefined, unwrapUndefinable } from './undefinable'
|
||||||
|
import { type Env, log } from './util'
|
||||||
|
|
||||||
export type RunnableEnvCfgItem = {
|
export type RunnableEnvCfgItem = {
|
||||||
mask?: string
|
mask?: string
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||||
import * as vscode from 'vscode'
|
import * as vscode from 'vscode'
|
||||||
import type * as lc from 'vscode-languageclient/node'
|
import type * as lc from 'vscode-languageclient/node'
|
||||||
|
import { TransportKind } from 'vscode-languageclient/node'
|
||||||
|
|
||||||
import { Config, prepareVSCodeConfig } from './config'
|
import { bootstrap } from './bootstrap'
|
||||||
import { createClient } from './client'
|
import { createClient } from './client'
|
||||||
import {
|
import { Config, prepareVSCodeConfig } from './config'
|
||||||
isKclDocument,
|
|
||||||
isKclEditor,
|
|
||||||
LazyOutputChannel,
|
|
||||||
log,
|
|
||||||
type KclEditor,
|
|
||||||
} from './util'
|
|
||||||
import type { ServerStatusParams } from './lsp_ext'
|
import type { ServerStatusParams } from './lsp_ext'
|
||||||
import { PersistentState } from './persistent_state'
|
import { PersistentState } from './persistent_state'
|
||||||
import { bootstrap } from './bootstrap'
|
import {
|
||||||
import { TransportKind } from 'vscode-languageclient/node'
|
type KclEditor,
|
||||||
|
LazyOutputChannel,
|
||||||
|
isKclDocument,
|
||||||
|
isKclEditor,
|
||||||
|
log,
|
||||||
|
} from './util'
|
||||||
|
|
||||||
// We only support local folders, not eg. Live Share (`vlsl:` scheme), so don't activate if
|
// 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
|
// only those are in use. We use "Empty" to represent these scenarios
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||||
import type * as vscode from 'vscode'
|
import type * as vscode from 'vscode'
|
||||||
|
|
||||||
import { log } from './util'
|
import { log } from './util'
|
||||||
|
|
||||||
export class PersistentState {
|
export class PersistentState {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import * as path from 'path'
|
|
||||||
|
|
||||||
import { runTests } from '@vscode/test-electron'
|
import { runTests } from '@vscode/test-electron'
|
||||||
|
import * as path from 'path'
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
try {
|
try {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import * as assert from 'assert'
|
import * as assert from 'assert'
|
||||||
|
|
||||||
// You can import and use all API from the 'vscode' module
|
// You can import and use all API from the 'vscode' module
|
||||||
// as well as import your extension to test it
|
// as well as import your extension to test it
|
||||||
import * as vscode from 'vscode'
|
import * as vscode from 'vscode'
|
||||||
|
|
||||||
// import * as myExtension from '../../extension';
|
// import * as myExtension from '../../extension';
|
||||||
|
|
||||||
suite('Extension Test Suite', () => {
|
suite('Extension Test Suite', () => {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
const Mocha = require('mocha')
|
const Mocha = require('mocha')
|
||||||
const { glob } = require('glob')
|
const { glob } = require('glob')
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||||
import * as vscode from 'vscode'
|
|
||||||
import { strict as nativeAssert } from 'assert'
|
import { strict as nativeAssert } from 'assert'
|
||||||
import { exec, type ExecOptions, spawnSync } from 'child_process'
|
import { type ExecOptions, exec, spawnSync } from 'child_process'
|
||||||
import { inspect } from 'util'
|
import { inspect } from 'util'
|
||||||
|
import * as vscode from 'vscode'
|
||||||
|
|
||||||
export interface Env {
|
export interface Env {
|
||||||
[name: string]: string
|
[name: string]: string
|
||||||
|
69
src/App.tsx
69
src/App.tsx
@ -1,36 +1,43 @@
|
|||||||
import { useEffect, useMemo, useRef } from 'react'
|
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 { LowerRightControls } from 'components/LowerRightControls'
|
|
||||||
import ModalContainer from 'react-modal-promise'
|
|
||||||
import useHotkeyWrapper from 'lib/hotkeyWrapper'
|
|
||||||
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 { 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 { rustContext } from 'lib/singletons'
|
|
||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
|
import { useHotkeys } from 'react-hotkeys-hook'
|
||||||
|
import ModalContainer from 'react-modal-promise'
|
||||||
|
import {
|
||||||
|
useLoaderData,
|
||||||
|
useNavigate,
|
||||||
|
useRouteLoaderData,
|
||||||
|
} from 'react-router-dom'
|
||||||
|
|
||||||
|
import { AppHeader } from '@src/components/AppHeader'
|
||||||
|
import { CameraProjectionToggle } from '@src/components/CameraProjectionToggle'
|
||||||
|
import { useEngineCommands } from '@src/components/EngineCommands'
|
||||||
|
import Gizmo from '@src/components/Gizmo'
|
||||||
|
import { LowerRightControls } from '@src/components/LowerRightControls'
|
||||||
|
import { useLspContext } from '@src/components/LspProvider'
|
||||||
|
import { ModelingSidebar } from '@src/components/ModelingSidebar/ModelingSidebar'
|
||||||
|
import { Stream } from '@src/components/Stream'
|
||||||
|
import { UnitsMenu } from '@src/components/UnitsMenu'
|
||||||
|
import { useAbsoluteFilePath } from '@src/hooks/useAbsoluteFilePath'
|
||||||
|
import { useCreateFileLinkQuery } from '@src/hooks/useCreateFileLinkQueryWatcher'
|
||||||
|
import { useEngineConnectionSubscriptions } from '@src/hooks/useEngineConnectionSubscriptions'
|
||||||
|
import { useHotKeyListener } from '@src/hooks/useHotKeyListener'
|
||||||
|
import { CoreDumpManager } from '@src/lib/coredump'
|
||||||
|
import { writeProjectThumbnailFile } from '@src/lib/desktop'
|
||||||
|
import useHotkeyWrapper from '@src/lib/hotkeyWrapper'
|
||||||
|
import { isDesktop } from '@src/lib/isDesktop'
|
||||||
|
import { PATHS } from '@src/lib/paths'
|
||||||
|
import { takeScreenshotOfVideoStreamCanvas } from '@src/lib/screenshot'
|
||||||
|
import {
|
||||||
|
codeManager,
|
||||||
|
engineCommandManager,
|
||||||
|
rustContext,
|
||||||
|
} from '@src/lib/singletons'
|
||||||
|
import { maybeWriteToDisk } from '@src/lib/telemetry'
|
||||||
|
import { type IndexLoaderData } from '@src/lib/types'
|
||||||
|
import { useSettings, useToken } from '@src/machines/appMachine'
|
||||||
|
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||||
|
import { onboardingPaths } from '@src/routes/Onboarding/paths'
|
||||||
|
|
||||||
maybeWriteToDisk()
|
maybeWriteToDisk()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { createContext, useContext, useState, ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
|
import { createContext, useContext, useState } from 'react'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useAuthState } from 'machines/appMachine'
|
import Loading from '@src/components/Loading'
|
||||||
import Loading from './components/Loading'
|
import { useAuthState } from '@src/machines/appMachine'
|
||||||
|
|
||||||
// Wrapper around protected routes, used in src/Router.tsx
|
// Wrapper around protected routes, used in src/Router.tsx
|
||||||
export const Auth = ({ children }: React.PropsWithChildren) => {
|
export const Auth = ({ children }: React.PropsWithChildren) => {
|
||||||
|
@ -1,46 +1,53 @@
|
|||||||
import { App } from './App'
|
import { useMemo } from 'react'
|
||||||
|
import toast from 'react-hot-toast'
|
||||||
import {
|
import {
|
||||||
|
Outlet,
|
||||||
|
RouterProvider,
|
||||||
createBrowserRouter,
|
createBrowserRouter,
|
||||||
createHashRouter,
|
createHashRouter,
|
||||||
Outlet,
|
|
||||||
redirect,
|
redirect,
|
||||||
RouterProvider,
|
|
||||||
} from 'react-router-dom'
|
} from 'react-router-dom'
|
||||||
import { ErrorPage } from './components/ErrorPage'
|
|
||||||
import { Settings } from './routes/Settings'
|
import { App } from '@src/App'
|
||||||
import { Telemetry } from './routes/Telemetry'
|
import { AppStateProvider } from '@src/AppState'
|
||||||
import Onboarding, { onboardingRoutes } from './routes/Onboarding'
|
import { Auth } from '@src/Auth'
|
||||||
import SignIn from './routes/SignIn'
|
import { CommandBar } from '@src/components/CommandBar/CommandBar'
|
||||||
import { Auth } from './Auth'
|
import DownloadAppBanner from '@src/components/DownloadAppBanner'
|
||||||
import { isDesktop } from './lib/isDesktop'
|
import { ErrorPage } from '@src/components/ErrorPage'
|
||||||
import Home from './routes/Home'
|
import FileMachineProvider from '@src/components/FileMachineProvider'
|
||||||
import { NetworkContext } from './hooks/useNetworkContext'
|
import LspProvider from '@src/components/LspProvider'
|
||||||
import { useNetworkStatus } from './hooks/useNetworkStatus'
|
import { MachineManagerProvider } from '@src/components/MachineManagerProvider'
|
||||||
import makeUrlPathRelative from './lib/makeUrlPathRelative'
|
import ModelingMachineProvider from '@src/components/ModelingMachineProvider'
|
||||||
import DownloadAppBanner from 'components/DownloadAppBanner'
|
import { OpenInDesktopAppHandler } from '@src/components/OpenInDesktopAppHandler'
|
||||||
import { WasmErrBanner } from 'components/WasmErrBanner'
|
import { ProjectsContextProvider } from '@src/components/ProjectsContextProvider'
|
||||||
import { CommandBar } from 'components/CommandBar/CommandBar'
|
import { RouteProvider } from '@src/components/RouteProvider'
|
||||||
import ModelingMachineProvider from 'components/ModelingMachineProvider'
|
import { WasmErrBanner } from '@src/components/WasmErrBanner'
|
||||||
import FileMachineProvider from 'components/FileMachineProvider'
|
import { NetworkContext } from '@src/hooks/useNetworkContext'
|
||||||
import { MachineManagerProvider } from 'components/MachineManagerProvider'
|
import { useNetworkStatus } from '@src/hooks/useNetworkStatus'
|
||||||
import { PATHS } from 'lib/paths'
|
import { KclContextProvider } from '@src/lang/KclProvider'
|
||||||
import { fileLoader, homeLoader, telemetryLoader } from 'lib/routeLoaders'
|
import { coreDump } from '@src/lang/wasm'
|
||||||
import LspProvider from 'components/LspProvider'
|
import {
|
||||||
import { KclContextProvider } from 'lang/KclProvider'
|
ASK_TO_OPEN_QUERY_PARAM,
|
||||||
import { ASK_TO_OPEN_QUERY_PARAM, BROWSER_PROJECT_NAME } from 'lib/constants'
|
BROWSER_PROJECT_NAME,
|
||||||
import { CoreDumpManager } from 'lib/coredump'
|
} from '@src/lib/constants'
|
||||||
import { codeManager, engineCommandManager } from 'lib/singletons'
|
import { CoreDumpManager } from '@src/lib/coredump'
|
||||||
import useHotkeyWrapper from 'lib/hotkeyWrapper'
|
import useHotkeyWrapper from '@src/lib/hotkeyWrapper'
|
||||||
import toast from 'react-hot-toast'
|
import { isDesktop } from '@src/lib/isDesktop'
|
||||||
import { coreDump } from 'lang/wasm'
|
import makeUrlPathRelative from '@src/lib/makeUrlPathRelative'
|
||||||
import { useMemo } from 'react'
|
import { PATHS } from '@src/lib/paths'
|
||||||
import { AppStateProvider } from 'AppState'
|
import { fileLoader, homeLoader, telemetryLoader } from '@src/lib/routeLoaders'
|
||||||
import { reportRejection } from 'lib/trap'
|
import {
|
||||||
import { RouteProvider } from 'components/RouteProvider'
|
codeManager,
|
||||||
import { ProjectsContextProvider } from 'components/ProjectsContextProvider'
|
engineCommandManager,
|
||||||
import { useToken } from 'machines/appMachine'
|
rustContext,
|
||||||
import { OpenInDesktopAppHandler } from 'components/OpenInDesktopAppHandler'
|
} from '@src/lib/singletons'
|
||||||
import { rustContext } from 'lib/singletons'
|
import { reportRejection } from '@src/lib/trap'
|
||||||
|
import { useToken } from '@src/machines/appMachine'
|
||||||
|
import Home from '@src/routes/Home'
|
||||||
|
import Onboarding, { onboardingRoutes } from '@src/routes/Onboarding'
|
||||||
|
import { Settings } from '@src/routes/Settings'
|
||||||
|
import SignIn from '@src/routes/SignIn'
|
||||||
|
import { Telemetry } from '@src/routes/Telemetry'
|
||||||
|
|
||||||
const createRouter = isDesktop() ? createHashRouter : createBrowserRouter
|
const createRouter = isDesktop() ? createHashRouter : createBrowserRouter
|
||||||
|
|
||||||
|
@ -1,28 +1,29 @@
|
|||||||
import { useRef, useMemo, memo, useCallback, useState } from 'react'
|
import { memo, useCallback, useMemo, useRef, 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 { ActionButtonDropdown } from 'components/ActionButtonDropdown'
|
|
||||||
import { useHotkeys } from 'react-hotkeys-hook'
|
import { useHotkeys } from 'react-hotkeys-hook'
|
||||||
import Tooltip from 'components/Tooltip'
|
|
||||||
import { useAppState } from 'AppState'
|
import { useAppState } from '@src/AppState'
|
||||||
import { CustomIcon } from 'components/CustomIcon'
|
import { ActionButton } from '@src/components/ActionButton'
|
||||||
import {
|
import { ActionButtonDropdown } from '@src/components/ActionButtonDropdown'
|
||||||
toolbarConfig,
|
import { CustomIcon } from '@src/components/CustomIcon'
|
||||||
|
import Tooltip from '@src/components/Tooltip'
|
||||||
|
import { useModelingContext } from '@src/hooks/useModelingContext'
|
||||||
|
import { useNetworkContext } from '@src/hooks/useNetworkContext'
|
||||||
|
import { NetworkHealthState } from '@src/hooks/useNetworkStatus'
|
||||||
|
import { useKclContext } from '@src/lang/KclProvider'
|
||||||
|
import { isCursorInFunctionDefinition } from '@src/lang/queryAst'
|
||||||
|
import { isCursorInSketchCommandRange } from '@src/lang/util'
|
||||||
|
import { isDesktop } from '@src/lib/isDesktop'
|
||||||
|
import { openExternalBrowserIfDesktop } from '@src/lib/openWindow'
|
||||||
|
import { editorManager, kclManager } from '@src/lib/singletons'
|
||||||
|
import type {
|
||||||
ToolbarItem,
|
ToolbarItem,
|
||||||
ToolbarItemCallbackProps,
|
ToolbarItemCallbackProps,
|
||||||
ToolbarItemResolved,
|
ToolbarItemResolved,
|
||||||
ToolbarModeName,
|
ToolbarModeName,
|
||||||
} from 'lib/toolbar'
|
} from '@src/lib/toolbar'
|
||||||
import { isDesktop } from 'lib/isDesktop'
|
import { toolbarConfig } from '@src/lib/toolbar'
|
||||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
import { isArray } from '@src/lib/utils'
|
||||||
import { isCursorInFunctionDefinition } from 'lang/queryAst'
|
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||||
import { commandBarActor } from 'machines/commandBarMachine'
|
|
||||||
import { isArray } from 'lib/utils'
|
|
||||||
|
|
||||||
export function Toolbar({
|
export function Toolbar({
|
||||||
className = '',
|
className = '',
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { cameraMouseDragGuards, MouseGuard } from 'lib/cameraControls'
|
import type { CameraDragInteractionType_type } from '@kittycad/lib/dist/types/src/models'
|
||||||
|
import * as TWEEN from '@tweenjs/tween.js'
|
||||||
import {
|
import {
|
||||||
Euler,
|
Euler,
|
||||||
MathUtils,
|
MathUtils,
|
||||||
@ -10,26 +11,34 @@ import {
|
|||||||
Vector2,
|
Vector2,
|
||||||
Vector3,
|
Vector3,
|
||||||
} from 'three'
|
} from 'three'
|
||||||
|
|
||||||
|
import type { CameraProjectionType } from '@rust/kcl-lib/bindings/CameraProjectionType'
|
||||||
|
|
||||||
|
import { isQuaternionVertical } from '@src/clientSideScene/helpers'
|
||||||
import {
|
import {
|
||||||
DEBUG_SHOW_INTERSECTION_PLANE,
|
DEBUG_SHOW_INTERSECTION_PLANE,
|
||||||
INTERSECTION_PLANE_LAYER,
|
INTERSECTION_PLANE_LAYER,
|
||||||
SKETCH_LAYER,
|
SKETCH_LAYER,
|
||||||
ZOOM_MAGIC_NUMBER,
|
ZOOM_MAGIC_NUMBER,
|
||||||
} from './sceneInfra'
|
} from '@src/clientSideScene/sceneInfra'
|
||||||
import {
|
import type { EngineCommand } from '@src/lang/std/artifactGraph'
|
||||||
Subscription,
|
import type {
|
||||||
EngineCommandManager,
|
EngineCommandManager,
|
||||||
|
Subscription,
|
||||||
UnreliableSubscription,
|
UnreliableSubscription,
|
||||||
} from 'lang/std/engineConnection'
|
} from '@src/lang/std/engineConnection'
|
||||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
import type { MouseGuard } from '@src/lib/cameraControls'
|
||||||
import { toSync, uuidv4, getNormalisedCoordinates } from 'lib/utils'
|
import { cameraMouseDragGuards } from '@src/lib/cameraControls'
|
||||||
import { deg2Rad } from 'lib/utils2d'
|
import { reportRejection } from '@src/lib/trap'
|
||||||
import { isReducedMotion, roundOff, throttle } from 'lib/utils'
|
import {
|
||||||
import * as TWEEN from '@tweenjs/tween.js'
|
getNormalisedCoordinates,
|
||||||
import { isQuaternionVertical } from './helpers'
|
isReducedMotion,
|
||||||
import { reportRejection } from 'lib/trap'
|
roundOff,
|
||||||
import { CameraProjectionType } from '@rust/kcl-lib/bindings/CameraProjectionType'
|
throttle,
|
||||||
import { CameraDragInteractionType_type } from '@kittycad/lib/dist/types/src/models'
|
toSync,
|
||||||
|
uuidv4,
|
||||||
|
} from '@src/lib/utils'
|
||||||
|
import { deg2Rad } from '@src/lib/utils2d'
|
||||||
|
|
||||||
const ORTHOGRAPHIC_CAMERA_SIZE = 20
|
const ORTHOGRAPHIC_CAMERA_SIZE = 20
|
||||||
const FRAMES_TO_ANIMATE_IN = 30
|
const FRAMES_TO_ANIMATE_IN = 30
|
||||||
|
@ -1,54 +1,60 @@
|
|||||||
import { useRef, useEffect, useState, useMemo, Fragment } from 'react'
|
import { Dialog, Popover, Transition } from '@headlessui/react'
|
||||||
import { useModelingContext } from 'hooks/useModelingContext'
|
import { Fragment, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
|
import toast from 'react-hot-toast'
|
||||||
|
import type { InstanceProps } from 'react-modal-promise'
|
||||||
|
import { create } from 'react-modal-promise'
|
||||||
|
|
||||||
import { cameraMouseDragGuards } from 'lib/cameraControls'
|
import type { Node } from '@rust/kcl-lib/bindings/Node'
|
||||||
import { ARROWHEAD, DEBUG_SHOW_BOTH_SCENES } from './sceneInfra'
|
|
||||||
import { ReactCameraProperties } from './CameraControls'
|
import type { ReactCameraProperties } from '@src/clientSideScene/CameraControls'
|
||||||
import { throttle, toSync } from 'lib/utils'
|
|
||||||
import {
|
|
||||||
sceneInfra,
|
|
||||||
kclManager,
|
|
||||||
codeManager,
|
|
||||||
editorManager,
|
|
||||||
sceneEntitiesManager,
|
|
||||||
engineCommandManager,
|
|
||||||
rustContext,
|
|
||||||
} from 'lib/singletons'
|
|
||||||
import {
|
import {
|
||||||
EXTRA_SEGMENT_HANDLE,
|
EXTRA_SEGMENT_HANDLE,
|
||||||
PROFILE_START,
|
PROFILE_START,
|
||||||
getParentGroup,
|
getParentGroup,
|
||||||
} from './sceneEntities'
|
} from '@src/clientSideScene/sceneConstants'
|
||||||
import { SegmentOverlay, SketchDetails } from 'machines/modelingMachine'
|
|
||||||
import { findUsesOfTagInPipe, getNodeFromPath } from 'lang/queryAst'
|
|
||||||
import {
|
import {
|
||||||
CallExpression,
|
ARROWHEAD,
|
||||||
CallExpressionKw,
|
DEBUG_SHOW_BOTH_SCENES,
|
||||||
PathToNode,
|
} from '@src/clientSideScene/sceneInfra'
|
||||||
Program,
|
import { ActionButton } from '@src/components/ActionButton'
|
||||||
Expr,
|
import type { CustomIconName } from '@src/components/CustomIcon'
|
||||||
parse,
|
import { CustomIcon } from '@src/components/CustomIcon'
|
||||||
recast,
|
import { useModelingContext } from '@src/hooks/useModelingContext'
|
||||||
defaultSourceRange,
|
import { executeAstMock } from '@src/lang/langHelpers'
|
||||||
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 {
|
import {
|
||||||
deleteSegmentFromPipeExpression,
|
deleteSegmentFromPipeExpression,
|
||||||
removeSingleConstraintInfo,
|
removeSingleConstraintInfo,
|
||||||
} from 'lang/modifyAst'
|
} from '@src/lang/modifyAst'
|
||||||
import { ActionButton } from 'components/ActionButton'
|
import { findUsesOfTagInPipe, getNodeFromPath } from '@src/lang/queryAst'
|
||||||
import { err, reportRejection, trap } from 'lib/trap'
|
import { getConstraintInfo, getConstraintInfoKw } from '@src/lang/std/sketch'
|
||||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
import type { ConstrainInfo } from '@src/lang/std/stdTypes'
|
||||||
import { commandBarActor } from 'machines/commandBarMachine'
|
import { topLevelRange } from '@src/lang/util'
|
||||||
import { useSettings } from 'machines/appMachine'
|
import type {
|
||||||
|
CallExpression,
|
||||||
|
CallExpressionKw,
|
||||||
|
Expr,
|
||||||
|
PathToNode,
|
||||||
|
Program,
|
||||||
|
} from '@src/lang/wasm'
|
||||||
|
import { defaultSourceRange, parse, recast, resultIsOk } from '@src/lang/wasm'
|
||||||
|
import { cameraMouseDragGuards } from '@src/lib/cameraControls'
|
||||||
|
import {
|
||||||
|
codeManager,
|
||||||
|
editorManager,
|
||||||
|
engineCommandManager,
|
||||||
|
kclManager,
|
||||||
|
rustContext,
|
||||||
|
sceneEntitiesManager,
|
||||||
|
sceneInfra,
|
||||||
|
} from '@src/lib/singletons'
|
||||||
|
import { err, reportRejection, trap } from '@src/lib/trap'
|
||||||
|
import { throttle, toSync } from '@src/lib/utils'
|
||||||
|
import type { useSettings } from '@src/machines/appMachine'
|
||||||
|
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||||
|
import type {
|
||||||
|
SegmentOverlay,
|
||||||
|
SketchDetails,
|
||||||
|
} from '@src/machines/modelingMachine'
|
||||||
|
|
||||||
function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } {
|
function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } {
|
||||||
const [isCamMoving, setIsCamMoving] = useState(false)
|
const [isCamMoving, setIsCamMoving] = useState(false)
|
||||||
@ -635,8 +641,8 @@ const ConstraintSymbol = ({
|
|||||||
implicitDesc
|
implicitDesc
|
||||||
? 'bg-chalkboard-10 dark:bg-chalkboard-100 border-transparent border-0 rounded'
|
? 'bg-chalkboard-10 dark:bg-chalkboard-100 border-transparent border-0 rounded'
|
||||||
: isConstrained
|
: isConstrained
|
||||||
? 'bg-chalkboard-10 dark:bg-chalkboard-90 dark:hover:bg-chalkboard-80 border-chalkboard-40 dark:border-chalkboard-70 rounded-sm'
|
? '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-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`}
|
} h-[26px] w-[26px] rounded-sm relative m-0 p-0`}
|
||||||
onMouseEnter={() => {
|
onMouseEnter={() => {
|
||||||
editorManager.setHighlightRange([range])
|
editorManager.setHighlightRange([range])
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Quaternion } from 'three'
|
import { Quaternion } from 'three'
|
||||||
import { isQuaternionVertical } from './helpers'
|
|
||||||
|
import { isQuaternionVertical } from '@src/clientSideScene/helpers'
|
||||||
|
|
||||||
describe('isQuaternionVertical', () => {
|
describe('isQuaternionVertical', () => {
|
||||||
it('should identify vertical quaternions', () => {
|
it('should identify vertical quaternions', () => {
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
import { compareVec2Epsilon2 } from 'lang/std/sketch'
|
import type { Group, Mesh, OrthographicCamera, Quaternion } from 'three'
|
||||||
import {
|
import {
|
||||||
GridHelper,
|
GridHelper,
|
||||||
LineBasicMaterial,
|
LineBasicMaterial,
|
||||||
OrthographicCamera,
|
|
||||||
PerspectiveCamera,
|
PerspectiveCamera,
|
||||||
Group,
|
|
||||||
Mesh,
|
|
||||||
Quaternion,
|
|
||||||
Vector3,
|
Vector3,
|
||||||
} from 'three'
|
} from 'three'
|
||||||
|
|
||||||
|
import { compareVec2Epsilon2 } from '@src/lang/std/sketch'
|
||||||
|
|
||||||
export function createGridHelper({
|
export function createGridHelper({
|
||||||
size,
|
size,
|
||||||
divisions,
|
divisions,
|
||||||
|
76
src/clientSideScene/sceneConstants.ts
Normal file
76
src/clientSideScene/sceneConstants.ts
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
// Constants shared between sceneEntities.ts and segments.ts
|
||||||
|
// This file helps break circular dependencies
|
||||||
|
import type { Group } from 'three'
|
||||||
|
|
||||||
|
// Segment types
|
||||||
|
export const ARC_SEGMENT = 'arc-segment'
|
||||||
|
export const ARC_SEGMENT_BODY = 'arc-segment-body'
|
||||||
|
export const ARC_SEGMENT_DASH = 'arc-segment-dash'
|
||||||
|
export const STRAIGHT_SEGMENT = 'straight-segment'
|
||||||
|
export const STRAIGHT_SEGMENT_BODY = 'straight-segment-body'
|
||||||
|
export const STRAIGHT_SEGMENT_DASH = 'straight-segment-body-dashed'
|
||||||
|
export const CIRCLE_SEGMENT = 'circle-segment'
|
||||||
|
export const CIRCLE_SEGMENT_BODY = 'circle-segment-body'
|
||||||
|
export const CIRCLE_SEGMENT_DASH = 'circle-segment-body-dashed'
|
||||||
|
export const TANGENTIAL_ARC_TO_SEGMENT = 'tangential-arc-to-segment'
|
||||||
|
export const TANGENTIAL_ARC_TO_SEGMENT_BODY = 'tangential-arc-to-segment-body'
|
||||||
|
export const TANGENTIAL_ARC_TO__SEGMENT_DASH =
|
||||||
|
'tangential-arc-to-segment-body-dashed'
|
||||||
|
export const THREE_POINT_ARC_SEGMENT = 'three-point-arc-segment'
|
||||||
|
export const THREE_POINT_ARC_SEGMENT_BODY = 'three-point-arc-segment-body'
|
||||||
|
export const THREE_POINT_ARC_SEGMENT_DASH = 'three-point-arc-segment-dash'
|
||||||
|
export const CIRCLE_THREE_POINT_SEGMENT = 'circle-three-point-segment'
|
||||||
|
export const CIRCLE_THREE_POINT_SEGMENT_BODY = 'circle-segment-body'
|
||||||
|
export const CIRCLE_THREE_POINT_SEGMENT_DASH =
|
||||||
|
'circle-three-point-segment-body-dashed'
|
||||||
|
|
||||||
|
// Handle names
|
||||||
|
export const ARC_ANGLE_END = 'arc-angle-end'
|
||||||
|
export const ARC_ANGLE_REFERENCE_LINE = 'arc-angle-reference-line'
|
||||||
|
export const ARC_CENTER_TO_FROM = 'arc-center-to-from'
|
||||||
|
export const ARC_CENTER_TO_TO = 'arc-center-to-to'
|
||||||
|
export const CIRCLE_CENTER_HANDLE = 'circle-center-handle'
|
||||||
|
export const CIRCLE_THREE_POINT_HANDLE1 = 'circle-three-point-handle1'
|
||||||
|
export const CIRCLE_THREE_POINT_HANDLE2 = 'circle-three-point-handle2'
|
||||||
|
export const CIRCLE_THREE_POINT_HANDLE3 = 'circle-three-point-handle3'
|
||||||
|
export const THREE_POINT_ARC_HANDLE2 = 'three-point-arc-handle2'
|
||||||
|
export const THREE_POINT_ARC_HANDLE3 = 'three-point-arc-handle3'
|
||||||
|
export const EXTRA_SEGMENT_HANDLE = 'extraSegmentHandle'
|
||||||
|
export const PROFILE_START = 'profile-start'
|
||||||
|
|
||||||
|
// Additional types
|
||||||
|
export const DRAFT_DASHED_LINE = 'draft-dashed-line'
|
||||||
|
|
||||||
|
// Measurements
|
||||||
|
export const EXTRA_SEGMENT_OFFSET_PX = 8
|
||||||
|
export const SEGMENT_WIDTH_PX = 1.6
|
||||||
|
export const HIDE_SEGMENT_LENGTH = 75
|
||||||
|
export const HIDE_HOVER_SEGMENT_LENGTH = 60
|
||||||
|
|
||||||
|
// Segment groups
|
||||||
|
export const SEGMENT_BODIES = [
|
||||||
|
STRAIGHT_SEGMENT,
|
||||||
|
TANGENTIAL_ARC_TO_SEGMENT,
|
||||||
|
CIRCLE_SEGMENT,
|
||||||
|
CIRCLE_THREE_POINT_SEGMENT,
|
||||||
|
ARC_SEGMENT,
|
||||||
|
THREE_POINT_ARC_SEGMENT,
|
||||||
|
]
|
||||||
|
|
||||||
|
export const SEGMENT_BODIES_PLUS_PROFILE_START = [
|
||||||
|
...SEGMENT_BODIES,
|
||||||
|
PROFILE_START,
|
||||||
|
]
|
||||||
|
|
||||||
|
// Helper functions
|
||||||
|
export function getParentGroup(
|
||||||
|
object: any,
|
||||||
|
stopAt: string[] = SEGMENT_BODIES
|
||||||
|
): Group | null {
|
||||||
|
if (stopAt.includes(object?.userData?.type)) {
|
||||||
|
return object
|
||||||
|
} else if (object?.parent) {
|
||||||
|
return getParentGroup(object.parent, stopAt)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,13 @@
|
|||||||
|
import * as TWEEN from '@tweenjs/tween.js'
|
||||||
|
import type {
|
||||||
|
Group,
|
||||||
|
Intersection,
|
||||||
|
Mesh,
|
||||||
|
MeshBasicMaterial,
|
||||||
|
Object3D,
|
||||||
|
Object3DEventMap,
|
||||||
|
Texture,
|
||||||
|
} from 'three'
|
||||||
import {
|
import {
|
||||||
AmbientLight,
|
AmbientLight,
|
||||||
Color,
|
Color,
|
||||||
@ -5,32 +15,29 @@ import {
|
|||||||
LineBasicMaterial,
|
LineBasicMaterial,
|
||||||
OrthographicCamera,
|
OrthographicCamera,
|
||||||
PerspectiveCamera,
|
PerspectiveCamera,
|
||||||
|
Raycaster,
|
||||||
Scene,
|
Scene,
|
||||||
|
TextureLoader,
|
||||||
|
Vector2,
|
||||||
Vector3,
|
Vector3,
|
||||||
WebGLRenderer,
|
WebGLRenderer,
|
||||||
Raycaster,
|
|
||||||
Vector2,
|
|
||||||
Group,
|
|
||||||
MeshBasicMaterial,
|
|
||||||
Mesh,
|
|
||||||
Intersection,
|
|
||||||
Object3D,
|
|
||||||
Object3DEventMap,
|
|
||||||
TextureLoader,
|
|
||||||
Texture,
|
|
||||||
} from 'three'
|
} from 'three'
|
||||||
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 { CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||||
import { orthoScale, perspScale } from './helpers'
|
|
||||||
|
import { CameraControls } from '@src/clientSideScene/CameraControls'
|
||||||
|
import { orthoScale, perspScale } from '@src/clientSideScene/helpers'
|
||||||
|
import type { useModelingContext } from '@src/hooks/useModelingContext'
|
||||||
|
import type { EngineCommandManager } from '@src/lang/std/engineConnection'
|
||||||
|
import type { Coords2d } from '@src/lang/std/sketch'
|
||||||
|
import { compareVec2Epsilon2 } from '@src/lang/std/sketch'
|
||||||
|
import type { Axis, NonCodeSelection } from '@src/lib/selections'
|
||||||
|
import { type BaseUnit } from '@src/lib/settings/settingsTypes'
|
||||||
|
import { Themes } from '@src/lib/theme'
|
||||||
|
import { getAngle, throttle } from '@src/lib/utils'
|
||||||
|
import type {
|
||||||
|
MouseState,
|
||||||
|
SegmentOverlayPayload,
|
||||||
|
} from '@src/machines/modelingMachine'
|
||||||
|
|
||||||
type SendType = ReturnType<typeof useModelingContext>['send']
|
type SendType = ReturnType<typeof useModelingContext>['send']
|
||||||
|
|
||||||
|
0
src/clientSideScene/sceneUtils.ts
Normal file
0
src/clientSideScene/sceneUtils.ts
Normal file
@ -1,4 +1,4 @@
|
|||||||
import { Coords2d } from 'lang/std/sketch'
|
import type { NormalBufferAttributes, Texture } from 'three'
|
||||||
import {
|
import {
|
||||||
BoxGeometry,
|
BoxGeometry,
|
||||||
BufferGeometry,
|
BufferGeometry,
|
||||||
@ -8,25 +8,33 @@ import {
|
|||||||
EllipseCurve,
|
EllipseCurve,
|
||||||
ExtrudeGeometry,
|
ExtrudeGeometry,
|
||||||
Group,
|
Group,
|
||||||
LineCurve3,
|
|
||||||
LineBasicMaterial,
|
|
||||||
LineDashedMaterial,
|
|
||||||
Line,
|
Line,
|
||||||
|
LineBasicMaterial,
|
||||||
|
LineCurve3,
|
||||||
|
LineDashedMaterial,
|
||||||
Mesh,
|
Mesh,
|
||||||
MeshBasicMaterial,
|
MeshBasicMaterial,
|
||||||
NormalBufferAttributes,
|
|
||||||
Points,
|
Points,
|
||||||
PointsMaterial,
|
PointsMaterial,
|
||||||
Shape,
|
Shape,
|
||||||
SphereGeometry,
|
SphereGeometry,
|
||||||
Texture,
|
|
||||||
Vector2,
|
Vector2,
|
||||||
Vector3,
|
Vector3,
|
||||||
} from 'three'
|
} from 'three'
|
||||||
import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js'
|
|
||||||
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||||
import { PathToNode, Sketch, getTangentialArcToInfo } from 'lang/wasm'
|
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 type { Sketch } from '@rust/kcl-lib/bindings/Sketch'
|
||||||
import {
|
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_CENTER_HANDLE,
|
||||||
CIRCLE_SEGMENT,
|
CIRCLE_SEGMENT,
|
||||||
CIRCLE_SEGMENT_BODY,
|
CIRCLE_SEGMENT_BODY,
|
||||||
@ -49,42 +57,37 @@ import {
|
|||||||
TANGENTIAL_ARC_TO_SEGMENT,
|
TANGENTIAL_ARC_TO_SEGMENT,
|
||||||
TANGENTIAL_ARC_TO_SEGMENT_BODY,
|
TANGENTIAL_ARC_TO_SEGMENT_BODY,
|
||||||
TANGENTIAL_ARC_TO__SEGMENT_DASH,
|
TANGENTIAL_ARC_TO__SEGMENT_DASH,
|
||||||
ARC_SEGMENT,
|
THREE_POINT_ARC_HANDLE2,
|
||||||
ARC_SEGMENT_BODY,
|
THREE_POINT_ARC_HANDLE3,
|
||||||
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,
|
||||||
THREE_POINT_ARC_SEGMENT_BODY,
|
THREE_POINT_ARC_SEGMENT_BODY,
|
||||||
THREE_POINT_ARC_SEGMENT_DASH,
|
THREE_POINT_ARC_SEGMENT_DASH,
|
||||||
THREE_POINT_ARC_HANDLE2,
|
getParentGroup,
|
||||||
THREE_POINT_ARC_HANDLE3,
|
} from '@src/clientSideScene/sceneConstants'
|
||||||
} from './sceneEntities'
|
import type { SceneInfra } from '@src/clientSideScene/sceneInfra'
|
||||||
import { getTangentPointFromPreviousArc } from 'lib/utils2d'
|
|
||||||
import {
|
import {
|
||||||
ARROWHEAD,
|
ARROWHEAD,
|
||||||
DRAFT_POINT,
|
DRAFT_POINT,
|
||||||
SceneInfra,
|
|
||||||
SEGMENT_LENGTH_LABEL,
|
SEGMENT_LENGTH_LABEL,
|
||||||
SEGMENT_LENGTH_LABEL_OFFSET_PX,
|
SEGMENT_LENGTH_LABEL_OFFSET_PX,
|
||||||
SEGMENT_LENGTH_LABEL_TEXT,
|
SEGMENT_LENGTH_LABEL_TEXT,
|
||||||
} from './sceneInfra'
|
} from '@src/clientSideScene/sceneInfra'
|
||||||
import { Themes, getThemeColorForThreeJs } from 'lib/theme'
|
import type { Coords2d } from '@src/lang/std/sketch'
|
||||||
import { isClockwise, normaliseAngle, roundOff } from 'lib/utils'
|
import type { SegmentInputs } from '@src/lang/std/stdTypes'
|
||||||
import {
|
import type { PathToNode } from '@src/lang/wasm'
|
||||||
|
import { getTangentialArcToInfo } from '@src/lang/wasm'
|
||||||
|
import type { Selections } from '@src/lib/selections'
|
||||||
|
import type { Themes } from '@src/lib/theme'
|
||||||
|
import { getThemeColorForThreeJs } from '@src/lib/theme'
|
||||||
|
import { err } from '@src/lib/trap'
|
||||||
|
import { isClockwise, normaliseAngle, roundOff } from '@src/lib/utils'
|
||||||
|
import { getTangentPointFromPreviousArc } from '@src/lib/utils2d'
|
||||||
|
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||||
|
import type {
|
||||||
SegmentOverlay,
|
SegmentOverlay,
|
||||||
SegmentOverlayPayload,
|
SegmentOverlayPayload,
|
||||||
SegmentOverlays,
|
SegmentOverlays,
|
||||||
} from 'machines/modelingMachine'
|
} from '@src/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
|
const ANGLE_INDICATOR_RADIUS = 30 // in px
|
||||||
interface CreateSegmentArgs {
|
interface CreateSegmentArgs {
|
||||||
@ -205,6 +208,7 @@ class StraightSegment implements SegmentUtils {
|
|||||||
from,
|
from,
|
||||||
to,
|
to,
|
||||||
scale,
|
scale,
|
||||||
|
sceneInfra,
|
||||||
})
|
})
|
||||||
segmentGroup.add(arrowGroup)
|
segmentGroup.add(arrowGroup)
|
||||||
segmentGroup.add(lengthIndicatorGroup)
|
segmentGroup.add(lengthIndicatorGroup)
|
||||||
@ -572,6 +576,7 @@ class CircleSegment implements SegmentUtils {
|
|||||||
from: center,
|
from: center,
|
||||||
to: [center[0] + radius, center[1]],
|
to: [center[0] + radius, center[1]],
|
||||||
scale,
|
scale,
|
||||||
|
sceneInfra,
|
||||||
})
|
})
|
||||||
|
|
||||||
arcMesh.userData.type = meshType
|
arcMesh.userData.type = meshType
|
||||||
@ -1002,6 +1007,7 @@ class ArcSegment implements SegmentUtils {
|
|||||||
from: center,
|
from: center,
|
||||||
to: from,
|
to: from,
|
||||||
scale,
|
scale,
|
||||||
|
sceneInfra,
|
||||||
})
|
})
|
||||||
|
|
||||||
const grey = 0xaaaaaa
|
const grey = 0xaaaaaa
|
||||||
@ -1059,6 +1065,7 @@ class ArcSegment implements SegmentUtils {
|
|||||||
center[1] + Math.sin(endAngle) * radius,
|
center[1] + Math.sin(endAngle) * radius,
|
||||||
],
|
],
|
||||||
scale,
|
scale,
|
||||||
|
sceneInfra,
|
||||||
})
|
})
|
||||||
endAngleLengthIndicator.name = 'endAngleLengthIndicator'
|
endAngleLengthIndicator.name = 'endAngleLengthIndicator'
|
||||||
|
|
||||||
@ -1679,11 +1686,13 @@ function createLengthIndicator({
|
|||||||
to,
|
to,
|
||||||
scale,
|
scale,
|
||||||
length = 0.1,
|
length = 0.1,
|
||||||
|
sceneInfra,
|
||||||
}: {
|
}: {
|
||||||
from: Coords2d
|
from: Coords2d
|
||||||
to: Coords2d
|
to: Coords2d
|
||||||
scale: number
|
scale: number
|
||||||
length?: number
|
length?: number
|
||||||
|
sceneInfra: SceneInfra
|
||||||
}) {
|
}) {
|
||||||
const lengthIndicatorGroup = new Group()
|
const lengthIndicatorGroup = new Group()
|
||||||
lengthIndicatorGroup.name = SEGMENT_LENGTH_LABEL
|
lengthIndicatorGroup.name = SEGMENT_LENGTH_LABEL
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { getPathOrUrlFromArgs, parseCLIArgs } from 'commandLineArgs'
|
import { getPathOrUrlFromArgs, parseCLIArgs } from '@src/commandLineArgs'
|
||||||
|
|
||||||
const linuxDeepLinkArgv = [
|
const linuxDeepLinkArgv = [
|
||||||
'/tmp/.mount_Zoo Movq3t0x/zoo-modeling-app',
|
'/tmp/.mount_Zoo Movq3t0x/zoo-modeling-app',
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { render, screen } from '@testing-library/react'
|
import { render, screen } from '@testing-library/react'
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
import { ActionButton } from './ActionButton'
|
|
||||||
|
import { ActionButton } from '@src/components/ActionButton'
|
||||||
|
|
||||||
describe('ActionButton tests', () => {
|
describe('ActionButton tests', () => {
|
||||||
it('ActionButton with no iconStart or iconEnd should have even left and right padding', () => {
|
it('ActionButton with no iconStart or iconEnd should have even left and right padding', () => {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user