@terrazzo/token-tools 2.0.0-beta.2 → 2.0.0-beta.4
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.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -33,8 +33,8 @@ declare const GRADIENT_REQUIRED_STOP_PROPERTIES: readonly ["color", "position"];
|
|
|
33
33
|
//#region src/id.d.ts
|
|
34
34
|
/** Is this token an alias of another? */
|
|
35
35
|
declare function isAlias(value: string): boolean;
|
|
36
|
-
/**
|
|
37
|
-
declare function
|
|
36
|
+
/** Create a token matcher function using . separated glob patterns */
|
|
37
|
+
declare function getTokenMatcher(globPatterns: string | string[]): (tokenId: string) => boolean;
|
|
38
38
|
/** Make an alias */
|
|
39
39
|
declare function makeAlias(input: string): string;
|
|
40
40
|
/** Parse an alias */
|
|
@@ -77,5 +77,5 @@ declare const TRANSITION_REQUIRED_PROPERTIES: readonly ["duration", "delay", "ti
|
|
|
77
77
|
//#region src/typography.d.ts
|
|
78
78
|
declare const TYPOGRAPHY_REQUIRED_PROPERTIES: readonly ["fontFamily", "fontSize", "fontWeight", "letterSpacing", "lineHeight"];
|
|
79
79
|
//#endregion
|
|
80
|
-
export { AliasToken, AliasValue, BORDER_REQUIRED_PROPERTIES, BooleanToken, BooleanTokenNormalized, BooleanValue, BorderToken, BorderTokenNormalized, BorderValue, BorderValueNormalized, COLOR_SPACE, ColorSpace, ColorToken, ColorTokenNormalized, ColorValue, ColorValueNormalized, CubicBezierToken, CubicBezierTokenNormalized, CubicBezierValue, CustomTransformOptions, DimensionToken, DimensionTokenNormalized, DimensionValue, DurationToken, DurationTokenNormalized, DurationValue, FONT_WEIGHTS, FontFamilyToken, FontFamilyTokenNormalized, FontFamilyValue, FontFamilyValueNormalized, FontWeightToken, FontWeightTokenNormalized, FontWeightValue, FontWeightValueNormalized, GRADIENT_REQUIRED_STOP_PROPERTIES, GradientStop, GradientStopNormalized, GradientToken, GradientTokenNormalized, GradientValue, GradientValueNormalized, Group, GroupCore, GroupNormalized, GroupOrToken, LinkToken, LinkTokenNormalized, LinkValue, ModeMap, NumberToken, NumberTokenNormalized, NumberValue, SHADOW_REQUIRED_PROPERTIES, STROKE_STYLE_LINE_CAP_VALUES, STROKE_STYLE_OBJECT_REQUIRED_PROPERTIES, STROKE_STYLE_STRING_VALUES, ShadowToken, ShadowTokenNormalized, ShadowValue, ShadowValueNormalized, StringToken, StringTokenNormalized, StringValue, StrokeStyleToken, StrokeStyleTokenNormalized, StrokeStyleValue, StrokeStyleValueExpanded, TRANSITION_REQUIRED_PROPERTIES, TYPOGRAPHY_REQUIRED_PROPERTIES, Token, TokenCore, TokenMode, TokenNormalized, TokenNormalizedCore, TokenNormalizedSet, TokenTransformed, TokenTransformedBase, TokenTransformedMultiValue, TokenTransformedSingleValue, TokensSet, TransitionToken, TransitionTokenNormalized, TransitionValue, TransitionValueNormalized, TypographyToken, TypographyTokenNormalized, TypographyValue, TypographyValueNormalized,
|
|
80
|
+
export { AliasToken, AliasValue, BORDER_REQUIRED_PROPERTIES, BooleanToken, BooleanTokenNormalized, BooleanValue, BorderToken, BorderTokenNormalized, BorderValue, BorderValueNormalized, COLOR_SPACE, ColorSpace, ColorToken, ColorTokenNormalized, ColorValue, ColorValueNormalized, CubicBezierToken, CubicBezierTokenNormalized, CubicBezierValue, CustomTransformOptions, DimensionToken, DimensionTokenNormalized, DimensionValue, DurationToken, DurationTokenNormalized, DurationValue, FONT_WEIGHTS, FontFamilyToken, FontFamilyTokenNormalized, FontFamilyValue, FontFamilyValueNormalized, FontWeightToken, FontWeightTokenNormalized, FontWeightValue, FontWeightValueNormalized, GRADIENT_REQUIRED_STOP_PROPERTIES, GradientStop, GradientStopNormalized, GradientToken, GradientTokenNormalized, GradientValue, GradientValueNormalized, Group, GroupCore, GroupNormalized, GroupOrToken, LinkToken, LinkTokenNormalized, LinkValue, ModeMap, NumberToken, NumberTokenNormalized, NumberValue, SHADOW_REQUIRED_PROPERTIES, STROKE_STYLE_LINE_CAP_VALUES, STROKE_STYLE_OBJECT_REQUIRED_PROPERTIES, STROKE_STYLE_STRING_VALUES, ShadowToken, ShadowTokenNormalized, ShadowValue, ShadowValueNormalized, StringToken, StringTokenNormalized, StringValue, StrokeStyleToken, StrokeStyleTokenNormalized, StrokeStyleValue, StrokeStyleValueExpanded, TRANSITION_REQUIRED_PROPERTIES, TYPOGRAPHY_REQUIRED_PROPERTIES, Token, TokenCore, TokenMode, TokenNormalized, TokenNormalizedCore, TokenNormalizedSet, TokenTransformed, TokenTransformedBase, TokenTransformedMultiValue, TokenTransformedSingleValue, TokensSet, TransitionToken, TransitionTokenNormalized, TransitionValue, TransitionValueNormalized, TypographyToken, TypographyTokenNormalized, TypographyValue, TypographyValueNormalized, getTokenMatcher, isAlias, kebabCase, makeAlias, padStr, parseAlias, parseColor, pluralize, splitID, tokenToColor, validateCustomTransform };
|
|
81
81
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/border.ts","../src/font-weight.ts","../src/gradient.ts","../src/id.ts","../src/shadow.ts","../src/string.ts","../src/stroke-style.ts","../src/transform.ts","../src/transition.ts","../src/typography.ts"],"mappings":";;;;cAAa,0BAAA;;;;cCCA,YAAA;;;;;;;;;;;;;;;;;;;;;;cCDA,iCAAA;;;;iBCKG,OAAA,CAAQ,KAAA;;iBAKR,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/border.ts","../src/font-weight.ts","../src/gradient.ts","../src/id.ts","../src/shadow.ts","../src/string.ts","../src/stroke-style.ts","../src/transform.ts","../src/transition.ts","../src/typography.ts"],"mappings":";;;;cAAa,0BAAA;;;;cCCA,YAAA;;;;;;;;;;;;;;;;;;;;;;cCDA,iCAAA;;;;iBCKG,OAAA,CAAQ,KAAA;;iBAKR,eAAA,CAAgB,YAAA,uBAAmC,OAAA;AHVnE;AAAA,iBGegB,SAAA,CAAU,KAAA;;iBAKV,UAAA,CAAW,KAAA;;iBAeX,OAAA,CAAQ,EAAA;EAAe,KAAA;EAAe,KAAA;AAAA;;;cCnCzC,0BAAA;;;;iBCCG,MAAA,CAAO,KAAA,UAAe,MAAA,UAAgB,SAAA;;iBAuBtC,SAAA,YAAA,CAAsB,KAAA,UAAe,QAAA,EAAU,CAAA,EAAG,MAAA,EAAQ,CAAA,GAAI,CAAA;ALxB9E;AAAA,iBK6BgB,SAAA,CAAU,GAAA;;;cC7Bb,0BAAA;AAAA,cAWA,uCAAA;AAAA,cAEA,4BAAA;;;UCbI,sBAAA;;EAEf,KAAA;AAAA;APFF;AAAA,iBOMgB,uBAAA,CAAwB,KAAA;EAAkB;AAAA,GAAS,sBAAA;;;cCNtD,8BAAA;;;cCAA,8BAAA"}
|
package/dist/index.js
CHANGED
|
@@ -43,9 +43,9 @@ const ALIAS_RE = /^\{([^}]+)\}$/;
|
|
|
43
43
|
function isAlias(value) {
|
|
44
44
|
return ALIAS_RE.test(value);
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
47
|
-
function
|
|
48
|
-
|
|
46
|
+
/** Create a token matcher function using . separated glob patterns */
|
|
47
|
+
function getTokenMatcher(globPatterns) {
|
|
48
|
+
return wcmatch(globPatterns, ".");
|
|
49
49
|
}
|
|
50
50
|
/** Make an alias */
|
|
51
51
|
function makeAlias(input) {
|
|
@@ -130,5 +130,5 @@ const TYPOGRAPHY_REQUIRED_PROPERTIES = [
|
|
|
130
130
|
];
|
|
131
131
|
|
|
132
132
|
//#endregion
|
|
133
|
-
export { BORDER_REQUIRED_PROPERTIES, COLOR_SPACE, FONT_WEIGHTS, GRADIENT_REQUIRED_STOP_PROPERTIES, SHADOW_REQUIRED_PROPERTIES, STROKE_STYLE_LINE_CAP_VALUES, STROKE_STYLE_OBJECT_REQUIRED_PROPERTIES, STROKE_STYLE_STRING_VALUES, TRANSITION_REQUIRED_PROPERTIES, TYPOGRAPHY_REQUIRED_PROPERTIES,
|
|
133
|
+
export { BORDER_REQUIRED_PROPERTIES, COLOR_SPACE, FONT_WEIGHTS, GRADIENT_REQUIRED_STOP_PROPERTIES, SHADOW_REQUIRED_PROPERTIES, STROKE_STYLE_LINE_CAP_VALUES, STROKE_STYLE_OBJECT_REQUIRED_PROPERTIES, STROKE_STYLE_STRING_VALUES, TRANSITION_REQUIRED_PROPERTIES, TYPOGRAPHY_REQUIRED_PROPERTIES, getTokenMatcher, isAlias, kebabCase, makeAlias, padStr, parseAlias, parseColor, pluralize, splitID, tokenToColor, validateCustomTransform };
|
|
134
134
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/border.ts","../src/font-weight.ts","../src/gradient.ts","../src/id.ts","../src/shadow.ts","../src/stroke-style.ts","../src/transform.ts","../src/transition.ts","../src/typography.ts"],"sourcesContent":["export const BORDER_REQUIRED_PROPERTIES = ['color', 'width', 'style'] as const;\n","/** Mapping of valid names to numeric weights */\nexport const FONT_WEIGHTS = {\n thin: 100,\n hairline: 100,\n\n 'extra-light': 200,\n 'ultra-light': 200,\n\n light: 300,\n\n normal: 400,\n regular: 400,\n book: 400,\n\n medium: 500,\n\n 'semi-bold': 600,\n 'demi-bold': 600,\n\n bold: 700,\n\n 'extra-bold': 800,\n 'ultra-bold': 800,\n\n black: 900,\n heavy: 900,\n\n 'extra-black': 950,\n 'ultra-black': 950,\n};\n","export const GRADIENT_REQUIRED_STOP_PROPERTIES = ['color', 'position'] as const;\n","import wcmatch from 'wildcard-match';\n\nconst ALIAS_RE = /^\\{([^}]+)\\}$/;\n\n/** Is this token an alias of another? */\nexport function isAlias(value: string): boolean {\n return ALIAS_RE.test(value);\n}\n\n/**
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/border.ts","../src/font-weight.ts","../src/gradient.ts","../src/id.ts","../src/shadow.ts","../src/stroke-style.ts","../src/transform.ts","../src/transition.ts","../src/typography.ts"],"sourcesContent":["export const BORDER_REQUIRED_PROPERTIES = ['color', 'width', 'style'] as const;\n","/** Mapping of valid names to numeric weights */\nexport const FONT_WEIGHTS = {\n thin: 100,\n hairline: 100,\n\n 'extra-light': 200,\n 'ultra-light': 200,\n\n light: 300,\n\n normal: 400,\n regular: 400,\n book: 400,\n\n medium: 500,\n\n 'semi-bold': 600,\n 'demi-bold': 600,\n\n bold: 700,\n\n 'extra-bold': 800,\n 'ultra-bold': 800,\n\n black: 900,\n heavy: 900,\n\n 'extra-black': 950,\n 'ultra-black': 950,\n};\n","export const GRADIENT_REQUIRED_STOP_PROPERTIES = ['color', 'position'] as const;\n","import wcmatch from 'wildcard-match';\n\nconst ALIAS_RE = /^\\{([^}]+)\\}$/;\n\n/** Is this token an alias of another? */\nexport function isAlias(value: string): boolean {\n return ALIAS_RE.test(value);\n}\n\n/** Create a token matcher function using . separated glob patterns */\nexport function getTokenMatcher(globPatterns: string | string[]): (tokenId: string) => boolean {\n return wcmatch(globPatterns, '.');\n}\n\n/** Make an alias */\nexport function makeAlias(input: string): string {\n return input.replace(/^\\{?([^}]+)\\}?$/, '{$1}');\n}\n\n/** Parse an alias */\nexport function parseAlias(input: string): string {\n // TODO: deprecate in future\n if (input.includes('#')) {\n throw new Error(\n 'Mode aliases (# character) are no longer supported as of v0.6.0. Alias the root token instead, and apply modes in plugins.',\n );\n }\n const match = input.match(ALIAS_RE);\n if (!match) {\n return input;\n }\n return match[1] ?? match[0];\n}\n\n/** split a token ID into a local ID and group ID */\nexport function splitID(id: string): { local: string; group?: string } {\n const lastSeparatorI = id.lastIndexOf('.');\n if (lastSeparatorI === -1) {\n return { local: id };\n }\n return {\n local: id.substring(lastSeparatorI + 1),\n group: id.substring(0, lastSeparatorI),\n };\n}\n","export const SHADOW_REQUIRED_PROPERTIES = ['color', 'offsetX', 'offsetY', 'blur', 'spread'] as const;\n","export const STROKE_STYLE_STRING_VALUES = [\n 'solid',\n 'dashed',\n 'dotted',\n 'double',\n 'groove',\n 'ridge',\n 'outset',\n 'inset',\n] as const;\n\nexport const STROKE_STYLE_OBJECT_REQUIRED_PROPERTIES = ['dashArray', 'lineCap'] as const;\n\nexport const STROKE_STYLE_LINE_CAP_VALUES = ['round', 'butt', 'square'] as const;\n","export interface CustomTransformOptions {\n /** Token $type */\n $type: string;\n}\n\n/** Give a user pertinent feedback if they override a transform incorrectly */\nexport function validateCustomTransform(value: unknown, { $type }: CustomTransformOptions) {\n if (value) {\n if ((typeof value !== 'string' && typeof value !== 'object') || Array.isArray(value)) {\n throw new Error(\n `transform(): expected string or Object of strings, received ${Array.isArray(value) ? 'Array' : typeof value}`,\n );\n }\n switch ($type) {\n case 'typography': {\n if (typeof value !== 'object') {\n throw new Error('transform(): typography tokens must be an object of keys');\n }\n break;\n }\n }\n }\n}\n","export const TRANSITION_REQUIRED_PROPERTIES = ['duration', 'delay', 'timingFunction'] as const;\n","export const TYPOGRAPHY_REQUIRED_PROPERTIES = [\n 'fontFamily',\n 'fontSize',\n 'fontWeight',\n 'letterSpacing',\n 'lineHeight',\n] as const;\n"],"mappings":";;;;AAAA,MAAa,6BAA6B;CAAC;CAAS;CAAS;CAAQ;;;;;ACCrE,MAAa,eAAe;CAC1B,MAAM;CACN,UAAU;CAEV,eAAe;CACf,eAAe;CAEf,OAAO;CAEP,QAAQ;CACR,SAAS;CACT,MAAM;CAEN,QAAQ;CAER,aAAa;CACb,aAAa;CAEb,MAAM;CAEN,cAAc;CACd,cAAc;CAEd,OAAO;CACP,OAAO;CAEP,eAAe;CACf,eAAe;CAChB;;;;AC7BD,MAAa,oCAAoC,CAAC,SAAS,WAAW;;;;ACEtE,MAAM,WAAW;;AAGjB,SAAgB,QAAQ,OAAwB;AAC9C,QAAO,SAAS,KAAK,MAAM;;;AAI7B,SAAgB,gBAAgB,cAA+D;AAC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