@supernova-studio/model 0.55.34 → 0.56.0
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/dsm/elements/raw-element.ts +30 -0
package/package.json
CHANGED
|
@@ -71,6 +71,36 @@ export function isTokenType(type: DesignElementType): type is DesignTokenType {
|
|
|
71
71
|
return DesignTokenType.safeParse(type).success;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
const numberTokenTypes: Set<DesignTokenType> = new Set([
|
|
75
|
+
"Dimension",
|
|
76
|
+
"Duration",
|
|
77
|
+
"Size",
|
|
78
|
+
"Space",
|
|
79
|
+
"Opacity",
|
|
80
|
+
"FontSize",
|
|
81
|
+
"LineHeight",
|
|
82
|
+
"LetterSpacing",
|
|
83
|
+
"ParagraphSpacing",
|
|
84
|
+
"BorderWidth",
|
|
85
|
+
"BorderRadius",
|
|
86
|
+
"ZIndex",
|
|
87
|
+
] satisfies DesignTokenType[]);
|
|
88
|
+
|
|
89
|
+
const stringTokenTypes: Set<DesignTokenType> = new Set([
|
|
90
|
+
"String",
|
|
91
|
+
"ProductCopy",
|
|
92
|
+
"FontFamily",
|
|
93
|
+
"FontWeight",
|
|
94
|
+
] satisfies DesignTokenType[]);
|
|
95
|
+
|
|
96
|
+
export function areTokenTypesCompatible(lhs: DesignTokenType, rhs: DesignTokenType): boolean {
|
|
97
|
+
if (lhs === rhs) return true;
|
|
98
|
+
if (numberTokenTypes.has(lhs) && numberTokenTypes.has(rhs)) return true;
|
|
99
|
+
if (stringTokenTypes.has(lhs) && stringTokenTypes.has(rhs)) return true;
|
|
100
|
+
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
|
|
74
104
|
//
|
|
75
105
|
// Element category
|
|
76
106
|
//
|