@design-sync/w3c-dtfm
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -169,5 +169,3 @@ import * as culori_fn from 'culori/fn'; | ||
declare function hasModesExtension(value: unknown): value is WithExtension<ModesExtension>; | ||
declare function isCompositeToken(token: DesignToken): token is TokenDefinition<'border'> | TokenDefinition<'shadow'> | TokenDefinition<'transition'> | TokenDefinition<'gradient'> | TokenDefinition<'typography'>; | ||
declare const TOKEN_ALIAS_REGEX: RegExp; | ||
declare const EXACT_TOKEN_ALIAS_REGEX: RegExp; | ||
declare function isCompositeToken(token: DesignToken): token is TokenDefinition<'border'> | TokenDefinition<'shadow'> | TokenDefinition<'transition'> | TokenDefinition<'gradient'> | TokenDefinition<'typography'> | TokenDefinition<'strokeStyle'>; | ||
declare function hasTokenAlias(value: unknown): value is TokenAlias; | ||
@@ -246,2 +244,3 @@ declare function isTokenAlias(value: unknown): value is TokenAlias; | ||
defaultMode?: string; | ||
filter?: TokensWalkerFilter; | ||
} | ||
@@ -252,3 +251,2 @@ declare class TokensWalker { | ||
private _rootKey; | ||
private _processed; | ||
private options; | ||
@@ -317,10 +315,12 @@ private tokens; | ||
type PathMatcher = string | RegExp; | ||
interface TokensWalkerExtensionFilterObj { | ||
interface TokenFilterObj { | ||
type?: TokenType | TokenType[]; | ||
path?: PathMatcher | PathMatcher[]; | ||
} | ||
type TokensWalkerExtensionFilter = '*' | string | TokensWalkerExtensionFilterObj | ((token: ProcessedDesignToken) => boolean) | RegExp | TokenType; | ||
type TokensFilterParams = [string, TokenDefinition<any, any>]; | ||
type TokensFilter = '*' | string | TokenFilterObj | ((params: TokensFilterParams) => boolean) | RegExp | TokenType; | ||
type TokensWalkerFilter = TokensFilter | TokensFilter[]; | ||
interface TokensWalkerExtension { | ||
name: string; | ||
filter: TokensWalkerExtensionFilter | TokensWalkerExtensionFilter[]; | ||
filter: TokensWalkerFilter; | ||
run(token: ProcessedDesignToken, walker: TokensWalker): TokensWalkerExtensionAction[]; | ||
@@ -367,4 +367,5 @@ } | ||
declare function getModeRawValue(valueByMode: DesignTokenValueByMode, mode: string): unknown; | ||
declare function isMatchTokenExtensionFilter(token: ProcessedDesignToken, target?: TokensWalkerExtension['filter']): boolean; | ||
declare function isMatchingTokensFilter(params: TokensFilterParams, filter?: TokensWalkerFilter): boolean; | ||
declare function isSupportedTypeFilter(params: TokensFilterParams): boolean; | ||
export { type Border, type Color, type ColorModifier, type ColorModifiersExtensionOptions, type ColorTokenModifier, type ColorTokenModifiersExtension, type CubicBezier, DEFAULT_MODE, type DerefToken, type DesignToken, type DesignTokenDefinition, type DesignTokenValueByMode, type DesignTokenValueRecord, type DesignTokens, type Dimension, type Duration, EXACT_TOKEN_ALIAS_REGEX, type FontFamily, type FontWeight, type FontWeightName, type Gradient, type GradientStop, type ModeExtension, type ModesExtension, type Number, type PathMatcher, type ProcessedDesignToken, type ReplaceTofK, type RequiredKeys, type ResponsiveExtensionOptions, type Shadow, type StrokeStyle, type StrokeStyleName, type StrokeStyleObject, TOKEN_ALIAS_REGEX, type TokenAlias, type TokenDefinition, type TokenGenerator, type TokenGeneratorsExtension, type TokenGroupDefinition, type TokenGroupItemDefinition, type TokenIterator, type TokenType, type TokenValue, type Tokens, TokensWalker, type TokensWalkerExtension, type TokensWalkerExtensionAction, type TokensWalkerExtensionBaseAction, type TokensWalkerExtensionFilter, type TokensWalkerExtensionFilterObj, type Transition, type Typography, type WithExtension, applyColorModifier, applyColorModifiers, borderToCssStyle, borderToCssValue, colorGeneratorsExtension, colorModifiersExtension, colorToCssValue, contrastColor, correctJSObjectKey, cubicBezierToCssValue, darkenColor, desaturateColor, fontFamilyToCssValue, fontWeightToCssValue, formatColor, getModeNormalizeValue, getModeRawValue, gradientToCssValue, grayscaleColor, hasColorTokenModifiersExtension, hasGeneratorsExtension, hasModeExtension, hasModesExtension, hasTokenAlias, hasTokenExtensions, hueRotateColor, invertColor, isBorderToken, isColorToken, isCompositeToken, isCubicBezierToken, isDesignToken, isDesignTokenGroup, isDesignTokenLike, isDesignTokenValueRecord, isDimensionToken, isDurationToken, isFontFamilyToken, isFontWeightToken, isGradientToken, isMatchTokenExtensionFilter, isNumberToken, isObject, isOtherToken, isShadowToken, isString, isStrokeStyleToken, isTokenAlias, isTransitionToken, isTypographyToken, lightenColor, normalizeBorderValue, normalizeColorValue, normalizeCubicBezierValue, normalizeDimensionValue, normalizeDurationValue, normalizeFontFamilyValue, normalizeFontWeightValue, normalizeGradientValue, normalizeShadowValue, normalizeStrokeStyleValue, normalizeTokenAlias, normalizeTransitionValue, normalizeTypographyValue, opacifyColor, parseColor, parseModifierValue, processCSSKey, processCssVarRef, processJSKey, processJSValue, processPrimitiveValue, responsiveExtension, saturateColor, sepiaColor, serializeObject, serializeObjectToCSS, shadowToCssValue, strokeStyleToCssValue, tokenAliasToCssVarName, tokenToCss, tokenValueToCss, tokenValueToCssValue, transitionToCssStyle, transitionToCssValue, typographyToCssStyle, typographyToCssValue }; | ||
export { type Border, type Color, type ColorModifier, type ColorModifiersExtensionOptions, type ColorTokenModifier, type ColorTokenModifiersExtension, type CubicBezier, DEFAULT_MODE, type DerefToken, type DesignToken, type DesignTokenDefinition, type DesignTokenValueByMode, type DesignTokenValueRecord, type DesignTokens, type Dimension, type Duration, type FontFamily, type FontWeight, type FontWeightName, type Gradient, type GradientStop, type ModeExtension, type ModesExtension, type Number, type PathMatcher, type ProcessedDesignToken, type ReplaceTofK, type RequiredKeys, type ResponsiveExtensionOptions, type Shadow, type StrokeStyle, type StrokeStyleName, type StrokeStyleObject, type TokenAlias, type TokenDefinition, type TokenFilterObj, type TokenGenerator, type TokenGeneratorsExtension, type TokenGroupDefinition, type TokenGroupItemDefinition, type TokenIterator, type TokenType, type TokenValue, type Tokens, type TokensFilter, type TokensFilterParams, TokensWalker, type TokensWalkerExtension, type TokensWalkerExtensionAction, type TokensWalkerExtensionBaseAction, type TokensWalkerFilter, type Transition, type Typography, type WithExtension, applyColorModifier, applyColorModifiers, borderToCssStyle, borderToCssValue, colorGeneratorsExtension, colorModifiersExtension, colorToCssValue, contrastColor, correctJSObjectKey, cubicBezierToCssValue, darkenColor, desaturateColor, fontFamilyToCssValue, fontWeightToCssValue, formatColor, getModeNormalizeValue, getModeRawValue, gradientToCssValue, grayscaleColor, hasColorTokenModifiersExtension, hasGeneratorsExtension, hasModeExtension, hasModesExtension, hasTokenAlias, hasTokenExtensions, hueRotateColor, invertColor, isBorderToken, isColorToken, isCompositeToken, isCubicBezierToken, isDesignToken, isDesignTokenGroup, isDesignTokenLike, isDesignTokenValueRecord, isDimensionToken, isDurationToken, isFontFamilyToken, isFontWeightToken, isGradientToken, isMatchingTokensFilter, isNumberToken, isObject, isOtherToken, isShadowToken, isString, isStrokeStyleToken, isSupportedTypeFilter, isTokenAlias, isTransitionToken, isTypographyToken, lightenColor, normalizeBorderValue, normalizeColorValue, normalizeCubicBezierValue, normalizeDimensionValue, normalizeDurationValue, normalizeFontFamilyValue, normalizeFontWeightValue, normalizeGradientValue, normalizeShadowValue, normalizeStrokeStyleValue, normalizeTokenAlias, normalizeTransitionValue, normalizeTypographyValue, opacifyColor, parseColor, parseModifierValue, processCSSKey, processCssVarRef, processJSKey, processJSValue, processPrimitiveValue, responsiveExtension, saturateColor, sepiaColor, serializeObject, serializeObjectToCSS, shadowToCssValue, strokeStyleToCssValue, tokenAliasToCssVarName, tokenToCss, tokenValueToCss, tokenValueToCssValue, transitionToCssStyle, transitionToCssValue, typographyToCssStyle, typographyToCssValue }; |
{ | ||
"name": "@design-sync/w3c-dtfm", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Design tokens module format (DTFM) utils and types", | ||
@@ -5,0 +5,0 @@ "repository": "salamaashoush/design-sync", |
@@ -31,9 +31,22 @@ # @design-sync/w3c-dtfm | ||
```js | ||
// ESM | ||
import {} from "@design-sync/w3c-dtfm"; | ||
import { TokensWalker } from "@design-sync/w3c-dtfm"; | ||
// CommonJS | ||
const {} = require("@design-sync/w3c-dtfm"); | ||
const tokens = { | ||
"color": { | ||
"primary": { | ||
"$value": "#000000", | ||
"$type": "color" | ||
} | ||
} | ||
... // rest of tokens | ||
}; | ||
const walker = new TokensWalker(tokens); | ||
walker.walk((token) => { | ||
// do something with token | ||
console.log(token); | ||
}); | ||
``` | ||
## Development | ||
@@ -40,0 +53,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
154292
2904
75