@storybook/angular 7.0.0-beta.9 → 7.0.0-rc.1
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 +214 -0
- package/dist/builders/build-storybook/index.d.ts +5 -3
- package/dist/builders/build-storybook/index.js +9 -4
- package/dist/builders/build-storybook/schema.json +14 -6
- package/dist/builders/start-storybook/index.d.ts +5 -3
- package/dist/builders/start-storybook/index.js +15 -6
- package/dist/builders/start-storybook/schema.json +10 -5
- package/dist/builders/utils/error-handler.d.ts +2 -0
- package/dist/builders/utils/{build-standalone-errors-handler.js → error-handler.js} +6 -3
- package/dist/builders/utils/run-compodoc.js +11 -27
- package/dist/builders/utils/run-compodoc.spec.js +42 -0
- package/dist/builders/utils/standalone-options.d.ts +2 -2
- package/dist/client/angular-beta/AbstractRenderer.d.ts +3 -3
- package/dist/client/angular-beta/AbstractRenderer.js +31 -31
- package/dist/client/angular-beta/CanvasRenderer.js +1 -1
- package/dist/client/angular-beta/DocsRenderer.js +5 -3
- package/dist/client/angular-beta/RendererFactory.js +5 -4
- package/dist/client/angular-beta/StorybookModule.d.ts +3 -6
- package/dist/client/angular-beta/StorybookModule.js +4 -45
- package/dist/client/angular-beta/StorybookModule.test.js +51 -36
- package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +3 -2
- package/dist/client/angular-beta/StorybookWrapperComponent.js +30 -2
- package/dist/client/angular-beta/__testfixtures__/test.module.d.ts +2 -0
- package/dist/client/angular-beta/__testfixtures__/test.module.js +20 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.js +1 -1
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +43 -5
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.d.ts +1 -1
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.js +4 -4
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.js +3 -3
- package/dist/client/angular-beta/utils/PropertyExtractor.d.ts +32 -0
- package/dist/client/angular-beta/utils/PropertyExtractor.js +136 -0
- package/dist/client/angular-beta/utils/PropertyExtractor.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/PropertyExtractor.test.js +141 -0
- package/dist/client/config.d.ts +1 -1
- package/dist/client/config.js +1 -1
- package/dist/client/decorateStory.js +1 -1
- package/dist/client/docs/compodoc.js +5 -7
- package/dist/client/docs/config.js +1 -2
- package/dist/client/docs/sourceDecorator.js +2 -1
- package/dist/client/globals.d.ts +0 -8
- package/dist/client/globals.js +2 -29
- package/dist/client/public-api.js +3 -3
- package/dist/client/public-types.d.ts +2 -1
- package/dist/client/render.d.ts +1 -0
- package/dist/client/render.js +1 -5
- package/dist/client/types.d.ts +1 -2
- package/dist/index.mjs +13 -0
- package/dist/preset.mjs +26 -0
- package/dist/renderer.d.ts +2 -1
- package/dist/renderer.js +4 -2
- package/dist/renderer.mjs +5 -0
- package/dist/server/framework-preset-angular-cli.d.ts +2 -1
- package/dist/server/framework-preset-angular-cli.js +21 -92
- package/dist/server/preset-options.d.ts +3 -2
- package/dist/types.mjs +1 -0
- package/jest.config.js +19 -0
- package/package.json +46 -45
- package/template/cli/Button.stories.ts +1 -1
- package/template/cli/Header.stories.ts +2 -2
- package/template/cli/button.component.ts +2 -0
- package/template/components/index.js +2 -2
- package/template/stories/angular-mdx.stories.mdx +1 -1
- package/template/stories/argTypes/doc-button/doc-button.component.ts +1 -2
- package/template/stories/basics/component-without-selector/without-selector-ng-component-outlet.stories.ts +1 -1
- package/template/stories/basics/component-without-selector/without-selector-ng-factory-resolver.stories.ts +1 -1
- package/template/stories/basics/component-without-selector/without-selector.stories.ts +1 -1
- package/template/stories/basics/ng-module/import-module-chip.stories.ts +23 -0
- package/template/stories/basics/ng-module/import-module.stories.ts +2 -13
- package/template/stories/core/decorators/componentWrapperDecorator/decorators.stories.ts +0 -18
- package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.css +13 -0
- package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.html +7 -0
- package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.ts +39 -0
- package/template/stories/core/moduleMetadata/with-browser-animations.stories.ts +30 -0
- package/template/stories/core/moduleMetadata/with-noop-browser-animations.stories.ts +27 -0
- package/template/stories/core/parameters/bootstrap-options.stories.ts +1 -5
- package/template/stories/others/app-initializer-use-factory/app-initializer-use-factory.stories.ts +34 -0
- package/dist/builders/utils/build-standalone-errors-handler.d.ts +0 -1
- package/dist/client/angular/helpers.d.ts +0 -8
- package/dist/client/angular/helpers.js +0 -150
- package/dist/server/angular-read-workspace.d.ts +0 -13
- package/dist/server/angular-read-workspace.js +0 -78
- package/dist/server/utils/normalize-asset-patterns.d.ts +0 -7
- package/dist/server/utils/normalize-asset-patterns.js +0 -64
- package/dist/server/utils/normalize-optimization.d.ts +0 -3
- package/dist/server/utils/normalize-optimization.js +0 -21
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { storyPropsProvider } from './client/angular-beta/StorybookProvider';
|
|
2
|
+
export { computesTemplateSourceFromComponent } from './client/angular-beta/ComputesTemplateFromComponent';
|
|
3
|
+
export { rendererFactory } from './client/render';
|
|
4
|
+
export { AbstractRenderer } from './client/angular-beta/AbstractRenderer';
|
|
5
|
+
export { getApplication } from './client/angular-beta/StorybookModule';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import webpack from 'webpack';
|
|
2
2
|
import { PresetOptions } from './preset-options';
|
|
3
|
-
export declare function webpackFinal(baseConfig: webpack.Configuration, options: PresetOptions): Promise<
|
|
3
|
+
export declare function webpackFinal(baseConfig: webpack.Configuration, options: PresetOptions): Promise<any>;
|
|
4
|
+
export declare const migrationToBuilderReferrenceMessage: string;
|
|
@@ -1,72 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.webpackFinal = void 0;
|
|
3
|
+
exports.migrationToBuilderReferrenceMessage = exports.webpackFinal = void 0;
|
|
30
4
|
const node_logger_1 = require("@storybook/node-logger");
|
|
31
5
|
const architect_1 = require("@angular-devkit/architect");
|
|
32
6
|
const find_up_1 = require("find-up");
|
|
33
|
-
const semver_1 = __importDefault(require("semver"));
|
|
34
7
|
const ts_dedent_1 = require("ts-dedent");
|
|
35
8
|
const core_1 = require("@angular-devkit/core");
|
|
36
9
|
const angular_cli_webpack_1 = require("./angular-cli-webpack");
|
|
37
10
|
const module_is_available_1 = require("./utils/module-is-available");
|
|
38
|
-
const angular_read_workspace_1 = require("./angular-read-workspace");
|
|
39
11
|
async function webpackFinal(baseConfig, options) {
|
|
40
12
|
if (!(0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular')) {
|
|
41
13
|
node_logger_1.logger.info('=> Using base config because "@angular-devkit/build-angular" is not installed');
|
|
42
14
|
return baseConfig;
|
|
43
15
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
condition: semver_1.default.satisfies(angularCliVersion, '>=13.0.0'),
|
|
52
|
-
getWebpackConfig: async (_baseConfig, _options) => {
|
|
53
|
-
const builderContext = getBuilderContext(_options);
|
|
54
|
-
const builderOptions = await getBuilderOptions(_options, builderContext);
|
|
55
|
-
const legacyDefaultOptions = await getLegacyDefaultBuildOptions(_options);
|
|
56
|
-
return (0, angular_cli_webpack_1.getWebpackConfig)(_baseConfig, {
|
|
57
|
-
builderOptions: {
|
|
58
|
-
watch: options.configType === 'DEVELOPMENT',
|
|
59
|
-
...legacyDefaultOptions,
|
|
60
|
-
...builderOptions,
|
|
61
|
-
},
|
|
62
|
-
builderContext,
|
|
63
|
-
});
|
|
64
|
-
},
|
|
16
|
+
checkForLegacyBuildOptions(options);
|
|
17
|
+
const builderContext = getBuilderContext(options);
|
|
18
|
+
const builderOptions = await getBuilderOptions(options, builderContext);
|
|
19
|
+
return (0, angular_cli_webpack_1.getWebpackConfig)(baseConfig, {
|
|
20
|
+
builderOptions: {
|
|
21
|
+
watch: options.configType === 'DEVELOPMENT',
|
|
22
|
+
...builderOptions,
|
|
65
23
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
node_logger_1.logger.info(webpackGetter.info);
|
|
69
|
-
return Promise.resolve(webpackGetter.getWebpackConfig(baseConfig, options));
|
|
24
|
+
builderContext,
|
|
25
|
+
});
|
|
70
26
|
}
|
|
71
27
|
exports.webpackFinal = webpackFinal;
|
|
72
28
|
/**
|
|
@@ -110,47 +66,20 @@ async function getBuilderOptions(options, builderContext) {
|
|
|
110
66
|
node_logger_1.logger.info(`=> Using angular project with "tsConfig:${builderOptions.tsConfig}"`);
|
|
111
67
|
return builderOptions;
|
|
112
68
|
}
|
|
69
|
+
exports.migrationToBuilderReferrenceMessage = (0, ts_dedent_1.dedent) `Your Storybook startup uses a solution that is not supported.
|
|
70
|
+
You must use angular builder to have an explicit configuration on the project used in angular.json
|
|
71
|
+
Read more at:
|
|
72
|
+
- https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#sb-angular-builder)
|
|
73
|
+
- https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular13)
|
|
74
|
+
`;
|
|
113
75
|
/**
|
|
114
|
-
*
|
|
115
|
-
* /!\ This is only for backward compatibility and would be removed on Storybook 7.0
|
|
116
|
-
* only work for angular.json with [defaultProject].build or "storybook.build" config
|
|
76
|
+
* Checks if using legacy configuration that doesn't use builder and logs message referring to migration docs.
|
|
117
77
|
*/
|
|
118
|
-
|
|
78
|
+
function checkForLegacyBuildOptions(options) {
|
|
119
79
|
if (options.angularBrowserTarget !== undefined) {
|
|
120
80
|
// Not use legacy way with builder (`angularBrowserTarget` is defined or null with builder and undefined without)
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
node_logger_1.logger.warn((0, ts_dedent_1.dedent) `Your Storybook startup uses a solution that will not be supported in version 7.0.
|
|
124
|
-
You must use angular builder to have an explicit configuration on the project used in angular.json
|
|
125
|
-
Read more at:
|
|
126
|
-
- https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#sb-angular-builder)
|
|
127
|
-
- https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular13)
|
|
128
|
-
`);
|
|
129
|
-
const dirToSearch = process.cwd();
|
|
130
|
-
// Read angular workspace
|
|
131
|
-
let workspaceConfig;
|
|
132
|
-
try {
|
|
133
|
-
workspaceConfig = await (0, angular_read_workspace_1.readAngularWorkspaceConfig)(dirToSearch);
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
node_logger_1.logger.error(`=> Could not find angular workspace config (angular.json) on this path "${dirToSearch}"`);
|
|
137
|
-
node_logger_1.logger.info(`=> Fail to load angular-cli config. Using base config`);
|
|
138
|
-
return {};
|
|
139
|
-
}
|
|
140
|
-
// Find angular project target
|
|
141
|
-
try {
|
|
142
|
-
const browserTarget = {
|
|
143
|
-
configuration: undefined,
|
|
144
|
-
project: (0, angular_read_workspace_1.getDefaultProjectName)(workspaceConfig),
|
|
145
|
-
target: 'build',
|
|
146
|
-
};
|
|
147
|
-
const { target } = (0, angular_read_workspace_1.findAngularProjectTarget)(workspaceConfig, browserTarget.project, browserTarget.target);
|
|
148
|
-
node_logger_1.logger.info(`=> Using angular project "${browserTarget.project}:${browserTarget.target}" for configuring Storybook`);
|
|
149
|
-
return { ...target.options };
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
node_logger_1.logger.error(`=> Could not find angular project: ${error.message}`);
|
|
153
|
-
node_logger_1.logger.info(`=> Fail to load angular-cli config. Using base config`);
|
|
154
|
-
return {};
|
|
81
|
+
return;
|
|
155
82
|
}
|
|
83
|
+
node_logger_1.logger.error(exports.migrationToBuilderReferrenceMessage);
|
|
84
|
+
throw Error('angularBrowserTarget is undefined.');
|
|
156
85
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Options as CoreOptions } from '@storybook/types';
|
|
2
2
|
import { BuilderContext } from '@angular-devkit/architect';
|
|
3
|
-
import {
|
|
3
|
+
import { StylePreprocessorOptions } from '@angular-devkit/build-angular';
|
|
4
|
+
import { StyleElement } from '@angular-devkit/build-angular/src/builders/browser/schema';
|
|
4
5
|
export type PresetOptions = CoreOptions & {
|
|
5
6
|
angularBrowserTarget?: string | null;
|
|
6
7
|
angularBuilderOptions?: {
|
|
7
|
-
styles?:
|
|
8
|
+
styles?: StyleElement[];
|
|
8
9
|
stylePreprocessorOptions?: StylePreprocessorOptions;
|
|
9
10
|
};
|
|
10
11
|
angularBuilderContext?: BuilderContext | null;
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/jest.config.js
CHANGED
|
@@ -9,4 +9,23 @@ module.exports = {
|
|
|
9
9
|
escapeString: true,
|
|
10
10
|
printBasicPrototype: true,
|
|
11
11
|
},
|
|
12
|
+
globals: {
|
|
13
|
+
'ts-jest': {
|
|
14
|
+
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
15
|
+
stringifyContentPathRegex: '\\.(html|svg)$',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
coverageDirectory: './coverage/testapp',
|
|
19
|
+
transform: {
|
|
20
|
+
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
|
|
21
|
+
},
|
|
22
|
+
snapshotSerializers: [
|
|
23
|
+
'jest-preset-angular/build/serializers/no-ng-attributes',
|
|
24
|
+
'jest-preset-angular/build/serializers/ng-snapshot',
|
|
25
|
+
'jest-preset-angular/build/serializers/html-comment',
|
|
26
|
+
],
|
|
27
|
+
testMatch: [
|
|
28
|
+
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
|
|
29
|
+
'<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)',
|
|
30
|
+
],
|
|
12
31
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-rc.1",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -21,39 +21,41 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"main": "dist/index.js",
|
|
24
|
+
"module": "dist/index.mjs",
|
|
24
25
|
"types": "dist/index.d.ts",
|
|
25
26
|
"files": [
|
|
26
27
|
"dist/**/*",
|
|
27
28
|
"template/**/*",
|
|
28
29
|
"README.md",
|
|
29
30
|
"*.js",
|
|
31
|
+
"*.mjs",
|
|
30
32
|
"*.d.ts"
|
|
31
33
|
],
|
|
32
34
|
"scripts": {
|
|
33
35
|
"check": "../../../scripts/node_modules/.bin/tsc",
|
|
34
|
-
"prep": "
|
|
36
|
+
"prep": "../../../scripts/prepare/tsc.ts"
|
|
35
37
|
},
|
|
36
38
|
"dependencies": {
|
|
37
|
-
"@storybook/builder-webpack5": "7.0.0-
|
|
38
|
-
"@storybook/
|
|
39
|
-
"@storybook/
|
|
40
|
-
"@storybook/core-
|
|
41
|
-
"@storybook/core-
|
|
42
|
-
"@storybook/core-
|
|
43
|
-
"@storybook/core-
|
|
44
|
-
"@storybook/
|
|
45
|
-
"@storybook/
|
|
46
|
-
"@storybook/
|
|
47
|
-
"@storybook/
|
|
48
|
-
"@storybook/
|
|
39
|
+
"@storybook/builder-webpack5": "7.0.0-rc.1",
|
|
40
|
+
"@storybook/cli": "7.0.0-rc.1",
|
|
41
|
+
"@storybook/client-logger": "7.0.0-rc.1",
|
|
42
|
+
"@storybook/core-client": "7.0.0-rc.1",
|
|
43
|
+
"@storybook/core-common": "7.0.0-rc.1",
|
|
44
|
+
"@storybook/core-events": "7.0.0-rc.1",
|
|
45
|
+
"@storybook/core-server": "7.0.0-rc.1",
|
|
46
|
+
"@storybook/core-webpack": "7.0.0-rc.1",
|
|
47
|
+
"@storybook/docs-tools": "7.0.0-rc.1",
|
|
48
|
+
"@storybook/global": "^5.0.0",
|
|
49
|
+
"@storybook/manager-api": "7.0.0-rc.1",
|
|
50
|
+
"@storybook/node-logger": "7.0.0-rc.1",
|
|
51
|
+
"@storybook/preview-api": "7.0.0-rc.1",
|
|
52
|
+
"@storybook/types": "7.0.0-rc.1",
|
|
49
53
|
"@types/node": "^16.0.0",
|
|
50
54
|
"@types/react": "^16.14.34",
|
|
51
55
|
"@types/react-dom": "^16.9.14",
|
|
52
56
|
"@types/semver": "^7.3.4",
|
|
53
57
|
"@types/webpack-env": "^1.18.0",
|
|
54
|
-
"core-js": "^3.8.2",
|
|
55
58
|
"find-up": "^5.0.0",
|
|
56
|
-
"global": "^4.4.0",
|
|
57
59
|
"read-pkg-up": "^7.0.1",
|
|
58
60
|
"semver": "^7.3.7",
|
|
59
61
|
"telejson": "^7.0.3",
|
|
@@ -63,23 +65,23 @@
|
|
|
63
65
|
"webpack": "5"
|
|
64
66
|
},
|
|
65
67
|
"devDependencies": {
|
|
66
|
-
"@angular-devkit/architect": "^0.
|
|
67
|
-
"@angular-devkit/build-angular": "^
|
|
68
|
-
"@angular-devkit/core": "^
|
|
69
|
-
"@angular/
|
|
70
|
-
"@angular/
|
|
71
|
-
"@angular/
|
|
72
|
-
"@angular/compiler
|
|
73
|
-
"@angular/
|
|
74
|
-
"@angular/
|
|
75
|
-
"@angular/
|
|
76
|
-
"@angular/platform-browser
|
|
77
|
-
"@
|
|
68
|
+
"@angular-devkit/architect": "^0.1500.4",
|
|
69
|
+
"@angular-devkit/build-angular": "^15.1.1",
|
|
70
|
+
"@angular-devkit/core": "^15.1.1",
|
|
71
|
+
"@angular/animations": "^15.1.1",
|
|
72
|
+
"@angular/cli": "^15.1.1",
|
|
73
|
+
"@angular/common": "^15.1.1",
|
|
74
|
+
"@angular/compiler": "^15.1.1",
|
|
75
|
+
"@angular/compiler-cli": "^15.1.1",
|
|
76
|
+
"@angular/core": "^15.1.1",
|
|
77
|
+
"@angular/forms": "^15.1.1",
|
|
78
|
+
"@angular/platform-browser": "^15.1.1",
|
|
79
|
+
"@angular/platform-browser-dynamic": "^15.1.1",
|
|
78
80
|
"@types/rimraf": "^3.0.2",
|
|
79
81
|
"@types/tmp": "^0.2.3",
|
|
80
82
|
"cross-spawn": "^7.0.3",
|
|
81
83
|
"jest": "^29.3.1",
|
|
82
|
-
"jest-preset-angular": "^12.
|
|
84
|
+
"jest-preset-angular": "^12.2.3",
|
|
83
85
|
"jest-specific-snapshot": "^7.0.0",
|
|
84
86
|
"rimraf": "^3.0.2",
|
|
85
87
|
"tmp": "^0.2.1",
|
|
@@ -88,19 +90,18 @@
|
|
|
88
90
|
"zone.js": "^0.12.0"
|
|
89
91
|
},
|
|
90
92
|
"peerDependencies": {
|
|
91
|
-
"@angular-devkit/architect": ">=0.
|
|
92
|
-
"@angular-devkit/build-angular": ">=
|
|
93
|
-
"@angular-devkit/core": ">=
|
|
94
|
-
"@angular/cli": ">=
|
|
95
|
-
"@angular/common": ">=
|
|
96
|
-
"@angular/compiler": ">=
|
|
97
|
-
"@angular/compiler-cli": ">=
|
|
98
|
-
"@angular/core": ">=
|
|
99
|
-
"@angular/forms": ">=
|
|
100
|
-
"@angular/platform-browser": ">=
|
|
101
|
-
"@angular/platform-browser-dynamic": ">=
|
|
93
|
+
"@angular-devkit/architect": ">=0.1400.0 < 0.1600.0",
|
|
94
|
+
"@angular-devkit/build-angular": ">=14.1.0 < 16.0.0",
|
|
95
|
+
"@angular-devkit/core": ">=14.1.0 < 16.0.0",
|
|
96
|
+
"@angular/cli": ">=14.1.0 < 16.0.0",
|
|
97
|
+
"@angular/common": ">=14.1.0 < 16.0.0",
|
|
98
|
+
"@angular/compiler": ">=14.1.0 < 16.0.0",
|
|
99
|
+
"@angular/compiler-cli": ">=14.1.0 < 16.0.0",
|
|
100
|
+
"@angular/core": ">=14.1.0 < 16.0.0",
|
|
101
|
+
"@angular/forms": ">=14.1.0 < 16.0.0",
|
|
102
|
+
"@angular/platform-browser": ">=14.1.0 < 16.0.0",
|
|
103
|
+
"@angular/platform-browser-dynamic": ">=14.1.0 < 16.0.0",
|
|
102
104
|
"@babel/core": "*",
|
|
103
|
-
"@nrwl/workspace": "14.6.1",
|
|
104
105
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
105
106
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
106
107
|
"rxjs": "^6.0.0 || ^7.4.0",
|
|
@@ -110,9 +111,6 @@
|
|
|
110
111
|
"peerDependenciesMeta": {
|
|
111
112
|
"@angular/cli": {
|
|
112
113
|
"optional": true
|
|
113
|
-
},
|
|
114
|
-
"@nrwl/workspace": {
|
|
115
|
-
"optional": true
|
|
116
114
|
}
|
|
117
115
|
},
|
|
118
116
|
"engines": {
|
|
@@ -122,5 +120,8 @@
|
|
|
122
120
|
"access": "public"
|
|
123
121
|
},
|
|
124
122
|
"builders": "dist/builders/builders.json",
|
|
125
|
-
"
|
|
123
|
+
"bundler": {
|
|
124
|
+
"tsConfig": "tsconfig.build.json"
|
|
125
|
+
},
|
|
126
|
+
"gitHead": "115d69123dc7c4dfab9538d2b273cb0fcc372852"
|
|
126
127
|
}
|
|
@@ -8,8 +8,8 @@ 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
|
|
12
|
-
tags: ['
|
|
11
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/7.0/angular/writing-docs/docs-page
|
|
12
|
+
tags: ['autodocs'],
|
|
13
13
|
render: (args) => ({ props: args }),
|
|
14
14
|
decorators: [
|
|
15
15
|
moduleMetadata({
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
1
2
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
3
|
|
|
3
4
|
@Component({
|
|
4
5
|
selector: 'storybook-button',
|
|
6
|
+
imports: [CommonModule],
|
|
5
7
|
template: ` <button
|
|
6
8
|
type="button"
|
|
7
9
|
(click)="onClick.emit($event)"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { global } from '@storybook/global';
|
|
2
2
|
|
|
3
3
|
import Button from './button.component';
|
|
4
4
|
import Html from './html.component';
|
|
5
5
|
import Pre from './pre.component';
|
|
6
6
|
import Form from './form.component';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
global.Components = { Button, Html, Pre, Form };
|
|
@@ -59,7 +59,7 @@ WithCustomNgComponentOutletWrapper.argTypes = {
|
|
|
59
59
|
name: { control: 'text' },
|
|
60
60
|
color: { control: 'color' },
|
|
61
61
|
};
|
|
62
|
-
WithCustomNgComponentOutletWrapper.args = { name: '
|
|
62
|
+
WithCustomNgComponentOutletWrapper.args = { name: 'Color', color: 'green' };
|
|
63
63
|
WithCustomNgComponentOutletWrapper.decorators = [
|
|
64
64
|
moduleMetadata({
|
|
65
65
|
declarations: [NgComponentOutletWrapperComponent],
|
|
@@ -59,7 +59,7 @@ WithComponentFactoryResolver.argTypes = {
|
|
|
59
59
|
name: { control: 'text' },
|
|
60
60
|
color: { control: 'color' },
|
|
61
61
|
};
|
|
62
|
-
WithComponentFactoryResolver.args = { name: '
|
|
62
|
+
WithComponentFactoryResolver.args = { name: 'Color', color: 'chartreuse' };
|
|
63
63
|
WithComponentFactoryResolver.decorators = [
|
|
64
64
|
moduleMetadata({
|
|
65
65
|
declarations: [ComponentFactoryWrapperComponent],
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StoryFn, Meta, moduleMetadata } from '@storybook/angular';
|
|
2
|
+
import { ChipsModule } from './angular-src/chips.module';
|
|
3
|
+
import { ChipComponent } from './angular-src/chip.component';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
component: ChipComponent,
|
|
7
|
+
decorators: [
|
|
8
|
+
moduleMetadata({
|
|
9
|
+
imports: [ChipsModule],
|
|
10
|
+
}),
|
|
11
|
+
],
|
|
12
|
+
} as Meta;
|
|
13
|
+
|
|
14
|
+
export const Chip: StoryFn = (args) => ({
|
|
15
|
+
props: args,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
Chip.args = {
|
|
19
|
+
displayText: 'Chip',
|
|
20
|
+
};
|
|
21
|
+
Chip.argTypes = {
|
|
22
|
+
removeClicked: { action: 'Remove icon clicked' },
|
|
23
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { StoryFn, Meta, moduleMetadata } from '@storybook/angular';
|
|
2
2
|
import { ChipsModule } from './angular-src/chips.module';
|
|
3
3
|
import { ChipsGroupComponent } from './angular-src/chips-group.component';
|
|
4
|
-
import { ChipComponent } from './angular-src/chip.component';
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
6
|
// title: 'Basics / NgModule / Module with multiple component',
|
|
@@ -14,9 +13,9 @@ export default {
|
|
|
14
13
|
} as Meta;
|
|
15
14
|
|
|
16
15
|
export const ChipsGroup: StoryFn = (args) => ({
|
|
17
|
-
component: ChipsGroupComponent,
|
|
18
16
|
props: args,
|
|
19
17
|
});
|
|
18
|
+
|
|
20
19
|
ChipsGroup.args = {
|
|
21
20
|
chips: [
|
|
22
21
|
{
|
|
@@ -29,18 +28,8 @@ ChipsGroup.args = {
|
|
|
29
28
|
},
|
|
30
29
|
],
|
|
31
30
|
};
|
|
31
|
+
|
|
32
32
|
ChipsGroup.argTypes = {
|
|
33
33
|
removeChipClick: { action: 'Remove chip' },
|
|
34
34
|
removeAllChipsClick: { action: 'Remove all chips clicked' },
|
|
35
35
|
};
|
|
36
|
-
|
|
37
|
-
export const Chip: StoryFn = (args) => ({
|
|
38
|
-
component: ChipComponent,
|
|
39
|
-
props: args,
|
|
40
|
-
});
|
|
41
|
-
Chip.args = {
|
|
42
|
-
displayText: 'Chip',
|
|
43
|
-
};
|
|
44
|
-
Chip.argTypes = {
|
|
45
|
-
removeClicked: { action: 'Remove icon clicked' },
|
|
46
|
-
};
|
|
@@ -97,21 +97,3 @@ WithCustomDecorator.decorators = [
|
|
|
97
97
|
};
|
|
98
98
|
},
|
|
99
99
|
] as Story['decorators'];
|
|
100
|
-
|
|
101
|
-
export const AngularLegacyRendering = (args: Args) => ({
|
|
102
|
-
template: `Child Template`,
|
|
103
|
-
props: {
|
|
104
|
-
...args,
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
AngularLegacyRendering.parameters = { angularLegacyRendering: true };
|
|
108
|
-
AngularLegacyRendering.decorators = [
|
|
109
|
-
(storyFunc) => {
|
|
110
|
-
const story = storyFunc();
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
...story,
|
|
114
|
-
template: `Custom Decorator <div style="margin: 3em">${story.template}</div>`,
|
|
115
|
-
};
|
|
116
|
-
},
|
|
117
|
-
] as Story['decorators'];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-open-close',
|
|
7
|
+
animations: [
|
|
8
|
+
trigger('openClose', [
|
|
9
|
+
// ...
|
|
10
|
+
state(
|
|
11
|
+
'open',
|
|
12
|
+
style({
|
|
13
|
+
height: '200px',
|
|
14
|
+
opacity: 1,
|
|
15
|
+
backgroundColor: 'yellow',
|
|
16
|
+
})
|
|
17
|
+
),
|
|
18
|
+
state(
|
|
19
|
+
'closed',
|
|
20
|
+
style({
|
|
21
|
+
height: '100px',
|
|
22
|
+
opacity: 0.8,
|
|
23
|
+
backgroundColor: 'blue',
|
|
24
|
+
})
|
|
25
|
+
),
|
|
26
|
+
transition('open => closed', [animate('0.1s')]),
|
|
27
|
+
transition('closed => open', [animate('0.1s')]),
|
|
28
|
+
]),
|
|
29
|
+
],
|
|
30
|
+
templateUrl: 'open-close.component.html',
|
|
31
|
+
styleUrls: ['open-close.component.css'],
|
|
32
|
+
})
|
|
33
|
+
export class OpenCloseComponent {
|
|
34
|
+
isOpen = true;
|
|
35
|
+
|
|
36
|
+
toggle() {
|
|
37
|
+
this.isOpen = !this.isOpen;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/angular';
|
|
2
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
3
|
+
import { within, userEvent } from '@storybook/testing-library';
|
|
4
|
+
import { expect } from '@storybook/jest';
|
|
5
|
+
import { OpenCloseComponent } from './angular-src/open-close-component/open-close.component';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: OpenCloseComponent,
|
|
9
|
+
parameters: {
|
|
10
|
+
chromatic: { delay: 100 },
|
|
11
|
+
},
|
|
12
|
+
} as Meta;
|
|
13
|
+
|
|
14
|
+
export const WithBrowserAnimations: StoryFn = () => ({
|
|
15
|
+
template: `<app-open-close></app-open-close>`,
|
|
16
|
+
moduleMetadata: {
|
|
17
|
+
declarations: [OpenCloseComponent],
|
|
18
|
+
imports: [BrowserAnimationsModule],
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
WithBrowserAnimations.play = async ({ canvasElement }) => {
|
|
23
|
+
const canvas = within(canvasElement);
|
|
24
|
+
const opened = canvas.getByText('The box is now Open!');
|
|
25
|
+
expect(opened).toBeDefined();
|
|
26
|
+
const submitButton = canvas.getByRole('button');
|
|
27
|
+
await userEvent.click(submitButton);
|
|
28
|
+
const closed = canvas.getByText('The box is now Closed!');
|
|
29
|
+
expect(closed).toBeDefined();
|
|
30
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/angular';
|
|
2
|
+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
3
|
+
import { within, userEvent } from '@storybook/testing-library';
|
|
4
|
+
import { expect } from '@storybook/jest';
|
|
5
|
+
import { OpenCloseComponent } from './angular-src/open-close-component/open-close.component';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: OpenCloseComponent,
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
export const WithNoopBrowserAnimations: StoryFn = () => ({
|
|
12
|
+
template: `<app-open-close></app-open-close>`,
|
|
13
|
+
moduleMetadata: {
|
|
14
|
+
declarations: [OpenCloseComponent],
|
|
15
|
+
imports: [NoopAnimationsModule],
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
WithNoopBrowserAnimations.play = async ({ canvasElement }) => {
|
|
20
|
+
const canvas = within(canvasElement);
|
|
21
|
+
const opened = canvas.getByText('The box is now Open!');
|
|
22
|
+
expect(opened).toBeDefined();
|
|
23
|
+
const submitButton = canvas.getByRole('button');
|
|
24
|
+
await userEvent.click(submitButton);
|
|
25
|
+
const closed = canvas.getByText('The box is now Closed!');
|
|
26
|
+
expect(closed).toBeDefined();
|
|
27
|
+
};
|