How to use the @brainly/html-sketchapp.SymbolMaster function in @brainly/html-sketchapp

To help you get started, we’ve selected a few @brainly/html-sketchapp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brainly / html-sketchapp-style-guide / src / styleguide2asketch.js View on Github external
.map(metaNode => {
      const symbolNode = metaNode.firstChild;
      const name = metaNode.title;

      const {left: x, top: y, width, height} = symbolNode.getBoundingClientRect();
      const symbol = new SymbolMaster({x, y, width, height});

      symbol.setId(name);
      symbol.setName(name);

      //symbol.setUserInfo('code', node.innerHTML);

      const parentAndChildren = [symbolNode, ...symbolNode.querySelectorAll('*')];

      Array.from(parentAndChildren)
        .map(node => {
          const layers = nodeToSketchLayers(node);

          return layers.map(layer => {

            // fix font name so the name matches locally installed font
            if (layer instanceof Text && layer._style._fontFamily === 'ProximaNova') {
github microsoft / fast-dna / packages / fast-sketch-library / src / aSketchPage.ts View on Github external
.map((node: Element) => {
            const rect: ClientRect = node.getBoundingClientRect();
            const x: number = rect.left;
            const y: number = rect.top;
            const height: number = rect.height;
            const width: number = rect.width;
            const symbol: SymbolMaster = new SymbolMaster({
                x,
                y,
                width,
                height,
            });
            const children: Element[] = Array.from(node.querySelectorAll("*"));
            const allNodes: Element[] = [node].concat(children);

            if (node.hasAttribute(symbolNameDataAttribute)) {
                symbol.setName(node.getAttribute(symbolNameDataAttribute));
            } else {
                symbol.setName("Symbol");
            }

            allNodes
                .filter((filtered: Element) => filtered !== null || undefined)
github chrisvxd / story2sketch / src / browser / page2layers.js View on Github external
}

  if (fixPseudo) {
    fixPseudoElements();
  }

  if (removePreviewMargin) {
    removeShowMainMargin();
  }

  const layer = nodeTreeToSketchGroup(nodes, {
    getGroupName: getNodeName,
    getRectangleName: getNodeName
  });

  const symbol = new SymbolMaster({ x, y });

  symbol.setName(name);
  symbol.addLayer(layer);

  return symbol.toJSON();
};