From 807796b3411c9ef05ae7dee10c6961d27ca43f4e Mon Sep 17 00:00:00 2001 From: Brian Ingles Date: Mon, 9 Oct 2023 16:16:12 -0500 Subject: [PATCH] Added comments #1542 --- packages/components/src/theme/ThemeUtils.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/components/src/theme/ThemeUtils.ts b/packages/components/src/theme/ThemeUtils.ts index aa79e10e6d..73c8ca93b1 100644 --- a/packages/components/src/theme/ThemeUtils.ts +++ b/packages/components/src/theme/ThemeUtils.ts @@ -146,6 +146,25 @@ export function getThemePreloadData(): ThemePreloadData | null { /** * Identifies start and end indices of any css variable expressions in the given * string. + * + * e.g. + * getCssVariableRanges('var(--aaa-aa) var(--bbb-bb)') + * yields: + * [ + * [0, 12], + * [14, 26], + * ] + * + * In cases where there are nested expressions, only the indices of the outermost + * expression will be included. + * + * e.g. + * getCssVariableRanges('var(--ccc-cc, var(--aaa-aa, green)) var(--bbb-bb)') + * yields: + * [ + * [0, 34], // range for --ccc-cc expression + * [36, 48], // range for --bbb-bb expression + * ] * @param value The string to search for css variable expressions * @returns An array of [start, end] index pairs for each css variable expression */