@builder.io/dev-tools 1.0.20 → 1.1.0-rc0

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.
@@ -0,0 +1,53 @@
1
+ /// <reference types="@figma/plugin-typings" />
2
+ import type { ComponentInfo, ComponentInput, ComponentRegistry, DevToolsSys } from "../types";
3
+ import type { FigmaArgs } from "./figma";
4
+ export declare const runFigmaAdd: (sys: DevToolsSys, args: FigmaArgs) => Promise<void>;
5
+ export interface FigmaComponentInput {
6
+ id: string;
7
+ name: string;
8
+ value?: any;
9
+ type: string;
10
+ baseType: "text" | "variant" | "boolean" | "slot";
11
+ variantOptions?: string[];
12
+ isDefault: boolean;
13
+ ref?: string;
14
+ }
15
+ export interface FigmaComponentInfo {
16
+ documentName: string;
17
+ key: string;
18
+ tree: string;
19
+ jsx: string;
20
+ name: string;
21
+ inputs: FigmaComponentInput[];
22
+ description: string;
23
+ documentationLinks: string[];
24
+ instanceId: string;
25
+ }
26
+ export declare const parseFigmaURL: (str: string) => {
27
+ fileID: string;
28
+ nodeId: string;
29
+ } | null;
30
+ export declare const getFigmaNodeData: (auth: {
31
+ access_token: string;
32
+ oauth: boolean;
33
+ }, fileId: string, nodeId: string) => Promise<any>;
34
+ export declare function getInputsSlotsFromComponentPropertyDefinitions(mainComponent: ComponentSetNode | ComponentNode): {
35
+ inputs: FigmaComponentInput[];
36
+ nameMap: (key: string) => string;
37
+ };
38
+ export declare const REMOVE_EMOJI: RegExp;
39
+ export declare function getFigmaComponentName(name: string): string;
40
+ export interface MappingCodeV2 {
41
+ figmaInterface: string;
42
+ reactInterface: string;
43
+ componentRegistry: string;
44
+ figmaComponentName: string;
45
+ figmaTree: string;
46
+ meta?: Record<string, any>;
47
+ previousCode?: string;
48
+ prompt?: string;
49
+ }
50
+ export declare function getMappingData(figmaNode: FigmaComponentInfo, registeredCmp: ComponentInfo, cmpRegistry: ComponentRegistry, useJSX: boolean): MappingCodeV2;
51
+ export declare const getTypeFromComponentInput: (input: ComponentInput) => string;
52
+ export declare const getPropertyAccessor: (name: string) => string;
53
+ export declare function getMappingPrompt(figmaNode: FigmaComponentInfo, registeredCmp: ComponentInfo, cmpRegistry: ComponentRegistry, useJSX?: boolean): string;
@@ -0,0 +1,31 @@
1
+ import type { DevToolsSys } from "../types";
2
+ import type { FigmaArgs } from "./figma";
3
+ export interface CredentialsOptions {
4
+ builderPublicKey?: boolean;
5
+ builderPrivateKey?: boolean;
6
+ figmaAuth?: boolean;
7
+ force?: boolean;
8
+ }
9
+ export interface FigmaAuth {
10
+ access_token: string;
11
+ oauth: boolean;
12
+ }
13
+ export interface BuilderAuth {
14
+ privateKey: string;
15
+ spaceId: string;
16
+ name: string;
17
+ userId: string;
18
+ }
19
+ export interface Credentials {
20
+ figmaAuth?: FigmaAuth;
21
+ builderPublicKey?: string;
22
+ builderPrivateKey?: string;
23
+ }
24
+ export declare const isCI: (args: FigmaArgs) => boolean;
25
+ export declare const getCredentials: (sys: DevToolsSys, args: FigmaArgs, opts: CredentialsOptions) => Promise<{
26
+ figmaAuth: FigmaAuth | undefined;
27
+ builderPublicKey: string | undefined;
28
+ builderPrivateKey: string | undefined;
29
+ }>;
30
+ export declare function getFigmaAuth(): Promise<FigmaAuth>;
31
+ export declare function getBuilderAuth(sys: DevToolsSys): Promise<BuilderAuth>;
@@ -0,0 +1,10 @@
1
+ import type { FigmaArgs } from "./figma";
2
+ import type { DevToolsSys } from "../types";
3
+ import { type FigmaBuilderLink } from "./figma-publish";
4
+ interface KVGetRequest {
5
+ privateKey: string;
6
+ spaceId: string;
7
+ }
8
+ export declare const runFigmaMigrate: (sys: DevToolsSys, args: FigmaArgs) => Promise<void>;
9
+ export declare function getBuilderSpaceFigmaLinks(kvReq: KVGetRequest): Promise<FigmaBuilderLink[]>;
10
+ export {};
@@ -0,0 +1,39 @@
1
+ import type { DevToolsSys, ExportType } from "../types";
2
+ import type { FigmaArgs } from "./figma";
3
+ export interface FigmaBuilderLink {
4
+ builderName: string;
5
+ figmaName: string;
6
+ figmaKey: string;
7
+ inputMapper?: string;
8
+ originalInputMapper?: string;
9
+ exportType?: ExportType;
10
+ importName?: string;
11
+ importPath?: string;
12
+ source: string;
13
+ }
14
+ export declare const runFigmaPublish: (sys: DevToolsSys, args: FigmaArgs) => Promise<void>;
15
+ export declare const FIGMA_CONNECT_CALL = "figmaMapping";
16
+ export declare function findAllMappingFiles(sys: DevToolsSys): Promise<string[]>;
17
+ export interface BuilderSpace {
18
+ privateKey: string;
19
+ spaceId: string;
20
+ userId: string;
21
+ name?: string;
22
+ }
23
+ interface KVGetRequest extends BuilderSpace {
24
+ docId: string;
25
+ }
26
+ interface KVPutRequest extends KVGetRequest {
27
+ /**
28
+ * Must be an object but not an array. TS is a fool sometimes.
29
+ * https://stackoverflow.com/a/70448528/1520787
30
+ */
31
+ data: Record<string, any> & {
32
+ length?: never;
33
+ };
34
+ }
35
+ export interface FigmaBuilderData {
36
+ figmaBuilderLinks: FigmaBuilderLink[];
37
+ }
38
+ export declare function putBuilderSpaceKv(kvReq: KVPutRequest): Promise<void>;
39
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { DevToolsSys } from "../types";
2
+ export interface FigmaArgs {
3
+ privateKey?: string;
4
+ figmaToken?: string;
5
+ ci?: boolean;
6
+ help?: boolean;
7
+ _: string[];
8
+ }
9
+ export declare const runFigmaCommand: (sys: DevToolsSys, subCommand: string, args: FigmaArgs) => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function printHelp(): void;
@@ -0,0 +1 @@
1
+ export declare function formatCode(code: string): Promise<string>;
@@ -1,5 +1,5 @@
1
1
  import type { ModifiedFile } from "../../../types";
2
2
  import type { AngularDevToolsSys } from ".";
3
- export declare function angularEnsureBuilderSetup(sys: AngularDevToolsSys): Promise<ModifiedFile[]>;
4
3
  export declare function angularEnsureBuilderRegistry(sys: AngularDevToolsSys): Promise<ModifiedFile[]>;
4
+ export declare function angularEnsureBuilderSetup(_sys: AngularDevToolsSys): Promise<ModifiedFile[]>;
5
5
  export declare function angularEnsureFigmaImportSetup(_sys: AngularDevToolsSys): Promise<ModifiedFile[]>;
@@ -9,5 +9,4 @@ export interface AngularDevToolsSys extends DevToolsSys {
9
9
  registryPath: string;
10
10
  angularConfigPath: string;
11
11
  typescriptEnabled: boolean;
12
- builderPageComponentPath: string;
13
12
  }
@@ -0,0 +1,70 @@
1
+ /// <reference types="@figma/plugin-typings" />
2
+ export type FigmaNodeType = "COMPONENT" | "ELLIPSE" | "FRAME" | "GROUP" | "INSTANCE" | "LINE" | "POLYGON" | "RECTANGLE" | "STAR" | "TEXT" | "VECTOR";
3
+ export interface FigmaComponentInput {
4
+ id: string;
5
+ name: string;
6
+ value?: any;
7
+ type: string;
8
+ baseType: "text" | "variant" | "boolean" | "slot";
9
+ variantOptions?: string[];
10
+ isDefault: boolean;
11
+ ref?: string;
12
+ }
13
+ export interface FigmaNode {
14
+ "@type": "passedNode";
15
+ $id: string;
16
+ $name: string;
17
+ $type: FigmaNodeType;
18
+ $inputs: readonly FigmaComponentInput[];
19
+ $componentName?: string;
20
+ $rawNode: SceneNode;
21
+ /** Represents the text content of the node and its descendants */
22
+ $textContent: string;
23
+ /** URL to the rasterized image of this node */
24
+ $imageUrl: string;
25
+ $children: readonly FigmaNode[];
26
+ /** Recursively finds the first node that matches the callback */
27
+ $findOne(callback: (node: SceneNode) => boolean): FigmaNode | undefined;
28
+ /** Recursively finds the first figma child with the given name */
29
+ $findOneByName(name: string | RegExp): FigmaNode | undefined;
30
+ /** @deprecated Use $type instead */
31
+ type: FigmaNodeType;
32
+ /** @deprecated - */
33
+ props: {};
34
+ /** @deprecated - */
35
+ key: string | null;
36
+ }
37
+ export interface BaseFigmaProps {
38
+ $id: string;
39
+ $name: string;
40
+ $type: FigmaNodeType;
41
+ $inputs: readonly FigmaComponentInput[];
42
+ $componentName?: string;
43
+ /** Represents the text content of the node and its descendants */
44
+ $textContent: string;
45
+ $css: Readonly<Record<string, string>>;
46
+ /** URL to the rasterized image of this node */
47
+ $imageUrl: string;
48
+ /** Direct children of the root component node or instance */
49
+ $children: readonly FigmaNode[];
50
+ /** Recursively finds the first figma child with the given name */
51
+ $findOneByName(name: string | RegExp): FigmaNode | undefined;
52
+ /** Recursively finds the first node that matches the callback */
53
+ $findOne(callback: (node: SceneNode) => boolean): FigmaNode | undefined;
54
+ }
55
+ interface FigmaProps extends BaseFigmaProps {
56
+ [key: string]: any;
57
+ }
58
+ export interface FigmaMappingWithKeyMapper<T extends BaseFigmaProps> {
59
+ url?: string;
60
+ componentKey: string;
61
+ mapper?: (figma: T) => any;
62
+ }
63
+ export interface FigmaGenericMapper {
64
+ genericMapper: (figma: FigmaProps) => any;
65
+ }
66
+ export interface FigmaTokenMapper {
67
+ designTokenMapper: (token: string) => string | undefined | boolean;
68
+ }
69
+ export declare function figmaMapping<T extends BaseFigmaProps = FigmaProps>(_config: FigmaMappingWithKeyMapper<T> | FigmaGenericMapper | FigmaTokenMapper): void;
70
+ export {};
@@ -0,0 +1,2 @@
1
+ export function jsx(): null;
2
+ export function jsxs(): null;
@@ -0,0 +1,2 @@
1
+ export function jsx(): null;
2
+ export function jsxs(): null;
@@ -1,3 +0,0 @@
1
- import type { AngularDevToolsSys } from ".";
2
- export declare function angularUpdateAppModule(sys: AngularDevToolsSys): Promise<string | undefined>;
3
- export declare function angularEnsureAppModuleImports(sys: AngularDevToolsSys, filePath: string, code: string): Promise<string>;