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:
69
src/App.tsx
69
src/App.tsx
@ -1,36 +1,43 @@
|
||||
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 { 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()
|
||||
.then(() => {})
|
||||
.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 './components/Loading'
|
||||
import Loading from '@src/components/Loading'
|
||||
import { useAuthState } from '@src/machines/appMachine'
|
||||
|
||||
// Wrapper around protected routes, used in src/Router.tsx
|
||||
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 {
|
||||
Outlet,
|
||||
RouterProvider,
|
||||
createBrowserRouter,
|
||||
createHashRouter,
|
||||
Outlet,
|
||||
redirect,
|
||||
RouterProvider,
|
||||
} from 'react-router-dom'
|
||||
import { ErrorPage } from './components/ErrorPage'
|
||||
import { Settings } from './routes/Settings'
|
||||
import { Telemetry } from './routes/Telemetry'
|
||||
import Onboarding, { onboardingRoutes } from './routes/Onboarding'
|
||||
import SignIn from './routes/SignIn'
|
||||
import { Auth } from './Auth'
|
||||
import { isDesktop } from './lib/isDesktop'
|
||||
import Home from './routes/Home'
|
||||
import { NetworkContext } from './hooks/useNetworkContext'
|
||||
import { useNetworkStatus } from './hooks/useNetworkStatus'
|
||||
import makeUrlPathRelative from './lib/makeUrlPathRelative'
|
||||
import DownloadAppBanner from 'components/DownloadAppBanner'
|
||||
import { WasmErrBanner } from 'components/WasmErrBanner'
|
||||
import { CommandBar } from 'components/CommandBar/CommandBar'
|
||||
import ModelingMachineProvider from 'components/ModelingMachineProvider'
|
||||
import FileMachineProvider from 'components/FileMachineProvider'
|
||||
import { MachineManagerProvider } from 'components/MachineManagerProvider'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { fileLoader, homeLoader, telemetryLoader } from 'lib/routeLoaders'
|
||||
import LspProvider from 'components/LspProvider'
|
||||
import { KclContextProvider } from 'lang/KclProvider'
|
||||
import { ASK_TO_OPEN_QUERY_PARAM, BROWSER_PROJECT_NAME } from 'lib/constants'
|
||||
import { CoreDumpManager } from 'lib/coredump'
|
||||
import { codeManager, engineCommandManager } from 'lib/singletons'
|
||||
import useHotkeyWrapper from 'lib/hotkeyWrapper'
|
||||
import toast from 'react-hot-toast'
|
||||
import { coreDump } from 'lang/wasm'
|
||||
import { useMemo } from 'react'
|
||||
import { AppStateProvider } from 'AppState'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { RouteProvider } from 'components/RouteProvider'
|
||||
import { ProjectsContextProvider } from 'components/ProjectsContextProvider'
|
||||
import { useToken } from 'machines/appMachine'
|
||||
import { OpenInDesktopAppHandler } from 'components/OpenInDesktopAppHandler'
|
||||
import { rustContext } from 'lib/singletons'
|
||||
|
||||
import { App } from '@src/App'
|
||||
import { AppStateProvider } from '@src/AppState'
|
||||
import { Auth } from '@src/Auth'
|
||||
import { CommandBar } from '@src/components/CommandBar/CommandBar'
|
||||
import DownloadAppBanner from '@src/components/DownloadAppBanner'
|
||||
import { ErrorPage } from '@src/components/ErrorPage'
|
||||
import FileMachineProvider from '@src/components/FileMachineProvider'
|
||||
import LspProvider from '@src/components/LspProvider'
|
||||
import { MachineManagerProvider } from '@src/components/MachineManagerProvider'
|
||||
import ModelingMachineProvider from '@src/components/ModelingMachineProvider'
|
||||
import { OpenInDesktopAppHandler } from '@src/components/OpenInDesktopAppHandler'
|
||||
import { ProjectsContextProvider } from '@src/components/ProjectsContextProvider'
|
||||
import { RouteProvider } from '@src/components/RouteProvider'
|
||||
import { WasmErrBanner } from '@src/components/WasmErrBanner'
|
||||
import { NetworkContext } from '@src/hooks/useNetworkContext'
|
||||
import { useNetworkStatus } from '@src/hooks/useNetworkStatus'
|
||||
import { KclContextProvider } from '@src/lang/KclProvider'
|
||||
import { coreDump } from '@src/lang/wasm'
|
||||
import {
|
||||
ASK_TO_OPEN_QUERY_PARAM,
|
||||
BROWSER_PROJECT_NAME,
|
||||
} from '@src/lib/constants'
|
||||
import { CoreDumpManager } from '@src/lib/coredump'
|
||||
import useHotkeyWrapper from '@src/lib/hotkeyWrapper'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import makeUrlPathRelative from '@src/lib/makeUrlPathRelative'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import { fileLoader, homeLoader, telemetryLoader } from '@src/lib/routeLoaders'
|
||||
import {
|
||||
codeManager,
|
||||
engineCommandManager,
|
||||
rustContext,
|
||||
} from '@src/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
|
||||
|
||||
|
@ -1,28 +1,29 @@
|
||||
import { useRef, useMemo, memo, useCallback, useState } from 'react'
|
||||
import { isCursorInSketchCommandRange } from 'lang/util'
|
||||
import { editorManager, kclManager } from 'lib/singletons'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { useNetworkContext } from 'hooks/useNetworkContext'
|
||||
import { NetworkHealthState } from 'hooks/useNetworkStatus'
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import { ActionButtonDropdown } from 'components/ActionButtonDropdown'
|
||||
import { memo, useCallback, useMemo, useRef, useState } from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { useAppState } from 'AppState'
|
||||
import { CustomIcon } from 'components/CustomIcon'
|
||||
import {
|
||||
toolbarConfig,
|
||||
|
||||
import { useAppState } from '@src/AppState'
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { ActionButtonDropdown } from '@src/components/ActionButtonDropdown'
|
||||
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,
|
||||
ToolbarItemCallbackProps,
|
||||
ToolbarItemResolved,
|
||||
ToolbarModeName,
|
||||
} from 'lib/toolbar'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||
import { isCursorInFunctionDefinition } from 'lang/queryAst'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { isArray } from 'lib/utils'
|
||||
} from '@src/lib/toolbar'
|
||||
import { toolbarConfig } from '@src/lib/toolbar'
|
||||
import { isArray } from '@src/lib/utils'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
|
||||
export function Toolbar({
|
||||
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 {
|
||||
Euler,
|
||||
MathUtils,
|
||||
@ -10,26 +11,34 @@ import {
|
||||
Vector2,
|
||||
Vector3,
|
||||
} from 'three'
|
||||
|
||||
import type { CameraProjectionType } from '@rust/kcl-lib/bindings/CameraProjectionType'
|
||||
|
||||
import { isQuaternionVertical } from '@src/clientSideScene/helpers'
|
||||
import {
|
||||
DEBUG_SHOW_INTERSECTION_PLANE,
|
||||
INTERSECTION_PLANE_LAYER,
|
||||
SKETCH_LAYER,
|
||||
ZOOM_MAGIC_NUMBER,
|
||||
} from './sceneInfra'
|
||||
import {
|
||||
Subscription,
|
||||
} from '@src/clientSideScene/sceneInfra'
|
||||
import type { EngineCommand } from '@src/lang/std/artifactGraph'
|
||||
import type {
|
||||
EngineCommandManager,
|
||||
Subscription,
|
||||
UnreliableSubscription,
|
||||
} from 'lang/std/engineConnection'
|
||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||
import { toSync, uuidv4, getNormalisedCoordinates } from 'lib/utils'
|
||||
import { deg2Rad } from 'lib/utils2d'
|
||||
import { isReducedMotion, roundOff, throttle } from 'lib/utils'
|
||||
import * as TWEEN from '@tweenjs/tween.js'
|
||||
import { isQuaternionVertical } from './helpers'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { CameraProjectionType } from '@rust/kcl-lib/bindings/CameraProjectionType'
|
||||
import { CameraDragInteractionType_type } from '@kittycad/lib/dist/types/src/models'
|
||||
} from '@src/lang/std/engineConnection'
|
||||
import type { MouseGuard } from '@src/lib/cameraControls'
|
||||
import { cameraMouseDragGuards } from '@src/lib/cameraControls'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import {
|
||||
getNormalisedCoordinates,
|
||||
isReducedMotion,
|
||||
roundOff,
|
||||
throttle,
|
||||
toSync,
|
||||
uuidv4,
|
||||
} from '@src/lib/utils'
|
||||
import { deg2Rad } from '@src/lib/utils2d'
|
||||
|
||||
const ORTHOGRAPHIC_CAMERA_SIZE = 20
|
||||
const FRAMES_TO_ANIMATE_IN = 30
|
||||
|
@ -1,54 +1,60 @@
|
||||
import { useRef, useEffect, useState, useMemo, Fragment } from 'react'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { Dialog, Popover, Transition } from '@headlessui/react'
|
||||
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 { ARROWHEAD, DEBUG_SHOW_BOTH_SCENES } from './sceneInfra'
|
||||
import { ReactCameraProperties } from './CameraControls'
|
||||
import { throttle, toSync } from 'lib/utils'
|
||||
import {
|
||||
sceneInfra,
|
||||
kclManager,
|
||||
codeManager,
|
||||
editorManager,
|
||||
sceneEntitiesManager,
|
||||
engineCommandManager,
|
||||
rustContext,
|
||||
} from 'lib/singletons'
|
||||
import type { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
|
||||
import type { ReactCameraProperties } from '@src/clientSideScene/CameraControls'
|
||||
import {
|
||||
EXTRA_SEGMENT_HANDLE,
|
||||
PROFILE_START,
|
||||
getParentGroup,
|
||||
} from './sceneEntities'
|
||||
import { SegmentOverlay, SketchDetails } from 'machines/modelingMachine'
|
||||
import { findUsesOfTagInPipe, getNodeFromPath } from 'lang/queryAst'
|
||||
} from '@src/clientSideScene/sceneConstants'
|
||||
import {
|
||||
CallExpression,
|
||||
CallExpressionKw,
|
||||
PathToNode,
|
||||
Program,
|
||||
Expr,
|
||||
parse,
|
||||
recast,
|
||||
defaultSourceRange,
|
||||
resultIsOk,
|
||||
topLevelRange,
|
||||
} from 'lang/wasm'
|
||||
import { CustomIcon, CustomIconName } from 'components/CustomIcon'
|
||||
import { ConstrainInfo } from 'lang/std/stdTypes'
|
||||
import { getConstraintInfo, getConstraintInfoKw } from 'lang/std/sketch'
|
||||
import { Dialog, Popover, Transition } from '@headlessui/react'
|
||||
import toast from 'react-hot-toast'
|
||||
import { InstanceProps, create } from 'react-modal-promise'
|
||||
import { executeAstMock } from 'lang/langHelpers'
|
||||
ARROWHEAD,
|
||||
DEBUG_SHOW_BOTH_SCENES,
|
||||
} from '@src/clientSideScene/sceneInfra'
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import type { CustomIconName } from '@src/components/CustomIcon'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import { useModelingContext } from '@src/hooks/useModelingContext'
|
||||
import { executeAstMock } from '@src/lang/langHelpers'
|
||||
import {
|
||||
deleteSegmentFromPipeExpression,
|
||||
removeSingleConstraintInfo,
|
||||
} from 'lang/modifyAst'
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import { err, reportRejection, trap } from 'lib/trap'
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
} from '@src/lang/modifyAst'
|
||||
import { findUsesOfTagInPipe, getNodeFromPath } from '@src/lang/queryAst'
|
||||
import { getConstraintInfo, getConstraintInfoKw } from '@src/lang/std/sketch'
|
||||
import type { ConstrainInfo } from '@src/lang/std/stdTypes'
|
||||
import { topLevelRange } from '@src/lang/util'
|
||||
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 } {
|
||||
const [isCamMoving, setIsCamMoving] = useState(false)
|
||||
@ -635,8 +641,8 @@ const ConstraintSymbol = ({
|
||||
implicitDesc
|
||||
? 'bg-chalkboard-10 dark:bg-chalkboard-100 border-transparent border-0 rounded'
|
||||
: isConstrained
|
||||
? 'bg-chalkboard-10 dark:bg-chalkboard-90 dark:hover:bg-chalkboard-80 border-chalkboard-40 dark:border-chalkboard-70 rounded-sm'
|
||||
: 'bg-primary/30 dark:bg-primary text-primary dark:text-chalkboard-10 dark:border-transparent group-hover:bg-primary/40 group-hover:border-primary/50 group-hover:brightness-125'
|
||||
? 'bg-chalkboard-10 dark:bg-chalkboard-90 dark:hover:bg-chalkboard-80 border-chalkboard-40 dark:border-chalkboard-70 rounded-sm'
|
||||
: 'bg-primary/30 dark:bg-primary text-primary dark:text-chalkboard-10 dark:border-transparent group-hover:bg-primary/40 group-hover:border-primary/50 group-hover:brightness-125'
|
||||
} h-[26px] w-[26px] rounded-sm relative m-0 p-0`}
|
||||
onMouseEnter={() => {
|
||||
editorManager.setHighlightRange([range])
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Quaternion } from 'three'
|
||||
import { isQuaternionVertical } from './helpers'
|
||||
|
||||
import { isQuaternionVertical } from '@src/clientSideScene/helpers'
|
||||
|
||||
describe('isQuaternionVertical', () => {
|
||||
it('should identify vertical quaternions', () => {
|
||||
|
@ -1,15 +1,13 @@
|
||||
import { compareVec2Epsilon2 } from 'lang/std/sketch'
|
||||
import type { Group, Mesh, OrthographicCamera, Quaternion } from 'three'
|
||||
import {
|
||||
GridHelper,
|
||||
LineBasicMaterial,
|
||||
OrthographicCamera,
|
||||
PerspectiveCamera,
|
||||
Group,
|
||||
Mesh,
|
||||
Quaternion,
|
||||
Vector3,
|
||||
} from 'three'
|
||||
|
||||
import { compareVec2Epsilon2 } from '@src/lang/std/sketch'
|
||||
|
||||
export function createGridHelper({
|
||||
size,
|
||||
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 {
|
||||
AmbientLight,
|
||||
Color,
|
||||
@ -5,32 +15,29 @@ import {
|
||||
LineBasicMaterial,
|
||||
OrthographicCamera,
|
||||
PerspectiveCamera,
|
||||
Raycaster,
|
||||
Scene,
|
||||
TextureLoader,
|
||||
Vector2,
|
||||
Vector3,
|
||||
WebGLRenderer,
|
||||
Raycaster,
|
||||
Vector2,
|
||||
Group,
|
||||
MeshBasicMaterial,
|
||||
Mesh,
|
||||
Intersection,
|
||||
Object3D,
|
||||
Object3DEventMap,
|
||||
TextureLoader,
|
||||
Texture,
|
||||
} 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 { 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']
|
||||
|
||||
|
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 {
|
||||
BoxGeometry,
|
||||
BufferGeometry,
|
||||
@ -8,25 +8,33 @@ import {
|
||||
EllipseCurve,
|
||||
ExtrudeGeometry,
|
||||
Group,
|
||||
LineCurve3,
|
||||
LineBasicMaterial,
|
||||
LineDashedMaterial,
|
||||
Line,
|
||||
LineBasicMaterial,
|
||||
LineCurve3,
|
||||
LineDashedMaterial,
|
||||
Mesh,
|
||||
MeshBasicMaterial,
|
||||
NormalBufferAttributes,
|
||||
Points,
|
||||
PointsMaterial,
|
||||
Shape,
|
||||
SphereGeometry,
|
||||
Texture,
|
||||
Vector2,
|
||||
Vector3,
|
||||
} from 'three'
|
||||
import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js'
|
||||
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 {
|
||||
ARC_ANGLE_END,
|
||||
ARC_ANGLE_REFERENCE_LINE,
|
||||
ARC_CENTER_TO_FROM,
|
||||
ARC_CENTER_TO_TO,
|
||||
ARC_SEGMENT,
|
||||
ARC_SEGMENT_BODY,
|
||||
ARC_SEGMENT_DASH,
|
||||
CIRCLE_CENTER_HANDLE,
|
||||
CIRCLE_SEGMENT,
|
||||
CIRCLE_SEGMENT_BODY,
|
||||
@ -49,42 +57,37 @@ import {
|
||||
TANGENTIAL_ARC_TO_SEGMENT,
|
||||
TANGENTIAL_ARC_TO_SEGMENT_BODY,
|
||||
TANGENTIAL_ARC_TO__SEGMENT_DASH,
|
||||
ARC_SEGMENT,
|
||||
ARC_SEGMENT_BODY,
|
||||
ARC_SEGMENT_DASH,
|
||||
ARC_ANGLE_END,
|
||||
getParentGroup,
|
||||
ARC_CENTER_TO_FROM,
|
||||
ARC_CENTER_TO_TO,
|
||||
ARC_ANGLE_REFERENCE_LINE,
|
||||
THREE_POINT_ARC_HANDLE2,
|
||||
THREE_POINT_ARC_HANDLE3,
|
||||
THREE_POINT_ARC_SEGMENT,
|
||||
THREE_POINT_ARC_SEGMENT_BODY,
|
||||
THREE_POINT_ARC_SEGMENT_DASH,
|
||||
THREE_POINT_ARC_HANDLE2,
|
||||
THREE_POINT_ARC_HANDLE3,
|
||||
} from './sceneEntities'
|
||||
import { getTangentPointFromPreviousArc } from 'lib/utils2d'
|
||||
getParentGroup,
|
||||
} from '@src/clientSideScene/sceneConstants'
|
||||
import type { SceneInfra } from '@src/clientSideScene/sceneInfra'
|
||||
import {
|
||||
ARROWHEAD,
|
||||
DRAFT_POINT,
|
||||
SceneInfra,
|
||||
SEGMENT_LENGTH_LABEL,
|
||||
SEGMENT_LENGTH_LABEL_OFFSET_PX,
|
||||
SEGMENT_LENGTH_LABEL_TEXT,
|
||||
} from './sceneInfra'
|
||||
import { Themes, getThemeColorForThreeJs } from 'lib/theme'
|
||||
import { isClockwise, normaliseAngle, roundOff } from 'lib/utils'
|
||||
import {
|
||||
} from '@src/clientSideScene/sceneInfra'
|
||||
import type { Coords2d } from '@src/lang/std/sketch'
|
||||
import type { SegmentInputs } from '@src/lang/std/stdTypes'
|
||||
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,
|
||||
SegmentOverlayPayload,
|
||||
SegmentOverlays,
|
||||
} from 'machines/modelingMachine'
|
||||
import { SegmentInputs } from 'lang/std/stdTypes'
|
||||
import { err } from 'lib/trap'
|
||||
import { sceneInfra } from 'lib/singletons'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { calculate_circle_from_3_points } from '@rust/kcl-wasm-lib/pkg/kcl_wasm_lib'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
} from '@src/machines/modelingMachine'
|
||||
|
||||
const ANGLE_INDICATOR_RADIUS = 30 // in px
|
||||
interface CreateSegmentArgs {
|
||||
@ -205,6 +208,7 @@ class StraightSegment implements SegmentUtils {
|
||||
from,
|
||||
to,
|
||||
scale,
|
||||
sceneInfra,
|
||||
})
|
||||
segmentGroup.add(arrowGroup)
|
||||
segmentGroup.add(lengthIndicatorGroup)
|
||||
@ -572,6 +576,7 @@ class CircleSegment implements SegmentUtils {
|
||||
from: center,
|
||||
to: [center[0] + radius, center[1]],
|
||||
scale,
|
||||
sceneInfra,
|
||||
})
|
||||
|
||||
arcMesh.userData.type = meshType
|
||||
@ -1002,6 +1007,7 @@ class ArcSegment implements SegmentUtils {
|
||||
from: center,
|
||||
to: from,
|
||||
scale,
|
||||
sceneInfra,
|
||||
})
|
||||
|
||||
const grey = 0xaaaaaa
|
||||
@ -1059,6 +1065,7 @@ class ArcSegment implements SegmentUtils {
|
||||
center[1] + Math.sin(endAngle) * radius,
|
||||
],
|
||||
scale,
|
||||
sceneInfra,
|
||||
})
|
||||
endAngleLengthIndicator.name = 'endAngleLengthIndicator'
|
||||
|
||||
@ -1679,11 +1686,13 @@ function createLengthIndicator({
|
||||
to,
|
||||
scale,
|
||||
length = 0.1,
|
||||
sceneInfra,
|
||||
}: {
|
||||
from: Coords2d
|
||||
to: Coords2d
|
||||
scale: number
|
||||
length?: number
|
||||
sceneInfra: SceneInfra
|
||||
}) {
|
||||
const lengthIndicatorGroup = new Group()
|
||||
lengthIndicatorGroup.name = SEGMENT_LENGTH_LABEL
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { getPathOrUrlFromArgs, parseCLIArgs } from 'commandLineArgs'
|
||||
import { getPathOrUrlFromArgs, parseCLIArgs } from '@src/commandLineArgs'
|
||||
|
||||
const linuxDeepLinkArgv = [
|
||||
'/tmp/.mount_Zoo Movq3t0x/zoo-modeling-app',
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { ActionButton } from './ActionButton'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
|
||||
describe('ActionButton tests', () => {
|
||||
it('ActionButton with no iconStart or iconEnd should have even left and right padding', () => {
|
||||
|
@ -1,9 +1,12 @@
|
||||
import { ActionIcon, ActionIconProps } from './ActionIcon'
|
||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||
import React, { ForwardedRef, forwardRef } from 'react'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { Link } from 'react-router-dom'
|
||||
import type { ForwardedRef } from 'react'
|
||||
import React, { forwardRef } from 'react'
|
||||
import type { LinkProps } from 'react-router-dom'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import type { ActionIconProps } from '@src/components/ActionIcon'
|
||||
import { ActionIcon } from '@src/components/ActionIcon'
|
||||
import { openExternalBrowserIfDesktop } from '@src/lib/openWindow'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
|
||||
interface BaseActionButtonProps {
|
||||
iconStart?: ActionIconProps
|
||||
@ -47,8 +50,8 @@ export const ActionButton = forwardRef((props: ActionButtonProps, ref) => {
|
||||
? 'px-0' // No padding if both icons are present
|
||||
: 'pr-2' // Padding on the right if only the start icon is present
|
||||
: props.iconEnd
|
||||
? 'pl-2' // Padding on the left if only the end icon is present
|
||||
: 'px-2' // Padding on both sides if no icons are present
|
||||
? 'pl-2' // Padding on the left if only the end icon is present
|
||||
: 'px-2' // Padding on both sides if no icons are present
|
||||
} ${props.className ? props.className : ''}`
|
||||
|
||||
switch (props.Element) {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { Popover } from '@headlessui/react'
|
||||
import { ActionButtonProps } from './ActionButton'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import Tooltip from './Tooltip'
|
||||
|
||||
import type { ActionButtonProps } from '@src/components/ActionButton'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
|
||||
type ActionButtonSplitProps = ActionButtonProps & { Element: 'button' } & {
|
||||
name?: string
|
||||
|
@ -1,9 +1,9 @@
|
||||
import {
|
||||
IconDefinition,
|
||||
faCircleExclamation,
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
import type { IconDefinition } from '@fortawesome/free-solid-svg-icons'
|
||||
import { faCircleExclamation } from '@fortawesome/free-solid-svg-icons'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
import { CustomIcon, CustomIconName } from './CustomIcon'
|
||||
|
||||
import type { CustomIconName } from '@src/components/CustomIcon'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
|
||||
const iconSizes = {
|
||||
xs: 12,
|
||||
|
@ -1,12 +1,13 @@
|
||||
import { Toolbar } from '../Toolbar'
|
||||
import UserSidebarMenu from 'components/UserSidebarMenu'
|
||||
import { type IndexLoaderData } from 'lib/types'
|
||||
import ProjectSidebarMenu from './ProjectSidebarMenu'
|
||||
import { Toolbar } from '@src/Toolbar'
|
||||
import { CommandBarOpenButton } from '@src/components/CommandBarOpenButton'
|
||||
import ProjectSidebarMenu from '@src/components/ProjectSidebarMenu'
|
||||
import { RefreshButton } from '@src/components/RefreshButton'
|
||||
import UserSidebarMenu from '@src/components/UserSidebarMenu'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { type IndexLoaderData } from '@src/lib/types'
|
||||
import { useUser } from '@src/machines/appMachine'
|
||||
|
||||
import styles from './AppHeader.module.css'
|
||||
import { RefreshButton } from 'components/RefreshButton'
|
||||
import { CommandBarOpenButton } from './CommandBarOpenButton'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { useUser } from 'machines/appMachine'
|
||||
|
||||
interface AppHeaderProps extends React.PropsWithChildren {
|
||||
showToolbar?: boolean
|
||||
|
@ -1,13 +1,15 @@
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { editorManager, kclManager } from 'lib/singletons'
|
||||
import { getNodeFromPath } from 'lang/queryAst'
|
||||
import { getNodePathFromSourceRange } from 'lang/queryAstNodePathUtils'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { trap } from 'lib/trap'
|
||||
import { codeToIdSelections } from 'lib/selections'
|
||||
import { codeRefFromRange } from 'lang/std/artifactGraph'
|
||||
import { defaultSourceRange, topLevelRange } from 'lang/wasm'
|
||||
import { isArray } from 'lib/utils'
|
||||
|
||||
import { useModelingContext } from '@src/hooks/useModelingContext'
|
||||
import { getNodeFromPath } from '@src/lang/queryAst'
|
||||
import { getNodePathFromSourceRange } from '@src/lang/queryAstNodePathUtils'
|
||||
import { codeRefFromRange } from '@src/lang/std/artifactGraph'
|
||||
import { topLevelRange } from '@src/lang/util'
|
||||
import { defaultSourceRange } from '@src/lang/wasm'
|
||||
import { codeToIdSelections } from '@src/lib/selections'
|
||||
import { editorManager, kclManager } from '@src/lib/singletons'
|
||||
import { trap } from '@src/lib/trap'
|
||||
import { isArray } from '@src/lib/utils'
|
||||
|
||||
export function AstExplorer() {
|
||||
const { context } = useModelingContext()
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { BinaryPart } from '../lang/wasm'
|
||||
import {
|
||||
createLocalName,
|
||||
createLiteral,
|
||||
createLocalName,
|
||||
createUnaryExpression,
|
||||
} from '../lang/modifyAst'
|
||||
import { PrevVariable } from '../lang/queryAst'
|
||||
} from '@src/lang/create'
|
||||
import type { PrevVariable } from '@src/lang/queryAst'
|
||||
import type { BinaryPart } from '@src/lang/wasm'
|
||||
|
||||
export const AvailableVars = ({
|
||||
onVarClick,
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { EngineCommandManagerEvents } from 'lang/std/engineConnection'
|
||||
import { engineCommandManager, sceneInfra } from 'lib/singletons'
|
||||
import { throttle, isReducedMotion } from 'lib/utils'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { EngineCommandManagerEvents } from '@src/lang/std/engineConnection'
|
||||
import { engineCommandManager, sceneInfra } from '@src/lib/singletons'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { isReducedMotion, throttle } from '@src/lib/utils'
|
||||
|
||||
const updateDollyZoom = throttle(
|
||||
(newFov: number) => sceneInfra.camControls.dollyZoom(newFov),
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { Switch } from '@headlessui/react'
|
||||
import { settingsActor, useSettings } from 'machines/appMachine'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { settingsActor, useSettings } from '@src/machines/appMachine'
|
||||
|
||||
export function CameraProjectionToggle() {
|
||||
const settings = useSettings()
|
||||
const isCameraProjectionPerspective =
|
||||
|
@ -1,10 +1,17 @@
|
||||
import { Combobox } from '@headlessui/react'
|
||||
import { useSelector } from '@xstate/react'
|
||||
import Fuse from 'fuse.js'
|
||||
import { CommandArgument, CommandArgumentOption } from 'lib/commandTypes'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { AnyStateMachine, StateFrom } from 'xstate'
|
||||
import type { AnyStateMachine, StateFrom } from 'xstate'
|
||||
|
||||
import type {
|
||||
CommandArgument,
|
||||
CommandArgumentOption,
|
||||
} from '@src/lib/commandTypes'
|
||||
import {
|
||||
commandBarActor,
|
||||
useCommandBarState,
|
||||
} from '@src/machines/commandBarMachine'
|
||||
|
||||
const contextSelector = (snapshot: StateFrom<AnyStateMachine> | undefined) =>
|
||||
snapshot?.context
|
||||
|
@ -1,13 +1,17 @@
|
||||
import { Dialog, Popover, Transition } from '@headlessui/react'
|
||||
import { Fragment, useEffect } from 'react'
|
||||
import CommandBarArgument from './CommandBarArgument'
|
||||
import CommandComboBox from '../CommandComboBox'
|
||||
import CommandBarReview from './CommandBarReview'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
import useHotkeyWrapper from 'lib/hotkeyWrapper'
|
||||
import { CustomIcon } from 'components/CustomIcon'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
|
||||
import CommandBarArgument from '@src/components/CommandBar/CommandBarArgument'
|
||||
import CommandBarReview from '@src/components/CommandBar/CommandBarReview'
|
||||
import CommandComboBox from '@src/components/CommandComboBox'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import useHotkeyWrapper from '@src/lib/hotkeyWrapper'
|
||||
import {
|
||||
commandBarActor,
|
||||
useCommandBarState,
|
||||
} from '@src/machines/commandBarMachine'
|
||||
|
||||
export const COMMAND_PALETTE_HOTKEY = 'mod+k'
|
||||
|
||||
|
@ -1,12 +1,15 @@
|
||||
import CommandArgOptionInput from './CommandArgOptionInput'
|
||||
import CommandBarBasicInput from './CommandBarBasicInput'
|
||||
import CommandBarSelectionInput from './CommandBarSelectionInput'
|
||||
import CommandBarSelectionMixedInput from './CommandBarSelectionMixedInput'
|
||||
import { CommandArgument } from 'lib/commandTypes'
|
||||
import CommandBarHeader from './CommandBarHeader'
|
||||
import CommandBarKclInput from './CommandBarKclInput'
|
||||
import CommandBarTextareaInput from './CommandBarTextareaInput'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import CommandArgOptionInput from '@src/components/CommandBar/CommandArgOptionInput'
|
||||
import CommandBarBasicInput from '@src/components/CommandBar/CommandBarBasicInput'
|
||||
import CommandBarHeader from '@src/components/CommandBar/CommandBarHeader'
|
||||
import CommandBarKclInput from '@src/components/CommandBar/CommandBarKclInput'
|
||||
import CommandBarSelectionInput from '@src/components/CommandBar/CommandBarSelectionInput'
|
||||
import CommandBarSelectionMixedInput from '@src/components/CommandBar/CommandBarSelectionMixedInput'
|
||||
import CommandBarTextareaInput from '@src/components/CommandBar/CommandBarTextareaInput'
|
||||
import type { CommandArgument } from '@src/lib/commandTypes'
|
||||
import {
|
||||
commandBarActor,
|
||||
useCommandBarState,
|
||||
} from '@src/machines/commandBarMachine'
|
||||
|
||||
function CommandBarArgument({ stepBack }: { stepBack: () => void }) {
|
||||
const commandBarState = useCommandBarState()
|
||||
|
@ -1,8 +1,12 @@
|
||||
import { CommandArgument } from 'lib/commandTypes'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
|
||||
import type { CommandArgument } from '@src/lib/commandTypes'
|
||||
import {
|
||||
commandBarActor,
|
||||
useCommandBarState,
|
||||
} from '@src/machines/commandBarMachine'
|
||||
|
||||
function CommandBarBasicInput({
|
||||
arg,
|
||||
stepBack,
|
||||
|
@ -1,12 +1,20 @@
|
||||
import { CustomIcon } from '../CustomIcon'
|
||||
import React, { useMemo, useState } from 'react'
|
||||
import { ActionButton } from '../ActionButton'
|
||||
import { Selections, getSelectionTypeDisplayText } from 'lib/selections'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { KclCommandValue, KclExpressionWithVariable } from 'lib/commandTypes'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { roundOff } from 'lib/utils'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import type {
|
||||
KclCommandValue,
|
||||
KclExpressionWithVariable,
|
||||
} from '@src/lib/commandTypes'
|
||||
import type { Selections } from '@src/lib/selections'
|
||||
import { getSelectionTypeDisplayText } from '@src/lib/selections'
|
||||
import { roundOff } from '@src/lib/utils'
|
||||
import {
|
||||
commandBarActor,
|
||||
useCommandBarState,
|
||||
} from '@src/machines/commandBarMachine'
|
||||
|
||||
function CommandBarHeader({ children }: React.PropsWithChildren<object>) {
|
||||
const commandBarState = useCommandBarState()
|
||||
|
@ -1,33 +1,41 @@
|
||||
import type { Completion } from '@codemirror/autocomplete'
|
||||
import {
|
||||
closeBrackets,
|
||||
closeBracketsKeymap,
|
||||
Completion,
|
||||
completionKeymap,
|
||||
completionStatus,
|
||||
} from '@codemirror/autocomplete'
|
||||
import { EditorView, keymap, ViewUpdate } from '@codemirror/view'
|
||||
import { CustomIcon } from 'components/CustomIcon'
|
||||
import { CommandArgument, KclCommandValue } from 'lib/commandTypes'
|
||||
import { getSystemTheme } from 'lib/theme'
|
||||
import { useCalculateKclExpression } from 'lib/useCalculateKclExpression'
|
||||
import { roundOff } from 'lib/utils'
|
||||
import { varMentions } from 'lib/varCompletionExtension'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import styles from './CommandBarKclInput.module.css'
|
||||
import { createLocalName, createVariableDeclaration } from 'lang/modifyAst'
|
||||
import { useCodeMirror } from 'components/ModelingSidebar/ModelingPanes/CodeEditor'
|
||||
import type { ViewUpdate } from '@codemirror/view'
|
||||
import { EditorView, keymap } from '@codemirror/view'
|
||||
import { useSelector } from '@xstate/react'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import { AnyStateMachine, SnapshotFrom } from 'xstate'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { getNodeFromPath } from 'lang/queryAst'
|
||||
import { isPathToNode, SourceRange, VariableDeclarator } from 'lang/wasm'
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
import { err } from 'lib/trap'
|
||||
import { Spinner } from 'components/Spinner'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import type { AnyStateMachine, SnapshotFrom } from 'xstate'
|
||||
|
||||
import type { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import { useCodeMirror } from '@src/components/ModelingSidebar/ModelingPanes/CodeEditor'
|
||||
import { Spinner } from '@src/components/Spinner'
|
||||
import { createLocalName, createVariableDeclaration } from '@src/lang/create'
|
||||
import { getNodeFromPath } from '@src/lang/queryAst'
|
||||
import type { SourceRange, VariableDeclarator } from '@src/lang/wasm'
|
||||
import { isPathToNode } from '@src/lang/wasm'
|
||||
import type { CommandArgument, KclCommandValue } from '@src/lib/commandTypes'
|
||||
import { kclManager } from '@src/lib/singletons'
|
||||
import { getSystemTheme } from '@src/lib/theme'
|
||||
import { err } from '@src/lib/trap'
|
||||
import { useCalculateKclExpression } from '@src/lib/useCalculateKclExpression'
|
||||
import { roundOff } from '@src/lib/utils'
|
||||
import { varMentions } from '@src/lib/varCompletionExtension'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
import {
|
||||
commandBarActor,
|
||||
useCommandBarState,
|
||||
} from '@src/machines/commandBarMachine'
|
||||
|
||||
import styles from './CommandBarKclInput.module.css'
|
||||
|
||||
// TODO: remove the need for this selector once we decouple all actors from React
|
||||
const machineContextSelector = (snapshot?: SnapshotFrom<AnyStateMachine>) =>
|
||||
|
@ -1,7 +1,11 @@
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import CommandBarHeader from './CommandBarHeader'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
|
||||
import CommandBarHeader from '@src/components/CommandBar/CommandBarHeader'
|
||||
import {
|
||||
commandBarActor,
|
||||
useCommandBarState,
|
||||
} from '@src/machines/commandBarMachine'
|
||||
|
||||
function CommandBarReview({ stepBack }: { stepBack: () => void }) {
|
||||
const commandBarState = useCommandBarState()
|
||||
const {
|
||||
|
@ -1,18 +1,22 @@
|
||||
import { useSelector } from '@xstate/react'
|
||||
import { Artifact } from 'lang/std/artifactGraph'
|
||||
import { CommandArgument } from 'lib/commandTypes'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import type { StateFrom } from 'xstate'
|
||||
|
||||
import type { Artifact } from '@src/lang/std/artifactGraph'
|
||||
import type { CommandArgument } from '@src/lib/commandTypes'
|
||||
import {
|
||||
canSubmitSelectionArg,
|
||||
getSelectionCountByType,
|
||||
getSelectionTypeDisplayText,
|
||||
} from 'lib/selections'
|
||||
import { engineCommandManager, kclManager } from 'lib/singletons'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { toSync } from 'lib/utils'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import { modelingMachine } from 'machines/modelingMachine'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { StateFrom } from 'xstate'
|
||||
} from '@src/lib/selections'
|
||||
import { engineCommandManager, kclManager } from '@src/lib/singletons'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { toSync } from '@src/lib/utils'
|
||||
import {
|
||||
commandBarActor,
|
||||
useCommandBarState,
|
||||
} from '@src/machines/commandBarMachine'
|
||||
import type { modelingMachine } from '@src/machines/modelingMachine'
|
||||
|
||||
const semanticEntityNames: {
|
||||
[key: string]: Array<Artifact['type'] | 'defaultPlane'>
|
||||
|
@ -1,13 +1,17 @@
|
||||
import { useSelector } from '@xstate/react'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { CommandArgument } from 'lib/commandTypes'
|
||||
|
||||
import type { CommandArgument } from '@src/lib/commandTypes'
|
||||
import type { Selections } from '@src/lib/selections'
|
||||
import {
|
||||
Selections,
|
||||
canSubmitSelectionArg,
|
||||
getSelectionCountByType,
|
||||
} from 'lib/selections'
|
||||
import { useSelector } from '@xstate/react'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
} from '@src/lib/selections'
|
||||
import { kclManager } from '@src/lib/singletons'
|
||||
import {
|
||||
commandBarActor,
|
||||
useCommandBarState,
|
||||
} from '@src/machines/commandBarMachine'
|
||||
|
||||
const selectionSelector = (snapshot: any) => snapshot?.context.selectionRanges
|
||||
|
||||
|
@ -1,8 +1,13 @@
|
||||
import { CommandArgument } from 'lib/commandTypes'
|
||||
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
|
||||
import { RefObject, useEffect, useRef } from 'react'
|
||||
import type { RefObject } from 'react'
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
|
||||
import type { CommandArgument } from '@src/lib/commandTypes'
|
||||
import {
|
||||
commandBarActor,
|
||||
useCommandBarState,
|
||||
} from '@src/machines/commandBarMachine'
|
||||
|
||||
function CommandBarTextareaInput({
|
||||
arg,
|
||||
stepBack,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import usePlatform from 'hooks/usePlatform'
|
||||
import { hotkeyDisplay } from 'lib/hotkeyWrapper'
|
||||
import { COMMAND_PALETTE_HOTKEY } from './CommandBar/CommandBar'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { COMMAND_PALETTE_HOTKEY } from '@src/components/CommandBar/CommandBar'
|
||||
import usePlatform from '@src/hooks/usePlatform'
|
||||
import { hotkeyDisplay } from '@src/lib/hotkeyWrapper'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
|
||||
export function CommandBarOpenButton() {
|
||||
const platform = usePlatform()
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { Combobox } from '@headlessui/react'
|
||||
import Fuse from 'fuse.js'
|
||||
import { Command } from 'lib/commandTypes'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import { getActorNextEvents } from 'lib/utils'
|
||||
import { sortCommands } from 'lib/commandUtils'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import type { Command } from '@src/lib/commandTypes'
|
||||
import { sortCommands } from '@src/lib/commandUtils'
|
||||
import { getActorNextEvents } from '@src/lib/utils'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
|
||||
function CommandComboBox({
|
||||
options,
|
||||
|
@ -1,15 +1,11 @@
|
||||
import toast from 'react-hot-toast'
|
||||
import { ActionIcon, ActionIconProps } from './ActionIcon'
|
||||
import {
|
||||
RefObject,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { Dialog } from '@headlessui/react'
|
||||
import type { RefObject } from 'react'
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
|
||||
import type { ActionIconProps } from '@src/components/ActionIcon'
|
||||
import { ActionIcon } from '@src/components/ActionIcon'
|
||||
|
||||
export interface ContextMenuProps
|
||||
extends Omit<React.HTMLAttributes<HTMLUListElement>, 'children'> {
|
||||
|
@ -1,8 +1,11 @@
|
||||
import { useMemo } from 'react'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { expandPlane, PlaneArtifactRich } from 'lang/std/artifactGraph'
|
||||
import { ArtifactGraph } from 'lang/wasm'
|
||||
import { DebugDisplayArray, GenericObj } from './DebugDisplayObj'
|
||||
|
||||
import type { GenericObj } from '@src/components/DebugDisplayObj'
|
||||
import { DebugDisplayArray } from '@src/components/DebugDisplayObj'
|
||||
import type { PlaneArtifactRich } from '@src/lang/std/artifactGraph'
|
||||
import { expandPlane } from '@src/lang/std/artifactGraph'
|
||||
import type { ArtifactGraph } from '@src/lang/wasm'
|
||||
import { kclManager } from '@src/lib/singletons'
|
||||
|
||||
export function DebugArtifactGraph() {
|
||||
const artifactGraphTree = useMemo(() => {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { isArray, isNonNullable } from 'lib/utils'
|
||||
import { useRef, useState } from 'react'
|
||||
|
||||
import { isArray, isNonNullable } from '@src/lib/utils'
|
||||
|
||||
type Primitive = string | number | bigint | boolean | symbol | null | undefined
|
||||
|
||||
export type GenericObj = {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { Dialog } from '@headlessui/react'
|
||||
import { ActionButton } from './ActionButton'
|
||||
import { useState } from 'react'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
|
||||
const DownloadAppBanner = () => {
|
||||
const settings = useSettings()
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { MoveDesc } from 'machines/modelingMachine'
|
||||
import type { MoveDesc } from '@src/machines/modelingMachine'
|
||||
|
||||
export const DragWarningToast = (moveDescs: MoveDesc[]) => {
|
||||
if (moveDescs.length === 1) {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { CommandLog } from 'lang/std/engineConnection'
|
||||
import { engineCommandManager } from 'lib/singletons'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import type { CommandLog } from '@src/lang/std/engineConnection'
|
||||
import { engineCommandManager } from '@src/lib/singletons'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
|
||||
export function useEngineCommands(): [CommandLog[], () => void] {
|
||||
const [engineCommands, setEngineCommands] = useState<CommandLog[]>(
|
||||
|
@ -1,12 +1,13 @@
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { useRouteError, isRouteErrorResponse } from 'react-router-dom'
|
||||
import { ActionButton } from './ActionButton'
|
||||
import {
|
||||
faBug,
|
||||
faHome,
|
||||
faRefresh,
|
||||
faTrash,
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
import { isRouteErrorResponse, useRouteError } from 'react-router-dom'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
|
||||
/** Type narrowing function of unknown error to a string */
|
||||
function errorMessage(error: unknown): string {
|
||||
|
@ -1,41 +1,39 @@
|
||||
import { useMachine } from '@xstate/react'
|
||||
import { useLocation, useNavigate, useRouteLoaderData } from 'react-router-dom'
|
||||
import { type IndexLoaderData } from 'lib/types'
|
||||
import { BROWSER_PATH, PATHS } from 'lib/paths'
|
||||
import React, { createContext, useEffect, useMemo } from 'react'
|
||||
import { toast } from 'react-hot-toast'
|
||||
import {
|
||||
import { useLocation, useNavigate, useRouteLoaderData } from 'react-router-dom'
|
||||
import type {
|
||||
Actor,
|
||||
AnyStateMachine,
|
||||
ContextFrom,
|
||||
Prop,
|
||||
StateFrom,
|
||||
fromPromise,
|
||||
} from 'xstate'
|
||||
import { fileMachine } from 'machines/fileMachine'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { fromPromise } from 'xstate'
|
||||
|
||||
import { newKclFile } from '@src/lang/project'
|
||||
import { createNamedViewsCommand } from '@src/lib/commandBarConfigs/namedViewsConfig'
|
||||
import { createRouteCommands } from '@src/lib/commandBarConfigs/routeCommandConfig'
|
||||
import {
|
||||
DEFAULT_DEFAULT_LENGTH_UNIT,
|
||||
DEFAULT_FILE_NAME,
|
||||
DEFAULT_PROJECT_KCL_FILE,
|
||||
FILE_EXT,
|
||||
} from 'lib/constants'
|
||||
import { getProjectInfo } from 'lib/desktop'
|
||||
import { getNextDirName, getNextFileName } from 'lib/desktopFS'
|
||||
import { kclCommands } from 'lib/kclCommands'
|
||||
import { codeManager, kclManager } from 'lib/singletons'
|
||||
import {
|
||||
getKclSamplesManifest,
|
||||
KclSamplesManifestItem,
|
||||
} from 'lib/getKclSamplesManifest'
|
||||
import { markOnce } from 'lib/performance'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
import { createRouteCommands } from 'lib/commandBarConfigs/routeCommandConfig'
|
||||
import { useToken } from 'machines/appMachine'
|
||||
import { createNamedViewsCommand } from 'lib/commandBarConfigs/namedViewsConfig'
|
||||
import { err, reportRejection } from 'lib/trap'
|
||||
import { newKclFile } from 'lang/project'
|
||||
} from '@src/lib/constants'
|
||||
import { getProjectInfo } from '@src/lib/desktop'
|
||||
import { getNextDirName, getNextFileName } from '@src/lib/desktopFS'
|
||||
import type { KclSamplesManifestItem } from '@src/lib/getKclSamplesManifest'
|
||||
import { getKclSamplesManifest } from '@src/lib/getKclSamplesManifest'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { kclCommands } from '@src/lib/kclCommands'
|
||||
import { BROWSER_PATH, PATHS } from '@src/lib/paths'
|
||||
import { markOnce } from '@src/lib/performance'
|
||||
import { codeManager, kclManager } from '@src/lib/singletons'
|
||||
import { err, reportRejection } from '@src/lib/trap'
|
||||
import { type IndexLoaderData } from '@src/lib/types'
|
||||
import { useSettings, useToken } from '@src/machines/appMachine'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
import { fileMachine } from '@src/machines/fileMachine'
|
||||
|
||||
type MachineContext<T extends AnyStateMachine> = {
|
||||
state: StateFrom<T>
|
||||
|
@ -1,30 +1,34 @@
|
||||
import type { IndexLoaderData } from 'lib/types'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { ActionButton } from './ActionButton'
|
||||
import Tooltip from './Tooltip'
|
||||
import { Dispatch, useCallback, useRef, useState } from 'react'
|
||||
import { useNavigate, useRouteLoaderData } from 'react-router-dom'
|
||||
import { Disclosure } from '@headlessui/react'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
import { faChevronRight, faPencil } from '@fortawesome/free-solid-svg-icons'
|
||||
import { useFileContext } from 'hooks/useFileContext'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
import { Disclosure } from '@headlessui/react'
|
||||
import type { Dispatch } from 'react'
|
||||
import { useCallback, useRef, useState } from 'react'
|
||||
import { useNavigate, useRouteLoaderData } from 'react-router-dom'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { ContextMenu, ContextMenuItem } from '@src/components/ContextMenu'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import { useLspContext } from '@src/components/LspProvider'
|
||||
import { DeleteConfirmationDialog } from '@src/components/ProjectCard/DeleteProjectDialog'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import { useFileContext } from '@src/hooks/useFileContext'
|
||||
import { useFileSystemWatcher } from '@src/hooks/useFileSystemWatcher'
|
||||
import { useModelingContext } from '@src/hooks/useModelingContext'
|
||||
import usePlatform from '@src/hooks/usePlatform'
|
||||
import { useKclContext } from '@src/lang/KclProvider'
|
||||
import type { KCLError } from '@src/lang/errors'
|
||||
import { kclErrorsByFilename } from '@src/lang/errors'
|
||||
import { normalizeLineEndings } from '@src/lib/codeEditor'
|
||||
import { FILE_EXT } from '@src/lib/constants'
|
||||
import { sortFilesAndDirectories } from '@src/lib/desktopFS'
|
||||
import useHotkeyWrapper from '@src/lib/hotkeyWrapper'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import type { FileEntry } from '@src/lib/project'
|
||||
import { codeManager, kclManager } from '@src/lib/singletons'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import type { IndexLoaderData } from '@src/lib/types'
|
||||
|
||||
import styles from './FileTree.module.css'
|
||||
import { sortFilesAndDirectories } from 'lib/desktopFS'
|
||||
import { FILE_EXT } from 'lib/constants'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import { codeManager, kclManager } from 'lib/singletons'
|
||||
import { useLspContext } from './LspProvider'
|
||||
import useHotkeyWrapper from 'lib/hotkeyWrapper'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { DeleteConfirmationDialog } from './ProjectCard/DeleteProjectDialog'
|
||||
import { ContextMenu, ContextMenuItem } from './ContextMenu'
|
||||
import usePlatform from 'hooks/usePlatform'
|
||||
import { FileEntry } from 'lib/project'
|
||||
import { useFileSystemWatcher } from 'hooks/useFileSystemWatcher'
|
||||
import { normalizeLineEndings } from 'lib/codeEditor'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import { kclErrorsByFilename, KCLError } from 'lang/errors'
|
||||
|
||||
function getIndentationCSS(level: number) {
|
||||
return `calc(1rem * ${level + 1})`
|
||||
|
@ -1,34 +1,33 @@
|
||||
import { SceneInfra } from 'clientSideScene/sceneInfra'
|
||||
import { sceneInfra } from 'lib/singletons'
|
||||
import { MutableRefObject, useEffect, useRef } from 'react'
|
||||
import { Popover } from '@headlessui/react'
|
||||
import type { MutableRefObject } from 'react'
|
||||
import { useEffect, useRef } from 'react'
|
||||
import type { Camera, ColorRepresentation, Intersection, Object3D } from 'three'
|
||||
import {
|
||||
WebGLRenderer,
|
||||
Scene,
|
||||
OrthographicCamera,
|
||||
BoxGeometry,
|
||||
SphereGeometry,
|
||||
MeshBasicMaterial,
|
||||
Clock,
|
||||
Color,
|
||||
Mesh,
|
||||
Clock,
|
||||
MeshBasicMaterial,
|
||||
OrthographicCamera,
|
||||
Quaternion,
|
||||
ColorRepresentation,
|
||||
Vector2,
|
||||
Raycaster,
|
||||
Camera,
|
||||
Intersection,
|
||||
Object3D,
|
||||
Scene,
|
||||
SphereGeometry,
|
||||
Vector2,
|
||||
WebGLRenderer,
|
||||
} from 'three'
|
||||
import { Popover } from '@headlessui/react'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
|
||||
import type { SceneInfra } from '@src/clientSideScene/sceneInfra'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import {
|
||||
useViewControlMenuItems,
|
||||
ViewControlContextMenu,
|
||||
} from './ViewControlMenu'
|
||||
import { AxisNames } from 'lib/constants'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
useViewControlMenuItems,
|
||||
} from '@src/components/ViewControlMenu'
|
||||
import { useModelingContext } from '@src/hooks/useModelingContext'
|
||||
import { AxisNames } from '@src/lib/constants'
|
||||
import { sceneInfra } from '@src/lib/singletons'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
|
||||
const CANVAS_SIZE = 80
|
||||
const FRUSTUM_SIZE = 0.5
|
||||
|
@ -1,16 +1,17 @@
|
||||
import { Popover } from '@headlessui/react'
|
||||
import Tooltip from './Tooltip'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { createAndOpenNewTutorialProject } from 'lib/desktopFS'
|
||||
import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath'
|
||||
import { useLspContext } from './LspProvider'
|
||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { settingsActor } from 'machines/appMachine'
|
||||
import type { WebContentSendPayload } from '../menu/channels'
|
||||
import { useMenuListener } from 'hooks/useMenu'
|
||||
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import { useLspContext } from '@src/components/LspProvider'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import { useAbsoluteFilePath } from '@src/hooks/useAbsoluteFilePath'
|
||||
import { useMenuListener } from '@src/hooks/useMenu'
|
||||
import { createAndOpenNewTutorialProject } from '@src/lib/desktopFS'
|
||||
import { openExternalBrowserIfDesktop } from '@src/lib/openWindow'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { settingsActor } from '@src/machines/appMachine'
|
||||
import type { WebContentSendPayload } from '@src/menu/channels'
|
||||
|
||||
const HelpMenuDivider = () => (
|
||||
<div className="h-[1px] bg-chalkboard-110 dark:bg-chalkboard-80" />
|
||||
|
@ -1,17 +1,15 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { Spinner } from '@src/components/Spinner'
|
||||
import {
|
||||
EngineConnectionStateType,
|
||||
CONNECTION_ERROR_TEXT,
|
||||
ConnectionError,
|
||||
DisconnectingType,
|
||||
EngineCommandManagerEvents,
|
||||
EngineConnectionEvents,
|
||||
ConnectionError,
|
||||
CONNECTION_ERROR_TEXT,
|
||||
} from '../lang/std/engineConnection'
|
||||
|
||||
import { engineCommandManager } from '../lib/singletons'
|
||||
|
||||
import { Spinner } from './Spinner'
|
||||
EngineConnectionStateType,
|
||||
} from '@src/lang/std/engineConnection'
|
||||
import { engineCommandManager } from '@src/lib/singletons'
|
||||
|
||||
interface LoadingProps extends React.PropsWithChildren {
|
||||
className?: string
|
||||
|
@ -1,18 +1,19 @@
|
||||
import { APP_VERSION, getReleaseUrl } from 'routes/Settings'
|
||||
import { CustomIcon } from 'components/CustomIcon'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { NetworkHealthIndicator } from 'components/NetworkHealthIndicator'
|
||||
import { HelpMenu } from './HelpMenu'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath'
|
||||
import { coreDump } from 'lang/wasm'
|
||||
import toast from 'react-hot-toast'
|
||||
import { CoreDumpManager } from 'lib/coredump'
|
||||
import openWindow, { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||
import { NetworkMachineIndicator } from './NetworkMachineIndicator'
|
||||
import { ModelStateIndicator } from './ModelStateIndicator'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import { HelpMenu } from '@src/components/HelpMenu'
|
||||
import { ModelStateIndicator } from '@src/components/ModelStateIndicator'
|
||||
import { NetworkHealthIndicator } from '@src/components/NetworkHealthIndicator'
|
||||
import { NetworkMachineIndicator } from '@src/components/NetworkMachineIndicator'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import { useAbsoluteFilePath } from '@src/hooks/useAbsoluteFilePath'
|
||||
import { coreDump } from '@src/lang/wasm'
|
||||
import type { CoreDumpManager } from '@src/lib/coredump'
|
||||
import openWindow, { openExternalBrowserIfDesktop } from '@src/lib/openWindow'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { APP_VERSION, getReleaseUrl } from '@src/routes/Settings'
|
||||
|
||||
export function LowerRightControls({
|
||||
children,
|
||||
|
@ -1,32 +1,33 @@
|
||||
import type * as LSP from 'vscode-languageserver-protocol'
|
||||
import React, { createContext, useMemo, useContext, useState } from 'react'
|
||||
import type { LanguageSupport } from '@codemirror/language'
|
||||
import type { Extension } from '@codemirror/state'
|
||||
import type { LanguageServerPlugin } from '@kittycad/codemirror-lsp-client'
|
||||
import {
|
||||
LanguageServerClient,
|
||||
FromServer,
|
||||
IntoServer,
|
||||
LanguageServerClient,
|
||||
LspWorkerEventType,
|
||||
LanguageServerPlugin,
|
||||
} from '@kittycad/codemirror-lsp-client'
|
||||
import { TEST, VITE_KC_API_BASE_URL } from 'env'
|
||||
import { kcl } from 'editor/plugins/lsp/kcl/language'
|
||||
import { copilotPlugin } from 'editor/plugins/lsp/copilot'
|
||||
import { Extension } from '@codemirror/state'
|
||||
import { LanguageSupport } from '@codemirror/language'
|
||||
import { TEST, VITE_KC_API_BASE_URL } from '@src/env'
|
||||
import React, { createContext, useContext, useMemo, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { FileEntry } from 'lib/project'
|
||||
import Worker from 'editor/plugins/lsp/worker.ts?worker'
|
||||
import {
|
||||
KclWorkerOptions,
|
||||
import type * as LSP from 'vscode-languageserver-protocol'
|
||||
|
||||
import { copilotPlugin } from '@src/editor/plugins/lsp/copilot'
|
||||
import { kcl } from '@src/editor/plugins/lsp/kcl/language'
|
||||
import type {
|
||||
CopilotWorkerOptions,
|
||||
LspWorker,
|
||||
} from 'editor/plugins/lsp/types'
|
||||
import { wasmUrl } from 'lang/wasm'
|
||||
import { PROJECT_ENTRYPOINT } from 'lib/constants'
|
||||
import { err } from 'lib/trap'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { codeManager } from 'lib/singletons'
|
||||
import { useToken } from 'machines/appMachine'
|
||||
KclWorkerOptions,
|
||||
} from '@src/editor/plugins/lsp/types'
|
||||
import { LspWorker } from '@src/editor/plugins/lsp/types'
|
||||
import Worker from '@src/editor/plugins/lsp/worker.ts?worker'
|
||||
import { wasmUrl } from '@src/lang/wasm'
|
||||
import { PROJECT_ENTRYPOINT } from '@src/lib/constants'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import type { FileEntry } from '@src/lib/project'
|
||||
import { codeManager } from '@src/lib/singletons'
|
||||
import { err } from '@src/lib/trap'
|
||||
import { useToken } from '@src/machines/appMachine'
|
||||
|
||||
function getWorkspaceFolders(): LSP.WorkspaceFolder[] {
|
||||
return []
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { createContext, useEffect, useState } from 'react'
|
||||
|
||||
import { engineCommandManager } from 'lib/singletons'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { components } from 'lib/machine-api'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { toSync } from 'lib/utils'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import type { components } from '@src/lib/machine-api'
|
||||
import { engineCommandManager } from '@src/lib/singletons'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { toSync } from '@src/lib/utils'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
|
||||
export type MachinesListing = Array<
|
||||
components['schemas']['MachineInfoResponse']
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { useEngineCommands } from './EngineCommands'
|
||||
import { Spinner } from './Spinner'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import { useEngineCommands } from '@src/components/EngineCommands'
|
||||
import { Spinner } from '@src/components/Spinner'
|
||||
|
||||
export const ModelStateIndicator = () => {
|
||||
const [commands] = useEngineCommands()
|
||||
const lastCommandType = commands[commands.length - 1]?.type
|
||||
|
@ -1,70 +1,46 @@
|
||||
import { useMachine, useSelector } from '@xstate/react'
|
||||
import React, {
|
||||
createContext,
|
||||
useContext,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useContext,
|
||||
} from 'react'
|
||||
import {
|
||||
Actor,
|
||||
ContextFrom,
|
||||
Prop,
|
||||
SnapshotFrom,
|
||||
StateFrom,
|
||||
assign,
|
||||
fromPromise,
|
||||
} from 'xstate'
|
||||
import {
|
||||
getPersistedContext,
|
||||
modelingMachine,
|
||||
modelingMachineDefaultContext,
|
||||
} from 'machines/modelingMachine'
|
||||
import { useSetupEngineManager } from 'hooks/useSetupEngineManager'
|
||||
import {
|
||||
isCursorInSketchCommandRange,
|
||||
updateSketchDetailsNodePaths,
|
||||
} from 'lang/util'
|
||||
import {
|
||||
kclManager,
|
||||
sceneInfra,
|
||||
engineCommandManager,
|
||||
codeManager,
|
||||
editorManager,
|
||||
sceneEntitiesManager,
|
||||
rustContext,
|
||||
} from 'lib/singletons'
|
||||
import {
|
||||
MachineManager,
|
||||
MachineManagerContext,
|
||||
} from 'components/MachineManagerProvider'
|
||||
import toast from 'react-hot-toast'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { applyConstraintHorzVertDistance } from './Toolbar/SetHorzVertDistance'
|
||||
import {
|
||||
angleBetweenInfo,
|
||||
applyConstraintAngleBetween,
|
||||
} from './Toolbar/SetAngleBetween'
|
||||
import {
|
||||
applyConstraintAngleLength,
|
||||
applyConstraintLength,
|
||||
} from './Toolbar/setAngleLength'
|
||||
import {
|
||||
handleSelectionBatch,
|
||||
Selections,
|
||||
updateSelections,
|
||||
} from 'lib/selections'
|
||||
import { applyConstraintIntersect } from './Toolbar/Intersect'
|
||||
import { applyConstraintAbsDistance } from './Toolbar/SetAbsDistance'
|
||||
import useStateMachineCommands from 'hooks/useStateMachineCommands'
|
||||
import {
|
||||
ModelingCommandSchema,
|
||||
modelingMachineCommandConfig,
|
||||
} from 'lib/commandBarConfigs/modelingCommandConfig'
|
||||
import { useLoaderData, useNavigate, useSearchParams } from 'react-router-dom'
|
||||
import type { Actor, ContextFrom, Prop, SnapshotFrom, StateFrom } from 'xstate'
|
||||
import { assign, fromPromise } from 'xstate'
|
||||
|
||||
import type {
|
||||
OutputFormat3d,
|
||||
Point3d,
|
||||
} from '@rust/kcl-lib/bindings/ModelingCmd'
|
||||
import type { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
import type { Plane } from '@rust/kcl-lib/bindings/Plane'
|
||||
|
||||
import { letEngineAnimateAndSyncCamAfter } from '@src/clientSideScene/CameraControls'
|
||||
import {
|
||||
SEGMENT_BODIES,
|
||||
getParentGroup,
|
||||
getSketchOrientationDetails,
|
||||
} from 'clientSideScene/sceneEntities'
|
||||
} from '@src/clientSideScene/sceneConstants'
|
||||
import type { MachineManager } from '@src/components/MachineManagerProvider'
|
||||
import { MachineManagerContext } from '@src/components/MachineManagerProvider'
|
||||
import { applyConstraintIntersect } from '@src/components/Toolbar/Intersect'
|
||||
import { applyConstraintAbsDistance } from '@src/components/Toolbar/SetAbsDistance'
|
||||
import {
|
||||
angleBetweenInfo,
|
||||
applyConstraintAngleBetween,
|
||||
} from '@src/components/Toolbar/SetAngleBetween'
|
||||
import { applyConstraintHorzVertDistance } from '@src/components/Toolbar/SetHorzVertDistance'
|
||||
import {
|
||||
applyConstraintAngleLength,
|
||||
applyConstraintLength,
|
||||
} from '@src/components/Toolbar/setAngleLength'
|
||||
import { useFileContext } from '@src/hooks/useFileContext'
|
||||
import { useSetupEngineManager } from '@src/hooks/useSetupEngineManager'
|
||||
import useStateMachineCommands from '@src/hooks/useStateMachineCommands'
|
||||
import { updateModelingState } from '@src/lang/modelingWorkflows'
|
||||
import {
|
||||
insertNamedConstant,
|
||||
replaceValueAtNodePath,
|
||||
@ -72,55 +48,69 @@ import {
|
||||
sketchOnOffsetPlane,
|
||||
splitPipedProfile,
|
||||
startSketchOnDefault,
|
||||
} from 'lang/modifyAst'
|
||||
import {
|
||||
KclValue,
|
||||
PathToNode,
|
||||
PipeExpression,
|
||||
Program,
|
||||
VariableDeclaration,
|
||||
parse,
|
||||
recast,
|
||||
resultIsOk,
|
||||
} from 'lang/wasm'
|
||||
} from '@src/lang/modifyAst'
|
||||
import {
|
||||
artifactIsPlaneWithPaths,
|
||||
doesSketchPipeNeedSplitting,
|
||||
getNodeFromPath,
|
||||
isCursorInFunctionDefinition,
|
||||
traverse,
|
||||
} from 'lang/queryAst'
|
||||
import toast from 'react-hot-toast'
|
||||
import { useLoaderData, useNavigate, useSearchParams } from 'react-router-dom'
|
||||
import { letEngineAnimateAndSyncCamAfter } from 'clientSideScene/CameraControls'
|
||||
import { err, reportRejection, trap, reject } from 'lib/trap'
|
||||
import {
|
||||
EngineConnectionStateType,
|
||||
EngineConnectionEvents,
|
||||
} from 'lang/std/engineConnection'
|
||||
import { submitAndAwaitTextToKcl } from 'lib/textToCad'
|
||||
import { useFileContext } from 'hooks/useFileContext'
|
||||
import { platform, uuidv4 } from 'lib/utils'
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
} from '@src/lang/queryAst'
|
||||
import { getNodePathFromSourceRange } from '@src/lang/queryAstNodePathUtils'
|
||||
import {
|
||||
getFaceCodeRef,
|
||||
getPathsFromArtifact,
|
||||
getPlaneFromArtifact,
|
||||
} from 'lang/std/artifactGraph'
|
||||
import { promptToEditFlow } from 'lib/promptToEdit'
|
||||
import { kclEditorActor } from 'machines/kclEditorMachine'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { useToken } from 'machines/appMachine'
|
||||
import { getNodePathFromSourceRange } from 'lang/queryAstNodePathUtils'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
import { IndexLoaderData } from 'lib/types'
|
||||
import { OutputFormat3d, Point3d } from '@rust/kcl-lib/bindings/ModelingCmd'
|
||||
import { EXPORT_TOAST_MESSAGES, MAKE_TOAST_MESSAGES } from 'lib/constants'
|
||||
import { exportMake } from 'lib/exportMake'
|
||||
import { exportSave } from 'lib/exportSave'
|
||||
import { Plane } from '@rust/kcl-lib/bindings/Plane'
|
||||
import { updateModelingState } from 'lang/modelingWorkflows'
|
||||
import { EXECUTION_TYPE_MOCK } from 'lib/constants'
|
||||
} from '@src/lang/std/artifactGraph'
|
||||
import {
|
||||
EngineConnectionEvents,
|
||||
EngineConnectionStateType,
|
||||
} from '@src/lang/std/engineConnection'
|
||||
import {
|
||||
isCursorInSketchCommandRange,
|
||||
updateSketchDetailsNodePaths,
|
||||
} from '@src/lang/util'
|
||||
import type {
|
||||
KclValue,
|
||||
PathToNode,
|
||||
PipeExpression,
|
||||
Program,
|
||||
VariableDeclaration,
|
||||
} from '@src/lang/wasm'
|
||||
import { parse, recast, resultIsOk } from '@src/lang/wasm'
|
||||
import type { ModelingCommandSchema } from '@src/lib/commandBarConfigs/modelingCommandConfig'
|
||||
import { modelingMachineCommandConfig } from '@src/lib/commandBarConfigs/modelingCommandConfig'
|
||||
import {
|
||||
EXECUTION_TYPE_MOCK,
|
||||
EXPORT_TOAST_MESSAGES,
|
||||
MAKE_TOAST_MESSAGES,
|
||||
} from '@src/lib/constants'
|
||||
import { exportMake } from '@src/lib/exportMake'
|
||||
import { exportSave } from '@src/lib/exportSave'
|
||||
import { promptToEditFlow } from '@src/lib/promptToEdit'
|
||||
import type { Selections } from '@src/lib/selections'
|
||||
import { handleSelectionBatch, updateSelections } from '@src/lib/selections'
|
||||
import {
|
||||
codeManager,
|
||||
editorManager,
|
||||
engineCommandManager,
|
||||
kclManager,
|
||||
rustContext,
|
||||
sceneEntitiesManager,
|
||||
sceneInfra,
|
||||
} from '@src/lib/singletons'
|
||||
import { submitAndAwaitTextToKcl } from '@src/lib/textToCad'
|
||||
import { err, reject, reportRejection, trap } from '@src/lib/trap'
|
||||
import type { IndexLoaderData } from '@src/lib/types'
|
||||
import { platform, uuidv4 } from '@src/lib/utils'
|
||||
import { useSettings, useToken } from '@src/machines/appMachine'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
import { kclEditorActor } from '@src/machines/kclEditorMachine'
|
||||
import {
|
||||
getPersistedContext,
|
||||
modelingMachine,
|
||||
modelingMachineDefaultContext,
|
||||
} from '@src/machines/modelingMachine'
|
||||
|
||||
export const ModelingMachineContext = createContext(
|
||||
{} as {
|
||||
@ -911,7 +901,9 @@ export const ModelingMachineProvider = ({
|
||||
}
|
||||
return Promise.reject(new Error('No sketch'))
|
||||
}
|
||||
const info = await getSketchOrientationDetails(sketch.value)
|
||||
const info = await sceneEntitiesManager.getSketchOrientationDetails(
|
||||
sketch.value
|
||||
)
|
||||
await letEngineAnimateAndSyncCamAfter(
|
||||
engineCommandManager,
|
||||
info?.sketchDetails?.faceId || ''
|
||||
|
@ -1,12 +1,14 @@
|
||||
import { ReactNode } from 'react'
|
||||
import type { IconDefinition } from '@fortawesome/free-solid-svg-icons'
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { ActionIcon } from '@src/components/ActionIcon'
|
||||
import type { CustomIconName } from '@src/components/CustomIcon'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
import { onboardingPaths } from '@src/routes/Onboarding/paths'
|
||||
|
||||
import styles from './ModelingPane.module.css'
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { CustomIconName } from 'components/CustomIcon'
|
||||
import { IconDefinition } from '@fortawesome/free-solid-svg-icons'
|
||||
import { ActionIcon } from 'components/ActionIcon'
|
||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
|
||||
export interface ModelingPaneProps {
|
||||
id: string
|
||||
|
@ -1,20 +1,17 @@
|
||||
import React, {
|
||||
import type { EditorStateConfig, Extension } from '@codemirror/state'
|
||||
import { EditorState, StateEffect } from '@codemirror/state'
|
||||
import { oneDark } from '@codemirror/theme-one-dark'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import {
|
||||
forwardRef,
|
||||
useEffect,
|
||||
useImperativeHandle,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
forwardRef,
|
||||
useImperativeHandle,
|
||||
} from 'react'
|
||||
import {
|
||||
EditorState,
|
||||
EditorStateConfig,
|
||||
Extension,
|
||||
StateEffect,
|
||||
} from '@codemirror/state'
|
||||
import { EditorView } from '@codemirror/view'
|
||||
import { oneDark } from '@codemirror/theme-one-dark'
|
||||
import { isArray } from 'lib/utils'
|
||||
|
||||
import { isArray } from '@src/lib/utils'
|
||||
|
||||
//reference: https://github.com/sachinraja/rodemirror/blob/main/src/use-first-render.ts
|
||||
const useFirstRender = () => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { DebugArtifactGraph } from 'components/DebugArtifactGraph'
|
||||
import { AstExplorer } from '../../AstExplorer'
|
||||
import { EngineCommands } from '../../EngineCommands'
|
||||
import { CamDebugSettings } from 'clientSideScene/ClientSideSceneComp'
|
||||
import { CamDebugSettings } from '@src/clientSideScene/ClientSideSceneComp'
|
||||
import { AstExplorer } from '@src/components/AstExplorer'
|
||||
import { DebugArtifactGraph } from '@src/components/DebugArtifactGraph'
|
||||
import { EngineCommands } from '@src/components/EngineCommands'
|
||||
|
||||
export const DebugPane = () => {
|
||||
return (
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { Menu } from '@headlessui/react'
|
||||
import { PropsWithChildren } from 'react'
|
||||
import { ActionIcon } from 'components/ActionIcon'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
|
||||
import { ActionIcon } from '@src/components/ActionIcon'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
|
||||
import styles from './KclEditorMenu.module.css'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
|
||||
export const FeatureTreeMenu = ({ children }: PropsWithChildren) => {
|
||||
return (
|
||||
|
@ -1,28 +1,35 @@
|
||||
import { Diagnostic } from '@codemirror/lint'
|
||||
import type { Diagnostic } from '@codemirror/lint'
|
||||
import { useMachine, useSelector } from '@xstate/react'
|
||||
import { ContextMenu, ContextMenuItem } from 'components/ContextMenu'
|
||||
import { CustomIcon, CustomIconName } from 'components/CustomIcon'
|
||||
import Loading from 'components/Loading'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import { codeRefFromRange, getArtifactFromRange } from 'lang/std/artifactGraph'
|
||||
import { sourceRangeFromRust } from 'lang/wasm'
|
||||
import type { ComponentProps } from 'react'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import type { Actor, Prop } from 'xstate'
|
||||
|
||||
import type { Operation } from '@rust/kcl-lib/bindings/Operation'
|
||||
|
||||
import { ContextMenu, ContextMenuItem } from '@src/components/ContextMenu'
|
||||
import type { CustomIconName } from '@src/components/CustomIcon'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import Loading from '@src/components/Loading'
|
||||
import { useModelingContext } from '@src/hooks/useModelingContext'
|
||||
import { useKclContext } from '@src/lang/KclProvider'
|
||||
import {
|
||||
codeRefFromRange,
|
||||
getArtifactFromRange,
|
||||
} from '@src/lang/std/artifactGraph'
|
||||
import { sourceRangeFromRust } from '@src/lang/wasm'
|
||||
import {
|
||||
filterOperations,
|
||||
getOperationIcon,
|
||||
getOperationLabel,
|
||||
stdLibMap,
|
||||
} from 'lib/operations'
|
||||
import { editorManager, kclManager } from 'lib/singletons'
|
||||
import { ComponentProps, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { Operation } from '@rust/kcl-lib/bindings/Operation'
|
||||
import { Actor, Prop } from 'xstate'
|
||||
import { featureTreeMachine } from 'machines/featureTreeMachine'
|
||||
} from '@src/lib/operations'
|
||||
import { editorManager, kclManager } from '@src/lib/singletons'
|
||||
import { featureTreeMachine } from '@src/machines/featureTreeMachine'
|
||||
import {
|
||||
editorIsMountedSelector,
|
||||
kclEditorActor,
|
||||
selectionEventSelector,
|
||||
} from 'machines/kclEditorMachine'
|
||||
} from '@src/machines/kclEditorMachine'
|
||||
|
||||
export const FeatureTreePane = () => {
|
||||
const isEditorMounted = useSelector(kclEditorActor, editorIsMountedSelector)
|
||||
|
@ -1,15 +1,17 @@
|
||||
import { Menu } from '@headlessui/react'
|
||||
import { PropsWithChildren } from 'react'
|
||||
import { faArrowUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'
|
||||
import { ActionIcon } from 'components/ActionIcon'
|
||||
import styles from './KclEditorMenu.module.css'
|
||||
import { useConvertToVariable } from 'hooks/useToolbarGuards'
|
||||
import { editorShortcutMeta } from './KclEditorPane'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { Menu } from '@headlessui/react'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
|
||||
import { ActionIcon } from '@src/components/ActionIcon'
|
||||
import { editorShortcutMeta } from '@src/components/ModelingSidebar/ModelingPanes/KclEditorPane'
|
||||
import { useConvertToVariable } from '@src/hooks/useToolbarGuards'
|
||||
import { openExternalBrowserIfDesktop } from '@src/lib/openWindow'
|
||||
import { kclManager } from '@src/lib/singletons'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
|
||||
import styles from './KclEditorMenu.module.css'
|
||||
|
||||
export const KclEditorMenu = ({ children }: PropsWithChildren) => {
|
||||
const { enable: convertToVarEnabled, handleClick: handleConvertToVarClick } =
|
||||
|
@ -1,56 +1,58 @@
|
||||
import { TEST } from 'env'
|
||||
import { Themes, getSystemTheme } from 'lib/theme'
|
||||
import { useEffect, useMemo, useRef } from 'react'
|
||||
import { highlightSelectionMatches, searchKeymap } from '@codemirror/search'
|
||||
import { lineHighlightField } from 'editor/highlightextension'
|
||||
import { onMouseDragMakeANewNumber, onMouseDragRegex } from 'lib/utils'
|
||||
import {
|
||||
lineNumbers,
|
||||
rectangularSelection,
|
||||
highlightActiveLineGutter,
|
||||
highlightSpecialChars,
|
||||
highlightActiveLine,
|
||||
keymap,
|
||||
EditorView,
|
||||
dropCursor,
|
||||
drawSelection,
|
||||
} from '@codemirror/view'
|
||||
import {
|
||||
indentWithTab,
|
||||
defaultKeymap,
|
||||
historyKeymap,
|
||||
history,
|
||||
} from '@codemirror/commands'
|
||||
import { diagnosticCount, lintGutter, lintKeymap } from '@codemirror/lint'
|
||||
import {
|
||||
foldGutter,
|
||||
foldKeymap,
|
||||
bracketMatching,
|
||||
indentOnInput,
|
||||
codeFolding,
|
||||
syntaxHighlighting,
|
||||
defaultHighlightStyle,
|
||||
} from '@codemirror/language'
|
||||
import interact from '@replit/codemirror-interact'
|
||||
import { kclManager, editorManager, codeManager } from 'lib/singletons'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { useLspContext } from 'components/LspProvider'
|
||||
import { Prec, EditorState, Extension, Transaction } from '@codemirror/state'
|
||||
import {
|
||||
closeBrackets,
|
||||
closeBracketsKeymap,
|
||||
completionKeymap,
|
||||
} from '@codemirror/autocomplete'
|
||||
import CodeEditor from './CodeEditor'
|
||||
import { codeManagerHistoryCompartment } from 'lang/codeManager'
|
||||
import {
|
||||
defaultKeymap,
|
||||
history,
|
||||
historyKeymap,
|
||||
indentWithTab,
|
||||
} from '@codemirror/commands'
|
||||
import {
|
||||
bracketMatching,
|
||||
codeFolding,
|
||||
defaultHighlightStyle,
|
||||
foldGutter,
|
||||
foldKeymap,
|
||||
indentOnInput,
|
||||
syntaxHighlighting,
|
||||
} from '@codemirror/language'
|
||||
import { diagnosticCount, lintGutter, lintKeymap } from '@codemirror/lint'
|
||||
import { highlightSelectionMatches, searchKeymap } from '@codemirror/search'
|
||||
import type { Extension } from '@codemirror/state'
|
||||
import { EditorState, Prec, Transaction } from '@codemirror/state'
|
||||
import {
|
||||
EditorView,
|
||||
drawSelection,
|
||||
dropCursor,
|
||||
highlightActiveLine,
|
||||
highlightActiveLineGutter,
|
||||
highlightSpecialChars,
|
||||
keymap,
|
||||
lineNumbers,
|
||||
rectangularSelection,
|
||||
} from '@codemirror/view'
|
||||
import interact from '@replit/codemirror-interact'
|
||||
import { TEST } from '@src/env'
|
||||
import { useSelector } from '@xstate/react'
|
||||
import { useEffect, useMemo, useRef } from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
|
||||
import { useLspContext } from '@src/components/LspProvider'
|
||||
import CodeEditor from '@src/components/ModelingSidebar/ModelingPanes/CodeEditor'
|
||||
import { lineHighlightField } from '@src/editor/highlightextension'
|
||||
import { modelingMachineEvent } from '@src/editor/manager'
|
||||
import { codeManagerHistoryCompartment } from '@src/lang/codeManager'
|
||||
import { codeManager, editorManager, kclManager } from '@src/lib/singletons'
|
||||
import { Themes, getSystemTheme } from '@src/lib/theme'
|
||||
import { onMouseDragMakeANewNumber, onMouseDragRegex } from '@src/lib/utils'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
import {
|
||||
editorIsMountedSelector,
|
||||
kclEditorActor,
|
||||
selectionEventSelector,
|
||||
} from 'machines/kclEditorMachine'
|
||||
import { useSelector } from '@xstate/react'
|
||||
import { modelingMachineEvent } from 'editor/manager'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
} from '@src/machines/kclEditorMachine'
|
||||
|
||||
export const editorShortcutMeta = {
|
||||
formatCode: {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import ReactJson from 'react-json-view'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import { useResolvedTheme } from 'hooks/useResolvedTheme'
|
||||
|
||||
import { useResolvedTheme } from '@src/hooks/useResolvedTheme'
|
||||
import { useKclContext } from '@src/lang/KclProvider'
|
||||
|
||||
const ReactJsonTypeHack = ReactJson as any
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { processMemory } from './MemoryPane'
|
||||
import { enginelessExecutor } from '../../../lib/testHelpers'
|
||||
import { assertParse, initPromise } from '../../../lang/wasm'
|
||||
import { processMemory } from '@src/components/ModelingSidebar/ModelingPanes/MemoryPane'
|
||||
import { assertParse, initPromise } from '@src/lang/wasm'
|
||||
import { enginelessExecutor } from '@src/lib/testHelpers'
|
||||
|
||||
beforeAll(async () => {
|
||||
await initPromise
|
||||
|
@ -1,18 +1,18 @@
|
||||
import { useMemo } from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import ReactJson from 'react-json-view'
|
||||
import { useMemo } from 'react'
|
||||
import {
|
||||
Path,
|
||||
ExtrudeSurface,
|
||||
sketchFromKclValueOptional,
|
||||
VariableMap,
|
||||
} from 'lang/wasm'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import { useResolvedTheme } from 'hooks/useResolvedTheme'
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import { Reason, trap } from 'lib/trap'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
|
||||
import type { ExtrudeSurface } from '@rust/kcl-lib/bindings/ExtrudeSurface'
|
||||
import type { Path } from '@rust/kcl-lib/bindings/Path'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import { useModelingContext } from '@src/hooks/useModelingContext'
|
||||
import { useResolvedTheme } from '@src/hooks/useResolvedTheme'
|
||||
import { useKclContext } from '@src/lang/KclProvider'
|
||||
import type { VariableMap } from '@src/lang/wasm'
|
||||
import { sketchFromKclValueOptional } from '@src/lang/wasm'
|
||||
import { Reason, trap } from '@src/lib/trap'
|
||||
|
||||
export const MemoryPaneMenu = () => {
|
||||
const { variables } = useKclContext()
|
||||
|
@ -1,25 +1,30 @@
|
||||
import { IconDefinition, faBugSlash } from '@fortawesome/free-solid-svg-icons'
|
||||
import { KclEditorMenu } from 'components/ModelingSidebar/ModelingPanes/KclEditorMenu'
|
||||
import { CustomIconName } from 'components/CustomIcon'
|
||||
import { KclEditorPane } from 'components/ModelingSidebar/ModelingPanes/KclEditorPane'
|
||||
import { ModelingPaneHeader } from 'components/ModelingSidebar/ModelingPane'
|
||||
import { MouseEventHandler, ReactNode } from 'react'
|
||||
import { MemoryPane, MemoryPaneMenu } from './MemoryPane'
|
||||
import { LogsPane } from './LoggingPanes'
|
||||
import { DebugPane } from './DebugPane'
|
||||
import type { IconDefinition } from '@fortawesome/free-solid-svg-icons'
|
||||
import { faBugSlash } from '@fortawesome/free-solid-svg-icons'
|
||||
import type { MouseEventHandler, ReactNode } from 'react'
|
||||
import type { ContextFrom } from 'xstate'
|
||||
|
||||
import type { CustomIconName } from '@src/components/CustomIcon'
|
||||
import {
|
||||
FileTreeInner,
|
||||
FileTreeMenu,
|
||||
FileTreeRoot,
|
||||
useFileTreeOperations,
|
||||
} from 'components/FileTree'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import { editorManager } from 'lib/singletons'
|
||||
import { ContextFrom } from 'xstate'
|
||||
import { settingsMachine } from 'machines/settingsMachine'
|
||||
import { FeatureTreePane } from './FeatureTreePane'
|
||||
import { kclErrorsByFilename } from 'lang/errors'
|
||||
import { FeatureTreeMenu } from './FeatureTreeMenu'
|
||||
} from '@src/components/FileTree'
|
||||
import { ModelingPaneHeader } from '@src/components/ModelingSidebar/ModelingPane'
|
||||
import { DebugPane } from '@src/components/ModelingSidebar/ModelingPanes/DebugPane'
|
||||
import { FeatureTreeMenu } from '@src/components/ModelingSidebar/ModelingPanes/FeatureTreeMenu'
|
||||
import { FeatureTreePane } from '@src/components/ModelingSidebar/ModelingPanes/FeatureTreePane'
|
||||
import { KclEditorMenu } from '@src/components/ModelingSidebar/ModelingPanes/KclEditorMenu'
|
||||
import { KclEditorPane } from '@src/components/ModelingSidebar/ModelingPanes/KclEditorPane'
|
||||
import { LogsPane } from '@src/components/ModelingSidebar/ModelingPanes/LoggingPanes'
|
||||
import {
|
||||
MemoryPane,
|
||||
MemoryPaneMenu,
|
||||
} from '@src/components/ModelingSidebar/ModelingPanes/MemoryPane'
|
||||
import type { useKclContext } from '@src/lang/KclProvider'
|
||||
import { kclErrorsByFilename } from '@src/lang/errors'
|
||||
import { editorManager } from '@src/lib/singletons'
|
||||
import type { settingsMachine } from '@src/machines/settingsMachine'
|
||||
|
||||
export type SidebarType =
|
||||
| 'code'
|
||||
|
@ -1,26 +1,26 @@
|
||||
import type { IconDefinition } from '@fortawesome/free-solid-svg-icons'
|
||||
import { Resizable } from 're-resizable'
|
||||
import {
|
||||
MouseEventHandler,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useContext,
|
||||
} from 'react'
|
||||
import type { MouseEventHandler } from 'react'
|
||||
import { useCallback, useContext, useEffect, useMemo } from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { SidebarAction, SidebarType, sidebarPanes } from './ModelingPanes'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { ActionIcon } from 'components/ActionIcon'
|
||||
import { ModelingPane } from './ModelingPane'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { CustomIconName } from 'components/CustomIcon'
|
||||
import { IconDefinition } from '@fortawesome/free-solid-svg-icons'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import { MachineManagerContext } from 'components/MachineManagerProvider'
|
||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||
import { SIDEBAR_BUTTON_SUFFIX } from 'lib/constants'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
|
||||
import { ActionIcon } from '@src/components/ActionIcon'
|
||||
import type { CustomIconName } from '@src/components/CustomIcon'
|
||||
import { MachineManagerContext } from '@src/components/MachineManagerProvider'
|
||||
import { ModelingPane } from '@src/components/ModelingSidebar/ModelingPane'
|
||||
import type {
|
||||
SidebarAction,
|
||||
SidebarType,
|
||||
} from '@src/components/ModelingSidebar/ModelingPanes'
|
||||
import { sidebarPanes } from '@src/components/ModelingSidebar/ModelingPanes'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import { useModelingContext } from '@src/hooks/useModelingContext'
|
||||
import { useKclContext } from '@src/lang/KclProvider'
|
||||
import { SIDEBAR_BUTTON_SUFFIX } from '@src/lib/constants'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
import { onboardingPaths } from '@src/routes/Onboarding/paths'
|
||||
|
||||
interface ModelingSidebarProps {
|
||||
paneOpacity: '' | 'opacity-20' | 'opacity-40'
|
||||
@ -113,17 +113,20 @@ export function ModelingSidebar({ paneOpacity }: ModelingSidebarProps) {
|
||||
)
|
||||
|
||||
const paneBadgeMap: Record<SidebarType, BadgeInfoComputed> = useMemo(() => {
|
||||
return filteredPanes.reduce((acc, pane) => {
|
||||
if (pane.showBadge) {
|
||||
acc[pane.id] = {
|
||||
value: pane.showBadge.value(paneCallbackProps),
|
||||
onClick: pane.showBadge.onClick,
|
||||
className: pane.showBadge.className,
|
||||
title: pane.showBadge.title,
|
||||
return filteredPanes.reduce(
|
||||
(acc, pane) => {
|
||||
if (pane.showBadge) {
|
||||
acc[pane.id] = {
|
||||
value: pane.showBadge.value(paneCallbackProps),
|
||||
onClick: pane.showBadge.onClick,
|
||||
className: pane.showBadge.className,
|
||||
title: pane.showBadge.title,
|
||||
}
|
||||
}
|
||||
}
|
||||
return acc
|
||||
}, {} as Record<SidebarType, BadgeInfoComputed>)
|
||||
return acc
|
||||
},
|
||||
{} as Record<SidebarType, BadgeInfoComputed>
|
||||
)
|
||||
}, [paneCallbackProps])
|
||||
|
||||
// Clear any hidden panes from the `openPanes` array
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
|
||||
import {
|
||||
NETWORK_HEALTH_TEXT,
|
||||
NetworkHealthIndicator,
|
||||
} from './NetworkHealthIndicator'
|
||||
import { NetworkHealthState } from 'hooks/useNetworkStatus'
|
||||
} from '@src/components/NetworkHealthIndicator'
|
||||
import { NetworkHealthState } from '@src/hooks/useNetworkStatus'
|
||||
|
||||
function TestWrap({ children }: { children: React.ReactNode }) {
|
||||
// wrap in router and xState context
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Popover } from '@headlessui/react'
|
||||
import { ActionIcon, ActionIconProps } from './ActionIcon'
|
||||
import Tooltip from './Tooltip'
|
||||
import { ConnectingTypeGroup } from '../lang/std/engineConnection'
|
||||
import { useNetworkContext } from '../hooks/useNetworkContext'
|
||||
import { NetworkHealthState } from '../hooks/useNetworkStatus'
|
||||
import { toSync } from 'lib/utils'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
|
||||
import type { ActionIconProps } from '@src/components/ActionIcon'
|
||||
import { ActionIcon } from '@src/components/ActionIcon'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import { useNetworkContext } from '@src/hooks/useNetworkContext'
|
||||
import { NetworkHealthState } from '@src/hooks/useNetworkStatus'
|
||||
import type { ConnectingTypeGroup } from '@src/lang/std/engineConnection'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { toSync } from '@src/lib/utils'
|
||||
|
||||
export const NETWORK_HEALTH_TEXT: Record<NetworkHealthState, string> = {
|
||||
[NetworkHealthState.Ok]: 'Connected',
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { Popover } from '@headlessui/react'
|
||||
import { useContext } from 'react'
|
||||
import Tooltip from './Tooltip'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { components } from 'lib/machine-api'
|
||||
import { MachineManagerContext } from 'components/MachineManagerProvider'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import { MachineManagerContext } from '@src/components/MachineManagerProvider'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import type { components } from '@src/lib/machine-api'
|
||||
|
||||
export const NetworkMachineIndicator = ({
|
||||
className,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { BrowserRouter, Route, Routes } from 'react-router-dom'
|
||||
import { OpenInDesktopAppHandler } from './OpenInDesktopAppHandler'
|
||||
|
||||
import { OpenInDesktopAppHandler } from '@src/components/OpenInDesktopAppHandler'
|
||||
|
||||
/**
|
||||
* The behavior under test requires a router,
|
||||
|
@ -1,11 +1,14 @@
|
||||
import { getSystemTheme, Themes } from 'lib/theme'
|
||||
import { ZOO_STUDIO_PROTOCOL } from 'lib/constants'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { useSearchParams } from 'react-router-dom'
|
||||
import { ASK_TO_OPEN_QUERY_PARAM } from 'lib/constants'
|
||||
import { VITE_KC_SITE_BASE_URL } from 'env'
|
||||
import { ActionButton } from './ActionButton'
|
||||
import { Transition } from '@headlessui/react'
|
||||
import { VITE_KC_SITE_BASE_URL } from '@src/env'
|
||||
import { useSearchParams } from 'react-router-dom'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import {
|
||||
ASK_TO_OPEN_QUERY_PARAM,
|
||||
ZOO_STUDIO_PROTOCOL,
|
||||
} from '@src/lib/constants'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { Themes, getSystemTheme } from '@src/lib/theme'
|
||||
|
||||
/**
|
||||
* This component is a handler that checks if a certain query parameter
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Dialog } from '@headlessui/react'
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
|
||||
type DeleteConfirmationDialogProps = React.PropsWithChildren<{
|
||||
title: string
|
||||
|
@ -1,15 +1,17 @@
|
||||
import { FormEvent, useEffect, useRef, useState } from 'react'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { ActionButton } from '../ActionButton'
|
||||
import { FILE_EXT, PROJECT_IMAGE_NAME } from 'lib/constants'
|
||||
import type { FormEvent } from 'react'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import Tooltip from '../Tooltip'
|
||||
import { DeleteConfirmationDialog } from './DeleteProjectDialog'
|
||||
import { ProjectCardRenameForm } from './ProjectCardRenameForm'
|
||||
import { Project } from 'lib/project'
|
||||
import { toSync } from 'lib/utils'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { DeleteConfirmationDialog } from '@src/components/ProjectCard/DeleteProjectDialog'
|
||||
import { ProjectCardRenameForm } from '@src/components/ProjectCard/ProjectCardRenameForm'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import { FILE_EXT, PROJECT_IMAGE_NAME } from '@src/lib/constants'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import type { Project } from '@src/lib/project'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { toSync } from '@src/lib/utils'
|
||||
|
||||
function ProjectCard({
|
||||
project,
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { HTMLProps, forwardRef } from 'react'
|
||||
import { Project } from 'lib/project'
|
||||
import type { HTMLProps } from 'react'
|
||||
import { forwardRef } from 'react'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import type { Project } from '@src/lib/project'
|
||||
|
||||
interface ProjectCardRenameFormProps extends HTMLProps<HTMLFormElement> {
|
||||
project: Project
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { Project } from 'lib/project'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import Fuse from 'fuse.js'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import Fuse from 'fuse.js'
|
||||
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import type { Project } from '@src/lib/project'
|
||||
|
||||
export function useProjectSearch(projects: Project[]) {
|
||||
const [query, setQuery] = useState('')
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
import ProjectSidebarMenu from './ProjectSidebarMenu'
|
||||
import { Project } from 'lib/project'
|
||||
|
||||
import ProjectSidebarMenu from '@src/components/ProjectSidebarMenu'
|
||||
import type { Project } from '@src/lib/project'
|
||||
|
||||
const now = new Date()
|
||||
const projectWellFormed = {
|
||||
|
@ -1,24 +1,30 @@
|
||||
import { Popover, Transition } from '@headlessui/react'
|
||||
import { ActionButton, ActionButtonProps } from './ActionButton'
|
||||
import { type IndexLoaderData } from 'lib/types'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { isDesktop } from '../lib/isDesktop'
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom'
|
||||
import { Fragment, useMemo, useContext } from 'react'
|
||||
import { Logo } from './Logo'
|
||||
import { APP_NAME } from 'lib/constants'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import { useLspContext } from './LspProvider'
|
||||
import { codeManager, engineCommandManager, kclManager } from 'lib/singletons'
|
||||
import { MachineManagerContext } from 'components/MachineManagerProvider'
|
||||
import usePlatform from 'hooks/usePlatform'
|
||||
import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath'
|
||||
import Tooltip from './Tooltip'
|
||||
import { SnapshotFrom } from 'xstate'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { useSelector } from '@xstate/react'
|
||||
import { copyFileShareLink } from 'lib/links'
|
||||
import { useToken } from 'machines/appMachine'
|
||||
import { Fragment, useContext, useMemo } from 'react'
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom'
|
||||
import type { SnapshotFrom } from 'xstate'
|
||||
|
||||
import type { ActionButtonProps } from '@src/components/ActionButton'
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import { Logo } from '@src/components/Logo'
|
||||
import { useLspContext } from '@src/components/LspProvider'
|
||||
import { MachineManagerContext } from '@src/components/MachineManagerProvider'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import { useAbsoluteFilePath } from '@src/hooks/useAbsoluteFilePath'
|
||||
import usePlatform from '@src/hooks/usePlatform'
|
||||
import { APP_NAME } from '@src/lib/constants'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { copyFileShareLink } from '@src/lib/links'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import {
|
||||
codeManager,
|
||||
engineCommandManager,
|
||||
kclManager,
|
||||
} from '@src/lib/singletons'
|
||||
import { type IndexLoaderData } from '@src/lib/types'
|
||||
import { useToken } from '@src/machines/appMachine'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
|
||||
const ProjectSidebarMenu = ({
|
||||
project,
|
||||
|
@ -1,39 +1,41 @@
|
||||
import { useMachine } from '@xstate/react'
|
||||
import { useFileSystemWatcher } from 'hooks/useFileSystemWatcher'
|
||||
import { useProjectsLoader } from 'hooks/useProjectsLoader'
|
||||
import { projectsMachine } from 'machines/projectsMachine'
|
||||
import { createContext, useCallback, useEffect, useState } from 'react'
|
||||
import { Actor, AnyStateMachine, fromPromise, Prop, StateFrom } from 'xstate'
|
||||
import { useLspContext } from './LspProvider'
|
||||
import toast from 'react-hot-toast'
|
||||
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import {
|
||||
createNewProjectDirectory,
|
||||
listProjects,
|
||||
renameProjectDirectory,
|
||||
} from 'lib/desktop'
|
||||
import {
|
||||
getNextProjectIndex,
|
||||
interpolateProjectNameWithIndex,
|
||||
doesProjectNameNeedInterpolated,
|
||||
getUniqueProjectName,
|
||||
getNextFileName,
|
||||
} from 'lib/desktopFS'
|
||||
import useStateMachineCommands from 'hooks/useStateMachineCommands'
|
||||
import { projectsCommandBarConfig } from 'lib/commandBarConfigs/projectsCommandConfig'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
import type { Actor, AnyStateMachine, Prop, StateFrom } from 'xstate'
|
||||
import { fromPromise } from 'xstate'
|
||||
|
||||
import { useLspContext } from '@src/components/LspProvider'
|
||||
import { useFileSystemWatcher } from '@src/hooks/useFileSystemWatcher'
|
||||
import { useProjectsLoader } from '@src/hooks/useProjectsLoader'
|
||||
import useStateMachineCommands from '@src/hooks/useStateMachineCommands'
|
||||
import { newKclFile } from '@src/lang/project'
|
||||
import { projectsCommandBarConfig } from '@src/lib/commandBarConfigs/projectsCommandConfig'
|
||||
import {
|
||||
CREATE_FILE_URL_PARAM,
|
||||
FILE_EXT,
|
||||
PROJECT_ENTRYPOINT,
|
||||
} from 'lib/constants'
|
||||
import { codeManager, kclManager } from 'lib/singletons'
|
||||
import { Project } from 'lib/project'
|
||||
import { newKclFile } from 'lang/project'
|
||||
import { err } from 'lib/trap'
|
||||
} from '@src/lib/constants'
|
||||
import {
|
||||
createNewProjectDirectory,
|
||||
listProjects,
|
||||
renameProjectDirectory,
|
||||
} from '@src/lib/desktop'
|
||||
import {
|
||||
doesProjectNameNeedInterpolated,
|
||||
getNextFileName,
|
||||
getNextProjectIndex,
|
||||
getUniqueProjectName,
|
||||
interpolateProjectNameWithIndex,
|
||||
} from '@src/lib/desktopFS'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import type { Project } from '@src/lib/project'
|
||||
import { codeManager, kclManager } from '@src/lib/singletons'
|
||||
import { err } from '@src/lib/trap'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
import { projectsMachine } from '@src/machines/projectsMachine'
|
||||
|
||||
type MachineContext<T extends AnyStateMachine> = {
|
||||
state?: StateFrom<T>
|
||||
@ -382,8 +384,8 @@ const ProjectsContextDesktop = ({
|
||||
input.method === 'newProject'
|
||||
? PROJECT_ENTRYPOINT
|
||||
: input.name.endsWith(FILE_EXT)
|
||||
? input.name
|
||||
: input.name + FILE_EXT
|
||||
? input.name
|
||||
: input.name + FILE_EXT
|
||||
let message = 'File created successfully'
|
||||
|
||||
const needsInterpolated = doesProjectNameNeedInterpolated(projectName)
|
||||
|
@ -1,16 +1,20 @@
|
||||
import { coreDump } from 'lang/wasm'
|
||||
import { CoreDumpManager } from 'lib/coredump'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
import { codeManager, engineCommandManager } from 'lib/singletons'
|
||||
import React, { useMemo } from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import Tooltip from './Tooltip'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { toSync } from 'lib/utils'
|
||||
import { useToken } from 'machines/appMachine'
|
||||
import { rustContext } from 'lib/singletons'
|
||||
import type { WebContentSendPayload } from '../menu/channels'
|
||||
import { useMenuListener } from 'hooks/useMenu'
|
||||
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import { useMenuListener } from '@src/hooks/useMenu'
|
||||
import { coreDump } from '@src/lang/wasm'
|
||||
import { CoreDumpManager } from '@src/lib/coredump'
|
||||
import {
|
||||
codeManager,
|
||||
engineCommandManager,
|
||||
rustContext,
|
||||
} from '@src/lib/singletons'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { toSync } from '@src/lib/utils'
|
||||
import { useToken } from '@src/machines/appMachine'
|
||||
import type { WebContentSendPayload } from '@src/menu/channels'
|
||||
|
||||
export const RefreshButton = ({ children }: React.PropsWithChildren) => {
|
||||
const token = useToken()
|
||||
|
@ -1,22 +1,24 @@
|
||||
import { useEffect, useState, createContext, ReactNode } from 'react'
|
||||
import type { ReactNode } from 'react'
|
||||
import { createContext, useEffect, useState } from 'react'
|
||||
import {
|
||||
useNavigation,
|
||||
useLocation,
|
||||
useNavigate,
|
||||
useNavigation,
|
||||
useRouteLoaderData,
|
||||
} from 'react-router-dom'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { markOnce } from 'lib/performance'
|
||||
import { useAuthNavigation } from 'hooks/useAuthNavigation'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
import { IndexLoaderData } from 'lib/types'
|
||||
import { getAppSettingsFilePath } from 'lib/desktop'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { trap } from 'lib/trap'
|
||||
import { useFileSystemWatcher } from 'hooks/useFileSystemWatcher'
|
||||
import { loadAndValidateSettings } from 'lib/settings/settingsUtils'
|
||||
import { settingsActor } from 'machines/appMachine'
|
||||
import { OnboardingStatus } from '@rust/kcl-lib/bindings/OnboardingStatus'
|
||||
|
||||
import type { OnboardingStatus } from '@rust/kcl-lib/bindings/OnboardingStatus'
|
||||
|
||||
import { useAuthNavigation } from '@src/hooks/useAuthNavigation'
|
||||
import { useFileSystemWatcher } from '@src/hooks/useFileSystemWatcher'
|
||||
import { getAppSettingsFilePath } from '@src/lib/desktop'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import { markOnce } from '@src/lib/performance'
|
||||
import { loadAndValidateSettings } from '@src/lib/settings/settingsUtils'
|
||||
import { trap } from '@src/lib/trap'
|
||||
import type { IndexLoaderData } from '@src/lib/types'
|
||||
import { settingsActor, useSettings } from '@src/machines/appMachine'
|
||||
|
||||
export const RouteProviderContext = createContext({})
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
import { Dialog, Transition } from '@headlessui/react'
|
||||
import { Fragment, useState } from 'react'
|
||||
import { type InstanceProps, create } from 'react-modal-promise'
|
||||
import { Expr } from '../lang/wasm'
|
||||
|
||||
import {
|
||||
AvailableVars,
|
||||
addToInputHelper,
|
||||
CalcResult,
|
||||
CreateNewVariable,
|
||||
} from './AvailableVarsHelpers'
|
||||
import { useCalculateKclExpression } from 'lib/useCalculateKclExpression'
|
||||
addToInputHelper,
|
||||
} from '@src/components/AvailableVarsHelpers'
|
||||
import type { Expr } from '@src/lang/wasm'
|
||||
import { useCalculateKclExpression } from '@src/lib/useCalculateKclExpression'
|
||||
|
||||
type ModalResolve = {
|
||||
value: string
|
||||
|
@ -1,14 +1,15 @@
|
||||
import { Dialog, Transition } from '@headlessui/react'
|
||||
import { Fragment, useState } from 'react'
|
||||
import { type InstanceProps, create } from 'react-modal-promise'
|
||||
import { Expr } from '../lang/wasm'
|
||||
|
||||
import {
|
||||
AvailableVars,
|
||||
addToInputHelper,
|
||||
CalcResult,
|
||||
CreateNewVariable,
|
||||
} from './AvailableVarsHelpers'
|
||||
import { useCalculateKclExpression } from 'lib/useCalculateKclExpression'
|
||||
addToInputHelper,
|
||||
} from '@src/components/AvailableVarsHelpers'
|
||||
import type { Expr } from '@src/lang/wasm'
|
||||
import { useCalculateKclExpression } from '@src/lib/useCalculateKclExpression'
|
||||
|
||||
type ModalResolve = {
|
||||
value: string
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { Dialog, Transition } from '@headlessui/react'
|
||||
import { Fragment } from 'react'
|
||||
import { CreateNewVariable } from './AvailableVarsHelpers'
|
||||
import { ActionButton } from './ActionButton'
|
||||
import { toast } from 'react-hot-toast'
|
||||
import { type InstanceProps, create } from 'react-modal-promise'
|
||||
import { useCalculateKclExpression } from 'lib/useCalculateKclExpression'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { CreateNewVariable } from '@src/components/AvailableVarsHelpers'
|
||||
import { useCalculateKclExpression } from '@src/lib/useCalculateKclExpression'
|
||||
|
||||
type ModalResolve = { variableName: string }
|
||||
type ModalReject = boolean
|
||||
|
@ -1,10 +1,12 @@
|
||||
import type { ForwardedRef } from 'react'
|
||||
import { forwardRef } from 'react'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
|
||||
import type { InteractionMapItem } from '@src/lib/settings/initialKeybindings'
|
||||
import {
|
||||
InteractionMapItem,
|
||||
interactionMap,
|
||||
sortInteractionMapByCategory,
|
||||
} from 'lib/settings/initialKeybindings'
|
||||
import { ForwardedRef, forwardRef } from 'react'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
} from '@src/lib/settings/initialKeybindings'
|
||||
|
||||
type AllKeybindingsFieldsProps = object
|
||||
|
||||
|
@ -1,31 +1,36 @@
|
||||
import { useSelector } from '@xstate/react'
|
||||
import decamelize from 'decamelize'
|
||||
import { Setting } from 'lib/settings/initialSettings'
|
||||
import { SetEventTypes, SettingsLevel } from 'lib/settings/settingsTypes'
|
||||
import {
|
||||
shouldHideSetting,
|
||||
shouldShowSettingInput,
|
||||
} from 'lib/settings/settingsUtils'
|
||||
import { Fragment } from 'react/jsx-runtime'
|
||||
import { SettingsSection } from './SettingsSection'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import { SettingsFieldInput } from './SettingsFieldInput'
|
||||
import type { ForwardedRef } from 'react'
|
||||
import { forwardRef, useEffect, useMemo } from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import { APP_VERSION, IS_NIGHTLY, getReleaseUrl } from 'routes/Settings'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
import { Fragment } from 'react/jsx-runtime'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { useLspContext } from '@src/components/LspProvider'
|
||||
import { SettingsFieldInput } from '@src/components/Settings/SettingsFieldInput'
|
||||
import { SettingsSection } from '@src/components/Settings/SettingsSection'
|
||||
import { useDotDotSlash } from '@src/hooks/useDotDotSlash'
|
||||
import {
|
||||
createAndOpenNewTutorialProject,
|
||||
getSettingsFolderPaths,
|
||||
} from 'lib/desktopFS'
|
||||
import { useDotDotSlash } from 'hooks/useDotDotSlash'
|
||||
import { ForwardedRef, forwardRef, useEffect, useMemo } from 'react'
|
||||
import { useLspContext } from 'components/LspProvider'
|
||||
import { toSync } from 'lib/utils'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||
import { settingsActor, useSettings } from 'machines/appMachine'
|
||||
import { useSelector } from '@xstate/react'
|
||||
} from '@src/lib/desktopFS'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { openExternalBrowserIfDesktop } from '@src/lib/openWindow'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import type { Setting } from '@src/lib/settings/initialSettings'
|
||||
import type {
|
||||
SetEventTypes,
|
||||
SettingsLevel,
|
||||
} from '@src/lib/settings/settingsTypes'
|
||||
import {
|
||||
shouldHideSetting,
|
||||
shouldShowSettingInput,
|
||||
} from '@src/lib/settings/settingsUtils'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { toSync } from '@src/lib/utils'
|
||||
import { settingsActor, useSettings } from '@src/machines/appMachine'
|
||||
import { APP_VERSION, IS_NIGHTLY, getReleaseUrl } from '@src/routes/Settings'
|
||||
|
||||
interface AllSettingsFieldsProps {
|
||||
searchParamTab: SettingsLevel
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {
|
||||
interactionMap,
|
||||
sortInteractionMapByCategory,
|
||||
} from 'lib/settings/initialKeybindings'
|
||||
} from '@src/lib/settings/initialKeybindings'
|
||||
|
||||
interface KeybindingSectionsListProps {
|
||||
scrollRef: React.RefObject<HTMLDivElement>
|
||||
|
@ -1,14 +1,15 @@
|
||||
import { Toggle } from 'components/Toggle/Toggle'
|
||||
import { Setting } from 'lib/settings/initialSettings'
|
||||
import {
|
||||
import { useMemo } from 'react'
|
||||
import type { EventFrom } from 'xstate'
|
||||
|
||||
import { Toggle } from '@src/components/Toggle/Toggle'
|
||||
import type { Setting } from '@src/lib/settings/initialSettings'
|
||||
import type {
|
||||
SetEventTypes,
|
||||
SettingsLevel,
|
||||
WildcardSetEvent,
|
||||
} from 'lib/settings/settingsTypes'
|
||||
import { getSettingInputType } from 'lib/settings/settingsUtils'
|
||||
import { settingsActor, useSettings } from 'machines/appMachine'
|
||||
import { useMemo } from 'react'
|
||||
import { EventFrom } from 'xstate'
|
||||
} from '@src/lib/settings/settingsTypes'
|
||||
import { getSettingInputType } from '@src/lib/settings/settingsUtils'
|
||||
import { settingsActor, useSettings } from '@src/machines/appMachine'
|
||||
|
||||
interface SettingsFieldInputProps {
|
||||
// We don't need the fancy types here,
|
||||
|
@ -1,14 +1,15 @@
|
||||
import { Combobox } from '@headlessui/react'
|
||||
import { CustomIcon } from 'components/CustomIcon'
|
||||
import decamelize from 'decamelize'
|
||||
import Fuse from 'fuse.js'
|
||||
import { interactionMap } from 'lib/settings/initialKeybindings'
|
||||
import { SettingsLevel } from 'lib/settings/settingsTypes'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import { interactionMap } from '@src/lib/settings/initialKeybindings'
|
||||
import type { SettingsLevel } from '@src/lib/settings/settingsTypes'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
|
||||
type ExtendedSettingsLevel = SettingsLevel | 'keybindings'
|
||||
|
||||
export type SettingsSearchItem = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { CustomIcon } from 'components/CustomIcon'
|
||||
import Tooltip from 'components/Tooltip'
|
||||
import { SettingsLevel } from 'lib/settings/settingsTypes'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
import Tooltip from '@src/components/Tooltip'
|
||||
import type { SettingsLevel } from '@src/lib/settings/settingsTypes'
|
||||
|
||||
interface SettingsSectionProps extends React.HTMLProps<HTMLDivElement> {
|
||||
title: string
|
||||
|
@ -1,8 +1,9 @@
|
||||
import decamelize from 'decamelize'
|
||||
import { Setting } from 'lib/settings/initialSettings'
|
||||
import { SettingsLevel } from 'lib/settings/settingsTypes'
|
||||
import { shouldHideSetting } from 'lib/settings/settingsUtils'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
|
||||
import type { Setting } from '@src/lib/settings/initialSettings'
|
||||
import type { SettingsLevel } from '@src/lib/settings/settingsTypes'
|
||||
import { shouldHideSetting } from '@src/lib/settings/settingsUtils'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
|
||||
interface SettingsSectionsListProps {
|
||||
searchParamTab: SettingsLevel
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { CustomIcon, CustomIconName } from 'components/CustomIcon'
|
||||
import type { CustomIconName } from '@src/components/CustomIcon'
|
||||
import { CustomIcon } from '@src/components/CustomIcon'
|
||||
|
||||
interface SettingsTabButtonProps {
|
||||
checked: boolean
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { RadioGroup } from '@headlessui/react'
|
||||
import { SettingsTabButton } from './SettingsTabButton'
|
||||
|
||||
import { SettingsTabButton } from '@src/components/Settings/SettingsTabButton'
|
||||
|
||||
interface SettingsTabButtonProps {
|
||||
value: string
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { SVGProps } from 'react'
|
||||
import type { SVGProps } from 'react'
|
||||
|
||||
export const Spinner = (props: SVGProps<SVGSVGElement>) => {
|
||||
return (
|
||||
|
@ -1,26 +1,32 @@
|
||||
import { MouseEventHandler, useEffect, useRef, useState } from 'react'
|
||||
import Loading from './Loading'
|
||||
import { useModelingContext } from 'hooks/useModelingContext'
|
||||
import { useNetworkContext } from 'hooks/useNetworkContext'
|
||||
import { NetworkHealthState } from 'hooks/useNetworkStatus'
|
||||
import { ClientSideScene } from 'clientSideScene/ClientSideSceneComp'
|
||||
import { btnName } from 'lib/cameraControls'
|
||||
import { sendSelectEventToEngine } from 'lib/selections'
|
||||
import { kclManager, engineCommandManager, sceneInfra } from 'lib/singletons'
|
||||
import { useAppStream } from 'AppState'
|
||||
import { useAppStream } from '@src/AppState'
|
||||
import type { MouseEventHandler } from 'react'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useRouteLoaderData } from 'react-router-dom'
|
||||
|
||||
import { ClientSideScene } from '@src/clientSideScene/ClientSideSceneComp'
|
||||
import Loading from '@src/components/Loading'
|
||||
import { ViewControlContextMenu } from '@src/components/ViewControlMenu'
|
||||
import { useModelingContext } from '@src/hooks/useModelingContext'
|
||||
import { useNetworkContext } from '@src/hooks/useNetworkContext'
|
||||
import { NetworkHealthState } from '@src/hooks/useNetworkStatus'
|
||||
import { getArtifactOfTypes } from '@src/lang/std/artifactGraph'
|
||||
import {
|
||||
DisconnectingType,
|
||||
EngineCommandManagerEvents,
|
||||
EngineConnectionStateType,
|
||||
DisconnectingType,
|
||||
} from 'lang/std/engineConnection'
|
||||
import { useRouteLoaderData } from 'react-router-dom'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import { IndexLoaderData } from 'lib/types'
|
||||
import { err, reportRejection } from 'lib/trap'
|
||||
import { getArtifactOfTypes } from 'lang/std/artifactGraph'
|
||||
import { ViewControlContextMenu } from './ViewControlMenu'
|
||||
import { useCommandBarState } from 'machines/commandBarMachine'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
} from '@src/lang/std/engineConnection'
|
||||
import { btnName } from '@src/lib/cameraControls'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import { sendSelectEventToEngine } from '@src/lib/selections'
|
||||
import {
|
||||
engineCommandManager,
|
||||
kclManager,
|
||||
sceneInfra,
|
||||
} from '@src/lib/singletons'
|
||||
import { err, reportRejection } from '@src/lib/trap'
|
||||
import type { IndexLoaderData } from '@src/lib/types'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
import { useCommandBarState } from '@src/machines/commandBarMachine'
|
||||
|
||||
enum StreamState {
|
||||
Playing = 'playing',
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { getMarks } from 'lib/performance'
|
||||
|
||||
import { getMarks } from '@src/lib/performance'
|
||||
import {
|
||||
printDeltaTotal,
|
||||
printInvocationCount,
|
||||
printMarkDownTable,
|
||||
printRawMarks,
|
||||
} from 'lib/telemetry'
|
||||
} from '@src/lib/telemetry'
|
||||
|
||||
export function TelemetryExplorer() {
|
||||
const marks = getMarks()
|
||||
|
@ -1,14 +1,10 @@
|
||||
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
|
||||
import { useFileContext } from 'hooks/useFileContext'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { PATHS } from 'lib/paths'
|
||||
import toast from 'react-hot-toast'
|
||||
import {
|
||||
TextToCad_type,
|
||||
import type {
|
||||
TextToCadIteration_type,
|
||||
TextToCad_type,
|
||||
} from '@kittycad/lib/dist/types/src/models'
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import type { Mesh } from 'three'
|
||||
import {
|
||||
Box3,
|
||||
Color,
|
||||
@ -16,24 +12,29 @@ import {
|
||||
EdgesGeometry,
|
||||
LineBasicMaterial,
|
||||
LineSegments,
|
||||
Mesh,
|
||||
MeshBasicMaterial,
|
||||
OrthographicCamera,
|
||||
Scene,
|
||||
Vector3,
|
||||
WebGLRenderer,
|
||||
} from 'three'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
|
||||
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader'
|
||||
import { base64Decode } from 'lang/wasm'
|
||||
import { sendTelemetry } from 'lib/textToCad'
|
||||
import { Themes } from 'lib/theme'
|
||||
import { ActionButton } from './ActionButton'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { EventFrom } from 'xstate'
|
||||
import { fileMachine } from 'machines/fileMachine'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { codeManager, kclManager } from 'lib/singletons'
|
||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
|
||||
import type { EventFrom } from 'xstate'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import type { useFileContext } from '@src/hooks/useFileContext'
|
||||
import { base64Decode } from '@src/lang/wasm'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { openExternalBrowserIfDesktop } from '@src/lib/openWindow'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import { codeManager, kclManager } from '@src/lib/singletons'
|
||||
import { sendTelemetry } from '@src/lib/textToCad'
|
||||
import type { Themes } from '@src/lib/theme'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { commandBarActor } from '@src/machines/commandBarMachine'
|
||||
import type { fileMachine } from '@src/machines/fileMachine'
|
||||
|
||||
const CANVAS_SIZE = 128
|
||||
const PROMPT_TRUNCATE_LENGTH = 128
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { vi } from 'vitest'
|
||||
import { ToastUpdate } from './ToastUpdate'
|
||||
|
||||
import { ToastUpdate } from '@src/components/ToastUpdate'
|
||||
|
||||
describe('ToastUpdate tests', () => {
|
||||
const testData = {
|
||||
|
@ -1,9 +1,11 @@
|
||||
import type { MarkedOptions } from '@ts-stack/markdown'
|
||||
import { Marked, escape, unescape } from '@ts-stack/markdown'
|
||||
import toast from 'react-hot-toast'
|
||||
import { ActionButton } from './ActionButton'
|
||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||
import { escape, Marked, MarkedOptions, unescape } from '@ts-stack/markdown'
|
||||
import { getReleaseUrl } from 'routes/Settings'
|
||||
import { SafeRenderer } from 'lib/markdown'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { SafeRenderer } from '@src/lib/markdown'
|
||||
import { openExternalBrowserIfDesktop } from '@src/lib/openWindow'
|
||||
import { getReleaseUrl } from '@src/routes/Settings'
|
||||
|
||||
export function ToastUpdate({
|
||||
version,
|
||||
|
@ -1,17 +1,17 @@
|
||||
import { toolTips } from 'lang/langHelpers'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||
import { getNodeFromPath } from '../../lang/queryAst'
|
||||
import { getNodePathFromSourceRange } from 'lang/queryAstNodePathUtils'
|
||||
import { isSketchVariablesLinked } from '../../lang/std/sketchConstraints'
|
||||
import { toolTips } from '@src/lang/langHelpers'
|
||||
import { getNodeFromPath } from '@src/lang/queryAst'
|
||||
import { getNodePathFromSourceRange } from '@src/lang/queryAstNodePathUtils'
|
||||
import { isSketchVariablesLinked } from '@src/lang/std/sketchConstraints'
|
||||
import type { PathToNodeMap } from '@src/lang/std/sketchcombos'
|
||||
import {
|
||||
transformSecondarySketchLinesTagFirst,
|
||||
getTransformInfos,
|
||||
PathToNodeMap,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
transformSecondarySketchLinesTagFirst,
|
||||
} from '@src/lang/std/sketchcombos'
|
||||
import type { TransformInfo } from '@src/lang/std/stdTypes'
|
||||
import type { Expr, Program, VariableDeclarator } from '@src/lang/wasm'
|
||||
import type { Selections } from '@src/lib/selections'
|
||||
import { kclManager } from '@src/lib/singletons'
|
||||
import { err } from '@src/lib/trap'
|
||||
|
||||
export function equalAngleInfo({
|
||||
selectionRanges,
|
||||
|
@ -1,17 +1,18 @@
|
||||
import { toolTips } from 'lang/langHelpers'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||
import { getNodeFromPath } from '../../lang/queryAst'
|
||||
import { isSketchVariablesLinked } from '../../lang/std/sketchConstraints'
|
||||
import type { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
|
||||
import { toolTips } from '@src/lang/langHelpers'
|
||||
import { getNodeFromPath } from '@src/lang/queryAst'
|
||||
import { isSketchVariablesLinked } from '@src/lang/std/sketchConstraints'
|
||||
import type { PathToNodeMap } from '@src/lang/std/sketchcombos'
|
||||
import {
|
||||
transformSecondarySketchLinesTagFirst,
|
||||
getTransformInfos,
|
||||
PathToNodeMap,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
transformSecondarySketchLinesTagFirst,
|
||||
} from '@src/lang/std/sketchcombos'
|
||||
import type { TransformInfo } from '@src/lang/std/stdTypes'
|
||||
import type { Expr, Program, VariableDeclarator } from '@src/lang/wasm'
|
||||
import type { Selections } from '@src/lib/selections'
|
||||
import { kclManager } from '@src/lib/singletons'
|
||||
import { err } from '@src/lib/trap'
|
||||
|
||||
export function setEqualLengthInfo({
|
||||
selectionRanges,
|
||||
|
@ -1,16 +1,17 @@
|
||||
import { toolTips } from 'lang/langHelpers'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { Program, Expr, VariableMap } from '../../lang/wasm'
|
||||
import { getNodeFromPath } from '../../lang/queryAst'
|
||||
import type { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
|
||||
import { toolTips } from '@src/lang/langHelpers'
|
||||
import { getNodeFromPath } from '@src/lang/queryAst'
|
||||
import type { PathToNodeMap } from '@src/lang/std/sketchcombos'
|
||||
import {
|
||||
PathToNodeMap,
|
||||
getTransformInfos,
|
||||
transformAstSketchLines,
|
||||
} from '../../lang/std/sketchcombos'
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
} from '@src/lang/std/sketchcombos'
|
||||
import type { TransformInfo } from '@src/lang/std/stdTypes'
|
||||
import type { Expr, Program, VariableMap } from '@src/lang/wasm'
|
||||
import type { Selections } from '@src/lib/selections'
|
||||
import { kclManager } from '@src/lib/singletons'
|
||||
import { err } from '@src/lib/trap'
|
||||
|
||||
export function horzVertInfo(
|
||||
selectionRanges: Selections,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user