In storybook 8.3, the globals api was introduced. This seems like the perfect api to reduce the complexity of this addon.
A sketch of what I'm thinking:
Make a new global called "addon-rtl"
I think this is a better name than "direction" since it's more clearly related to our addon
Keep the existing icon button in the toolbar, and call setGlobal when it's toggled. Should we disable the button when a global is set at the story level, like the built-in global toolbar items?
For compatibility, we should try to continue to respect url params, events, and story parameters. Maybe keep track of "eventsState" and give that priority over other state. I don't think we should do anything special to support the case where both story parameters and globals are provided.
In storybook 8.3, the globals api was introduced. This seems like the perfect api to reduce the complexity of this addon.
A sketch of what I'm thinking: