Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.cjs.dev.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var isBrowser = typeof document !== 'undefined';
  4. function getRegisteredStyles(registered, registeredStyles, classNames) {
  5. var rawClassName = '';
  6. classNames.split(' ').forEach(function (className) {
  7. if (registered[className] !== undefined) {
  8. registeredStyles.push(registered[className]);
  9. } else {
  10. rawClassName += className + " ";
  11. }
  12. });
  13. return rawClassName;
  14. }
  15. var insertStyles = function insertStyles(cache, serialized, isStringTag) {
  16. var className = cache.key + "-" + serialized.name;
  17. if ( // we only need to add the styles to the registered cache if the
  18. // class name could be used further down
  19. // the tree but if it's a string tag, we know it won't
  20. // so we don't have to add it to registered cache.
  21. // this improves memory usage since we can avoid storing the whole style string
  22. (isStringTag === false || // we need to always store it if we're in compat mode and
  23. // in node since emotion-server relies on whether a style is in
  24. // the registered cache to know whether a style is global or not
  25. // also, note that this check will be dead code eliminated in the browser
  26. isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
  27. cache.registered[className] = serialized.styles;
  28. }
  29. if (cache.inserted[serialized.name] === undefined) {
  30. var stylesForSSR = '';
  31. var current = serialized;
  32. do {
  33. var maybeStyles = cache.insert("." + className, current, cache.sheet, true);
  34. if (!isBrowser && maybeStyles !== undefined) {
  35. stylesForSSR += maybeStyles;
  36. }
  37. current = current.next;
  38. } while (current !== undefined);
  39. if (!isBrowser && stylesForSSR.length !== 0) {
  40. return stylesForSSR;
  41. }
  42. }
  43. };
  44. exports.getRegisteredStyles = getRegisteredStyles;
  45. exports.insertStyles = insertStyles;