import { default as Compiler } from '../../../compiler/index'; import { Filepath, FilepathId, SettingName } from '../../types'; import { Column, CustomMetadataValue, CustomMetadataValueType, ArchGroup, ArchNode, Note, Ref, Table, TableGroup, TokenPosition } from '../../types/schemaJson'; import { SyntaxNode } from '../../types/nodes'; import { NodeSymbol, NodeMetadata } from '../../types/symbol'; export type MetadataTarget = Table | TableGroup | Note | Column | Ref | ArchNode | ArchGroup; /** * Spec for one builtin metadata field (table's note, tablegroup's color, .etc) of an element kind. * Used for both the inline settings list and Metadata blocks: * - `parse`: Read the field's own value from a source node, `undefined` means the value is invalid * - `assign`: Write the parsed value to the element builtin props (e.g. write `table.note` instead of `table.metadata`) */ export type MetadataField = { /** Type of the parsed value, reported when the field is read as a metadata entry */ type: CustomMetadataValueType; /** Parse the source node into the field's value, `undefined` if the node is not a valid value for this field */ parse(node?: SyntaxNode): V | undefined; message: string; /** Write the parsed value to the element builtin props (e.g. write to `table.note`) */ assign(element: Partial, value: V, token: TokenPosition): void; }; export type MetadataFieldRegistry = { [K in keyof R]: MetadataField; }; /** Get precedence score of files in import tree, lower score means lower precedence */ export declare function metadataFilePrecedence(compiler: Compiler, root: Filepath): Map; /** * Merge every custom-metadata block applying to the target in the current program (in precedence order) to its `metadata` and other builtin (note/headercolor/...) fields * NOTE: Only run during interpret phase */ export declare function attachCustomMetadata(compiler: Compiler, targetElement: Partial, targetSymbol: NodeSymbol | NodeMetadata, fieldsRegistry: MetadataFieldRegistry, filepath: Filepath): void;