@stylexjs/stylex 0.7.4 → 0.8.0

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.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.styleSheet = exports.StyleXSheet = void 0;
7
7
  var _invariant = _interopRequireDefault(require("invariant"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  const LIGHT_MODE_CLASS_NAME = '__fb-light-mode';
10
10
  const DARK_MODE_CLASS_NAME = '__fb-dark-mode';
11
11
  function buildTheme(selector, theme) {
@@ -32,8 +32,8 @@ function doesSupportCSSVariables() {
32
32
  }
33
33
  const VARIABLE_MATCH = /var\(--(.*?)\)/g;
34
34
  class StyleXSheet {
35
- static LIGHT_MODE_CLASS_NAME = LIGHT_MODE_CLASS_NAME;
36
- static DARK_MODE_CLASS_NAME = DARK_MODE_CLASS_NAME;
35
+ static LIGHT_MODE_CLASS_NAME = (() => LIGHT_MODE_CLASS_NAME)();
36
+ static DARK_MODE_CLASS_NAME = (() => DARK_MODE_CLASS_NAME)();
37
37
  constructor(opts) {
38
38
  this.tag = null;
39
39
  this.injected = false;
@@ -123,6 +123,9 @@ class StyleXSheet {
123
123
  return this.getRuleCount();
124
124
  }
125
125
  const lastPriority = priorities.pop();
126
+ if (lastPriority == null) {
127
+ return this.getRuleCount();
128
+ }
126
129
  return this.rules.indexOf(this.ruleForPriority.get(lastPriority));
127
130
  }
128
131
  insert(rawLTRRule, priority, rawRTLRule) {
@@ -80,8 +80,8 @@ function doesSupportCSSVariables() {
80
80
  }
81
81
  const VARIABLE_MATCH = /var\(--(.*?)\)/g;
82
82
  class StyleXSheet {
83
- static LIGHT_MODE_CLASS_NAME = LIGHT_MODE_CLASS_NAME;
84
- static DARK_MODE_CLASS_NAME = DARK_MODE_CLASS_NAME;
83
+ static LIGHT_MODE_CLASS_NAME = (() => LIGHT_MODE_CLASS_NAME)();
84
+ static DARK_MODE_CLASS_NAME = (() => DARK_MODE_CLASS_NAME)();
85
85
  constructor(opts) {
86
86
  this.tag = null;
87
87
  this.injected = false;
@@ -171,6 +171,9 @@ class StyleXSheet {
171
171
  return this.getRuleCount();
172
172
  }
173
173
  const lastPriority = priorities.pop();
174
+ if (lastPriority == null) {
175
+ return this.getRuleCount();
176
+ }
174
177
  return this.rules.indexOf(this.ruleForPriority.get(lastPriority));
175
178
  }
176
179
  insert(rawLTRRule, priority, rawRTLRule) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/stylex",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": "A library for defining styles for optimized user interfaces.",
5
5
  "main": "./lib/stylex.js",
6
6
  "module": "./lib/es/stylex.mjs",
@@ -45,7 +45,7 @@
45
45
  "styleq": "0.1.3"
46
46
  },
47
47
  "devDependencies": {
48
- "@stylexjs/scripts": "0.7.4",
48
+ "@stylexjs/scripts": "0.8.0",
49
49
  "cross-env": "^7.0.3"
50
50
  },
51
51
  "jest": {},