@supernova-studio/supernova-sdk-beta 1.6.14 → 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.
@@ -1,4 +1,4 @@
1
- import { AnyToken, DTProcessedTokenNode, TokenGroup, TokenTheme } from "../exports";
1
+ import { AnyToken, BlurType, BorderPosition, BorderStyle, DTProcessedTokenNode, GradientType, ShadowType, TokenGroup, TokenTheme } from "../exports";
2
2
  import { ElementProperty } from "../model/elements/SDKElementProperty";
3
3
  import { TokenType } from "../model/enums/SDKTokenType";
4
4
  import { BlurToken } from "../model/tokens/SDKBlurToken";
@@ -11,7 +11,7 @@ import { FontFamilyToken, FontWeightToken, ProductCopyToken, StringToken } from
11
11
  import { TextCaseToken } from "../model/tokens/SDKTextCaseToken";
12
12
  import { TextDecorationToken } from "../model/tokens/SDKTextDecorationToken";
13
13
  import { Token } from "../model/tokens/SDKToken";
14
- import { AnyTokenValue } from "../model/tokens/SDKTokenValue";
14
+ import { AnyTokenValue, AnyMultiLayerToken, AnySingleLayerToken, BorderWidthTokenValue, ColorTokenValue, ColorValue, DimensionTokenValue, DurationTokenValue, FontFamilyTokenValue, FontSizeTokenValue, FontWeightTokenValue, LetterSpacingTokenValue, LineHeightTokenValue, OpacityTokenValue, ParagraphSpacingTokenValue, ProductCopyTokenValue, RadiusTokenValue, RawValue, SizeTokenValue, SpaceTokenValue, StringTokenValue, TextCaseTokenValue, TextDecorationTokenValue, VisibilityTokenValue, ZIndexTokenValue } from "../model/tokens/SDKTokenValue";
15
15
  import { TypographyToken } from "../model/tokens/SDKTypographyToken";
16
16
  import { VisibilityToken } from "../model/tokens/SDKVisibilityToken";
17
17
  type TokenMapCompletenessTypeCheck<T extends {
@@ -141,6 +141,141 @@ export declare class TokenUtils {
141
141
  static replaceIdAcrossAllPossibleReferences(override: DTProcessedTokenNode, newId: string, allTokens: Array<DTProcessedTokenNode>): void;
142
142
  static replaceIdAcrossAllPossibleReferencesWithTokens(currentId: string, newId: string, allTokens: Array<Token>): void;
143
143
  static replaceIdForComplexTokens(token: AnyToken, currentId: string, newId: string): void;
144
+ /** Creates a new theme with updated overrides */
145
+ static tokenThemeByUpdatingOverride(theme: TokenTheme, override: AnyToken): TokenTheme;
146
+ /** Creates a new theme with removed override */
147
+ static tokenThemeByRemovingOverride(theme: TokenTheme, tokenId: string): TokenTheme;
148
+ /** Creates a new color token with updated .color value */
149
+ static colorTokenByUpdatingColor(token: ColorToken, newValue: ColorValue | ColorToken): ColorToken;
150
+ /** Creates a new color token with updated .opacity value */
151
+ static colorTokenByUpdatingOpacity(token: ColorToken, newValue: number | OpacityToken): ColorToken;
152
+ /** Creates a new blur token with updated .type value */
153
+ static blurTokenByUpdatingType(token: BlurToken, newValue: BlurType): BlurToken;
154
+ /** Creates a new blur token with updated .radius value */
155
+ static blurTokenByUpdatingRadius(token: BlurToken, newValue: RawValue<DimensionTokenValue> | RadiusToken): BlurToken;
156
+ /** Creates a new typography token with updated .fontFamily value */
157
+ static typographyTokenByUpdatingFontFamily(token: TypographyToken, newValue: RawValue<FontFamilyTokenValue> | FontFamilyToken): TypographyToken;
158
+ /** Creates a new typography token with updated .fontWeight value */
159
+ static typographyTokenByUpdatingFontWeight(token: TypographyToken, newValue: RawValue<FontWeightTokenValue> | FontWeightToken): TypographyToken;
160
+ /** Creates a new typography token with updated .fontSize value */
161
+ static typographyTokenByUpdatingFontSize(token: TypographyToken, newValue: RawValue<FontSizeTokenValue> | FontSizeToken): TypographyToken;
162
+ /** Creates a new typography token with updated .letterSpacing value */
163
+ static typographyTokenByUpdatingLetterSpacing(token: TypographyToken, newValue: RawValue<LetterSpacingTokenValue> | LetterSpacingToken): TypographyToken;
164
+ /** Creates a new typography token with updated .lineHeight value */
165
+ static typographyTokenByUpdatingLineHeight(token: TypographyToken, newValue: RawValue<LineHeightTokenValue> | LineHeightToken): TypographyToken;
166
+ /** Creates a new typography token with updated .paragraphSpacing value */
167
+ static typographyTokenByUpdatingParagraphSpacing(token: TypographyToken, newValue: RawValue<ParagraphSpacingTokenValue> | ParagraphSpacingToken): TypographyToken;
168
+ /** Creates a new typography token with updated .paragraphSpacing value */
169
+ static typographyTokenByUpdatingParagraphIndent(token: TypographyToken, newValue: RawValue<ParagraphSpacingTokenValue> | ParagraphSpacingToken): TypographyToken;
170
+ /** Creates a new typography token with updated .textCase value */
171
+ static typographyTokenByUpdatingTextCase(token: TypographyToken, newValue: RawValue<TextCaseTokenValue> | TextCaseToken): TypographyToken;
172
+ /** Creates a new border token with updated .position value */
173
+ static typographyTokenByUpdatingTextDecoration(token: TypographyToken, newValue: RawValue<TextDecorationTokenValue> | TextDecorationToken): TypographyToken;
174
+ /** Creates a new border token with updated .color value. Do note, opacity is ignored */
175
+ static borderTokenByUpdatingColor(token: BorderToken, newValue: ColorValue | ColorToken): BorderToken;
176
+ /** Creates a new border token with updated color.opacity value */
177
+ static borderTokenByUpdatingOpacity(token: BorderToken, newValue: number | OpacityToken): BorderToken;
178
+ /** Creates a new border token with updated .width value */
179
+ static borderTokenByUpdatingWidth(token: BorderToken, newValue: RawValue<BorderWidthTokenValue> | BorderWidthToken): BorderToken;
180
+ /** Creates a new border token with updated .position value */
181
+ static borderTokenByUpdatingPosition(token: BorderToken, newValue: BorderPosition): BorderToken;
182
+ /** Creates a new border token with updated .style value */
183
+ static borderTokenByUpdatingStyle(token: BorderToken, newValue: BorderStyle): BorderToken;
184
+ /** Creates a new dimension token with updated value */
185
+ static dimensionTokenByUpdatingValue(token: DimensionToken, newValue: RawValue<DimensionTokenValue>): DimensionToken;
186
+ /** Creates a new size token with updated value */
187
+ static sizeTokenByUpdatingValue(token: SizeToken, newValue: RawValue<SizeTokenValue>): SizeToken;
188
+ /** Creates a new space token with updated value */
189
+ static spaceTokenByUpdatingValue(token: SpaceToken, newValue: RawValue<SpaceTokenValue>): SpaceToken;
190
+ /** Creates a new opacity token with updated value */
191
+ static opacityTokenByUpdatingValue(token: OpacityToken, newValue: RawValue<OpacityTokenValue>): OpacityToken;
192
+ /** Creates a new font size token with updated value */
193
+ static fontSizeTokenByUpdatingValue(token: FontSizeToken, newValue: RawValue<FontSizeTokenValue>): FontSizeToken;
194
+ /** Creates a new font size token with updated value */
195
+ static lineHeightTokenByUpdatingValue(token: LineHeightToken, newValue: RawValue<LineHeightTokenValue>): LineHeightToken;
196
+ /** Creates a new letter spacing token with updated value */
197
+ static letterSpacingTokenByUpdatingValue(token: LetterSpacingToken, newValue: RawValue<LetterSpacingTokenValue>): LetterSpacingToken;
198
+ /** Creates a new paragraph spacing token with updated value */
199
+ static paragraphSpacingTokenByUpdatingValue(token: ParagraphSpacingToken, newValue: RawValue<ParagraphSpacingTokenValue>): ParagraphSpacingToken;
200
+ /** Creates a new border width token with updated value */
201
+ static borderWidthTokenByUpdatingValue(token: BorderWidthToken, newValue: RawValue<BorderWidthTokenValue>): BorderWidthToken;
202
+ /** Creates a new radius token with updated value */
203
+ static radiusTokenByUpdatingValue(token: RadiusToken, newValue: RawValue<RadiusTokenValue>): RadiusToken;
204
+ /** Creates a new duration token with updated value */
205
+ static durationTokenByUpdatingValue(token: DurationToken, newValue: RawValue<DurationTokenValue>): DurationToken;
206
+ /** Creates a new z-index token with updated value */
207
+ static zIndexTokenByUpdatingValue(token: ZIndexToken, newValue: RawValue<ZIndexTokenValue>): ZIndexToken;
208
+ /** Creates a new string token with updated value */
209
+ static stringTokenByUpdatingValue(token: StringToken, newValue: RawValue<StringTokenValue>): StringToken;
210
+ /** Creates a new product copy token with updated value */
211
+ static productCopyTokenByUpdatingValue(token: ProductCopyToken, newValue: RawValue<ProductCopyTokenValue>): ProductCopyToken;
212
+ /** Creates a new font family token with updated value */
213
+ static fontFamilyTokenByUpdatingValue(token: FontFamilyToken, newValue: RawValue<FontFamilyTokenValue>): FontFamilyToken;
214
+ /** Creates a new font weight token with updated value */
215
+ static fontWeightTokenByUpdatingValue(token: FontWeightToken, newValue: RawValue<FontWeightTokenValue>): FontWeightToken;
216
+ /** Creates a new text case token with updated value */
217
+ static textCaseTokenByUpdatingValue(token: TextCaseToken, newValue: RawValue<TextCaseTokenValue>): TextCaseToken;
218
+ /** Creates a new text case token with updated value */
219
+ static textDecorationTokenByUpdatingValue(token: TextDecorationToken, newValue: RawValue<TextDecorationTokenValue>): TextDecorationToken;
220
+ /** Creates a new visibility token with updated value */
221
+ static visibilityTokenByUpdatingValue(token: VisibilityToken, newValue: RawValue<VisibilityTokenValue>): VisibilityToken;
222
+ /** Creates a new shadow token with one new extra layer added at the end of all layers */
223
+ static shadowTokenByAddingLayer(token: ShadowToken): ShadowToken;
224
+ /** Creates a new shadow token by removing one of the layers */
225
+ static shadowTokenByRemovingLayer(token: ShadowToken, layerIndex: number): ShadowToken;
226
+ /** Creates a new shadow token with updated .color value. Do note, opacity is ignored */
227
+ static shadowTokenByUpdatingColor(token: ShadowToken, layerIndex: number, newValue: ColorValue | ColorToken): ShadowToken;
228
+ /** Creates a new shadow token with updated .color value */
229
+ static shadowTokenByUpdatingOpacity(token: ShadowToken, layerIndex: number, newValue: number | OpacityToken): ShadowToken;
230
+ /** Creates a new shadow token with updated .x value */
231
+ static shadowTokenByUpdatingX(token: ShadowToken, layerIndex: number, newValue: number): ShadowToken;
232
+ /** Creates a new shadow token with updated .y value */
233
+ static shadowTokenByUpdatingY(token: ShadowToken, layerIndex: number, newValue: number): ShadowToken;
234
+ /** Creates a new shadow token with updated .radius value */
235
+ static shadowTokenByUpdatingRadius(token: ShadowToken, layerIndex: number, newValue: number): ShadowToken;
236
+ /** Creates a new shadow token with updated .spread value */
237
+ static shadowTokenByUpdatingSpread(token: ShadowToken, layerIndex: number, newValue: number): ShadowToken;
238
+ /** Creates a new shadow token with updated .type value */
239
+ static shadowTokenByUpdatingType(token: ShadowToken, layerIndex: number, newValue: ShadowType): ShadowToken;
240
+ /** Creates a new gradient token with updated .to value */
241
+ static gradientTokenByUpdatingTo(token: GradientToken, layerIndex: number, newValue: {
242
+ x: number;
243
+ y: number;
244
+ }): GradientToken;
245
+ /** Creates a new gradient token with updated .from value */
246
+ static gradientTokenByUpdatingFrom(token: GradientToken, layerIndex: number, newValue: {
247
+ x: number;
248
+ y: number;
249
+ }): GradientToken;
250
+ /** Creates a new gradient token with updated .to value */
251
+ static gradientTokenByUpdatingType(token: GradientToken, layerIndex: number, newValue: GradientType): GradientToken;
252
+ /** Creates a new gradient token with updated .aspectRatio value */
253
+ static gradientTokenByUpdatingAspectRatio(token: GradientToken, layerIndex: number, newValue: number): GradientToken;
254
+ /** Creates a new gradient token with updated .to value */
255
+ static gradientTokenByUpdatingStops(token: GradientToken, layerIndex: number, newValue: Array<{
256
+ position: number;
257
+ color: ColorTokenValue | ColorToken;
258
+ }>): GradientToken;
259
+ /** Creates a new token where value is reference to the provided token. Token and reference must be of the same type */
260
+ static tokenByReferencing<T extends AnyToken>(token: T, reference: T): T;
261
+ /** Creates a new multilayer token where one of the layers is reference to the provided token. Token and reference must be of the same type */
262
+ static multilayerTokenByReferencing<T extends AnyMultiLayerToken>(token: T, layerIndex: number, reference: T): T;
263
+ /** Creates a new token where value is raw, but taken from the previously referenced token. Token must have had reference before */
264
+ static tokenByDisconnectingReference<T extends AnySingleLayerToken>(token: T, options?: {
265
+ supressErrorOnNoReference?: boolean;
266
+ }): T;
267
+ /** Creates a new multilayer token where one of the layers value is raw, but taken from the previously referenced token. That layer must have had reference before */
268
+ static multilayerTokenByDisconnectingReference<T extends AnySingleLayerToken>(token: T, layerIndex: number): T;
269
+ /** Checks if token as a whole is a reference to another token */
270
+ static isReferencedToken(token: AnySingleLayerToken): boolean;
271
+ /** Checks if a token layer of multilayer token is a reference to another token */
272
+ static isReferencedMultilayerTokenLayer(token: AnyMultiLayerToken, layerIndex: number): boolean;
273
+ /** Checks if a token was imported from some foreign source. Not imported tokens were always created in Supernova */
274
+ static isTokenImported(token: AnyToken): boolean;
275
+ private static checkNotReference;
276
+ private static rawOrReferencedDimensionValue;
277
+ private static rawOrReferencedStringValue;
278
+ private static validateLayerAccess;
144
279
  static inlineValueIntoComplexTokens(token: AnyToken, candidateId: string, candidateValueToInline: AnyTokenValue): void;
145
280
  static getRefIdsFromComplexTokens(token: AnyToken): string[];
146
281
  static buildKey(path: Array<string>, name: string): string;