import type { DesignDocument, DocumentEngine, DocumentValue } from '../document/contracts.js'; import type { BindingScopeUse, DataBinding, DataBindingDocument, DataCatalog, DataField, DataSlot, RepeatBinding } from './contracts.js'; export declare const DATA_FIELD_DRAG_TYPE = "application/x-pygmalion-data-field"; /** A current document view and the transaction boundary that commits its explicit edits. */ export type DataBindingAuthoringTarget = Pick; export declare function dataFieldChoiceKey(fieldId: string, scope: BindingScopeUse): string; export declare function parseDataFieldDragPayload(raw: string): { fieldId: string; scope: BindingScopeUse; } | null; export declare function documentDataBindings(snapshot: DesignDocument, catalog: DataCatalog, screenId: string): DataBindingDocument; export declare function availableDataFields(snapshot: DesignDocument, catalog: DataCatalog, document: DataBindingDocument, nodeId: string): readonly { field: DataField; scope: BindingScopeUse; label: string; }[]; export declare function compatibleDataSlots(snapshot: DesignDocument, catalog: DataCatalog, nodeId: string, field: DataField): readonly DataSlot[]; /** One command contributes to the document engine's single transaction. */ export declare function connectDocumentDataField(engine: DataBindingAuthoringTarget, catalog: DataCatalog, screenId: string, nodeId: string, fieldId: string, slotId?: string, explicitScope?: BindingScopeUse, availableRepeats?: readonly RepeatBinding[]): boolean; export interface DataScopeDescription { use: BindingScopeUse; /** Declared catalog scope, or an empty string when the referenced repeat or collection is unavailable. */ scopeId: string; label: string; templateNodeId?: string; templateName?: string; } /** Describe a scope use from declarations and the referenced template, never from displayed values. */ export declare function describeDataScope(catalog: DataCatalog, document: DataBindingDocument, snapshot: DesignDocument, use: BindingScopeUse): DataScopeDescription; /** * The written-content rule shared by every disconnection path: a declared text-content slot on an * actual text layer, under the matching catalog. The caller records both the node patch and the * authored replacement in the same transaction, so source review can distinguish it from capture. */ export declare function writtenContentConversion(snapshot: DesignDocument, catalog: DataCatalog, stored: DataBindingDocument, binding: DataBinding, writtenText: string): { nodeId: string; properties: Record; replacement: NonNullable[number]; }; export declare function detachDocumentDataField(engine: DataBindingAuthoringTarget, bindingId: string): boolean; export declare function detachDocumentDataField(engine: DataBindingAuthoringTarget, bindingId: string, writtenText: string, catalog: DataCatalog): boolean; export declare function updateDocumentBinding(engine: DataBindingAuthoringTarget, bindingId: string, patch: Pick, 'missing' | 'formatter' | 'condition'>): boolean; /** Return a repeated template to one authored layer and remove only its item-scope connections. */ export declare function detachDocumentRepeat(engine: DataBindingAuthoringTarget, repeatId: string): boolean;