Files
simstudioai--sim/apps/sim/lib/workflows/autolayout/constants.ts
T
wehub-resource-sync d25d482dc2
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

116 lines
2.6 KiB
TypeScript

/**
* Autolayout Constants
*
* Layout algorithm specific constants for spacing, padding, and overlap detection.
* Block dimensions are in @sim/workflow-renderer
*/
/**
* Horizontal spacing between layers (columns)
*/
export const DEFAULT_HORIZONTAL_SPACING = 180
/**
* Vertical spacing between blocks in the same layer
*/
export const DEFAULT_VERTICAL_SPACING = 80
/**
* Default offset when duplicating blocks
*/
export const DEFAULT_DUPLICATE_OFFSET = {
x: 180,
y: 20,
} as const
/**
* General container padding for layout calculations
*/
export const CONTAINER_PADDING = 150
/**
* Container horizontal padding (X offset for children in layout coordinates)
*/
export const CONTAINER_PADDING_X = 180
/**
* Container vertical padding (Y offset for children in layout coordinates)
*/
export const CONTAINER_PADDING_Y = 100
/**
* Root level horizontal padding
*/
export const ROOT_PADDING_X = 150
/**
* Root level vertical padding
*/
export const ROOT_PADDING_Y = 150
/**
* Default padding for layout positioning
*/
export const DEFAULT_LAYOUT_PADDING = { x: 150, y: 150 }
/**
* Margin for overlap detection
*/
export const OVERLAP_MARGIN = 30
/**
* Maximum iterations for overlap resolution
*/
export const MAX_OVERLAP_ITERATIONS = 20
/**
* Note block type identifier
*/
export const NOTE_BLOCK_TYPE = 'note'
/**
* Block types excluded from autolayout
*/
export const AUTO_LAYOUT_EXCLUDED_TYPES = new Set([NOTE_BLOCK_TYPE])
/**
* Container block types that can have children
*/
export const CONTAINER_BLOCK_TYPES = new Set(['loop', 'parallel'])
/**
* Estimated height per subblock when no measured height is available.
* Used as a heuristic for new blocks that haven't been rendered yet.
*/
export const ESTIMATED_SUBBLOCK_HEIGHT = 45
/**
* Bottom padding added to estimated block height
*/
export const ESTIMATED_BLOCK_BOTTOM_PADDING = 20
/**
* Maximum estimated block height when no measurement is available.
* Prevents wildly over-estimated heights for blocks with many conditional
* subblocks (e.g. agent blocks define ~20 subblocks but only ~5 are visible).
*/
export const MAX_ESTIMATED_BLOCK_HEIGHT = 350
/**
* Default layout options
*/
export const DEFAULT_LAYOUT_OPTIONS = {
horizontalSpacing: DEFAULT_HORIZONTAL_SPACING,
verticalSpacing: DEFAULT_VERTICAL_SPACING,
padding: DEFAULT_LAYOUT_PADDING,
}
/**
* Container-specific layout options (same spacing as root level for consistency)
*/
export const CONTAINER_LAYOUT_OPTIONS = {
horizontalSpacing: DEFAULT_HORIZONTAL_SPACING,
verticalSpacing: DEFAULT_VERTICAL_SPACING,
padding: { x: CONTAINER_PADDING_X, y: CONTAINER_PADDING_Y },
}