import type { BlokkliFieldElement } from '../types/field.js'; import type { DomProvider } from './dom.js'; import type { BlockDefinitionProvider } from './types.js'; import type { StateProvider } from './state.js'; import type { BlocksProvider } from './blocks.js'; export type FieldsProvider = { /** * Find a field element by host entity UUID and field name. * * Returns a BlokkliFieldElement with complete field metadata including: * - Field configuration (label, cardinality, allowed bundles) * - Host entity information * - Nesting level and field list type * - HTML element reference * - Drop alignment settings * * Results are cached and invalidated on state reload. * * @param uuid - The host entity UUID * @param fieldName - The name of the field * @returns The field element with metadata, or undefined if not found */ find: (uuid: string, fieldName: string) => BlokkliFieldElement | undefined; /** * Get the z-index of the field containing the given block UUID. * * @param uuid - The block UUID * @returns The z-index of the field, or 0 if not found */ getFieldZIndex: (uuid: string) => number; /** * Compare field priority between two blocks. * Returns > 0 if uuidA wins, < 0 if uuidB wins, 0 if equal. * Uses z-index as primary sort, DOM order as tiebreaker. * * @param uuidA - First block UUID * @param uuidB - Second block UUID * @returns Comparison result */ compareFieldPriority: (uuidA: string, uuidB: string) => number; }; export default function (dom: DomProvider, types: BlockDefinitionProvider, state: StateProvider, blocks: BlocksProvider): FieldsProvider;