more minor clean up renaming
This commit is contained in:
		@ -20,7 +20,7 @@ import {
 | 
			
		||||
import { enginelessExecutor } from '../lib/testHelpers'
 | 
			
		||||
import { findUsesOfTagInPipe, getNodePathFromSourceRange } from './queryAst'
 | 
			
		||||
import { err } from 'lib/trap'
 | 
			
		||||
import { SimplifiedVarValue, VarValueKeys } from './std/stdTypes'
 | 
			
		||||
import { SimplifiedArgDetails, VarValueKeys } from './std/stdTypes'
 | 
			
		||||
 | 
			
		||||
beforeAll(async () => {
 | 
			
		||||
  await initPromise
 | 
			
		||||
@ -639,7 +639,7 @@ describe('Testing removeSingleConstraintInfo', () => {
 | 
			
		||||
        code.indexOf(lineOfInterest) + lineOfInterest.length,
 | 
			
		||||
      ]
 | 
			
		||||
      const pathToNode = getNodePathFromSourceRange(ast, range)
 | 
			
		||||
      let argPosition: SimplifiedVarValue
 | 
			
		||||
      let argPosition: SimplifiedArgDetails
 | 
			
		||||
      if (key === 'arrayIndex' && typeof value === 'number') {
 | 
			
		||||
        argPosition = {
 | 
			
		||||
          type: 'arrayItem',
 | 
			
		||||
@ -692,7 +692,7 @@ describe('Testing removeSingleConstraintInfo', () => {
 | 
			
		||||
        code.indexOf(lineOfInterest) + 1,
 | 
			
		||||
        code.indexOf(lineOfInterest) + lineOfInterest.length,
 | 
			
		||||
      ]
 | 
			
		||||
      let argPosition: SimplifiedVarValue
 | 
			
		||||
      let argPosition: SimplifiedArgDetails
 | 
			
		||||
      if (key === 'arrayIndex' && typeof value === 'number') {
 | 
			
		||||
        argPosition = {
 | 
			
		||||
          type: 'arrayItem',
 | 
			
		||||
 | 
			
		||||
@ -38,7 +38,7 @@ import {
 | 
			
		||||
import { DefaultPlaneStr } from 'clientSideScene/sceneEntities'
 | 
			
		||||
import { isOverlap, roundOff } from 'lib/utils'
 | 
			
		||||
import { KCL_DEFAULT_CONSTANT_PREFIXES } from 'lib/constants'
 | 
			
		||||
import { SimplifiedVarValue } from './std/stdTypes'
 | 
			
		||||
import { SimplifiedArgDetails } from './std/stdTypes'
 | 
			
		||||
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
 | 
			
		||||
import { Models } from '@kittycad/lib'
 | 
			
		||||
 | 
			
		||||
@ -831,7 +831,7 @@ export function deleteSegmentFromPipeExpression(
 | 
			
		||||
 | 
			
		||||
export function removeSingleConstraintInfo(
 | 
			
		||||
  pathToCallExp: PathToNode,
 | 
			
		||||
  varValue: SimplifiedVarValue,
 | 
			
		||||
  varValue: SimplifiedArgDetails,
 | 
			
		||||
  ast: Program,
 | 
			
		||||
  programMemory: ProgramMemory
 | 
			
		||||
):
 | 
			
		||||
 | 
			
		||||
@ -35,7 +35,7 @@ import {
 | 
			
		||||
  SingleValueInput,
 | 
			
		||||
  AddTagInfo,
 | 
			
		||||
  SegmentInputs,
 | 
			
		||||
  SimplifiedVarValue,
 | 
			
		||||
  SimplifiedArgDetails,
 | 
			
		||||
} from 'lang/std/stdTypes'
 | 
			
		||||
 | 
			
		||||
import {
 | 
			
		||||
@ -112,7 +112,7 @@ type AbbreviatedInput =
 | 
			
		||||
  | ArrayItemInput<any>['index']
 | 
			
		||||
  | ObjectPropertyInput<any>['key']
 | 
			
		||||
  | SingleValueInput<any>['type']
 | 
			
		||||
  | SimplifiedVarValue
 | 
			
		||||
  | SimplifiedArgDetails
 | 
			
		||||
  | undefined
 | 
			
		||||
 | 
			
		||||
const constrainInfo = (
 | 
			
		||||
@ -329,7 +329,7 @@ export const lineTo: SketchLineHelper = {
 | 
			
		||||
              type: 'arrayItem',
 | 
			
		||||
              index: 0,
 | 
			
		||||
              argType: 'xAbsolute',
 | 
			
		||||
              value: createLiteral(roundOff(to[0], 2)),
 | 
			
		||||
              expr: createLiteral(roundOff(to[0], 2)),
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
@ -338,7 +338,7 @@ export const lineTo: SketchLineHelper = {
 | 
			
		||||
              type: 'arrayItem',
 | 
			
		||||
              index: 1,
 | 
			
		||||
              argType: 'yAbsolute',
 | 
			
		||||
              value: createLiteral(roundOff(to[1], 2)),
 | 
			
		||||
              expr: createLiteral(roundOff(to[1], 2)),
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
@ -455,7 +455,7 @@ export const line: SketchLineHelper = {
 | 
			
		||||
              type: 'arrayItem',
 | 
			
		||||
              index: 0,
 | 
			
		||||
              argType: 'xRelative',
 | 
			
		||||
              value: createLiteral(roundOff(to[0] - from[0], 2)),
 | 
			
		||||
              expr: createLiteral(roundOff(to[0] - from[0], 2)),
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
@ -464,7 +464,7 @@ export const line: SketchLineHelper = {
 | 
			
		||||
              type: 'arrayItem',
 | 
			
		||||
              index: 1,
 | 
			
		||||
              argType: 'yRelative',
 | 
			
		||||
              value: createLiteral(roundOff(to[1] - from[1], 2)),
 | 
			
		||||
              expr: createLiteral(roundOff(to[1] - from[1], 2)),
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
@ -561,7 +561,7 @@ export const xLineTo: SketchLineHelper = {
 | 
			
		||||
          varDetails: {
 | 
			
		||||
            type: 'singleValue',
 | 
			
		||||
            argType: 'xAbsolute',
 | 
			
		||||
            value: createLiteral(roundOff(to[0], 2)),
 | 
			
		||||
            expr: createLiteral(roundOff(to[0], 2)),
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
      ])
 | 
			
		||||
@ -638,7 +638,7 @@ export const yLineTo: SketchLineHelper = {
 | 
			
		||||
          varDetails: {
 | 
			
		||||
            type: 'singleValue',
 | 
			
		||||
            argType: 'yAbsolute',
 | 
			
		||||
            value: newVal,
 | 
			
		||||
            expr: newVal,
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
      ])
 | 
			
		||||
@ -715,7 +715,7 @@ export const xLine: SketchLineHelper = {
 | 
			
		||||
          varDetails: {
 | 
			
		||||
            type: 'singleValue',
 | 
			
		||||
            argType: 'xRelative',
 | 
			
		||||
            value: newVal,
 | 
			
		||||
            expr: newVal,
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
      ])
 | 
			
		||||
@ -788,7 +788,7 @@ export const yLine: SketchLineHelper = {
 | 
			
		||||
          varDetails: {
 | 
			
		||||
            type: 'singleValue',
 | 
			
		||||
            argType: 'yRelative',
 | 
			
		||||
            value: newVal,
 | 
			
		||||
            expr: newVal,
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
      ])
 | 
			
		||||
@ -874,7 +874,7 @@ export const tangentialArcTo: SketchLineHelper = {
 | 
			
		||||
              type: 'arrayItem',
 | 
			
		||||
              index: 0,
 | 
			
		||||
              argType: 'xRelative',
 | 
			
		||||
              value: toX,
 | 
			
		||||
              expr: toX,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
@ -883,7 +883,7 @@ export const tangentialArcTo: SketchLineHelper = {
 | 
			
		||||
              type: 'arrayItem',
 | 
			
		||||
              index: 1,
 | 
			
		||||
              argType: 'yAbsolute',
 | 
			
		||||
              value: toY,
 | 
			
		||||
              expr: toY,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
@ -1022,7 +1022,7 @@ export const circle: SketchLineHelper = {
 | 
			
		||||
            index: 0,
 | 
			
		||||
            key: 'center',
 | 
			
		||||
            argType: 'xAbsolute',
 | 
			
		||||
            value: x,
 | 
			
		||||
            expr: x,
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
@ -1032,7 +1032,7 @@ export const circle: SketchLineHelper = {
 | 
			
		||||
            index: 1,
 | 
			
		||||
            key: 'center',
 | 
			
		||||
            argType: 'yAbsolute',
 | 
			
		||||
            value: y,
 | 
			
		||||
            expr: y,
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
@ -1041,7 +1041,7 @@ export const circle: SketchLineHelper = {
 | 
			
		||||
            type: 'objectProperty',
 | 
			
		||||
            key: 'radius',
 | 
			
		||||
            argType: 'radius',
 | 
			
		||||
            value: radiusExp,
 | 
			
		||||
            expr: radiusExp,
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
      ])
 | 
			
		||||
@ -1202,7 +1202,7 @@ export const angledLine: SketchLineHelper = {
 | 
			
		||||
              index: 0,
 | 
			
		||||
              key: 'angle',
 | 
			
		||||
              argType: 'angle',
 | 
			
		||||
              value: newAngleVal,
 | 
			
		||||
              expr: newAngleVal,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
@ -1212,7 +1212,7 @@ export const angledLine: SketchLineHelper = {
 | 
			
		||||
              index: 1,
 | 
			
		||||
              key: 'length',
 | 
			
		||||
              argType: 'length',
 | 
			
		||||
              value: newLengthVal,
 | 
			
		||||
              expr: newLengthVal,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
@ -1317,7 +1317,7 @@ export const angledLineOfXLength: SketchLineHelper = {
 | 
			
		||||
              index: 0,
 | 
			
		||||
              key: 'angle',
 | 
			
		||||
              argType: 'angle',
 | 
			
		||||
              value: angle,
 | 
			
		||||
              expr: angle,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
@ -1327,7 +1327,7 @@ export const angledLineOfXLength: SketchLineHelper = {
 | 
			
		||||
              index: 1,
 | 
			
		||||
              key: 'length',
 | 
			
		||||
              argType: 'xRelative',
 | 
			
		||||
              value: xLength,
 | 
			
		||||
              expr: xLength,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
        ]).callExp
 | 
			
		||||
@ -1433,7 +1433,7 @@ export const angledLineOfYLength: SketchLineHelper = {
 | 
			
		||||
              index: 0,
 | 
			
		||||
              key: 'angle',
 | 
			
		||||
              argType: 'angle',
 | 
			
		||||
              value: angle,
 | 
			
		||||
              expr: angle,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
@ -1443,7 +1443,7 @@ export const angledLineOfYLength: SketchLineHelper = {
 | 
			
		||||
              index: 1,
 | 
			
		||||
              key: 'length',
 | 
			
		||||
              argType: 'yRelative',
 | 
			
		||||
              value: yLength,
 | 
			
		||||
              expr: yLength,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
        ]).callExp
 | 
			
		||||
@ -1537,7 +1537,7 @@ export const angledLineToX: SketchLineHelper = {
 | 
			
		||||
              index: 0,
 | 
			
		||||
              key: 'angle',
 | 
			
		||||
              argType: 'angle',
 | 
			
		||||
              value: angle,
 | 
			
		||||
              expr: angle,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
@ -1547,7 +1547,7 @@ export const angledLineToX: SketchLineHelper = {
 | 
			
		||||
              index: 1,
 | 
			
		||||
              key: 'to',
 | 
			
		||||
              argType: 'xAbsolute',
 | 
			
		||||
              value: xArg,
 | 
			
		||||
              expr: xArg,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
@ -1647,7 +1647,7 @@ export const angledLineToY: SketchLineHelper = {
 | 
			
		||||
              index: 0,
 | 
			
		||||
              key: 'angle',
 | 
			
		||||
              argType: 'angle',
 | 
			
		||||
              value: angle,
 | 
			
		||||
              expr: angle,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
@ -1657,7 +1657,7 @@ export const angledLineToY: SketchLineHelper = {
 | 
			
		||||
              index: 1,
 | 
			
		||||
              key: 'to',
 | 
			
		||||
              argType: 'yAbsolute',
 | 
			
		||||
              value: yArg,
 | 
			
		||||
              expr: yArg,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
@ -1768,7 +1768,7 @@ export const angledLineThatIntersects: SketchLineHelper = {
 | 
			
		||||
            type: 'objectProperty',
 | 
			
		||||
            key: 'angle',
 | 
			
		||||
            argType: 'angle',
 | 
			
		||||
            value: angle,
 | 
			
		||||
            expr: angle,
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
@ -1777,7 +1777,7 @@ export const angledLineThatIntersects: SketchLineHelper = {
 | 
			
		||||
            type: 'objectProperty',
 | 
			
		||||
            key: 'offset',
 | 
			
		||||
            argType: 'intersectionOffset',
 | 
			
		||||
            value: offset,
 | 
			
		||||
            expr: offset,
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
      ])
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,8 @@
 | 
			
		||||
import { SegmentInput, SimplifiedVarValue, TransformCallback } from './stdTypes'
 | 
			
		||||
import {
 | 
			
		||||
  SegmentInput,
 | 
			
		||||
  SimplifiedArgDetails,
 | 
			
		||||
  TransformCallback,
 | 
			
		||||
} from './stdTypes'
 | 
			
		||||
import { ToolTip, toolTips } from 'lang/langHelpers'
 | 
			
		||||
import { Selections, Selection } from 'lib/selections'
 | 
			
		||||
import { cleanErrs, err } from 'lib/trap'
 | 
			
		||||
@ -1355,7 +1359,7 @@ export function removeSingleConstraint({
 | 
			
		||||
  ast,
 | 
			
		||||
}: {
 | 
			
		||||
  pathToCallExp: PathToNode
 | 
			
		||||
  inputDetails: SimplifiedVarValue
 | 
			
		||||
  inputDetails: SimplifiedArgDetails
 | 
			
		||||
  ast: Program
 | 
			
		||||
}): TransformInfo | false {
 | 
			
		||||
  const callExp = getNodeFromPath<CallExpression>(
 | 
			
		||||
@ -1392,16 +1396,16 @@ export function removeSingleConstraint({
 | 
			
		||||
                varValue.index === inputDetails.index
 | 
			
		||||
              )
 | 
			
		||||
            )
 | 
			
		||||
              return varValue.value
 | 
			
		||||
              return varValue.expr
 | 
			
		||||
            const literal = rawValues.find(
 | 
			
		||||
              (rawValue) =>
 | 
			
		||||
                (rawValue.varDetails.type === 'arrayItem' ||
 | 
			
		||||
                  rawValue.varDetails.type === 'arrayOrObjItem') &&
 | 
			
		||||
                rawValue.varDetails.index === inputDetails.index
 | 
			
		||||
            )?.varDetails?.value
 | 
			
		||||
            )?.varDetails?.expr
 | 
			
		||||
            return (
 | 
			
		||||
              (varValue.index === inputDetails.index && literal) ||
 | 
			
		||||
              varValue.value
 | 
			
		||||
              varValue.expr
 | 
			
		||||
            )
 | 
			
		||||
          })
 | 
			
		||||
          return createStdlibCallExpression(
 | 
			
		||||
@ -1430,9 +1434,7 @@ export function removeSingleConstraint({
 | 
			
		||||
                rawValue.varDetails.type === 'arrayInObject' &&
 | 
			
		||||
                rawValue.varDetails.key === inputDetails.key &&
 | 
			
		||||
                rawValue.varDetails.index ===
 | 
			
		||||
                  (varValue.type === 'arrayInObject'
 | 
			
		||||
                    ? varValue.index
 | 
			
		||||
                    : -1)
 | 
			
		||||
                  (varValue.type === 'arrayInObject' ? varValue.index : -1)
 | 
			
		||||
            )
 | 
			
		||||
            const rawLiteralObjProp = rawValues.find(
 | 
			
		||||
              (rawValue) =>
 | 
			
		||||
@ -1443,8 +1445,7 @@ export function removeSingleConstraint({
 | 
			
		||||
            )
 | 
			
		||||
            if (
 | 
			
		||||
              inputDetails.type === 'arrayInObject' &&
 | 
			
		||||
              rawLiteralArrayInObject?.varDetails.type ===
 | 
			
		||||
                'arrayInObject' &&
 | 
			
		||||
              rawLiteralArrayInObject?.varDetails.type === 'arrayInObject' &&
 | 
			
		||||
              rawLiteralArrayInObject?.varDetails.index ===
 | 
			
		||||
                inputDetails.index &&
 | 
			
		||||
              rawLiteralArrayInObject?.varDetails.key === inputDetails.key
 | 
			
		||||
@ -1453,7 +1454,7 @@ export function removeSingleConstraint({
 | 
			
		||||
                arrayDetailsNameBetterLater[varValue.key] = []
 | 
			
		||||
              arrayDetailsNameBetterLater[inputDetails.key][
 | 
			
		||||
                inputDetails.index
 | 
			
		||||
              ] = rawLiteralArrayInObject.varDetails.value
 | 
			
		||||
              ] = rawLiteralArrayInObject.varDetails.expr
 | 
			
		||||
            } else if (
 | 
			
		||||
              inputDetails.type === 'objectProperty' &&
 | 
			
		||||
              (rawLiteralObjProp?.varDetails.type === 'objectProperty' ||
 | 
			
		||||
@ -1461,7 +1462,7 @@ export function removeSingleConstraint({
 | 
			
		||||
              rawLiteralObjProp?.varDetails.key === inputDetails.key &&
 | 
			
		||||
              varValue.key === inputDetails.key
 | 
			
		||||
            ) {
 | 
			
		||||
              otherThing[inputDetails.key] = rawLiteralObjProp.varDetails.value
 | 
			
		||||
              otherThing[inputDetails.key] = rawLiteralObjProp.varDetails.expr
 | 
			
		||||
            } else if (varValue.type === 'arrayInObject') {
 | 
			
		||||
              if (!arrayDetailsNameBetterLater[varValue.key])
 | 
			
		||||
                arrayDetailsNameBetterLater[varValue.key] = []
 | 
			
		||||
@ -1491,7 +1492,7 @@ export function removeSingleConstraint({
 | 
			
		||||
 | 
			
		||||
        return createCallWrapper(
 | 
			
		||||
          callExp.node.callee.name as any,
 | 
			
		||||
          rawValues[0].varDetails.value,
 | 
			
		||||
          rawValues[0].varDetails.expr,
 | 
			
		||||
          tag
 | 
			
		||||
        )
 | 
			
		||||
      },
 | 
			
		||||
@ -1804,7 +1805,7 @@ export function transformAstSketchLines({
 | 
			
		||||
          varDetails: {
 | 
			
		||||
            type: 'arrayItem',
 | 
			
		||||
            index: a.argPosition.index,
 | 
			
		||||
            value: nodeMeta.node,
 | 
			
		||||
            expr: nodeMeta.node,
 | 
			
		||||
            argType: a.type,
 | 
			
		||||
          },
 | 
			
		||||
          varExpression: nodeMeta.node,
 | 
			
		||||
@ -1814,7 +1815,7 @@ export function transformAstSketchLines({
 | 
			
		||||
          varDetails: {
 | 
			
		||||
            type: 'objectProperty',
 | 
			
		||||
            key: a.argPosition.key,
 | 
			
		||||
            value: nodeMeta.node,
 | 
			
		||||
            expr: nodeMeta.node,
 | 
			
		||||
            argType: a.type,
 | 
			
		||||
          },
 | 
			
		||||
          varExpression: nodeMeta.node,
 | 
			
		||||
@ -1824,7 +1825,7 @@ export function transformAstSketchLines({
 | 
			
		||||
          varDetails: {
 | 
			
		||||
            type: 'singleValue',
 | 
			
		||||
            argType: a.type,
 | 
			
		||||
            value: nodeMeta.node,
 | 
			
		||||
            expr: nodeMeta.node,
 | 
			
		||||
          },
 | 
			
		||||
          varExpression: nodeMeta.node,
 | 
			
		||||
        })
 | 
			
		||||
@ -1834,7 +1835,7 @@ export function transformAstSketchLines({
 | 
			
		||||
            type: 'arrayInObject',
 | 
			
		||||
            key: a.argPosition.key,
 | 
			
		||||
            index: a.argPosition.index,
 | 
			
		||||
            value: nodeMeta.node,
 | 
			
		||||
            expr: nodeMeta.node,
 | 
			
		||||
            argType: a.type,
 | 
			
		||||
          },
 | 
			
		||||
          varExpression: nodeMeta.node,
 | 
			
		||||
 | 
			
		||||
@ -89,51 +89,80 @@ export type VarValueKeys =
 | 
			
		||||
export interface SingleValueInput<T> {
 | 
			
		||||
  type: 'singleValue'
 | 
			
		||||
  argType: LineInputsType | 'radius'
 | 
			
		||||
  value: T
 | 
			
		||||
  expr: T
 | 
			
		||||
}
 | 
			
		||||
export interface ArrayItemInput<T> {
 | 
			
		||||
  type: 'arrayItem'
 | 
			
		||||
  index: 0 | 1
 | 
			
		||||
  argType: LineInputsType | 'radius'
 | 
			
		||||
  value: T
 | 
			
		||||
  expr: T
 | 
			
		||||
}
 | 
			
		||||
export interface ObjectPropertyInput<T> {
 | 
			
		||||
  type: 'objectProperty'
 | 
			
		||||
  key: VarValueKeys
 | 
			
		||||
  argType: LineInputsType | 'radius'
 | 
			
		||||
  value: T
 | 
			
		||||
  expr: T
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ArrayOrObjItemInput<T> {
 | 
			
		||||
interface ArrayOrObjItemInput<T> {
 | 
			
		||||
  type: 'arrayOrObjItem'
 | 
			
		||||
  key: VarValueKeys
 | 
			
		||||
  index: 0 | 1
 | 
			
		||||
  argType: LineInputsType | 'radius'
 | 
			
		||||
  value: T
 | 
			
		||||
  expr: T
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ArrayInObject<T> {
 | 
			
		||||
interface ArrayInObject<T> {
 | 
			
		||||
  type: 'arrayInObject'
 | 
			
		||||
  key: VarValueKeys
 | 
			
		||||
  argType: LineInputsType | 'radius'
 | 
			
		||||
  index: 0 | 1
 | 
			
		||||
  value: T
 | 
			
		||||
  expr: T
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type _VarValue<T> =
 | 
			
		||||
type _VarValue<T> =
 | 
			
		||||
  | SingleValueInput<T>
 | 
			
		||||
  | ArrayItemInput<T>
 | 
			
		||||
  | ObjectPropertyInput<T>
 | 
			
		||||
  | ArrayOrObjItemInput<T>
 | 
			
		||||
  | ArrayInObject<T>
 | 
			
		||||
 | 
			
		||||
export type VarValue = _VarValue<Expr>
 | 
			
		||||
export type RawValue = _VarValue<Literal>
 | 
			
		||||
/**
 | 
			
		||||
 * {@link RawArg.expr} is the current expression for each of the args for a segment
 | 
			
		||||
 * i.e. if the expression is 5 + 6, {@link RawArg.expr} will be that binary expression
 | 
			
		||||
 *
 | 
			
		||||
 * Other properties on this type describe how the args are defined for this particular segment
 | 
			
		||||
 * i.e. line uses [x, y] style inputs, while angledLine uses either [angle, length] or {angle, length}
 | 
			
		||||
 * and circle uses {center: [x, y], radius: number}
 | 
			
		||||
 * Which is why a union type is used that can be type narrowed using the {@link RawArg.type} property
 | 
			
		||||
 * {@link RawArg.expr} is common to all of these types
 | 
			
		||||
 */
 | 
			
		||||
type InputArg = _VarValue<Expr>
 | 
			
		||||
 | 
			
		||||
export type VarValues = Array<VarValue>
 | 
			
		||||
export type RawValues = Array<RawValue>
 | 
			
		||||
/**
 | 
			
		||||
 * {@link RawArg.expr} is the literal equivalent of whatever current expression is
 | 
			
		||||
 * i.e. if the expression is 5 + 6, the literal would be 11
 | 
			
		||||
 * but of course works for expressions like myVar + someFn() etc too
 | 
			
		||||
 * This is useful in cases where we want to "un-constrain" inputs to segments
 | 
			
		||||
 */
 | 
			
		||||
type RawArg = _VarValue<Literal>
 | 
			
		||||
 | 
			
		||||
export type SimplifiedVarValue =
 | 
			
		||||
type InputArgs = Array<InputArg>
 | 
			
		||||
 | 
			
		||||
// /**
 | 
			
		||||
//  * The literal equivalent of whatever current expression is
 | 
			
		||||
//  * i.e. if the expression is 5 + 6, the literal would be 11
 | 
			
		||||
//  * but of course works for expressions like myVar + someFn() etc too
 | 
			
		||||
//  * This is useful in cases where we want to "un-constrain" inputs to segments
 | 
			
		||||
//  */
 | 
			
		||||
type RawArgs = Array<RawArg>
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Serves the same role as {@link InputArg} on {@link RawArg}
 | 
			
		||||
 * but without the {@link RawArg.expr} property, since it is not needed
 | 
			
		||||
 * when we only need to know where there arg is.
 | 
			
		||||
 */
 | 
			
		||||
export type SimplifiedArgDetails =
 | 
			
		||||
  | {
 | 
			
		||||
      type: 'singleValue'
 | 
			
		||||
    }
 | 
			
		||||
@ -147,7 +176,7 @@ export type SimplifiedVarValue =
 | 
			
		||||
 | 
			
		||||
export interface SegmentInput {
 | 
			
		||||
  varExpression: Expr
 | 
			
		||||
  varDetails: VarValue
 | 
			
		||||
  varDetails: InputArg
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type TransformCallback = (
 | 
			
		||||
@ -171,7 +200,7 @@ export interface ConstrainInfo {
 | 
			
		||||
  pathToNode: PathToNode
 | 
			
		||||
  value: string
 | 
			
		||||
  calculatedValue?: any
 | 
			
		||||
  argPosition?: SimplifiedVarValue
 | 
			
		||||
  argPosition?: SimplifiedArgDetails
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface SketchLineHelper {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user