@storybook/angular 7.1.0-alpha.1 → 7.1.0-alpha.11

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.
@@ -13,6 +13,17 @@ export type StorybookBuilderOptions = JsonObject & {
13
13
  stylePreprocessorOptions?: StylePreprocessorOptions;
14
14
  assets?: AssetPattern[];
15
15
  } & Pick<CLIOptions, 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'webpackStatsJson' | 'disableTelemetry'>;
16
- export type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
17
- declare const _default: import("@angular-devkit/architect/src/internal").Builder<any>;
16
+ export type StorybookBuilderOutput = JsonObject & BuilderOutput & {
17
+ [key: string]: any;
18
+ };
19
+ declare const _default: import("@angular-devkit/architect/src/internal").Builder<JsonObject & {
20
+ browserTarget?: string | null | undefined;
21
+ tsConfig?: string | undefined;
22
+ docs: boolean;
23
+ compodoc: boolean;
24
+ compodocArgs: string[];
25
+ styles?: StyleElement[] | undefined;
26
+ stylePreprocessorOptions?: StylePreprocessorOptions | undefined;
27
+ assets?: AssetPattern[] | undefined;
28
+ } & Pick<CLIOptions, "webpackStatsJson" | "outputDir" | "configDir" | "loglevel" | "quiet" | "disableTelemetry">>;
18
29
  export default _default;
@@ -6,12 +6,13 @@ 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");
12
- exports.default = (0, architect_1.createBuilder)(commandBuilder);
13
- function commandBuilder(options, context) {
14
- return (0, rxjs_1.from)(setup(options, context)).pipe((0, operators_1.switchMap)(({ tsConfig }) => {
13
+ (0, telemetry_1.addToGlobalContext)('cliVersion', cli_1.versions.storybook);
14
+ const commandBuilder = (options, context) => {
15
+ const builder = (0, rxjs_1.from)(setup(options, context)).pipe((0, operators_1.switchMap)(({ tsConfig }) => {
15
16
  const runCompodoc$ = options.compodoc
16
17
  ? (0, run_compodoc_1.runCompodoc)({ compodocArgs: options.compodocArgs, tsconfig: tsConfig }, context).pipe((0, operators_1.mapTo)({ tsConfig }))
17
18
  : (0, rxjs_1.of)({});
@@ -45,7 +46,9 @@ function commandBuilder(options, context) {
45
46
  }), (0, operators_1.switchMap)((standaloneOptions) => runInstance({ ...standaloneOptions, mode: 'static' })), (0, operators_1.map)(() => {
46
47
  return { success: true };
47
48
  }));
48
- }
49
+ return builder;
50
+ };
51
+ exports.default = (0, architect_1.createBuilder)(commandBuilder);
49
52
  async function setup(options, context) {
50
53
  let browserOptions;
51
54
  let browserTarget;
@@ -14,5 +14,14 @@ export type StorybookBuilderOptions = JsonObject & {
14
14
  assets?: AssetPattern[];
15
15
  } & Pick<CLIOptions, 'port' | 'host' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'disableTelemetry'>;
16
16
  export type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
17
- declare const _default: import("@angular-devkit/architect/src/internal").Builder<any>;
17
+ declare const _default: import("@angular-devkit/architect/src/internal").Builder<JsonObject & {
18
+ browserTarget?: string | null | undefined;
19
+ tsConfig?: string | undefined;
20
+ docs: boolean;
21
+ compodoc: boolean;
22
+ compodocArgs: string[];
23
+ styles?: StyleElement[] | undefined;
24
+ stylePreprocessorOptions?: StylePreprocessorOptions | undefined;
25
+ assets?: AssetPattern[] | undefined;
26
+ } & Pick<CLIOptions, "port" | "configDir" | "quiet" | "disableTelemetry" | "host" | "https" | "sslCa" | "sslCert" | "sslKey" | "smokeTest" | "ci">>;
18
27
  export default _default;
@@ -6,12 +6,13 @@ 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");
12
- exports.default = (0, architect_1.createBuilder)(commandBuilder);
13
- function commandBuilder(options, context) {
14
- return (0, rxjs_1.from)(setup(options, context)).pipe((0, operators_1.switchMap)(({ tsConfig }) => {
13
+ (0, telemetry_1.addToGlobalContext)('cliVersion', cli_1.versions.storybook);
14
+ const commandBuilder = (options, context) => {
15
+ const builder = (0, rxjs_1.from)(setup(options, context)).pipe((0, operators_1.switchMap)(({ tsConfig }) => {
15
16
  const runCompodoc$ = options.compodoc
16
17
  ? (0, run_compodoc_1.runCompodoc)({ compodocArgs: options.compodocArgs, tsconfig: tsConfig }, context).pipe((0, operators_1.mapTo)({ tsConfig }))
17
18
  : (0, rxjs_1.of)({});
@@ -54,7 +55,9 @@ function commandBuilder(options, context) {
54
55
  }), (0, operators_1.switchMap)((standaloneOptions) => runInstance(standaloneOptions)), (0, operators_1.map)((port) => {
55
56
  return { success: true, info: { port } };
56
57
  }));
57
- }
58
+ return builder;
59
+ };
60
+ exports.default = (0, architect_1.createBuilder)(commandBuilder);
58
61
  async function setup(options, context) {
59
62
  let browserOptions;
60
63
  let browserTarget;
@@ -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>;
@@ -15,7 +15,10 @@ const getComponentInputsOutputs = (component) => {
15
15
  };
16
16
  // Adds the I/O present in @Component metadata
17
17
  if (componentMetadata && componentMetadata.inputs) {
18
- initialValue.inputs.push(...componentMetadata.inputs.map((i) => ({ propName: i, templateName: i })));
18
+ initialValue.inputs.push(...componentMetadata.inputs.map((i) => ({
19
+ propName: typeof i === 'string' ? i : i.name,
20
+ templateName: typeof i === 'string' ? i : i.alias,
21
+ })));
19
22
  }
20
23
  if (componentMetadata && componentMetadata.outputs) {
21
24
  initialValue.outputs.push(...componentMetadata.outputs.map((i) => ({ propName: i, templateName: i })));
@@ -30,7 +33,7 @@ const getComponentInputsOutputs = (component) => {
30
33
  if (value instanceof core_1.Input) {
31
34
  const inputToAdd = {
32
35
  propName: propertyName,
33
- templateName: value.bindingPropertyName ?? propertyName,
36
+ templateName: value.bindingPropertyName ?? value.alias ?? propertyName,
34
37
  };
35
38
  const previousInputsFiltered = previousValue.inputs.filter((i) => i.templateName !== propertyName);
36
39
  return {
@@ -41,7 +44,7 @@ const getComponentInputsOutputs = (component) => {
41
44
  if (value instanceof core_1.Output) {
42
45
  const outputToAdd = {
43
46
  propName: propertyName,
44
- templateName: value.bindingPropertyName ?? propertyName,
47
+ templateName: value.bindingPropertyName ?? value.alias ?? propertyName,
45
48
  };
46
49
  const previousOutputsFiltered = previousValue.outputs.filter((i) => i.templateName !== propertyName);
47
50
  return {
@@ -368,11 +368,7 @@ function sortByPropName(array) {
368
368
  function resolveComponentFactory(component) {
369
369
  testing_1.TestBed.configureTestingModule({
370
370
  declarations: [component],
371
- }).overrideModule(testing_2.BrowserDynamicTestingModule, {
372
- set: {
373
- entryComponents: [component],
374
- },
375
- });
371
+ }).overrideModule(testing_2.BrowserDynamicTestingModule, {});
376
372
  const componentFactoryResolver = testing_1.TestBed.inject(core_1.ComponentFactoryResolver);
377
373
  return componentFactoryResolver.resolveComponentFactory(component);
378
374
  }
@@ -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;
@@ -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?.hot?.decline();
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 core_client_1 = require("@storybook/core-client");
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, core_client_1.start)(render_1.renderToCanvas, { decorateStory: decorateStory_1.default, render: render_1.render });
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');
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.webpack = exports.runNgcc = void 0;
27
+ const core_1 = require("@angular/core");
27
28
  const path = __importStar(require("path"));
28
29
  /**
29
30
  * Source : https://github.com/angular/angular-cli/blob/ebccb5de4a455af813c5e82483db6af20666bdbd/packages/angular_devkit/build_angular/src/utils/load-esm.ts#L23
@@ -51,7 +52,8 @@ function loadEsmModule(modulePath) {
51
52
  const runNgcc = async () => {
52
53
  let ngcc;
53
54
  try {
54
- ngcc = await Promise.resolve().then(() => __importStar(require('@angular/compiler-cli/ngcc')));
55
+ // eslint-disable-next-line global-require
56
+ ngcc = require('@angular/compiler-cli/ngcc');
55
57
  }
56
58
  catch (error) {
57
59
  ngcc = await loadEsmModule('@angular/compiler-cli/ngcc');
@@ -69,26 +71,25 @@ exports.runNgcc = runNgcc;
69
71
  const webpack = async (webpackConfig, options) => {
70
72
  const framework = await options.presets.apply('framework');
71
73
  const angularOptions = (typeof framework === 'object' ? framework.options : {});
74
+ const isAngular16OrNewer = parseInt(core_1.VERSION.major, 10) >= 16;
72
75
  // Default to true, if undefined
73
76
  if (angularOptions.enableIvy === false) {
74
77
  return webpackConfig;
75
78
  }
76
- if (angularOptions.enableNgcc !== false) {
79
+ let extraMainFields = [];
80
+ if (angularOptions.enableNgcc !== false && !isAngular16OrNewer) {
81
+ // TODO: Drop if Angular 14 and 15 are not supported anymore
77
82
  (0, exports.runNgcc)();
83
+ extraMainFields = ['es2015_ivy_ngcc', 'module_ivy_ngcc', 'main_ivy_ngcc'];
84
+ }
85
+ if (!isAngular16OrNewer) {
86
+ extraMainFields.push('es2015');
78
87
  }
79
88
  return {
80
89
  ...webpackConfig,
81
90
  resolve: {
82
91
  ...webpackConfig.resolve,
83
- mainFields: [
84
- 'es2015_ivy_ngcc',
85
- 'module_ivy_ngcc',
86
- 'main_ivy_ngcc',
87
- 'es2015',
88
- 'browser',
89
- 'module',
90
- 'main',
91
- ],
92
+ mainFields: [...extraMainFields, 'browser', 'module', 'main'],
92
93
  },
93
94
  };
94
95
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "7.1.0-alpha.1",
3
+ "version": "7.1.0-alpha.11",
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.1",
40
- "@storybook/cli": "7.1.0-alpha.1",
41
- "@storybook/client-logger": "7.1.0-alpha.1",
42
- "@storybook/core-client": "7.1.0-alpha.1",
43
- "@storybook/core-common": "7.1.0-alpha.1",
44
- "@storybook/core-events": "7.1.0-alpha.1",
45
- "@storybook/core-server": "7.1.0-alpha.1",
46
- "@storybook/core-webpack": "7.1.0-alpha.1",
47
- "@storybook/docs-tools": "7.1.0-alpha.1",
39
+ "@storybook/builder-webpack5": "7.1.0-alpha.11",
40
+ "@storybook/cli": "7.1.0-alpha.11",
41
+ "@storybook/client-logger": "7.1.0-alpha.11",
42
+ "@storybook/core-common": "7.1.0-alpha.11",
43
+ "@storybook/core-events": "7.1.0-alpha.11",
44
+ "@storybook/core-server": "7.1.0-alpha.11",
45
+ "@storybook/core-webpack": "7.1.0-alpha.11",
46
+ "@storybook/docs-tools": "7.1.0-alpha.11",
48
47
  "@storybook/global": "^5.0.0",
49
- "@storybook/manager-api": "7.1.0-alpha.1",
50
- "@storybook/node-logger": "7.1.0-alpha.1",
51
- "@storybook/preview-api": "7.1.0-alpha.1",
52
- "@storybook/types": "7.1.0-alpha.1",
48
+ "@storybook/manager-api": "7.1.0-alpha.11",
49
+ "@storybook/node-logger": "7.1.0-alpha.11",
50
+ "@storybook/preview-api": "7.1.0-alpha.11",
51
+ "@storybook/telemetry": "7.1.0-alpha.11",
52
+ "@storybook/types": "7.1.0-alpha.11",
53
53
  "@types/node": "^16.0.0",
54
54
  "@types/react": "^16.14.34",
55
55
  "@types/react-dom": "^16.9.14",
@@ -65,18 +65,18 @@
65
65
  "webpack": "5"
66
66
  },
67
67
  "devDependencies": {
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",
68
+ "@angular-devkit/architect": "^0.1600.0-rc.3",
69
+ "@angular-devkit/build-angular": "^16.0.0-rc.3",
70
+ "@angular-devkit/core": "^16.0.0-rc.3",
71
+ "@angular/animations": "^16.0.0-rc.3",
72
+ "@angular/cli": "^16.0.0-rc.3",
73
+ "@angular/common": "^16.0.0-rc.3",
74
+ "@angular/compiler": "^16.0.0-rc.3",
75
+ "@angular/compiler-cli": "^16.0.0-rc.3",
76
+ "@angular/core": "^16.0.0-rc.3",
77
+ "@angular/forms": "^16.0.0-rc.3",
78
+ "@angular/platform-browser": "^16.0.0-rc.3",
79
+ "@angular/platform-browser-dynamic": "^16.0.0-rc.3",
80
80
  "@types/rimraf": "^3.0.2",
81
81
  "@types/tmp": "^0.2.3",
82
82
  "cross-spawn": "^7.0.3",
@@ -87,20 +87,20 @@
87
87
  "tmp": "^0.2.1",
88
88
  "typescript": "~4.9.3",
89
89
  "webpack": "5",
90
- "zone.js": "^0.12.0"
90
+ "zone.js": "^0.13.0"
91
91
  },
92
92
  "peerDependencies": {
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",
93
+ "@angular-devkit/architect": ">=0.1400.0 < 0.1700.0",
94
+ "@angular-devkit/build-angular": ">=14.1.0 < 17.0.0",
95
+ "@angular-devkit/core": ">=14.1.0 < 17.0.0",
96
+ "@angular/cli": ">=14.1.0 < 17.0.0",
97
+ "@angular/common": ">=14.1.0 < 17.0.0",
98
+ "@angular/compiler": ">=14.1.0 < 17.0.0",
99
+ "@angular/compiler-cli": ">=14.1.0 < 17.0.0",
100
+ "@angular/core": ">=14.1.0 < 17.0.0",
101
+ "@angular/forms": ">=14.1.0 < 17.0.0",
102
+ "@angular/platform-browser": ">=14.1.0 < 17.0.0",
103
+ "@angular/platform-browser-dynamic": ">=14.1.0 < 17.0.0",
104
104
  "@babel/core": "*",
105
105
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
106
106
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
@@ -123,5 +123,5 @@
123
123
  "bundler": {
124
124
  "tsConfig": "tsconfig.build.json"
125
125
  },
126
- "gitHead": "48a1df25493b1cc26a405096e723301f4bb04b4e"
126
+ "gitHead": "0797ab602bc569ff71c343a2b1aaba7e49232d95"
127
127
  }