From d3400ada762b1983c10ed0c70c8c30e42a537b3a Mon Sep 17 00:00:00 2001 From: Thomas Lowry Date: Sun, 3 May 2020 00:22:42 -0400 Subject: [PATCH] Updated figma-plugin-ds dependency --- dist/code.js | 39 ++++++++++++++++++++++++++++++++++++++- dist/index.html | 18 ++++++++++++++---- package-lock.json | 6 ++++++ package.json | 1 + src/ui/index.html | 18 ++++++++++++++---- src/ui/js/scripts.js | 3 ++- 6 files changed, 75 insertions(+), 10 deletions(-) diff --git a/dist/code.js b/dist/code.js index b9daaaf..e6bcab5 100644 --- a/dist/code.js +++ b/dist/code.js @@ -1 +1,38 @@ -figma.showUI(__html__,{width:232,height:208}),figma.ui.onmessage=function(e){if("create-shapes"===e.type){for(var a=[],i=0;i tag inside "ui.html" which has a +// full browser enviroment (see documentation). +// This shows the HTML page in "ui.html". +figma.showUI(__html__, { width: 232, height: 208 }); +// Calls to "parent.postMessage" from within the HTML page will trigger this +// callback. The callback will be passed the "pluginMessage" property of the +// posted message. +figma.ui.onmessage = function (msg) { + // One way of distinguishing between different types of messages sent from + // your HTML page is to use an object with a "type" property like this. + if (msg.type === 'create-shapes') { + var nodes = []; + for (var i = 0; i < msg.count; i++) { + var shape; + if (msg.shape === 'rectangle') { + shape = figma.createRectangle(); + } + else if (msg.shape === 'triangle') { + shape = figma.createPolygon(); + } + else { + shape = figma.createEllipse(); + } + shape.x = i * 150; + shape.fills = [{ type: 'SOLID', color: { r: 1, g: 0.5, b: 0 } }]; + figma.currentPage.appendChild(shape); + nodes.push(shape); + } + figma.currentPage.selection = nodes; + figma.viewport.scrollAndZoomIntoView(nodes); + } + // Make sure to close the plugin when you're done. Otherwise the plugin will + // keep running, which shows the cancel button at the bottom of the screen. + figma.closePlugin(); +}; diff --git a/dist/index.html b/dist/index.html index eefd692..41fce33 100644 --- a/dist/index.html +++ b/dist/index.html @@ -3,11 +3,21 @@ - + + + + - - - + + + + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b225ba4..ba5d03b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2172,6 +2172,12 @@ "reusify": "^1.0.4" } }, + "figma-plugin-ds": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/figma-plugin-ds/-/figma-plugin-ds-0.0.5.tgz", + "integrity": "sha512-uZ074cdSYl5jeDlvnapKqJjMTuioF5gVRql3c7zArR7p/bZXAbT6operPgVcJnKZFRtNGQ6L6W5PkG8YqmwwsQ==", + "dev": true + }, "file-extension": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/file-extension/-/file-extension-1.1.4.tgz", diff --git a/package.json b/package.json index e2efbf7..6c68b71 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "autoprefixer": "^9.7.6", "cssnano": "^4.1.10", "del": "^5.1.0", + "figma-plugin-ds": "0.0.5", "gulp": "^4.0.2", "gulp-base64-inline": "^1.0.6", "gulp-concat": "^2.6.1", diff --git a/src/ui/index.html b/src/ui/index.html index debf3b5..054bef7 100644 --- a/src/ui/index.html +++ b/src/ui/index.html @@ -3,11 +3,21 @@ - + + + + - - - + + + + + \ No newline at end of file diff --git a/src/ui/js/scripts.js b/src/ui/js/scripts.js index 4fbeb21..d3978b4 100644 --- a/src/ui/js/scripts.js +++ b/src/ui/js/scripts.js @@ -1,5 +1,6 @@ function helloThere() { console.log('hello there'); } +helloThere(); -helloThere(); \ No newline at end of file +selectMenu.init(); \ No newline at end of file