sort imports (#6094)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { type IndexLoaderData } from 'lib/types'
|
||||
import { BROWSER_PATH, PATHS } from 'lib/paths'
|
||||
import { type IndexLoaderData } from 'lib/types'
|
||||
import { useRouteLoaderData } from 'react-router-dom'
|
||||
|
||||
export function useAbsoluteFilePath() {
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { base64ToString } from 'lib/base64'
|
||||
import { ProjectsCommandSchema } from 'lib/commandBarConfigs/projectsCommandConfig'
|
||||
import { CREATE_FILE_URL_PARAM, DEFAULT_FILE_NAME } from 'lib/constants'
|
||||
import { useEffect } from 'react'
|
||||
import { useSearchParams } from 'react-router-dom'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { FileLinkParams } from 'lib/links'
|
||||
import { ProjectsCommandSchema } from 'lib/commandBarConfigs/projectsCommandConfig'
|
||||
import { useSettings } from 'machines/appMachine'
|
||||
import { useEffect } from 'react'
|
||||
import { useSearchParams } from 'react-router-dom'
|
||||
|
||||
// For initializing the command arguments, we actually want `method` to be undefined
|
||||
// so that we don't skip it in the command palette.
|
||||
@ -45,8 +45,8 @@ export function useCreateFileLinkQuery(
|
||||
? params.name.replace('.kcl', '')
|
||||
: params.name
|
||||
: isDesktop()
|
||||
? settings.projects.defaultProjectName.current
|
||||
: DEFAULT_FILE_NAME,
|
||||
? settings.projects.defaultProjectName.current
|
||||
: DEFAULT_FILE_NAME,
|
||||
code: params.code || '',
|
||||
method: isDesktop() ? undefined : 'existingProject',
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Based on https://learnersbucket.com/examples/interview/usehasfocus-hook-in-react/
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
export const useDocumentHasFocus = () => {
|
||||
// get the initial state
|
||||
|
||||
@ -1,28 +1,29 @@
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { getFaceDetails } from 'clientSideScene/sceneEntities'
|
||||
import { getNodeFromPath } from 'lang/queryAst'
|
||||
import { getNodePathFromSourceRange } from 'lang/queryAstNodePathUtils'
|
||||
import {
|
||||
SegmentArtifact,
|
||||
getArtifactOfTypes,
|
||||
getCapCodeRef,
|
||||
getCodeRefsByArtifactId,
|
||||
getSweepFromSuspectedSweepSurface,
|
||||
getWallCodeRef,
|
||||
} from 'lang/std/artifactGraph'
|
||||
import { CallExpression, CallExpressionKw, defaultSourceRange } from 'lang/wasm'
|
||||
import { DefaultPlaneStr } from 'lib/planes'
|
||||
import { getEventForSelectWithPoint } from 'lib/selections'
|
||||
import {
|
||||
editorManager,
|
||||
engineCommandManager,
|
||||
kclManager,
|
||||
sceneInfra,
|
||||
} from 'lib/singletons'
|
||||
import { useModelingContext } from './useModelingContext'
|
||||
import { getEventForSelectWithPoint } from 'lib/selections'
|
||||
import {
|
||||
getCapCodeRef,
|
||||
getSweepFromSuspectedSweepSurface,
|
||||
getWallCodeRef,
|
||||
getCodeRefsByArtifactId,
|
||||
getArtifactOfTypes,
|
||||
SegmentArtifact,
|
||||
} from 'lang/std/artifactGraph'
|
||||
import { err, reportRejection } from 'lib/trap'
|
||||
import { getFaceDetails } from 'clientSideScene/sceneEntities'
|
||||
import { DefaultPlaneStr } from 'lib/planes'
|
||||
import { getNodeFromPath } from 'lang/queryAst'
|
||||
import { getNodePathFromSourceRange } from 'lang/queryAstNodePathUtils'
|
||||
import { CallExpression, CallExpressionKw, defaultSourceRange } from 'lang/wasm'
|
||||
import { EdgeCutInfo, ExtrudeFacePlane } from 'machines/modelingMachine'
|
||||
import { rustContext } from 'lib/singletons'
|
||||
import { err, reportRejection } from 'lib/trap'
|
||||
import { EdgeCutInfo, ExtrudeFacePlane } from 'machines/modelingMachine'
|
||||
import { useEffect, useRef } from 'react'
|
||||
|
||||
import { useModelingContext } from './useModelingContext'
|
||||
|
||||
export function useEngineConnectionSubscriptions() {
|
||||
const { send, context, state } = useModelingContext()
|
||||
@ -165,7 +166,7 @@ export function useEngineConnectionSubscriptions() {
|
||||
].map((num) => num / sceneInfra._baseUnitMultiplier) as [
|
||||
number,
|
||||
number,
|
||||
number
|
||||
number,
|
||||
],
|
||||
planeId: planeOrFaceId,
|
||||
pathToNode: artifact.codeRef.pathToNode,
|
||||
@ -194,8 +195,8 @@ export function useEngineConnectionSubscriptions() {
|
||||
artifact.type === 'cap'
|
||||
? getCapCodeRef(artifact, kclManager.artifactGraph)
|
||||
: artifact.type === 'wall'
|
||||
? getWallCodeRef(artifact, kclManager.artifactGraph)
|
||||
: artifact.codeRef
|
||||
? getWallCodeRef(artifact, kclManager.artifactGraph)
|
||||
: artifact.codeRef
|
||||
|
||||
const faceInfo = await getFaceDetails(faceId)
|
||||
if (!faceInfo?.origin || !faceInfo?.z_axis || !faceInfo?.y_axis)
|
||||
@ -275,11 +276,11 @@ export function useEngineConnectionSubscriptions() {
|
||||
const _faceInfo: ExtrudeFacePlane['faceInfo'] = edgeCutMeta
|
||||
? edgeCutMeta
|
||||
: artifact.type === 'cap'
|
||||
? {
|
||||
type: 'cap',
|
||||
subType: artifact.subType,
|
||||
}
|
||||
: { type: 'wall' }
|
||||
? {
|
||||
type: 'cap',
|
||||
subType: artifact.subType,
|
||||
}
|
||||
: { type: 'wall' }
|
||||
|
||||
const extrudePathToNode = !err(extrusion)
|
||||
? getNodePathFromSourceRange(
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { useEffect, useState, useRef } from 'react'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
||||
type Path = string
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { useEffect } from 'react'
|
||||
import type { WebContentSendPayload } from '../menu/channels'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
import type { WebContentSendPayload } from '../menu/channels'
|
||||
|
||||
export function useMenuListener(
|
||||
callback: (data: WebContentSendPayload) => void
|
||||
) {
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import { createContext, useContext } from 'react'
|
||||
|
||||
import {
|
||||
ConnectingTypeGroup,
|
||||
EngineConnectionStateType,
|
||||
EngineConnectionState,
|
||||
EngineConnectionStateType,
|
||||
initialConnectingTypeGroupState,
|
||||
} from '../lang/std/engineConnection'
|
||||
import { NetworkStatus, NetworkHealthState } from './useNetworkStatus'
|
||||
import { NetworkHealthState, NetworkStatus } from './useNetworkStatus'
|
||||
|
||||
export const NetworkContext = createContext<NetworkStatus>({
|
||||
immediateState: {
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import {
|
||||
ConnectingType,
|
||||
ConnectingTypeGroup,
|
||||
DisconnectingType,
|
||||
EngineCommandManagerEvents,
|
||||
EngineConnectionEvents,
|
||||
EngineConnectionStateType,
|
||||
EngineConnectionState,
|
||||
EngineConnectionStateType,
|
||||
ErrorType,
|
||||
initialConnectingTypeGroupState,
|
||||
} from '../lang/std/engineConnection'
|
||||
@ -69,10 +70,10 @@ export function useNetworkStatus() {
|
||||
!internetConnected
|
||||
? NetworkHealthState.Disconnected
|
||||
: hasIssues || hasIssues === undefined
|
||||
? NetworkHealthState.Issue
|
||||
: pingPongHealth === 'TIMEOUT'
|
||||
? NetworkHealthState.Weak
|
||||
: NetworkHealthState.Ok
|
||||
? NetworkHealthState.Issue
|
||||
: pingPongHealth === 'TIMEOUT'
|
||||
? NetworkHealthState.Weak
|
||||
: NetworkHealthState.Ok
|
||||
)
|
||||
}, [hasIssues, internetConnected, pingPongHealth])
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { trap } from 'lib/trap'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { ensureProjectDirectoryExists, listProjects } from 'lib/desktop'
|
||||
import { loadAndValidateSettings } from 'lib/settings/settingsUtils'
|
||||
import { Project } from 'lib/project'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { Project } from 'lib/project'
|
||||
import { loadAndValidateSettings } from 'lib/settings/settingsUtils'
|
||||
import { trap } from 'lib/trap'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
// Gotcha: This should be ported to the ProjectMachine and keep track of
|
||||
// projectDirs and projectPaths in the context when it internally calls listProjects
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
import { useLayoutEffect, useEffect, useRef } from 'react'
|
||||
import { engineCommandManager } from 'lib/singletons'
|
||||
import { deferExecution } from 'lib/utils'
|
||||
import { Themes } from 'lib/theme'
|
||||
import { useModelingContext } from './useModelingContext'
|
||||
import { useNetworkContext } from 'hooks/useNetworkContext'
|
||||
import { useAppState, useAppStream } from 'AppState'
|
||||
import { SettingsViaQueryString } from 'lib/settings/settingsTypes'
|
||||
import { useNetworkContext } from 'hooks/useNetworkContext'
|
||||
import {
|
||||
EngineConnectionStateType,
|
||||
DisconnectingType,
|
||||
EngineConnectionStateType,
|
||||
} from 'lang/std/engineConnection'
|
||||
import { SettingsViaQueryString } from 'lib/settings/settingsTypes'
|
||||
import { engineCommandManager } from 'lib/singletons'
|
||||
import { Themes } from 'lib/theme'
|
||||
import { deferExecution } from 'lib/utils'
|
||||
import { useEffect, useLayoutEffect, useRef } from 'react'
|
||||
|
||||
import { useModelingContext } from './useModelingContext'
|
||||
|
||||
export function useSetupEngineManager(
|
||||
streamRef: React.RefObject<HTMLDivElement>,
|
||||
|
||||
@ -1,20 +1,21 @@
|
||||
import { useEffect } from 'react'
|
||||
import { AnyStateMachine, Actor, StateFrom, EventFrom } from 'xstate'
|
||||
import { createMachineCommand } from '../lib/createMachineCommand'
|
||||
import { modelingMachine } from 'machines/modelingMachine'
|
||||
import { authMachine } from 'machines/authMachine'
|
||||
import { settingsMachine } from 'machines/settingsMachine'
|
||||
import { projectsMachine } from 'machines/projectsMachine'
|
||||
import { useAppState } from 'AppState'
|
||||
import { useNetworkContext } from 'hooks/useNetworkContext'
|
||||
import { NetworkHealthState } from 'hooks/useNetworkStatus'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import {
|
||||
Command,
|
||||
StateMachineCommandSetConfig,
|
||||
StateMachineCommandSetSchema,
|
||||
} from 'lib/commandTypes'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import { useNetworkContext } from 'hooks/useNetworkContext'
|
||||
import { NetworkHealthState } from 'hooks/useNetworkStatus'
|
||||
import { useAppState } from 'AppState'
|
||||
import { authMachine } from 'machines/authMachine'
|
||||
import { commandBarActor } from 'machines/commandBarMachine'
|
||||
import { modelingMachine } from 'machines/modelingMachine'
|
||||
import { projectsMachine } from 'machines/projectsMachine'
|
||||
import { settingsMachine } from 'machines/settingsMachine'
|
||||
import { useEffect } from 'react'
|
||||
import { Actor, AnyStateMachine, EventFrom, StateFrom } from 'xstate'
|
||||
|
||||
import { createMachineCommand } from '../lib/createMachineCommand'
|
||||
|
||||
// This might not be necessary, AnyStateMachine from xstate is working
|
||||
export type AllMachines =
|
||||
@ -25,7 +26,7 @@ export type AllMachines =
|
||||
|
||||
interface UseStateMachineCommandsArgs<
|
||||
T extends AllMachines,
|
||||
S extends StateMachineCommandSetSchema<T>
|
||||
S extends StateMachineCommandSetSchema<T>,
|
||||
> {
|
||||
machineId: T['id']
|
||||
state: StateFrom<T>
|
||||
@ -38,7 +39,7 @@ interface UseStateMachineCommandsArgs<
|
||||
|
||||
export default function useStateMachineCommands<
|
||||
T extends AnyStateMachine,
|
||||
S extends StateMachineCommandSetSchema<T>
|
||||
S extends StateMachineCommandSetSchema<T>,
|
||||
>({
|
||||
machineId,
|
||||
state,
|
||||
|
||||
@ -2,15 +2,16 @@ import {
|
||||
SetVarNameModal,
|
||||
createSetVarNameModal,
|
||||
} from 'components/SetVarNameModal'
|
||||
import { editorManager, kclManager, codeManager } from 'lib/singletons'
|
||||
import { reportRejection, trap, err } from 'lib/trap'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import { moveValueIntoNewVariable } from 'lang/modifyAst'
|
||||
import { isNodeSafeToReplace } from 'lang/queryAst'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useModelingContext } from './useModelingContext'
|
||||
import { PathToNode, SourceRange, recast } from 'lang/wasm'
|
||||
import { useKclContext } from 'lang/KclProvider'
|
||||
import { codeManager, editorManager, kclManager } from 'lib/singletons'
|
||||
import { err, reportRejection, trap } from 'lib/trap'
|
||||
import { toSync } from 'lib/utils'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { useModelingContext } from './useModelingContext'
|
||||
|
||||
export const getVarNameModal = createSetVarNameModal(SetVarNameModal)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user