import { ComponentType } from 'react';
import { FieldDefinition, CmssyBlockContext, BlockPropsSchema, InferBlockContent, BlockSchema } from '@cmssy/core';
interface BlockProps
{
content: InferBlockContent
;
style?: Record;
advanced?: Record;
context?: CmssyBlockContext;
data?: D;
}
type Identical = (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? true : false;
type SchemaSlice = {
[K in keyof Content]: K extends keyof C ? C[K] : never;
};
type ContentGuard = Identical>, InferBlockContent> extends true ? unknown : {
CONTENT_MUST_BE_TYPED_AS_BlockProps_OF_THIS_PROPS: InferBlockContent
;
};
interface BlockLoaderArgs {
content: Record;
context?: CmssyBlockContext;
}
type BlockLoader = (args: BlockLoaderArgs) => Promise | unknown;
interface BlockDefinition {
type: string;
label?: string;
category?: string;
icon?: string;
layoutPositions?: string[];
description?: string;
props: Record;
loader?: BlockLoader;
component: ComponentType<{
content: Record;
style?: Record;
advanced?: Record;
context?: CmssyBlockContext;
data?: unknown;
}>;
}
declare function defineBlock, D = unknown, S extends Record = Record, A extends Record = Record>(def: {
type: string;
label?: string;
category?: string;
icon?: string;
layoutPositions?: string[];
description?: string;
props: P;
loader?: (args: {
content: InferBlockContent;
context?: CmssyBlockContext;
}) => Promise | D;
component: ComponentType<{
content: C;
style?: S;
advanced?: A;
context?: CmssyBlockContext;
data?: D;
}>;
} & ContentGuard): BlockDefinition;
type BlockMap = Record;
style?: Record;
advanced?: Record;
context?: CmssyBlockContext;
data?: unknown;
}>>;
declare function buildBlockMap(blocks: BlockDefinition[]): BlockMap;
declare function blocksToSchemas(blocks: BlockDefinition[]): Record;
export { type BlockDefinition as B, type BlockMap as a, type BlockProps as b, buildBlockMap as c, defineBlock as d, blocksToSchemas as e };