index.d.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { FC } from 'react';
  2. declare global {
  3. interface SymbolConstructor {
  4. readonly observable: symbol;
  5. }
  6. }
  7. type Addon_Types = Exclude<Addon_TypesEnum, Addon_TypesEnum.experimental_PAGE | Addon_TypesEnum.experimental_SIDEBAR_BOTTOM | Addon_TypesEnum.experimental_SIDEBAR_TOP>;
  8. declare enum Addon_TypesEnum {
  9. /**
  10. * This API is used to create a tab the toolbar above the canvas, This API might be removed in the future.
  11. * @unstable
  12. */
  13. TAB = "tab",
  14. /**
  15. * This adds panels to the addons side panel.
  16. */
  17. PANEL = "panel",
  18. /**
  19. * This adds items in the toolbar above the canvas - on the left side.
  20. */
  21. TOOL = "tool",
  22. /**
  23. * This adds items in the toolbar above the canvas - on the right side.
  24. */
  25. TOOLEXTRA = "toolextra",
  26. /**
  27. * This adds wrapper components around the canvas/iframe component storybook renders.
  28. * @unstable this API is not stable yet, and is likely to change in 8.0.
  29. */
  30. PREVIEW = "preview",
  31. /**
  32. * This adds pages that render instead of the canvas.
  33. * @unstable
  34. */
  35. experimental_PAGE = "page",
  36. /**
  37. * This adds items in the bottom of the sidebar.
  38. * @unstable
  39. */
  40. experimental_SIDEBAR_BOTTOM = "sidebar-bottom",
  41. /**
  42. * This adds items in the top of the sidebar.
  43. * @unstable This will get replaced with a new API in 8.0, use at your own risk.
  44. */
  45. experimental_SIDEBAR_TOP = "sidebar-top",
  46. /**
  47. * @deprecated This property does nothing, and will be removed in Storybook 8.0.
  48. */
  49. NOTES_ELEMENT = "notes-element"
  50. }
  51. declare class Provider {
  52. getElements(_type: Addon_Types): void;
  53. handleAPI(_api: unknown): void;
  54. getConfig(): {};
  55. }
  56. interface RootProps {
  57. provider: Provider;
  58. history?: History;
  59. }
  60. declare const Root: FC<RootProps>;
  61. declare function renderStorybookUI(domNode: HTMLElement, provider: Provider): void;
  62. export { Provider, Root, RootProps, renderStorybookUI };