@storybook/angular 7.1.0-alpha.0 → 7.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/builders/build-storybook/index.js +2 -0
- package/dist/builders/start-storybook/index.js +2 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.d.ts +1 -1
- package/dist/client/angular-beta/StorybookProvider.d.ts +1 -1
- package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +2 -2
- package/dist/client/decorators.d.ts +1 -1
- package/dist/client/docs/compodoc.d.ts +3 -3
- package/dist/client/index.js +2 -1
- package/dist/client/public-api.js +2 -2
- package/dist/server/angular-cli-webpack.js +1 -0
- package/package.json +15 -15
- package/template/cli/Button.stories.ts +2 -2
- package/template/cli/Header.stories.ts +2 -2
- package/template/cli/Page.stories.ts +2 -2
package/README.md
CHANGED
|
@@ -27,12 +27,12 @@ So you can develop UI components in isolation without worrying about app specifi
|
|
|
27
27
|
|
|
28
28
|
```sh
|
|
29
29
|
cd my-angular-app
|
|
30
|
-
npx storybook init
|
|
30
|
+
npx storybook@latest init
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Setup Storybook for your Angular projects
|
|
34
34
|
|
|
35
|
-
Storybook supports Angular multi-project workspace. You can setup Storybook for each project in the workspace. When running `npx storybook init` you will be asked for which project Storybook should be set up. Essentially, during initialization, the `.storybook` folder will be created and the `angular.json` will be edited to add the Storybook configuration for the selected project. The configuration looks approximately like this:
|
|
35
|
+
Storybook supports Angular multi-project workspace. You can setup Storybook for each project in the workspace. When running `npx storybook@latest init` you will be asked for which project Storybook should be set up. Essentially, during initialization, the `.storybook` folder will be created and the `angular.json` will be edited to add the Storybook configuration for the selected project. The configuration looks approximately like this:
|
|
36
36
|
|
|
37
37
|
```json
|
|
38
38
|
// angular.json
|
|
@@ -6,9 +6,11 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const find_up_1 = require("find-up");
|
|
7
7
|
const read_pkg_up_1 = require("read-pkg-up");
|
|
8
8
|
const cli_1 = require("@storybook/cli");
|
|
9
|
+
const telemetry_1 = require("@storybook/telemetry");
|
|
9
10
|
const core_server_1 = require("@storybook/core-server");
|
|
10
11
|
const run_compodoc_1 = require("../utils/run-compodoc");
|
|
11
12
|
const error_handler_1 = require("../utils/error-handler");
|
|
13
|
+
(0, telemetry_1.addToGlobalContext)('cliVersion', cli_1.versions.storybook);
|
|
12
14
|
exports.default = (0, architect_1.createBuilder)(commandBuilder);
|
|
13
15
|
function commandBuilder(options, context) {
|
|
14
16
|
return (0, rxjs_1.from)(setup(options, context)).pipe((0, operators_1.switchMap)(({ tsConfig }) => {
|
|
@@ -6,9 +6,11 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const find_up_1 = require("find-up");
|
|
7
7
|
const read_pkg_up_1 = require("read-pkg-up");
|
|
8
8
|
const cli_1 = require("@storybook/cli");
|
|
9
|
+
const telemetry_1 = require("@storybook/telemetry");
|
|
9
10
|
const core_server_1 = require("@storybook/core-server");
|
|
10
11
|
const run_compodoc_1 = require("../utils/run-compodoc");
|
|
11
12
|
const error_handler_1 = require("../utils/error-handler");
|
|
13
|
+
(0, telemetry_1.addToGlobalContext)('cliVersion', cli_1.versions.storybook);
|
|
12
14
|
exports.default = (0, architect_1.createBuilder)(commandBuilder);
|
|
13
15
|
function commandBuilder(options, context) {
|
|
14
16
|
return (0, rxjs_1.from)(setup(options, context)).pipe((0, operators_1.switchMap)(({ tsConfig }) => {
|
|
@@ -14,4 +14,4 @@ export declare const computesTemplateFromComponent: (component: Type<unknown>, i
|
|
|
14
14
|
* @param initialProps
|
|
15
15
|
* @param innerTemplate
|
|
16
16
|
*/
|
|
17
|
-
export declare const computesTemplateSourceFromComponent: (component: Type<unknown>, initialProps?: ICollection, argTypes?: ArgTypes) => string;
|
|
17
|
+
export declare const computesTemplateSourceFromComponent: (component: Type<unknown>, initialProps?: ICollection, argTypes?: ArgTypes) => string | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Provider, InjectionToken } from '@angular/core';
|
|
2
2
|
import { Subject } from 'rxjs';
|
|
3
3
|
import { ICollection } from '../types';
|
|
4
|
-
export declare const STORY_PROPS: InjectionToken<Subject<ICollection>>;
|
|
4
|
+
export declare const STORY_PROPS: InjectionToken<Subject<ICollection | undefined>>;
|
|
5
5
|
export declare const storyPropsProvider: (storyProps$: Subject<ICollection | undefined>) => Provider;
|
|
@@ -11,6 +11,6 @@ export declare const createStorybookWrapperComponent: ({ selector, template, sto
|
|
|
11
11
|
storyComponent: Type<unknown> | undefined;
|
|
12
12
|
styles: string[];
|
|
13
13
|
moduleMetadata: NgModuleMetadata;
|
|
14
|
-
initialProps?: ICollection;
|
|
15
|
-
analyzedMetadata?: PropertyExtractor;
|
|
14
|
+
initialProps?: ICollection | undefined;
|
|
15
|
+
analyzedMetadata?: PropertyExtractor | undefined;
|
|
16
16
|
}) => Type<any>;
|
|
@@ -11,4 +11,4 @@ export declare function applicationConfig<TArgs = any>(
|
|
|
11
11
|
* Set of config options available during the application bootstrap operation.
|
|
12
12
|
*/
|
|
13
13
|
config: ApplicationConfig): DecoratorFunction<AngularRenderer, TArgs>;
|
|
14
|
-
export declare const componentWrapperDecorator: <TArgs = any>(element: Type<unknown> | ((story: string) => string), props?: ICollection | ((storyContext: StoryContext<AngularRenderer, TArgs>) => ICollection)) => DecoratorFunction<AngularRenderer, TArgs>;
|
|
14
|
+
export declare const componentWrapperDecorator: <TArgs = any>(element: Type<unknown> | ((story: string) => string), props?: ICollection | ((storyContext: StoryContext<AngularRenderer, TArgs>) => ICollection) | undefined) => DecoratorFunction<AngularRenderer, TArgs>;
|
|
@@ -5,8 +5,8 @@ export declare const setCompodocJson: (compodocJson: CompodocJson) => void;
|
|
|
5
5
|
export declare const getCompodocJson: () => CompodocJson;
|
|
6
6
|
export declare const checkValidComponentOrDirective: (component: Component | Directive) => void;
|
|
7
7
|
export declare const checkValidCompodocJson: (compodocJson: CompodocJson) => void;
|
|
8
|
-
export declare const findComponentByName: (name: string, compodocJson: CompodocJson) => Class | Injectable | Pipe | Directive;
|
|
8
|
+
export declare const findComponentByName: (name: string, compodocJson: CompodocJson) => Class | Injectable | Pipe | Directive | undefined;
|
|
9
9
|
export declare const extractType: (property: Property, defaultValue: any) => SBType;
|
|
10
10
|
export declare const extractArgTypesFromData: (componentData: Class | Directive | Injectable | Pipe) => ArgTypes<import("@storybook/types").Args>;
|
|
11
|
-
export declare const extractArgTypes: (component: Component | Directive) => ArgTypes<import("@storybook/types").Args
|
|
12
|
-
export declare const extractComponentDescription: (component: Component | Directive) => string;
|
|
11
|
+
export declare const extractArgTypes: (component: Component | Directive) => ArgTypes<import("@storybook/types").Args> | null | undefined;
|
|
12
|
+
export declare const extractComponentDescription: (component: Component | Directive) => string | null | undefined;
|
package/dist/client/index.js
CHANGED
|
@@ -26,4 +26,5 @@ Object.defineProperty(exports, "moduleMetadata", { enumerable: true, get: functi
|
|
|
26
26
|
Object.defineProperty(exports, "componentWrapperDecorator", { enumerable: true, get: function () { return decorators_1.componentWrapperDecorator; } });
|
|
27
27
|
Object.defineProperty(exports, "applicationConfig", { enumerable: true, get: function () { return decorators_1.applicationConfig; } });
|
|
28
28
|
// optimization: stop HMR propagation in webpack
|
|
29
|
-
module
|
|
29
|
+
if (typeof module !== 'undefined')
|
|
30
|
+
module?.hot?.decline();
|
|
@@ -18,12 +18,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.raw = exports.forceReRender = exports.configure = exports.storiesOf = void 0;
|
|
21
|
-
const
|
|
21
|
+
const preview_api_1 = require("@storybook/preview-api");
|
|
22
22
|
const render_1 = require("./render");
|
|
23
23
|
const decorateStory_1 = __importDefault(require("./decorateStory"));
|
|
24
24
|
__exportStar(require("./public-types"), exports);
|
|
25
25
|
const RENDERER = 'angular';
|
|
26
|
-
const api = (0,
|
|
26
|
+
const api = (0, preview_api_1.start)(render_1.renderToCanvas, { decorateStory: decorateStory_1.default, render: render_1.render });
|
|
27
27
|
const storiesOf = (kind, m) => {
|
|
28
28
|
return api.clientApi.storiesOf(kind, m).addParameters({
|
|
29
29
|
renderer: RENDERER,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
// Private angular devkit stuff
|
|
2
3
|
const { generateI18nBrowserWebpackConfigFromContext, } = require('@angular-devkit/build-angular/src/utils/webpack-browser-config');
|
|
3
4
|
const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig, } = require('@angular-devkit/build-angular/src/webpack/configs');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "7.1.0-alpha.
|
|
3
|
+
"version": "7.1.0-alpha.10",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
"prep": "../../../scripts/prepare/tsc.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@storybook/builder-webpack5": "7.1.0-alpha.
|
|
40
|
-
"@storybook/cli": "7.1.0-alpha.
|
|
41
|
-
"@storybook/client-logger": "7.1.0-alpha.
|
|
42
|
-
"@storybook/core-
|
|
43
|
-
"@storybook/core-
|
|
44
|
-
"@storybook/core-
|
|
45
|
-
"@storybook/core-
|
|
46
|
-
"@storybook/
|
|
47
|
-
"@storybook/docs-tools": "7.1.0-alpha.0",
|
|
39
|
+
"@storybook/builder-webpack5": "7.1.0-alpha.10",
|
|
40
|
+
"@storybook/cli": "7.1.0-alpha.10",
|
|
41
|
+
"@storybook/client-logger": "7.1.0-alpha.10",
|
|
42
|
+
"@storybook/core-common": "7.1.0-alpha.10",
|
|
43
|
+
"@storybook/core-events": "7.1.0-alpha.10",
|
|
44
|
+
"@storybook/core-server": "7.1.0-alpha.10",
|
|
45
|
+
"@storybook/core-webpack": "7.1.0-alpha.10",
|
|
46
|
+
"@storybook/docs-tools": "7.1.0-alpha.10",
|
|
48
47
|
"@storybook/global": "^5.0.0",
|
|
49
|
-
"@storybook/manager-api": "7.1.0-alpha.
|
|
50
|
-
"@storybook/node-logger": "7.1.0-alpha.
|
|
51
|
-
"@storybook/preview-api": "7.1.0-alpha.
|
|
52
|
-
"@storybook/
|
|
48
|
+
"@storybook/manager-api": "7.1.0-alpha.10",
|
|
49
|
+
"@storybook/node-logger": "7.1.0-alpha.10",
|
|
50
|
+
"@storybook/preview-api": "7.1.0-alpha.10",
|
|
51
|
+
"@storybook/telemetry": "7.1.0-alpha.10",
|
|
52
|
+
"@storybook/types": "7.1.0-alpha.10",
|
|
53
53
|
"@types/node": "^16.0.0",
|
|
54
54
|
"@types/react": "^16.14.34",
|
|
55
55
|
"@types/react-dom": "^16.9.14",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"bundler": {
|
|
124
124
|
"tsConfig": "tsconfig.build.json"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "e7c833e690dd0d2966ffb7fb806a3bda89a508c8"
|
|
127
127
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
2
|
import Button from './button.component';
|
|
3
3
|
|
|
4
|
-
// More on how to set up stories at: https://storybook.js.org/docs/
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/angular/writing-stories/introduction
|
|
5
5
|
const meta: Meta<Button> = {
|
|
6
6
|
title: 'Example/Button',
|
|
7
7
|
component: Button,
|
|
@@ -22,7 +22,7 @@ const meta: Meta<Button> = {
|
|
|
22
22
|
export default meta;
|
|
23
23
|
type Story = StoryObj<Button>;
|
|
24
24
|
|
|
25
|
-
// More on writing stories with args: https://storybook.js.org/docs/
|
|
25
|
+
// More on writing stories with args: https://storybook.js.org/docs/angular/writing-stories/args
|
|
26
26
|
export const Primary: Story = {
|
|
27
27
|
args: {
|
|
28
28
|
primary: true,
|
|
@@ -8,7 +8,7 @@ import Header from './header.component';
|
|
|
8
8
|
const meta: Meta<Header> = {
|
|
9
9
|
title: 'Example/Header',
|
|
10
10
|
component: Header,
|
|
11
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/
|
|
11
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/angular/writing-docs/autodocs
|
|
12
12
|
tags: ['autodocs'],
|
|
13
13
|
render: (args) => ({ props: args }),
|
|
14
14
|
decorators: [
|
|
@@ -18,7 +18,7 @@ const meta: Meta<Header> = {
|
|
|
18
18
|
}),
|
|
19
19
|
],
|
|
20
20
|
parameters: {
|
|
21
|
-
// More on how to position stories at: https://storybook.js.org/docs/
|
|
21
|
+
// More on how to position stories at: https://storybook.js.org/docs/angular/configure/story-layout
|
|
22
22
|
layout: 'fullscreen',
|
|
23
23
|
},
|
|
24
24
|
};
|
|
@@ -11,7 +11,7 @@ const meta: Meta<Page> = {
|
|
|
11
11
|
title: 'Example/Page',
|
|
12
12
|
component: Page,
|
|
13
13
|
parameters: {
|
|
14
|
-
// More on how to position stories at: https://storybook.js.org/docs/
|
|
14
|
+
// More on how to position stories at: https://storybook.js.org/docs/angular/configure/story-layout
|
|
15
15
|
layout: 'fullscreen',
|
|
16
16
|
},
|
|
17
17
|
decorators: [
|
|
@@ -31,7 +31,7 @@ export const LoggedOut: Story = {
|
|
|
31
31
|
}),
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
// More on interaction testing: https://storybook.js.org/docs/
|
|
34
|
+
// More on interaction testing: https://storybook.js.org/docs/angular/writing-tests/interaction-testing
|
|
35
35
|
export const LoggedIn: Story = {
|
|
36
36
|
render: (args: Page) => ({
|
|
37
37
|
props: args,
|