@supernova-studio/supernova-sdk-beta 1.6.20 → 1.6.21
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/build/sdk-typescript/src/model/support/SDKTokenOrigin.d.ts +2 -0
- package/build/sdk-typescript/src/model/tokens/SDKTokenValue.d.ts +1 -0
- package/build/sdk-typescript/src/model/tokens/remote/SDKRemoteTokenModel.d.ts +2 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTJSONConverter.d.ts +1 -0
- package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTTokenReferenceResolver.d.ts +1 -0
- package/build/sdk-typescript/src/tools/json-builder/elements-transformers/SDKToolsJSONElementTransformer.d.ts +1 -1
- package/build/supernova-sdk-typescript.js +153 -112
- package/build/supernova-sdk-typescript.js.map +1 -1
- package/package.json +1 -1
|
@@ -198,3 +198,4 @@ export declare const checkSingleReferencedTokenById: (token: AnyToken, candidate
|
|
|
198
198
|
export declare const replaceReferencedTokenIds: (token: AnyToken, currentId: string, newId: string, allTokens: Map<string, Token>) => void;
|
|
199
199
|
export declare const replaceReferencedToken: (token: Token, existingToken: AnyToken, newToken: AnyToken) => void;
|
|
200
200
|
export declare const replaceReferencedTokenByIds: (token: Token, existingTokenId: string, newTokenId: string) => void;
|
|
201
|
+
export declare const replaceOriginReferencePersistentIdByIds: (token: Token, existingTokenId: string, newTokenId: string) => void;
|
|
@@ -17,6 +17,7 @@ export declare class DTJSONConverter {
|
|
|
17
17
|
referenceResolver: DTTokenReferenceResolver;
|
|
18
18
|
constructor(versionId: string, mapping: DTPluginToSupernovaMapPack);
|
|
19
19
|
convertNodesToTokens(nodes: Array<DTParsedNode>, brand: Brand): Array<DTProcessedTokenNode>;
|
|
20
|
+
private remapRootNodeKey;
|
|
20
21
|
private remapRootNodeKeys;
|
|
21
22
|
private convertNodesToTokensForSupportedNodeTypes;
|
|
22
23
|
private convertAtomicNode;
|
package/build/sdk-typescript/src/tools/design-tokens/utilities/SDKDTTokenReferenceResolver.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class DTTokenReferenceResolver {
|
|
|
12
12
|
unmappedValues(): Array<DTProcessedTokenNode>;
|
|
13
13
|
tokensOfType(type: TokenType): Array<Token>;
|
|
14
14
|
lookupReferencedToken(reference: string): Token | undefined;
|
|
15
|
+
lookupReferencedNode(reference: string): DTProcessedTokenNode | undefined;
|
|
15
16
|
lookupAllReferencedTokens(reference: string): Array<{
|
|
16
17
|
token: Token;
|
|
17
18
|
key: string;
|
|
@@ -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" | "measure" | "text";
|
|
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
|
}
|
|
@@ -48241,6 +48241,7 @@ class DimensionCategoryToken extends SDKToken_1.Token {
|
|
|
48241
48241
|
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
|
48242
48242
|
// MARK: - Static building
|
|
48243
48243
|
static create(type, versionId, brandId, name, description, value, alias, properties, propertyValues) {
|
|
48244
|
+
var _a;
|
|
48244
48245
|
const baseToken = {
|
|
48245
48246
|
id: undefined,
|
|
48246
48247
|
persistentId: (0, uuid_1.v4)(),
|
|
@@ -48276,7 +48277,9 @@ class DimensionCategoryToken extends SDKToken_1.Token {
|
|
|
48276
48277
|
measure: DimensionCategoryToken.getCompatibleMeasure(alias.value.unit, type, alias.value.measure),
|
|
48277
48278
|
referencedTokenId: null
|
|
48278
48279
|
};
|
|
48279
|
-
|
|
48280
|
+
const result = new this(versionId, baseToken, tokenValue, undefined, properties, propertyValues);
|
|
48281
|
+
result.origin = Object.assign(Object.assign({}, ((_a = result.origin) !== null && _a !== void 0 ? _a : { id: null, name: null, sourceId: null })), { referencePersistentId: alias.id });
|
|
48282
|
+
return result;
|
|
48280
48283
|
}
|
|
48281
48284
|
}
|
|
48282
48285
|
throw SDKSupernovaError_1.SupernovaError.fromMessage("Dimension Token must be created using value or alias, but none was provided");
|
|
@@ -48450,6 +48453,7 @@ class DimensionCategoryToken extends SDKToken_1.Token {
|
|
|
48450
48453
|
};
|
|
48451
48454
|
}
|
|
48452
48455
|
else {
|
|
48456
|
+
//
|
|
48453
48457
|
// If tokenType from args !== tokenType resolved, inline
|
|
48454
48458
|
// Align units, if we reference dimension from Opacity, unit must become raw
|
|
48455
48459
|
console.log(`Inlining reference ${reference.id}: ${reference.tokenType} into ${definition}:${tokenType}`);
|
|
@@ -49672,7 +49676,7 @@ class Token {
|
|
|
49672
49676
|
this.sortOrder = order;
|
|
49673
49677
|
}
|
|
49674
49678
|
toBaseWriteObject() {
|
|
49675
|
-
var _a, _b, _c, _d;
|
|
49679
|
+
var _a, _b, _c, _d, _e, _f;
|
|
49676
49680
|
return {
|
|
49677
49681
|
id: this.idInVersion,
|
|
49678
49682
|
brandId: this.brandId,
|
|
@@ -49688,6 +49692,8 @@ class Token {
|
|
|
49688
49692
|
id: (_b = this.origin.id) !== null && _b !== void 0 ? _b : undefined,
|
|
49689
49693
|
name: (_c = this.origin.name) !== null && _c !== void 0 ? _c : undefined,
|
|
49690
49694
|
sourceId: (_d = this.origin.sourceId) !== null && _d !== void 0 ? _d : undefined,
|
|
49695
|
+
referenceOriginId: (_e = this.origin.referenceOriginId) !== null && _e !== void 0 ? _e : undefined,
|
|
49696
|
+
referencePersistentId: (_f = this.origin.referencePersistentId) !== null && _f !== void 0 ? _f : undefined,
|
|
49691
49697
|
}
|
|
49692
49698
|
: undefined,
|
|
49693
49699
|
customPropertyOverrides: [],
|
|
@@ -49944,7 +49950,7 @@ exports.TokenComparator = TokenComparator;
|
|
|
49944
49950
|
// This file defines all token value containers for the actual model - this model will be exactly available to users
|
|
49945
49951
|
//
|
|
49946
49952
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
49947
|
-
exports.replaceReferencedTokenByIds = exports.replaceReferencedToken = exports.replaceReferencedTokenIds = exports.checkSingleReferencedTokenById = exports.getSingleReferencedTokenId = exports.getReferencedTokens = void 0;
|
|
49953
|
+
exports.replaceOriginReferencePersistentIdByIds = exports.replaceReferencedTokenByIds = exports.replaceReferencedToken = exports.replaceReferencedTokenIds = exports.checkSingleReferencedTokenById = exports.getSingleReferencedTokenId = exports.getReferencedTokens = void 0;
|
|
49948
49954
|
const SDKGradientToken_1 = __webpack_require__(/*! ./SDKGradientToken */ "./src/model/tokens/SDKGradientToken.ts");
|
|
49949
49955
|
const SDKShadowToken_1 = __webpack_require__(/*! ./SDKShadowToken */ "./src/model/tokens/SDKShadowToken.ts");
|
|
49950
49956
|
const getReferencedTokens = (token, allTokens) => {
|
|
@@ -49979,6 +49985,7 @@ const replaceReferencedTokenIds = (token, currentId, newId, allTokens) => {
|
|
|
49979
49985
|
exports.replaceReferencedTokenIds = replaceReferencedTokenIds;
|
|
49980
49986
|
const replaceReferencedToken = (token, existingToken, newToken) => {
|
|
49981
49987
|
(0, exports.replaceReferencedTokenByIds)(token, existingToken.id, newToken.id);
|
|
49988
|
+
(0, exports.replaceOriginReferencePersistentIdByIds)(token, existingToken.id, newToken.id);
|
|
49982
49989
|
};
|
|
49983
49990
|
exports.replaceReferencedToken = replaceReferencedToken;
|
|
49984
49991
|
const replaceReferencedTokenByIds = (token, existingTokenId, newTokenId) => {
|
|
@@ -50001,6 +50008,18 @@ const replaceReferencedTokenByIds = (token, existingTokenId, newTokenId) => {
|
|
|
50001
50008
|
}
|
|
50002
50009
|
};
|
|
50003
50010
|
exports.replaceReferencedTokenByIds = replaceReferencedTokenByIds;
|
|
50011
|
+
const replaceOriginReferencePersistentIdByIds = (token, existingTokenId, newTokenId) => {
|
|
50012
|
+
const origin = token === null || token === void 0 ? void 0 : token.origin;
|
|
50013
|
+
if (!(origin === null || origin === void 0 ? void 0 : origin.referencePersistentId)) {
|
|
50014
|
+
// Do nothing if there is no origin
|
|
50015
|
+
}
|
|
50016
|
+
else if (origin.referencePersistentId && !Array.isArray(origin.referencePersistentId)) {
|
|
50017
|
+
if (origin.referencePersistentId === existingTokenId) {
|
|
50018
|
+
origin.referencePersistentId = newTokenId;
|
|
50019
|
+
}
|
|
50020
|
+
}
|
|
50021
|
+
};
|
|
50022
|
+
exports.replaceOriginReferencePersistentIdByIds = replaceOriginReferencePersistentIdByIds;
|
|
50004
50023
|
|
|
50005
50024
|
|
|
50006
50025
|
/***/ }),
|
|
@@ -51305,17 +51324,13 @@ class SupernovaToolsDesignTokensPlugin {
|
|
|
51305
51324
|
return mapping;
|
|
51306
51325
|
}
|
|
51307
51326
|
setTokensOrigin(map, brand, sources) {
|
|
51308
|
-
var _a;
|
|
51327
|
+
var _a, _b, _c;
|
|
51309
51328
|
const sourceId = (_a = sources.find((s) => s.type === SDKSourceType_1.SourceType.tokenStudio && s.brandId === brand.id)) === null || _a === void 0 ? void 0 : _a.id;
|
|
51310
51329
|
if (!sourceId) {
|
|
51311
51330
|
return map;
|
|
51312
51331
|
}
|
|
51313
51332
|
for (const node of map.processedNodes) {
|
|
51314
|
-
node.token.origin = {
|
|
51315
|
-
name: node.token.name,
|
|
51316
|
-
sourceId,
|
|
51317
|
-
id: node.key,
|
|
51318
|
-
};
|
|
51333
|
+
node.token.origin = Object.assign(Object.assign({ name: node.token.name, sourceId, id: node.key }, (((_b = node.token.origin) === null || _b === void 0 ? void 0 : _b.referenceOriginId) ? { referenceOriginId: node.token.origin.referenceOriginId } : {})), (((_c = node.token.origin) === null || _c === void 0 ? void 0 : _c.referencePersistentId) ? { referencePersistentId: node.token.origin.referencePersistentId } : {}));
|
|
51319
51334
|
}
|
|
51320
51335
|
return map;
|
|
51321
51336
|
}
|
|
@@ -51599,112 +51614,117 @@ class DTJSONConverter {
|
|
|
51599
51614
|
// Retrieve all tokens
|
|
51600
51615
|
return processedNodes;
|
|
51601
51616
|
}
|
|
51617
|
+
remapRootNodeKey(nodePath, tokenType, nodeOriginalType, nodeTokenName) {
|
|
51618
|
+
let path = Array.from(nodePath);
|
|
51619
|
+
let firstSegment = path.splice(0, 1)[0];
|
|
51620
|
+
// Remap remote to proper destination
|
|
51621
|
+
// TODO: maybe we should make firstSegment typed?
|
|
51622
|
+
const type = tokenType;
|
|
51623
|
+
switch (type) {
|
|
51624
|
+
case SDKTokenType_1.TokenType.color:
|
|
51625
|
+
firstSegment = "Color";
|
|
51626
|
+
break;
|
|
51627
|
+
case SDKTokenType_1.TokenType.gradient:
|
|
51628
|
+
firstSegment = "Gradient";
|
|
51629
|
+
break;
|
|
51630
|
+
// TEST: Do we use separate keys for all Dimensions
|
|
51631
|
+
case SDKTokenType_1.TokenType.radius:
|
|
51632
|
+
firstSegment = "Radius";
|
|
51633
|
+
break;
|
|
51634
|
+
case SDKTokenType_1.TokenType.space:
|
|
51635
|
+
case SDKTokenType_1.TokenType.opacity:
|
|
51636
|
+
case SDKTokenType_1.TokenType.fontSize:
|
|
51637
|
+
case SDKTokenType_1.TokenType.lineHeight:
|
|
51638
|
+
case SDKTokenType_1.TokenType.letterSpacing:
|
|
51639
|
+
case SDKTokenType_1.TokenType.paragraphSpacing:
|
|
51640
|
+
case SDKTokenType_1.TokenType.borderWidth:
|
|
51641
|
+
case SDKTokenType_1.TokenType.duration:
|
|
51642
|
+
case SDKTokenType_1.TokenType.zIndex:
|
|
51643
|
+
case SDKTokenType_1.TokenType.size:
|
|
51644
|
+
case SDKTokenType_1.TokenType.dimension:
|
|
51645
|
+
// firstSegment = "Dimension"
|
|
51646
|
+
firstSegment = "Measure";
|
|
51647
|
+
break;
|
|
51648
|
+
case SDKTokenType_1.TokenType.shadow:
|
|
51649
|
+
firstSegment = "Shadow";
|
|
51650
|
+
break;
|
|
51651
|
+
case SDKTokenType_1.TokenType.typography:
|
|
51652
|
+
firstSegment = "Typography";
|
|
51653
|
+
break;
|
|
51654
|
+
// TEST: Should we now use separate segments here or String?
|
|
51655
|
+
case SDKTokenType_1.TokenType.fontFamily:
|
|
51656
|
+
case SDKTokenType_1.TokenType.fontWeight:
|
|
51657
|
+
firstSegment = "Generic";
|
|
51658
|
+
break;
|
|
51659
|
+
case SDKTokenType_1.TokenType.border:
|
|
51660
|
+
firstSegment = "Border";
|
|
51661
|
+
break;
|
|
51662
|
+
case SDKTokenType_1.TokenType.textCase:
|
|
51663
|
+
case SDKTokenType_1.TokenType.textDecoration:
|
|
51664
|
+
case SDKTokenType_1.TokenType.visibility:
|
|
51665
|
+
firstSegment = "Options";
|
|
51666
|
+
break;
|
|
51667
|
+
default:
|
|
51668
|
+
throw new UnreachableCaseError_1.UnreachableCaseError(type, `Unsupported type ${firstSegment} in remapping of nodes`);
|
|
51669
|
+
}
|
|
51670
|
+
let secondSegment;
|
|
51671
|
+
switch (nodeOriginalType) {
|
|
51672
|
+
case "borderRadius":
|
|
51673
|
+
secondSegment = "Border Radius";
|
|
51674
|
+
break;
|
|
51675
|
+
case "borderWidth":
|
|
51676
|
+
secondSegment = "Border Width";
|
|
51677
|
+
break;
|
|
51678
|
+
case "sizing":
|
|
51679
|
+
secondSegment = "Sizing";
|
|
51680
|
+
break;
|
|
51681
|
+
case "fontSizes":
|
|
51682
|
+
secondSegment = "Font Size";
|
|
51683
|
+
break;
|
|
51684
|
+
case "paragraphSpacing":
|
|
51685
|
+
secondSegment = "Paragraph Spacing";
|
|
51686
|
+
break;
|
|
51687
|
+
case "lineHeights":
|
|
51688
|
+
secondSegment = "Line Height";
|
|
51689
|
+
break;
|
|
51690
|
+
case "letterSpacing":
|
|
51691
|
+
secondSegment = "Letter Spacing";
|
|
51692
|
+
break;
|
|
51693
|
+
case "spacing":
|
|
51694
|
+
secondSegment = "Spacing";
|
|
51695
|
+
break;
|
|
51696
|
+
case "opacity":
|
|
51697
|
+
secondSegment = "Opacity";
|
|
51698
|
+
break;
|
|
51699
|
+
case "dimension":
|
|
51700
|
+
secondSegment = "Dimension";
|
|
51701
|
+
break;
|
|
51702
|
+
case 'fontFamilies':
|
|
51703
|
+
secondSegment = 'Font Family';
|
|
51704
|
+
break;
|
|
51705
|
+
case 'fontWeights':
|
|
51706
|
+
secondSegment = 'Font Weight';
|
|
51707
|
+
break;
|
|
51708
|
+
default:
|
|
51709
|
+
// Other types than listed should be ignored
|
|
51710
|
+
break;
|
|
51711
|
+
}
|
|
51712
|
+
// Remap original type and add extra group, if needed
|
|
51713
|
+
if (secondSegment) {
|
|
51714
|
+
path = [firstSegment, secondSegment, ...path];
|
|
51715
|
+
}
|
|
51716
|
+
else {
|
|
51717
|
+
path = [firstSegment, ...path];
|
|
51718
|
+
}
|
|
51719
|
+
// Rebuild key
|
|
51720
|
+
const key = SDKDTTokenMerger_1.DTTokenMerger.buildKey(path, nodeTokenName);
|
|
51721
|
+
return { path, key };
|
|
51722
|
+
}
|
|
51602
51723
|
remapRootNodeKeys(nodes) {
|
|
51603
51724
|
for (const node of nodes) {
|
|
51604
|
-
let path =
|
|
51605
|
-
let firstSegment = path.splice(0, 1)[0];
|
|
51606
|
-
// Remap remote to proper destination
|
|
51607
|
-
// TODO: maybe we should make firstSegment typed?
|
|
51608
|
-
const type = node.token.tokenType;
|
|
51609
|
-
switch (type) {
|
|
51610
|
-
case SDKTokenType_1.TokenType.color:
|
|
51611
|
-
firstSegment = "Color";
|
|
51612
|
-
break;
|
|
51613
|
-
case SDKTokenType_1.TokenType.gradient:
|
|
51614
|
-
firstSegment = "Gradient";
|
|
51615
|
-
break;
|
|
51616
|
-
// TEST: Do we use separate keys for all Dimensions
|
|
51617
|
-
case SDKTokenType_1.TokenType.radius:
|
|
51618
|
-
firstSegment = "Radius";
|
|
51619
|
-
break;
|
|
51620
|
-
case SDKTokenType_1.TokenType.space:
|
|
51621
|
-
case SDKTokenType_1.TokenType.opacity:
|
|
51622
|
-
case SDKTokenType_1.TokenType.fontSize:
|
|
51623
|
-
case SDKTokenType_1.TokenType.lineHeight:
|
|
51624
|
-
case SDKTokenType_1.TokenType.letterSpacing:
|
|
51625
|
-
case SDKTokenType_1.TokenType.paragraphSpacing:
|
|
51626
|
-
case SDKTokenType_1.TokenType.borderWidth:
|
|
51627
|
-
case SDKTokenType_1.TokenType.duration:
|
|
51628
|
-
case SDKTokenType_1.TokenType.zIndex:
|
|
51629
|
-
case SDKTokenType_1.TokenType.size:
|
|
51630
|
-
case SDKTokenType_1.TokenType.dimension:
|
|
51631
|
-
// firstSegment = "Dimension"
|
|
51632
|
-
firstSegment = "Measure";
|
|
51633
|
-
break;
|
|
51634
|
-
case SDKTokenType_1.TokenType.shadow:
|
|
51635
|
-
firstSegment = "Shadow";
|
|
51636
|
-
break;
|
|
51637
|
-
case SDKTokenType_1.TokenType.typography:
|
|
51638
|
-
firstSegment = "Typography";
|
|
51639
|
-
break;
|
|
51640
|
-
// TEST: Should we now use separate segments here or String?
|
|
51641
|
-
case SDKTokenType_1.TokenType.fontFamily:
|
|
51642
|
-
case SDKTokenType_1.TokenType.fontWeight:
|
|
51643
|
-
firstSegment = "Generic";
|
|
51644
|
-
break;
|
|
51645
|
-
case SDKTokenType_1.TokenType.border:
|
|
51646
|
-
firstSegment = "Border";
|
|
51647
|
-
break;
|
|
51648
|
-
case SDKTokenType_1.TokenType.textCase:
|
|
51649
|
-
case SDKTokenType_1.TokenType.textDecoration:
|
|
51650
|
-
case SDKTokenType_1.TokenType.visibility:
|
|
51651
|
-
firstSegment = "Options";
|
|
51652
|
-
break;
|
|
51653
|
-
default:
|
|
51654
|
-
throw new UnreachableCaseError_1.UnreachableCaseError(type, `Unsupported type ${firstSegment} in remapping of nodes`);
|
|
51655
|
-
}
|
|
51656
|
-
let secondSegment;
|
|
51657
|
-
switch (node.originalType) {
|
|
51658
|
-
case "borderRadius":
|
|
51659
|
-
secondSegment = "Border Radius";
|
|
51660
|
-
break;
|
|
51661
|
-
case "borderWidth":
|
|
51662
|
-
secondSegment = "Border Width";
|
|
51663
|
-
break;
|
|
51664
|
-
case "sizing":
|
|
51665
|
-
secondSegment = "Sizing";
|
|
51666
|
-
break;
|
|
51667
|
-
case "fontSizes":
|
|
51668
|
-
secondSegment = "Font Size";
|
|
51669
|
-
break;
|
|
51670
|
-
case "paragraphSpacing":
|
|
51671
|
-
secondSegment = "Paragraph Spacing";
|
|
51672
|
-
break;
|
|
51673
|
-
case "lineHeights":
|
|
51674
|
-
secondSegment = "Line Height";
|
|
51675
|
-
break;
|
|
51676
|
-
case "letterSpacing":
|
|
51677
|
-
secondSegment = "Letter Spacing";
|
|
51678
|
-
break;
|
|
51679
|
-
case "spacing":
|
|
51680
|
-
secondSegment = "Spacing";
|
|
51681
|
-
break;
|
|
51682
|
-
case "opacity":
|
|
51683
|
-
secondSegment = "Opacity";
|
|
51684
|
-
break;
|
|
51685
|
-
case "dimension":
|
|
51686
|
-
secondSegment = "Dimension";
|
|
51687
|
-
break;
|
|
51688
|
-
case 'fontFamilies':
|
|
51689
|
-
secondSegment = 'Font Family';
|
|
51690
|
-
break;
|
|
51691
|
-
case 'fontWeights':
|
|
51692
|
-
secondSegment = 'Font Weight';
|
|
51693
|
-
break;
|
|
51694
|
-
default:
|
|
51695
|
-
// Other types than listed should be ignored
|
|
51696
|
-
break;
|
|
51697
|
-
}
|
|
51698
|
-
// Remap original type and add extra group, if needed
|
|
51699
|
-
if (secondSegment) {
|
|
51700
|
-
path = [firstSegment, secondSegment, ...path];
|
|
51701
|
-
}
|
|
51702
|
-
else {
|
|
51703
|
-
path = [firstSegment, ...path];
|
|
51704
|
-
}
|
|
51725
|
+
let { path, key } = this.remapRootNodeKey(node.path, node.token.tokenType, node.originalType, node.token.name);
|
|
51705
51726
|
node.path = path;
|
|
51706
|
-
|
|
51707
|
-
node.key = SDKDTTokenMerger_1.DTTokenMerger.buildKey(node.path, node.token.name);
|
|
51727
|
+
node.key = key;
|
|
51708
51728
|
}
|
|
51709
51729
|
return nodes;
|
|
51710
51730
|
}
|
|
@@ -51910,6 +51930,7 @@ class DTJSONConverter {
|
|
|
51910
51930
|
}
|
|
51911
51931
|
// TODO: Can we do better or need to copy paste?
|
|
51912
51932
|
convertPureReferencedNode(node, brand) {
|
|
51933
|
+
var _a, _b;
|
|
51913
51934
|
const valueAsReference = node.value;
|
|
51914
51935
|
const resolvedToken = this.referenceResolver.lookupReferencedToken(valueAsReference);
|
|
51915
51936
|
if (resolvedToken) {
|
|
@@ -51932,6 +51953,12 @@ class DTJSONConverter {
|
|
|
51932
51953
|
case SDKTokenType_1.TokenType.duration:
|
|
51933
51954
|
case SDKTokenType_1.TokenType.zIndex:
|
|
51934
51955
|
constructedToken = (0, SDKDimensionToken_1.resolveDimension)(snType).create(snType, this.versionId, brand.id, node.name, node.description, undefined, resolvedToken, [], []);
|
|
51956
|
+
if (resolvedToken && ((_a = constructedToken.origin) === null || _a === void 0 ? void 0 : _a.referencePersistentId)) {
|
|
51957
|
+
const refNode = this.referenceResolver.lookupReferencedNode(valueAsReference);
|
|
51958
|
+
const key = this.remapRootNodeKey(refNode.path, resolvedToken.tokenType, refNode.originalType, resolvedToken.name).key;
|
|
51959
|
+
console.log(`Inlining reference origin id ${valueAsReference}: ${key}: ${(_b = constructedToken.origin) === null || _b === void 0 ? void 0 : _b.referencePersistentId} into ${constructedToken.id}:${node.name}:${node.type}`);
|
|
51960
|
+
constructedToken.origin.referenceOriginId = key;
|
|
51961
|
+
}
|
|
51935
51962
|
break;
|
|
51936
51963
|
case SDKTokenType_1.TokenType.shadow:
|
|
51937
51964
|
constructedToken = SDKShadowToken_1.ShadowToken.create(this.versionId, brand.id, node.name, node.description, undefined, resolvedToken, this.referenceResolver, [], []);
|
|
@@ -52623,6 +52650,8 @@ class DTThemeMerger {
|
|
|
52623
52650
|
const tokensToIterate = [...themeReplica.overriddenTokens, ...[...tokensInThemeButNotInUpstream.values()].map(t => t.token)];
|
|
52624
52651
|
for (const node of tokensToIterate) {
|
|
52625
52652
|
(0, SDKTokenValue_1.replaceReferencedTokenByIds)(node, oldId, newId);
|
|
52653
|
+
(0, SDKTokenValue_1.replaceOriginReferencePersistentIdByIds)(node, oldId, newId);
|
|
52654
|
+
// TODO: Fix inside Typography.fontSize
|
|
52626
52655
|
TokenUtils_1.TokenUtils.replaceIdForComplexTokens(node, oldId, newId);
|
|
52627
52656
|
}
|
|
52628
52657
|
}
|
|
@@ -52869,6 +52898,8 @@ class DTTokenMerger {
|
|
|
52869
52898
|
for (const [oldId, newId] of idsToRemap) {
|
|
52870
52899
|
for (const node of toCreateOrUpdate) {
|
|
52871
52900
|
(0, SDKTokenValue_1.replaceReferencedTokenByIds)(node.token, oldId, newId);
|
|
52901
|
+
(0, SDKTokenValue_1.replaceOriginReferencePersistentIdByIds)(node.token, oldId, newId);
|
|
52902
|
+
// TODO: Fix inside Typography.fontSize
|
|
52872
52903
|
TokenUtils_1.TokenUtils.replaceIdForComplexTokens(node.token, oldId, newId);
|
|
52873
52904
|
}
|
|
52874
52905
|
}
|
|
@@ -53020,6 +53051,16 @@ class DTTokenReferenceResolver {
|
|
|
53020
53051
|
// Find single token reference
|
|
53021
53052
|
return (_a = this.mappedTokens.get(ref)) === null || _a === void 0 ? void 0 : _a[0];
|
|
53022
53053
|
}
|
|
53054
|
+
lookupReferencedNode(reference) {
|
|
53055
|
+
reference = reference.trim();
|
|
53056
|
+
let ref = reference;
|
|
53057
|
+
if (reference.includes('$')) {
|
|
53058
|
+
// Convert $ reference to {}-type of reference as keys are all defined as {}
|
|
53059
|
+
ref = `{${reference.substring(1)}}`;
|
|
53060
|
+
}
|
|
53061
|
+
// Find single token reference
|
|
53062
|
+
return this.nodes.get(ref);
|
|
53063
|
+
}
|
|
53023
53064
|
lookupAllReferencedTokens(reference) {
|
|
53024
53065
|
var _a, _b;
|
|
53025
53066
|
reference = reference.trim();
|