@animaapp/anima-sdk 0.4.3 → 0.4.4

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
@@ -73,7 +73,7 @@ export declare class CodegenError extends Error {
73
73
  /**
74
74
  * Codegen errors from the worker
75
75
  */
76
- export declare type CodegenErrorReason = "Selected node type is not supported" | "Invisible group nodes are unsupported" | "Selected node is a page with multiple children" | "There is no node with the given id" | "Invalid Figma token" | "Anima API connection error" | "Figma token expired" | "Invalid user token" | "Figma file not found" | "Figma rate limit exceeded" | "Figma selection too large" | "Invalid responsive page node type" | "Unknown";
76
+ export declare type CodegenErrorReason = "Selected node type is not supported" | "Invisible group nodes are unsupported" | "Selected node is a page with multiple children" | "Selected node is a page with no valid children" | "There is no node with the given id" | "Invalid Figma token" | "Anima API connection error" | "Figma token expired" | "Invalid user token" | "Figma file not found" | "Figma rate limit exceeded" | "Figma selection too large" | "Invalid responsive page node type" | "Unknown";
77
77
 
78
78
  export declare type CodegenResult = BaseResult & {
79
79
  files: Record<string, {
@@ -103,6 +103,7 @@ export declare type CodegenSettings = {
103
103
  enableAutoSplit?: boolean;
104
104
  autoSplitThreshold?: number;
105
105
  disableMarkedForExport?: boolean;
106
+ allowAutoSelectFirstNode?: boolean;
106
107
  enableDisplayScreenModelId?: boolean;
107
108
  enableGeneratePackageLock?: boolean;
108
109
  };
@@ -308,14 +309,17 @@ export declare const getRelatedScreenFiles: ({ files, screenPath, }: {
308
309
  screenPath?: string;
309
310
  }) => AnimaFiles;
310
311
 
311
- declare type InvalidNodeForCodegenReason = "Selected node is a page with multiple children" | "There is no node with the given id" | "Selected node type is not supported";
312
+ declare type InvalidNodeForCodegenReason = "Selected node is a page with multiple children" | "Selected node is a page with no valid children" | "There is no node with the given id" | "Selected node type is not supported";
312
313
 
313
314
  export declare const isFigmaTokenIssue: (error: Error) => boolean;
314
315
 
315
316
  /**
316
- * Check if the pair "design" + "node id" are valid for code generation.
317
+ * Check if the pair "design" + "node id" is valid for code generation.
318
+ * May recommend a node that is not the one passed as argument.
317
319
  */
318
- export declare const isNodeCodegenCompatible: (design: GetFileResponse, nodeId: string) => ValidateNodeForCodegenResult;
320
+ export declare const isNodeCodegenCompatible: (design: GetFileResponse, nodeId: string, options?: {
321
+ allowAutoSelectFirstNode: boolean;
322
+ }) => ValidateNodeForCodegenResult;
319
323
 
320
324
  export declare const isNotFound: (error: Error) => boolean;
321
325
 
@@ -521,6 +525,10 @@ declare type ValidateNodeForCodegenResult = {
521
525
  isValid: true;
522
526
  node: FigmaNode;
523
527
  note?: "Selected node is a page with a single valid children - returning it instead";
528
+ } | {
529
+ isValid: true;
530
+ node: FigmaNode;
531
+ note?: "Selected node is a page with multiple valid children - returning the first one instead";
524
532
  } | {
525
533
  isValid: false;
526
534
  reason: InvalidNodeForCodegenReason;