storybook-addon-pseudo-states 1.12.0 → 1.14.1

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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,17 @@
1
- # v1.0.0 (Mon May 23 2022)
1
+ # v1.14.1 (Wed Jun 15 2022)
2
+
3
+ #### ⚠️ Pushed to `main`
4
+
5
+ - Fix toolbar toggles ([@ghengeveld](https://github.com/ghengeveld))
6
+ - Upgrade Storybook ([@ghengeveld](https://github.com/ghengeveld))
7
+
8
+ #### Authors: 1
9
+
10
+ - Gert Hengeveld ([@ghengeveld](https://github.com/ghengeveld))
11
+
12
+ ---
13
+
14
+ # v1.0.0 (Tue May 24 2022)
2
15
 
3
16
  #### 🚀 Enhancement
4
17
 
@@ -7,6 +20,8 @@
7
20
 
8
21
  #### 🐛 Bug Fix
9
22
 
23
+ - fix: only generate pseudo selector when the selector has a match [#30](https://github.com/chromaui/storybook-addon-pseudo-states/pull/30) ([@tobi-or-not-tobi](https://github.com/tobi-or-not-tobi) [@ghengeveld](https://github.com/ghengeveld))
24
+ - Use personal access token to be able to push to main ([@ghengeveld](https://github.com/ghengeveld))
10
25
  - fix: Resolve crash for stories that use internal State [#28](https://github.com/chromaui/storybook-addon-pseudo-states/pull/28) (david.maulick@coinbase.com)
11
26
  - Fix CSS selector splitting [#24](https://github.com/chromaui/storybook-addon-pseudo-states/pull/24) ([@ilanus](https://github.com/ilanus) [@ghengeveld](https://github.com/ghengeveld))
12
27
  - Add support for slotted lit elements [#23](https://github.com/chromaui/storybook-addon-pseudo-states/pull/23) ([@ilanus](https://github.com/ilanus))
@@ -14,7 +29,7 @@
14
29
 
15
30
  #### ⚠️ Pushed to `main`
16
31
 
17
- - Use personal access token to be able to push to main ([@ghengeveld](https://github.com/ghengeveld))
32
+ - Update config to checkout repo using personal access token ([@ghengeveld](https://github.com/ghengeveld))
18
33
  - Use chromatic@next ([@ghengeveld](https://github.com/ghengeveld))
19
34
  - [skip release] Revert back to disabling CustomElement stories ([@ghengeveld](https://github.com/ghengeveld))
20
35
  - Another attempt at dealing with IE ([@ghengeveld](https://github.com/ghengeveld))
@@ -27,12 +42,13 @@
27
42
  - Upgrade Storybook ([@ghengeveld](https://github.com/ghengeveld))
28
43
  - Ignore .env file ([@ghengeveld](https://github.com/ghengeveld))
29
44
 
30
- #### Authors: 4
45
+ #### Authors: 5
31
46
 
32
47
  - David Maulick ([@dmaulick](https://github.com/dmaulick))
33
48
  - Gert Hengeveld ([@ghengeveld](https://github.com/ghengeveld))
34
49
  - Ilan ([@ilanus](https://github.com/ilanus))
35
50
  - Jeroen Zwartepoorte ([@jpzwarte](https://github.com/jpzwarte))
51
+ - tobi-or-not-tobi ([@tobi-or-not-tobi](https://github.com/tobi-or-not-tobi))
36
52
 
37
53
  ---
38
54
 
@@ -120,13 +120,13 @@ var withPseudoState = function withPseudoState(StoryFn, _ref5) {
120
120
  (0, _addons.useEffect)(function () {
121
121
  var timeout = setTimeout(function () {
122
122
  var element = document.getElementById(viewMode === "docs" ? "story--".concat(id) : "root");
123
- applyParameter(element, parameter);
123
+ applyParameter(element, globals);
124
124
  shadowHosts.forEach(updateShadowHost);
125
125
  }, 0);
126
126
  return function () {
127
127
  return clearTimeout(timeout);
128
128
  };
129
- }, [parameter, viewMode]);
129
+ }, [globals, viewMode]);
130
130
  return StoryFn();
131
131
  };
132
132
 
@@ -183,6 +183,10 @@ function rewriteStyleSheets(shadowRoot) {
183
183
  });
184
184
  var stateSelector;
185
185
 
186
+ if (!matchOne.test(selector)) {
187
+ return [selector];
188
+ }
189
+
186
190
  if (selector.startsWith(":host(") || selector.startsWith("::slotted(")) {
187
191
  stateSelector = states.reduce(function (acc, state) {
188
192
  return acc.replaceAll(":".concat(state), ".pseudo-".concat(state));
@@ -29,7 +29,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
29
29
  /* eslint-env browser */
30
30
  import { addons, useEffect } from "@storybook/addons";
31
31
  import { DOCS_RENDERED, STORY_CHANGED, STORY_RENDERED } from "@storybook/core-events";
32
- import { UPDATE_GLOBALS } from '@storybook/core-events';
32
+ import { UPDATE_GLOBALS } from "@storybook/core-events";
33
33
  import { PSEUDO_STATES } from "./constants";
34
34
  import { splitSelectors } from "./splitSelectors";
35
35
  var pseudoStates = Object.values(PSEUDO_STATES);
@@ -107,13 +107,13 @@ export var withPseudoState = function withPseudoState(StoryFn, _ref5) {
107
107
  useEffect(function () {
108
108
  var timeout = setTimeout(function () {
109
109
  var element = document.getElementById(viewMode === "docs" ? "story--".concat(id) : "root");
110
- applyParameter(element, parameter);
110
+ applyParameter(element, globals);
111
111
  shadowHosts.forEach(updateShadowHost);
112
112
  }, 0);
113
113
  return function () {
114
114
  return clearTimeout(timeout);
115
115
  };
116
- }, [parameter, viewMode]);
116
+ }, [globals, viewMode]);
117
117
  return StoryFn();
118
118
  };
119
119
  var warnings = new Set();
@@ -168,6 +168,10 @@ function rewriteStyleSheets(shadowRoot) {
168
168
  });
169
169
  var stateSelector;
170
170
 
171
+ if (!matchOne.test(selector)) {
172
+ return [selector];
173
+ }
174
+
171
175
  if (selector.startsWith(":host(") || selector.startsWith("::slotted(")) {
172
176
  stateSelector = states.reduce(function (acc, state) {
173
177
  return acc.replaceAll(":".concat(state), ".pseudo-".concat(state));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-addon-pseudo-states",
3
- "version": "1.12.0",
3
+ "version": "1.14.1",
4
4
  "description": "CSS pseudo states for Storybook",
5
5
  "keywords": [
6
6
  "storybook-addons",
@@ -38,8 +38,8 @@
38
38
  "@babel/core": "^7.12.3",
39
39
  "@babel/preset-env": "^7.12.1",
40
40
  "@babel/preset-react": "^7.12.5",
41
- "@storybook/addon-docs": "^6.4.19",
42
- "@storybook/react": "^6.4.19",
41
+ "@storybook/addon-docs": "^6.5.0",
42
+ "@storybook/react": "^6.5.0",
43
43
  "auto": "^10.16.8",
44
44
  "babel-loader": "^8.1.0",
45
45
  "chromatic": "^5.6.0",
@@ -50,11 +50,11 @@
50
50
  "rimraf": "^3.0.2"
51
51
  },
52
52
  "peerDependencies": {
53
- "@storybook/addons": "^6.4.19",
54
- "@storybook/api": "^6.4.19",
55
- "@storybook/components": "^6.4.19",
56
- "@storybook/core-events": "^6.4.19",
57
- "@storybook/theming": "^6.4.19",
53
+ "@storybook/addons": "^6.5.0",
54
+ "@storybook/api": "^6.5.0",
55
+ "@storybook/components": "^6.5.0",
56
+ "@storybook/core-events": "^6.5.0",
57
+ "@storybook/theming": "^6.5.0",
58
58
  "react": "^16.8.0 || ^17.0.0",
59
59
  "react-dom": "^16.8.0 || ^17.0.0"
60
60
  },