Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into prop-table-default-false
- Loading branch information
Showing
50 changed files
with
567 additions
and
147,432 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Storybook for Marionette.js | ||
|
||
--- | ||
|
||
Storybook for Marionette.js is a UI development environment for your Marionette.js components. | ||
With it, you can visualize different states of your UI components and develop them interactively. | ||
|
||
![Storybook Screenshot](https://github.com/storybookjs/storybook/blob/master/media/storybook-intro.gif) | ||
|
||
Storybook runs outside of your app. | ||
So you can develop UI components in isolation without worrying about app specific dependencies and requirements. | ||
|
||
## Getting Started | ||
|
||
```sh | ||
cd my-app | ||
npx -p @storybook/cli sb init | ||
``` | ||
|
||
For more information visit: [storybook.js.org](https://storybook.js.org) | ||
|
||
--- | ||
|
||
Storybook also comes with a lot of [addons](https://storybook.js.org/addons/introduction) and a great API to customize as you wish. | ||
You can also build a [static version](https://storybook.js.org/basics/exporting-storybook) of your storybook and deploy it anywhere you want. |
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,4 @@ | ||
#!/usr/bin/env node | ||
|
||
process.env.NODE_ENV = process.env.NODE_ENV || 'production'; | ||
require('../dist/server/build'); |
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,3 @@ | ||
#!/usr/bin/env node | ||
|
||
require('../dist/server'); |
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,48 @@ | ||
{ | ||
"name": "@storybook/marionette", | ||
"version": "5.3.7", | ||
"description": "Storybook for Marionette: Develop Marionette.js component in isolation with Hot Reloading.", | ||
"keywords": [ | ||
"storybook" | ||
], | ||
"homepage": "https://github.com/storybookjs/storybook/tree/master/app/marionette", | ||
"bugs": { | ||
"url": "https://github.com/storybookjs/storybook/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/storybookjs/storybook.git", | ||
"directory": "app/marionette" | ||
}, | ||
"license": "MIT", | ||
"main": "dist/client/index.js", | ||
"bin": { | ||
"build-storybook": "./bin/build.js", | ||
"start-storybook": "./bin/index.js", | ||
"storybook-server": "./bin/index.js" | ||
}, | ||
"scripts": { | ||
"prepare": "node ../../scripts/prepare.js" | ||
}, | ||
"dependencies": { | ||
"@storybook/core": "5.3.7", | ||
"common-tags": "^1.8.0", | ||
"core-js": "^3.0.1", | ||
"global": "^4.3.2", | ||
"html-loader": "^0.5.5", | ||
"regenerator-runtime": "^0.12.1" | ||
}, | ||
"devDependencies": { | ||
"backbone.marionette": "*" | ||
}, | ||
"peerDependencies": { | ||
"babel-loader": "^7.0.0 || ^8.0.0", | ||
"backbone.marionette": "*" | ||
}, | ||
"engines": { | ||
"node": ">=8.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Marionette from 'backbone.marionette'; | ||
|
||
const allMarionetteViewConstructors = [ | ||
'View', | ||
'CompositeView', | ||
'CollectionView', | ||
'NextCollectionView', | ||
]; | ||
const viewConstructorsSupportedByMarionette = allMarionetteViewConstructors | ||
.filter(constructorName => constructorName in Marionette) | ||
.map(constructorName => Marionette[constructorName]); | ||
|
||
// accepts an element and return true if renderable else return false | ||
const isMarionetteRenderable = element => { | ||
return viewConstructorsSupportedByMarionette.find(Constructor => element instanceof Constructor); | ||
}; | ||
|
||
export default isMarionetteRenderable; |
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,3 @@ | ||
import { window } from 'global'; | ||
|
||
window.STORYBOOK_ENV = 'marionette'; |
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,22 @@ | ||
import { start } from '@storybook/core/client'; | ||
|
||
import './globals'; | ||
import render from './render'; | ||
|
||
const { load: coreLoad, clientApi, configApi, forceReRender } = start(render); | ||
|
||
export const { | ||
setAddon, | ||
addDecorator, | ||
addParameters, | ||
clearDecorators, | ||
getStorybook, | ||
raw, | ||
} = clientApi; | ||
|
||
const framework = 'marionette'; | ||
export const storiesOf = (...args) => clientApi.storiesOf(...args).addParameters({ framework }); | ||
export const load = (...args) => coreLoad(...args, framework); | ||
|
||
export const { configure } = configApi; | ||
export { forceReRender }; |
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,40 @@ | ||
import { document } from 'global'; | ||
import { stripIndents } from 'common-tags'; | ||
import Marionette from 'backbone.marionette'; | ||
import isMarionetteRenderable from './element_check'; | ||
|
||
const rootEl = document.getElementById('root'); | ||
const rootRegion = new Marionette.Region({ el: rootEl }); | ||
|
||
function render(view) { | ||
rootRegion.show(view); | ||
} | ||
|
||
export default function renderMain({ storyFn, selectedKind, selectedStory, showMain, showError }) { | ||
const element = storyFn(); | ||
|
||
if (!element) { | ||
showError({ | ||
title: `Expecting a Marionette View from the story: "${selectedStory}" of "${selectedKind}".`, | ||
description: stripIndents` | ||
Did you forget to return the React element from the story? | ||
Use "() => (<MyComp/>)" or "() => { return <MyComp/>; }" when defining the story. | ||
`, | ||
}); | ||
return; | ||
} | ||
|
||
if (!isMarionetteRenderable(element)) { | ||
showError({ | ||
title: `Expecting a valid Marionette View from the story: "${selectedStory}" of "${selectedKind}".`, | ||
description: stripIndents` | ||
Seems like you are not returning a correct Marionette View from the story. | ||
Could you double check that? | ||
`, | ||
}); | ||
return; | ||
} | ||
|
||
render(element); | ||
showMain(); | ||
} |
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,3 @@ | ||
export function webpack(config) { | ||
return config; | ||
} |
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,6 @@ | ||
import packageJson from '../../package.json'; | ||
|
||
export default { | ||
packageJson, | ||
frameworkPresets: [require.resolve('./framework-preset-marionette.js')], | ||
}; |
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,8 @@ | ||
const build = require('@storybook/core/standalone'); | ||
const frameworkOptions = require('./dist/server/options').default; | ||
|
||
async function buildStandalone(options) { | ||
return build(options, frameworkOptions); | ||
} | ||
|
||
module.exports = buildStandalone; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export { | ||
storiesOf, | ||
setAddon, | ||
addDecorator, | ||
addParameters, | ||
configure, | ||
getStorybook, | ||
forceReRender, | ||
raw, | ||
} from './preview'; | ||
|
||
// tsc wants to use NodeModule instead of WebpackModule | ||
declare const module: any; | ||
if (module && module.hot && module.hot.decline) { | ||
module.hot.decline(); | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { TemplateResult } from 'lit-html'; | ||
|
||
export interface IStorybookSection { | ||
kind: string; | ||
stories: IStorybookStory[]; | ||
} | ||
|
||
export interface IStorybookStory { | ||
name: string; | ||
render: () => any; | ||
} | ||
|
||
export type StoryFnPolymerReturnType = string | Node | TemplateResult; | ||
|
||
export interface ShowErrorArgs { | ||
title: string; | ||
description: string; | ||
} | ||
|
||
export interface RenderMainArgs { | ||
storyFn: (...args: any[]) => StoryFnPolymerReturnType; | ||
selectedKind: string; | ||
selectedStory: string; | ||
showMain: () => void; | ||
showError: (args: ShowErrorArgs) => void; | ||
showException: (err: Error) => void; | ||
forceRender: boolean; | ||
} |
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,4 @@ | ||
import { buildStatic } from '@storybook/core/server'; | ||
import options from './options'; | ||
|
||
buildStatic(options); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { buildDev } from '@storybook/core/server'; | ||
import options from './options'; | ||
|
||
buildDev(options); |
Oops, something went wrong.