Skip to content

Commit

Permalink
Merge pull request #1383 from storybooks/release/3.2
Browse files Browse the repository at this point in the history
Release/3.2
  • Loading branch information
shilman authored Jul 27, 2017
2 parents f3565c0 + 570e3e8 commit 83d55c2
Show file tree
Hide file tree
Showing 168 changed files with 6,892 additions and 669 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ node_modules
app/**/demo/**
docs/public

vue

*.bundle.js
*.js.map

Expand Down
72 changes: 72 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,75 @@
# 3.2.0

2017-July-27

Storybook 3.2 is filled with new features to help make your components shine! Headline features:

- Vue support [#1267](https://github.com/storybooks/storybook/pull/1267)
- Story Hierarchy [#1329](https://github.com/storybooks/storybook/pull/1329)
- React Native On Device UI [#1413](https://github.com/storybooks/storybook/pull/1413)

Plus many more features, documentation improvements, and bugfixes below!

#### Features

- Vue support [#1267](https://github.com/storybooks/storybook/pull/1267)
- Add support for vue in addon-notes [#1278](https://github.com/storybooks/storybook/pull/1278)
- CLI support for Vue [#1287](https://github.com/storybooks/storybook/pull/1287)


- Story Hierarchy [#1329](https://github.com/storybooks/storybook/pull/1329)
- Story Hierarchy UI improvements [#1387](https://github.com/storybooks/storybook/pull/1387) [#1356](https://github.com/storybooks/storybook/pull/1356)
- Story Hierarchy - keyboard accessibility [#1427](https://github.com/storybooks/storybook/pull/1427)


- React Native - On Device UI [#1413](https://github.com/storybooks/storybook/pull/1413)
- Show first story on RN OnDeviceUI startup [#1510](https://github.com/storybooks/storybook/pull/1510)


- Add warning when module is missing in storiesOf [#1525](https://github.com/storybooks/storybook/pull/1525)
- Provide styling hook for Addon Info story body [#1308](https://github.com/storybooks/storybook/pull/1308)
- Implement filtering on story-level [#1432](https://github.com/storybooks/storybook/pull/1432)
- Refactoring of `addon-info` [#1452](https://github.com/storybooks/storybook/pull/1452)
- ADD storybook logo for inside terminal for future CLI or easteregg [#1499](https://github.com/storybooks/storybook/pull/1499)
- Improved error checking in global addDecorator [#1481](https://github.com/storybooks/storybook/pull/1481)

#### Bug Fixes

- Fix react native example and bootstrapping [#1514](https://github.com/storybooks/storybook/pull/1514)
- Fix a 'funny' hmr issue in cra-kitchen-sink [#1508](https://github.com/storybooks/storybook/pull/1508)
- When timestamps are enabled, it actually checks them before applying changes [#1405](https://github.com/storybooks/storybook/pull/1405)
- Fix issue when extending webpack config [#1468](https://github.com/storybooks/storybook/pull/1468)
- Fix addon notes [#1448](https://github.com/storybooks/storybook/pull/1448)
- Story Hierarchy - initial state bug fix [#1401](https://github.com/storybooks/storybook/pull/1401)
- Remove blue outline when node is focused [#1497](https://github.com/storybooks/storybook/pull/1497)

#### Documentation

- Add hierarchySeparator to README [#1445](https://github.com/storybooks/storybook/pull/1445)
- Document null addons channel in FAQ [#1507](https://github.com/storybooks/storybook/pull/1507)

#### Maintenance

- Revert knobs API to previous API. [#1527](https://github.com/storybooks/storybook/pull/1527)
- FIX hoist-internals: remove existing folder/link before linking [#1516](https://github.com/storybooks/storybook/pull/1516)
- Update global hook for Vue Devtools [#1376](https://github.com/storybooks/storybook/pull/1376)
- SWITCH to circleci over travisCI && CHANGE lerna bootstrap procedure: [#1486](https://github.com/storybooks/storybook/pull/1486)
- Update cra-kitchen-sink package versions for 3.2-alpha [#1434](https://github.com/storybooks/storybook/pull/1434)
- Updating 3.2 alpha release with patches [#1419](https://github.com/storybooks/storybook/pull/1419)
- Remove typescript typings for @storybook/addon-notes [#1344](https://github.com/storybooks/storybook/pull/1344)
- Remove typescript typings for @storybook/addon-options [#1343](https://github.com/storybooks/storybook/pull/1343)
- Remove typescript typings for @storybook/addon-knobs [#1339](https://github.com/storybooks/storybook/pull/1339)
- Remove typescript typings for @storybook/addon-links [#1342](https://github.com/storybooks/storybook/pull/1342)

#### Dependency Upgrades

- Updated babel-plugin-react-docgen version [#1526](https://github.com/storybooks/storybook/pull/1526)
- UPDATE everything (including eslint 4) [#1517](https://github.com/storybooks/storybook/pull/1517)
- Update remark-preset-lint-recommended to the latest version 🚀 [#1512](https://github.com/storybooks/storybook/pull/1512)
- Update remark-cli to the latest version 🚀 [#1498](https://github.com/storybooks/storybook/pull/1498)
- Remove upper bound on react-native peerDependency [#1424](https://github.com/storybooks/storybook/pull/1424)
- Bump `react-split-pane` version [#1495](https://github.com/storybooks/storybook/pull/1495)

# 3.1.9

2017-July-16
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ It allows you to browse a component library, view the different states of each c

Storybook runs outside of your app. This allows you to develop UI components in isolation, which can improve component reuse, testability, and development speed. You can build quickly without having to worry about application-specific dependencies.

Here are some featured examples that you can reference to see how Storybook works: https://storybook.js.org/examples/
Here are some featured examples that you can reference to see how Storybook works: <https://storybook.js.org/examples/>

Storybook comes with a lot of [addons](https://storybook.js.org/addons/introduction/) for component design, documentation, testing, interactivity, and so on. Storybook's easy-to-use API makes it easy to configure and extend in various ways. It has even been extended to support React Native development for mobile.

Expand Down Expand Up @@ -48,11 +48,13 @@ getstorybook
Once it's installed, you can `npm run storybook` and it will run the development server on your local machine, and give you a URL to browse some sample stories.

**Storybook v2.x migration note**: If you're using Storybook v2.x and want to shift to 3.x version the easiest way is:

```sh
npm i -g @storybook/cli
cd my-storybook-v2-app
getstorybook
```

It runs a codemod to update all package names. Read all migration details in our [Migration Guide](MIGRATION.md)

For full documentation on using Storybook visit: [storybook.js.org](https://storybook.js.org)
Expand Down
4 changes: 2 additions & 2 deletions addons/actions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-actions",
"version": "3.1.9",
"version": "3.2.0-alpha.10",
"description": "Action Logger addon for storybook",
"keywords": [
"storybook"
Expand All @@ -21,7 +21,7 @@
"storybook": "start-storybook -p 9001"
},
"dependencies": {
"@storybook/addons": "^3.1.6",
"@storybook/addons": "^3.2.0-alpha.10",
"deep-equal": "^1.0.1",
"json-stringify-safe": "^5.0.1",
"prop-types": "^15.5.10",
Expand Down
2 changes: 1 addition & 1 deletion addons/centered/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-centered",
"version": "3.1.9",
"version": "3.2.0-alpha.8",
"description": "Storybook decorator to center components",
"license": "MIT",
"author": "Muhammed Thanish <mnmtanish@gmail.com>",
Expand Down
4 changes: 2 additions & 2 deletions addons/comments/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-comments",
"version": "3.1.9",
"version": "3.2.0-alpha.10",
"description": "Comments addon for Storybook",
"keywords": [
"storybook"
Expand All @@ -23,7 +23,7 @@
"storybook-remote": "start-storybook -p 3006"
},
"dependencies": {
"@storybook/addons": "^3.1.6",
"@storybook/addons": "^3.2.0-alpha.10",
"babel-runtime": "^6.23.0",
"deep-equal": "^1.0.1",
"events": "^1.1.1",
Expand Down
4 changes: 2 additions & 2 deletions addons/events/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-events",
"version": "3.1.9",
"version": "3.2.0-alpha.10",
"description": "Add events to your Storybook stories.",
"keywords": [
"addon",
Expand All @@ -20,7 +20,7 @@
"storybook": "start-storybook -p 6006"
},
"dependencies": {
"@storybook/addons": "^3.1.6",
"@storybook/addons": "^3.2.0-alpha.10",
"babel-runtime": "^6.23.0",
"format-json": "^1.0.3",
"prop-types": "^15.5.10",
Expand Down
2 changes: 1 addition & 1 deletion addons/graphql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-graphql",
"version": "3.1.6",
"version": "3.2.0-alpha.10",
"description": "Storybook addon to display the GraphiQL IDE",
"keywords": [
"storybook"
Expand Down
7 changes: 4 additions & 3 deletions addons/info/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-info",
"version": "3.1.9",
"version": "3.2.0-alpha.10",
"description": "A Storybook addon to show additional information for your stories.",
"license": "MIT",
"main": "dist/index.js",
Expand All @@ -14,12 +14,13 @@
"storybook": "start-storybook -p 9010"
},
"dependencies": {
"@storybook/addons": "^3.1.6",
"@storybook/addons": "^3.2.0-alpha.10",
"babel-runtime": "^6.23.0",
"global": "^4.3.2",
"marksy": "^2.0.0",
"prop-types": "^15.5.10",
"react-addons-create-fragment": "^15.5.3"
"react-addons-create-fragment": "^15.5.3",
"util-deprecate": "^1.0.2"
},
"devDependencies": {
"git-url-parse": "^6.2.2",
Expand Down
15 changes: 11 additions & 4 deletions addons/info/src/components/PropVal.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,16 @@ export default function PropVal(props) {
);
}

PropVal.defaultProps = {
val: null,
maxPropObjectKeys: 3,
maxPropArrayLength: 3,
maxPropStringLength: 50,
};

PropVal.propTypes = {
val: PropTypes.any.isRequired, // eslint-disable-line
maxPropObjectKeys: PropTypes.number.isRequired,
maxPropArrayLength: PropTypes.number.isRequired,
maxPropStringLength: PropTypes.number.isRequired,
val: PropTypes.any, // eslint-disable-line
maxPropObjectKeys: PropTypes.number,
maxPropArrayLength: PropTypes.number,
maxPropStringLength: PropTypes.number,
};
96 changes: 52 additions & 44 deletions addons/info/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import React from 'react';
import deprecate from 'util-deprecate';
import _Story from './components/Story';
import { H1, H2, H3, H4, H5, H6, Code, P, UL, A, LI } from './components/markdown';

function addonCompose(addonFn) {
return storyFn => context => addonFn(storyFn, context);
}

export const Story = _Story;

const defaultOptions = {
Expand Down Expand Up @@ -29,59 +34,62 @@ const defaultMarksyConf = {
ul: UL,
};

export default {
addWithInfo(storyName, info, storyFn, _options) {
if (typeof storyFn !== 'function') {
if (typeof info === 'function') {
export function addInfo(storyFn, context, info, _options) {
if (typeof storyFn !== 'function') {
if (typeof info === 'function') {
_options = storyFn; // eslint-disable-line
storyFn = info; // eslint-disable-line
info = ''; // eslint-disable-line
} else {
throw new Error('No story defining function has been specified');
}
} else {
throw new Error('No story defining function has been specified');
}
}

const options = {
...defaultOptions,
..._options,
};
const options = {
...defaultOptions,
..._options,
};

// props.propTables can only be either an array of components or null
// propTables option is allowed to be set to 'false' (a boolean)
// if the option is false, replace it with null to avoid react warnings
if (!options.propTables) {
options.propTables = null;
}
// props.propTables can only be either an array of components or null
// propTables option is allowed to be set to 'false' (a boolean)
// if the option is false, replace it with null to avoid react warnings
if (!options.propTables) {
options.propTables = null;
}

const marksyConf = { ...defaultMarksyConf };
if (options && options.marksyConf) {
Object.assign(marksyConf, options.marksyConf);
}
const marksyConf = { ...defaultMarksyConf };
if (options && options.marksyConf) {
Object.assign(marksyConf, options.marksyConf);
}
const props = {
info,
context,
showInline: Boolean(options.inline),
showHeader: Boolean(options.header),
showSource: Boolean(options.source),
propTables: options.propTables,
propTablesExclude: options.propTablesExclude,
styles: typeof options.styles === 'function' ? options.styles : s => s,
marksyConf,
maxPropObjectKeys: options.maxPropObjectKeys,
maxPropArrayLength: options.maxPropArrayLength,
maxPropsIntoLine: options.maxPropsIntoLine,
maxPropStringLength: options.maxPropStringLength,
};
return (
<Story {...props}>
{storyFn(context)}
</Story>
);
}

return this.add(storyName, context => {
const props = {
info,
context,
showInline: Boolean(options.inline),
showHeader: Boolean(options.header),
showSource: Boolean(options.source),
propTables: options.propTables,
propTablesExclude: options.propTablesExclude,
styles: typeof options.styles === 'function' ? options.styles : s => s,
marksyConf,
maxPropObjectKeys: options.maxPropObjectKeys,
maxPropArrayLength: options.maxPropArrayLength,
maxPropsIntoLine: options.maxPropsIntoLine,
maxPropStringLength: options.maxPropStringLength,
};
export const withInfo = (info, _options) =>
addonCompose((storyFn, context) => addInfo(storyFn, context, info, _options));

return (
<Story {...props}>
{storyFn(context)}
</Story>
);
});
},
export default {
addWithInfo: deprecate(function addWithInfo(storyName, info, storyFn, _options) {
return this.add(storyName, withInfo(info, _options)(storyFn));
}, '@storybook/addon-info .addWithInfo() addon is deprecated, use withInfo() from the same package instead. \nSee https://github.com/storybooks/storybook/tree/master/addons/info'),
};

export function setDefaults(newDefaults) {
Expand Down
59 changes: 59 additions & 0 deletions addons/info/src/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* global document */

import React from 'react';
import ReactDOM from 'react-dom';
import AddonInfo, { withInfo, setDefaults, addInfo } from './';

/* eslint-disable */
const TestComponent = ({ func, obj, array, number, string, bool, empty }) =>
<div>
<h1>{func}</h1>
<h2>{obj.toString()}</h2>
<h3>{array}</h3>
<h4>{number}</h4>
<h5>{string}</h5>
<h6>{bool}</h6>
<p>{empty}</p>
<a href="#">test</a>
<code>storiesOf</code>
<ui>
<li>1</li>
<li>2</li>
</ui>
</div>;
/* eslint-enable */

const testContext = { kind: 'addon_info', story: 'jest_test' };
const testOptions = { propTables: false };

describe('addon Info', () => {
const story = context =>
<div>
It's a {context.story} story:
<TestComponent
func={x => x + 1}
obj={{ a: 'a', b: 'b' }}
array={[1, 2, 3]}
number={7}
string={'seven'}
bool
/>
</div>;
const api = {
add: (name, fn) => fn(testContext),
};
it('should render <Info /> and markdown', () => {
const Info = withInfo(
'# Test story \n## with markdown info \ncontaing **bold**, *cursive* text and `code`'
)(story);
ReactDOM.render(<Info />, document.createElement('div'));
});
it('should render with missed info', () => {
setDefaults(testOptions);
addInfo(null, testContext, story, testOptions);
});
it('should show deprecation warning', () => {
const addWithInfo = AddonInfo.addWithInfo.bind(api);
addWithInfo('jest', story);
});
});
Loading

0 comments on commit 83d55c2

Please sign in to comment.