mermaid
Version:
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
29 lines (28 loc) • 1.76 kB
TypeScript
import type { GridHorizontalAlign, GridVerticalAlign } from '../types.js';
export declare const GRID_HORIZONTAL_ALIGNMENTS: readonly ["left", "center", "right"];
export declare const GRID_VERTICAL_ALIGNMENTS: readonly ["top", "center", "bottom"];
/** Grid coordinates identify ordered tracks, not physical offsets or array indexes. */
export declare function isValidGridCoordinate(value: unknown): value is number;
/** Narrows untrusted alignment values to the supported horizontal cell alignments. */
export declare function isGridHorizontalAlign(value: unknown): value is GridHorizontalAlign;
/** Narrows untrusted alignment values to the supported vertical stack alignments. */
export declare function isGridVerticalAlign(value: unknown): value is GridVerticalAlign;
/**
* Accepts an omitted coordinate or a safe integer without coercing authored values.
* Throws `GRID_INVALID_COORDINATE` with placement, node, field, and value details otherwise.
*/
export declare function validateGridCoordinate(placementId: string, field: 'row' | 'column', value: unknown, nodeId?: string): asserts value is number | undefined;
/**
* Validates own row and column properties in placement-map occurrences and inline item metadata.
* Ignores malformed container shapes; invalid coordinates throw, with array indexes identifying
* the offending occurrence.
*/
export declare function validateGridPlacementCoordinates(placements: unknown, items: Iterable<{
id: string;
metadata?: unknown;
}>): void;
/**
* Sanitizes the user-keyed placement dictionary without treating authored node IDs as config keys.
* Only the fixed placement shape crosses the directive trust boundary.
*/
export declare function sanitizeGridPlacements(dict: Record<string, unknown>): void;