@esheet/renderer 0.0.3 → 0.0.4-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.d.ts +9 -102
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5284 -4315
- package/dist/lib/EsheetRenderer.d.ts +116 -0
- package/dist/lib/EsheetRenderer.d.ts.map +1 -0
- package/dist/lib/EsheetRenderer.js +115 -0
- package/dist/lib/components/FieldNode.d.ts +17 -0
- package/dist/lib/components/FieldNode.d.ts.map +1 -0
- package/dist/lib/components/FieldNode.js +96 -0
- package/dist/lib/components/RendererBody.d.ts +14 -0
- package/dist/lib/components/RendererBody.d.ts.map +1 -0
- package/dist/lib/components/RendererBody.js +45 -0
- package/dist/lib/components/index.d.ts +3 -0
- package/dist/lib/components/index.d.ts.map +1 -0
- package/dist/lib/components/index.js +2 -0
- package/dist/lib/hooks/index.d.ts +2 -0
- package/dist/lib/hooks/index.d.ts.map +1 -0
- package/dist/lib/hooks/index.js +1 -0
- package/dist/lib/hooks/useRendererInit.d.ts +12 -0
- package/dist/lib/hooks/useRendererInit.d.ts.map +1 -0
- package/dist/lib/hooks/useRendererInit.js +87 -0
- package/dist/lib/mcp/index.d.ts +7 -0
- package/dist/lib/mcp/index.d.ts.map +1 -0
- package/dist/lib/mcp/index.js +4 -0
- package/dist/lib/mcp/system-prompt.d.ts +2 -0
- package/dist/lib/mcp/system-prompt.d.ts.map +1 -0
- package/dist/lib/mcp/system-prompt.js +24 -0
- package/dist/lib/mcp/tool-definitions.d.ts +10 -0
- package/dist/lib/mcp/tool-definitions.d.ts.map +1 -0
- package/dist/lib/mcp/tool-definitions.js +66 -0
- package/dist/lib/mcp/tool-executor.d.ts +5 -0
- package/dist/lib/mcp/tool-executor.d.ts.map +1 -0
- package/dist/lib/mcp/tool-executor.js +55 -0
- package/dist/lib/mcp/useRendererToolBridge.d.ts +28 -0
- package/dist/lib/mcp/useRendererToolBridge.d.ts.map +1 -0
- package/dist/lib/mcp/useRendererToolBridge.js +53 -0
- package/dist/lib/register-defaults.d.ts +2 -0
- package/dist/lib/register-defaults.d.ts.map +1 -0
- package/dist/lib/register-defaults.js +36 -0
- package/dist/lib/renderer-tools.d.ts +56 -0
- package/dist/lib/renderer-tools.d.ts.map +1 -0
- package/dist/lib/renderer-tools.js +305 -0
- package/dist/lib/renderer.d.ts +28 -0
- package/dist/lib/renderer.d.ts.map +1 -0
- package/dist/lib/renderer.js +33 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ import { EsheetRenderer } from '@esheet/renderer';
|
|
|
39
39
|
import type { FormDefinition } from '@esheet/core';
|
|
40
40
|
|
|
41
41
|
const myForm: FormDefinition = {
|
|
42
|
-
|
|
42
|
+
id: 'patient-intake',
|
|
43
43
|
title: 'Patient Intake',
|
|
44
44
|
fields: [
|
|
45
45
|
{
|
|
@@ -105,7 +105,7 @@ function App() {
|
|
|
105
105
|
|
|
106
106
|
```tsx
|
|
107
107
|
const yamlSchema = `
|
|
108
|
-
|
|
108
|
+
id: simple-form
|
|
109
109
|
title: Simple Form
|
|
110
110
|
fields:
|
|
111
111
|
- id: q1
|
|
@@ -164,7 +164,7 @@ EsheetRenderer is a thin wrapper that:
|
|
|
164
164
|
|
|
165
165
|
```tsx
|
|
166
166
|
const conditionalForm: FormDefinition = {
|
|
167
|
-
|
|
167
|
+
id: 'conditional-form',
|
|
168
168
|
title: 'Conditional Form',
|
|
169
169
|
fields: [
|
|
170
170
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -1,102 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
* Renders a form in fill-out mode with conditional visibility logic.
|
|
12
|
-
* Reuses all field components from @esheet/fields.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* const rendererRef = useRef<EsheetRendererHandle>(null);
|
|
17
|
-
*
|
|
18
|
-
* <EsheetRenderer
|
|
19
|
-
* formData={myFormDefinition}
|
|
20
|
-
* initialResponses={{ field1: 'answer' }}
|
|
21
|
-
* ref={rendererRef}
|
|
22
|
-
* />
|
|
23
|
-
*
|
|
24
|
-
* // Later: get responses
|
|
25
|
-
* const responses = rendererRef.current?.getRawResponse();
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare const EsheetRenderer: default_2.ForwardRefExoticComponent<EsheetRendererProps & default_2.RefAttributes<EsheetRendererHandle>>;
|
|
29
|
-
|
|
30
|
-
export declare interface EsheetRendererHandle {
|
|
31
|
-
/** Get current form responses */
|
|
32
|
-
getRawResponse: () => FormResponse;
|
|
33
|
-
/** Get form store instance */
|
|
34
|
-
getFormStore: () => FormStore;
|
|
35
|
-
/** Get UI store instance */
|
|
36
|
-
getUIStore: () => UIStore;
|
|
37
|
-
/** Get validated form responses (returns null if invalid) */
|
|
38
|
-
getValidResponse: () => {
|
|
39
|
-
response: FormResponse | null;
|
|
40
|
-
errors: ValidationError[];
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export declare interface EsheetRendererProps {
|
|
45
|
-
/** Form definition — accepts FormDefinition, SurveyJS schema, MCP elicitation envelope,
|
|
46
|
-
* or any of the above as a JSON/YAML string. Auto-detected and converted internally.
|
|
47
|
-
* Set `strict` to disable auto-conversion and require a valid FormDefinition directly. */
|
|
48
|
-
formDataInput: unknown;
|
|
49
|
-
/** Additional CSS classes for root container */
|
|
50
|
-
className?: string;
|
|
51
|
-
/** Initial form responses (pre-fill data) */
|
|
52
|
-
initialResponses?: FormResponse;
|
|
53
|
-
/** When true, disables auto-detection of MCP/SurveyJS formats.
|
|
54
|
-
* Only accepts a valid eSheet FormDefinition (or JSON/YAML string thereof). */
|
|
55
|
-
strict?: boolean;
|
|
56
|
-
/** Called after the form definition has been parsed and loaded into the store. */
|
|
57
|
-
onReady?: () => void;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* FieldNode - Renders a single field or section with recursive children
|
|
62
|
-
*
|
|
63
|
-
* Looks up the field component from the registry and passes field props.
|
|
64
|
-
* For sections, recursively renders visible children.
|
|
65
|
-
*/
|
|
66
|
-
export declare const FieldNode: default_2.NamedExoticComponent<FieldNodeProps>;
|
|
67
|
-
|
|
68
|
-
declare interface FieldNodeProps {
|
|
69
|
-
id: string;
|
|
70
|
-
form: FormStore;
|
|
71
|
-
ui: UIStore;
|
|
72
|
-
/** Nesting depth for visual styling (default: 0) */
|
|
73
|
-
depth?: number;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* RendererBody - Iterates over visible root fields and renders them
|
|
78
|
-
*
|
|
79
|
-
* Respects conditional visibility logic from form store.
|
|
80
|
-
* Only renders fields where isVisible() returns true.
|
|
81
|
-
* Sections recursively render their visible children.
|
|
82
|
-
*/
|
|
83
|
-
export declare function RendererBody({ form, ui }: RendererBodyProps): JSX.Element;
|
|
84
|
-
|
|
85
|
-
declare interface RendererBodyProps {
|
|
86
|
-
form: FormStore;
|
|
87
|
-
ui: UIStore;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Initialize renderer with form definition.
|
|
92
|
-
*
|
|
93
|
-
* Auto-detects and converts the following input formats:
|
|
94
|
-
* - eSheet FormDefinition (object or JSON/YAML string)
|
|
95
|
-
* - MCP elicitation/create envelope
|
|
96
|
-
* - SurveyJS schema (has top-level `pages` or `elements` array)
|
|
97
|
-
*/
|
|
98
|
-
export declare function useRendererInit(form: FormStore, ui: UIStore, formData: unknown, initialResponses?: FormResponse, onValidationError?: (errors: string[]) => void, strict?: boolean, onReady?: () => void): void;
|
|
99
|
-
|
|
100
|
-
export { ValidationError }
|
|
101
|
-
|
|
102
|
-
export { }
|
|
1
|
+
import './index.output.css';
|
|
2
|
+
export { EsheetRenderer, type EsheetRendererProps, type EsheetRendererHandle, type GetResponseOptions, type GetResponseResult, type ResponseFormat, } from './lib/EsheetRenderer.js';
|
|
3
|
+
export type { FormDefinition, FormResponseEnvelope, ValidationError, } from '@esheet/core';
|
|
4
|
+
export { RendererBody, FieldNode } from './lib/components/index.js';
|
|
5
|
+
export { useRendererInit } from './lib/hooks/index.js';
|
|
6
|
+
export { executeToolCall, RENDERER_TOOL_DEFINITIONS, RENDERER_SYSTEM_PROMPT, useRendererMcpToolHandler, } from './lib/mcp/index.js';
|
|
7
|
+
export type { ToolDefinition, UseRendererMcpToolHandlerOptions, } from './lib/mcp/index.js';
|
|
8
|
+
export type { RendererTools } from './lib/renderer-tools.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAG5B,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,cAAc,EACd,gCAAgC,GACjC,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC"}
|