@storybook/angular 6.5.7 → 6.5.9-alpha.0
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/dist/ts3.4/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +1 -0
- package/dist/ts3.9/client/preview/angular-beta/StorybookModule.js +8 -2
- package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +1 -0
- package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.js +10 -1
- package/package.json +11 -11
|
@@ -15,6 +15,7 @@ export declare type ComponentInputsOutputs = {
|
|
|
15
15
|
export declare const getComponentInputsOutputs: (component: any) => ComponentInputsOutputs;
|
|
16
16
|
export declare const isDeclarable: (component: any) => boolean;
|
|
17
17
|
export declare const isComponent: (component: any) => component is Type<unknown>;
|
|
18
|
+
export declare const isStandaloneComponent: (component: any) => component is Type<unknown>;
|
|
18
19
|
/**
|
|
19
20
|
* Returns all component decorator properties
|
|
20
21
|
* is used to get all `@Input` and `@Output` Decorator
|
|
@@ -45,16 +45,22 @@ exports.getStorybookModuleMetadata = ({ storyFnAngular, component: annotatedComp
|
|
|
45
45
|
* Create a component that wraps generated template and gives it props
|
|
46
46
|
*/
|
|
47
47
|
const ComponentToInject = StorybookWrapperComponent_1.createStorybookWrapperComponent(targetSelector, template, component, styles, props);
|
|
48
|
+
const isStandalone = NgComponentAnalyzer_1.isStandaloneComponent(component);
|
|
48
49
|
// Look recursively (deep) if the component is not already declared by an import module
|
|
49
50
|
const requiresComponentDeclaration = NgComponentAnalyzer_1.isDeclarable(component) &&
|
|
50
|
-
!NgModulesAnalyzer_1.isComponentAlreadyDeclaredInModules(component, moduleMetadata.declarations, moduleMetadata.imports)
|
|
51
|
+
!NgModulesAnalyzer_1.isComponentAlreadyDeclaredInModules(component, moduleMetadata.declarations, moduleMetadata.imports) &&
|
|
52
|
+
!isStandalone;
|
|
51
53
|
return {
|
|
52
54
|
declarations: [
|
|
53
55
|
...(requiresComponentDeclaration ? [component] : []),
|
|
54
56
|
ComponentToInject,
|
|
55
57
|
...((_a = moduleMetadata.declarations) !== null && _a !== void 0 ? _a : []),
|
|
56
58
|
],
|
|
57
|
-
imports: [
|
|
59
|
+
imports: [
|
|
60
|
+
platform_browser_1.BrowserModule,
|
|
61
|
+
...(isStandalone ? [component] : []),
|
|
62
|
+
...((_b = moduleMetadata.imports) !== null && _b !== void 0 ? _b : []),
|
|
63
|
+
],
|
|
58
64
|
providers: [StorybookProvider_1.storyPropsProvider(storyProps$), ...((_c = moduleMetadata.providers) !== null && _c !== void 0 ? _c : [])],
|
|
59
65
|
entryComponents: [...((_d = moduleMetadata.entryComponents) !== null && _d !== void 0 ? _d : [])],
|
|
60
66
|
schemas: [...((_e = moduleMetadata.schemas) !== null && _e !== void 0 ? _e : [])],
|
|
@@ -15,6 +15,7 @@ export declare type ComponentInputsOutputs = {
|
|
|
15
15
|
export declare const getComponentInputsOutputs: (component: any) => ComponentInputsOutputs;
|
|
16
16
|
export declare const isDeclarable: (component: any) => boolean;
|
|
17
17
|
export declare const isComponent: (component: any) => component is Type<unknown>;
|
|
18
|
+
export declare const isStandaloneComponent: (component: any) => component is Type<unknown>;
|
|
18
19
|
/**
|
|
19
20
|
* Returns all component decorator properties
|
|
20
21
|
* is used to get all `@Input` and `@Output` Decorator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getComponentDecoratorMetadata = exports.getComponentPropsDecoratorMetadata = exports.isComponent = exports.isDeclarable = exports.getComponentInputsOutputs = void 0;
|
|
3
|
+
exports.getComponentDecoratorMetadata = exports.getComponentPropsDecoratorMetadata = exports.isStandaloneComponent = exports.isComponent = exports.isDeclarable = exports.getComponentInputsOutputs = void 0;
|
|
4
4
|
const core_1 = require("@angular/core");
|
|
5
5
|
const reflectionCapabilities = new core_1.ɵReflectionCapabilities();
|
|
6
6
|
/**
|
|
@@ -61,6 +61,15 @@ exports.isComponent = (component) => {
|
|
|
61
61
|
const decorators = reflectionCapabilities.annotations(component);
|
|
62
62
|
return (decorators || []).some((d) => d instanceof core_1.Component);
|
|
63
63
|
};
|
|
64
|
+
exports.isStandaloneComponent = (component) => {
|
|
65
|
+
if (!component) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
const decorators = reflectionCapabilities.annotations(component);
|
|
69
|
+
// TODO: `standalone` is only available in Angular v14. Remove cast to `any` once
|
|
70
|
+
// Angular deps are updated to v14.x.x.
|
|
71
|
+
return (decorators || []).some((d) => d instanceof core_1.Component && d.standalone);
|
|
72
|
+
};
|
|
64
73
|
/**
|
|
65
74
|
* Returns all component decorator properties
|
|
66
75
|
* is used to get all `@Input` and `@Output` Decorator
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.9-alpha.0",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular Components in isolation with Hot Reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
"prepare": "node ../../scripts/prepare.js"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@storybook/addons": "6.5.
|
|
49
|
-
"@storybook/api": "6.5.
|
|
50
|
-
"@storybook/client-logger": "6.5.
|
|
51
|
-
"@storybook/core": "6.5.
|
|
52
|
-
"@storybook/core-common": "6.5.
|
|
53
|
-
"@storybook/core-events": "6.5.
|
|
48
|
+
"@storybook/addons": "6.5.9-alpha.0",
|
|
49
|
+
"@storybook/api": "6.5.9-alpha.0",
|
|
50
|
+
"@storybook/client-logger": "6.5.9-alpha.0",
|
|
51
|
+
"@storybook/core": "6.5.9-alpha.0",
|
|
52
|
+
"@storybook/core-common": "6.5.9-alpha.0",
|
|
53
|
+
"@storybook/core-events": "6.5.9-alpha.0",
|
|
54
54
|
"@storybook/csf": "0.0.2--canary.4566f4d.1",
|
|
55
|
-
"@storybook/docs-tools": "6.5.
|
|
56
|
-
"@storybook/node-logger": "6.5.
|
|
55
|
+
"@storybook/docs-tools": "6.5.9-alpha.0",
|
|
56
|
+
"@storybook/node-logger": "6.5.9-alpha.0",
|
|
57
57
|
"@storybook/semver": "^7.3.2",
|
|
58
|
-
"@storybook/store": "6.5.
|
|
58
|
+
"@storybook/store": "6.5.9-alpha.0",
|
|
59
59
|
"@types/node": "^14.14.20 || ^16.0.0",
|
|
60
60
|
"@types/react": "^16.14.23",
|
|
61
61
|
"@types/react-dom": "^16.9.14",
|
|
@@ -137,5 +137,5 @@
|
|
|
137
137
|
"access": "public"
|
|
138
138
|
},
|
|
139
139
|
"builders": "dist/ts3.9/builders/builders.json",
|
|
140
|
-
"gitHead": "
|
|
140
|
+
"gitHead": "561ef6e64c97d1c2457c4ebd807a82eca60a84f5"
|
|
141
141
|
}
|