import { JSONSchema } from 'json-schema-to-ts'; type Schema = {} | (JSONSchema & { type: "object"; }); export interface BlockPreset = Record> { label: string; description?: string; group?: string; state: TState; context: TContext; } export type BlockPresets = Record>>; export type BlockRenderer = (block: BlockInstance) => HTMLElement; export type BlockLocaleFile = { overrides?: Record; [key: string]: string | Record | undefined; }; export type BlockDefinition = { name: string; group: "internal" | "juo" | "theme" | "integration" | "page" | "workflow" | "action"; schema: Schema; initialValue: T | (() => T); render: BlockRenderer; presets?: BlockPresets; locales?: { /** Locale codes supported by this block (e.g. ["en", "de", "nl"]). */ supported?: string[]; load: (locale: string) => Promise; }; }; export type Block = { id: string; type: string; props: any; slots: any; }; export type BlockInstance = Block & { readonly definition: BlockDefinition; }; export declare function serializeBlocks(blocks: (Block | BlockInstance)[]): Block[]; export declare function createSelectedBlock(): { selected: import('@preact/signals-core').Signal; setSelection: (block: BlockInstance) => void; clearSelection: (block?: BlockInstance) => void; }; export declare const SelectedBlockContext: { __context__: { selected: import('@preact/signals-core').Signal; setSelection: (block: BlockInstance) => void; clearSelection: (block?: BlockInstance) => void; }; }; declare global { interface Window { _juoBlocks: Map>; } } export declare class BlockWrapperEvent extends Event { readonly block: BlockInstance; readonly callback: (wrapper: HTMLElement) => void; constructor(block: BlockInstance, callback: (wrapper: HTMLElement) => void); } declare global { interface HTMLElementEventMap { "juo:block-wrapper-render": BlockWrapperEvent; } } export declare function withWrapper(fn: (block: BlockInstance) => HTMLElement): (block: BlockInstance) => HTMLElement; export declare function registerBlock(block: BlockDefinition): void; export declare function onRegisterBlock(cb: (name: string, block: BlockDefinition) => void): void; export declare function defineBlock(name: string, opts: { group: "internal" | "juo" | "theme" | "integration" | "page" | "workflow" | "action"; schema: JSONSchema; initialValue: T | (() => T); renderer: (block: BlockInstance) => HTMLElement; presets?: BlockPresets; locales?: { supported?: string[]; load: (locale: string) => Promise; }; }): BlockDefinition; export declare function defineBlockRuntime(name: string, opts: { group: "internal" | "juo" | "theme" | "integration" | "page" | "workflow" | "action"; renderer: (block: BlockInstance) => HTMLElement; }): BlockDefinition; export declare function getDefinedBlocks(): BlockDefinition[]; export declare function createCeRenderer(name: string): (block: BlockInstance) => HTMLDivElement; export declare function createBlockInstance(name: string, opts?: { props?: any; slots?: any; id?: string; }): BlockInstance; export declare function createBlockInstanceFromObject(input: Block): BlockInstance; export declare function createBlockInstanceFromJSON(input: string): BlockInstance; export {};