@figma/code-connect 1.0.6 → 1.1.0
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/README.md +2 -595
- package/dist/client/figma_client.d.ts +1 -1
- package/dist/client/figma_client.js +9 -7
- package/dist/client/figma_client.js.map +1 -1
- package/dist/commands/connect.d.ts +4 -2
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +97 -49
- package/dist/commands/connect.js.map +1 -1
- package/dist/common/project.d.ts +86 -0
- package/dist/common/project.d.ts.map +1 -0
- package/dist/common/project.js +138 -0
- package/dist/common/project.js.map +1 -0
- package/dist/connect/api.d.ts +143 -0
- package/dist/connect/api.d.ts.map +1 -0
- package/dist/connect/api.js +3 -0
- package/dist/connect/api.js.map +1 -0
- package/dist/connect/create.d.ts.map +1 -1
- package/dist/connect/create.js +4 -0
- package/dist/connect/create.js.map +1 -1
- package/dist/connect/create_common.d.ts +7 -0
- package/dist/connect/create_common.d.ts.map +1 -0
- package/dist/connect/create_common.js +19 -0
- package/dist/connect/create_common.js.map +1 -0
- package/dist/connect/external_types.d.ts +8 -0
- package/dist/connect/external_types.d.ts.map +1 -0
- package/dist/connect/external_types.js +31 -0
- package/dist/connect/external_types.js.map +1 -0
- package/dist/connect/figma_connect.d.ts +26 -0
- package/dist/connect/figma_connect.d.ts.map +1 -0
- package/dist/connect/figma_connect.js +3 -0
- package/dist/connect/figma_connect.js.map +1 -0
- package/dist/connect/figma_rest_api.d.ts +7 -0
- package/dist/connect/figma_rest_api.d.ts.map +1 -1
- package/dist/connect/figma_rest_api.js.map +1 -1
- package/dist/connect/index_common.d.ts +3 -0
- package/dist/connect/index_common.d.ts.map +1 -0
- package/dist/connect/index_common.js +23 -0
- package/dist/connect/index_common.js.map +1 -0
- package/dist/connect/intrinsics.d.ts +94 -0
- package/dist/connect/intrinsics.d.ts.map +1 -0
- package/dist/connect/intrinsics.js +401 -0
- package/dist/connect/intrinsics.js.map +1 -0
- package/dist/connect/parser_common.d.ts +144 -0
- package/dist/connect/parser_common.d.ts.map +1 -0
- package/dist/connect/parser_common.js +297 -0
- package/dist/connect/parser_common.js.map +1 -0
- package/dist/connect/parser_executable_types.d.ts +20 -23
- package/dist/connect/parser_executable_types.d.ts.map +1 -1
- package/dist/connect/parser_executable_types.js.map +1 -1
- package/dist/connect/parser_executables.js +1 -1
- package/dist/connect/parser_executables.js.map +1 -1
- package/dist/connect/project.d.ts +20 -5
- package/dist/connect/project.d.ts.map +1 -1
- package/dist/connect/project.js +79 -16
- package/dist/connect/project.js.map +1 -1
- package/dist/connect/upload.d.ts +1 -1
- package/dist/connect/upload.d.ts.map +1 -1
- package/dist/connect/validation.d.ts +1 -1
- package/dist/connect/validation.d.ts.map +1 -1
- package/dist/connect/wizard/helpers.d.ts.map +1 -1
- package/dist/connect/wizard/helpers.js +18 -14
- package/dist/connect/wizard/helpers.js.map +1 -1
- package/dist/connect/wizard/prop_mapping.d.ts +12 -7
- package/dist/connect/wizard/prop_mapping.d.ts.map +1 -1
- package/dist/connect/wizard/prop_mapping.js +88 -89
- package/dist/connect/wizard/prop_mapping.js.map +1 -1
- package/dist/connect/wizard/run_wizard.d.ts.map +1 -1
- package/dist/connect/wizard/run_wizard.js +8 -3
- package/dist/connect/wizard/run_wizard.js.map +1 -1
- package/dist/connect/wizard/signature_extraction.d.ts +7 -0
- package/dist/connect/wizard/signature_extraction.d.ts.map +1 -0
- package/dist/connect/wizard/signature_extraction.js +46 -0
- package/dist/connect/wizard/signature_extraction.js.map +1 -0
- package/dist/html/__test__/parser/examples/NoConfigObject.figma.d.ts +2 -0
- package/dist/html/__test__/parser/examples/NoConfigObject.figma.d.ts.map +1 -0
- package/dist/html/__test__/parser/examples/NoConfigObject.figma.js +9 -0
- package/dist/html/__test__/parser/examples/NoConfigObject.figma.js.map +1 -0
- package/dist/html/__test__/parser/examples/NoExample.figma.d.ts +2 -0
- package/dist/html/__test__/parser/examples/NoExample.figma.d.ts.map +1 -0
- package/dist/html/__test__/parser/examples/NoExample.figma.js +9 -0
- package/dist/html/__test__/parser/examples/NoExample.figma.js.map +1 -0
- package/dist/html/__test__/parser/examples/RegularFunctionExampleWithExtraCode.figma.d.ts +2 -0
- package/dist/html/__test__/parser/examples/RegularFunctionExampleWithExtraCode.figma.d.ts.map +1 -0
- package/dist/html/__test__/parser/examples/RegularFunctionExampleWithExtraCode.figma.js +33 -0
- package/dist/html/__test__/parser/examples/RegularFunctionExampleWithExtraCode.figma.js.map +1 -0
- package/dist/html/__test__/parser/examples/WrongSignatureJsx.figma.d.ts +2 -0
- package/dist/html/__test__/parser/examples/WrongSignatureJsx.figma.d.ts.map +1 -0
- package/dist/html/__test__/parser/examples/WrongSignatureJsx.figma.js +15 -0
- package/dist/html/__test__/parser/examples/WrongSignatureJsx.figma.js.map +1 -0
- package/dist/html/__test__/parser/examples/WrongSignatureNoHtmlTag.figma.d.ts +2 -0
- package/dist/html/__test__/parser/examples/WrongSignatureNoHtmlTag.figma.d.ts.map +1 -0
- package/dist/html/__test__/parser/examples/WrongSignatureNoHtmlTag.figma.js +15 -0
- package/dist/html/__test__/parser/examples/WrongSignatureNoHtmlTag.figma.js.map +1 -0
- package/dist/html/__test__/parser/parser.test.d.ts +2 -0
- package/dist/html/__test__/parser/parser.test.d.ts.map +1 -0
- package/dist/html/__test__/parser/parser.test.js +50 -0
- package/dist/html/__test__/parser/parser.test.js.map +1 -0
- package/dist/html/create.d.ts +4 -0
- package/dist/html/create.d.ts.map +1 -0
- package/dist/html/create.js +81 -0
- package/dist/html/create.js.map +1 -0
- package/dist/html/external.d.ts +8 -0
- package/dist/html/external.d.ts.map +1 -0
- package/dist/html/external.js +25 -0
- package/dist/html/external.js.map +1 -0
- package/dist/html/index_html.d.ts +77 -0
- package/dist/html/index_html.d.ts.map +1 -0
- package/dist/html/index_html.js +42 -0
- package/dist/html/index_html.js.map +1 -0
- package/dist/html/parser.d.ts +19 -0
- package/dist/html/parser.d.ts.map +1 -0
- package/dist/html/parser.js +487 -0
- package/dist/html/parser.js.map +1 -0
- package/dist/html/parser_template_helpers.d.ts +2 -0
- package/dist/html/parser_template_helpers.d.ts.map +1 -0
- package/dist/html/parser_template_helpers.js +68 -0
- package/dist/html/parser_template_helpers.js.map +1 -0
- package/dist/html/template_literal.d.ts +5 -0
- package/dist/html/template_literal.d.ts.map +1 -0
- package/dist/html/template_literal.js +8 -0
- package/dist/html/template_literal.js.map +1 -0
- package/dist/parser_scripts/get_swift_parser_dir.d.ts +1 -1
- package/dist/parser_scripts/get_swift_parser_dir.d.ts.map +1 -1
- package/dist/parser_scripts/get_swift_parser_dir.js +38 -10
- package/dist/parser_scripts/get_swift_parser_dir.js.map +1 -1
- package/dist/react/create.d.ts +5 -0
- package/dist/react/create.d.ts.map +1 -1
- package/dist/react/create.js +144 -42
- package/dist/react/create.js.map +1 -1
- package/dist/react/external.d.ts +9 -0
- package/dist/react/external.d.ts.map +1 -0
- package/dist/react/external.js +45 -0
- package/dist/react/external.js.map +1 -0
- package/dist/react/index_react.d.ts +94 -0
- package/dist/react/index_react.d.ts.map +1 -0
- package/dist/react/index_react.js +39 -0
- package/dist/react/index_react.js.map +1 -0
- package/dist/react/parser.d.ts +6 -38
- package/dist/react/parser.d.ts.map +1 -1
- package/dist/react/parser.js +137 -295
- package/dist/react/parser.js.map +1 -1
- package/dist/react/parser_template_helpers.d.ts +15 -15
- package/dist/react/parser_template_helpers.d.ts.map +1 -1
- package/dist/react/parser_template_helpers.js +51 -35
- package/dist/react/parser_template_helpers.js.map +1 -1
- package/dist/storybook/convert.d.ts +1 -1
- package/dist/storybook/convert.d.ts.map +1 -1
- package/dist/storybook/convert.js +6 -4
- package/dist/storybook/convert.js.map +1 -1
- package/dist/storybook/external.d.ts +1 -1
- package/dist/storybook/external.d.ts.map +1 -1
- package/dist/typescript/compiler.d.ts +2 -2
- package/dist/typescript/compiler.d.ts.map +1 -1
- package/dist/typescript/compiler.js +50 -23
- package/dist/typescript/compiler.js.map +1 -1
- package/package.json +27 -7
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type EnumValue = string | boolean | number | symbol | undefined | JSX.Element | Function | Object;
|
|
3
|
+
export interface FigmaConnectAPI<InstanceChildrenT> {
|
|
4
|
+
/**
|
|
5
|
+
* Maps a Figma Variant property to a set if values for the connected component. This prop is replaced
|
|
6
|
+
* with values from the Figma instance when viewed in Dev Mode. For example:
|
|
7
|
+
* ```ts
|
|
8
|
+
* props: {
|
|
9
|
+
* type: figma.enum('Type', {
|
|
10
|
+
* Primary: 'primary',
|
|
11
|
+
* Secondary: 'secondary',
|
|
12
|
+
* }),
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
* Would output "primary" if the Type Variant in Figma is set to "Primary".
|
|
16
|
+
*
|
|
17
|
+
* @param figmaPropName The name of the property on the Figma component
|
|
18
|
+
* @param valueMapping A mapping of values for the Figma Variant
|
|
19
|
+
*/
|
|
20
|
+
enum<V extends EnumValue>(figmaPropName: string, valueMapping: Record<string, V>): V;
|
|
21
|
+
/**
|
|
22
|
+
* Maps a Figma property to a string value for the connected component. This prop is replaced
|
|
23
|
+
* with values from the Figma instance when viewed in Dev Mode. For example:
|
|
24
|
+
* ```ts
|
|
25
|
+
* props: {
|
|
26
|
+
* text: figma.string('Text'),
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
* Would replace `text` with the text content from the Figma property "Text".
|
|
30
|
+
*
|
|
31
|
+
* @param figmaPropName The name of the property on the Figma component
|
|
32
|
+
*/
|
|
33
|
+
string(figmaPropName: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Maps a Figma instance property for the connected component. This prop is replaced
|
|
36
|
+
* with values from the Figma instance when viewed in Dev Mode. For example:
|
|
37
|
+
* ```ts
|
|
38
|
+
* props: {
|
|
39
|
+
* icon: figma.instance('Icon'),
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
* Would show the nested examples for the component passed to the "Icon" property in Figma.
|
|
43
|
+
*
|
|
44
|
+
* @param figmaPropName The name of the property on the Figma component
|
|
45
|
+
*/
|
|
46
|
+
instance(figmaPropName: string): InstanceChildrenT;
|
|
47
|
+
/**
|
|
48
|
+
* Maps a Figma instance layer to a nested code example. For example:
|
|
49
|
+
* ```ts
|
|
50
|
+
* props: {
|
|
51
|
+
* icon: figma.children('Icon')
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
* Would show the nested code example for the child instance named 'Icon'. This also supports
|
|
55
|
+
* an array: `tabs: figma.children(['Tab 1', 'Tab 2'])` to map multiple nested examples.
|
|
56
|
+
*
|
|
57
|
+
* You can pass a single wildcard '*' character to match partial names. For example:
|
|
58
|
+
* ```ts
|
|
59
|
+
* props: {
|
|
60
|
+
* icon: figma.children('Icon*')
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
* Would show the nested code example for any child instance which name starts with "Icon"
|
|
64
|
+
*
|
|
65
|
+
* @param figmaPropName The name of the property on the Figma component
|
|
66
|
+
*/
|
|
67
|
+
children(layerNames: string | string[]): InstanceChildrenT;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a className string by joining an array of strings. The argument supports both
|
|
70
|
+
* string literals and nested functions like `figma.enum` and `figma.boolean` that return
|
|
71
|
+
* a string. For example:
|
|
72
|
+
* ```ts
|
|
73
|
+
* props: {
|
|
74
|
+
* className: figma.className([
|
|
75
|
+
* 'btn-base',
|
|
76
|
+
* figma.enum('Size', { Large: 'btn-large' }),
|
|
77
|
+
* figma.boolean('Disabled', { true: 'btn-disabled', false: '' }),
|
|
78
|
+
* ]),
|
|
79
|
+
* }
|
|
80
|
+
*
|
|
81
|
+
* @param className
|
|
82
|
+
*/
|
|
83
|
+
className(className: (string | undefined)[]): string;
|
|
84
|
+
/**
|
|
85
|
+
* Maps a Figma text layer to a string value representing the text content of that layer.
|
|
86
|
+
* This function takes the layer name within the original component as its parameter.
|
|
87
|
+
* For example:
|
|
88
|
+
* ```ts
|
|
89
|
+
* props: {
|
|
90
|
+
* text: figma.textContent('Text Layer')
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @param layer The name of the text layer in the Figma component
|
|
95
|
+
*/
|
|
96
|
+
textContent(layer: string): string;
|
|
97
|
+
}
|
|
98
|
+
export type ValueOf<T> = T[keyof T];
|
|
99
|
+
export type PropMapping<T> = {
|
|
100
|
+
[key in keyof T]: T[key];
|
|
101
|
+
};
|
|
102
|
+
export interface FigmaConnectLink {
|
|
103
|
+
name: string;
|
|
104
|
+
url: string;
|
|
105
|
+
}
|
|
106
|
+
export interface FigmaConnectMeta<T = {}, ExampleFnReturnT = unknown> {
|
|
107
|
+
/**
|
|
108
|
+
* Restricts this figma connect to any variants that fullfill the given filter.
|
|
109
|
+
* The filter is a map of Figma variant names to values. Example:
|
|
110
|
+
* ```ts
|
|
111
|
+
* {
|
|
112
|
+
* variant: { "Has Icon": true }
|
|
113
|
+
* }
|
|
114
|
+
*/
|
|
115
|
+
variant?: Record<string, string | boolean | number>;
|
|
116
|
+
/**
|
|
117
|
+
* Prop mappings for the connected component. This is used to map the values of the component's props
|
|
118
|
+
* to the values that are used in Figma, using helper functions like `Figma.boolean`. For example:
|
|
119
|
+
* ```ts
|
|
120
|
+
* props: {
|
|
121
|
+
* disabled: figma.boolean('Disabled'),
|
|
122
|
+
* text: figma.string('Text'),
|
|
123
|
+
* size: figma.enum('Size', {
|
|
124
|
+
* slim: 'slim',
|
|
125
|
+
* medium: 'medium',
|
|
126
|
+
* large: 'large',
|
|
127
|
+
* }),
|
|
128
|
+
* }
|
|
129
|
+
*/
|
|
130
|
+
props?: T;
|
|
131
|
+
/**
|
|
132
|
+
* The code example to display in Figma. Any mapped `props` are passed to the component,
|
|
133
|
+
* where those values will be replaced with the mapped value when inspecting that instance in Figma.
|
|
134
|
+
* @param props
|
|
135
|
+
* @returns
|
|
136
|
+
*/
|
|
137
|
+
example?: (props: T) => ExampleFnReturnT;
|
|
138
|
+
/**
|
|
139
|
+
* A list of links that will display in Figma along with the examples
|
|
140
|
+
*/
|
|
141
|
+
links?: FigmaConnectLink[];
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/connect/api.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,GACT,GAAG,CAAC,OAAO,GACX,QAAQ,GACR,MAAM,CAAA;AASV,MAAM,WAAW,eAAe,CAAC,iBAAiB;IAChD;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAA;IAEpF;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAA;IAErC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,iBAAiB,CAAA;IAElD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,iBAAiB,CAAA;IAE1D;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,SAAS,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,CAAA;IAEpD;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACnC;AAED,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAEnC,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;CACzB,CAAA;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,EAAE,EAAE,gBAAgB,GAAG,OAAO;IAClE;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CAAA;IAEnD;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,EAAE,CAAC,CAAA;IAET;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,gBAAgB,CAAA;IAExC;;OAEG;IACH,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAA;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/connect/api.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/connect/create.ts"],"names":[],"mappings":"AAWA,OAAO,EAAqC,WAAW,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/connect/create.ts"],"names":[],"mappings":"AAWA,OAAO,EAAqC,WAAW,EAAE,MAAM,WAAW,CAAA;AAM1E,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,UAQlD;AAED,wBAAsB,wBAAwB,CAAC,EAC7C,WAAW,EACX,YAAY,EACZ,OAAO,EACP,MAAM,EACN,WAAW,GACZ,EAAE,gBAAgB,iBAuGlB"}
|
package/dist/connect/create.js
CHANGED
|
@@ -36,6 +36,7 @@ const parser_executables_1 = require("./parser_executables");
|
|
|
36
36
|
const create_1 = require("../react/create");
|
|
37
37
|
const parser_executable_types_1 = require("./parser_executable_types");
|
|
38
38
|
const zod_validation_error_1 = require("zod-validation-error");
|
|
39
|
+
const create_2 = require("../html/create");
|
|
39
40
|
function normalizeComponentName(name) {
|
|
40
41
|
// Convert the string to PascalCase and ensure first character is not a digit
|
|
41
42
|
return name
|
|
@@ -89,6 +90,9 @@ async function createCodeConnectFromUrl({ accessToken, figmaNodeUrl, outFile, ou
|
|
|
89
90
|
if (projectInfo.config.parser === 'react') {
|
|
90
91
|
result = await (0, create_1.createReactCodeConnect)(payload);
|
|
91
92
|
}
|
|
93
|
+
else if (projectInfo.config.parser === 'html') {
|
|
94
|
+
result = await (0, create_2.createHtmlCodeConnect)(payload);
|
|
95
|
+
}
|
|
92
96
|
else {
|
|
93
97
|
try {
|
|
94
98
|
const stdout = await (0, parser_executables_1.callParser)(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/connect/create.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAKkB;AAClB,+CAA2C;AAC3C,4CAAmB;AACnB,qDAAwD;AACxD,+CAAyD;AACzD,6DAAiE;AAEjE,4CAAwD;AAExD,uEAAuF;AACvF,+DAAgD;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/connect/create.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAKkB;AAClB,+CAA2C;AAC3C,4CAAmB;AACnB,qDAAwD;AACxD,+CAAyD;AACzD,6DAAiE;AAEjE,4CAAwD;AAExD,uEAAuF;AACvF,+DAAgD;AAChD,2CAAsD;AAStD,SAAgB,sBAAsB,CAAC,IAAY;IACjD,6EAA6E;IAC7E,OAAO,IAAI;SACR,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;SAC7B,KAAK,CA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AAA;YACH,CAAC;iBAAM,CAAC;gBACN,gBAAM,CAAC,KAAK,CAAC,uCAAuC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;YACpE,CAAC;YACD,gBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAA;QAClD,CAAC;aAAM,CAAC;YACN,gBAAM,CAAC,KAAK,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAA;QAC1C,CAAC;QACD,IAAA,iCAAuB,EAAC,CAAC,CAAC,CAAA;IAC5B,CAAC;AACH,CAAC;AA7GD,4DA6GC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_common.d.ts","sourceRoot":"","sources":["../../src/connect/create_common.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,cAAc,EACd,SAAS,GACV,EAAE;IACD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,MAAM,CAYT"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getOutFileName = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
function getOutFileName({ outFile, outDir, sourceFilename, extension, }) {
|
|
9
|
+
if (outFile) {
|
|
10
|
+
return outFile;
|
|
11
|
+
}
|
|
12
|
+
const baseName = `${sourceFilename}.figma.${extension}`;
|
|
13
|
+
if (outDir) {
|
|
14
|
+
return path_1.default.join(outDir, baseName);
|
|
15
|
+
}
|
|
16
|
+
return path_1.default.join(process.env.INIT_CWD ?? process.cwd(), baseName);
|
|
17
|
+
}
|
|
18
|
+
exports.getOutFileName = getOutFileName;
|
|
19
|
+
//# sourceMappingURL=create_common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_common.js","sourceRoot":"","sources":["../../src/connect/create_common.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAEvB,SAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,cAAc,EACd,SAAS,GAMV;IACC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,MAAM,QAAQ,GAAG,GAAG,cAAc,UAAU,SAAS,EAAE,CAAA;IAEvD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IACpC,CAAC;IAED,OAAO,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAA;AACnE,CAAC;AAtBD,wCAsBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PropMapping, ValueOf, EnumValue } from './api';
|
|
2
|
+
export declare function booleanType(_figmaPropName: string): boolean;
|
|
3
|
+
export declare function enumType<V extends EnumValue>(_figmaPropName: string, _valueMapping: PropMapping<Record<string, V>>): ValueOf<Record<string, V>>;
|
|
4
|
+
export declare function stringType(_figmaPropName: string): string;
|
|
5
|
+
export declare function nestedPropsType<T>(_layer: string, props: T): T;
|
|
6
|
+
export declare function classNameType(_className: (string | undefined)[]): string;
|
|
7
|
+
export declare function textContentType(_layer: string): string;
|
|
8
|
+
//# sourceMappingURL=external_types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external_types.d.ts","sourceRoot":"","sources":["../../src/connect/external_types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEvD,wBAAgB,WAAW,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAA;AAW5D,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAC1C,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,GAC5C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAE5B;AAED,wBAAgB,UAAU,CAAC,cAAc,EAAE,MAAM,UAEhD;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAE1D;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,UAE/D;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,UAE7C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.textContentType = exports.classNameType = exports.nestedPropsType = exports.stringType = exports.enumType = exports.booleanType = void 0;
|
|
4
|
+
function booleanType(_figmaPropName, _valueMapping) {
|
|
5
|
+
if (_valueMapping) {
|
|
6
|
+
return enumType(_figmaPropName, _valueMapping);
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
exports.booleanType = booleanType;
|
|
11
|
+
function enumType(_figmaPropName, _valueMapping) {
|
|
12
|
+
return Object.values(_valueMapping)[0];
|
|
13
|
+
}
|
|
14
|
+
exports.enumType = enumType;
|
|
15
|
+
function stringType(_figmaPropName) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
exports.stringType = stringType;
|
|
19
|
+
function nestedPropsType(_layer, props) {
|
|
20
|
+
return props;
|
|
21
|
+
}
|
|
22
|
+
exports.nestedPropsType = nestedPropsType;
|
|
23
|
+
function classNameType(_className) {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
exports.classNameType = classNameType;
|
|
27
|
+
function textContentType(_layer) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
exports.textContentType = textContentType;
|
|
31
|
+
//# sourceMappingURL=external_types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external_types.js","sourceRoot":"","sources":["../../src/connect/external_types.ts"],"names":[],"mappings":";;;AAGA,SAAgB,WAAW,CACzB,cAAsB,EACtB,aAA2C;IAE3C,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,QAAQ,CAAI,cAAc,EAAE,aAAa,CAAC,CAAA;IACnD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AARD,kCAQC;AAED,SAAgB,QAAQ,CACtB,cAAsB,EACtB,aAA6C;IAE7C,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAA+B,CAAA;AACtE,CAAC;AALD,4BAKC;AAED,SAAgB,UAAU,CAAC,cAAsB;IAC/C,OAAO,EAAE,CAAA;AACX,CAAC;AAFD,gCAEC;AAED,SAAgB,eAAe,CAAI,MAAc,EAAE,KAAQ;IACzD,OAAO,KAAK,CAAA;AACd,CAAC;AAFD,0CAEC;AAED,SAAgB,aAAa,CAAC,UAAkC;IAC9D,OAAO,EAAE,CAAA;AACX,CAAC;AAFD,sCAEC;AAED,SAAgB,eAAe,CAAC,MAAc;IAC5C,OAAO,EAAE,CAAA;AACX,CAAC;AAFD,0CAEC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FigmaConnectLink } from './api';
|
|
2
|
+
import { Intrinsic } from './intrinsics';
|
|
3
|
+
export type BaseCodeConnectObject = {
|
|
4
|
+
figmaNode: string;
|
|
5
|
+
component?: string;
|
|
6
|
+
variant?: Record<string, any>;
|
|
7
|
+
template: string;
|
|
8
|
+
templateData: {
|
|
9
|
+
props?: Record<string, Intrinsic>;
|
|
10
|
+
imports?: string[];
|
|
11
|
+
nestable?: boolean;
|
|
12
|
+
};
|
|
13
|
+
language: string;
|
|
14
|
+
label: string;
|
|
15
|
+
links?: FigmaConnectLink[];
|
|
16
|
+
source?: string;
|
|
17
|
+
sourceLocation?: {
|
|
18
|
+
line: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type CodeConnectJSON = BaseCodeConnectObject & {
|
|
22
|
+
metadata: {
|
|
23
|
+
cliVersion: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=figma_connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figma_connect.d.ts","sourceRoot":"","sources":["../../src/connect/figma_connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;QACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;QAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;KACnB,CAAA;IACD,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,qBAAqB,GAAG;IACpD,QAAQ,EAAE;QACR,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figma_connect.js","sourceRoot":"","sources":["../../src/connect/figma_connect.ts"],"names":[],"mappings":""}
|
|
@@ -18,6 +18,13 @@ export declare namespace FigmaRestApi {
|
|
|
18
18
|
* All possible values for this property. Only exists on VARIANT properties
|
|
19
19
|
*/
|
|
20
20
|
variantOptions?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Only exists on INSTANCE_SWAP properties
|
|
23
|
+
*/
|
|
24
|
+
preferredValues?: {
|
|
25
|
+
type: string;
|
|
26
|
+
key: string;
|
|
27
|
+
}[];
|
|
21
28
|
}
|
|
22
29
|
interface Node {
|
|
23
30
|
type: 'COMPONENT' | 'COMPONENT_SET' | 'OTHER';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"figma_rest_api.d.ts","sourceRoot":"","sources":["../../src/connect/figma_rest_api.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,UAE1C;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM;;;;EAM7C;AAGD,yBAAiB,YAAY,CAAC;IAC5B,KAAY,qBAAqB;QAC/B,OAAO,YAAY;QACnB,YAAY,kBAAkB;QAC9B,IAAI,SAAS;QACb,OAAO,YAAY;KACpB;IAED,UAAiB,2BAA2B;QAC1C,YAAY,EAAE,OAAO,GAAG,MAAM,CAAA;QAC9B,IAAI,EAAE,qBAAqB,CAAA;QAC3B;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"figma_rest_api.d.ts","sourceRoot":"","sources":["../../src/connect/figma_rest_api.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,UAE1C;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM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AA;AAc3D,wBAAgB,SAAS,uBAMxB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getClient = void 0;
|
|
4
|
+
// `client/external`'s dependency chain ends up including code which is not safe
|
|
5
|
+
// in a browser context, e.g. `child_process`. This would mean that if you
|
|
6
|
+
// co-locate your Code Connect with React components, your app will be broken in
|
|
7
|
+
// a browser, because of this import chain.
|
|
8
|
+
//
|
|
9
|
+
// To get around this, we only import `client/external` if you are in a Node
|
|
10
|
+
// context – it is only used for the icon script, so none of the code which runs
|
|
11
|
+
// in the browser should touch it.
|
|
12
|
+
//
|
|
13
|
+
// Note that you may still see messages from the JS bundler about Node modules,
|
|
14
|
+
// but these won't be included at runtime.
|
|
15
|
+
function getClient() {
|
|
16
|
+
let client = {};
|
|
17
|
+
if (typeof process !== 'undefined' && process.versions && process.versions.node) {
|
|
18
|
+
client = require('./client/external');
|
|
19
|
+
}
|
|
20
|
+
return client;
|
|
21
|
+
}
|
|
22
|
+
exports.getClient = getClient;
|
|
23
|
+
//# sourceMappingURL=index_common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index_common.js","sourceRoot":"","sources":["../../src/connect/index_common.ts"],"names":[],"mappings":";;;AAEA,gFAAgF;AAChF,0EAA0E;AAC1E,gFAAgF;AAChF,2CAA2C;AAC3C,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAC/E,0CAA0C;AAE1C,SAAgB,SAAS;IACvB,IAAI,MAAM,GAAuB,EAAS,CAAA;IAC1C,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChF,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACvC,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAND,8BAMC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { ParserContext } from './parser_common';
|
|
3
|
+
import { FCCValue } from '../react/parser_template_helpers';
|
|
4
|
+
export declare const API_PREFIX = "figma";
|
|
5
|
+
export declare const FIGMA_CONNECT_CALL = "figma.connect";
|
|
6
|
+
export declare enum IntrinsicKind {
|
|
7
|
+
Enum = "enum",
|
|
8
|
+
String = "string",
|
|
9
|
+
Boolean = "boolean",
|
|
10
|
+
Instance = "instance",
|
|
11
|
+
Children = "children",
|
|
12
|
+
NestedProps = "nested-props",
|
|
13
|
+
ClassName = "className",
|
|
14
|
+
TextContent = "text-content"
|
|
15
|
+
}
|
|
16
|
+
export interface IntrinsicBase {
|
|
17
|
+
kind: IntrinsicKind;
|
|
18
|
+
args: {};
|
|
19
|
+
}
|
|
20
|
+
export type ValueMappingKind = FCCValue | Intrinsic;
|
|
21
|
+
export interface FigmaBoolean extends IntrinsicBase {
|
|
22
|
+
kind: IntrinsicKind.Boolean;
|
|
23
|
+
args: {
|
|
24
|
+
figmaPropName: string;
|
|
25
|
+
valueMapping?: Record<'true' | 'false', ValueMappingKind>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export type ValueMapping = Record<string, ValueMappingKind>;
|
|
29
|
+
export interface FigmaEnum extends IntrinsicBase {
|
|
30
|
+
kind: IntrinsicKind.Enum;
|
|
31
|
+
args: {
|
|
32
|
+
figmaPropName: string;
|
|
33
|
+
valueMapping: ValueMapping;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface FigmaString extends IntrinsicBase {
|
|
37
|
+
kind: IntrinsicKind.String;
|
|
38
|
+
args: {
|
|
39
|
+
figmaPropName: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface FigmaInstance extends IntrinsicBase {
|
|
43
|
+
kind: IntrinsicKind.Instance;
|
|
44
|
+
args: {
|
|
45
|
+
figmaPropName: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface FigmaChildren extends IntrinsicBase {
|
|
49
|
+
kind: IntrinsicKind.Children;
|
|
50
|
+
args: {
|
|
51
|
+
layers: string[];
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface FigmaNestedProps extends IntrinsicBase {
|
|
55
|
+
kind: IntrinsicKind.NestedProps;
|
|
56
|
+
args: {
|
|
57
|
+
layer: string;
|
|
58
|
+
props: Record<string, Intrinsic>;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface FigmaClassName extends IntrinsicBase {
|
|
62
|
+
kind: IntrinsicKind.ClassName;
|
|
63
|
+
args: {
|
|
64
|
+
className: (string | Intrinsic)[];
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface FigmaTextContent extends IntrinsicBase {
|
|
68
|
+
kind: IntrinsicKind.TextContent;
|
|
69
|
+
args: {
|
|
70
|
+
layer: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export type Intrinsic = FigmaBoolean | FigmaEnum | FigmaString | FigmaInstance | FigmaChildren | FigmaNestedProps | FigmaClassName | FigmaTextContent;
|
|
74
|
+
/**
|
|
75
|
+
* Parses a call expression to an intrinsic
|
|
76
|
+
*
|
|
77
|
+
* @param exp Expression to parse
|
|
78
|
+
* @param parserContext parser context
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
export declare function parseIntrinsic(exp: ts.CallExpression, parserContext: ParserContext): Intrinsic;
|
|
82
|
+
export declare function valueMappingToString(valueMapping: ValueMapping, childLayer?: string): string;
|
|
83
|
+
export declare function intrinsicToString({ kind, args }: Intrinsic, childLayer?: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* Parses the `props` field in a `figma.connect()` call, returning a mapping of
|
|
86
|
+
* prop names to their respective intrinsic types
|
|
87
|
+
*
|
|
88
|
+
* @param objectLiteral An object literal expression
|
|
89
|
+
* @param parserContext Parser context
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
export declare function parsePropsObject(objectLiteral: ts.ObjectLiteralExpression, parserContext: ParserContext): PropMappings;
|
|
93
|
+
export type PropMappings = Record<string, Intrinsic>;
|
|
94
|
+
//# sourceMappingURL=intrinsics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intrinsics.d.ts","sourceRoot":"","sources":["../../src/connect/intrinsics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAA;AAChC,OAAO,EAAiB,aAAa,EAAe,MAAM,iBAAiB,CAAA;AAS3E,OAAO,EACL,QAAQ,EAMT,MAAM,kCAAkC,CAAA;AAIzC,eAAO,MAAM,UAAU,UAAU,CAAA;AACjC,eAAO,MAAM,kBAAkB,kBAA0B,CAAA;AAEzD,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,WAAW,iBAAiB;IAC5B,SAAS,cAAc;IACvB,WAAW,iBAAiB;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,aAAa,CAAA;IACnB,IAAI,EAAE,EAAE,CAAA;CACT;AAED,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEnD,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,IAAI,EAAE,aAAa,CAAC,OAAO,CAAA;IAC3B,IAAI,EAAE;QACJ,aAAa,EAAE,MAAM,CAAA;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,EAAE,gBAAgB,CAAC,CAAA;KAC1D,CAAA;CACF;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;AAE3D,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C,IAAI,EAAE,aAAa,CAAC,IAAI,CAAA;IACxB,IAA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