@byteluck-fe/model-driven-engine 3.0.0-beta.7 → 3.0.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,8 @@ function _define_property(obj, key, value) {
36
36
  }
37
37
  return obj;
38
38
  }
39
+ import postcss from 'postcss';
40
+ import prefixSelector from 'postcss-prefix-selector';
39
41
  export var StylePlugin = /*#__PURE__*/ function() {
40
42
  "use strict";
41
43
  function StylePlugin(config) {
@@ -51,7 +53,7 @@ export var StylePlugin = /*#__PURE__*/ function() {
51
53
  {
52
54
  key: "apply",
53
55
  value: function apply(engine) {
54
- var _this_config;
56
+ var _this_config, _this_engine;
55
57
  this.engine = engine;
56
58
  var _this_config_source;
57
59
  var compiledStyle = (_this_config_source = (_this_config = this.config) === null || _this_config === void 0 ? void 0 : _this_config.source) !== null && _this_config_source !== void 0 ? _this_config_source : '';
@@ -59,12 +61,11 @@ export var StylePlugin = /*#__PURE__*/ function() {
59
61
  style.className = 'edit-css-' + engine.id;
60
62
  var dom = document.querySelector('head');
61
63
  dom === null || dom === void 0 ? void 0 : dom.appendChild(style);
62
- var cssStyleText;
63
- if (this.isPc) {
64
- cssStyleText = ".render-engine-".concat(engine.id, "{ ").concat(compiledStyle, " }");
65
- } else {
66
- cssStyleText = compiledStyle;
67
- }
64
+ var cssStyleText = postcss([
65
+ prefixSelector({
66
+ prefix: ".render-engine-".concat((_this_engine = this.engine) === null || _this_engine === void 0 ? void 0 : _this_engine.id)
67
+ })
68
+ ]).process(compiledStyle).css;
68
69
  style.appendChild(document.createTextNode(cssStyleText));
69
70
  }
70
71
  }