Chore: clean up duplication of nodeToEdit props (#7553)
pierremtb/adhoc/cleanup-nodetoedit-in-config
This commit is contained in:
@ -13,6 +13,7 @@ import type {
|
|||||||
} from '@src/lang/wasm'
|
} from '@src/lang/wasm'
|
||||||
import { isPathToNode } from '@src/lang/wasm'
|
import { isPathToNode } from '@src/lang/wasm'
|
||||||
import type {
|
import type {
|
||||||
|
CommandArgumentConfig,
|
||||||
KclCommandValue,
|
KclCommandValue,
|
||||||
StateMachineCommandSetConfig,
|
StateMachineCommandSetConfig,
|
||||||
} from '@src/lib/commandTypes'
|
} from '@src/lib/commandTypes'
|
||||||
@ -27,7 +28,11 @@ import type { components } from '@src/lib/machine-api'
|
|||||||
import type { Selections } from '@src/lib/selections'
|
import type { Selections } from '@src/lib/selections'
|
||||||
import { codeManager, kclManager } from '@src/lib/singletons'
|
import { codeManager, kclManager } from '@src/lib/singletons'
|
||||||
import { err } from '@src/lib/trap'
|
import { err } from '@src/lib/trap'
|
||||||
import type { SketchTool, modelingMachine } from '@src/machines/modelingMachine'
|
import type {
|
||||||
|
ModelingMachineContext,
|
||||||
|
SketchTool,
|
||||||
|
modelingMachine,
|
||||||
|
} from '@src/machines/modelingMachine'
|
||||||
|
|
||||||
type OutputFormat = Models['OutputFormat3d_type']
|
type OutputFormat = Models['OutputFormat3d_type']
|
||||||
type OutputTypeKey = OutputFormat['type']
|
type OutputTypeKey = OutputFormat['type']
|
||||||
@ -45,6 +50,16 @@ export const COMMAND_APPEARANCE_COLOR_DEFAULT = 'default'
|
|||||||
|
|
||||||
export type HelixModes = 'Axis' | 'Edge' | 'Cylinder'
|
export type HelixModes = 'Axis' | 'Edge' | 'Cylinder'
|
||||||
|
|
||||||
|
// For all nodeToEdit-like arguments needed for edit flows
|
||||||
|
const nodeToEditDescription =
|
||||||
|
'Path to the node in the AST to edit. Never shown to the user.'
|
||||||
|
const nodeToEditProps = {
|
||||||
|
description: nodeToEditDescription,
|
||||||
|
inputType: 'text',
|
||||||
|
required: false,
|
||||||
|
hidden: true,
|
||||||
|
} as CommandArgumentConfig<PathToNode | undefined, ModelingMachineContext>
|
||||||
|
|
||||||
export type ModelingCommandSchema = {
|
export type ModelingCommandSchema = {
|
||||||
'Enter sketch': { forceNewSketch?: boolean }
|
'Enter sketch': { forceNewSketch?: boolean }
|
||||||
Export: {
|
Export: {
|
||||||
@ -378,12 +393,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
skip: true,
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
sketches: {
|
sketches: {
|
||||||
inputType: 'selection',
|
inputType: 'selection',
|
||||||
@ -407,12 +417,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
skip: true,
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
sketches: {
|
sketches: {
|
||||||
inputType: 'selection',
|
inputType: 'selection',
|
||||||
@ -461,12 +466,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
skip: true,
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
sketches: {
|
sketches: {
|
||||||
inputType: 'selection',
|
inputType: 'selection',
|
||||||
@ -522,12 +522,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
skip: true,
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
selection: {
|
selection: {
|
||||||
inputType: 'selection',
|
inputType: 'selection',
|
||||||
@ -606,12 +601,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
icon: 'plane',
|
icon: 'plane',
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
skip: true,
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
plane: {
|
plane: {
|
||||||
inputType: 'selection',
|
inputType: 'selection',
|
||||||
@ -633,12 +623,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
skip: true,
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
mode: {
|
mode: {
|
||||||
inputType: 'options',
|
inputType: 'options',
|
||||||
@ -732,11 +717,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
selection: {
|
selection: {
|
||||||
inputType: 'selection',
|
inputType: 'selection',
|
||||||
@ -759,11 +740,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
selection: {
|
selection: {
|
||||||
inputType: 'selection',
|
inputType: 'selection',
|
||||||
@ -912,8 +889,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
icon: 'make-variable',
|
icon: 'make-variable',
|
||||||
args: {
|
args: {
|
||||||
currentValue: {
|
currentValue: {
|
||||||
description:
|
description: nodeToEditDescription,
|
||||||
'Path to the node in the AST to constrain. This is never shown to the user.',
|
|
||||||
inputType: 'text',
|
inputType: 'text',
|
||||||
required: false,
|
required: false,
|
||||||
skip: true,
|
skip: true,
|
||||||
@ -989,12 +965,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
skip: true,
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
color: {
|
color: {
|
||||||
inputType: 'options',
|
inputType: 'options',
|
||||||
@ -1055,12 +1026,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
skip: true,
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
selection: {
|
selection: {
|
||||||
// selectionMixed allows for feature tree selection of module imports
|
// selectionMixed allows for feature tree selection of module imports
|
||||||
@ -1095,12 +1061,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
skip: true,
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
selection: {
|
selection: {
|
||||||
// selectionMixed allows for feature tree selection of module imports
|
// selectionMixed allows for feature tree selection of module imports
|
||||||
@ -1135,12 +1096,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
needsReview: true,
|
needsReview: true,
|
||||||
args: {
|
args: {
|
||||||
nodeToEdit: {
|
nodeToEdit: {
|
||||||
description:
|
...nodeToEditProps,
|
||||||
'Path to the node in the AST to edit. Never shown to the user.',
|
|
||||||
skip: true,
|
|
||||||
inputType: 'text',
|
|
||||||
required: false,
|
|
||||||
hidden: true,
|
|
||||||
},
|
},
|
||||||
selection: {
|
selection: {
|
||||||
// selectionMixed allows for feature tree selection of module imports
|
// selectionMixed allows for feature tree selection of module imports
|
||||||
|
Reference in New Issue
Block a user