diff --git a/docs/BUILD_FIX_COMPLETE.md b/docs/BUILD_FIX_COMPLETE.md index 2ed9fe0..78023a0 100644 --- a/docs/BUILD_FIX_COMPLETE.md +++ b/docs/BUILD_FIX_COMPLETE.md @@ -46,7 +46,7 @@ Replaced all imports of `@github/spark/hooks` with the local `@/hooks/use-kv` im ### Config Files - `src/config/orchestration/data-source-manager.ts` -- `src/lib/json-ui/hooks.ts` +- `src/lib/json-ui/hooks.ts` (re-exported via `@/lib/json-ui`) ## Change Pattern All instances of: diff --git a/docs/JSON-UI-IMPLEMENTATION.md b/docs/JSON-UI-IMPLEMENTATION.md index 7d4b6f2..b11664f 100644 --- a/docs/JSON-UI-IMPLEMENTATION.md +++ b/docs/JSON-UI-IMPLEMENTATION.md @@ -27,7 +27,7 @@ Successfully implemented a comprehensive JSON-driven UI system that allows build - Array looping for lists - Form rendering with validation -- **hooks.ts**: React hooks for data management +- **hooks.ts**: React hooks for data management (import from `@/lib/json-ui`) - `useJSONDataSource`: Single data source management (KV, API, static, computed) - `useJSONDataSources`: Multiple data sources orchestration - `useJSONActions`: Action registration and execution diff --git a/docs/JSON-UI-SYSTEM.md b/docs/JSON-UI-SYSTEM.md index 450cdc4..d11c69f 100644 --- a/docs/JSON-UI-SYSTEM.md +++ b/docs/JSON-UI-SYSTEM.md @@ -275,6 +275,12 @@ registerComponent('MyCustom', MyCustomComponent) ### Add Custom Data Source Types +Use the public entrypoint when consuming JSON UI hooks: + +```typescript +import { useJSONDataSource, useJSONDataSources, useJSONActions } from '@/lib/json-ui' +``` + Edit `/src/lib/json-ui/hooks.ts` to add new data source handlers. ### Add Custom Actions @@ -296,7 +302,7 @@ const handleAction = (handler: EventHandler, event?: any) => { - **Schema Definitions**: `/src/lib/json-ui/schema.ts` - **Component Registry**: `/src/lib/json-ui/component-registry.ts` - **Renderer**: `/src/lib/json-ui/renderer.tsx` -- **Hooks**: `/src/lib/json-ui/hooks.ts` +- **Hooks**: Import from `@/lib/json-ui` (source: `/src/lib/json-ui/hooks.ts`) - **Utils**: `/src/lib/json-ui/utils.ts` - **Examples**: `/src/config/ui-examples/` - **Demo Page**: `/src/components/JSONUIShowcase.tsx` diff --git a/src/lib/json-ui/README.md b/src/lib/json-ui/README.md index eb02990..0b0ce62 100644 --- a/src/lib/json-ui/README.md +++ b/src/lib/json-ui/README.md @@ -226,6 +226,14 @@ const component: UIComponent = { } ``` +### Hooks + +Consume JSON UI data hooks from the public entrypoint: + +```typescript +import { useJSONDataSource, useJSONDataSources, useJSONActions } from '@/lib/json-ui' +``` + ## 📦 Exports ```typescript diff --git a/src/lib/json-ui/index.ts b/src/lib/json-ui/index.ts index bd0b187..1e33845 100644 --- a/src/lib/json-ui/index.ts +++ b/src/lib/json-ui/index.ts @@ -1,5 +1,6 @@ export { JSONUIRenderer, JSONFormRenderer } from './renderer' export { getUIComponent, uiComponentRegistry, registerComponent } from './component-registry' +export * from './hooks' export * from './schema' export * from './utils' export * from './validator'