@animaapp/anima-sdk 0.3.12 → 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.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +17 -5
- package/dist/index.js +1053 -1037
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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" | "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, {
|
|
@@ -85,7 +85,7 @@ export declare type CodegenResult = BaseResult & {
|
|
|
85
85
|
/**
|
|
86
86
|
* Codegen errors from the "/codegen" route
|
|
87
87
|
*/
|
|
88
|
-
export declare type CodegenRouteErrorReason = "Missing Authorization header" | "Invalid Authorization header" | "Missing teamId" | "Internal server error" | "Forbidden, no team access" | "Requested Usage Exceeds Limit" | "Invalid Anima token";
|
|
88
|
+
export declare type CodegenRouteErrorReason = "Missing Authorization header" | "Invalid Authorization header" | "Missing teamId" | "Internal server error" | "Forbidden, no team access" | "Requested Usage Exceeds Limit" | "Not all frames id from responsive pages are mentioned on the nodes id list" | "Too many screens to import" | "Invalid Anima token";
|
|
89
89
|
|
|
90
90
|
export declare type CodegenSettings = {
|
|
91
91
|
language?: "typescript" | "javascript";
|
|
@@ -93,12 +93,17 @@ export declare type CodegenSettings = {
|
|
|
93
93
|
framework: "react" | "html";
|
|
94
94
|
styling: "plain_css" | "css_modules" | "styled_components" | "tailwind" | "sass" | "scss" | "inline_styles";
|
|
95
95
|
uiLibrary?: "mui" | "antd" | "radix" | "shadcn";
|
|
96
|
+
responsivePages?: Array<{
|
|
97
|
+
name: string;
|
|
98
|
+
framesId: string[];
|
|
99
|
+
}>;
|
|
96
100
|
enableTranslation?: boolean;
|
|
97
101
|
enableUILibraryTheming?: boolean;
|
|
98
102
|
enableCompactStructure?: boolean;
|
|
99
103
|
enableAutoSplit?: boolean;
|
|
100
104
|
autoSplitThreshold?: number;
|
|
101
105
|
disableMarkedForExport?: boolean;
|
|
106
|
+
allowAutoSelectFirstNode?: boolean;
|
|
102
107
|
enableDisplayScreenModelId?: boolean;
|
|
103
108
|
enableGeneratePackageLock?: boolean;
|
|
104
109
|
};
|
|
@@ -304,14 +309,17 @@ export declare const getRelatedScreenFiles: ({ files, screenPath, }: {
|
|
|
304
309
|
screenPath?: string;
|
|
305
310
|
}) => AnimaFiles;
|
|
306
311
|
|
|
307
|
-
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";
|
|
308
313
|
|
|
309
314
|
export declare const isFigmaTokenIssue: (error: Error) => boolean;
|
|
310
315
|
|
|
311
316
|
/**
|
|
312
|
-
* Check if the pair "design" + "node id"
|
|
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.
|
|
313
319
|
*/
|
|
314
|
-
export declare const isNodeCodegenCompatible: (design: GetFileResponse, nodeId: string
|
|
320
|
+
export declare const isNodeCodegenCompatible: (design: GetFileResponse, nodeId: string, options?: {
|
|
321
|
+
allowAutoSelectFirstNode: boolean;
|
|
322
|
+
}) => ValidateNodeForCodegenResult;
|
|
315
323
|
|
|
316
324
|
export declare const isNotFound: (error: Error) => boolean;
|
|
317
325
|
|
|
@@ -517,6 +525,10 @@ declare type ValidateNodeForCodegenResult = {
|
|
|
517
525
|
isValid: true;
|
|
518
526
|
node: FigmaNode;
|
|
519
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";
|
|
520
532
|
} | {
|
|
521
533
|
isValid: false;
|
|
522
534
|
reason: InvalidNodeForCodegenReason;
|