@storybook/angular 6.5.0-alpha.46 → 6.5.0-alpha.49
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/docs/compodoc.d.ts +18 -0
- package/dist/ts3.4/client/docs/config.d.ts +15 -0
- package/dist/ts3.4/client/docs/index.d.ts +1 -0
- package/dist/ts3.4/client/docs/prepareForInline.d.ts +7 -0
- package/dist/ts3.4/client/docs/sourceDecorator.d.ts +9 -0
- package/dist/ts3.4/client/docs/types.d.ts +102 -0
- package/dist/ts3.4/server/framework-preset-angular-docs.d.ts +2 -0
- package/dist/ts3.9/builders/build-storybook/index.d.ts +1 -1
- package/dist/ts3.9/builders/start-storybook/index.d.ts +1 -1
- package/dist/ts3.9/client/docs/compodoc.d.ts +18 -0
- package/dist/ts3.9/client/docs/compodoc.js +247 -0
- package/dist/ts3.9/client/docs/config.d.ts +15 -0
- package/dist/ts3.9/client/docs/config.js +22 -0
- package/dist/ts3.9/client/docs/index.d.ts +1 -0
- package/dist/ts3.9/client/docs/index.js +13 -0
- package/dist/ts3.9/client/docs/prepareForInline.d.ts +7 -0
- package/dist/ts3.9/client/docs/prepareForInline.js +45 -0
- package/dist/ts3.9/client/docs/sourceDecorator.d.ts +9 -0
- package/dist/ts3.9/client/docs/sourceDecorator.js +97 -0
- package/dist/ts3.9/client/docs/types.d.ts +102 -0
- package/dist/ts3.9/client/docs/types.js +2 -0
- package/dist/ts3.9/client/preview/angular/helpers.d.ts +2 -2
- package/dist/ts3.9/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +3 -3
- package/dist/ts3.9/client/preview/decorateStory.d.ts +2 -2
- package/dist/ts3.9/client/preview/decorators.d.ts +4 -4
- package/dist/ts3.9/client/preview/index.d.ts +3 -3
- package/dist/ts3.9/client/preview/render.d.ts +3 -3
- package/dist/ts3.9/client/preview/types-6-0.d.ts +2 -2
- package/dist/ts3.9/client/preview/types-7-0.d.ts +1 -1
- package/dist/ts3.9/server/create-fork-ts-checker-plugin.js +1 -1
- package/dist/ts3.9/server/framework-preset-angular-docs.d.ts +2 -0
- package/dist/ts3.9/server/framework-preset-angular-docs.js +13 -0
- package/dist/ts3.9/server/options.d.ts +1 -1
- package/dist/ts3.9/server/preset.js +1 -0
- package/dist/ts3.9/types/index.d.ts +1 -1
- package/package.json +18 -12
- package/standalone.d.ts +2 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ArgTypes } from '@storybook/api';
|
|
2
|
+
import { Class, CompodocJson, Component, Injectable, Method, Pipe, Property, Directive } from './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;
|
|
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) => ArgTypes;
|
|
17
|
+
export declare const extractArgTypes: (component: Component | Directive) => ArgTypes;
|
|
18
|
+
export declare const extractComponentDescription: (component: Component | Directive) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SourceType } from '@storybook/docs-tools';
|
|
2
|
+
export declare const parameters: {
|
|
3
|
+
docs: {
|
|
4
|
+
inlineStories: boolean;
|
|
5
|
+
prepareForInline: (storyFn: import("@storybook/csf").PartialStoryFn<import("..").AngularFramework, import("@storybook/csf").Args>, { id, parameters, component }: import("..").StoryContext) => import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<undefined>, undefined>;
|
|
6
|
+
extractArgTypes: (component: import("./types").Directive) => import("@storybook/api").ArgTypes;
|
|
7
|
+
extractComponentDescription: (component: import("./types").Directive) => string;
|
|
8
|
+
source: {
|
|
9
|
+
type: SourceType;
|
|
10
|
+
language: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const decorators: ((storyFn: import("@storybook/csf").PartialStoryFn<import("..").AngularFramework, import("@storybook/csf").Args>, context: import("..").StoryContext) => import("..").IStory)[];
|
|
15
|
+
export declare const argTypesEnhancers: (<TFramework extends import("@storybook/csf").AnyFramework>(context: import("@storybook/csf").StoryContextForEnhancers<TFramework, import("@storybook/csf").Args>) => import("@storybook/csf").StrictArgTypes<import("@storybook/csf").Args> | import("@storybook/addons").Parameters)[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './compodoc';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PartialStoryFn } from '@storybook/csf';
|
|
3
|
+
import { AngularFramework, StoryContext } from '..';
|
|
4
|
+
/**
|
|
5
|
+
* Uses the angular renderer to generate a story. Uses p-limit to run synchronously
|
|
6
|
+
*/
|
|
7
|
+
export declare const prepareForInline: (storyFn: PartialStoryFn<AngularFramework>, { id, parameters, component }: StoryContext) => React.DetailedReactHTMLElement<React.HTMLAttributes<undefined>, undefined>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PartialStoryFn } from '@storybook/csf';
|
|
2
|
+
import { StoryContext, AngularFramework } from '..';
|
|
3
|
+
export declare const skipSourceRender: (context: StoryContext) => any;
|
|
4
|
+
/**
|
|
5
|
+
* Angular source decorator.
|
|
6
|
+
* @param storyFn Fn
|
|
7
|
+
* @param context StoryContext
|
|
8
|
+
*/
|
|
9
|
+
export declare const sourceDecorator: (storyFn: PartialStoryFn<AngularFramework>, context: StoryContext) => import("..").IStory;
|
|
@@ -0,0 +1,102 @@
|
|
|
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 declare 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,6 +1,6 @@
|
|
|
1
1
|
import { BuilderOutput } from '@angular-devkit/architect';
|
|
2
2
|
import { JsonObject } from '@angular-devkit/core';
|
|
3
|
-
import { CLIOptions } from '@storybook/core-common';
|
|
3
|
+
import type { CLIOptions } from '@storybook/core-common';
|
|
4
4
|
import { ExtraEntryPoint, StylePreprocessorOptions } from '@angular-devkit/build-angular';
|
|
5
5
|
export declare type StorybookBuilderOptions = JsonObject & {
|
|
6
6
|
browserTarget?: string | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BuilderOutput } from '@angular-devkit/architect';
|
|
2
2
|
import { JsonObject } from '@angular-devkit/core';
|
|
3
3
|
import { ExtraEntryPoint, StylePreprocessorOptions } from '@angular-devkit/build-angular';
|
|
4
|
-
import { CLIOptions } from '@storybook/core-common';
|
|
4
|
+
import type { CLIOptions } from '@storybook/core-common';
|
|
5
5
|
export declare type StorybookBuilderOptions = JsonObject & {
|
|
6
6
|
browserTarget?: string | null;
|
|
7
7
|
tsConfig?: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ArgTypes } from '@storybook/api';
|
|
2
|
+
import type { Class, CompodocJson, Component, Injectable, Method, Pipe, Property, Directive } from './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;
|
|
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) => ArgTypes;
|
|
17
|
+
export declare const extractArgTypes: (component: Component | Directive) => ArgTypes;
|
|
18
|
+
export declare const extractComponentDescription: (component: Component | Directive) => string;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-underscore-dangle */
|
|
3
|
+
/* global window */
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.extractComponentDescription = exports.extractArgTypes = exports.extractArgTypesFromData = exports.extractType = exports.findComponentByName = exports.checkValidCompodocJson = exports.checkValidComponentOrDirective = exports.getCompodocJson = exports.setCompodocJson = exports.isMethod = void 0;
|
|
6
|
+
const client_logger_1 = require("@storybook/client-logger");
|
|
7
|
+
exports.isMethod = (methodOrProp) => {
|
|
8
|
+
return methodOrProp.args !== undefined;
|
|
9
|
+
};
|
|
10
|
+
exports.setCompodocJson = (compodocJson) => {
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
window.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
|
|
13
|
+
};
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
exports.getCompodocJson = () => window.__STORYBOOK_COMPODOC_JSON__;
|
|
16
|
+
exports.checkValidComponentOrDirective = (component) => {
|
|
17
|
+
if (!component.name) {
|
|
18
|
+
throw new Error(`Invalid component ${JSON.stringify(component)}`);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.checkValidCompodocJson = (compodocJson) => {
|
|
22
|
+
if (!compodocJson || !compodocJson.components) {
|
|
23
|
+
throw new Error('Invalid compodoc JSON');
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const hasDecorator = (item, decoratorName) => item.decorators && item.decorators.find((x) => x.name === decoratorName);
|
|
27
|
+
const mapPropertyToSection = (item) => {
|
|
28
|
+
if (hasDecorator(item, 'ViewChild')) {
|
|
29
|
+
return 'view child';
|
|
30
|
+
}
|
|
31
|
+
if (hasDecorator(item, 'ViewChildren')) {
|
|
32
|
+
return 'view children';
|
|
33
|
+
}
|
|
34
|
+
if (hasDecorator(item, 'ContentChild')) {
|
|
35
|
+
return 'content child';
|
|
36
|
+
}
|
|
37
|
+
if (hasDecorator(item, 'ContentChildren')) {
|
|
38
|
+
return 'content children';
|
|
39
|
+
}
|
|
40
|
+
return 'properties';
|
|
41
|
+
};
|
|
42
|
+
const mapItemToSection = (key, item) => {
|
|
43
|
+
switch (key) {
|
|
44
|
+
case 'methods':
|
|
45
|
+
case 'methodsClass':
|
|
46
|
+
return 'methods';
|
|
47
|
+
case 'inputsClass':
|
|
48
|
+
return 'inputs';
|
|
49
|
+
case 'outputsClass':
|
|
50
|
+
return 'outputs';
|
|
51
|
+
case 'properties':
|
|
52
|
+
case 'propertiesClass':
|
|
53
|
+
if (exports.isMethod(item)) {
|
|
54
|
+
throw new Error("Cannot be of type Method if key === 'propertiesClass'");
|
|
55
|
+
}
|
|
56
|
+
return mapPropertyToSection(item);
|
|
57
|
+
default:
|
|
58
|
+
throw new Error(`Unknown key: ${key}`);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports.findComponentByName = (name, compodocJson) => compodocJson.components.find((c) => c.name === name) ||
|
|
62
|
+
compodocJson.directives.find((c) => c.name === name) ||
|
|
63
|
+
compodocJson.pipes.find((c) => c.name === name) ||
|
|
64
|
+
compodocJson.injectables.find((c) => c.name === name) ||
|
|
65
|
+
compodocJson.classes.find((c) => c.name === name);
|
|
66
|
+
const getComponentData = (component) => {
|
|
67
|
+
if (!component) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
exports.checkValidComponentOrDirective(component);
|
|
71
|
+
const compodocJson = exports.getCompodocJson();
|
|
72
|
+
if (!compodocJson) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
exports.checkValidCompodocJson(compodocJson);
|
|
76
|
+
const { name } = component;
|
|
77
|
+
const metadata = exports.findComponentByName(name, compodocJson);
|
|
78
|
+
if (!metadata) {
|
|
79
|
+
client_logger_1.logger.warn(`Component not found in compodoc JSON: '${name}'`);
|
|
80
|
+
}
|
|
81
|
+
return metadata;
|
|
82
|
+
};
|
|
83
|
+
const displaySignature = (item) => {
|
|
84
|
+
const args = item.args.map((arg) => `${arg.name}${arg.optional ? '?' : ''}: ${arg.type}`);
|
|
85
|
+
return `(${args.join(', ')}) => ${item.returnType}`;
|
|
86
|
+
};
|
|
87
|
+
const extractTypeFromValue = (defaultValue) => {
|
|
88
|
+
const valueType = typeof defaultValue;
|
|
89
|
+
return defaultValue || valueType === 'number' || valueType === 'boolean' || valueType === 'string'
|
|
90
|
+
? valueType
|
|
91
|
+
: null;
|
|
92
|
+
};
|
|
93
|
+
const extractEnumValues = (compodocType) => {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
const compodocJson = exports.getCompodocJson();
|
|
96
|
+
const enumType = (_b = (_a = compodocJson === null || compodocJson === void 0 ? void 0 : compodocJson.miscellaneous) === null || _a === void 0 ? void 0 : _a.enumerations) === null || _b === void 0 ? void 0 : _b.find((x) => x.name === compodocType);
|
|
97
|
+
if (enumType === null || enumType === void 0 ? void 0 : enumType.childs.every((x) => x.value)) {
|
|
98
|
+
return enumType.childs.map((x) => x.value);
|
|
99
|
+
}
|
|
100
|
+
if (typeof compodocType !== 'string' || compodocType.indexOf('|') === -1) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
return compodocType.split('|').map((value) => JSON.parse(value));
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
exports.extractType = (property, defaultValue) => {
|
|
111
|
+
const compodocType = property.type || extractTypeFromValue(defaultValue);
|
|
112
|
+
switch (compodocType) {
|
|
113
|
+
case 'string':
|
|
114
|
+
case 'boolean':
|
|
115
|
+
case 'number':
|
|
116
|
+
return { name: compodocType };
|
|
117
|
+
case undefined:
|
|
118
|
+
case null:
|
|
119
|
+
return { name: 'void' };
|
|
120
|
+
default: {
|
|
121
|
+
const resolvedType = resolveTypealias(compodocType);
|
|
122
|
+
const enumValues = extractEnumValues(resolvedType);
|
|
123
|
+
return enumValues ? { name: 'enum', value: enumValues } : { name: 'object' };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const castDefaultValue = (property, defaultValue) => {
|
|
128
|
+
const compodocType = property.type;
|
|
129
|
+
// All these checks are necessary as compodoc does not always set the type ie. @HostBinding have empty types.
|
|
130
|
+
// null and undefined also have 'any' type
|
|
131
|
+
if (['boolean', 'number', 'string', 'EventEmitter'].includes(compodocType)) {
|
|
132
|
+
switch (compodocType) {
|
|
133
|
+
case 'boolean':
|
|
134
|
+
return defaultValue === 'true';
|
|
135
|
+
case 'number':
|
|
136
|
+
return Number(defaultValue);
|
|
137
|
+
case 'EventEmitter':
|
|
138
|
+
return undefined;
|
|
139
|
+
default:
|
|
140
|
+
return defaultValue;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
switch (defaultValue) {
|
|
145
|
+
case 'true':
|
|
146
|
+
return true;
|
|
147
|
+
case 'false':
|
|
148
|
+
return false;
|
|
149
|
+
case 'null':
|
|
150
|
+
return null;
|
|
151
|
+
case 'undefined':
|
|
152
|
+
return undefined;
|
|
153
|
+
default:
|
|
154
|
+
return defaultValue;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const extractDefaultValueFromComments = (property, value) => {
|
|
159
|
+
let commentValue = value;
|
|
160
|
+
property.jsdoctags.forEach((tag) => {
|
|
161
|
+
if (['default', 'defaultvalue'].includes(tag.tagName.escapedText)) {
|
|
162
|
+
// @ts-ignore
|
|
163
|
+
const dom = new window.DOMParser().parseFromString(tag.comment, 'text/html');
|
|
164
|
+
commentValue = dom.body.textContent;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
return commentValue;
|
|
168
|
+
};
|
|
169
|
+
const extractDefaultValue = (property) => {
|
|
170
|
+
var _a, _b;
|
|
171
|
+
try {
|
|
172
|
+
let value = (_a = property.defaultValue) === null || _a === void 0 ? void 0 : _a.replace(/^'(.*)'$/, '$1');
|
|
173
|
+
value = castDefaultValue(property, value);
|
|
174
|
+
if (value == null && ((_b = property.jsdoctags) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
175
|
+
value = extractDefaultValueFromComments(property, value);
|
|
176
|
+
}
|
|
177
|
+
return value;
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
client_logger_1.logger.debug(`Error extracting ${property.name}: ${property.defaultValue}`);
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
const resolveTypealias = (compodocType) => {
|
|
185
|
+
var _a, _b;
|
|
186
|
+
const compodocJson = exports.getCompodocJson();
|
|
187
|
+
const typeAlias = (_b = (_a = compodocJson === null || compodocJson === void 0 ? void 0 : compodocJson.miscellaneous) === null || _a === void 0 ? void 0 : _a.typealiases) === null || _b === void 0 ? void 0 : _b.find((x) => x.name === compodocType);
|
|
188
|
+
return typeAlias ? resolveTypealias(typeAlias.rawtype) : compodocType;
|
|
189
|
+
};
|
|
190
|
+
exports.extractArgTypesFromData = (componentData) => {
|
|
191
|
+
const sectionToItems = {};
|
|
192
|
+
const compodocClasses = ['component', 'directive'].includes(componentData.type)
|
|
193
|
+
? ['propertiesClass', 'methodsClass', 'inputsClass', 'outputsClass']
|
|
194
|
+
: ['properties', 'methods'];
|
|
195
|
+
compodocClasses.forEach((key) => {
|
|
196
|
+
const data = componentData[key] || [];
|
|
197
|
+
data.forEach((item) => {
|
|
198
|
+
const section = mapItemToSection(key, item);
|
|
199
|
+
const defaultValue = exports.isMethod(item) ? undefined : extractDefaultValue(item);
|
|
200
|
+
const type = exports.isMethod(item) || (section !== 'inputs' && section !== 'properties')
|
|
201
|
+
? { name: 'void' }
|
|
202
|
+
: exports.extractType(item, defaultValue);
|
|
203
|
+
const action = section === 'outputs' ? { action: item.name } : {};
|
|
204
|
+
const argType = Object.assign(Object.assign({ name: item.name, description: item.rawdescription || item.description, defaultValue,
|
|
205
|
+
type }, action), { table: {
|
|
206
|
+
category: section,
|
|
207
|
+
type: {
|
|
208
|
+
summary: exports.isMethod(item) ? displaySignature(item) : item.type,
|
|
209
|
+
required: exports.isMethod(item) ? false : !item.optional,
|
|
210
|
+
},
|
|
211
|
+
defaultValue: { summary: defaultValue },
|
|
212
|
+
} });
|
|
213
|
+
if (!sectionToItems[section]) {
|
|
214
|
+
sectionToItems[section] = [];
|
|
215
|
+
}
|
|
216
|
+
sectionToItems[section].push(argType);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
const SECTIONS = [
|
|
220
|
+
'properties',
|
|
221
|
+
'inputs',
|
|
222
|
+
'outputs',
|
|
223
|
+
'methods',
|
|
224
|
+
'view child',
|
|
225
|
+
'view children',
|
|
226
|
+
'content child',
|
|
227
|
+
'content children',
|
|
228
|
+
];
|
|
229
|
+
const argTypes = {};
|
|
230
|
+
SECTIONS.forEach((section) => {
|
|
231
|
+
const items = sectionToItems[section];
|
|
232
|
+
if (items) {
|
|
233
|
+
items.forEach((argType) => {
|
|
234
|
+
argTypes[argType.name] = argType;
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
return argTypes;
|
|
239
|
+
};
|
|
240
|
+
exports.extractArgTypes = (component) => {
|
|
241
|
+
const componentData = getComponentData(component);
|
|
242
|
+
return componentData && exports.extractArgTypesFromData(componentData);
|
|
243
|
+
};
|
|
244
|
+
exports.extractComponentDescription = (component) => {
|
|
245
|
+
const componentData = getComponentData(component);
|
|
246
|
+
return componentData && (componentData.rawdescription || componentData.description);
|
|
247
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SourceType } from '@storybook/docs-tools';
|
|
2
|
+
export declare const parameters: {
|
|
3
|
+
docs: {
|
|
4
|
+
inlineStories: boolean;
|
|
5
|
+
prepareForInline: (storyFn: import("@storybook/csf").PartialStoryFn<import("..").AngularFramework, import("@storybook/csf").Args>, { id, parameters, component }: import("..").StoryContext) => import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<undefined>, undefined>;
|
|
6
|
+
extractArgTypes: (component: import("./types").Directive) => import("@storybook/api").ArgTypes;
|
|
7
|
+
extractComponentDescription: (component: import("./types").Directive) => string;
|
|
8
|
+
source: {
|
|
9
|
+
type: SourceType;
|
|
10
|
+
language: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const decorators: ((storyFn: import("@storybook/csf").PartialStoryFn<import("..").AngularFramework, import("@storybook/csf").Args>, context: import("..").StoryContext) => import("..").IStory)[];
|
|
15
|
+
export declare const argTypesEnhancers: (<TFramework extends import("@storybook/csf").AnyFramework>(context: import("@storybook/csf").StoryContextForEnhancers<TFramework, import("@storybook/csf").Args>) => import("@storybook/csf").StrictArgTypes<import("@storybook/csf").Args> | import("@storybook/addons").Parameters)[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.argTypesEnhancers = exports.decorators = exports.parameters = void 0;
|
|
4
|
+
const docs_tools_1 = require("@storybook/docs-tools");
|
|
5
|
+
const compodoc_1 = require("./compodoc");
|
|
6
|
+
const sourceDecorator_1 = require("./sourceDecorator");
|
|
7
|
+
const prepareForInline_1 = require("./prepareForInline");
|
|
8
|
+
exports.parameters = {
|
|
9
|
+
docs: {
|
|
10
|
+
// probably set this to true by default once it's battle-tested
|
|
11
|
+
inlineStories: false,
|
|
12
|
+
prepareForInline: prepareForInline_1.prepareForInline,
|
|
13
|
+
extractArgTypes: compodoc_1.extractArgTypes,
|
|
14
|
+
extractComponentDescription: compodoc_1.extractComponentDescription,
|
|
15
|
+
source: {
|
|
16
|
+
type: docs_tools_1.SourceType.DYNAMIC,
|
|
17
|
+
language: 'html',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
exports.decorators = [sourceDecorator_1.sourceDecorator];
|
|
22
|
+
exports.argTypesEnhancers = [docs_tools_1.enhanceArgTypes];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './compodoc';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./compodoc"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PartialStoryFn } from '@storybook/csf';
|
|
3
|
+
import { AngularFramework, StoryContext } from '..';
|
|
4
|
+
/**
|
|
5
|
+
* Uses the angular renderer to generate a story. Uses p-limit to run synchronously
|
|
6
|
+
*/
|
|
7
|
+
export declare const prepareForInline: (storyFn: PartialStoryFn<AngularFramework>, { id, parameters, component }: StoryContext) => React.DetailedReactHTMLElement<React.HTMLAttributes<undefined>, undefined>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.prepareForInline = void 0;
|
|
16
|
+
const react_1 = __importDefault(require("react"));
|
|
17
|
+
const p_limit_1 = __importDefault(require("p-limit"));
|
|
18
|
+
const nanoid_1 = require("nanoid");
|
|
19
|
+
const renderer_1 = require("../../renderer");
|
|
20
|
+
const limit = p_limit_1.default(1);
|
|
21
|
+
/**
|
|
22
|
+
* Uses the angular renderer to generate a story. Uses p-limit to run synchronously
|
|
23
|
+
*/
|
|
24
|
+
exports.prepareForInline = (storyFn, { id, parameters, component }) => {
|
|
25
|
+
const el = react_1.default.useRef();
|
|
26
|
+
react_1.default.useEffect(() => {
|
|
27
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
limit(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
const renderer = yield renderer_1.rendererFactory.getRendererInstance(`${id}-${nanoid_1.nanoid(10)}`.toLowerCase(), el.current);
|
|
30
|
+
if (renderer) {
|
|
31
|
+
yield renderer.render({
|
|
32
|
+
forced: false,
|
|
33
|
+
component,
|
|
34
|
+
parameters,
|
|
35
|
+
storyFnAngular: storyFn(),
|
|
36
|
+
targetDOMNode: el.current,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
}))();
|
|
41
|
+
});
|
|
42
|
+
return react_1.default.createElement('div', {
|
|
43
|
+
ref: el,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PartialStoryFn } from '@storybook/csf';
|
|
2
|
+
import { StoryContext, AngularFramework } from '..';
|
|
3
|
+
export declare const skipSourceRender: (context: StoryContext) => any;
|
|
4
|
+
/**
|
|
5
|
+
* Angular source decorator.
|
|
6
|
+
* @param storyFn Fn
|
|
7
|
+
* @param context StoryContext
|
|
8
|
+
*/
|
|
9
|
+
export declare const sourceDecorator: (storyFn: PartialStoryFn<AngularFramework>, context: StoryContext) => import("..").IStory;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.sourceDecorator = exports.skipSourceRender = void 0;
|
|
32
|
+
const addons_1 = require("@storybook/addons");
|
|
33
|
+
const docs_tools_1 = require("@storybook/docs-tools");
|
|
34
|
+
const renderer_1 = require("../../renderer");
|
|
35
|
+
exports.skipSourceRender = (context) => {
|
|
36
|
+
var _a;
|
|
37
|
+
const sourceParams = (_a = context === null || context === void 0 ? void 0 : context.parameters.docs) === null || _a === void 0 ? void 0 : _a.source;
|
|
38
|
+
// always render if the user forces it
|
|
39
|
+
if ((sourceParams === null || sourceParams === void 0 ? void 0 : sourceParams.type) === docs_tools_1.SourceType.DYNAMIC) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
// never render if the user is forcing the block to render code, or
|
|
43
|
+
// if the user provides code
|
|
44
|
+
return (sourceParams === null || sourceParams === void 0 ? void 0 : sourceParams.code) || (sourceParams === null || sourceParams === void 0 ? void 0 : sourceParams.type) === docs_tools_1.SourceType.CODE;
|
|
45
|
+
};
|
|
46
|
+
let prettyUpInternal;
|
|
47
|
+
const makePrettyUp = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
if (prettyUpInternal) {
|
|
49
|
+
return prettyUpInternal;
|
|
50
|
+
}
|
|
51
|
+
const prettierHtml = yield Promise.resolve().then(() => __importStar(require('prettier/parser-html')));
|
|
52
|
+
const prettier = yield Promise.resolve().then(() => __importStar(require('prettier/standalone')));
|
|
53
|
+
prettyUpInternal = (source) => {
|
|
54
|
+
return prettier.format(source, {
|
|
55
|
+
parser: 'angular',
|
|
56
|
+
plugins: [prettierHtml],
|
|
57
|
+
htmlWhitespaceSensitivity: 'ignore',
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
return prettyUpInternal;
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Angular source decorator.
|
|
64
|
+
* @param storyFn Fn
|
|
65
|
+
* @param context StoryContext
|
|
66
|
+
*/
|
|
67
|
+
exports.sourceDecorator = (storyFn, context) => {
|
|
68
|
+
const story = storyFn();
|
|
69
|
+
if (exports.skipSourceRender(context)) {
|
|
70
|
+
return story;
|
|
71
|
+
}
|
|
72
|
+
const channel = addons_1.addons.getChannel();
|
|
73
|
+
const { props, template, userDefinedTemplate } = story;
|
|
74
|
+
const { component, argTypes } = context;
|
|
75
|
+
let toEmit;
|
|
76
|
+
const prettyUpPromise = makePrettyUp();
|
|
77
|
+
addons_1.useEffect(() => {
|
|
78
|
+
prettyUpPromise.then((prettyUp) => {
|
|
79
|
+
if (toEmit)
|
|
80
|
+
channel.emit(docs_tools_1.SNIPPET_RENDERED, context.id, prettyUp(toEmit));
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
prettyUpPromise.then((prettyUp) => {
|
|
84
|
+
if (component && !userDefinedTemplate) {
|
|
85
|
+
const source = renderer_1.computesTemplateSourceFromComponent(component, props, argTypes);
|
|
86
|
+
// We might have a story with a Directive or Service defined as the component
|
|
87
|
+
// In these cases there might exist a template, even if we aren't able to create source from component
|
|
88
|
+
if (source || template) {
|
|
89
|
+
toEmit = prettyUp(source || template);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (template) {
|
|
93
|
+
toEmit = prettyUp(template);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return story;
|
|
97
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
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 declare 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,5 +1,5 @@
|
|
|
1
|
-
import { PartialStoryFn } from '@storybook/csf';
|
|
2
|
-
import { AngularFramework } from '../types-6-0';
|
|
1
|
+
import type { PartialStoryFn } from '@storybook/csf';
|
|
2
|
+
import type { AngularFramework } from '../types-6-0';
|
|
3
3
|
declare global {
|
|
4
4
|
interface Window {
|
|
5
5
|
NODE_ENV: 'string' | 'development' | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Type } from '@angular/core';
|
|
2
|
-
import { ArgTypes } from '@storybook/api';
|
|
3
|
-
import { ICollection } from '../types';
|
|
1
|
+
import type { Type } from '@angular/core';
|
|
2
|
+
import type { ArgTypes } from '@storybook/api';
|
|
3
|
+
import type { ICollection } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Converts a component into a template with inputs/outputs present in initial props
|
|
6
6
|
* @param component
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DecoratorFunction, LegacyStoryFn } from '@storybook/csf';
|
|
2
|
-
import { AngularFramework } from './types-6-0';
|
|
1
|
+
import type { DecoratorFunction, LegacyStoryFn } from '@storybook/csf';
|
|
2
|
+
import type { AngularFramework } from './types-6-0';
|
|
3
3
|
export default function decorateStory(mainStoryFn: LegacyStoryFn<AngularFramework>, decorators: DecoratorFunction<AngularFramework>[]): LegacyStoryFn<AngularFramework>;
|
|
4
4
|
export { decorateStory };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Type } from '@angular/core';
|
|
2
|
-
import { DecoratorFunction, StoryContext } from '@storybook/csf';
|
|
3
|
-
import { ICollection, NgModuleMetadata } from './types';
|
|
4
|
-
import { AngularFramework } from './types-6-0';
|
|
1
|
+
import type { Type } from '@angular/core';
|
|
2
|
+
import type { DecoratorFunction, StoryContext } from '@storybook/csf';
|
|
3
|
+
import type { ICollection, NgModuleMetadata } from './types';
|
|
4
|
+
import type { AngularFramework } from './types-6-0';
|
|
5
5
|
export declare const moduleMetadata: <TArgs = any>(metadata: Partial<NgModuleMetadata>) => DecoratorFunction<AngularFramework, TArgs>;
|
|
6
6
|
export declare const componentWrapperDecorator: <TArgs = any>(element: Type<unknown> | ((story: string) => string), props?: ICollection | ((storyContext: StoryContext<AngularFramework, TArgs>) => ICollection)) => DecoratorFunction<AngularFramework, TArgs>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="webpack-env" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { ClientStoryApi, Loadable } from '@storybook/addons';
|
|
3
|
+
import type { ClientStoryApi, Loadable } from '@storybook/addons';
|
|
4
4
|
import './globals';
|
|
5
|
-
import { IStorybookSection } from './types';
|
|
6
|
-
import { AngularFramework } from './types-6-0';
|
|
5
|
+
import type { IStorybookSection } from './types';
|
|
6
|
+
import type { AngularFramework } from './types-6-0';
|
|
7
7
|
interface ClientApi extends ClientStoryApi<AngularFramework['storyResult']> {
|
|
8
8
|
setAddon(addon: any): void;
|
|
9
9
|
configure(loader: Loadable, module: NodeModule): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RenderContext } from '@storybook/store';
|
|
2
|
-
import { ArgsStoryFn } from '@storybook/csf';
|
|
3
|
-
import { AngularFramework } from './types-6-0';
|
|
1
|
+
import type { RenderContext } from '@storybook/store';
|
|
2
|
+
import type { ArgsStoryFn } from '@storybook/csf';
|
|
3
|
+
import type { AngularFramework } from './types-6-0';
|
|
4
4
|
import { RendererFactory } from './angular-beta/RendererFactory';
|
|
5
5
|
export declare const rendererFactory: RendererFactory;
|
|
6
6
|
export declare const render: ArgsStoryFn<AngularFramework>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Args, Parameters as DefaultParameters, StoryContext as DefaultStoryContext, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
|
|
2
|
-
import { StoryFnAngularReturnType } from './types';
|
|
1
|
+
import type { Args, Parameters as DefaultParameters, StoryContext as DefaultStoryContext, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
|
|
2
|
+
import type { StoryFnAngularReturnType } from './types';
|
|
3
3
|
export type { Args, ArgTypes } from '@storybook/csf';
|
|
4
4
|
export declare type AngularFramework = {
|
|
5
5
|
component: any;
|
|
@@ -10,7 +10,7 @@ function default_1(tsLoaderOptions) {
|
|
|
10
10
|
if (tsLoaderOptions && tsLoaderOptions.configFile) {
|
|
11
11
|
return new fork_ts_checker_webpack_plugin_1.default({
|
|
12
12
|
tsconfig: tsLoaderOptions.configFile,
|
|
13
|
-
async:
|
|
13
|
+
async: true,
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
node_logger_1.logger.info('=> Using default options for ForkTsCheckerWebpackPlugin');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.config = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const docs_tools_1 = require("@storybook/docs-tools");
|
|
9
|
+
exports.config = (entry = [], options) => {
|
|
10
|
+
if (!docs_tools_1.hasDocsOrControls(options))
|
|
11
|
+
return entry;
|
|
12
|
+
return [...entry, path_1.default.join(__dirname, '../../../dist/ts3.9/client/docs/config')];
|
|
13
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoadOptions, Options as CoreOptions } from '@storybook/core-common';
|
|
1
|
+
import type { LoadOptions, Options as CoreOptions } from '@storybook/core-common';
|
|
2
2
|
import { BuilderContext } from '@angular-devkit/architect';
|
|
3
3
|
import { ExtraEntryPoint, StylePreprocessorOptions } from '@angular-devkit/build-angular';
|
|
4
4
|
export declare type PresetOptions = CoreOptions & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "6.5.0-alpha.
|
|
3
|
+
"version": "6.5.0-alpha.49",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular Components in isolation with Hot Reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -45,15 +45,17 @@
|
|
|
45
45
|
"prepare": "node ../../scripts/prepare.js"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@storybook/addons": "6.5.0-alpha.
|
|
49
|
-
"@storybook/api": "6.5.0-alpha.
|
|
50
|
-
"@storybook/
|
|
51
|
-
"@storybook/core
|
|
52
|
-
"@storybook/core-
|
|
48
|
+
"@storybook/addons": "6.5.0-alpha.49",
|
|
49
|
+
"@storybook/api": "6.5.0-alpha.49",
|
|
50
|
+
"@storybook/client-logger": "6.5.0-alpha.49",
|
|
51
|
+
"@storybook/core": "6.5.0-alpha.49",
|
|
52
|
+
"@storybook/core-common": "6.5.0-alpha.49",
|
|
53
|
+
"@storybook/core-events": "6.5.0-alpha.49",
|
|
53
54
|
"@storybook/csf": "0.0.2--canary.87bc651.0",
|
|
54
|
-
"@storybook/
|
|
55
|
+
"@storybook/docs-tools": "6.5.0-alpha.49",
|
|
56
|
+
"@storybook/node-logger": "6.5.0-alpha.49",
|
|
55
57
|
"@storybook/semver": "^7.3.2",
|
|
56
|
-
"@storybook/store": "6.5.0-alpha.
|
|
58
|
+
"@storybook/store": "6.5.0-alpha.49",
|
|
57
59
|
"@types/node": "^14.14.20 || ^16.0.0",
|
|
58
60
|
"@types/react": "^16.14.23",
|
|
59
61
|
"@types/react-dom": "^16.9.14",
|
|
@@ -63,15 +65,17 @@
|
|
|
63
65
|
"find-up": "^5.0.0",
|
|
64
66
|
"fork-ts-checker-webpack-plugin": "^4.1.6",
|
|
65
67
|
"global": "^4.4.0",
|
|
68
|
+
"nanoid": "^3.1.23",
|
|
69
|
+
"p-limit": "^3.1.0",
|
|
66
70
|
"postcss": "^7.0.36",
|
|
67
71
|
"postcss-loader": "^4.2.0",
|
|
72
|
+
"prettier": ">=2.2.1 <=2.3.0",
|
|
68
73
|
"raw-loader": "^4.0.2",
|
|
69
74
|
"react": "^16.14.0",
|
|
70
75
|
"react-dom": "^16.14.0",
|
|
71
76
|
"read-pkg-up": "^7.0.1",
|
|
72
77
|
"regenerator-runtime": "^0.13.7",
|
|
73
78
|
"sass-loader": "^10.1.0",
|
|
74
|
-
"strip-json-comments": "3.1.1",
|
|
75
79
|
"telejson": "^5.3.3",
|
|
76
80
|
"ts-dedent": "^2.0.0",
|
|
77
81
|
"ts-loader": "^8.0.14",
|
|
@@ -93,10 +97,12 @@
|
|
|
93
97
|
"@angular/platform-browser-dynamic": "^11.2.14",
|
|
94
98
|
"@nrwl/workspace": "^11.6.3",
|
|
95
99
|
"@types/autoprefixer": "^9.7.2",
|
|
96
|
-
"@types/
|
|
100
|
+
"@types/tmp": "^0.2.3",
|
|
101
|
+
"cross-spawn": "^7.0.3",
|
|
97
102
|
"jest": "^26.6.3",
|
|
98
103
|
"jest-preset-angular": "^8.3.2",
|
|
99
|
-
"
|
|
104
|
+
"jest-specific-snapshot": "^4.0.0",
|
|
105
|
+
"tmp": "^0.2.1"
|
|
100
106
|
},
|
|
101
107
|
"peerDependencies": {
|
|
102
108
|
"@angular-devkit/architect": ">=0.8.9",
|
|
@@ -131,5 +137,5 @@
|
|
|
131
137
|
"access": "public"
|
|
132
138
|
},
|
|
133
139
|
"builders": "dist/ts3.9/builders/builders.json",
|
|
134
|
-
"gitHead": "
|
|
140
|
+
"gitHead": "5cd3cd92ff4ab3dce81726f0d3913d7077926bee"
|
|
135
141
|
}
|
package/standalone.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CLIOptions, LoadOptions, BuilderOptions } from '@storybook/core-common';
|
|
2
|
-
import { BuilderContext } from '@angular-devkit/architect';
|
|
1
|
+
import type { CLIOptions, LoadOptions, BuilderOptions } from '@storybook/core-common';
|
|
2
|
+
import type { BuilderContext } from '@angular-devkit/architect';
|
|
3
3
|
|
|
4
4
|
export type StandaloneOptions = Partial<
|
|
5
5
|
CLIOptions &
|