-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP - add vue support #1267
Merged
Merged
WIP - add vue support #1267
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
c3b35e6
WIP
ndelangen fcd6283
WIP, webpack succesful
ndelangen 7b53666
testing
ndelangen b1470eb
Implement basic working version, Cannot handle extension and global c…
alexandrebodin 23aadf4
:shirt: refactor(client): update preview rendering
kazupon c23caa9
:shirt: refactor(examples): update stories
kazupon ccbbf6e
Publish alpha.0
ndelangen 55aa3ff
Make global examples work if config.js bootstrap components and exten…
alexandrebodin e7b9b0a
Make working examples for functions, Vue extensions and Vue global co…
alexandrebodin 6b21da8
fix dep for lerna bootstrap
alexandrebodin cc546c5
HMR works!
ndelangen d51f83e
CHANGE favicon
ndelangen 9454fa7
ADD example with actions and links
ndelangen d0dc873
Update the dep value to work with next releases of @storybook/vue
alexandrebodin 385611b
Merge branch 'master' into add-app-vue
ndelangen 9974a3b
Add support for vue in addon-notes
alexandrebodin bf00a9a
Make addon notes agnostic
alexandrebodin 514f4b7
deprecate old WithNotes but keep backward compatible
alexandrebodin 5a6472d
Cleaning up deps and comments
alexandrebodin a93eba3
Merge pull request #1278 from storybooks/addon-notes-vue
ndelangen b41fda4
:construction: wip: add story template for vue app project
kazupon ff56861
:up: update(cli): getstorybook vue supporting
kazupon 765d394
Merge branch 'master' into add-app-vue
ndelangen 9bd55bc
:up: update(cli): stories creating for vue
kazupon 82d44e8
Merge branch 'add-app-vue' into getstorybook-support-for-vue
kazupon 19dcfd9
Change docs to contains Vue info
ndelangen db319e4
Merge branch 'master' into add-app-vue
ndelangen d9a3da5
Make a working example
alexandrebodin 5e66224
Cleaning up
alexandrebodin aef1f01
less ugly working example
alexandrebodin 5784a79
Comment unused to make PR clear
alexandrebodin bac1905
Add support for addonKnobs, rename withX to addonX to avoid name coll…
alexandrebodin 6255569
Finish cleanup of addon knobs
alexandrebodin 4c1daab
More clean up
alexandrebodin 3e12ba1
:shirt: refactor: tweak style guide
kazupon b355060
Fix example using a function as a component to object component
alexandrebodin 4dd6b78
Make example a proper vue app
alexandrebodin 3260f7d
Readme fix
alexandrebodin 1e91907
Wording
alexandrebodin 838730f
:up: update: show the error at storybook/vue
kazupon 2e3170d
:pencil: docs: update vue guide
kazupon 040f4e0
Merge pull request #1287 from kazupon/getstorybook-support-for-vue
alexandrebodin 68d237c
Remove unwatend packe-lock.json
alexandrebodin bc84ee6
Rename vue example to vue-kitchen-sink
alexandrebodin 8145ac3
Merge branch 'master' into add-app-vue
alexandrebodin d3c53c1
:up: update: fix error display
kazupon 70a043f
add more examples with knobs fields
alexandrebodin 8178ec1
Merge branch 'add-app-vue' of github.com:storybooks/storybook into ad…
alexandrebodin 043b5f1
Merge branch 'master' into add-app-vue
ndelangen 5daa769
Merge branch 'master' into add-app-vue
alexandrebodin 6c95ac9
add tests
alexandrebodin 6e8f869
fix dependency
alexandrebodin c7efe5a
bumping version
alexandrebodin 654be24
bumping version
alexandrebodin e35aeee
Merge branch 'add-app-vue' of github.com:storybooks/storybook into ad…
alexandrebodin 7be65d4
fix resolve in webpack
alexandrebodin 96031cd
Merge branch 'master' into add-app-vue
ndelangen d806c3f
WIP
ndelangen d41655a
Merge branch 'master' of github.com:storybooks/storybook into add-app…
alexandrebodin c7ddd09
clean up build and wording
alexandrebodin f2926f4
bump to alpha 4
alexandrebodin cafa395
FIX multiple version react in vue app
ndelangen 0605107
CLEANUP
ndelangen 997f3d9
FIX multiple versions of react & vue && CLEANUP
ndelangen ec67cc5
:up: update(server): tweak consoleoutputing
kazupon d2f259b
Merge branch 'add-app-vue' of github.com:storybooks/storybook into ad…
alexandrebodin 929eb38
Merge branch 'master' of github.com:storybooks/storybook into add-app…
alexandrebodin 864e97e
fix version in package.json
alexandrebodin 83bb874
Merge branch 'release/3.2' into add-app-vue
shilman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ node_modules | |
app/**/demo/** | ||
docs/public | ||
|
||
vue | ||
|
||
*.bundle.js | ||
*.js.map | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
import WrapStory from './WrapStory'; | ||
|
||
/** | ||
* Handles a react story | ||
*/ | ||
export const reactHandler = (channel, knobStore) => getStory => context => { | ||
const initialContent = getStory(context); | ||
const props = { context, storyFn: getStory, channel, knobStore, initialContent }; | ||
return <WrapStory {...props} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import { reactHandler } from './index'; | ||
import { shallow } from 'enzyme'; // eslint-disable-line | ||
import KnobStore from '../KnobStore'; | ||
|
||
describe('React Handler', () => { | ||
describe('wrapStory', () => { | ||
it('should contain the story and add correct props', () => { | ||
const testChannel = { emit: () => {} }; | ||
const testStory = () => <div id="test-story">Test Content</div>; | ||
const testContext = { | ||
kind: 'Foo', | ||
story: 'bar baz', | ||
}; | ||
|
||
const testStore = new KnobStore(); | ||
|
||
const wrappedStory = reactHandler(testChannel, testStore)(testStory)(testContext); | ||
const wrapper = shallow(wrappedStory); | ||
expect(wrapper.find('#test-story').length).toBe(1); | ||
|
||
const storyWrapperProps = wrappedStory.props; | ||
expect(storyWrapperProps.channel).toEqual(testChannel); | ||
expect(storyWrapperProps.context).toEqual(testContext); | ||
}); | ||
}); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's great to have some tests for knobs! Even better would be more tests that fully exercised it. I think we can do this later: #1355 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
export const vueHandler = (channel, knobStore) => getStory => context => ({ | ||
render(h) { | ||
return h(getStory(context)); | ||
}, | ||
|
||
methods: { | ||
onKnobChange(change) { | ||
const { name, value } = change; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spacing?? |
||
// Update the related knob and it's value. | ||
const knobOptions = knobStore.get(name); | ||
knobOptions.value = value; | ||
this.$forceUpdate(); | ||
}, | ||
|
||
onKnobReset() { | ||
knobStore.reset(); | ||
this.setPaneKnobs(false); | ||
this.$forceUpdate(); | ||
}, | ||
|
||
setPaneKnobs(timestamp = +new Date()) { | ||
channel.emit('addon:knobs:setKnobs', { knobs: knobStore.getAll(), timestamp }); | ||
}, | ||
}, | ||
|
||
created() { | ||
channel.on('addon:knobs:reset', this.onKnobReset); | ||
channel.on('addon:knobs:knobChange', this.onKnobChange); | ||
knobStore.subscribe(this.setPaneKnobs); | ||
}, | ||
|
||
beforeDestroy(){ | ||
channel.removeListener('addon:knobs:reset', this.onKnobReset); | ||
channel.removeListener('addon:knobs:knobChange', this.onKnobChange); | ||
knobStore.unsubscribe(this.setPaneKnobs); | ||
} | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this mean that all react projects will load vue in development mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just that
vue
is included when developing the package (i.e. running the tests).