@supernova-studio/supernova-sdk-beta 1.6.15 → 1.6.16
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.
|
@@ -62,7 +62,7 @@ export declare class TokenJSONElementTransformer {
|
|
|
62
62
|
safeGroupName(group: TokenGroup): string;
|
|
63
63
|
processedName(name: string, naming: JSONBuilderNamingOption): string;
|
|
64
64
|
/** Retrieve human-readable token type in unified fashion, used both as token type and as token master group */
|
|
65
|
-
typeLabel(type: TokenType): "color" | "gradient" | "typography" | "border" | "textCase" | "textDecoration" | "shadow" | "visibility" | "
|
|
65
|
+
typeLabel(type: TokenType): "color" | "gradient" | "typography" | "border" | "textCase" | "textDecoration" | "shadow" | "visibility" | "text" | "measure";
|
|
66
66
|
/** Retrieve chain of groups up to a specified group, ordered from parent to children */
|
|
67
67
|
referenceGroupChain(containingGroup: TokenGroup, allGroups: Array<TokenGroup>): Array<TokenGroup>;
|
|
68
68
|
}
|
|
@@ -52101,6 +52101,7 @@ class DTTokenMerger {
|
|
|
52101
52101
|
const existingAsProcessedNodes = this.convertBaseTokensToProcessedNode(existing, groups);
|
|
52102
52102
|
const existingMap = this.buildNodeMap(existingAsProcessedNodes);
|
|
52103
52103
|
const extractedMap = this.buildNodeMap(extracted);
|
|
52104
|
+
const idInVersionToIgnore = [];
|
|
52104
52105
|
// Existing: font-sizing/font-size/fontsizes/body
|
|
52105
52106
|
// Extracted: measure/font-size/fontsizes/body
|
|
52106
52107
|
// Maybe, instead we should run a migration to rename origin.ids?
|
|
@@ -52118,6 +52119,7 @@ class DTTokenMerger {
|
|
|
52118
52119
|
node.token.id = oldToken.token.id;
|
|
52119
52120
|
node.token.idInVersion = oldToken.token.idInVersion;
|
|
52120
52121
|
toUpdate.push(node);
|
|
52122
|
+
idInVersionToIgnore.push(oldToken.token.idInVersion);
|
|
52121
52123
|
}
|
|
52122
52124
|
else {
|
|
52123
52125
|
const newId = (0, uuid_1.v4)();
|
|
@@ -52133,8 +52135,12 @@ class DTTokenMerger {
|
|
|
52133
52135
|
TokenUtils_1.TokenUtils.replaceIdForComplexTokens(node.token, oldId, newId);
|
|
52134
52136
|
}
|
|
52135
52137
|
}
|
|
52138
|
+
const extractedMapWithoutMatchedTokens = this.buildNodeMap([...extractedMap.values()].filter(t => !idInVersionToIgnore.includes(t.token.idInVersion)));
|
|
52136
52139
|
for (const node of existingAsProcessedNodes) {
|
|
52137
|
-
|
|
52140
|
+
if (idInVersionToIgnore.includes(node.token.idInVersion)) {
|
|
52141
|
+
continue;
|
|
52142
|
+
}
|
|
52143
|
+
const isInExtractedMap = !!TokenUtils_1.TokenUtils.getTokenByKeyOrBackwardKey(node, extractedMapWithoutMatchedTokens);
|
|
52138
52144
|
if (!isInExtractedMap) {
|
|
52139
52145
|
toDelete.push(node);
|
|
52140
52146
|
// Any tokens and theme overrides that were imported from Figma are unlinked (turned into SN tokens)
|
|
@@ -58609,17 +58615,20 @@ class TokenUtils {
|
|
|
58609
58615
|
static buildFallbackKey(node) {
|
|
58610
58616
|
return this.buildKey(node.path, node.token.name)
|
|
58611
58617
|
.replace(/^measure\//, this.mapTypeToPrefix(node.token.tokenType) + '/')
|
|
58612
|
-
.replace(/^generic\//, this.mapTypeToPrefix(node.token.tokenType) + '/')
|
|
58618
|
+
.replace(/^generic\//, this.mapTypeToPrefix(node.token.tokenType) + '/')
|
|
58619
|
+
.replace(/^radius\//, this.mapTypeToPrefix(node.token.tokenType) + '/');
|
|
58613
58620
|
}
|
|
58614
58621
|
static buildFallbackKeyBack(node) {
|
|
58615
58622
|
return this.buildKey(node.path, node.token.name)
|
|
58616
|
-
.replace(/^(font-size|font-sizing|line-height|letter-spacing|paragraph-spacing|spacing|space|opacity|size|sizing)\//, 'measure/')
|
|
58617
|
-
.replace(/^(font-family|font-weight)\//, 'generic/')
|
|
58623
|
+
.replace(/^(dimension|font-size|font-sizing|line-height|letter-spacing|paragraph-spacing|spacing|space|opacity|size|sizing)\//, 'measure/')
|
|
58624
|
+
.replace(/^(font-family|font-weight)\//, 'generic/')
|
|
58625
|
+
.replace(/^(border-radius)\//, 'radius/');
|
|
58618
58626
|
}
|
|
58619
58627
|
static buildFallbackKey2(node) {
|
|
58620
58628
|
return this.buildKey(node.path, node.token.name)
|
|
58621
58629
|
.replace(/^measure\//, this.mapTypeToPrefix2(node.token.tokenType) + '/')
|
|
58622
|
-
.replace(/^generic\//, this.mapTypeToPrefix(node.token.tokenType) + '/')
|
|
58630
|
+
.replace(/^generic\//, this.mapTypeToPrefix(node.token.tokenType) + '/')
|
|
58631
|
+
.replace(/^radius\//, this.mapTypeToPrefix(node.token.tokenType) + '/');
|
|
58623
58632
|
}
|
|
58624
58633
|
static getTokenByKeyOrFallbackKeys(node, map) {
|
|
58625
58634
|
var _a;
|
|
@@ -58629,7 +58638,7 @@ class TokenUtils {
|
|
|
58629
58638
|
static getKeysByKeyOrFallbackKeys(node) {
|
|
58630
58639
|
const key = TokenUtils.buildKey(node.path, node.token.name);
|
|
58631
58640
|
const fallbackKey = TokenUtils.buildFallbackKey(node);
|
|
58632
|
-
const fallbackKey2 = TokenUtils.
|
|
58641
|
+
const fallbackKey2 = TokenUtils.buildFallbackKey2(node);
|
|
58633
58642
|
// FIXMENOW: Verify and test
|
|
58634
58643
|
const fallbackKey3 = TokenUtils.buildFallbackKeyBack(node);
|
|
58635
58644
|
// if (key !== fallbackKey || key !== fallbackKey2) console.log({ key, fallbackKey, fallbackKey2 })
|
|
@@ -58662,7 +58671,7 @@ TokenUtils.mapTypeToPrefix = (type) => {
|
|
|
58662
58671
|
case SDKTokenType_1.TokenType.space:
|
|
58663
58672
|
return 'spacing';
|
|
58664
58673
|
case SDKTokenType_1.TokenType.radius:
|
|
58665
|
-
return 'radius';
|
|
58674
|
+
return 'border-radius';
|
|
58666
58675
|
case SDKTokenType_1.TokenType.fontFamily:
|
|
58667
58676
|
return 'font-family';
|
|
58668
58677
|
case SDKTokenType_1.TokenType.fontWeight:
|