MCPcopy Index your code
hub / github.com/microsoft/SandDance / resolveThemableArray

Function resolveThemableArray

docs/app/js/sanddance-app.js:27176–27199  ·  view source on GitHub ↗

* Resolves ThemingInstruction objects in an array and joins the result into a string. * @param {ThemableArray} splitStyleArray ThemableArray to resolve and join.

(splitStyleArray)

Source from the content-addressed store, hash-verified

27174 * Resolves ThemingInstruction objects in an array and joins the result into a string.
27175 * @param {ThemableArray} splitStyleArray ThemableArray to resolve and join.
27176 */ function resolveThemableArray(splitStyleArray) {
27177 var theme = _themeState.theme;
27178 var themable = false;
27179 // Resolve the array of theming instructions to an array of strings.
27180 // Then join the array to produce the final CSS string.
27181 var resolvedArray = (splitStyleArray || []).map(function(currentValue) {
27182 var themeSlot = currentValue.theme;
27183 if (themeSlot) {
27184 themable = true;
27185 // A theming annotation. Resolve it.
27186 var themedValue = theme ? theme[themeSlot] : undefined;
27187 var defaultValue = currentValue.defaultValue || "inherit";
27188 // Warn to console if we hit an unthemed value even when themes are provided, but only if "DEBUG" is true.
27189 // Allow the themedValue to be undefined to explicitly request the default value.
27190 if (theme && !themedValue && console && !(themeSlot in theme) && typeof DEBUG !== "undefined" && DEBUG) console.warn('Theming value not provided for "'.concat(themeSlot, '". Falling back to "').concat(defaultValue, '".'));
27191 return themedValue || defaultValue;
27192 } else // A non-themable string. Preserve it.
27193 return currentValue.rawString;
27194 });
27195 return {
27196 styleString: resolvedArray.join(""),
27197 themable: themable
27198 };
27199}
27200function splitStyles(styles) {
27201 var result = [];
27202 if (styles) {

Callers 3

applyThemableStylesFunction · 0.85
detokenizeFunction · 0.85
registerStylesFunction · 0.85

Calls 1

warnMethod · 0.45

Tested by

no test coverage detected