@seed-design/figma 2.1.0 → 3.0.1
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/lib/codegen/index.cjs
CHANGED
|
@@ -24423,12 +24423,13 @@ function isVariableAlias(value) {
|
|
|
24423
24423
|
return typeof value === "object" && value !== null && "type" in value && value.type === "VARIABLE_ALIAS";
|
|
24424
24424
|
}
|
|
24425
24425
|
function isIdenticalVariableValue(value1, value2) {
|
|
24426
|
-
if (typeof value1 !== typeof value2) {
|
|
24427
|
-
return false;
|
|
24428
|
-
}
|
|
24429
|
-
if (typeof value1 === "string" || typeof value1 === "number" || typeof value1 === "boolean") {
|
|
24426
|
+
if (typeof value1 !== "object" || typeof value2 !== "object") {
|
|
24430
24427
|
return value1 === value2;
|
|
24431
24428
|
}
|
|
24429
|
+
// A composed color keeps its opacity as a variable alias, so it never equals a resolved value.
|
|
24430
|
+
if (!("r" in value1) || !("r" in value2)) {
|
|
24431
|
+
return false;
|
|
24432
|
+
}
|
|
24432
24433
|
return value1.r === value2.r && value1.g === value2.g && value1.b === value2.b && value1.a === value2.a;
|
|
24433
24434
|
}
|
|
24434
24435
|
function isInsideScope(variable, scope) {
|
package/lib/codegen/index.js
CHANGED
|
@@ -24404,12 +24404,13 @@ function isVariableAlias(value) {
|
|
|
24404
24404
|
return typeof value === "object" && value !== null && "type" in value && value.type === "VARIABLE_ALIAS";
|
|
24405
24405
|
}
|
|
24406
24406
|
function isIdenticalVariableValue(value1, value2) {
|
|
24407
|
-
if (typeof value1 !== typeof value2) {
|
|
24408
|
-
return false;
|
|
24409
|
-
}
|
|
24410
|
-
if (typeof value1 === "string" || typeof value1 === "number" || typeof value1 === "boolean") {
|
|
24407
|
+
if (typeof value1 !== "object" || typeof value2 !== "object") {
|
|
24411
24408
|
return value1 === value2;
|
|
24412
24409
|
}
|
|
24410
|
+
// A composed color keeps its opacity as a variable alias, so it never equals a resolved value.
|
|
24411
|
+
if (!("r" in value1) || !("r" in value2)) {
|
|
24412
|
+
return false;
|
|
24413
|
+
}
|
|
24413
24414
|
return value1.r === value2.r && value1.g === value2.g && value1.b === value2.b && value1.a === value2.a;
|
|
24414
24415
|
}
|
|
24415
24416
|
function isInsideScope(variable, scope) {
|
|
@@ -33107,12 +33107,13 @@ function isVariableAlias(value) {
|
|
|
33107
33107
|
return typeof value === "object" && value !== null && "type" in value && value.type === "VARIABLE_ALIAS";
|
|
33108
33108
|
}
|
|
33109
33109
|
function isIdenticalVariableValue(value1, value2) {
|
|
33110
|
-
if (typeof value1 !== typeof value2) {
|
|
33111
|
-
return false;
|
|
33112
|
-
}
|
|
33113
|
-
if (typeof value1 === "string" || typeof value1 === "number" || typeof value1 === "boolean") {
|
|
33110
|
+
if (typeof value1 !== "object" || typeof value2 !== "object") {
|
|
33114
33111
|
return value1 === value2;
|
|
33115
33112
|
}
|
|
33113
|
+
// A composed color keeps its opacity as a variable alias, so it never equals a resolved value.
|
|
33114
|
+
if (!("r" in value1) || !("r" in value2)) {
|
|
33115
|
+
return false;
|
|
33116
|
+
}
|
|
33116
33117
|
return value1.r === value2.r && value1.g === value2.g && value1.b === value2.b && value1.a === value2.a;
|
|
33117
33118
|
}
|
|
33118
33119
|
function isInsideScope(variable, scope) {
|
|
@@ -33107,12 +33107,13 @@ function isVariableAlias(value) {
|
|
|
33107
33107
|
return typeof value === "object" && value !== null && "type" in value && value.type === "VARIABLE_ALIAS";
|
|
33108
33108
|
}
|
|
33109
33109
|
function isIdenticalVariableValue(value1, value2) {
|
|
33110
|
-
if (typeof value1 !== typeof value2) {
|
|
33111
|
-
return false;
|
|
33112
|
-
}
|
|
33113
|
-
if (typeof value1 === "string" || typeof value1 === "number" || typeof value1 === "boolean") {
|
|
33110
|
+
if (typeof value1 !== "object" || typeof value2 !== "object") {
|
|
33114
33111
|
return value1 === value2;
|
|
33115
33112
|
}
|
|
33113
|
+
// A composed color keeps its opacity as a variable alias, so it never equals a resolved value.
|
|
33114
|
+
if (!("r" in value1) || !("r" in value2)) {
|
|
33115
|
+
return false;
|
|
33116
|
+
}
|
|
33116
33117
|
return value1.r === value2.r && value1.g === value2.g && value1.b === value2.b && value1.a === value2.a;
|
|
33117
33118
|
}
|
|
33118
33119
|
function isInsideScope(variable, scope) {
|
package/lib/index.cjs
CHANGED
|
@@ -28292,12 +28292,13 @@ function isVariableAlias(value) {
|
|
|
28292
28292
|
return typeof value === "object" && value !== null && "type" in value && value.type === "VARIABLE_ALIAS";
|
|
28293
28293
|
}
|
|
28294
28294
|
function isIdenticalVariableValue(value1, value2) {
|
|
28295
|
-
if (typeof value1 !== typeof value2) {
|
|
28296
|
-
return false;
|
|
28297
|
-
}
|
|
28298
|
-
if (typeof value1 === "string" || typeof value1 === "number" || typeof value1 === "boolean") {
|
|
28295
|
+
if (typeof value1 !== "object" || typeof value2 !== "object") {
|
|
28299
28296
|
return value1 === value2;
|
|
28300
28297
|
}
|
|
28298
|
+
// A composed color keeps its opacity as a variable alias, so it never equals a resolved value.
|
|
28299
|
+
if (!("r" in value1) || !("r" in value2)) {
|
|
28300
|
+
return false;
|
|
28301
|
+
}
|
|
28301
28302
|
return value1.r === value2.r && value1.g === value2.g && value1.b === value2.b && value1.a === value2.a;
|
|
28302
28303
|
}
|
|
28303
28304
|
function isInsideScope(variable, scope) {
|
package/lib/index.js
CHANGED
|
@@ -28292,12 +28292,13 @@ function isVariableAlias(value) {
|
|
|
28292
28292
|
return typeof value === "object" && value !== null && "type" in value && value.type === "VARIABLE_ALIAS";
|
|
28293
28293
|
}
|
|
28294
28294
|
function isIdenticalVariableValue(value1, value2) {
|
|
28295
|
-
if (typeof value1 !== typeof value2) {
|
|
28296
|
-
return false;
|
|
28297
|
-
}
|
|
28298
|
-
if (typeof value1 === "string" || typeof value1 === "number" || typeof value1 === "boolean") {
|
|
28295
|
+
if (typeof value1 !== "object" || typeof value2 !== "object") {
|
|
28299
28296
|
return value1 === value2;
|
|
28300
28297
|
}
|
|
28298
|
+
// A composed color keeps its opacity as a variable alias, so it never equals a resolved value.
|
|
28299
|
+
if (!("r" in value1) || !("r" in value2)) {
|
|
28300
|
+
return false;
|
|
28301
|
+
}
|
|
28301
28302
|
return value1.r === value2.r && value1.g === value2.g && value1.b === value2.b && value1.a === value2.a;
|
|
28302
28303
|
}
|
|
28303
28304
|
function isInsideScope(variable, scope) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/figma",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@figma/plugin-typings": "^1.130.0",
|
|
49
|
-
"@figma/rest-api-spec": "^0.
|
|
49
|
+
"@figma/rest-api-spec": "^0.47.0",
|
|
50
50
|
"@karrotmarket/icon-data": "^1.34.0",
|
|
51
|
-
"@seed-design/figma-extractor": "^
|
|
52
|
-
"typescript": "^6.0.
|
|
51
|
+
"@seed-design/figma-extractor": "^2.0.1",
|
|
52
|
+
"typescript": "^6.0.3"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VariableScope } from "@figma/rest-api-spec";
|
|
1
|
+
import type { VariableComposedColor, VariableScope } from "@figma/rest-api-spec";
|
|
2
2
|
|
|
3
3
|
// boundVariable.id is formatted as "VariableID:{key}/{localId}", we have to extract the key
|
|
4
4
|
export function sanitizeVariableId(id: string) {
|
|
@@ -14,23 +14,23 @@ export function isVariableAlias(value: unknown): value is VariableAlias {
|
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
type ComparableVariableValue = string | number | boolean | RGBA | VariableComposedColor;
|
|
18
|
+
|
|
17
19
|
export function isIdenticalVariableValue(
|
|
18
|
-
value1:
|
|
19
|
-
value2:
|
|
20
|
+
value1: ComparableVariableValue,
|
|
21
|
+
value2: ComparableVariableValue,
|
|
20
22
|
) {
|
|
21
|
-
if (typeof value1 !== typeof value2) {
|
|
22
|
-
return
|
|
23
|
+
if (typeof value1 !== "object" || typeof value2 !== "object") {
|
|
24
|
+
return value1 === value2;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
// A composed color keeps its opacity as a variable alias, so it never equals a resolved value.
|
|
28
|
+
if (!("r" in value1) || !("r" in value2)) {
|
|
29
|
+
return false;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
return (
|
|
30
|
-
value1.r ===
|
|
31
|
-
value1.g === (value2 as RGBA).g &&
|
|
32
|
-
value1.b === (value2 as RGBA).b &&
|
|
33
|
-
value1.a === (value2 as RGBA).a
|
|
33
|
+
value1.r === value2.r && value1.g === value2.g && value1.b === value2.b && value1.a === value2.a
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
|