chromaui / storybook-addon-pseudo-states

CSS pseudo-classes for Storybook
MIT License
89 stars 28 forks source link

Attempted to set a global (pseudo) that is not defined in initial globals or globalTypes #59

Closed sgoodluck closed 1 year ago

sgoodluck commented 1 year ago

When spinning up storybook 7.0.0 (beta) I'm unable to use this package successfully. Any attempt to use the menu results in the above console output.

Would love any recommendations!

richbachman commented 1 year ago

Any updates on this one? I'm also running into the same error. I'm also seeing this in the below in the console. Maybe its helpful.

preview.mjs:55 Reached maximum of 1000 pseudo selectors per sheet, skipping the rest.
axe.js:11387 Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently
srMarquinho commented 1 year ago

I've managed to get it working defining pseudo as a global type:

// preview.ts/js
const preview: Preview = {
  globalTypes: {
    pseudo: {}
  },
  ...
};
export default preview;
richbachman commented 1 year ago

@srMarquinho tried that approach with luck. I do have a different error now:

Uncaught TypeError: Cannot read properties of null (reading 'className')
    at applyClasses (withPseudoState.js:12:1)
    at withPseudoState.js:33:1
    at Map.forEach (<anonymous>)
    at applyParameter (withPseudoState.js:30:1)
    at withPseudoState.js:80:1
srMarquinho commented 1 year ago

@srMarquinho tried that approach with luck. I do have a different error now:

Uncaught TypeError: Cannot read properties of null (reading 'className')
    at applyClasses (withPseudoState.js:12:1)
    at withPseudoState.js:33:1
    at Map.forEach (<anonymous>)
    at applyParameter (withPseudoState.js:30:1)
    at withPseudoState.js:80:1

@richbachman Unfortunately I did not see that. I'm on:

"storybook": "^7.0.0-rc.10",
"storybook-addon-pseudo-states": "^2.0.0-next.3",
richbachman commented 1 year ago

@srMarquinho the 2.0.0-next.3 version was the ticket. Thanks for the tip!

R-Lek commented 1 year ago

It works with version 2.0.1 now as well. Kudos to @srMarquinho, I was stumped with this error until I found this issue.

Sidnioulz commented 1 year ago

Just to clarify, the warning is still being shown. If any add-on author knows how to register globals from within add-on code, could you please provide an example?

Sidnioulz commented 1 year ago

Looks like this issue can be closed! Thanks @yasnbouz for writing a fix!