@storybook/angular 7.0.0-alpha.54 → 7.0.0-alpha.56

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.
@@ -1,5 +1,5 @@
1
1
  import { Type } from '@angular/core';
2
- import { API_ArgTypes } from '@storybook/types';
2
+ import { ArgTypes } from '@storybook/types';
3
3
  import { ICollection } from '../types';
4
4
  /**
5
5
  * Converts a component into a template with inputs/outputs present in initial props
@@ -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?: API_ArgTypes) => string;
17
+ export declare const computesTemplateSourceFromComponent: (component: Type<unknown>, initialProps?: ICollection, argTypes?: ArgTypes) => string;
@@ -37,9 +37,9 @@ const computesTemplateFromComponent = (component, initialProps, innerTemplate =
37
37
  };
38
38
  exports.computesTemplateFromComponent = computesTemplateFromComponent;
39
39
  const createAngularInputProperty = ({ propertyName, value, argType, }) => {
40
- const { name: type = null, summary = null } = argType?.type || {};
41
- let templateValue = type === 'enum' && !!summary ? `${summary}.${value}` : value;
42
- const actualType = type === 'enum' && summary ? 'enum' : typeof value;
40
+ const { name: type = null } = (typeof argType?.type === 'object' && argType?.type) || {};
41
+ let templateValue = type === 'enum' && value;
42
+ const actualType = type === 'enum' && typeof value;
43
43
  const requiresBrackets = ['object', 'any', 'boolean', 'enum', 'number'].includes(actualType);
44
44
  if (typeof value === 'object') {
45
45
  templateValue = propertyName;
@@ -335,7 +335,7 @@ describe('angular source decorator', () => {
335
335
  type: {
336
336
  name: 'enum',
337
337
  required: true,
338
- summary: 'ButtonAccent',
338
+ value: [],
339
339
  },
340
340
  },
341
341
  };
@@ -362,6 +362,7 @@ describe('angular source decorator', () => {
362
362
  type: {
363
363
  name: 'object',
364
364
  required: true,
365
+ value: {},
365
366
  },
366
367
  },
367
368
  };
@@ -261,7 +261,7 @@ describe('RendererFactory', () => {
261
261
  .getElementById('storybook-root')
262
262
  .appendChild(global.document.createElement('👾'));
263
263
  expect(global.document.getElementById('storybook-root').innerHTML).toContain('Canvas 🖼');
264
- const render = await rendererFactory.getRendererInstance('my-story-in-docs', rootDocstargetDOMNode);
264
+ await rendererFactory.getRendererInstance('my-story-in-docs', rootDocstargetDOMNode);
265
265
  expect(global.document.getElementById('storybook-root').innerHTML).toBe('');
266
266
  });
267
267
  });
@@ -1,4 +1,4 @@
1
- import { API_ArgTypes } from '@storybook/types';
1
+ import { ArgTypes, SBType } from '@storybook/types';
2
2
  import { Class, CompodocJson, Component, Injectable, Method, Pipe, Property, Directive } from './types';
3
3
  export declare const isMethod: (methodOrProp: Method | Property) => methodOrProp is Method;
4
4
  export declare const setCompodocJson: (compodocJson: CompodocJson) => void;
@@ -6,13 +6,7 @@ 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
8
  export declare const findComponentByName: (name: string, compodocJson: CompodocJson) => Class | Injectable | Pipe | Directive;
9
- export declare const extractType: (property: Property, defaultValue: any) => {
10
- name: string;
11
- value?: undefined;
12
- } | {
13
- name: string;
14
- value: any[];
15
- };
16
- export declare const extractArgTypesFromData: (componentData: Class | Directive | Injectable | Pipe) => API_ArgTypes;
17
- export declare const extractArgTypes: (component: Component | Directive) => API_ArgTypes;
9
+ export declare const extractType: (property: Property, defaultValue: any) => SBType;
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>;
18
12
  export declare const extractComponentDescription: (component: Component | Directive) => string;
@@ -121,11 +121,13 @@ const extractType = (property, defaultValue) => {
121
121
  return { name: compodocType };
122
122
  case undefined:
123
123
  case null:
124
- return { name: 'void' };
124
+ return { name: 'other', value: 'void' };
125
125
  default: {
126
126
  const resolvedType = resolveTypealias(compodocType);
127
127
  const enumValues = extractEnumValues(resolvedType);
128
- return enumValues ? { name: 'enum', value: enumValues } : { name: 'object' };
128
+ return enumValues
129
+ ? { name: 'enum', value: enumValues }
130
+ : { name: 'other', value: 'empty-enum' };
129
131
  }
130
132
  }
131
133
  };
@@ -201,7 +203,7 @@ const extractArgTypesFromData = (componentData) => {
201
203
  const section = mapItemToSection(key, item);
202
204
  const defaultValue = (0, exports.isMethod)(item) ? undefined : extractDefaultValue(item);
203
205
  const type = (0, exports.isMethod)(item) || (section !== 'inputs' && section !== 'properties')
204
- ? { name: 'void' }
206
+ ? { name: 'other', value: 'void' }
205
207
  : (0, exports.extractType)(item, defaultValue);
206
208
  const action = section === 'outputs' ? { action: item.name } : {};
207
209
  const argType = {
@@ -1,6 +1,6 @@
1
- import { Store_RenderContext, ArgsStoryFn } from '@storybook/types';
1
+ import { RenderContext, ArgsStoryFn } from '@storybook/types';
2
2
  import { AngularRenderer } from './types';
3
3
  import { RendererFactory } from './angular-beta/RendererFactory';
4
4
  export declare const rendererFactory: RendererFactory;
5
5
  export declare const render: ArgsStoryFn<AngularRenderer>;
6
- export declare function renderToCanvas({ storyFn, showMain, forceRemount, storyContext: { parameters, component }, id, }: Store_RenderContext<AngularRenderer>, element: HTMLElement): Promise<void>;
6
+ export declare function renderToCanvas({ storyFn, showMain, forceRemount, storyContext: { parameters, component }, id, }: RenderContext<AngularRenderer>, element: HTMLElement): Promise<void>;
@@ -28,10 +28,8 @@ describe('framework-preset-angular-cli', () => {
28
28
  options = {};
29
29
  });
30
30
  describe('without angular.json', () => {
31
- let consoleErrorSpy;
32
31
  beforeEach(() => {
33
32
  initMockWorkspace('');
34
- consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation();
35
33
  });
36
34
  it('should return webpack base config and display log error', async () => {
37
35
  const webpackBaseConfig = newWebpackConfiguration();
@@ -336,10 +334,6 @@ describe('framework-preset-angular-cli', () => {
336
334
  it('should set webpack "module.rules"', async () => {
337
335
  const baseWebpackConfig = newWebpackConfiguration();
338
336
  const webpackFinalConfig = await (0, framework_preset_angular_cli_1.webpackFinal)(baseWebpackConfig, options);
339
- const stylePaths = [
340
- path_1.default.join(workspaceRoot, 'src', 'styles.css'),
341
- path_1.default.join(workspaceRoot, 'src', 'styles.scss'),
342
- ];
343
337
  const expectedRules = [
344
338
  {
345
339
  oneOf: [
@@ -417,10 +411,6 @@ describe('framework-preset-angular-cli', () => {
417
411
  it('should set webpack "module.rules"', async () => {
418
412
  const baseWebpackConfig = newWebpackConfiguration();
419
413
  const webpackFinalConfig = await (0, framework_preset_angular_cli_1.webpackFinal)(baseWebpackConfig, options);
420
- const stylePaths = [
421
- path_1.default.join(workspaceRoot, 'src', 'styles.css'),
422
- path_1.default.join(workspaceRoot, 'src', 'styles.scss'),
423
- ];
424
414
  const expectedRules = [
425
415
  {
426
416
  oneOf: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "7.0.0-alpha.54",
3
+ "version": "7.0.0-alpha.56",
4
4
  "description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -34,18 +34,18 @@
34
34
  "prep": "rimraf dist && ../../../scripts/node_modules/.bin/tsc --project tsconfig.build.json && echo \"Preventing passing flags to tsc\""
35
35
  },
36
36
  "dependencies": {
37
- "@storybook/builder-webpack5": "7.0.0-alpha.54",
38
- "@storybook/client-logger": "7.0.0-alpha.54",
39
- "@storybook/core-client": "7.0.0-alpha.54",
40
- "@storybook/core-common": "7.0.0-alpha.54",
41
- "@storybook/core-events": "7.0.0-alpha.54",
42
- "@storybook/core-server": "7.0.0-alpha.54",
43
- "@storybook/core-webpack": "7.0.0-alpha.54",
44
- "@storybook/docs-tools": "7.0.0-alpha.54",
45
- "@storybook/manager-api": "7.0.0-alpha.54",
46
- "@storybook/node-logger": "7.0.0-alpha.54",
47
- "@storybook/preview-api": "7.0.0-alpha.54",
48
- "@storybook/types": "7.0.0-alpha.54",
37
+ "@storybook/builder-webpack5": "7.0.0-alpha.56",
38
+ "@storybook/client-logger": "7.0.0-alpha.56",
39
+ "@storybook/core-client": "7.0.0-alpha.56",
40
+ "@storybook/core-common": "7.0.0-alpha.56",
41
+ "@storybook/core-events": "7.0.0-alpha.56",
42
+ "@storybook/core-server": "7.0.0-alpha.56",
43
+ "@storybook/core-webpack": "7.0.0-alpha.56",
44
+ "@storybook/docs-tools": "7.0.0-alpha.56",
45
+ "@storybook/manager-api": "7.0.0-alpha.56",
46
+ "@storybook/node-logger": "7.0.0-alpha.56",
47
+ "@storybook/preview-api": "7.0.0-alpha.56",
48
+ "@storybook/types": "7.0.0-alpha.56",
49
49
  "@types/node": "^16.0.0",
50
50
  "@types/react": "^16.14.34",
51
51
  "@types/react-dom": "^16.9.14",
@@ -58,7 +58,7 @@
58
58
  "react-dom": "^16.14.0",
59
59
  "read-pkg-up": "^7.0.1",
60
60
  "semver": "^7.3.7",
61
- "telejson": "^6.0.8",
61
+ "telejson": "^7.0.3",
62
62
  "ts-dedent": "^2.0.0",
63
63
  "tsconfig-paths-webpack-plugin": "^3.5.2",
64
64
  "util-deprecate": "^1.0.2",
@@ -82,7 +82,7 @@
82
82
  "cross-spawn": "^7.0.3",
83
83
  "jest": "^29.3.1",
84
84
  "jest-preset-angular": "^12.0.0",
85
- "jest-specific-snapshot": "^6.0.0",
85
+ "jest-specific-snapshot": "^7.0.0",
86
86
  "rimraf": "^3.0.2",
87
87
  "tmp": "^0.2.1",
88
88
  "typescript": "^4.9.3",
@@ -122,5 +122,5 @@
122
122
  "access": "public"
123
123
  },
124
124
  "builders": "dist/builders/builders.json",
125
- "gitHead": "91177d4e27daec556a24ae6223c3cbe17a998d9b"
125
+ "gitHead": "c8e9a862bb83c4a0d6b5975e795b4ca7f7ff7bc2"
126
126
  }