Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function buildLibrary(designInfo, newSketch) {
const libraryPage = new Page({
name: "Library"
});
var offset = 20;
var lastX = 20;
for (const library of designInfo.libraries) {
const artboard = new Artboard({
name: library.libraryName
});
switch (library.libraryName) {
case "Color":
buildColorLibrary(library.libraryPresets, newSketch, artboard);
break;
case "FontSize":
buildFontSizeLibrary(library.libraryPresets, newSketch, artboard);
break;
default:
break;
}
artboard.frame.x = lastX;
lastX = lastX + artboard.frame.width + offset;
function buildFlows(designInfo, newSketch) {
for (const flow of designInfo.flows) {
const page = new Page({
name: flow.flowName
});
if (flow.interactions == null) {
continue;
}
var index = 1;
for (const interaction of flow.interactions) {
let seeComponentName = interaction.see.componentName.replace(/\"/g, "");
let seeComponentData = interaction.see.data.replace(/\"/g, "");
const artboard = new Artboard({
name: seeComponentData + seeComponentName,
frame: {
width: '320px',
height: '480px',
x: 360 * index + 'px'
},
});
page.addArtboard(artboard);
index++;
reactIndex = 0;
let lastFrame = {
x: 0,
y: 0
};
],
},
width: 320,
height: 400,
x: 120,
y: addYPos(40),
})
const artboardFrame = {
width: 1280,
height: addYPos(520),
x: 0,
y: 0
}
const artboard = new Artboard({
name: 'Telements',
layers: [
textVersion,
textTelements,
textGeneratedFile,
rectangleDivider,
textComponents,
textAlert,
rectangleAlertBackground,
textButton,
rectangleButton,
textCard,
rectangleCard,
],
frame: artboardFrame,
});
x: 360 * index + 'px'
},
});
page.addArtboard(artboard);
index++;
reactIndex = 0;
let lastFrame = {
x: 0,
y: 0
};
for (const react of interaction.react) {
let componentName = react.reactComponentName.replace(/\"/g, "");
let componentData = react.reactComponentData.replace(/\"/g, "");
const artboard1 = new Artboard({
name: componentData + componentName,
frame: {
width: '320px',
height: '480px',
x: 360 * index + 'px',
y: lastFrame.y + reactIndex * 20 + 'px'
},
});
lastFrame = {
y: artboard1.frame.height
};
if (components[componentName]) {
if (components[componentName].width) {
artboard1.frame.width = components[componentName].width
}