UNPKG

@angelerator/uuics-react

Version:

Universal UI Context System - React hooks and components

67 lines (59 loc) 1.98 kB
import { UUICSConfig, PageContext, ActionCommand, ActionResult, UUICSEngine, UIElement } from '@angelerator/uuics-core'; export { Action, ActionCommand, ActionParameters, ActionResult, ActionType, ElementType, FormState, PageContext, SerializationFormat, SerializedContext, UIElement, UUICSConfig } from '@angelerator/uuics-core'; import * as react_jsx_runtime from 'react/jsx-runtime'; import React, { ReactNode } from 'react'; /** * UUICS React Hook */ /** * Hook to use UUICS in a React component */ declare function useUICS(config?: UUICSConfig): { context: PageContext | null; isInitialized: boolean; execute: (command: ActionCommand) => Promise<ActionResult>; executeBatch: (commands: ActionCommand[]) => Promise<ActionResult[]>; serialize: (format?: "json" | "natural" | "openapi") => string; scan: () => Promise<PageContext | null>; engine: UUICSEngine | null; }; /** * Hook to access a specific UI element */ /** * Hook to find and track a specific UI element */ declare function useUIElement(selector: string): UIElement | null; /** * Hook to find elements by type */ declare function useUIElements(type: string): UIElement[]; /** * UUICS Context type */ type UUICSContextType = ReturnType<typeof useUICS>; /** * Provider props */ interface UUICSProviderProps { children: ReactNode; config?: UUICSConfig; } /** * UUICS Provider component */ declare function UUICSProvider({ children, config }: UUICSProviderProps): react_jsx_runtime.JSX.Element; /** * Hook to use UUICS from context */ declare function useUUICSContext(): UUICSContextType; interface DebugPanelProps { format?: 'json' | 'natural' | 'openapi'; className?: string; style?: React.CSSProperties; } /** * Debug Panel component */ declare function DebugPanel({ format, className, style, }: DebugPanelProps): react_jsx_runtime.JSX.Element; export { DebugPanel, UUICSProvider, useUICS, useUIElement, useUIElements, useUUICSContext };