@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 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(_props: BuilderHeaderProps): JSX.Element;
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;