- */
-async function performGetNodeData() {
- const nodes = figma.currentPage.selection;
- const data: { [k: string]: CodeSnippetParamsMap } = {};
- await Promise.all(
- nodes.map(async (node) => {
- data[keyFromNode(node)] = await paramsFromNode(node);
- return;
- })
- );
- const message: EventToBulk = {
- type: "BULK_NODE_DATA",
- code: JSON.stringify(data, null, 2),
- };
- figma.ui.postMessage(message);
-}
-
-/**
- * Generate a key descriptive and unique to the node for indexing node data
- * @param node node to generate a key from
- * @returns a unique key for indexing the node data
- */
-function keyFromNode(node: SceneNode) {
- return `${node.name} ${node.type} ${node.id}`;
-}
-
/**
* Find all component and component set nodes in a file
* @returns array of all components and component sets in a file.
diff --git a/src/code.ts b/src/code.ts
index 61de451..ce64bd2 100644
--- a/src/code.ts
+++ b/src/code.ts
@@ -142,10 +142,6 @@ function initializeDesignMode() {
figma.ui.on("message", async (event: EventFromBulk) => {
if (event.type === "BULK_INITIALIZE") {
handleCurrentSelection();
- } else if (event.type === "BULK_COMPONENT_DATA") {
- bulk.performGetComponentData();
- } else if (event.type === "BULK_NODE_DATA") {
- await bulk.performGetNodeData();
} else if (event.type === "BULK_EXPORT") {
bulk.performExport();
} else if (event.type === "BULK_IMPORT") {
diff --git a/src/index.d.ts b/src/index.d.ts
index 9c56e34..81931b6 100644
--- a/src/index.d.ts
+++ b/src/index.d.ts
@@ -61,25 +61,12 @@ interface NodeSnippetTemplateData {
}
/**
- * JSON format of bulk codegen result payload for bulk import and export
- * Where key is the component key and value is an array of codegenResultTemplates
+ * JSON format of codegen result where key is the component key and value is an array of CodegenResult templates
*/
type CodegenResultTemplatesByComponentKey = {
[componentKey: string]: CodegenResult[];
};
-/**
- * JSON format of bulk component export result payload for bulk import and export
- * Where key is the component key and value is an array of codegenResultTemplates
- */
-type ComponentDataByComponentKey = {
- [componentKey: string]: {
- name: string;
- description: string;
- lineage: string;
- };
-};
-
/**
* Object of components and component sets by key
*/
@@ -130,11 +117,7 @@ type EventToTemplates = {
*/
type EventFromBulk =
| {
- type:
- | "BULK_INITIALIZE"
- | "BULK_COMPONENT_DATA"
- | "BULK_NODE_DATA"
- | "BULK_EXPORT";
+ type: "BULK_INITIALIZE" | "BULK_EXPORT";
}
| EventFromBulkImport;
@@ -147,6 +130,6 @@ type EventFromBulkImport = {
* Events sending to the bulk.html ui
*/
type EventToBulk = {
- type: "BULK_COMPONENT_DATA" | "BULK_NODE_DATA" | "BULK_EXPORT";
+ type: "BULK_EXPORT";
code: string;
};
diff --git a/ui/bulk.html b/ui/bulk.html
index 7f1a3a5..ea93bf1 100644
--- a/ui/bulk.html
+++ b/ui/bulk.html
@@ -73,36 +73,19 @@
-
-