{"bugs":{"url":"https://github.com/storybooks/storybook/issues"},"dist":{"shasum":"96c865b890f5f639168e28240abc483cec92ff21","tarball":"https://registry.npmjs.org/@storybook/ui/-/ui-5.0.0-debug.2.tgz","fileCount":137,"integrity":"sha512-Dq+s11OWvNhYgADar6nS88OWHl2+f07npKQJpGtZi7Rp2rtHYVIqhMME4Yu1wTxWQNj68XI974PGhZTh2TJUwg==","signatures":[{"sig":"MEYCIQCRy/i/0v5aQzhyhrZckCO4dqZe/d7Cper84ovpIQo0KgIhAMQ3hVTsJEdUQIZTCo+pfiWl/FKtKP9HrQ2hpNSMjdx7","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":970369,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcOXtiCRA9TVsSAnZWagAACOgQAJtyys99gJP421ndn1vG\n7Th+Rhs99ehguQHMP94LcuRNQkXXC9AHnKhVl3mMWsK6tQHziZjfgNGR8Nff\ndFH4RURoaZ2Tb7JUQME2nPRu0DplaQqKJtBpf0JrEjDc+Nwi/CG0oz4ydFB7\nwFm2VkrMIxieMr7sFloX04yZjH+cggxPNlwsW1qG3M+kmBuGtwUzhNrw+qnb\n/l4sYzwF3kn7qKc4ku9pmS7PKlCcYXY3uRaRCNmWg4sgqz7Ozzj6S3yRNonV\n/4aUVEeD6yEHSTHwRy9foCY7KaHCXrj8GOalD5BNnw8fjcRahxv43lOC1mTf\nEhihLhqBZAV9PKEOxt1ZkHxPPDC9/9jAVjiVUut0YLRkLkMJETt9d7NlhKc2\nH5r7aYHpfg2Ou/oMtsfAtWGCx2sdenoRTjz/ZAy6aimWcPHmsXERsFgLHphN\nEurlqJ9OlYfCpukFLrkTk2Mqn4HGzTyWfHxNw7Io9/gRSdBlVzgLK8byDS1W\nFP093Al6eXdTO+eDqeoEbEyD5W2sR3lwGwY5CtS6+rRxfSN1n2q7FX11dPIa\neyT8BHZKnbZJx32NO1gZsPJ19GbUkDco/q/2pDxuXSzH/a4WWE96p+IkWS4K\nOrkuzLrt68WfC9NG+MREzvUOxqG4Z1HV01V4THSAMDUQcw1+GzZccpPjee1n\njQRK\r\n=2oks\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","name":"@storybook/ui","readme":"# Storybook UI\n\nStorybook UI the core UI of [storybook](https://storybook.js.org).\nIt's a React based UI which you can initialize with a simple function.\nYou can configure it by providing a provider API.\n\n## Table of Contents\n\n-   [Usage](#usage)\n-   [API](#api)\n    -   [.setOptions()](#setoptions)\n-   [.setStories()](#setstories)\n-   [.onStory()](#onstory)\n-   [Hacking Guide](#hacking-guide)\n    -   [The App](#the-app)\n    -   [Changing UI](#changing-ui)\n    -   [Mounting](#mounting)\n    -   [App Context](#app-context)\n    -   [Actions](#actions)\n    -   [Core API](#core-api)\n    -   [Keyboard Shortcuts](#keyboard-shortcuts)\n    -   [URL Changes](#url-changes)\n\n## Usage\n\nFirst you need to install `@storybook/ui` into your app.\n\n```sh\nyarn add @storybook/ui --dev\n```\n\nThen you need to create a Provider class like this:\n\n```js\nimport React from 'react';\nimport { Provider } from '@storybook/ui';\n\nexport default class MyProvider extends Provider {\n  getElements(type) {\n    return {};\n  }\n\n  renderPreview() {\n    return (\n      <p>This is the Preview</p>\n    );\n  }\n\n  handleAPI(api) {\n    // no need to do anything for now.\n  }\n}\n```\n\nThen you need to initialize the UI like this:\n\n```js\nimport { document } from 'global';\nimport renderStorybookUI from '@storybook/ui';\nimport Provider from './provider';\n\nconst roolEl = document.getElementById('root');\nrenderStorybookUI(roolEl, new Provider());\n```\n\n> **See the [example](./example) app for a complete example.**\n\n## API\n\n### .setOptions()\n\n```js\nimport { Provider } from '@storybook/ui';\n\nclass ReactProvider extends Provider {\n  handleAPI(api) {\n    api.setOptions({\n      // see available options in\n      // https://github.com/storybooks/storybook/tree/master/addons/options#getting-started\n    });\n  }\n};\n```\n\n## .setStories()\n\nThis API is used to pass the`kind` and `stories` list to storybook-ui.\n\n```js\nimport { Provider } from '@storybook/ui';\n\nclass ReactProvider extends Provider {\n  handleAPI(api) {\n    api.setStories([\n      {\n        kind: 'Component 1',\n        stories: ['State 1', 'State 2']\n      },\n\n      {\n        kind: 'Component 2',\n        stories: ['State a', 'State b']\n      }\n    ]);\n  }\n}\n```\n\n## .onStory()\n\nYou can use to listen to the story change and update the preview.\n\n```js\nimport { Provider } from '@storybook/ui';\n\nclass ReactProvider extends Provider {\n  handleAPI(api) {\n    api.onStory((kind, story) => {\n        this.globalState.emit('change', kind, story);\n    });\n  }\n}\n```\n\n## Hacking Guide\n\nIf you like to add features to the Storybook UI or fix bugs, this is the guide you need to follow.\n\nFirst of all, you can need to start the [example](./example) app to see your changes.\n\n### The App\n\nThis is a Redux app written based on the [Mantra architecture](https://github.com/kadirahq/mantra/).\nIt's a set of modules. You can see those modules at `src/modules` directory.\n\n### Changing UI\n\nIf you like to change the appearance of the UI, you need to look at the `ui` module. Simply change components at the `components` directory for simple UI tweaks.\n\nYou can also change containers(which are written with [react-komposer](https://github.com/kadirahq/react-komposer/)) to add more data from the redux state.\n\n### Mounting\n\nThe UI is mounted in the `src/modules/ui/routes.js`. Inside that, we have injected dependencies as well. Refer [mantra-core](https://github.com/mantrajs/mantra-core) for that.\n\nWe've injected the context and actions.\n\n### App Context\n\nApp context is the app which application context you initialize when creating the UI. It is initialized in the `src/index.js` file. It's a non serializable state. You can access the app context from containers and basically most of the place in the app.\n\nSo, that's the place to put app wide configurations and objects which won't changed after initialized. Our redux store is also stayed inside the app context.\n\n### Actions\n\nActions are the place we implement app logic in a Mantra app. Each module has a set of actions and they are globally accessible. These actions are located at `<module>/actions` directory.\n\nThey got injected into the app(when mounting) and you can access them via containers. If you are familiar with redux, this is exactly action creators. But they are not only limited to do redux stuff. Actions has the access to the app context, so literally it can do anything.\n\n### Core API\n\nCore API (which is passed to the Provider with `handleAPI` method) is implemented in the `api` module. We put the provider passed by the user in the app context. Then api module access it and use it as needed.\n\n### Keyboard Shortcuts\n\nKeyboard shortcuts are implemented in a bit different way. The final state of keyboard shortcuts is managed by the `shortcuts` module. But they are implemented in the `ui` module with `src/modules/ui/configs/handle_routing.js`\n\nThese shortcuts also can be called from main API using the `handleShortcut` method. Check the example app for the usage. That's implemented as an action in the `shortcuts` module.\n\nThe above action(or the `handleShortcut` method) accepts events as a constant defined by this module. They are defined in the `src/libs/key_events.js`. This is basically to serialize these events.\n\n> In react-storybook we need to pass these events from the preview iframe to the main app. That's the core reason for this.\n\n### URL Changes\n\nTODO: state we use reach/router customized to query params\n","gitHead":"7d7fcb32d55969d68fec225832168c354f6716e0","license":"MIT","scripts":{"prepare":"node ../../scripts/prepare.js","createDlls":"node -r esm ./scripts/createDlls.js"},"_npmUser":{"name":"shilman","email":"michael@lab80.co"},"homepage":"https://github.com/storybooks/storybook/tree/master/lib/ui","keywords":["storybook"],"repository":{"url":"git+https://github.com/storybooks/storybook.git","type":"git"},"_npmVersion":"lerna/3.8.5/node@v8.11.2+x64 (darwin)","description":"Core Storybook UI","directories":{},"jsnext:main":"src/index.js","maintainers":[{"name":"alexandrebodin","email":"bodin.alex@gmail.com"},{"name":"danielduan","email":"dduan@yahoo.com"},{"name":"hypnosphi","email":"talpa@yandex.ru"},{"name":"igor-dv","email":"davydkin.igor@gmail.com"},{"name":"ndelangen","email":"ndelangen@me.com"},{"name":"pksunkara","email":"pavan.sss1991@gmail.com"},{"name":"shilman","email":"michael@lab80.co"},{"name":"tmeasday","email":"tom@thesnail.org"},{"name":"usulpro","email":"regx@usul.su"}],"_nodeVersion":"8.11.2","dependencies":{"qs":"^6.5.2","global":"^4.3.2","fuse.js":"^3.3.0","history":"^4.7.2","keycode":"^2.2.0","prop-types":"^15.6.2","lodash.pick":"^4.4.0","react-modal":"^3.8.1","memoizerific":"^1.11.3","@emotion/core":"^10.0.5","@reach/router":"^1.2.1","eventemitter3":"^3.1.0","lodash.sortby":"^4.7.0","to-camel-case":"^1.0.0","lodash.isequal":"^4.5.0","util-deprecate":"^1.0.2","@emotion/styled":"^10.0.5","emotion-theming":"^10.0.5","fast-deep-equal":"^2.0.1","lodash.debounce":"^4.0.8","lodash.throttle":"^4.1.1","markdown-to-jsx":"^6.9.0","react-draggable":"^3.1.1","lodash.mergewith":"^4.6.1","@storybook/addons":"5.0.0-debug.2","@storybook/components":"5.0.0-debug.2","react-resize-detector":"^3.2.1","@storybook/core-events":"5.0.0-debug.2","react-lifecycles-compat":"^3.0.4","@storybook/client-logger":"5.0.0-debug.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"webpack":"^4.28.3","terser-webpack-plugin":"^1.2.1"},"peerDependencies":{"react":"*","react-dom":"*"},"_npmOperationalInternal":{"tmp":"tmp/ui_5.0.0-debug.2_1547271009949_0.40827432228816063","host":"s3://npm-registry-packages"},"_id":"@storybook/ui@5.0.0-debug.2","version":"5.0.0-debug.2"}