| attempt-padding-margin-destructuring.mjs |
|
1796 |
- |
| attempt-shadow-destructuring.mjs |
Attempts to destructure a shadow token into its individual components.
This function processes a token with a potential shadow value,
and attempts to parse it into subtokens with destructured shadow properties.
@param {object} token - The token object to process.
@param {string} originalVal - The original value of the token, expected to be a string.
@returns {Array<object>|undefined} An array of new with destructured shadow properties,
or `undefined` if the token is not a shadow or cannot be parsed.
|
2255 |
- |
| constants.mjs |
|
662 |
- |
| create-figma-format.mjs |
Formats design tokens based on the provided arguments and options.
@param {string} collection - The name of the token collection to filter by.
@param {string} overrideIdentifier - The name of the set of override tokens to handle separately.
@returns {Function} A function that takes an object with `dictionary` and `options` properties
and returns a formatted JSON string of the tokens.
|
5221 |
- |
| filters.mjs |
Combines multiple filter functions into a single filter function.
@param {...Function} filters - One or more filter functions to combine.
@returns {Function} A new filter function that applies all provided filters.
|
1493 |
- |
| get-nested-brand-color.mjs |
Retrieves the nested brand color from a token object. The function traverses
the token structure to find and return an object containing `light` and `dark`
color values. If the token is a primitive value, it returns the same value
for both `light` and `dark`. If no valid color object is found, it returns `undefined`.
@param {object|string|number} token - The token object or value to extract the brand color from.
@returns {{light: string|number, dark: string|number}|undefined} An object containing `light` and `dark`
color values, or `undefined` if no valid color is found.
|
1293 |
- |
| get-nested-system-color.mjs |
Retrieves the nested system color value from a token object.
The function traverses through the token's properties (`forcedColors`, `prefersContrast`, `default`)
until it resolves to a non-object value.
@param {object} token - The token object containing nested system color definitions.
@returns {string|number|boolean|null|undefined} - The resolved system color value.
|
826 |
- |
| get-override-files.mjs |
|
726 |
- |
| get-override-formats.mjs |
|
804 |
- |
| get-token-collection.mjs |
|
1431 |
- |
| is-nested-default-object.mjs |
Determines if a given value is an arbitrarily deeply nested object
that satisfies the following conditions:
- Each object in the nesting hierarchy has exactly one key-value pair.
- The last key in the nesting hierarchy is "default".
- The value associated with the "default" key is a primitive (not an object).
- The value associated with the "default" key is not "currentColor".
@param {object} value - The value to check, expected to be an object.
@returns {boolean} Returns `true` if the object matches the criteria,
|
1460 |
- |
| parse-box-shadow.mjs |
Parses a CSS box-shadow string and returns an array of shadow objects.
@param {string} input - The box-shadow string to parse. Must be a valid CSS box-shadow value.
@returns {Array<object>} An array of objects representing the parsed box-shadow values.
@throws {Error} Throws an error if the input is not a string or if the box-shadow syntax is invalid.
|
2436 |
- |
| potentially-transform-value.mjs |
|
931 |
- |
| replace-references.mjs |
Replaces references and resolves `calc()` expressions in a given value.
This function processes a value to replace references with their actual values
and resolves any `calc()` expressions by evaluating them. It also handles
specific cases for high contrast mode (HCM) values.
@param {string | undefined} value - The value to process.
@param {object} tokens - All tokens in an unflattened object format, as provided by Style Dictionary.
|
2491 |
- |
| resolve-css-calc.mjs |
Attempts to evaluate a CSS calc expression
@param {string} expression - The CSS `calc()` expression to evaluate.
It can include numbers, units (e.g., px, %, rem), and operators (+, -, *, /).
@returns {string} - The evaluated result of the expression as a string, including the unit (if any).
@throws {Error} - Throws an error if the expression is invalid or if multiple units are mixed.
@example
resolveCssCalc("2 * 5rem"); // returns "10rem"
resolveCssCalc("8 / 2"); // returns "4"
resolveCssCalc("2px + 5px"); // returns "7px"
resolveCssCalc("1% + 5px"); // throws Error: Mixing units is not allowed
|
4040 |
- |
| transform-token-value.mjs |
Transforms the value of a design token by resolving references, handling `calc()` expressions,
and applying specific transformations for light, dark, and forced color modes.
@param {object} token - The token object containing metadata and the value to transform.
@param {string|object} originalVal - The original value of the token, which can be a string or an object.
@param {object} dictionary - Dictionary object from Style Dictionary
@param {string} overrideIdentifier - Name of the set of overrides being processed.
@returns {object} - A new token object with the transformed value.
|
3372 |
- |
| transforms.mjs |
|
2469 |
- |