@kform/scaffolder
Version:
Scaffolding utilities for KForm projects.
32 lines (31 loc) • 1.39 kB
TypeScript
import * as React from "react";
import { Scaffolder } from "./scaffolding/scaffold";
import { Schematic } from "./Schematic";
import { SchematicKind } from "./SchematicKind";
export interface DraggedSchematic {
id: string;
type: string;
node: React.ReactNode;
}
export interface SchematicBuilderContextValue {
name: string;
basePath?: string;
basePackage?: string;
baseDir?: string | ((schematic: Schematic) => string);
schematicKinds: Map<string, SchematicKind>;
scaffolders: Scaffolder<any>[] | ((schematic: Schematic) => Scaffolder<any>[]);
scaffoldingData?: Record<string, any> | ((schematic: Schematic) => Record<string, any>);
getRootSchematic: () => Schematic;
useSchematic: <T>(selector: (schematic: Schematic) => T) => T;
setSchematic: ((schematic: Partial<Schematic>) => void) & ((setter: (schematic: Schematic) => Partial<Schematic>) => void);
removeSchematic: () => void;
parentPackage?: string;
parentId?: string;
parentChildName?: string;
draggedSchematic: DraggedSchematic | null;
disableDrop?: boolean;
ignoreDrop?: boolean;
latestSchematicFileHandle: React.MutableRefObject<FileSystemFileHandle | null>;
}
export declare const SchematicBuilderContext: React.Context<SchematicBuilderContextValue | null>;
export declare function useSchematicBuilderContext(): SchematicBuilderContextValue;