MCPcopy Index your code
hub / github.com/bernaferrari/FigmaToCode / generateHTMLPreview

Function generateHTMLPreview

packages/backend/src/html/htmlMain.ts:350–374  ·  view source on GitHub ↗
(
  nodes: SceneNode[],
  settings: PluginSettings,
)

Source from the content-addressed store, hash-verified

348};
349
350export const generateHTMLPreview = async (
351 nodes: SceneNode[],
352 settings: PluginSettings,
353): Promise<HTMLPreview> => {
354 let result = await htmlMain(
355 nodes,
356 {
357 ...settings,
358 htmlGenerationMode: "html",
359 },
360 nodes.length > 1 ? false : true,
361 );
362
363 if (nodes.length > 1) {
364 result.html = `<div style="width: 100%; height: 100%">${result.html}</div>`;
365 }
366
367 return {
368 size: {
369 width: Math.max(...nodes.map((node) => node.width)),
370 height: nodes.reduce((sum, node) => sum + node.height, 0),
371 },
372 content: result.html,
373 };
374};
375
376const htmlWidgetGenerator = async (
377 sceneNode: ReadonlyArray<SceneNode>,

Callers 1

runFunction · 0.90

Calls 1

htmlMainFunction · 0.85

Tested by

no test coverage detected