Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-figma

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-figma - npm Package Compare versions

Comparing version 0.0.40 to 0.0.41

helpers/isEqualFontStyle.d.ts

16

hooks/useFontName.js

@@ -40,2 +40,3 @@ "use strict";

var React = require("react");
var isEqualFontStyle_1 = require("../helpers/isEqualFontStyle");
exports.useFontName = function (fontName) {

@@ -45,8 +46,19 @@ var _a = React.useState(null), loadedFont = _a[0], setLoadedFont = _a[1];

var loader = function () { return __awaiter(_this, void 0, void 0, function () {
var fonts, findedFont;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, figma.loadFontAsync(fontName)];
case 0: return [4 /*yield*/, figma.listAvailableFontsAsync()];
case 1:
fonts = _a.sent();
findedFont = fonts.find(function (font) {
return font.fontName.family === fontName.family && isEqualFontStyle_1.isEqualFontStyle(font.fontName.style, fontName.style);
});
if (!findedFont) {
console.warn("Font " + fontName.family + " " + fontName.style + " not found");
return [2 /*return*/];
}
return [4 /*yield*/, figma.loadFontAsync(findedFont.fontName)];
case 2:
_a.sent();
setLoadedFont(fontName);
setLoadedFont(findedFont.fontName);
return [2 /*return*/];

@@ -53,0 +65,0 @@ }

4

package.json
{
"name": "react-figma",
"version": "0.0.40",
"version": "0.0.41",
"description": "Render React components to Figma",

@@ -52,3 +52,3 @@ "scripts": {

"css-loader": "^3.2.0",
"figma-api-stub": "0.0.27",
"figma-api-stub": "0.0.28",
"gitbook-cli": "^2.3.2",

@@ -55,0 +55,0 @@ "gitbook-plugin-anchorjs": "^2.1.0",

@@ -12,2 +12,3 @@ "use strict";

var isValidSize_1 = require("../helpers/isValidSize");
var isEqualFontStyle_1 = require("../helpers/isEqualFontStyle");
var textNodePropsAssign = propsAssign_1.propsAssign([

@@ -38,5 +39,8 @@ 'characters',

var loadedFont = props.loadedFont, _a = props.fontName, fontName = _a === void 0 ? defaultFont : _a;
if (loadedFont && fontName && loadedFont.family === fontName.family && loadedFont.style === fontName.style) {
if (loadedFont &&
fontName &&
loadedFont.family === fontName.family &&
isEqualFontStyle_1.isEqualFontStyle(loadedFont.style, fontName.style)) {
if (props.fontName) {
textNode.fontName = props.fontName;
textNode.fontName = loadedFont;
}

@@ -43,0 +47,0 @@ if (props.hasDefinedWidth &&

@@ -5,3 +5,3 @@ import { Color, GeometryProps, TextNodeProps } from '../types';

fontFamily: string;
fontWeight: string | number;
fontWeight: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
fontStyle: 'normal' | 'italic';

@@ -8,0 +8,0 @@ fontSize: number;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc