figma-api-stub
Advanced tools
Comparing version 0.0.37 to 0.0.39
@@ -39,11 +39,14 @@ "use strict"; | ||
var currentPageChangeSubscribes = new Map(); | ||
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 majorId = 1; | ||
var minorId = 1; | ||
var allocateId = function (node, shouldIncreaseMajor) { | ||
minorId += 1; | ||
if (!shouldIncreaseMajor) { | ||
node.id = majorId + ":" + minorId; | ||
} | ||
else { | ||
node.id = majorId + ":" + 1; | ||
majorId += 1; | ||
} | ||
}; | ||
var getMajorId = function (node) { return Math.max(node.id.split(":")[0], 1); }; | ||
var UIAPIStub = /** @class */ (function () { | ||
@@ -131,2 +134,14 @@ function UIAPIStub() { | ||
}; | ||
ChildrenMixinStub.prototype.findChild = function (callback) { | ||
if (!this.children) { | ||
return null; | ||
} | ||
return this.children.find(callback); | ||
}; | ||
ChildrenMixinStub.prototype.findChildren = function (callback) { | ||
if (!this.children) { | ||
return null; | ||
} | ||
return this.children.find(callback); | ||
}; | ||
return ChildrenMixinStub; | ||
@@ -164,2 +179,6 @@ }()); | ||
}; | ||
BaseNodeMixinStub.prototype.setRelaunchData = function (data) { | ||
// TODO: Implement this method | ||
console.warn('"setRelaunchData" is not implemented. Skipped', data); | ||
}; | ||
BaseNodeMixinStub.prototype.remove = function () { | ||
@@ -379,4 +398,3 @@ var _this = this; | ||
var result = new PageNodeStub(); | ||
majorId += 1; | ||
allocateId(result, undefined, 1); | ||
allocateId(result, true); | ||
this.root.appendChild(result); | ||
@@ -388,3 +406,3 @@ return result; | ||
var result = new FrameNodeStub(); | ||
allocateId(result, getMajorId(this.currentPage)); | ||
allocateId(result); | ||
this.currentPage.appendChild(result); | ||
@@ -396,3 +414,3 @@ return result; | ||
var result = new ComponentNodeStub(); | ||
allocateId(result, getMajorId(this.currentPage)); | ||
allocateId(result); | ||
this.currentPage.appendChild(result); | ||
@@ -404,3 +422,3 @@ return result; | ||
var result = new RectangleNodeStub(); | ||
allocateId(result, getMajorId(this.currentPage)); | ||
allocateId(result); | ||
this.currentPage.appendChild(result); | ||
@@ -412,3 +430,3 @@ return result; | ||
var result = new TextNodeStub(); | ||
allocateId(result, getMajorId(this.currentPage)); | ||
allocateId(result); | ||
this.currentPage.appendChild(result); | ||
@@ -423,3 +441,3 @@ return result; | ||
var group = new GroupNodeStub(); | ||
allocateId(group, getMajorId(this.currentPage)); | ||
allocateId(group); | ||
nodes.forEach(function (node) { return group.appendChild(node); }); | ||
@@ -426,0 +444,0 @@ if (index) { |
{ | ||
"name": "figma-api-stub", | ||
"version": "0.0.37", | ||
"version": "0.0.39", | ||
"description": "Figma API stub", | ||
@@ -38,2 +38,3 @@ "main": "./dist/index.js", | ||
"devDependencies": { | ||
"@figma-plugin/types": "^1.14.0", | ||
"@types/jest": "^24.0.23", | ||
@@ -40,0 +41,0 @@ "cross-env": "^6.0.3", |
@@ -16,4 +16,4 @@ { | ||
}, | ||
"include": ["src/**/*", "figma.d.ts"], | ||
"include": ["src/**/*", "index.d.ts"], | ||
"exclude": ["node_modules", "dist", "**/__tests__/**"] | ||
} |
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
40966
9
674