@seed-design/figma 2.1.0 → 3.0.2
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 +1829 -364
- package/lib/codegen/index.js +1829 -364
- package/lib/codegen/targets/react/index.cjs +2048 -587
- package/lib/codegen/targets/react/index.js +2048 -587
- package/lib/index.cjs +1829 -364
- package/lib/index.js +1829 -364
- package/package.json +4 -4
- package/src/entities/data/__generated__/component-sets/index.d.ts +1004 -137
- package/src/entities/data/__generated__/component-sets/index.mjs +1004 -137
- package/src/entities/data/__generated__/components/index.d.ts +114 -60
- package/src/entities/data/__generated__/components/index.mjs +114 -60
- package/src/entities/data/__generated__/styles/index.mjs +1 -1
- package/src/entities/data/__generated__/variable-collections/index.mjs +33 -0
- package/src/entities/data/__generated__/variables/index.mjs +760 -196
- package/src/utils/figma-variable.ts +11 -11
|
@@ -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
|
|