@esheet/builder 0.0.4-0 → 0.0.4-2
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/dist/index.d.ts +19 -2
- package/dist/index.js +22105 -7909
- package/dist/lib/EsheetBuilder.js +111 -0
- package/dist/lib/builder-tools.js +321 -0
- package/dist/lib/components/BuilderHeader.js +390 -0
- package/dist/lib/components/Canvas.js +288 -0
- package/dist/lib/components/CodeView.js +197 -0
- package/dist/lib/components/FeedbackModal.js +22 -0
- package/dist/lib/components/FieldWrapper.js +152 -0
- package/dist/lib/components/MobileBottomDrawer.js +6 -0
- package/dist/lib/components/ToolPanel.js +117 -0
- package/dist/lib/components/edit-panel/CommonEditor.js +16 -0
- package/dist/lib/components/edit-panel/DraftIdEditor.js +32 -0
- package/dist/lib/components/edit-panel/EditPanel.js +156 -0
- package/dist/lib/components/edit-panel/InputTypeEditor.js +32 -0
- package/dist/lib/components/edit-panel/LogicEditor.js +392 -0
- package/dist/lib/components/edit-panel/MatrixEditor.js +32 -0
- package/dist/lib/components/edit-panel/OptionListEditor.js +27 -0
- package/dist/lib/hooks/useFormApi.js +80 -0
- package/dist/lib/hooks/useUiApi.js +37 -0
- package/dist/lib/hooks/useVisibleRootIds.js +32 -0
- package/dist/lib/icons.js +47 -0
- package/dist/lib/mcp/index.js +4 -0
- package/dist/lib/mcp/system-prompt.js +9 -0
- package/dist/lib/mcp/tool-definitions.js +436 -0
- package/dist/lib/mcp/tool-executor.js +482 -0
- package/dist/lib/mcp/useBuilderToolBridge.js +56 -0
- package/dist/lib/register-defaults.js +37 -0
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -30,9 +30,11 @@ export declare const BUILDER_TOOL_DEFINITIONS: readonly ToolDefinition[];
|
|
|
30
30
|
/**
|
|
31
31
|
* BuilderHeader — top bar with Build/Code/Preview mode toggle and Import/Export actions.
|
|
32
32
|
*/
|
|
33
|
-
export declare function BuilderHeader(
|
|
33
|
+
export declare function BuilderHeader({ allowDangerousJS, }: BuilderHeaderProps): JSX.Element;
|
|
34
34
|
|
|
35
35
|
export declare interface BuilderHeaderProps {
|
|
36
|
+
/** When false (default), hides the JS toggle and prevents enabling dangerous JS. */
|
|
37
|
+
allowDangerousJS?: boolean;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export { BuilderMode }
|
|
@@ -79,6 +81,7 @@ export declare interface BuilderTools {
|
|
|
79
81
|
option: {
|
|
80
82
|
add: (fieldId: string, value?: string) => string | null;
|
|
81
83
|
update: (fieldId: string, optionId: string, value: string) => boolean;
|
|
84
|
+
setScore: (fieldId: string, optionId: string, score: number | undefined) => boolean;
|
|
82
85
|
remove: (fieldId: string, optionId: string) => boolean;
|
|
83
86
|
};
|
|
84
87
|
/** Granular row mutations (matrix fields). */
|
|
@@ -91,6 +94,7 @@ export declare interface BuilderTools {
|
|
|
91
94
|
column: {
|
|
92
95
|
add: (fieldId: string, value?: string) => string | null;
|
|
93
96
|
update: (fieldId: string, columnId: string, value: string) => boolean;
|
|
97
|
+
setScore: (fieldId: string, columnId: string, score: number | undefined) => boolean;
|
|
94
98
|
remove: (fieldId: string, columnId: string) => boolean;
|
|
95
99
|
};
|
|
96
100
|
/** Move a field to a new index. */
|
|
@@ -145,6 +149,13 @@ export declare interface EsheetBuilderProps {
|
|
|
145
149
|
definition?: FormDefinition | Record<string, unknown>;
|
|
146
150
|
/** Callback fired when the form definition changes. */
|
|
147
151
|
onChange?: (definition: FormDefinition) => void;
|
|
152
|
+
/**
|
|
153
|
+
* Opt-in to allow dangerously embedded JavaScript in this builder instance.
|
|
154
|
+
* When `false` (default), the JS toggle is hidden and any `dangerouslyAllowJS: true`
|
|
155
|
+
* flag in the loaded schema is suppressed — JS never executes regardless of schema content.
|
|
156
|
+
* Only set to `true` when you fully control and trust the form schemas being authored.
|
|
157
|
+
*/
|
|
158
|
+
allowDangerousJS?: boolean;
|
|
148
159
|
/**
|
|
149
160
|
* Called once after the builder mounts, providing a narrow `BuilderTools`
|
|
150
161
|
* facade for MCP / AI tool integrations. Not intended for general developer use —
|
|
@@ -228,7 +239,7 @@ export declare interface FieldSummary {
|
|
|
228
239
|
* </FieldWrapper>
|
|
229
240
|
* ```
|
|
230
241
|
*/
|
|
231
|
-
export declare function FieldWrapper({ fieldId, form, ui, dragHandleRef, isSelectedOverride, onSelectOverride, selectedVariant, forceExpandVersion, forceCollapseVersion, children, }: FieldWrapperProps): JSX.Element | null;
|
|
242
|
+
export declare function FieldWrapper({ fieldId, form, ui, dragHandleRef, isSelectedOverride, onSelectOverride, selectedVariant, forceExpandVersion, forceCollapseVersion, computedValue, children, }: FieldWrapperProps): JSX.Element | null;
|
|
232
243
|
|
|
233
244
|
export declare interface FieldWrapperProps {
|
|
234
245
|
/** The field ID */
|
|
@@ -249,6 +260,8 @@ export declare interface FieldWrapperProps {
|
|
|
249
260
|
forceExpandVersion?: number;
|
|
250
261
|
/** Optional signal used to force collapse a field wrapper. */
|
|
251
262
|
forceCollapseVersion?: number;
|
|
263
|
+
/** Computed value from setValue effects (if applicable). */
|
|
264
|
+
computedValue?: string | number | null;
|
|
252
265
|
/** Render function that receives field data and tools */
|
|
253
266
|
children: (props: FieldWrapperRenderProps) => default_2.ReactNode;
|
|
254
267
|
}
|
|
@@ -266,6 +279,8 @@ export declare interface FormApi {
|
|
|
266
279
|
isVisible: boolean;
|
|
267
280
|
isEnabled: boolean;
|
|
268
281
|
isRequired: boolean;
|
|
282
|
+
isReadOnly: boolean;
|
|
283
|
+
isSoftRequired: boolean;
|
|
269
284
|
normalized: NormalizedDefinition;
|
|
270
285
|
responses: FieldResponseMap;
|
|
271
286
|
instanceId: string;
|
|
@@ -289,6 +304,7 @@ export declare interface FormApi {
|
|
|
289
304
|
option: {
|
|
290
305
|
add: (value?: string) => string | null;
|
|
291
306
|
update: (optId: string, value: string) => boolean;
|
|
307
|
+
setScore: (optId: string, score: number | undefined) => boolean;
|
|
292
308
|
remove: (optId: string) => boolean;
|
|
293
309
|
};
|
|
294
310
|
row: {
|
|
@@ -299,6 +315,7 @@ export declare interface FormApi {
|
|
|
299
315
|
column: {
|
|
300
316
|
add: (value?: string) => string | null;
|
|
301
317
|
update: (colId: string, value: string) => boolean;
|
|
318
|
+
setScore: (colId: string, score: number | undefined) => boolean;
|
|
302
319
|
remove: (colId: string) => boolean;
|
|
303
320
|
};
|
|
304
321
|
_form: FormStore;
|