@design-sdk/figma-url 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +0 -1
- package/dist/lib/access-check.js +1 -2
- package/dist/lib/analyze-url.d.ts +4 -4
- package/dist/lib/analyze-url.js +4 -5
- package/dist/lib/compare-url.d.ts +1 -0
- package/dist/lib/compare-url.js +19 -0
- package/dist/lib/constants.js +0 -1
- package/dist/lib/embed-url.js +1 -2
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -1
- package/dist/lib/parse-url.js +0 -1
- package/dist/lib/target-node-config.js +0 -1
- package/package.json +11 -4
package/dist/index.js
CHANGED
package/dist/lib/access-check.js
CHANGED
|
@@ -23,7 +23,7 @@ const analyze_url_1 = require("./analyze-url");
|
|
|
23
23
|
*/
|
|
24
24
|
function isPublic(url) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const type = analyze_url_1.analyze(url);
|
|
26
|
+
const type = (0, analyze_url_1.analyze)(url);
|
|
27
27
|
if (type == analyze_url_1.FigmaUrlType.embed || analyze_url_1.FigmaUrlType.file || analyze_url_1.FigmaUrlType.node) {
|
|
28
28
|
try {
|
|
29
29
|
const res = yield fetch(url);
|
|
@@ -37,4 +37,3 @@ function isPublic(url) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
exports.isPublic = isPublic;
|
|
40
|
-
//# sourceMappingURL=access-check.js.map
|
|
@@ -17,10 +17,10 @@ export declare enum FigmaUrlType {
|
|
|
17
17
|
empty = "empty"
|
|
18
18
|
}
|
|
19
19
|
export declare enum FigmaFileOrNodeIdType {
|
|
20
|
-
nodeid =
|
|
21
|
-
maybe_nodeid =
|
|
22
|
-
fileid =
|
|
23
|
-
maybe_fileid =
|
|
20
|
+
nodeid = "nodeid",
|
|
21
|
+
maybe_nodeid = "maybe_nodeid",
|
|
22
|
+
fileid = "fileid",
|
|
23
|
+
maybe_fileid = "maybe_fileid"
|
|
24
24
|
}
|
|
25
25
|
export declare type FigmaInputAnalysisResult = FigmaUrlType | FigmaFileOrNodeIdType;
|
|
26
26
|
export declare function analyze(url: string): FigmaInputAnalysisResult;
|
package/dist/lib/analyze-url.js
CHANGED
|
@@ -23,10 +23,10 @@ var FigmaUrlType;
|
|
|
23
23
|
})(FigmaUrlType = exports.FigmaUrlType || (exports.FigmaUrlType = {}));
|
|
24
24
|
var FigmaFileOrNodeIdType;
|
|
25
25
|
(function (FigmaFileOrNodeIdType) {
|
|
26
|
-
FigmaFileOrNodeIdType[
|
|
27
|
-
FigmaFileOrNodeIdType[
|
|
28
|
-
FigmaFileOrNodeIdType[
|
|
29
|
-
FigmaFileOrNodeIdType[
|
|
26
|
+
FigmaFileOrNodeIdType["nodeid"] = "nodeid";
|
|
27
|
+
FigmaFileOrNodeIdType["maybe_nodeid"] = "maybe_nodeid";
|
|
28
|
+
FigmaFileOrNodeIdType["fileid"] = "fileid";
|
|
29
|
+
FigmaFileOrNodeIdType["maybe_fileid"] = "maybe_fileid";
|
|
30
30
|
})(FigmaFileOrNodeIdType = exports.FigmaFileOrNodeIdType || (exports.FigmaFileOrNodeIdType = {}));
|
|
31
31
|
function analyze(url) {
|
|
32
32
|
var _a;
|
|
@@ -97,4 +97,3 @@ function analyze(url) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
exports.analyze = analyze;
|
|
100
|
-
//# sourceMappingURL=analyze-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isSameDesignUrl(url1: string, url2: string): boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSameDesignUrl = void 0;
|
|
4
|
+
const analyze_url_1 = require("./analyze-url");
|
|
5
|
+
const parse_url_1 = require("./parse-url");
|
|
6
|
+
function isSameDesignUrl(url1, url2) {
|
|
7
|
+
const analysis = (0, analyze_url_1.analyze)(url1);
|
|
8
|
+
switch (analysis) {
|
|
9
|
+
case analyze_url_1.FigmaUrlType.embed:
|
|
10
|
+
case analyze_url_1.FigmaUrlType.empty:
|
|
11
|
+
case analyze_url_1.FigmaUrlType.file:
|
|
12
|
+
return false;
|
|
13
|
+
case analyze_url_1.FigmaUrlType.node:
|
|
14
|
+
const parsed = (0, parse_url_1.parseFileAndNodeId)(url1);
|
|
15
|
+
const _this_parsed = (0, parse_url_1.parseFileAndNodeId)(url2);
|
|
16
|
+
return (_this_parsed.file === parsed.file && _this_parsed.node === parsed.node);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.isSameDesignUrl = isSameDesignUrl;
|
package/dist/lib/constants.js
CHANGED
|
@@ -28,4 +28,3 @@ exports.__FIGMA_DEMO_DEFAULT_FILE_ID = "Y0Gh77AqBoHH7dG1GtK3xF";
|
|
|
28
28
|
exports.__FIGMA_DEMO_DEFAULT_FILE_URL = "https://www.figma.com/file/Y0Gh77AqBoHH7dG1GtK3xF/";
|
|
29
29
|
exports.__FIGMA_DEMO_DEFAULT_FILE_NODE_URL = "https://www.figma.com/file/Y0Gh77AqBoHH7dG1GtK3xF/?node-id=264%3A49";
|
|
30
30
|
// ======================================================================================================
|
|
31
|
-
//# sourceMappingURL=constants.js.map
|
package/dist/lib/embed-url.js
CHANGED
|
@@ -10,7 +10,7 @@ const constants_1 = require("./constants");
|
|
|
10
10
|
*/
|
|
11
11
|
function embed(src) {
|
|
12
12
|
const url = builEmbedableSourceUrl(src);
|
|
13
|
-
const urltype = analyze_url_1.analyze(url);
|
|
13
|
+
const urltype = (0, analyze_url_1.analyze)(url);
|
|
14
14
|
switch (urltype) {
|
|
15
15
|
case analyze_url_1.FigmaUrlType.embed:
|
|
16
16
|
return url;
|
|
@@ -54,4 +54,3 @@ function builEmbedableSourceUrl(src) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
exports.builEmbedableSourceUrl = builEmbedableSourceUrl;
|
|
57
|
-
//# sourceMappingURL=embed-url.js.map
|
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/index.js
CHANGED
|
@@ -16,4 +16,4 @@ __exportStar(require("./access-check"), exports);
|
|
|
16
16
|
__exportStar(require("./analyze-url"), exports);
|
|
17
17
|
__exportStar(require("./target-node-config"), exports);
|
|
18
18
|
__exportStar(require("./constants"), exports);
|
|
19
|
-
|
|
19
|
+
__exportStar(require("./compare-url"), exports);
|
package/dist/lib/parse-url.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design-sdk/figma-url",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Figma url utils for sharing & embeding and url inspection",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"private": false,
|
|
6
7
|
"homepage": "https://github.com/gridaco/design-sdk",
|
|
7
8
|
"repository": "https://github.com/gridaco/design-sdk",
|
|
9
|
+
"authors": [
|
|
10
|
+
"grida.co",
|
|
11
|
+
"softmarshmallow <universe@grida.co>"
|
|
12
|
+
],
|
|
8
13
|
"scripts": {
|
|
9
|
-
"
|
|
14
|
+
"clean": "rimraf dist",
|
|
15
|
+
"build": "yarn clean && tsc",
|
|
10
16
|
"test": "jest"
|
|
11
17
|
},
|
|
12
18
|
"files": [
|
|
@@ -19,5 +25,6 @@
|
|
|
19
25
|
],
|
|
20
26
|
"publishConfig": {
|
|
21
27
|
"access": "public"
|
|
22
|
-
}
|
|
23
|
-
|
|
28
|
+
},
|
|
29
|
+
"gitHead": "e0abc41876d7c290b3dc1a9b355e5e9e7aa0c332"
|
|
30
|
+
}
|