import { z } from 'zod'; import { CompactNode } from '../compact/types'; import { PropsObject, PropSpec } from './props'; import { SxKeyDoc, SxSchema } from './sx'; /** `text: true` = may hold text instead of child nodes. */ export type NodeContent = { kind: 'text'; } | { kind: 'none'; } | { kind: 'nodes'; accepts?: readonly string[]; min?: number; text?: boolean; }; export type RuleContext = { typographyPresets?: { fontSize: string | number; lineHeight: string | number; }[]; variableKeys?: string[]; /** Names of the consumer's forms (`resources.forms`), which `name` of a form node may reference. */ formNames?: string[]; }; /** * `path` is relative to the node, e.g. `'children[1]'` or `'props.sx.fontSize'`. `related` lists other node-relative * paths the issue is about (e.g. the paired `props.sx.lineHeight`): a proposal that writes any of them owns the issue. */ export type RuleIssue = { path: string; message: string; related?: string[]; }; export type NodeRule = { description: string; check(node: CompactNode, ctx: RuleContext): RuleIssue[]; }; export type NodeSchemaDef
= Record , X> = X extends SxSchema ? P & {
sx: X;
} : P;
/** `writable` defaults to true; `propsSchema` holds `props` plus `sx`. */
export declare function defineNodeSchema = Record ): NodeSchema = z.infer;
/**
* Compile-time check for schema files: `type _Check = Assignable