parseObjectStyles.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. Object.defineProperty(exports, "default", {
  6. enumerable: true,
  7. get: function() {
  8. return parseObjectStyles;
  9. }
  10. });
  11. const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
  12. const _postcssnested = /*#__PURE__*/ _interop_require_default(require("postcss-nested"));
  13. const _postcssjs = /*#__PURE__*/ _interop_require_default(require("postcss-js"));
  14. function _interop_require_default(obj) {
  15. return obj && obj.__esModule ? obj : {
  16. default: obj
  17. };
  18. }
  19. function parseObjectStyles(styles) {
  20. if (!Array.isArray(styles)) {
  21. return parseObjectStyles([
  22. styles
  23. ]);
  24. }
  25. return styles.flatMap((style)=>{
  26. return (0, _postcss.default)([
  27. (0, _postcssnested.default)({
  28. bubble: [
  29. "screen"
  30. ]
  31. })
  32. ]).process(style, {
  33. parser: _postcssjs.default
  34. }).root.nodes;
  35. });
  36. }