@fluentui/styles
Advanced tools
@@ -32,2 +32,10 @@ "use strict"; | ||
| var _excluded = ["_debug"], | ||
| _excluded2 = ["_debug"], | ||
| _excluded3 = ["_debug"], | ||
| _excluded4 = ["_debug"], | ||
| _excluded5 = ["_debug"], | ||
| _excluded6 = ["_debug", "_debugId"], | ||
| _excluded7 = ["_debug"], | ||
| _excluded8 = ["_debug", "_invertedKeys", "_debugId"]; | ||
| var emptyTheme = { | ||
@@ -128,3 +136,3 @@ siteVariables: { | ||
| _debug = _ref$_debug === void 0 ? undefined : _ref$_debug, | ||
| styles = (0, _objectWithoutPropertiesLoose2.default)(_ref, ["_debug"]); // new object required to prevent circular JSON structure error in <Debug /> | ||
| styles = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded); // new object required to prevent circular JSON structure error in <Debug /> | ||
@@ -144,3 +152,3 @@ | ||
| _debug = _ref2$_debug === void 0 ? undefined : _ref2$_debug, | ||
| styles = (0, _objectWithoutPropertiesLoose2.default)(_ref2, ["_debug"]); // new object required to prevent circular JSON structure error in <Debug /> | ||
| styles = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2); // new object required to prevent circular JSON structure error in <Debug /> | ||
@@ -162,7 +170,7 @@ | ||
| debugA = _slotA._debug, | ||
| resolvedStylesA = (0, _objectWithoutPropertiesLoose2.default)(_slotA, ["_debug"]); | ||
| resolvedStylesA = (0, _objectWithoutPropertiesLoose2.default)(_slotA, _excluded3); | ||
| var _slotB = slotB(styleParam), | ||
| debugB = _slotB._debug, | ||
| resolvedStylesB = (0, _objectWithoutPropertiesLoose2.default)(_slotB, ["_debug"]); | ||
| resolvedStylesB = (0, _objectWithoutPropertiesLoose2.default)(_slotB, _excluded4); | ||
@@ -239,3 +247,3 @@ var merged = (0, _merge2.default)(resolvedStylesA, resolvedStylesB); | ||
| _debug = _acc$_debug === void 0 ? [] : _acc$_debug, | ||
| accumulatedVariables = (0, _objectWithoutPropertiesLoose2.default)(_acc, ["_debug"]); | ||
| accumulatedVariables = (0, _objectWithoutPropertiesLoose2.default)(_acc, _excluded5); | ||
@@ -247,3 +255,3 @@ var _ref3 = (0, _callable.callable)(next)(siteVariables) || {}, | ||
| _debugId = _ref3$_debugId === void 0 ? undefined : _ref3$_debugId, | ||
| computedComponentVariables = (0, _objectWithoutPropertiesLoose2.default)(_ref3, ["_debug", "_debugId"]); | ||
| computedComponentVariables = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded6); | ||
@@ -302,3 +310,3 @@ var merged = (0, _deepmerge.deepmerge)(accumulatedVariables, computedComponentVariables); | ||
| _debug = _acc$_debug2 === void 0 ? [] : _acc$_debug2, | ||
| accumulatedSiteVariables = (0, _objectWithoutPropertiesLoose2.default)(acc, ["_debug"]); | ||
| accumulatedSiteVariables = (0, _objectWithoutPropertiesLoose2.default)(acc, _excluded7); | ||
@@ -312,3 +320,3 @@ var _ref4 = next || {}, | ||
| _debugId = _ref4$_debugId === void 0 ? undefined : _ref4$_debugId, | ||
| nextSiteVariables = (0, _objectWithoutPropertiesLoose2.default)(_ref4, ["_debug", "_invertedKeys", "_debugId"]); | ||
| nextSiteVariables = (0, _objectWithoutPropertiesLoose2.default)(_ref4, _excluded8); | ||
@@ -315,0 +323,0 @@ var merged = (0, _deepmerge.deepmerge)(Object.assign({}, accumulatedSiteVariables, { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["mergeThemes.ts"],"names":["emptyTheme","siteVariables","fontSizes","componentVariables","componentStyles","fontFaces","staticStyles","animations","mergeComponentStyles__PROD","stylesA","stylesB","result","Object","keys","forEach","partName","slotA","slotB","mergedStyleFunction","styleParam","mergeComponentStyles__DEV","isDebugEnabled","mergedKeys","slotName","_debug","undefined","styles","debugId","_debugId","debugA","resolvedStylesA","debugB","resolvedStylesB","merged","concat","mergeComponentStyles","process","env","NODE_ENV","mergeComponentVariables__PROD","initial","sources","filteredSources","filter","Boolean","length","reduce","acc","next","mergeComponentVariables","accumulatedVariables","fn","computedComponentVariables","mergeComponentVariables__DEV","computedDebug","resolved","input","_invertedKeys","mergeSiteVariables__PROD","deepmerge","mergeSiteVariables__DEV","accumulatedSiteVariables","nextSiteVariables","key","mergeSiteVariables","mergeThemeVariables__PROD","displayNames","displayName","mergeThemeVariables__DEV","source","mergeThemeVariables","mergeThemeStyles","themeComponentStyles","stylesByPart","mergeFontFaces","toCompactArray","mergeStaticStyles","mergeAnimations","assign","mergeStyles","args","mergeThemes","themes","nextDebugId"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA;;AAoBA;;AACA;;AACA;;AACA;;AACA;;AAEO,IAAMA,UAAyB,GAAG;AACvCC,EAAAA,aAAa,EAAE;AACbC,IAAAA,SAAS,EAAE;AADE,GADwB;AAIvCC,EAAAA,kBAAkB,EAAE,EAJmB;AAKvCC,EAAAA,eAAe,EAAE,EALsB;AAMvCC,EAAAA,SAAS,EAAE,EAN4B;AAOvCC,EAAAA,YAAY,EAAE,EAPyB;AAQvCC,EAAAA,UAAU,EAAE;AAR2B,CAAlC,C,CAWP;AACA;AACA;;AAEA;AACA;AACA;;;;AACO,IAAMC,0BAAuD,GAAG,SAA1DA,0BAA0D,CAACC,OAAD,EAAUC,OAAV,EAAsB;AAC3F,MAAMC,MAAM,GAAG,EAAf;;AAEA,MAAIF,OAAJ,EAAa;AACXG,IAAAA,MAAM,CAACC,IAAP,CAAYJ,OAAZ,EAAqBK,OAArB,CAA6B,UAAAC,QAAQ,EAAI;AACvC,UAAMC,KAAK,GAAGP,OAAO,CAACM,QAAD,CAArB;AACA,UAAME,KAAK,GAAGP,OAAH,oBAAGA,OAAO,CAAGK,QAAH,CAArB,CAFuC,CAIvC;;AACA,UAAI,OAAOC,KAAP,KAAiB,WAAjB,IAAgCA,KAAK,KAAK,IAA9C,EAAoD;AAClD;AACD,OAPsC,CASvC;AACA;;;AACA,UAAI,OAAOC,KAAP,KAAiB,WAAjB,IAAgCA,KAAK,KAAK,IAA9C,EAAoD;AAClDN,QAAAA,MAAM,CAACI,QAAD,CAAN,GAAmB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AAOA,MAAM,CAACpC,MAAP,CACL,UAACC,GAAD,EAAqBC,IAArB,EAA0C;AACxC,QAAI,CAACA,IAAL,EAAW,OAAOD,GAAP;AACX,QAAMoC,WAAW,GAAGnC,IAAI,CAAC,UAAD,CAAxB;AAEAD,IAAAA,GAAG,CAAC9C,aAAJ,GAAoB+D,kBAAkB,CAACjB,GAAG,CAAC9C,aAAL,EAAoB,8BAAY+C,IAAI,CAAC/C,aAAjB,EAAgCkF,WAAhC,CAApB,CAAtC;AAEApC,IAAAA,GAAG,CAAC5C,kBAAJ,GAAyBmE,mBAAmB,CAC1CvB,GAAG,CAAC5C,kBADsC,EAE1C,8BAAY6C,IAAI,CAAC7C,kBAAjB,EAAqCgF,WAArC,CAF0C,CAA5C;AAKApC,IAAAA,GAAG,CAAC3C,eAAJ,GAAsBmE,gBAAgB,CAACxB,GAAG,CAAC3C,eAAL,EAAsB,8BAAY4C,IAAI,CAAC5C,eAAjB,EAAkC+E,WAAlC,CAAtB,CAAtC;AAEApC,IAAAA,GAAG,CAAC1C,SAAJ,GAAgBqE,cAAc,MAAd,SAAkB3B,GAAG,CAAC1C,SAAtB,QAAqC2C,IAAI,CAAC3C,SAAL,IAAkB,EAAvD,EAAhB;AAEA0C,IAAAA,GAAG,CAACzC,YAAJ,GAAmBsE,iBAAiB,MAAjB,SAAqB7B,GAAG,CAACzC,YAAzB,QAA2C0C,IAAI,CAAC1C,YAAL,IAAqB,EAAhE,EAAnB;AAEAyC,IAAAA,GAAG,CAACxC,UAAJ,GAAiBsE,eAAe,CAAC9B,GAAG,CAACxC,UAAL,EAAiByC,IAAI,CAACzC,UAAtB,CAAhC;AAEA,WAAOwC,GAAP;AACD,GArBI,EAsBL;AAtBK,oBAuBA/C,UAvBA,EAAP;AAyBD,CA1BM","sourcesContent":["import * as _ from 'lodash';\n\nimport { callable } from './callable';\nimport {\n ComponentSlotStyle,\n ComponentSlotStylesInput,\n ComponentSlotStylesPrepared,\n ComponentVariablesInput,\n ComponentVariablesPrepared,\n FontFace,\n SiteVariablesInput,\n SiteVariablesPrepared,\n StaticStyle,\n ThemeAnimation,\n ThemeComponentStylesInput,\n ThemeComponentStylesPrepared,\n ThemeComponentVariablesInput,\n ThemeComponentVariablesPrepared,\n ThemeInput,\n ThemePrepared,\n} from './types';\n\nimport { isEnabled as isDebugEnabled } from './debugEnabled';\nimport { deepmerge } from './deepmerge';\nimport { objectKeyToValues } from './objectKeysToValues';\nimport { toCompactArray } from './toCompactArray';\nimport { withDebugId } from './withDebugId';\n\nexport const emptyTheme: ThemePrepared = {\n siteVariables: {\n fontSizes: {},\n },\n componentVariables: {},\n componentStyles: {},\n fontFaces: [],\n staticStyles: [],\n animations: {},\n};\n\n// ----------------------------------------\n// Component level merge functions\n// ----------------------------------------\n\n/**\n * Merges a single component's styles (keyed by component part) with another component's styles.\n */\nexport const mergeComponentStyles__PROD: typeof mergeComponentStyles = (stylesA, stylesB) => {\n const result = {};\n\n if (stylesA) {\n Object.keys(stylesA).forEach(partName => {\n const slotA = stylesA[partName];\n const slotB = stylesB?.[partName];\n\n // if there is no source, merging is a no-op, skip it\n if (typeof slotA === 'undefined' || slotA === null) {\n return;\n }\n\n // no target means source doesn't need to merge onto anything\n // just ensure source is callable (prepared format)\n if (typeof slotB === 'undefined' || slotB === null) {\n result[partName] = typeof slotA === 'function' ? slotA : () => slotA;\n return;\n }\n\n if (slotA === slotB) {\n result[partName] = typeof slotA === 'function' ? slotA : () => slotA;\n }\n });\n }\n\n if (stylesB) {\n Object.keys(stylesB).forEach(partName => {\n const slotA = stylesA?.[partName];\n const slotB = stylesB[partName];\n\n // if there is no source, merging is a no-op, skip it\n if (typeof slotB === 'undefined' || slotB === null) {\n return;\n }\n\n // no target means source doesn't need to merge onto anything\n // just ensure source is callable (prepared format)\n if (typeof slotA === 'undefined' || slotA === null) {\n result[partName] = typeof slotB === 'function' ? slotB : () => slotB;\n return;\n }\n\n if (slotA === slotB) {\n return;\n }\n\n // We have both target and source, replace with merge fn\n result[partName] = function mergedStyleFunction(styleParam) {\n // originalTarget is always prepared, fn is guaranteed\n return _.merge(\n typeof slotA === 'function' ? slotA(styleParam) : slotA,\n typeof slotB === 'function' ? slotB(styleParam) : slotB,\n );\n };\n });\n }\n\n return result;\n};\n\nexport const mergeComponentStyles__DEV: typeof mergeComponentStyles = (stylesA, stylesB) => {\n if (!isDebugEnabled) {\n return mergeComponentStyles__PROD(stylesA, stylesB);\n }\n\n const mergedKeys = [...(stylesA ? Object.keys(stylesA) : []), ...(stylesB ? Object.keys(stylesB) : [])];\n const result = {};\n\n mergedKeys.forEach(slotName => {\n const slotA = styleParam => {\n const { _debug = undefined, ...styles } = callable(stylesA?.[slotName])(styleParam) || {};\n\n // new object required to prevent circular JSON structure error in <Debug />\n return {\n ...styles,\n _debug: _debug || [{ styles: { ...styles }, debugId: stylesA._debugId }],\n };\n };\n\n const slotB = styleParam => {\n const { _debug = undefined, ...styles } = callable(stylesB?.[slotName])(styleParam) || {};\n\n // new object required to prevent circular JSON structure error in <Debug />\n return {\n ...styles,\n _debug: _debug || [{ styles: { ...styles }, debugId: stylesB._debugId }],\n };\n };\n\n if (stylesA?.[slotName] && stylesB?.[slotName]) {\n // We have both, replace with merge fn\n result[slotName] = styleParam => {\n // slot* are always prepared, fn is guaranteed, _debug always exists\n const { _debug: debugA, ...resolvedStylesA } = slotA(styleParam);\n const { _debug: debugB, ...resolvedStylesB } = slotB(styleParam);\n\n const merged = _.merge(resolvedStylesA, resolvedStylesB);\n\n merged._debug = debugA.concat(debugB || { styles: resolvedStylesB, debugId: resolvedStylesB._debugId });\n\n return merged;\n };\n } else if (stylesA?.[slotName]) {\n result[slotName] = slotA;\n } else if (stylesB?.[slotName]) {\n result[slotName] = slotB;\n }\n });\n\n return result;\n};\n\nexport const mergeComponentStyles: (\n stylesA: ComponentSlotStylesInput | null | undefined,\n stylesB: ComponentSlotStylesInput | null | undefined,\n) => ComponentSlotStylesPrepared =\n process.env.NODE_ENV === 'production' ? mergeComponentStyles__PROD : mergeComponentStyles__DEV;\n\n/**\n * Merges a single component's variables with another component's variables.\n */\nexport const mergeComponentVariables__PROD = (...sources: ComponentVariablesInput[]): ComponentVariablesPrepared => {\n const initial = () => ({});\n\n // filtering is required as some arguments can be undefined\n const filteredSources = sources.filter(Boolean);\n\n // a short circle to avoid calls of deepmerge()\n if (filteredSources.length === 1) {\n return typeof filteredSources[0] === 'function' ? filteredSources[0] : callable(filteredSources[0]);\n }\n\n return filteredSources.reduce<ComponentVariablesPrepared>((acc, next) => {\n return function mergeComponentVariables(...args) {\n const accumulatedVariables = acc(...args);\n const fn = typeof next === 'function' ? next : callable(next);\n const computedComponentVariables = fn(...args);\n\n return deepmerge(accumulatedVariables, computedComponentVariables);\n };\n }, initial);\n};\n\nexport const mergeComponentVariables__DEV = (...sources: ComponentVariablesInput[]): ComponentVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeComponentVariables__PROD(...sources);\n }\n const initial = () => ({});\n\n return sources.reduce<ComponentVariablesPrepared>((acc, next) => {\n return siteVariables => {\n const { _debug = [], ...accumulatedVariables } = acc(siteVariables);\n const { _debug: computedDebug = undefined, _debugId = undefined, ...computedComponentVariables } =\n callable(next)(siteVariables) || {};\n\n const merged = deepmerge(accumulatedVariables, computedComponentVariables);\n\n merged._debug = _debug.concat(\n computedDebug || {\n resolved: computedComponentVariables,\n debugId: _debugId,\n input: siteVariables\n ? siteVariables._invertedKeys && callable(next)(siteVariables._invertedKeys)\n : callable(next)(),\n },\n );\n return merged;\n };\n }, initial);\n};\n\nexport const mergeComponentVariables =\n process.env.NODE_ENV === 'production' ? mergeComponentVariables__PROD : mergeComponentVariables__DEV;\n\n// ----------------------------------------\n// Theme level merge functions\n// ----------------------------------------\n\n/**\n * Site variables can safely be merged at each Provider in the tree.\n * They are flat objects and do not depend on render-time values, such as props.\n */\nexport const mergeSiteVariables__PROD = (\n ...sources: (SiteVariablesInput | null | undefined)[]\n): SiteVariablesPrepared => {\n const initial: SiteVariablesPrepared = {\n fontSizes: {},\n };\n return deepmerge(initial, ...sources);\n};\n\nexport const mergeSiteVariables__DEV = (\n ...sources: (SiteVariablesInput | null | undefined)[]\n): SiteVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeSiteVariables__PROD(...sources);\n }\n\n const initial: SiteVariablesPrepared = {\n fontSizes: {},\n };\n\n return sources.reduce<SiteVariablesPrepared>((acc, next) => {\n const { _debug = [], ...accumulatedSiteVariables } = acc;\n const { _debug: computedDebug = undefined, _invertedKeys = undefined, _debugId = undefined, ...nextSiteVariables } =\n next || {};\n\n const merged = deepmerge({ ...accumulatedSiteVariables, _invertedKeys: undefined }, nextSiteVariables);\n merged._debug = _debug.concat(computedDebug || { resolved: nextSiteVariables, debugId: _debugId });\n merged._invertedKeys = _invertedKeys || objectKeyToValues(merged, key => `siteVariables.${key}`);\n return merged;\n }, initial);\n};\n\nexport const mergeSiteVariables =\n process.env.NODE_ENV === 'production' ? mergeSiteVariables__PROD : mergeSiteVariables__DEV;\n\n/**\n * Component variables can be objects, functions, or an array of these.\n * The functions must be called with the final result of siteVariables, otherwise\n * the component variable objects would have no ability to apply siteVariables.\n * Therefore, componentVariables must be resolved by the component at render time.\n * We instead pass down call stack of component variable functions to be resolved later.\n */\n\nexport const mergeThemeVariables__PROD = (\n ...sources: (ThemeComponentVariablesInput | null | undefined)[]\n): ThemeComponentVariablesPrepared => {\n const displayNames = _.union(..._.map(sources, _.keys));\n return displayNames.reduce((componentVariables, displayName) => {\n componentVariables[displayName] = mergeComponentVariables(..._.map(sources, displayName));\n return componentVariables;\n }, {});\n};\n\nexport const mergeThemeVariables__DEV = (\n ...sources: (ThemeComponentVariablesInput | null | undefined)[]\n): ThemeComponentVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeThemeVariables__PROD(...sources);\n }\n\n const displayNames = _.union(..._.map(sources, _.keys));\n return displayNames.reduce((componentVariables, displayName) => {\n componentVariables[displayName] = mergeComponentVariables(\n ..._.map(sources, source => source && withDebugId(source[displayName], source._debugId)),\n );\n return componentVariables;\n }, {});\n};\n\nexport const mergeThemeVariables =\n process.env.NODE_ENV === 'production' ? mergeThemeVariables__PROD : mergeThemeVariables__DEV;\n\n/**\n * See mergeThemeVariables() description.\n * Component styles adhere to the same pattern as component variables, except\n * that they return style objects.\n */\nexport const mergeThemeStyles = (\n ...sources: (ThemeComponentStylesInput | null | undefined)[]\n): ThemeComponentStylesPrepared => {\n const initial: ThemeComponentStylesPrepared = {};\n\n return sources.reduce<ThemeComponentStylesPrepared>((themeComponentStyles, next) => {\n _.forEach(next, (stylesByPart, displayName) => {\n themeComponentStyles[displayName] = mergeComponentStyles(\n themeComponentStyles[displayName],\n withDebugId(stylesByPart, (next as ThemeComponentStylesPrepared & { _debugId: string })._debugId),\n );\n });\n\n return themeComponentStyles;\n }, initial);\n};\n\nexport const mergeFontFaces = (...sources: FontFace[]) => {\n return toCompactArray<FontFace>(...sources);\n};\n\nexport const mergeStaticStyles = (...sources: StaticStyle[]) => {\n return toCompactArray<StaticStyle>(...sources);\n};\n\nexport const mergeAnimations = (...sources: { [key: string]: ThemeAnimation }[]): { [key: string]: ThemeAnimation } => {\n return Object.assign({}, ...sources);\n};\n\nexport const mergeStyles = (...sources: ComponentSlotStyle[]) => {\n return (...args) => {\n return sources.reduce((acc, next) => {\n return _.merge(acc, callable(next)(...args));\n }, {});\n };\n};\n\nexport const mergeThemes = (...themes: ThemeInput[]): ThemePrepared => {\n return themes.reduce<ThemePrepared>(\n (acc: ThemePrepared, next: ThemeInput) => {\n if (!next) return acc;\n const nextDebugId = next['_debugId'];\n\n acc.siteVariables = mergeSiteVariables(acc.siteVariables, withDebugId(next.siteVariables, nextDebugId));\n\n acc.componentVariables = mergeThemeVariables(\n acc.componentVariables,\n withDebugId(next.componentVariables, nextDebugId),\n );\n\n acc.componentStyles = mergeThemeStyles(acc.componentStyles, withDebugId(next.componentStyles, nextDebugId));\n\n acc.fontFaces = mergeFontFaces(...acc.fontFaces, ...(next.fontFaces || []));\n\n acc.staticStyles = mergeStaticStyles(...acc.staticStyles, ...(next.staticStyles || []));\n\n acc.animations = mergeAnimations(acc.animations, next.animations);\n\n return acc;\n },\n // .reduce() will modify \"emptyTheme\" object, so we should clone it before actual usage\n { ...emptyTheme },\n );\n};\n"],"file":"mergeThemes.js"} | ||
| {"version":3,"sources":["mergeThemes.ts"],"names":["emptyTheme","siteVariables","fontSizes","componentVariables","componentStyles","fontFaces","staticStyles","animations","mergeComponentStyles__PROD","stylesA","stylesB","result","Object","keys","forEach","partName","slotA","slotB","mergedStyleFunction","styleParam","mergeComponentStyles__DEV","isDebugEnabled","mergedKeys","slotName","_debug","undefined","styles","debugId","_debugId","debugA","resolvedStylesA","debugB","resolvedStylesB","merged","concat","mergeComponentStyles","process","env","NODE_ENV","mergeComponentVariables__PROD","initial","sources","filteredSources","filter","Boolean","length","reduce","acc","next","mergeComponentVariables","accumulatedVariables","fn","computedComponentVariables","mergeComponentVariables__DEV","computedDebug","resolved","input","_invertedKeys","mergeSiteVariables__PROD","deepmerge","mergeSiteVariables__DEV","accumulatedSiteVariables","nextSiteVariables","key","mergeSiteVariables","mergeThemeVariables__PROD","displayNames","displayName","mergeThemeVariables__DEV","source","mergeThemeVariables","mergeThemeStyles","themeComponentStyles","stylesByPart","mergeFontFaces","toCompactArray","mergeStaticStyles","mergeAnimations","assign","mergeStyles","args","mergeThemes","themes","nextDebugId"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA;;AAoBA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,IAAMA,UAAyB,GAAG;AACvCC,EAAAA,aAAa,EAAE;AACbC,IAAAA,SAAS,EAAE;AADE,GADwB;AAIvCC,EAAAA,kBAAkB,EAAE,EAJmB;AAKvCC,EAAAA,eAAe,EAAE,EALsB;AAMvCC,EAAAA,SAAS,EAAE,EAN4B;AAOvCC,EAAAA,YAAY,EAAE,EAPyB;AAQvCC,EAAAA,UAAU,EAAE;AAR2B,CAAlC,C,CAWP;AACA;AACA;;AAEA;AACA;A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eAAjB,EAAkC+E,WAAlC,CAAtB,CAAtC;AAEApC,IAAAA,GAAG,CAAC1C,SAAJ,GAAgBqE,cAAc,MAAd,SAAkB3B,GAAG,CAAC1C,SAAtB,QAAqC2C,IAAI,CAAC3C,SAAL,IAAkB,EAAvD,EAAhB;AAEA0C,IAAAA,GAAG,CAACzC,YAAJ,GAAmBsE,iBAAiB,MAAjB,SAAqB7B,GAAG,CAACzC,YAAzB,QAA2C0C,IAAI,CAAC1C,YAAL,IAAqB,EAAhE,EAAnB;AAEAyC,IAAAA,GAAG,CAACxC,UAAJ,GAAiBsE,eAAe,CAAC9B,GAAG,CAACxC,UAAL,EAAiByC,IAAI,CAACzC,UAAtB,CAAhC;AAEA,WAAOwC,GAAP;AACD,GArBI,EAsBL;AAtBK,oBAuBA/C,UAvBA,EAAP;AAyBD,CA1BM","sourcesContent":["import * as _ from 'lodash';\n\nimport { callable } from './callable';\nimport {\n ComponentSlotStyle,\n ComponentSlotStylesInput,\n ComponentSlotStylesPrepared,\n ComponentVariablesInput,\n ComponentVariablesPrepared,\n FontFace,\n SiteVariablesInput,\n SiteVariablesPrepared,\n StaticStyle,\n ThemeAnimation,\n ThemeComponentStylesInput,\n ThemeComponentStylesPrepared,\n ThemeComponentVariablesInput,\n ThemeComponentVariablesPrepared,\n ThemeInput,\n ThemePrepared,\n} from './types';\n\nimport { isEnabled as isDebugEnabled } from './debugEnabled';\nimport { deepmerge } from './deepmerge';\nimport { objectKeyToValues } from './objectKeysToValues';\nimport { toCompactArray } from './toCompactArray';\nimport { withDebugId } from './withDebugId';\n\nexport const emptyTheme: ThemePrepared = {\n siteVariables: {\n fontSizes: {},\n },\n componentVariables: {},\n componentStyles: {},\n fontFaces: [],\n staticStyles: [],\n animations: {},\n};\n\n// ----------------------------------------\n// Component level merge functions\n// ----------------------------------------\n\n/**\n * Merges a single component's styles (keyed by component part) with another component's styles.\n */\nexport const mergeComponentStyles__PROD: typeof mergeComponentStyles = (stylesA, stylesB) => {\n const result = {};\n\n if (stylesA) {\n Object.keys(stylesA).forEach(partName => {\n const slotA = stylesA[partName];\n const slotB = stylesB?.[partName];\n\n // if there is no source, merging is a no-op, skip it\n if (typeof slotA === 'undefined' || slotA === null) {\n return;\n }\n\n // no target means source doesn't need to merge onto anything\n // just ensure source is callable (prepared format)\n if (typeof slotB === 'undefined' || slotB === null) {\n result[partName] = typeof slotA === 'function' ? slotA : () => slotA;\n return;\n }\n\n if (slotA === slotB) {\n result[partName] = typeof slotA === 'function' ? slotA : () => slotA;\n }\n });\n }\n\n if (stylesB) {\n Object.keys(stylesB).forEach(partName => {\n const slotA = stylesA?.[partName];\n const slotB = stylesB[partName];\n\n // if there is no source, merging is a no-op, skip it\n if (typeof slotB === 'undefined' || slotB === null) {\n return;\n }\n\n // no target means source doesn't need to merge onto anything\n // just ensure source is callable (prepared format)\n if (typeof slotA === 'undefined' || slotA === null) {\n result[partName] = typeof slotB === 'function' ? slotB : () => slotB;\n return;\n }\n\n if (slotA === slotB) {\n return;\n }\n\n // We have both target and source, replace with merge fn\n result[partName] = function mergedStyleFunction(styleParam) {\n // originalTarget is always prepared, fn is guaranteed\n return _.merge(\n typeof slotA === 'function' ? slotA(styleParam) : slotA,\n typeof slotB === 'function' ? slotB(styleParam) : slotB,\n );\n };\n });\n }\n\n return result;\n};\n\nexport const mergeComponentStyles__DEV: typeof mergeComponentStyles = (stylesA, stylesB) => {\n if (!isDebugEnabled) {\n return mergeComponentStyles__PROD(stylesA, stylesB);\n }\n\n const mergedKeys = [...(stylesA ? Object.keys(stylesA) : []), ...(stylesB ? Object.keys(stylesB) : [])];\n const result = {};\n\n mergedKeys.forEach(slotName => {\n const slotA = styleParam => {\n const { _debug = undefined, ...styles } = callable(stylesA?.[slotName])(styleParam) || {};\n\n // new object required to prevent circular JSON structure error in <Debug />\n return {\n ...styles,\n _debug: _debug || [{ styles: { ...styles }, debugId: stylesA._debugId }],\n };\n };\n\n const slotB = styleParam => {\n const { _debug = undefined, ...styles } = callable(stylesB?.[slotName])(styleParam) || {};\n\n // new object required to prevent circular JSON structure error in <Debug />\n return {\n ...styles,\n _debug: _debug || [{ styles: { ...styles }, debugId: stylesB._debugId }],\n };\n };\n\n if (stylesA?.[slotName] && stylesB?.[slotName]) {\n // We have both, replace with merge fn\n result[slotName] = styleParam => {\n // slot* are always prepared, fn is guaranteed, _debug always exists\n const { _debug: debugA, ...resolvedStylesA } = slotA(styleParam);\n const { _debug: debugB, ...resolvedStylesB } = slotB(styleParam);\n\n const merged = _.merge(resolvedStylesA, resolvedStylesB);\n\n merged._debug = debugA.concat(debugB || { styles: resolvedStylesB, debugId: resolvedStylesB._debugId });\n\n return merged;\n };\n } else if (stylesA?.[slotName]) {\n result[slotName] = slotA;\n } else if (stylesB?.[slotName]) {\n result[slotName] = slotB;\n }\n });\n\n return result;\n};\n\nexport const mergeComponentStyles: (\n stylesA: ComponentSlotStylesInput | null | undefined,\n stylesB: ComponentSlotStylesInput | null | undefined,\n) => ComponentSlotStylesPrepared =\n process.env.NODE_ENV === 'production' ? mergeComponentStyles__PROD : mergeComponentStyles__DEV;\n\n/**\n * Merges a single component's variables with another component's variables.\n */\nexport const mergeComponentVariables__PROD = (...sources: ComponentVariablesInput[]): ComponentVariablesPrepared => {\n const initial = () => ({});\n\n // filtering is required as some arguments can be undefined\n const filteredSources = sources.filter(Boolean);\n\n // a short circle to avoid calls of deepmerge()\n if (filteredSources.length === 1) {\n return typeof filteredSources[0] === 'function' ? filteredSources[0] : callable(filteredSources[0]);\n }\n\n return filteredSources.reduce<ComponentVariablesPrepared>((acc, next) => {\n return function mergeComponentVariables(...args) {\n const accumulatedVariables = acc(...args);\n const fn = typeof next === 'function' ? next : callable(next);\n const computedComponentVariables = fn(...args);\n\n return deepmerge(accumulatedVariables, computedComponentVariables);\n };\n }, initial);\n};\n\nexport const mergeComponentVariables__DEV = (...sources: ComponentVariablesInput[]): ComponentVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeComponentVariables__PROD(...sources);\n }\n const initial = () => ({});\n\n return sources.reduce<ComponentVariablesPrepared>((acc, next) => {\n return siteVariables => {\n const { _debug = [], ...accumulatedVariables } = acc(siteVariables);\n const { _debug: computedDebug = undefined, _debugId = undefined, ...computedComponentVariables } =\n callable(next)(siteVariables) || {};\n\n const merged = deepmerge(accumulatedVariables, computedComponentVariables);\n\n merged._debug = _debug.concat(\n computedDebug || {\n resolved: computedComponentVariables,\n debugId: _debugId,\n input: siteVariables\n ? siteVariables._invertedKeys && callable(next)(siteVariables._invertedKeys)\n : callable(next)(),\n },\n );\n return merged;\n };\n }, initial);\n};\n\nexport const mergeComponentVariables =\n process.env.NODE_ENV === 'production' ? mergeComponentVariables__PROD : mergeComponentVariables__DEV;\n\n// ----------------------------------------\n// Theme level merge functions\n// ----------------------------------------\n\n/**\n * Site variables can safely be merged at each Provider in the tree.\n * They are flat objects and do not depend on render-time values, such as props.\n */\nexport const mergeSiteVariables__PROD = (\n ...sources: (SiteVariablesInput | null | undefined)[]\n): SiteVariablesPrepared => {\n const initial: SiteVariablesPrepared = {\n fontSizes: {},\n };\n return deepmerge(initial, ...sources);\n};\n\nexport const mergeSiteVariables__DEV = (\n ...sources: (SiteVariablesInput | null | undefined)[]\n): SiteVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeSiteVariables__PROD(...sources);\n }\n\n const initial: SiteVariablesPrepared = {\n fontSizes: {},\n };\n\n return sources.reduce<SiteVariablesPrepared>((acc, next) => {\n const { _debug = [], ...accumulatedSiteVariables } = acc;\n const { _debug: computedDebug = undefined, _invertedKeys = undefined, _debugId = undefined, ...nextSiteVariables } =\n next || {};\n\n const merged = deepmerge({ ...accumulatedSiteVariables, _invertedKeys: undefined }, nextSiteVariables);\n merged._debug = _debug.concat(computedDebug || { resolved: nextSiteVariables, debugId: _debugId });\n merged._invertedKeys = _invertedKeys || objectKeyToValues(merged, key => `siteVariables.${key}`);\n return merged;\n }, initial);\n};\n\nexport const mergeSiteVariables =\n process.env.NODE_ENV === 'production' ? mergeSiteVariables__PROD : mergeSiteVariables__DEV;\n\n/**\n * Component variables can be objects, functions, or an array of these.\n * The functions must be called with the final result of siteVariables, otherwise\n * the component variable objects would have no ability to apply siteVariables.\n * Therefore, componentVariables must be resolved by the component at render time.\n * We instead pass down call stack of component variable functions to be resolved later.\n */\n\nexport const mergeThemeVariables__PROD = (\n ...sources: (ThemeComponentVariablesInput | null | undefined)[]\n): ThemeComponentVariablesPrepared => {\n const displayNames = _.union(..._.map(sources, _.keys));\n return displayNames.reduce((componentVariables, displayName) => {\n componentVariables[displayName] = mergeComponentVariables(..._.map(sources, displayName));\n return componentVariables;\n }, {});\n};\n\nexport const mergeThemeVariables__DEV = (\n ...sources: (ThemeComponentVariablesInput | null | undefined)[]\n): ThemeComponentVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeThemeVariables__PROD(...sources);\n }\n\n const displayNames = _.union(..._.map(sources, _.keys));\n return displayNames.reduce((componentVariables, displayName) => {\n componentVariables[displayName] = mergeComponentVariables(\n ..._.map(sources, source => source && withDebugId(source[displayName], source._debugId)),\n );\n return componentVariables;\n }, {});\n};\n\nexport const mergeThemeVariables =\n process.env.NODE_ENV === 'production' ? mergeThemeVariables__PROD : mergeThemeVariables__DEV;\n\n/**\n * See mergeThemeVariables() description.\n * Component styles adhere to the same pattern as component variables, except\n * that they return style objects.\n */\nexport const mergeThemeStyles = (\n ...sources: (ThemeComponentStylesInput | null | undefined)[]\n): ThemeComponentStylesPrepared => {\n const initial: ThemeComponentStylesPrepared = {};\n\n return sources.reduce<ThemeComponentStylesPrepared>((themeComponentStyles, next) => {\n _.forEach(next, (stylesByPart, displayName) => {\n themeComponentStyles[displayName] = mergeComponentStyles(\n themeComponentStyles[displayName],\n withDebugId(stylesByPart, (next as ThemeComponentStylesPrepared & { _debugId: string })._debugId),\n );\n });\n\n return themeComponentStyles;\n }, initial);\n};\n\nexport const mergeFontFaces = (...sources: FontFace[]) => {\n return toCompactArray<FontFace>(...sources);\n};\n\nexport const mergeStaticStyles = (...sources: StaticStyle[]) => {\n return toCompactArray<StaticStyle>(...sources);\n};\n\nexport const mergeAnimations = (...sources: { [key: string]: ThemeAnimation }[]): { [key: string]: ThemeAnimation } => {\n return Object.assign({}, ...sources);\n};\n\nexport const mergeStyles = (...sources: ComponentSlotStyle[]) => {\n return (...args) => {\n return sources.reduce((acc, next) => {\n return _.merge(acc, callable(next)(...args));\n }, {});\n };\n};\n\nexport const mergeThemes = (...themes: ThemeInput[]): ThemePrepared => {\n return themes.reduce<ThemePrepared>(\n (acc: ThemePrepared, next: ThemeInput) => {\n if (!next) return acc;\n const nextDebugId = next['_debugId'];\n\n acc.siteVariables = mergeSiteVariables(acc.siteVariables, withDebugId(next.siteVariables, nextDebugId));\n\n acc.componentVariables = mergeThemeVariables(\n acc.componentVariables,\n withDebugId(next.componentVariables, nextDebugId),\n );\n\n acc.componentStyles = mergeThemeStyles(acc.componentStyles, withDebugId(next.componentStyles, nextDebugId));\n\n acc.fontFaces = mergeFontFaces(...acc.fontFaces, ...(next.fontFaces || []));\n\n acc.staticStyles = mergeStaticStyles(...acc.staticStyles, ...(next.staticStyles || []));\n\n acc.animations = mergeAnimations(acc.animations, next.animations);\n\n return acc;\n },\n // .reduce() will modify \"emptyTheme\" object, so we should clone it before actual usage\n { ...emptyTheme },\n );\n};\n"],"file":"mergeThemes.js"} |
| "use strict"; | ||
| exports.__esModule = true; | ||
| //# sourceMappingURL=types.js.map |
@@ -7,2 +7,10 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
| import _merge from "lodash/merge"; | ||
| var _excluded = ["_debug"], | ||
| _excluded2 = ["_debug"], | ||
| _excluded3 = ["_debug"], | ||
| _excluded4 = ["_debug"], | ||
| _excluded5 = ["_debug"], | ||
| _excluded6 = ["_debug", "_debugId"], | ||
| _excluded7 = ["_debug"], | ||
| _excluded8 = ["_debug", "_invertedKeys", "_debugId"]; | ||
| import { callable } from './callable'; | ||
@@ -104,3 +112,3 @@ import { isEnabled as isDebugEnabled } from './debugEnabled'; | ||
| _debug = _ref$_debug === void 0 ? undefined : _ref$_debug, | ||
| styles = _objectWithoutPropertiesLoose(_ref, ["_debug"]); // new object required to prevent circular JSON structure error in <Debug /> | ||
| styles = _objectWithoutPropertiesLoose(_ref, _excluded); // new object required to prevent circular JSON structure error in <Debug /> | ||
@@ -120,3 +128,3 @@ | ||
| _debug = _ref2$_debug === void 0 ? undefined : _ref2$_debug, | ||
| styles = _objectWithoutPropertiesLoose(_ref2, ["_debug"]); // new object required to prevent circular JSON structure error in <Debug /> | ||
| styles = _objectWithoutPropertiesLoose(_ref2, _excluded2); // new object required to prevent circular JSON structure error in <Debug /> | ||
@@ -138,7 +146,7 @@ | ||
| debugA = _slotA._debug, | ||
| resolvedStylesA = _objectWithoutPropertiesLoose(_slotA, ["_debug"]); | ||
| resolvedStylesA = _objectWithoutPropertiesLoose(_slotA, _excluded3); | ||
| var _slotB = slotB(styleParam), | ||
| debugB = _slotB._debug, | ||
| resolvedStylesB = _objectWithoutPropertiesLoose(_slotB, ["_debug"]); | ||
| resolvedStylesB = _objectWithoutPropertiesLoose(_slotB, _excluded4); | ||
@@ -209,3 +217,3 @@ var merged = _merge(resolvedStylesA, resolvedStylesB); | ||
| _debug = _acc$_debug === void 0 ? [] : _acc$_debug, | ||
| accumulatedVariables = _objectWithoutPropertiesLoose(_acc, ["_debug"]); | ||
| accumulatedVariables = _objectWithoutPropertiesLoose(_acc, _excluded5); | ||
@@ -217,3 +225,3 @@ var _ref3 = callable(next)(siteVariables) || {}, | ||
| _debugId = _ref3$_debugId === void 0 ? undefined : _ref3$_debugId, | ||
| computedComponentVariables = _objectWithoutPropertiesLoose(_ref3, ["_debug", "_debugId"]); | ||
| computedComponentVariables = _objectWithoutPropertiesLoose(_ref3, _excluded6); | ||
@@ -265,3 +273,3 @@ var merged = deepmerge(accumulatedVariables, computedComponentVariables); | ||
| _debug = _acc$_debug2 === void 0 ? [] : _acc$_debug2, | ||
| accumulatedSiteVariables = _objectWithoutPropertiesLoose(acc, ["_debug"]); | ||
| accumulatedSiteVariables = _objectWithoutPropertiesLoose(acc, _excluded7); | ||
@@ -275,3 +283,3 @@ var _ref4 = next || {}, | ||
| _debugId = _ref4$_debugId === void 0 ? undefined : _ref4$_debugId, | ||
| nextSiteVariables = _objectWithoutPropertiesLoose(_ref4, ["_debug", "_invertedKeys", "_debugId"]); | ||
| nextSiteVariables = _objectWithoutPropertiesLoose(_ref4, _excluded8); | ||
@@ -278,0 +286,0 @@ var merged = deepmerge(Object.assign({}, accumulatedSiteVariables, { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["mergeThemes.ts"],"names":["callable","isEnabled","isDebugEnabled","deepmerge","objectKeyToValues","toCompactArray","withDebugId","emptyTheme","siteVariables","fontSizes","componentVariables","componentStyles","fontFaces","staticStyles","animations","mergeComponentStyles__PROD","stylesA","stylesB","result","Object","keys","forEach","partName","slotA","slotB","mergedStyleFunction","styleParam","mergeComponentStyles__DEV","mergedKeys","slotName","_debug","undefined","styles","debugId","_debugId","debugA","resolvedStylesA","debugB","resolvedStylesB","merged","concat","mergeComponentStyles","process","env","NODE_ENV","mergeComponentVariables__PROD","initial","sources","filteredSources","filter","Boolean","length","reduce","acc","next","mergeComponentVariables","accumulatedVariables","fn","computedComponentVariables","mergeComponentVariables__DEV","computedDebug","resolved","input","_invertedKeys","mergeSiteVariables__PROD","mergeSiteVariables__DEV","accumulatedSiteVariables","nextSiteVariables","key","mergeSiteVariables","mergeThemeVariables__PROD","displayNames","displayName","mergeThemeVariables__DEV","source","mergeThemeVariables","mergeThemeStyles","themeComponentStyles","stylesByPart","mergeFontFaces","mergeStaticStyles","mergeAnimations","assign","mergeStyles","args","mergeThemes","themes","nextDebugId"],"mappings":";;;;;;AAEA,SAASA,QAAT,QAAyB,YAAzB;AAoBA,SAASC,SAAS,IAAIC,cAAtB,QAA4C,gBAA5C;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,iBAAT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CAAClC,MAAP,CACL,UAACC,GAAD,EAAqBC,IAArB,EAA0C;AACxC,QAAI,CAACA,IAAL,EAAW,OAAOD,GAAP;AACX,QAAMkC,WAAW,GAAGjC,IAAI,CAAC,UAAD,CAAxB;AAEAD,IAAAA,GAAG,CAAC7C,aAAJ,GAAoB6D,kBAAkB,CAAChB,GAAG,CAAC7C,aAAL,EAAoBF,WAAW,CAACgD,IAAI,CAAC9C,aAAN,EAAqB+E,WAArB,CAA/B,CAAtC;AAEAlC,IAAAA,GAAG,CAAC3C,kBAAJ,GAAyBiE,mBAAmB,CAC1CtB,GAAG,CAAC3C,kBADsC,EAE1CJ,WAAW,CAACgD,IAAI,CAAC5C,kBAAN,EAA0B6E,WAA1B,CAF+B,CAA5C;AAKAlC,IAAAA,GAAG,CAAC1C,eAAJ,GAAsBiE,gBAAgB,CAACvB,GAAG,CAAC1C,eAAL,EAAsBL,WAAW,CAACgD,IAAI,CAAC3C,eAAN,EAAuB4E,WAAvB,CAAjC,CAAtC;AAEAlC,IAAAA,GAAG,CAACzC,SAAJ,GAAgBmE,cAAc,MAAd,SAAkB1B,GAAG,CAACzC,SAAtB,QAAqC0C,IAAI,CAAC1C,SAAL,IAAkB,EAAvD,EAAhB;AAEAyC,IAAAA,GAAG,CAACxC,YAAJ,GAAmBmE,iBAAiB,MAAjB,SAAqB3B,GAAG,CAACxC,YAAzB,QAA2CyC,IAAI,CAACzC,YAAL,IAAqB,EAAhE,EAAnB;AAEAwC,IAAAA,GAAG,CAACvC,UAAJ,GAAiBmE,eAAe,CAAC5B,GAAG,CAACvC,UAAL,EAAiBwC,IAAI,CAACxC,UAAtB,CAAhC;AAEA,WAAOuC,GAAP;AACD,GArBI,EAsBL;AAtBK,oBAuBA9C,UAvBA,EAAP;AAyBD,CA1BM","sourcesContent":["import * as _ from 'lodash';\n\nimport { callable } from './callable';\nimport {\n ComponentSlotStyle,\n ComponentSlotStylesInput,\n ComponentSlotStylesPrepared,\n ComponentVariablesInput,\n ComponentVariablesPrepared,\n FontFace,\n SiteVariablesInput,\n SiteVariablesPrepared,\n StaticStyle,\n ThemeAnimation,\n ThemeComponentStylesInput,\n ThemeComponentStylesPrepared,\n ThemeComponentVariablesInput,\n ThemeComponentVariablesPrepared,\n ThemeInput,\n ThemePrepared,\n} from './types';\n\nimport { isEnabled as isDebugEnabled } from './debugEnabled';\nimport { deepmerge } from './deepmerge';\nimport { objectKeyToValues } from './objectKeysToValues';\nimport { toCompactArray } from './toCompactArray';\nimport { withDebugId } from './withDebugId';\n\nexport const emptyTheme: ThemePrepared = {\n siteVariables: {\n fontSizes: {},\n },\n componentVariables: {},\n componentStyles: {},\n fontFaces: [],\n staticStyles: [],\n animations: {},\n};\n\n// ----------------------------------------\n// Component level merge functions\n// ----------------------------------------\n\n/**\n * Merges a single component's styles (keyed by component part) with another component's styles.\n */\nexport const mergeComponentStyles__PROD: typeof mergeComponentStyles = (stylesA, stylesB) => {\n const result = {};\n\n if (stylesA) {\n Object.keys(stylesA).forEach(partName => {\n const slotA = stylesA[partName];\n const slotB = stylesB?.[partName];\n\n // if there is no source, merging is a no-op, skip it\n if (typeof slotA === 'undefined' || slotA === null) {\n return;\n }\n\n // no target means source doesn't need to merge onto anything\n // just ensure source is callable (prepared format)\n if (typeof slotB === 'undefined' || slotB === null) {\n result[partName] = typeof slotA === 'function' ? slotA : () => slotA;\n return;\n }\n\n if (slotA === slotB) {\n result[partName] = typeof slotA === 'function' ? slotA : () => slotA;\n }\n });\n }\n\n if (stylesB) {\n Object.keys(stylesB).forEach(partName => {\n const slotA = stylesA?.[partName];\n const slotB = stylesB[partName];\n\n // if there is no source, merging is a no-op, skip it\n if (typeof slotB === 'undefined' || slotB === null) {\n return;\n }\n\n // no target means source doesn't need to merge onto anything\n // just ensure source is callable (prepared format)\n if (typeof slotA === 'undefined' || slotA === null) {\n result[partName] = typeof slotB === 'function' ? slotB : () => slotB;\n return;\n }\n\n if (slotA === slotB) {\n return;\n }\n\n // We have both target and source, replace with merge fn\n result[partName] = function mergedStyleFunction(styleParam) {\n // originalTarget is always prepared, fn is guaranteed\n return _.merge(\n typeof slotA === 'function' ? slotA(styleParam) : slotA,\n typeof slotB === 'function' ? slotB(styleParam) : slotB,\n );\n };\n });\n }\n\n return result;\n};\n\nexport const mergeComponentStyles__DEV: typeof mergeComponentStyles = (stylesA, stylesB) => {\n if (!isDebugEnabled) {\n return mergeComponentStyles__PROD(stylesA, stylesB);\n }\n\n const mergedKeys = [...(stylesA ? Object.keys(stylesA) : []), ...(stylesB ? Object.keys(stylesB) : [])];\n const result = {};\n\n mergedKeys.forEach(slotName => {\n const slotA = styleParam => {\n const { _debug = undefined, ...styles } = callable(stylesA?.[slotName])(styleParam) || {};\n\n // new object required to prevent circular JSON structure error in <Debug />\n return {\n ...styles,\n _debug: _debug || [{ styles: { ...styles }, debugId: stylesA._debugId }],\n };\n };\n\n const slotB = styleParam => {\n const { _debug = undefined, ...styles } = callable(stylesB?.[slotName])(styleParam) || {};\n\n // new object required to prevent circular JSON structure error in <Debug />\n return {\n ...styles,\n _debug: _debug || [{ styles: { ...styles }, debugId: stylesB._debugId }],\n };\n };\n\n if (stylesA?.[slotName] && stylesB?.[slotName]) {\n // We have both, replace with merge fn\n result[slotName] = styleParam => {\n // slot* are always prepared, fn is guaranteed, _debug always exists\n const { _debug: debugA, ...resolvedStylesA } = slotA(styleParam);\n const { _debug: debugB, ...resolvedStylesB } = slotB(styleParam);\n\n const merged = _.merge(resolvedStylesA, resolvedStylesB);\n\n merged._debug = debugA.concat(debugB || { styles: resolvedStylesB, debugId: resolvedStylesB._debugId });\n\n return merged;\n };\n } else if (stylesA?.[slotName]) {\n result[slotName] = slotA;\n } else if (stylesB?.[slotName]) {\n result[slotName] = slotB;\n }\n });\n\n return result;\n};\n\nexport const mergeComponentStyles: (\n stylesA: ComponentSlotStylesInput | null | undefined,\n stylesB: ComponentSlotStylesInput | null | undefined,\n) => ComponentSlotStylesPrepared =\n process.env.NODE_ENV === 'production' ? mergeComponentStyles__PROD : mergeComponentStyles__DEV;\n\n/**\n * Merges a single component's variables with another component's variables.\n */\nexport const mergeComponentVariables__PROD = (...sources: ComponentVariablesInput[]): ComponentVariablesPrepared => {\n const initial = () => ({});\n\n // filtering is required as some arguments can be undefined\n const filteredSources = sources.filter(Boolean);\n\n // a short circle to avoid calls of deepmerge()\n if (filteredSources.length === 1) {\n return typeof filteredSources[0] === 'function' ? filteredSources[0] : callable(filteredSources[0]);\n }\n\n return filteredSources.reduce<ComponentVariablesPrepared>((acc, next) => {\n return function mergeComponentVariables(...args) {\n const accumulatedVariables = acc(...args);\n const fn = typeof next === 'function' ? next : callable(next);\n const computedComponentVariables = fn(...args);\n\n return deepmerge(accumulatedVariables, computedComponentVariables);\n };\n }, initial);\n};\n\nexport const mergeComponentVariables__DEV = (...sources: ComponentVariablesInput[]): ComponentVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeComponentVariables__PROD(...sources);\n }\n const initial = () => ({});\n\n return sources.reduce<ComponentVariablesPrepared>((acc, next) => {\n return siteVariables => {\n const { _debug = [], ...accumulatedVariables } = acc(siteVariables);\n const { _debug: computedDebug = undefined, _debugId = undefined, ...computedComponentVariables } =\n callable(next)(siteVariables) || {};\n\n const merged = deepmerge(accumulatedVariables, computedComponentVariables);\n\n merged._debug = _debug.concat(\n computedDebug || {\n resolved: computedComponentVariables,\n debugId: _debugId,\n input: siteVariables\n ? siteVariables._invertedKeys && callable(next)(siteVariables._invertedKeys)\n : callable(next)(),\n },\n );\n return merged;\n };\n }, initial);\n};\n\nexport const mergeComponentVariables =\n process.env.NODE_ENV === 'production' ? mergeComponentVariables__PROD : mergeComponentVariables__DEV;\n\n// ----------------------------------------\n// Theme level merge functions\n// ----------------------------------------\n\n/**\n * Site variables can safely be merged at each Provider in the tree.\n * They are flat objects and do not depend on render-time values, such as props.\n */\nexport const mergeSiteVariables__PROD = (\n ...sources: (SiteVariablesInput | null | undefined)[]\n): SiteVariablesPrepared => {\n const initial: SiteVariablesPrepared = {\n fontSizes: {},\n };\n return deepmerge(initial, ...sources);\n};\n\nexport const mergeSiteVariables__DEV = (\n ...sources: (SiteVariablesInput | null | undefined)[]\n): SiteVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeSiteVariables__PROD(...sources);\n }\n\n const initial: SiteVariablesPrepared = {\n fontSizes: {},\n };\n\n return sources.reduce<SiteVariablesPrepared>((acc, next) => {\n const { _debug = [], ...accumulatedSiteVariables } = acc;\n const { _debug: computedDebug = undefined, _invertedKeys = undefined, _debugId = undefined, ...nextSiteVariables } =\n next || {};\n\n const merged = deepmerge({ ...accumulatedSiteVariables, _invertedKeys: undefined }, nextSiteVariables);\n merged._debug = _debug.concat(computedDebug || { resolved: nextSiteVariables, debugId: _debugId });\n merged._invertedKeys = _invertedKeys || objectKeyToValues(merged, key => `siteVariables.${key}`);\n return merged;\n }, initial);\n};\n\nexport const mergeSiteVariables =\n process.env.NODE_ENV === 'production' ? mergeSiteVariables__PROD : mergeSiteVariables__DEV;\n\n/**\n * Component variables can be objects, functions, or an array of these.\n * The functions must be called with the final result of siteVariables, otherwise\n * the component variable objects would have no ability to apply siteVariables.\n * Therefore, componentVariables must be resolved by the component at render time.\n * We instead pass down call stack of component variable functions to be resolved later.\n */\n\nexport const mergeThemeVariables__PROD = (\n ...sources: (ThemeComponentVariablesInput | null | undefined)[]\n): ThemeComponentVariablesPrepared => {\n const displayNames = _.union(..._.map(sources, _.keys));\n return displayNames.reduce((componentVariables, displayName) => {\n componentVariables[displayName] = mergeComponentVariables(..._.map(sources, displayName));\n return componentVariables;\n }, {});\n};\n\nexport const mergeThemeVariables__DEV = (\n ...sources: (ThemeComponentVariablesInput | null | undefined)[]\n): ThemeComponentVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeThemeVariables__PROD(...sources);\n }\n\n const displayNames = _.union(..._.map(sources, _.keys));\n return displayNames.reduce((componentVariables, displayName) => {\n componentVariables[displayName] = mergeComponentVariables(\n ..._.map(sources, source => source && withDebugId(source[displayName], source._debugId)),\n );\n return componentVariables;\n }, {});\n};\n\nexport const mergeThemeVariables =\n process.env.NODE_ENV === 'production' ? mergeThemeVariables__PROD : mergeThemeVariables__DEV;\n\n/**\n * See mergeThemeVariables() description.\n * Component styles adhere to the same pattern as component variables, except\n * that they return style objects.\n */\nexport const mergeThemeStyles = (\n ...sources: (ThemeComponentStylesInput | null | undefined)[]\n): ThemeComponentStylesPrepared => {\n const initial: ThemeComponentStylesPrepared = {};\n\n return sources.reduce<ThemeComponentStylesPrepared>((themeComponentStyles, next) => {\n _.forEach(next, (stylesByPart, displayName) => {\n themeComponentStyles[displayName] = mergeComponentStyles(\n themeComponentStyles[displayName],\n withDebugId(stylesByPart, (next as ThemeComponentStylesPrepared & { _debugId: string })._debugId),\n );\n });\n\n return themeComponentStyles;\n }, initial);\n};\n\nexport const mergeFontFaces = (...sources: FontFace[]) => {\n return toCompactArray<FontFace>(...sources);\n};\n\nexport const mergeStaticStyles = (...sources: StaticStyle[]) => {\n return toCompactArray<StaticStyle>(...sources);\n};\n\nexport const mergeAnimations = (...sources: { [key: string]: ThemeAnimation }[]): { [key: string]: ThemeAnimation } => {\n return Object.assign({}, ...sources);\n};\n\nexport const mergeStyles = (...sources: ComponentSlotStyle[]) => {\n return (...args) => {\n return sources.reduce((acc, next) => {\n return _.merge(acc, callable(next)(...args));\n }, {});\n };\n};\n\nexport const mergeThemes = (...themes: ThemeInput[]): ThemePrepared => {\n return themes.reduce<ThemePrepared>(\n (acc: ThemePrepared, next: ThemeInput) => {\n if (!next) return acc;\n const nextDebugId = next['_debugId'];\n\n acc.siteVariables = mergeSiteVariables(acc.siteVariables, withDebugId(next.siteVariables, nextDebugId));\n\n acc.componentVariables = mergeThemeVariables(\n acc.componentVariables,\n withDebugId(next.componentVariables, nextDebugId),\n );\n\n acc.componentStyles = mergeThemeStyles(acc.componentStyles, withDebugId(next.componentStyles, nextDebugId));\n\n acc.fontFaces = mergeFontFaces(...acc.fontFaces, ...(next.fontFaces || []));\n\n acc.staticStyles = mergeStaticStyles(...acc.staticStyles, ...(next.staticStyles || []));\n\n acc.animations = mergeAnimations(acc.animations, next.animations);\n\n return acc;\n },\n // .reduce() will modify \"emptyTheme\" object, so we should clone it before actual usage\n { ...emptyTheme },\n );\n};\n"],"file":"mergeThemes.js"} | ||
| {"version":3,"sources":["mergeThemes.ts"],"names":["callable","isEnabled","isDebugEnabled","deepmerge","objectKeyToValues","toCompactArray","withDebugId","emptyTheme","siteVariables","fontSizes","componentVariables","componentStyles","fontFaces","staticStyles","animations","mergeComponentStyles__PROD","stylesA","stylesB","result","Object","keys","forEach","partName","slotA","slotB","mergedStyleFunction","styleParam","mergeComponentStyles__DEV","mergedKeys","slotName","_debug","undefined","styles","debugId","_debugId","debugA","resolvedStylesA","debugB","resolvedStylesB","merged","concat","mergeComponentStyles","process","env","NODE_ENV","mergeComponentVariables__PROD","initial","sources","filteredSources","filter","Boolean","length","reduce","acc","next","mergeComponentVariables","accumulatedVariables","fn","computedComponentVariables","mergeComponentVariables__DEV","computedDebug","resolved","input","_invertedKeys","mergeSiteVariables__PROD","mergeSiteVariables__DEV","accumulatedSiteVariables","nextSiteVariables","key","mergeSiteVariables","mergeThemeVariables__PROD","displayNames","displayName","mergeThemeVariables__DEV","source","mergeThemeVariables","mergeThemeStyles","themeComponentStyles","stylesByPart","mergeFontFaces","mergeStaticStyles","mergeAnimations","assign","mergeStyles","args","mergeThemes","themes","nextDebugId"],"mappings":";;;;;;;;;;;;;;AAEA,SAASA,QAAT,QAAyB,YAAzB;AAoBA,SAASC,SAAS,IAAIC,cAAtB,QAA4C,gBAA5C;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,iBAAT,QAAkC,sBAAlC;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,WAAT,QAA4B,eAA5B;AAEA,OAAO,IAAMC,UAAyB,GAAG;AACvCC,EAAAA,aAAa,EAAE;AACbC,IAAAA,SAAS,EAAE;AADE,GADwB;AAIvCC,EAAAA,kBAAk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UAAD,CAAxB;AAEAD,IAAAA,GAAG,CAAC7C,aAAJ,GAAoB6D,kBAAkB,CAAChB,GAAG,CAAC7C,aAAL,EAAoBF,WAAW,CAACgD,IAAI,CAAC9C,aAAN,EAAqB+E,WAArB,CAA/B,CAAtC;AAEAlC,IAAAA,GAAG,CAAC3C,kBAAJ,GAAyBiE,mBAAmB,CAC1CtB,GAAG,CAAC3C,kBADsC,EAE1CJ,WAAW,CAACgD,IAAI,CAAC5C,kBAAN,EAA0B6E,WAA1B,CAF+B,CAA5C;AAKAlC,IAAAA,GAAG,CAAC1C,eAAJ,GAAsBiE,gBAAgB,CAACvB,GAAG,CAAC1C,eAAL,EAAsBL,WAAW,CAACgD,IAAI,CAAC3C,eAAN,EAAuB4E,WAAvB,CAAjC,CAAtC;AAEAlC,IAAAA,GAAG,CAACzC,SAAJ,GAAgBmE,cAAc,MAAd,SAAkB1B,GAAG,CAACzC,SAAtB,QAAqC0C,IAAI,CAAC1C,SAAL,IAAkB,EAAvD,EAAhB;AAEAyC,IAAAA,GAAG,CAACxC,YAAJ,GAAmBmE,iBAAiB,MAAjB,SAAqB3B,GAAG,CAACxC,YAAzB,QAA2CyC,IAAI,CAACzC,YAAL,IAAqB,EAAhE,EAAnB;AAEAwC,IAAAA,GAAG,CAACvC,UAAJ,GAAiBmE,eAAe,CAAC5B,GAAG,CAACvC,UAAL,EAAiBwC,IAAI,CAACxC,UAAtB,CAAhC;AAEA,WAAOuC,GAAP;AACD,GArBI,EAsBL;AAtBK,oBAuBA9C,UAvBA,EAAP;AAyBD,CA1BM","sourcesContent":["import * as _ from 'lodash';\n\nimport { callable } from './callable';\nimport {\n ComponentSlotStyle,\n ComponentSlotStylesInput,\n ComponentSlotStylesPrepared,\n ComponentVariablesInput,\n ComponentVariablesPrepared,\n FontFace,\n SiteVariablesInput,\n SiteVariablesPrepared,\n StaticStyle,\n ThemeAnimation,\n ThemeComponentStylesInput,\n ThemeComponentStylesPrepared,\n ThemeComponentVariablesInput,\n ThemeComponentVariablesPrepared,\n ThemeInput,\n ThemePrepared,\n} from './types';\n\nimport { isEnabled as isDebugEnabled } from './debugEnabled';\nimport { deepmerge } from './deepmerge';\nimport { objectKeyToValues } from './objectKeysToValues';\nimport { toCompactArray } from './toCompactArray';\nimport { withDebugId } from './withDebugId';\n\nexport const emptyTheme: ThemePrepared = {\n siteVariables: {\n fontSizes: {},\n },\n componentVariables: {},\n componentStyles: {},\n fontFaces: [],\n staticStyles: [],\n animations: {},\n};\n\n// ----------------------------------------\n// Component level merge functions\n// ----------------------------------------\n\n/**\n * Merges a single component's styles (keyed by component part) with another component's styles.\n */\nexport const mergeComponentStyles__PROD: typeof mergeComponentStyles = (stylesA, stylesB) => {\n const result = {};\n\n if (stylesA) {\n Object.keys(stylesA).forEach(partName => {\n const slotA = stylesA[partName];\n const slotB = stylesB?.[partName];\n\n // if there is no source, merging is a no-op, skip it\n if (typeof slotA === 'undefined' || slotA === null) {\n return;\n }\n\n // no target means source doesn't need to merge onto anything\n // just ensure source is callable (prepared format)\n if (typeof slotB === 'undefined' || slotB === null) {\n result[partName] = typeof slotA === 'function' ? slotA : () => slotA;\n return;\n }\n\n if (slotA === slotB) {\n result[partName] = typeof slotA === 'function' ? slotA : () => slotA;\n }\n });\n }\n\n if (stylesB) {\n Object.keys(stylesB).forEach(partName => {\n const slotA = stylesA?.[partName];\n const slotB = stylesB[partName];\n\n // if there is no source, merging is a no-op, skip it\n if (typeof slotB === 'undefined' || slotB === null) {\n return;\n }\n\n // no target means source doesn't need to merge onto anything\n // just ensure source is callable (prepared format)\n if (typeof slotA === 'undefined' || slotA === null) {\n result[partName] = typeof slotB === 'function' ? slotB : () => slotB;\n return;\n }\n\n if (slotA === slotB) {\n return;\n }\n\n // We have both target and source, replace with merge fn\n result[partName] = function mergedStyleFunction(styleParam) {\n // originalTarget is always prepared, fn is guaranteed\n return _.merge(\n typeof slotA === 'function' ? slotA(styleParam) : slotA,\n typeof slotB === 'function' ? slotB(styleParam) : slotB,\n );\n };\n });\n }\n\n return result;\n};\n\nexport const mergeComponentStyles__DEV: typeof mergeComponentStyles = (stylesA, stylesB) => {\n if (!isDebugEnabled) {\n return mergeComponentStyles__PROD(stylesA, stylesB);\n }\n\n const mergedKeys = [...(stylesA ? Object.keys(stylesA) : []), ...(stylesB ? Object.keys(stylesB) : [])];\n const result = {};\n\n mergedKeys.forEach(slotName => {\n const slotA = styleParam => {\n const { _debug = undefined, ...styles } = callable(stylesA?.[slotName])(styleParam) || {};\n\n // new object required to prevent circular JSON structure error in <Debug />\n return {\n ...styles,\n _debug: _debug || [{ styles: { ...styles }, debugId: stylesA._debugId }],\n };\n };\n\n const slotB = styleParam => {\n const { _debug = undefined, ...styles } = callable(stylesB?.[slotName])(styleParam) || {};\n\n // new object required to prevent circular JSON structure error in <Debug />\n return {\n ...styles,\n _debug: _debug || [{ styles: { ...styles }, debugId: stylesB._debugId }],\n };\n };\n\n if (stylesA?.[slotName] && stylesB?.[slotName]) {\n // We have both, replace with merge fn\n result[slotName] = styleParam => {\n // slot* are always prepared, fn is guaranteed, _debug always exists\n const { _debug: debugA, ...resolvedStylesA } = slotA(styleParam);\n const { _debug: debugB, ...resolvedStylesB } = slotB(styleParam);\n\n const merged = _.merge(resolvedStylesA, resolvedStylesB);\n\n merged._debug = debugA.concat(debugB || { styles: resolvedStylesB, debugId: resolvedStylesB._debugId });\n\n return merged;\n };\n } else if (stylesA?.[slotName]) {\n result[slotName] = slotA;\n } else if (stylesB?.[slotName]) {\n result[slotName] = slotB;\n }\n });\n\n return result;\n};\n\nexport const mergeComponentStyles: (\n stylesA: ComponentSlotStylesInput | null | undefined,\n stylesB: ComponentSlotStylesInput | null | undefined,\n) => ComponentSlotStylesPrepared =\n process.env.NODE_ENV === 'production' ? mergeComponentStyles__PROD : mergeComponentStyles__DEV;\n\n/**\n * Merges a single component's variables with another component's variables.\n */\nexport const mergeComponentVariables__PROD = (...sources: ComponentVariablesInput[]): ComponentVariablesPrepared => {\n const initial = () => ({});\n\n // filtering is required as some arguments can be undefined\n const filteredSources = sources.filter(Boolean);\n\n // a short circle to avoid calls of deepmerge()\n if (filteredSources.length === 1) {\n return typeof filteredSources[0] === 'function' ? filteredSources[0] : callable(filteredSources[0]);\n }\n\n return filteredSources.reduce<ComponentVariablesPrepared>((acc, next) => {\n return function mergeComponentVariables(...args) {\n const accumulatedVariables = acc(...args);\n const fn = typeof next === 'function' ? next : callable(next);\n const computedComponentVariables = fn(...args);\n\n return deepmerge(accumulatedVariables, computedComponentVariables);\n };\n }, initial);\n};\n\nexport const mergeComponentVariables__DEV = (...sources: ComponentVariablesInput[]): ComponentVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeComponentVariables__PROD(...sources);\n }\n const initial = () => ({});\n\n return sources.reduce<ComponentVariablesPrepared>((acc, next) => {\n return siteVariables => {\n const { _debug = [], ...accumulatedVariables } = acc(siteVariables);\n const { _debug: computedDebug = undefined, _debugId = undefined, ...computedComponentVariables } =\n callable(next)(siteVariables) || {};\n\n const merged = deepmerge(accumulatedVariables, computedComponentVariables);\n\n merged._debug = _debug.concat(\n computedDebug || {\n resolved: computedComponentVariables,\n debugId: _debugId,\n input: siteVariables\n ? siteVariables._invertedKeys && callable(next)(siteVariables._invertedKeys)\n : callable(next)(),\n },\n );\n return merged;\n };\n }, initial);\n};\n\nexport const mergeComponentVariables =\n process.env.NODE_ENV === 'production' ? mergeComponentVariables__PROD : mergeComponentVariables__DEV;\n\n// ----------------------------------------\n// Theme level merge functions\n// ----------------------------------------\n\n/**\n * Site variables can safely be merged at each Provider in the tree.\n * They are flat objects and do not depend on render-time values, such as props.\n */\nexport const mergeSiteVariables__PROD = (\n ...sources: (SiteVariablesInput | null | undefined)[]\n): SiteVariablesPrepared => {\n const initial: SiteVariablesPrepared = {\n fontSizes: {},\n };\n return deepmerge(initial, ...sources);\n};\n\nexport const mergeSiteVariables__DEV = (\n ...sources: (SiteVariablesInput | null | undefined)[]\n): SiteVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeSiteVariables__PROD(...sources);\n }\n\n const initial: SiteVariablesPrepared = {\n fontSizes: {},\n };\n\n return sources.reduce<SiteVariablesPrepared>((acc, next) => {\n const { _debug = [], ...accumulatedSiteVariables } = acc;\n const { _debug: computedDebug = undefined, _invertedKeys = undefined, _debugId = undefined, ...nextSiteVariables } =\n next || {};\n\n const merged = deepmerge({ ...accumulatedSiteVariables, _invertedKeys: undefined }, nextSiteVariables);\n merged._debug = _debug.concat(computedDebug || { resolved: nextSiteVariables, debugId: _debugId });\n merged._invertedKeys = _invertedKeys || objectKeyToValues(merged, key => `siteVariables.${key}`);\n return merged;\n }, initial);\n};\n\nexport const mergeSiteVariables =\n process.env.NODE_ENV === 'production' ? mergeSiteVariables__PROD : mergeSiteVariables__DEV;\n\n/**\n * Component variables can be objects, functions, or an array of these.\n * The functions must be called with the final result of siteVariables, otherwise\n * the component variable objects would have no ability to apply siteVariables.\n * Therefore, componentVariables must be resolved by the component at render time.\n * We instead pass down call stack of component variable functions to be resolved later.\n */\n\nexport const mergeThemeVariables__PROD = (\n ...sources: (ThemeComponentVariablesInput | null | undefined)[]\n): ThemeComponentVariablesPrepared => {\n const displayNames = _.union(..._.map(sources, _.keys));\n return displayNames.reduce((componentVariables, displayName) => {\n componentVariables[displayName] = mergeComponentVariables(..._.map(sources, displayName));\n return componentVariables;\n }, {});\n};\n\nexport const mergeThemeVariables__DEV = (\n ...sources: (ThemeComponentVariablesInput | null | undefined)[]\n): ThemeComponentVariablesPrepared => {\n if (!isDebugEnabled) {\n return mergeThemeVariables__PROD(...sources);\n }\n\n const displayNames = _.union(..._.map(sources, _.keys));\n return displayNames.reduce((componentVariables, displayName) => {\n componentVariables[displayName] = mergeComponentVariables(\n ..._.map(sources, source => source && withDebugId(source[displayName], source._debugId)),\n );\n return componentVariables;\n }, {});\n};\n\nexport const mergeThemeVariables =\n process.env.NODE_ENV === 'production' ? mergeThemeVariables__PROD : mergeThemeVariables__DEV;\n\n/**\n * See mergeThemeVariables() description.\n * Component styles adhere to the same pattern as component variables, except\n * that they return style objects.\n */\nexport const mergeThemeStyles = (\n ...sources: (ThemeComponentStylesInput | null | undefined)[]\n): ThemeComponentStylesPrepared => {\n const initial: ThemeComponentStylesPrepared = {};\n\n return sources.reduce<ThemeComponentStylesPrepared>((themeComponentStyles, next) => {\n _.forEach(next, (stylesByPart, displayName) => {\n themeComponentStyles[displayName] = mergeComponentStyles(\n themeComponentStyles[displayName],\n withDebugId(stylesByPart, (next as ThemeComponentStylesPrepared & { _debugId: string })._debugId),\n );\n });\n\n return themeComponentStyles;\n }, initial);\n};\n\nexport const mergeFontFaces = (...sources: FontFace[]) => {\n return toCompactArray<FontFace>(...sources);\n};\n\nexport const mergeStaticStyles = (...sources: StaticStyle[]) => {\n return toCompactArray<StaticStyle>(...sources);\n};\n\nexport const mergeAnimations = (...sources: { [key: string]: ThemeAnimation }[]): { [key: string]: ThemeAnimation } => {\n return Object.assign({}, ...sources);\n};\n\nexport const mergeStyles = (...sources: ComponentSlotStyle[]) => {\n return (...args) => {\n return sources.reduce((acc, next) => {\n return _.merge(acc, callable(next)(...args));\n }, {});\n };\n};\n\nexport const mergeThemes = (...themes: ThemeInput[]): ThemePrepared => {\n return themes.reduce<ThemePrepared>(\n (acc: ThemePrepared, next: ThemeInput) => {\n if (!next) return acc;\n const nextDebugId = next['_debugId'];\n\n acc.siteVariables = mergeSiteVariables(acc.siteVariables, withDebugId(next.siteVariables, nextDebugId));\n\n acc.componentVariables = mergeThemeVariables(\n acc.componentVariables,\n withDebugId(next.componentVariables, nextDebugId),\n );\n\n acc.componentStyles = mergeThemeStyles(acc.componentStyles, withDebugId(next.componentStyles, nextDebugId));\n\n acc.fontFaces = mergeFontFaces(...acc.fontFaces, ...(next.fontFaces || []));\n\n acc.staticStyles = mergeStaticStyles(...acc.staticStyles, ...(next.staticStyles || []));\n\n acc.animations = mergeAnimations(acc.animations, next.animations);\n\n return acc;\n },\n // .reduce() will modify \"emptyTheme\" object, so we should clone it before actual usage\n { ...emptyTheme },\n );\n};\n"],"file":"mergeThemes.js"} |
+1
-1
@@ -1,2 +0,2 @@ | ||
| export {}; | ||
| //# sourceMappingURL=types.js.map |
+2
-2
| { | ||
| "name": "@fluentui/styles", | ||
| "description": "A set of styling utilities for CSS-in-JS.", | ||
| "version": "0.57.0", | ||
| "version": "0.58.0", | ||
| "author": "Marija Najdova <mnajdova@gmail.com>", | ||
@@ -40,3 +40,3 @@ "bugs": "https://github.com/microsoft/fluentui/issues", | ||
| "types": "dist/es/index.d.ts", | ||
| "gitHead": "9ed48c7056dc8f76437c210040943dbd022e9980" | ||
| "gitHead": "f5084ca3629238483468ae59061a8435bb5d9f21" | ||
| } |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
311223
0.18%3300
0.55%