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.

34 lines
988 B

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