@storybook/angular 9.1.0-alpha.5 → 9.1.0-alpha.7
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/build-schema.json +199 -0
- package/builders.json +14 -0
- package/dist/builders/build-storybook/index.js +31 -80
- package/dist/builders/start-storybook/index.js +31 -101
- package/dist/chunk-CUDJAP6K.mjs +3 -0
- package/dist/chunk-KMSSK3DZ.mjs +6 -0
- package/dist/chunk-LXSTVAFF.mjs +40 -0
- package/dist/client/config.d.ts +20 -6
- package/dist/client/config.js +49 -20
- package/dist/client/config.mjs +10 -13
- package/dist/client/docs/config.d.ts +6 -3
- package/dist/client/docs/config.js +18 -14
- package/dist/client/docs/config.mjs +6 -10
- package/dist/client/index.d.ts +144 -6
- package/dist/client/index.js +47 -30
- package/dist/client/index.mjs +3 -9
- package/dist/client/preview-prod.d.ts +2 -1
- package/dist/client/preview-prod.js +5 -4
- package/dist/client/preview-prod.mjs +1 -0
- package/dist/index.d.ts +59 -2
- package/dist/index.js +47 -29
- package/dist/index.mjs +3 -13
- package/dist/preset.js +8 -38
- package/dist/server/framework-preset-angular-cli.js +20 -83
- package/dist/server/framework-preset-angular-ivy.js +6 -59
- package/dist/{client/types.d.ts → types-3b0b7107.d.ts} +9 -9
- package/package.json +59 -12
- package/start-schema.json +234 -0
- package/dist/builders/build-storybook/index.d.ts +0 -25
- package/dist/builders/build-storybook/index.mjs +0 -78
- package/dist/builders/build-storybook/index.spec.d.ts +0 -1
- package/dist/builders/build-storybook/index.spec.js +0 -222
- package/dist/builders/build-storybook/index.spec.mjs +0 -187
- package/dist/builders/build-storybook/schema.json +0 -199
- package/dist/builders/builders.json +0 -14
- package/dist/builders/start-storybook/index.d.ts +0 -21
- package/dist/builders/start-storybook/index.mjs +0 -99
- package/dist/builders/start-storybook/index.spec.d.ts +0 -1
- package/dist/builders/start-storybook/index.spec.js +0 -188
- package/dist/builders/start-storybook/index.spec.mjs +0 -186
- package/dist/builders/start-storybook/schema.json +0 -234
- package/dist/builders/utils/error-handler.d.ts +0 -2
- package/dist/builders/utils/error-handler.js +0 -38
- package/dist/builders/utils/error-handler.mjs +0 -33
- package/dist/builders/utils/run-compodoc.d.ts +0 -6
- package/dist/builders/utils/run-compodoc.js +0 -35
- package/dist/builders/utils/run-compodoc.mjs +0 -31
- package/dist/builders/utils/run-compodoc.spec.d.ts +0 -1
- package/dist/builders/utils/run-compodoc.spec.js +0 -76
- package/dist/builders/utils/run-compodoc.spec.mjs +0 -74
- package/dist/builders/utils/standalone-options.d.ts +0 -18
- package/dist/builders/utils/standalone-options.js +0 -2
- package/dist/builders/utils/standalone-options.mjs +0 -1
- package/dist/client/angular-beta/AbstractRenderer.d.ts +0 -75
- package/dist/client/angular-beta/AbstractRenderer.js +0 -201
- package/dist/client/angular-beta/AbstractRenderer.mjs +0 -164
- package/dist/client/angular-beta/CanvasRenderer.d.ts +0 -12
- package/dist/client/angular-beta/CanvasRenderer.js +0 -13
- package/dist/client/angular-beta/CanvasRenderer.mjs +0 -9
- package/dist/client/angular-beta/ComputesTemplateFromComponent.d.ts +0 -24
- package/dist/client/angular-beta/ComputesTemplateFromComponent.js +0 -160
- package/dist/client/angular-beta/ComputesTemplateFromComponent.mjs +0 -154
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.d.ts +0 -1
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +0 -730
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.mjs +0 -728
- package/dist/client/angular-beta/DocsRenderer.d.ts +0 -13
- package/dist/client/angular-beta/DocsRenderer.js +0 -39
- package/dist/client/angular-beta/DocsRenderer.mjs +0 -35
- package/dist/client/angular-beta/RendererFactory.d.ts +0 -11
- package/dist/client/angular-beta/RendererFactory.js +0 -56
- package/dist/client/angular-beta/RendererFactory.mjs +0 -50
- package/dist/client/angular-beta/RendererFactory.test.d.ts +0 -1
- package/dist/client/angular-beta/RendererFactory.test.js +0 -235
- package/dist/client/angular-beta/RendererFactory.test.mjs +0 -233
- package/dist/client/angular-beta/StorybookModule.d.ts +0 -8
- package/dist/client/angular-beta/StorybookModule.js +0 -27
- package/dist/client/angular-beta/StorybookModule.mjs +0 -23
- package/dist/client/angular-beta/StorybookModule.test.d.ts +0 -1
- package/dist/client/angular-beta/StorybookModule.test.js +0 -321
- package/dist/client/angular-beta/StorybookModule.test.mjs +0 -319
- package/dist/client/angular-beta/StorybookProvider.d.ts +0 -5
- package/dist/client/angular-beta/StorybookProvider.js +0 -26
- package/dist/client/angular-beta/StorybookProvider.mjs +0 -22
- package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +0 -13
- package/dist/client/angular-beta/StorybookWrapperComponent.js +0 -127
- package/dist/client/angular-beta/StorybookWrapperComponent.mjs +0 -123
- package/dist/client/angular-beta/__testfixtures__/input.component.d.ts +0 -29
- package/dist/client/angular-beta/__testfixtures__/input.component.js +0 -76
- package/dist/client/angular-beta/__testfixtures__/input.component.mjs +0 -73
- package/dist/client/angular-beta/__testfixtures__/test.module.d.ts +0 -2
- package/dist/client/angular-beta/__testfixtures__/test.module.js +0 -20
- package/dist/client/angular-beta/__testfixtures__/test.module.mjs +0 -17
- package/dist/client/angular-beta/utils/BootstrapQueue.d.ts +0 -12
- package/dist/client/angular-beta/utils/BootstrapQueue.js +0 -86
- package/dist/client/angular-beta/utils/BootstrapQueue.mjs +0 -49
- package/dist/client/angular-beta/utils/BootstrapQueue.test.d.ts +0 -1
- package/dist/client/angular-beta/utils/BootstrapQueue.test.js +0 -164
- package/dist/client/angular-beta/utils/BootstrapQueue.test.mjs +0 -162
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -22
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.js +0 -93
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.mjs +0 -84
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.d.ts +0 -1
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +0 -388
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.mjs +0 -386
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -6
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.js +0 -41
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.mjs +0 -37
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.d.ts +0 -1
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.js +0 -24
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.mjs +0 -22
- package/dist/client/angular-beta/utils/PropertyExtractor.d.ts +0 -30
- package/dist/client/angular-beta/utils/PropertyExtractor.js +0 -196
- package/dist/client/angular-beta/utils/PropertyExtractor.mjs +0 -158
- package/dist/client/angular-beta/utils/PropertyExtractor.test.d.ts +0 -1
- package/dist/client/angular-beta/utils/PropertyExtractor.test.js +0 -177
- package/dist/client/angular-beta/utils/PropertyExtractor.test.mjs +0 -175
- package/dist/client/angular-beta/utils/StoryUID.d.ts +0 -22
- package/dist/client/angular-beta/utils/StoryUID.js +0 -43
- package/dist/client/angular-beta/utils/StoryUID.mjs +0 -38
- package/dist/client/argsToTemplate.d.ts +0 -56
- package/dist/client/argsToTemplate.js +0 -58
- package/dist/client/argsToTemplate.mjs +0 -55
- package/dist/client/argsToTemplate.test.d.ts +0 -1
- package/dist/client/argsToTemplate.test.js +0 -102
- package/dist/client/argsToTemplate.test.mjs +0 -100
- package/dist/client/compodoc-types.d.ts +0 -102
- package/dist/client/compodoc-types.js +0 -2
- package/dist/client/compodoc-types.mjs +0 -1
- package/dist/client/compodoc.d.ts +0 -12
- package/dist/client/compodoc.js +0 -261
- package/dist/client/compodoc.mjs +0 -248
- package/dist/client/compodoc.test.d.ts +0 -1
- package/dist/client/compodoc.test.js +0 -132
- package/dist/client/compodoc.test.mjs +0 -130
- package/dist/client/decorateStory.d.ts +0 -4
- package/dist/client/decorateStory.js +0 -48
- package/dist/client/decorateStory.mjs +0 -45
- package/dist/client/decorateStory.test.d.ts +0 -1
- package/dist/client/decorateStory.test.js +0 -306
- package/dist/client/decorateStory.test.mjs +0 -301
- package/dist/client/decorators.d.ts +0 -13
- package/dist/client/decorators.js +0 -69
- package/dist/client/decorators.mjs +0 -63
- package/dist/client/decorators.test.d.ts +0 -1
- package/dist/client/decorators.test.js +0 -159
- package/dist/client/decorators.test.mjs +0 -157
- package/dist/client/docs/__testfixtures__/doc-button/input.d.ts +0 -110
- package/dist/client/docs/__testfixtures__/doc-button/input.js +0 -204
- package/dist/client/docs/__testfixtures__/doc-button/input.mjs +0 -201
- package/dist/client/docs/__testfixtures__/doc-button/tsconfig.json +0 -7
- package/dist/client/docs/angular-properties.test.d.ts +0 -1
- package/dist/client/docs/angular-properties.test.js +0 -36
- package/dist/client/docs/angular-properties.test.mjs +0 -34
- package/dist/client/docs/sourceDecorator.d.ts +0 -10
- package/dist/client/docs/sourceDecorator.js +0 -53
- package/dist/client/docs/sourceDecorator.mjs +0 -48
- package/dist/client/globals.d.ts +0 -1
- package/dist/client/globals.js +0 -33
- package/dist/client/globals.mjs +0 -31
- package/dist/client/portable-stories.d.ts +0 -23
- package/dist/client/portable-stories.js +0 -62
- package/dist/client/portable-stories.mjs +0 -26
- package/dist/client/public-types.d.ts +0 -54
- package/dist/client/public-types.js +0 -2
- package/dist/client/public-types.mjs +0 -1
- package/dist/client/render.d.ts +0 -7
- package/dist/client/render.js +0 -19
- package/dist/client/render.mjs +0 -14
- package/dist/client/types.js +0 -2
- package/dist/client/types.mjs +0 -1
- package/dist/node/index.d.ts +0 -2
- package/dist/node/index.js +0 -6
- package/dist/node/index.mjs +0 -3
- package/dist/preset.d.ts +0 -5
- package/dist/preset.mjs +0 -34
- package/dist/renderer.d.ts +0 -6
- package/dist/renderer.js +0 -15
- package/dist/renderer.mjs +0 -6
- package/dist/server/__mocks-ng-workspace__/empty-projects-entry/angular.json +0 -4
- package/dist/server/__mocks-ng-workspace__/minimal-config/angular.json +0 -18
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +0 -9
- package/dist/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/some-config/angular.json +0 -19
- package/dist/server/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/some-config/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/some-config/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +0 -9
- package/dist/server/__mocks-ng-workspace__/some-config/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +0 -64
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +0 -9
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/with-lib/angular.json +0 -28
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +0 -20
- package/dist/server/__mocks-ng-workspace__/with-lib/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/with-nx/angular.json +0 -18
- package/dist/server/__mocks-ng-workspace__/with-nx/nx.json +0 -3
- package/dist/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/with-nx/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/with-nx/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +0 -8
- package/dist/server/__mocks-ng-workspace__/with-nx/tsconfig.json +0 -14
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/nx.json +0 -3
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +0 -8
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +0 -14
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json +0 -18
- package/dist/server/__mocks-ng-workspace__/with-options-styles/angular.json +0 -18
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +0 -9
- package/dist/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/without-architect-build/angular.json +0 -5
- package/dist/server/__mocks-ng-workspace__/without-architect-build-options/angular.json +0 -11
- package/dist/server/__mocks-ng-workspace__/without-compatible-projects/angular.json +0 -7
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/angular.json +0 -3
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +0 -20
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +0 -13
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/angular.json +0 -16
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -1
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +0 -5
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.mjs +0 -2
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +0 -9
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +0 -13
- package/dist/server/__tests__/angular.json +0 -96
- package/dist/server/angular-cli-webpack.d.ts +0 -1
- package/dist/server/angular-cli-webpack.js +0 -80
- package/dist/server/angular-cli-webpack.mjs +0 -80
- package/dist/server/framework-preset-angular-cli.d.ts +0 -3
- package/dist/server/framework-preset-angular-cli.mjs +0 -81
- package/dist/server/framework-preset-angular-ivy.d.ts +0 -10
- package/dist/server/framework-preset-angular-ivy.mjs +0 -56
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.d.ts +0 -12
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.js +0 -55
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.mjs +0 -52
- package/dist/server/preset-options.d.ts +0 -9
- package/dist/server/preset-options.js +0 -2
- package/dist/server/preset-options.mjs +0 -1
- package/dist/server/utils/filter-out-styling-rules.d.ts +0 -2
- package/dist/server/utils/filter-out-styling-rules.js +0 -17
- package/dist/server/utils/filter-out-styling-rules.mjs +0 -13
- package/dist/server/utils/module-is-available.d.ts +0 -1
- package/dist/server/utils/module-is-available.js +0 -13
- package/dist/server/utils/module-is-available.mjs +0 -9
- package/dist/test-setup.d.ts +0 -1
- package/dist/test-setup.js +0 -6
- package/dist/test-setup.mjs +0 -4
- package/dist/types.d.ts +0 -27
- package/dist/types.js +0 -2
- package/dist/types.mjs +0 -1
- package/scripts/postbuild.js +0 -17
- package/template/cli/.eslintrc.json +0 -5
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
export interface Method {
|
|
2
|
-
name: string;
|
|
3
|
-
args: Argument[];
|
|
4
|
-
returnType: string;
|
|
5
|
-
decorators?: Decorator[];
|
|
6
|
-
description?: string;
|
|
7
|
-
rawdescription?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface JsDocTag {
|
|
10
|
-
comment?: string;
|
|
11
|
-
tagName?: {
|
|
12
|
-
escapedText?: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export interface Property {
|
|
16
|
-
name: string;
|
|
17
|
-
decorators?: Decorator[];
|
|
18
|
-
type: string;
|
|
19
|
-
optional: boolean;
|
|
20
|
-
defaultValue?: string;
|
|
21
|
-
description?: string;
|
|
22
|
-
rawdescription?: string;
|
|
23
|
-
jsdoctags?: JsDocTag[];
|
|
24
|
-
}
|
|
25
|
-
export interface Class {
|
|
26
|
-
name: string;
|
|
27
|
-
ngname: string;
|
|
28
|
-
type: 'pipe';
|
|
29
|
-
properties: Property[];
|
|
30
|
-
methods: Method[];
|
|
31
|
-
description?: string;
|
|
32
|
-
rawdescription?: string;
|
|
33
|
-
}
|
|
34
|
-
export interface Injectable {
|
|
35
|
-
name: string;
|
|
36
|
-
type: 'injectable';
|
|
37
|
-
properties: Property[];
|
|
38
|
-
methods: Method[];
|
|
39
|
-
description?: string;
|
|
40
|
-
rawdescription?: string;
|
|
41
|
-
}
|
|
42
|
-
export interface Pipe {
|
|
43
|
-
name: string;
|
|
44
|
-
type: 'class';
|
|
45
|
-
properties: Property[];
|
|
46
|
-
methods: Method[];
|
|
47
|
-
description?: string;
|
|
48
|
-
rawdescription?: string;
|
|
49
|
-
}
|
|
50
|
-
export interface Directive {
|
|
51
|
-
name: string;
|
|
52
|
-
type: 'directive' | 'component';
|
|
53
|
-
propertiesClass: Property[];
|
|
54
|
-
inputsClass: Property[];
|
|
55
|
-
outputsClass: Property[];
|
|
56
|
-
methodsClass: Method[];
|
|
57
|
-
description?: string;
|
|
58
|
-
rawdescription?: string;
|
|
59
|
-
}
|
|
60
|
-
export type Component = Directive;
|
|
61
|
-
export interface Argument {
|
|
62
|
-
name: string;
|
|
63
|
-
type: string;
|
|
64
|
-
optional?: boolean;
|
|
65
|
-
}
|
|
66
|
-
export interface Decorator {
|
|
67
|
-
name: string;
|
|
68
|
-
}
|
|
69
|
-
export interface TypeAlias {
|
|
70
|
-
name: string;
|
|
71
|
-
ctype: string;
|
|
72
|
-
subtype: string;
|
|
73
|
-
rawtype: string;
|
|
74
|
-
file: string;
|
|
75
|
-
kind: number;
|
|
76
|
-
description?: string;
|
|
77
|
-
rawdescription?: string;
|
|
78
|
-
}
|
|
79
|
-
export interface EnumType {
|
|
80
|
-
name: string;
|
|
81
|
-
childs: EnumTypeChild[];
|
|
82
|
-
ctype: string;
|
|
83
|
-
subtype: string;
|
|
84
|
-
file: string;
|
|
85
|
-
description?: string;
|
|
86
|
-
rawdescription?: string;
|
|
87
|
-
}
|
|
88
|
-
export interface EnumTypeChild {
|
|
89
|
-
name: string;
|
|
90
|
-
value?: string;
|
|
91
|
-
}
|
|
92
|
-
export interface CompodocJson {
|
|
93
|
-
directives: Directive[];
|
|
94
|
-
components: Component[];
|
|
95
|
-
pipes: Pipe[];
|
|
96
|
-
injectables: Injectable[];
|
|
97
|
-
classes: Class[];
|
|
98
|
-
miscellaneous?: {
|
|
99
|
-
typealiases?: TypeAlias[];
|
|
100
|
-
enumerations?: EnumType[];
|
|
101
|
-
};
|
|
102
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ArgTypes, SBType } from 'storybook/internal/types';
|
|
2
|
-
import { Class, CompodocJson, Component, Directive, Injectable, Method, Pipe, Property } from './compodoc-types';
|
|
3
|
-
export declare const isMethod: (methodOrProp: Method | Property) => methodOrProp is Method;
|
|
4
|
-
export declare const setCompodocJson: (compodocJson: CompodocJson) => void;
|
|
5
|
-
export declare const getCompodocJson: () => CompodocJson;
|
|
6
|
-
export declare const checkValidComponentOrDirective: (component: Component | Directive) => void;
|
|
7
|
-
export declare const checkValidCompodocJson: (compodocJson: CompodocJson) => void;
|
|
8
|
-
export declare const findComponentByName: (name: string, compodocJson: CompodocJson) => Class | Injectable | Pipe | Directive | undefined;
|
|
9
|
-
export declare const extractType: (property: Property, defaultValue: any) => SBType;
|
|
10
|
-
export declare const extractArgTypesFromData: (componentData: Class | Directive | Injectable | Pipe) => ArgTypes<import("storybook/internal/csf").Args>;
|
|
11
|
-
export declare const extractArgTypes: (component: Component | Directive) => ArgTypes<import("storybook/internal/csf").Args> | null | undefined;
|
|
12
|
-
export declare const extractComponentDescription: (component: Component | Directive) => string | null | undefined;
|
package/dist/client/compodoc.js
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractComponentDescription = exports.extractArgTypes = exports.extractArgTypesFromData = exports.extractType = exports.findComponentByName = exports.checkValidCompodocJson = exports.checkValidComponentOrDirective = exports.getCompodocJson = exports.setCompodocJson = exports.isMethod = void 0;
|
|
4
|
-
const client_logger_1 = require("storybook/internal/client-logger");
|
|
5
|
-
const global_1 = require("@storybook/global");
|
|
6
|
-
const { FEATURES } = global_1.global;
|
|
7
|
-
const isMethod = (methodOrProp) => {
|
|
8
|
-
return methodOrProp.args !== undefined;
|
|
9
|
-
};
|
|
10
|
-
exports.isMethod = isMethod;
|
|
11
|
-
const setCompodocJson = (compodocJson) => {
|
|
12
|
-
global_1.global.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
|
|
13
|
-
};
|
|
14
|
-
exports.setCompodocJson = setCompodocJson;
|
|
15
|
-
const getCompodocJson = () => global_1.global.__STORYBOOK_COMPODOC_JSON__;
|
|
16
|
-
exports.getCompodocJson = getCompodocJson;
|
|
17
|
-
const checkValidComponentOrDirective = (component) => {
|
|
18
|
-
if (!component.name) {
|
|
19
|
-
throw new Error(`Invalid component ${JSON.stringify(component)}`);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
exports.checkValidComponentOrDirective = checkValidComponentOrDirective;
|
|
23
|
-
const checkValidCompodocJson = (compodocJson) => {
|
|
24
|
-
if (!compodocJson || !compodocJson.components) {
|
|
25
|
-
throw new Error('Invalid compodoc JSON');
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
exports.checkValidCompodocJson = checkValidCompodocJson;
|
|
29
|
-
const hasDecorator = (item, decoratorName) => item.decorators && item.decorators.find((x) => x.name === decoratorName);
|
|
30
|
-
const mapPropertyToSection = (item) => {
|
|
31
|
-
if (hasDecorator(item, 'ViewChild')) {
|
|
32
|
-
return 'view child';
|
|
33
|
-
}
|
|
34
|
-
if (hasDecorator(item, 'ViewChildren')) {
|
|
35
|
-
return 'view children';
|
|
36
|
-
}
|
|
37
|
-
if (hasDecorator(item, 'ContentChild')) {
|
|
38
|
-
return 'content child';
|
|
39
|
-
}
|
|
40
|
-
if (hasDecorator(item, 'ContentChildren')) {
|
|
41
|
-
return 'content children';
|
|
42
|
-
}
|
|
43
|
-
return 'properties';
|
|
44
|
-
};
|
|
45
|
-
const mapItemToSection = (key, item) => {
|
|
46
|
-
switch (key) {
|
|
47
|
-
case 'methods':
|
|
48
|
-
case 'methodsClass':
|
|
49
|
-
return 'methods';
|
|
50
|
-
case 'inputsClass':
|
|
51
|
-
return 'inputs';
|
|
52
|
-
case 'outputsClass':
|
|
53
|
-
return 'outputs';
|
|
54
|
-
case 'properties':
|
|
55
|
-
case 'propertiesClass':
|
|
56
|
-
if ((0, exports.isMethod)(item)) {
|
|
57
|
-
throw new Error("Cannot be of type Method if key === 'propertiesClass'");
|
|
58
|
-
}
|
|
59
|
-
return mapPropertyToSection(item);
|
|
60
|
-
default:
|
|
61
|
-
throw new Error(`Unknown key: ${key}`);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const findComponentByName = (name, compodocJson) => compodocJson.components.find((c) => c.name === name) ||
|
|
65
|
-
compodocJson.directives.find((c) => c.name === name) ||
|
|
66
|
-
compodocJson.pipes.find((c) => c.name === name) ||
|
|
67
|
-
compodocJson.injectables.find((c) => c.name === name) ||
|
|
68
|
-
compodocJson.classes.find((c) => c.name === name);
|
|
69
|
-
exports.findComponentByName = findComponentByName;
|
|
70
|
-
const getComponentData = (component) => {
|
|
71
|
-
if (!component) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
(0, exports.checkValidComponentOrDirective)(component);
|
|
75
|
-
const compodocJson = (0, exports.getCompodocJson)();
|
|
76
|
-
if (!compodocJson) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
(0, exports.checkValidCompodocJson)(compodocJson);
|
|
80
|
-
const { name } = component;
|
|
81
|
-
const metadata = (0, exports.findComponentByName)(name, compodocJson);
|
|
82
|
-
if (!metadata) {
|
|
83
|
-
client_logger_1.logger.warn(`Component not found in compodoc JSON: '${name}'`);
|
|
84
|
-
}
|
|
85
|
-
return metadata;
|
|
86
|
-
};
|
|
87
|
-
const displaySignature = (item) => {
|
|
88
|
-
const args = item.args.map((arg) => `${arg.name}${arg.optional ? '?' : ''}: ${arg.type}`);
|
|
89
|
-
return `(${args.join(', ')}) => ${item.returnType}`;
|
|
90
|
-
};
|
|
91
|
-
const extractTypeFromValue = (defaultValue) => {
|
|
92
|
-
const valueType = typeof defaultValue;
|
|
93
|
-
return defaultValue || valueType === 'number' || valueType === 'boolean' || valueType === 'string'
|
|
94
|
-
? valueType
|
|
95
|
-
: null;
|
|
96
|
-
};
|
|
97
|
-
const extractEnumValues = (compodocType) => {
|
|
98
|
-
const compodocJson = (0, exports.getCompodocJson)();
|
|
99
|
-
const enumType = compodocJson?.miscellaneous?.enumerations?.find((x) => x.name === compodocType);
|
|
100
|
-
if (enumType?.childs.every((x) => x.value)) {
|
|
101
|
-
return enumType.childs.map((x) => x.value);
|
|
102
|
-
}
|
|
103
|
-
if (typeof compodocType !== 'string' || compodocType.indexOf('|') === -1) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
try {
|
|
107
|
-
return compodocType.split('|').map((value) => JSON.parse(value));
|
|
108
|
-
}
|
|
109
|
-
catch (e) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
const extractType = (property, defaultValue) => {
|
|
114
|
-
const compodocType = property.type || extractTypeFromValue(defaultValue);
|
|
115
|
-
switch (compodocType) {
|
|
116
|
-
case 'string':
|
|
117
|
-
case 'boolean':
|
|
118
|
-
case 'number':
|
|
119
|
-
return { name: compodocType };
|
|
120
|
-
case undefined:
|
|
121
|
-
case null:
|
|
122
|
-
return { name: 'other', value: 'void' };
|
|
123
|
-
default: {
|
|
124
|
-
const resolvedType = resolveTypealias(compodocType);
|
|
125
|
-
const enumValues = extractEnumValues(resolvedType);
|
|
126
|
-
return enumValues
|
|
127
|
-
? { name: 'enum', value: enumValues }
|
|
128
|
-
: { name: 'other', value: 'empty-enum' };
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
exports.extractType = extractType;
|
|
133
|
-
const castDefaultValue = (property, defaultValue) => {
|
|
134
|
-
const compodocType = property.type;
|
|
135
|
-
// All these checks are necessary as compodoc does not always set the type ie. @HostBinding have empty types.
|
|
136
|
-
// null and undefined also have 'any' type
|
|
137
|
-
if (['boolean', 'number', 'string', 'EventEmitter'].includes(compodocType)) {
|
|
138
|
-
switch (compodocType) {
|
|
139
|
-
case 'boolean':
|
|
140
|
-
return defaultValue === 'true';
|
|
141
|
-
case 'number':
|
|
142
|
-
return Number(defaultValue);
|
|
143
|
-
case 'EventEmitter':
|
|
144
|
-
return undefined;
|
|
145
|
-
default:
|
|
146
|
-
return defaultValue;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
switch (defaultValue) {
|
|
151
|
-
case 'true':
|
|
152
|
-
return true;
|
|
153
|
-
case 'false':
|
|
154
|
-
return false;
|
|
155
|
-
case 'null':
|
|
156
|
-
return null;
|
|
157
|
-
case 'undefined':
|
|
158
|
-
return undefined;
|
|
159
|
-
default:
|
|
160
|
-
return defaultValue;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
const extractDefaultValueFromComments = (property, value) => {
|
|
165
|
-
let commentValue = value;
|
|
166
|
-
property.jsdoctags.forEach((tag) => {
|
|
167
|
-
if (['default', 'defaultvalue'].includes(tag.tagName.escapedText)) {
|
|
168
|
-
const dom = new global_1.global.DOMParser().parseFromString(tag.comment, 'text/html');
|
|
169
|
-
commentValue = dom.body.textContent;
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
return commentValue;
|
|
173
|
-
};
|
|
174
|
-
const extractDefaultValue = (property) => {
|
|
175
|
-
try {
|
|
176
|
-
let value = property.defaultValue?.replace(/^'(.*)'$/, '$1');
|
|
177
|
-
value = castDefaultValue(property, value);
|
|
178
|
-
if (value == null && property.jsdoctags?.length > 0) {
|
|
179
|
-
value = extractDefaultValueFromComments(property, value);
|
|
180
|
-
}
|
|
181
|
-
return value;
|
|
182
|
-
}
|
|
183
|
-
catch (err) {
|
|
184
|
-
client_logger_1.logger.debug(`Error extracting ${property.name}: ${property.defaultValue}`);
|
|
185
|
-
return undefined;
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
const resolveTypealias = (compodocType) => {
|
|
189
|
-
const compodocJson = (0, exports.getCompodocJson)();
|
|
190
|
-
const typeAlias = compodocJson?.miscellaneous?.typealiases?.find((x) => x.name === compodocType);
|
|
191
|
-
return typeAlias ? resolveTypealias(typeAlias.rawtype) : compodocType;
|
|
192
|
-
};
|
|
193
|
-
const extractArgTypesFromData = (componentData) => {
|
|
194
|
-
const sectionToItems = {};
|
|
195
|
-
const componentClasses = FEATURES.angularFilterNonInputControls
|
|
196
|
-
? ['inputsClass']
|
|
197
|
-
: ['propertiesClass', 'methodsClass', 'inputsClass', 'outputsClass'];
|
|
198
|
-
const compodocClasses = ['component', 'directive'].includes(componentData.type)
|
|
199
|
-
? componentClasses
|
|
200
|
-
: ['properties', 'methods'];
|
|
201
|
-
compodocClasses.forEach((key) => {
|
|
202
|
-
const data = componentData[key] || [];
|
|
203
|
-
data.forEach((item) => {
|
|
204
|
-
const section = mapItemToSection(key, item);
|
|
205
|
-
const defaultValue = (0, exports.isMethod)(item) ? undefined : extractDefaultValue(item);
|
|
206
|
-
const type = (0, exports.isMethod)(item) || (section !== 'inputs' && section !== 'properties')
|
|
207
|
-
? { name: 'other', value: 'void' }
|
|
208
|
-
: (0, exports.extractType)(item, defaultValue);
|
|
209
|
-
const action = section === 'outputs' ? { action: item.name } : {};
|
|
210
|
-
const argType = {
|
|
211
|
-
name: item.name,
|
|
212
|
-
description: item.rawdescription || item.description,
|
|
213
|
-
type,
|
|
214
|
-
...action,
|
|
215
|
-
table: {
|
|
216
|
-
category: section,
|
|
217
|
-
type: {
|
|
218
|
-
summary: (0, exports.isMethod)(item) ? displaySignature(item) : item.type,
|
|
219
|
-
required: (0, exports.isMethod)(item) ? false : !item.optional,
|
|
220
|
-
},
|
|
221
|
-
defaultValue: { summary: defaultValue },
|
|
222
|
-
},
|
|
223
|
-
};
|
|
224
|
-
if (!sectionToItems[section]) {
|
|
225
|
-
sectionToItems[section] = [];
|
|
226
|
-
}
|
|
227
|
-
sectionToItems[section].push(argType);
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
const SECTIONS = [
|
|
231
|
-
'properties',
|
|
232
|
-
'inputs',
|
|
233
|
-
'outputs',
|
|
234
|
-
'methods',
|
|
235
|
-
'view child',
|
|
236
|
-
'view children',
|
|
237
|
-
'content child',
|
|
238
|
-
'content children',
|
|
239
|
-
];
|
|
240
|
-
const argTypes = {};
|
|
241
|
-
SECTIONS.forEach((section) => {
|
|
242
|
-
const items = sectionToItems[section];
|
|
243
|
-
if (items) {
|
|
244
|
-
items.forEach((argType) => {
|
|
245
|
-
argTypes[argType.name] = argType;
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
return argTypes;
|
|
250
|
-
};
|
|
251
|
-
exports.extractArgTypesFromData = extractArgTypesFromData;
|
|
252
|
-
const extractArgTypes = (component) => {
|
|
253
|
-
const componentData = getComponentData(component);
|
|
254
|
-
return componentData && (0, exports.extractArgTypesFromData)(componentData);
|
|
255
|
-
};
|
|
256
|
-
exports.extractArgTypes = extractArgTypes;
|
|
257
|
-
const extractComponentDescription = (component) => {
|
|
258
|
-
const componentData = getComponentData(component);
|
|
259
|
-
return componentData && (componentData.rawdescription || componentData.description);
|
|
260
|
-
};
|
|
261
|
-
exports.extractComponentDescription = extractComponentDescription;
|
package/dist/client/compodoc.mjs
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { logger } from 'storybook/internal/client-logger';
|
|
2
|
-
import { global } from '@storybook/global';
|
|
3
|
-
const { FEATURES } = global;
|
|
4
|
-
export const isMethod = (methodOrProp) => {
|
|
5
|
-
return methodOrProp.args !== undefined;
|
|
6
|
-
};
|
|
7
|
-
export const setCompodocJson = (compodocJson) => {
|
|
8
|
-
global.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
|
|
9
|
-
};
|
|
10
|
-
export const getCompodocJson = () => global.__STORYBOOK_COMPODOC_JSON__;
|
|
11
|
-
export const checkValidComponentOrDirective = (component) => {
|
|
12
|
-
if (!component.name) {
|
|
13
|
-
throw new Error(`Invalid component ${JSON.stringify(component)}`);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
export const checkValidCompodocJson = (compodocJson) => {
|
|
17
|
-
if (!compodocJson || !compodocJson.components) {
|
|
18
|
-
throw new Error('Invalid compodoc JSON');
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const hasDecorator = (item, decoratorName) => item.decorators && item.decorators.find((x) => x.name === decoratorName);
|
|
22
|
-
const mapPropertyToSection = (item) => {
|
|
23
|
-
if (hasDecorator(item, 'ViewChild')) {
|
|
24
|
-
return 'view child';
|
|
25
|
-
}
|
|
26
|
-
if (hasDecorator(item, 'ViewChildren')) {
|
|
27
|
-
return 'view children';
|
|
28
|
-
}
|
|
29
|
-
if (hasDecorator(item, 'ContentChild')) {
|
|
30
|
-
return 'content child';
|
|
31
|
-
}
|
|
32
|
-
if (hasDecorator(item, 'ContentChildren')) {
|
|
33
|
-
return 'content children';
|
|
34
|
-
}
|
|
35
|
-
return 'properties';
|
|
36
|
-
};
|
|
37
|
-
const mapItemToSection = (key, item) => {
|
|
38
|
-
switch (key) {
|
|
39
|
-
case 'methods':
|
|
40
|
-
case 'methodsClass':
|
|
41
|
-
return 'methods';
|
|
42
|
-
case 'inputsClass':
|
|
43
|
-
return 'inputs';
|
|
44
|
-
case 'outputsClass':
|
|
45
|
-
return 'outputs';
|
|
46
|
-
case 'properties':
|
|
47
|
-
case 'propertiesClass':
|
|
48
|
-
if (isMethod(item)) {
|
|
49
|
-
throw new Error("Cannot be of type Method if key === 'propertiesClass'");
|
|
50
|
-
}
|
|
51
|
-
return mapPropertyToSection(item);
|
|
52
|
-
default:
|
|
53
|
-
throw new Error(`Unknown key: ${key}`);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
export const findComponentByName = (name, compodocJson) => compodocJson.components.find((c) => c.name === name) ||
|
|
57
|
-
compodocJson.directives.find((c) => c.name === name) ||
|
|
58
|
-
compodocJson.pipes.find((c) => c.name === name) ||
|
|
59
|
-
compodocJson.injectables.find((c) => c.name === name) ||
|
|
60
|
-
compodocJson.classes.find((c) => c.name === name);
|
|
61
|
-
const getComponentData = (component) => {
|
|
62
|
-
if (!component) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
checkValidComponentOrDirective(component);
|
|
66
|
-
const compodocJson = getCompodocJson();
|
|
67
|
-
if (!compodocJson) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
checkValidCompodocJson(compodocJson);
|
|
71
|
-
const { name } = component;
|
|
72
|
-
const metadata = findComponentByName(name, compodocJson);
|
|
73
|
-
if (!metadata) {
|
|
74
|
-
logger.warn(`Component not found in compodoc JSON: '${name}'`);
|
|
75
|
-
}
|
|
76
|
-
return metadata;
|
|
77
|
-
};
|
|
78
|
-
const displaySignature = (item) => {
|
|
79
|
-
const args = item.args.map((arg) => `${arg.name}${arg.optional ? '?' : ''}: ${arg.type}`);
|
|
80
|
-
return `(${args.join(', ')}) => ${item.returnType}`;
|
|
81
|
-
};
|
|
82
|
-
const extractTypeFromValue = (defaultValue) => {
|
|
83
|
-
const valueType = typeof defaultValue;
|
|
84
|
-
return defaultValue || valueType === 'number' || valueType === 'boolean' || valueType === 'string'
|
|
85
|
-
? valueType
|
|
86
|
-
: null;
|
|
87
|
-
};
|
|
88
|
-
const extractEnumValues = (compodocType) => {
|
|
89
|
-
const compodocJson = getCompodocJson();
|
|
90
|
-
const enumType = compodocJson?.miscellaneous?.enumerations?.find((x) => x.name === compodocType);
|
|
91
|
-
if (enumType?.childs.every((x) => x.value)) {
|
|
92
|
-
return enumType.childs.map((x) => x.value);
|
|
93
|
-
}
|
|
94
|
-
if (typeof compodocType !== 'string' || compodocType.indexOf('|') === -1) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
try {
|
|
98
|
-
return compodocType.split('|').map((value) => JSON.parse(value));
|
|
99
|
-
}
|
|
100
|
-
catch (e) {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
export const extractType = (property, defaultValue) => {
|
|
105
|
-
const compodocType = property.type || extractTypeFromValue(defaultValue);
|
|
106
|
-
switch (compodocType) {
|
|
107
|
-
case 'string':
|
|
108
|
-
case 'boolean':
|
|
109
|
-
case 'number':
|
|
110
|
-
return { name: compodocType };
|
|
111
|
-
case undefined:
|
|
112
|
-
case null:
|
|
113
|
-
return { name: 'other', value: 'void' };
|
|
114
|
-
default: {
|
|
115
|
-
const resolvedType = resolveTypealias(compodocType);
|
|
116
|
-
const enumValues = extractEnumValues(resolvedType);
|
|
117
|
-
return enumValues
|
|
118
|
-
? { name: 'enum', value: enumValues }
|
|
119
|
-
: { name: 'other', value: 'empty-enum' };
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
const castDefaultValue = (property, defaultValue) => {
|
|
124
|
-
const compodocType = property.type;
|
|
125
|
-
// All these checks are necessary as compodoc does not always set the type ie. @HostBinding have empty types.
|
|
126
|
-
// null and undefined also have 'any' type
|
|
127
|
-
if (['boolean', 'number', 'string', 'EventEmitter'].includes(compodocType)) {
|
|
128
|
-
switch (compodocType) {
|
|
129
|
-
case 'boolean':
|
|
130
|
-
return defaultValue === 'true';
|
|
131
|
-
case 'number':
|
|
132
|
-
return Number(defaultValue);
|
|
133
|
-
case 'EventEmitter':
|
|
134
|
-
return undefined;
|
|
135
|
-
default:
|
|
136
|
-
return defaultValue;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
switch (defaultValue) {
|
|
141
|
-
case 'true':
|
|
142
|
-
return true;
|
|
143
|
-
case 'false':
|
|
144
|
-
return false;
|
|
145
|
-
case 'null':
|
|
146
|
-
return null;
|
|
147
|
-
case 'undefined':
|
|
148
|
-
return undefined;
|
|
149
|
-
default:
|
|
150
|
-
return defaultValue;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
const extractDefaultValueFromComments = (property, value) => {
|
|
155
|
-
let commentValue = value;
|
|
156
|
-
property.jsdoctags.forEach((tag) => {
|
|
157
|
-
if (['default', 'defaultvalue'].includes(tag.tagName.escapedText)) {
|
|
158
|
-
const dom = new global.DOMParser().parseFromString(tag.comment, 'text/html');
|
|
159
|
-
commentValue = dom.body.textContent;
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
return commentValue;
|
|
163
|
-
};
|
|
164
|
-
const extractDefaultValue = (property) => {
|
|
165
|
-
try {
|
|
166
|
-
let value = property.defaultValue?.replace(/^'(.*)'$/, '$1');
|
|
167
|
-
value = castDefaultValue(property, value);
|
|
168
|
-
if (value == null && property.jsdoctags?.length > 0) {
|
|
169
|
-
value = extractDefaultValueFromComments(property, value);
|
|
170
|
-
}
|
|
171
|
-
return value;
|
|
172
|
-
}
|
|
173
|
-
catch (err) {
|
|
174
|
-
logger.debug(`Error extracting ${property.name}: ${property.defaultValue}`);
|
|
175
|
-
return undefined;
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
const resolveTypealias = (compodocType) => {
|
|
179
|
-
const compodocJson = getCompodocJson();
|
|
180
|
-
const typeAlias = compodocJson?.miscellaneous?.typealiases?.find((x) => x.name === compodocType);
|
|
181
|
-
return typeAlias ? resolveTypealias(typeAlias.rawtype) : compodocType;
|
|
182
|
-
};
|
|
183
|
-
export const extractArgTypesFromData = (componentData) => {
|
|
184
|
-
const sectionToItems = {};
|
|
185
|
-
const componentClasses = FEATURES.angularFilterNonInputControls
|
|
186
|
-
? ['inputsClass']
|
|
187
|
-
: ['propertiesClass', 'methodsClass', 'inputsClass', 'outputsClass'];
|
|
188
|
-
const compodocClasses = ['component', 'directive'].includes(componentData.type)
|
|
189
|
-
? componentClasses
|
|
190
|
-
: ['properties', 'methods'];
|
|
191
|
-
compodocClasses.forEach((key) => {
|
|
192
|
-
const data = componentData[key] || [];
|
|
193
|
-
data.forEach((item) => {
|
|
194
|
-
const section = mapItemToSection(key, item);
|
|
195
|
-
const defaultValue = isMethod(item) ? undefined : extractDefaultValue(item);
|
|
196
|
-
const type = isMethod(item) || (section !== 'inputs' && section !== 'properties')
|
|
197
|
-
? { name: 'other', value: 'void' }
|
|
198
|
-
: extractType(item, defaultValue);
|
|
199
|
-
const action = section === 'outputs' ? { action: item.name } : {};
|
|
200
|
-
const argType = {
|
|
201
|
-
name: item.name,
|
|
202
|
-
description: item.rawdescription || item.description,
|
|
203
|
-
type,
|
|
204
|
-
...action,
|
|
205
|
-
table: {
|
|
206
|
-
category: section,
|
|
207
|
-
type: {
|
|
208
|
-
summary: isMethod(item) ? displaySignature(item) : item.type,
|
|
209
|
-
required: isMethod(item) ? false : !item.optional,
|
|
210
|
-
},
|
|
211
|
-
defaultValue: { summary: defaultValue },
|
|
212
|
-
},
|
|
213
|
-
};
|
|
214
|
-
if (!sectionToItems[section]) {
|
|
215
|
-
sectionToItems[section] = [];
|
|
216
|
-
}
|
|
217
|
-
sectionToItems[section].push(argType);
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
const SECTIONS = [
|
|
221
|
-
'properties',
|
|
222
|
-
'inputs',
|
|
223
|
-
'outputs',
|
|
224
|
-
'methods',
|
|
225
|
-
'view child',
|
|
226
|
-
'view children',
|
|
227
|
-
'content child',
|
|
228
|
-
'content children',
|
|
229
|
-
];
|
|
230
|
-
const argTypes = {};
|
|
231
|
-
SECTIONS.forEach((section) => {
|
|
232
|
-
const items = sectionToItems[section];
|
|
233
|
-
if (items) {
|
|
234
|
-
items.forEach((argType) => {
|
|
235
|
-
argTypes[argType.name] = argType;
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
return argTypes;
|
|
240
|
-
};
|
|
241
|
-
export const extractArgTypes = (component) => {
|
|
242
|
-
const componentData = getComponentData(component);
|
|
243
|
-
return componentData && extractArgTypesFromData(componentData);
|
|
244
|
-
};
|
|
245
|
-
export const extractComponentDescription = (component) => {
|
|
246
|
-
const componentData = getComponentData(component);
|
|
247
|
-
return componentData && (componentData.rawdescription || componentData.description);
|
|
248
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|