How to use the @uifabric/merge-styles.mergeCssSets function in @uifabric/merge-styles

To help you get started, we’ve selected a few @uifabric/merge-styles examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OfficeDev / office-ui-fabric-react / packages / utilities / src / classNamesFunction.ts View on Github external
if (currentMemoizedClassNames !== _memoizedClassNames) {
      currentMemoizedClassNames = _memoizedClassNames;
      map = new Map();
      resultCount = 0;
    }

    if (!options.disableCaching) {
      current = _traverseMap(map, styleFunctionOrObject as any);
      current = _traverseMap(current, styleProps);
    }

    if (disableCaching || !(current as any)[RetVal]) {
      if (styleFunctionOrObject === undefined) {
        (current as any)[RetVal] = {} as IProcessedStyleSet;
      } else {
        (current as any)[RetVal] = mergeCssSets(
          [
            (typeof styleFunctionOrObject === 'function' ? styleFunctionOrObject(styleProps) : styleFunctionOrObject) as IStyleSet<
              TStyleSet
            >
          ],
          { rtl: !!rtl }
        );
      }

      if (!disableCaching) {
        resultCount++;
      }
    }

    if (resultCount > MAX_CACHE_COUNT) {
      map.clear();