figma-api-stub
Advanced tools
Comparing version 0.0.34 to 0.0.35
@@ -39,7 +39,11 @@ "use strict"; | ||
var currentPageChangeSubscribes = new Map(); | ||
var lastId = 1; | ||
var allocateId = function (node) { | ||
lastId += 1; | ||
node.id = "1:" + lastId; | ||
var majorId = 0; | ||
var minorIds = {}; | ||
var allocateId = function (node, majorVersion, minorVersion) { | ||
var major = majorVersion === undefined ? majorId : majorVersion; | ||
var minor = minorVersion === undefined ? (minorIds[major] || 1) + 1 : minorVersion; | ||
minorIds[major] = minor; | ||
node.id = major + ":" + minor; | ||
}; | ||
var getMajorId = function (node) { return Math.max(node.id.split(":")[0], 1); }; | ||
var UIAPIStub = /** @class */ (function () { | ||
@@ -342,3 +346,4 @@ function UIAPIStub() { | ||
var result = new PageNodeStub(); | ||
allocateId(result); | ||
majorId += 1; | ||
allocateId(result, undefined, 1); | ||
this.root.appendChild(result); | ||
@@ -350,3 +355,3 @@ return result; | ||
var result = new FrameNodeStub(); | ||
allocateId(result); | ||
allocateId(result, getMajorId(this.currentPage)); | ||
this.currentPage.appendChild(result); | ||
@@ -358,3 +363,3 @@ return result; | ||
var result = new ComponentNodeStub(); | ||
allocateId(result); | ||
allocateId(result, getMajorId(this.currentPage)); | ||
this.currentPage.appendChild(result); | ||
@@ -366,3 +371,3 @@ return result; | ||
var result = new RectangleNodeStub(); | ||
allocateId(result); | ||
allocateId(result, getMajorId(this.currentPage)); | ||
this.currentPage.appendChild(result); | ||
@@ -374,3 +379,3 @@ return result; | ||
var result = new TextNodeStub(); | ||
allocateId(result); | ||
allocateId(result, getMajorId(this.currentPage)); | ||
this.currentPage.appendChild(result); | ||
@@ -385,3 +390,3 @@ return result; | ||
var group = new GroupNodeStub(); | ||
allocateId(group); | ||
allocateId(group, getMajorId(this.currentPage)); | ||
nodes.forEach(function (node) { return group.appendChild(node); }); | ||
@@ -388,0 +393,0 @@ if (index) { |
{ | ||
"name": "figma-api-stub", | ||
"version": "0.0.34", | ||
"version": "0.0.35", | ||
"description": "Figma API stub", | ||
@@ -12,3 +12,3 @@ "main": "./dist/index.js", | ||
"build:lib": "cross-env BABEL_ENV=production tsc -p tsconfig.json", | ||
"prepublish": "npm run build", | ||
"prepublishOnly": "npm run build", | ||
"test": "jest" | ||
@@ -15,0 +15,0 @@ }, |
@@ -15,2 +15,7 @@ # Figma API Stub | ||
--- | ||
⚠️ Warning! It's not official implementation and it hasn't purpose to fully reproduce Figma behavior and API. | ||
--- | ||
## Installation | ||
@@ -17,0 +22,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58238
1198
41