ember-storybook 0.1.4 → 0.1.6
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/declarations/client/docs/blocks/blocks.d.ts +5 -3
- package/declarations/client/docs/blocks/blocks.d.ts.map +1 -1
- package/declarations/client/docs/blocks/subcomponents.d.ts +3 -1
- package/declarations/client/docs/blocks/subcomponents.d.ts.map +1 -1
- package/declarations/client/docs/config.d.ts.map +1 -1
- package/declarations/client/docs/extractArgTypes.d.ts +0 -1
- package/declarations/client/docs/extractArgTypes.d.ts.map +1 -1
- package/declarations/client/docs/page.d.ts.map +1 -1
- package/declarations/client/docs/signature.d.ts +10 -0
- package/declarations/client/docs/signature.d.ts.map +1 -1
- package/declarations/node/docgen/docgen.d.ts.map +1 -1
- package/declarations/node/meta/vite-plugin.d.ts +1 -0
- package/declarations/node/meta/vite-plugin.d.ts.map +1 -1
- package/declarations/node/parser.d.ts.map +1 -1
- package/declarations/node/types.d.ts +1 -0
- package/declarations/node/types.d.ts.map +1 -1
- package/dist/client/docs/config.mjs +140 -87
- package/dist/client/docs/config.mjs.map +1 -1
- package/dist/preset.mjs +523 -763
- package/dist/preset.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EmberMeta } from '../../../node/types';
|
|
1
2
|
import type { BlockInfo } from 'ember-docgen';
|
|
2
3
|
export declare const ParamType: import("storybook/theming").StyledComponent<{
|
|
3
4
|
theme?: import("storybook/theming").Theme;
|
|
@@ -7,17 +8,18 @@ export declare const ParamRow: import("storybook/theming").StyledComponent<{
|
|
|
7
8
|
theme?: import("storybook/theming").Theme;
|
|
8
9
|
as?: React.ElementType;
|
|
9
10
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
10
|
-
export declare function BlocksTable({ blocks, subcomponentNames,
|
|
11
|
+
export declare function BlocksTable({ blocks, subcomponentNames, data }: {
|
|
11
12
|
blocks: Record<string, BlockInfo>;
|
|
12
13
|
subcomponentNames: Set<string>;
|
|
13
|
-
|
|
14
|
+
data?: EmberMeta;
|
|
14
15
|
}): import("react").FunctionComponentElement<{
|
|
15
16
|
theme?: import("storybook/theming").Theme;
|
|
16
17
|
as?: React.ElementType;
|
|
17
18
|
} & import("react").ClassAttributes<HTMLTableElement> & import("react").TableHTMLAttributes<HTMLTableElement>> | undefined;
|
|
18
|
-
export declare function BlocksSection({ blocks, subcomponentNames }: {
|
|
19
|
+
export declare function BlocksSection({ blocks, subcomponentNames, data }: {
|
|
19
20
|
blocks: Record<string, BlockInfo>;
|
|
20
21
|
subcomponentNames: Set<string>;
|
|
22
|
+
data?: EmberMeta;
|
|
21
23
|
}): import("react").FunctionComponentElement<{
|
|
22
24
|
theme?: import("storybook/theming").Theme;
|
|
23
25
|
as?: React.ElementType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../../src/client/docs/blocks/blocks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../../src/client/docs/blocks/blocks.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAA8B,MAAM,cAAc,CAAC;AAE1E,eAAO,MAAM,SAAS;;;mGAInB,CAAC;AAOJ,eAAO,MAAM,QAAQ;;;yGAIlB,CAAC;AAsKJ,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,iBAAiB,EACjB,IAAI,EACL,EAAE;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAClC,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;;;2HAiCA;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,iBAAiB,EACjB,IAAI,EACL,EAAE;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAClC,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;;;sGAOA"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { EmberMeta } from '../../../node/types';
|
|
1
2
|
import type { SubcomponentRef } from '../signature';
|
|
2
|
-
export declare function SubcomponentsArea({ components }: {
|
|
3
|
+
export declare function SubcomponentsArea({ components, data }: {
|
|
3
4
|
components: SubcomponentRef[];
|
|
5
|
+
data?: EmberMeta;
|
|
4
6
|
}): import("react").FunctionComponentElement<{
|
|
5
7
|
theme?: import("storybook/theming").Theme;
|
|
6
8
|
as?: React.ElementType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subcomponents.d.ts","sourceRoot":"","sources":["../../../../src/client/docs/blocks/subcomponents.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAgDpD,wBAAgB,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"subcomponents.d.ts","sourceRoot":"","sources":["../../../../src/client/docs/blocks/subcomponents.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAgDpD,wBAAgB,iBAAiB,CAAC,EAChC,UAAU,EACV,IAAI,EACL,EAAE;IACD,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;;;kHAmCA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/client/docs/config.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,wBAAwB,EACxB,cAAc,EACf,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/client/docs/config.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,wBAAwB,EACxB,cAAc,EACf,MAAM,0BAA0B,CAAC;AAuBlC,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAC/B,OAAO,EAAE,wBAAwB,CAAC,aAAa,CAAC,KAC7C,cAAc,CAAC,EAkCnB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAQxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,aAAa,CAAC,EAAsB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { ComponentSignature } from 'ember-docgen';
|
|
2
2
|
export declare function buildArgTypes(sig: ComponentSignature): Record<string, unknown>;
|
|
3
|
-
export declare function extractArgTypes(component: Record<string, unknown>): Record<string, unknown> | null;
|
|
4
3
|
//# sourceMappingURL=extractArgTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractArgTypes.d.ts","sourceRoot":"","sources":["../../../src/client/docs/extractArgTypes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extractArgTypes.d.ts","sourceRoot":"","sources":["../../../src/client/docs/extractArgTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAoCpE,wBAAgB,aAAa,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoB9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/client/docs/page.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/client/docs/page.ts"],"names":[],"mappings":"AAiFA,MAAM,CAAC,OAAO,UAAU,IAAI,4EAiC3B"}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import type { EmberMeta } from '../../node/types';
|
|
2
2
|
import type { BlockInfo, ComponentSignature } from 'ember-docgen';
|
|
3
|
+
/**
|
|
4
|
+
* Key used for default exports in signature/component maps. Mirrors
|
|
5
|
+
* ember-docgen's `Default` sentinel — duplicated as a literal so client
|
|
6
|
+
* code does not pull ember-docgen's node-only dependencies into the bundle.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_EXPORT = "__DEFAULT__";
|
|
3
9
|
export interface SubcomponentRef {
|
|
4
10
|
name: string;
|
|
5
11
|
signature?: ComponentSignature;
|
|
6
12
|
importPath?: string;
|
|
7
13
|
}
|
|
14
|
+
export declare function componentDisplayName(ref: undefined | {
|
|
15
|
+
filePath?: string;
|
|
16
|
+
exportName?: string;
|
|
17
|
+
}, data: EmberMeta): string | undefined;
|
|
8
18
|
export declare function applyModifiers(signature: ComponentSignature, modifiers?: {
|
|
9
19
|
name: string;
|
|
10
20
|
typeArgs: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../src/client/docs/signature.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,kBAAkB,EAC7B,SAAS,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,GACjD,kBAAkB,CAsBpB;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EACjC,IAAI,EAAE,SAAS,GACd,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../src/client/docs/signature.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAcD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAC3D,IAAI,EAAE,SAAS,GACd,MAAM,GAAG,SAAS,CAgBpB;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,kBAAkB,EAC7B,SAAS,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,GACjD,kBAAkB,CAsBpB;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EACjC,IAAI,EAAE,SAAS,GACd,eAAe,EAAE,CA8CnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docgen.d.ts","sourceRoot":"","sources":["../../../src/node/docgen/docgen.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAyC1D,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"docgen.d.ts","sourceRoot":"","sources":["../../../src/node/docgen/docgen.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAyC1D,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA0BtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../../../src/node/meta/vite-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../../../src/node/meta/vite-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAIlE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAgCD,wBAAgB,eAAe,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,CAuF3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/node/parser.ts"],"names":[],"mappings":"AAKA,OAAO,EAAW,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE1F,OAAO,EAAW,KAAK,YAAY,EAAqB,MAAM,UAAU,CAAC;AAEzE,OAAO,KAAK,EAAmB,OAAO,EAAsB,MAAM,YAAY,CAAC;AAE/E;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAExD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAW9F;AAED,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAKnF;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE;QACT;;;WAGG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd;;;;;;;WAOG;QACH,aAAa,CAAC,EAAE,MAAM,CAAC;QAEvB;;;;;WAKG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IAEF,OAAO,EAAE,CAAC,WAAW,GAAG;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CACxD;AAkDD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/node/parser.ts"],"names":[],"mappings":"AAKA,OAAO,EAAW,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE1F,OAAO,EAAW,KAAK,YAAY,EAAqB,MAAM,UAAU,CAAC;AAEzE,OAAO,KAAK,EAAmB,OAAO,EAAsB,MAAM,YAAY,CAAC;AAE/E;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAExD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAW9F;AAED,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAKnF;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE;QACT;;;WAGG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd;;;;;;;WAOG;QACH,aAAa,CAAC,EAAE,MAAM,CAAC;QAEvB;;;;;WAKG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IAEF,OAAO,EAAE,CAAC,WAAW,GAAG;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CACxD;AAkDD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAkF7E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CA6GvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/node/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,aAAa,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/node/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAChD,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AACnC,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEvC;;;;;GAKG;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,aAAa,GAAG,iBAAiB,EAAE,SAAS,GAAG,aAAa,CAAC,CAAC"}
|
|
@@ -3,18 +3,11 @@ import { t as unwrapBlockParams } from "../../block-params-C68OkWMC.mjs";
|
|
|
3
3
|
import { emitTransformCode, useEffect, useRef } from "storybook/preview-api";
|
|
4
4
|
import { SourceType } from "storybook/internal/docs-tools";
|
|
5
5
|
import emberData from "virtual:ember-storybook";
|
|
6
|
-
import { ArgTypes, Controls, Description, Heading, Primary, Stories, Subheading, Subtitle, Title, useOf } from "@storybook/addon-docs/blocks";
|
|
7
|
-
import { Fragment, createElement } from "react";
|
|
6
|
+
import { ArgTypes, Controls, Description, DocsContext, Heading, Primary, Stories, Subheading, Subtitle, Title, useOf } from "@storybook/addon-docs/blocks";
|
|
7
|
+
import { Fragment, createElement, useContext } from "react";
|
|
8
|
+
import { NAVIGATE_URL } from "storybook/internal/core-events";
|
|
8
9
|
import { styled } from "storybook/theming";
|
|
9
10
|
//#region src/client/docs/extractArgTypes.ts
|
|
10
|
-
const data$2 = emberData;
|
|
11
|
-
const byName = /* @__PURE__ */ new Map();
|
|
12
|
-
for (const entry of Object.values(data$2)) {
|
|
13
|
-
const comp = entry.component;
|
|
14
|
-
if (!comp?.signatureName) continue;
|
|
15
|
-
const sig = (comp.file ? data$2[comp.file] : void 0)?.signatures?.[comp.signatureName];
|
|
16
|
-
if (sig) byName.set(comp.signatureName, sig);
|
|
17
|
-
}
|
|
18
11
|
function mapTypeToControl(type) {
|
|
19
12
|
switch (type.category) {
|
|
20
13
|
case "string": return { type: "text" };
|
|
@@ -45,6 +38,65 @@ function buildArgTypes(sig) {
|
|
|
45
38
|
};
|
|
46
39
|
return argTypes;
|
|
47
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolve the human-facing name of a referenced component export.
|
|
43
|
+
*
|
|
44
|
+
* Prefers the component's own declaration name over its export alias and
|
|
45
|
+
* resolves the default-export sentinel to the real class name via the
|
|
46
|
+
* component file's declaration map. Returns `undefined` when no better
|
|
47
|
+
* name is known.
|
|
48
|
+
*/
|
|
49
|
+
function hasSignatureMap(entry) {
|
|
50
|
+
return typeof entry === "object" && entry !== null && Object.hasOwn(entry, "signatures");
|
|
51
|
+
}
|
|
52
|
+
function componentDisplayName(ref, data) {
|
|
53
|
+
if (!ref?.filePath || !ref.exportName) return void 0;
|
|
54
|
+
const rawEntry = data[ref.filePath];
|
|
55
|
+
const componentEntry = hasSignatureMap(rawEntry) ? rawEntry : void 0;
|
|
56
|
+
if (!componentEntry) return ref.exportName === "__DEFAULT__" ? void 0 : ref.exportName;
|
|
57
|
+
if (ref.exportName === "__DEFAULT__") return componentEntry.meta["__DEFAULT__"] ?? void 0;
|
|
58
|
+
return componentEntry.meta[ref.exportName] ?? ref.exportName;
|
|
59
|
+
}
|
|
60
|
+
function applyModifiers(signature, modifiers) {
|
|
61
|
+
if (!modifiers || modifiers.length === 0) return signature;
|
|
62
|
+
const blockedKeys = /* @__PURE__ */ new Set();
|
|
63
|
+
const pickedKeys = /* @__PURE__ */ new Set();
|
|
64
|
+
for (const mod of modifiers) {
|
|
65
|
+
if (mod.name === "WithBoundArgs" || mod.name === "Omit") for (const key of mod.typeArgs) blockedKeys.add(key);
|
|
66
|
+
if (mod.name === "Pick") for (const key of mod.typeArgs) pickedKeys.add(key);
|
|
67
|
+
}
|
|
68
|
+
const filtered = pickedKeys.size > 0 ? Object.fromEntries(Object.entries(signature.args).filter(([k]) => pickedKeys.has(k))) : Object.fromEntries(Object.entries(signature.args).filter(([k]) => !blockedKeys.has(k)));
|
|
69
|
+
return {
|
|
70
|
+
...signature,
|
|
71
|
+
args: filtered
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function collectSubcomponents(blocks, data) {
|
|
75
|
+
const seen = /* @__PURE__ */ new Set();
|
|
76
|
+
const result = [];
|
|
77
|
+
for (const block of Object.values(blocks)) for (const param of unwrapBlockParams(block.params)) {
|
|
78
|
+
if (!param.componentRef) continue;
|
|
79
|
+
const { filePath, exportName, importPath, modifiers } = param.componentRef;
|
|
80
|
+
const name = componentDisplayName(param.componentRef, data) ?? param.name;
|
|
81
|
+
if (seen.has(name)) continue;
|
|
82
|
+
seen.add(name);
|
|
83
|
+
if (importPath) result.push({
|
|
84
|
+
name,
|
|
85
|
+
importPath
|
|
86
|
+
});
|
|
87
|
+
else if (filePath && Object.hasOwn(data, filePath)) {
|
|
88
|
+
const entry = data[filePath];
|
|
89
|
+
if (Object.hasOwn(entry.signatures, exportName)) {
|
|
90
|
+
const sig = entry.signatures[exportName];
|
|
91
|
+
result.push({
|
|
92
|
+
name,
|
|
93
|
+
signature: applyModifiers(sig, modifiers)
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
} else if (filePath) result.push({ name });
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
48
100
|
//#endregion
|
|
49
101
|
//#region src/client/docs/blocks/ui.ts
|
|
50
102
|
function isHtmlElement(name) {
|
|
@@ -164,18 +216,48 @@ const SubcomponentLink = styled.a(({ theme }) => ({
|
|
|
164
216
|
"&:hover": { textDecoration: "underline" }
|
|
165
217
|
}));
|
|
166
218
|
const Indent = styled.span(() => ({ marginInlineStart: "20px" }));
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
219
|
+
/**
|
|
220
|
+
* In-page anchor to a subcomponent section. Mirrors Storybook's own
|
|
221
|
+
* in-docs navigation (TableOfContents / AnchorInPage): the default anchor
|
|
222
|
+
* behavior is prevented — it would resolve against the preview iframe's
|
|
223
|
+
* `<base>` and navigate away from Storybook — and instead the docs page
|
|
224
|
+
* scrolls to the target while `NAVIGATE_URL` keeps the address-bar hash
|
|
225
|
+
* (deep-linkable) in sync via the manager.
|
|
226
|
+
*/
|
|
227
|
+
function SubcomponentAnchor({ name, children }) {
|
|
228
|
+
const context = useContext(DocsContext);
|
|
229
|
+
const hash = `#subcomponent-${name}`;
|
|
230
|
+
return createElement(SubcomponentLink, {
|
|
231
|
+
href: hash,
|
|
232
|
+
target: "_self",
|
|
233
|
+
onClick: (event) => {
|
|
234
|
+
event.preventDefault();
|
|
235
|
+
const target = document.querySelector(`#${CSS.escape(hash.slice(1))}`);
|
|
236
|
+
if (target) {
|
|
237
|
+
target.scrollIntoView({
|
|
238
|
+
behavior: "smooth",
|
|
239
|
+
block: "start"
|
|
240
|
+
});
|
|
241
|
+
context.channel.emit(NAVIGATE_URL, hash);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}, children);
|
|
245
|
+
}
|
|
246
|
+
/** Display name for a block param's type: the referenced component's own
|
|
247
|
+
* name when available, otherwise the raw type string. */
|
|
248
|
+
function displayTypeName(param, data) {
|
|
249
|
+
return (data ? componentDisplayName(param.componentRef, data) : void 0) ?? param.type;
|
|
250
|
+
}
|
|
251
|
+
function renderType(param, subcomponentNames, data) {
|
|
252
|
+
const displayType = displayTypeName(param, data);
|
|
253
|
+
if (param.componentRef) return subcomponentNames.has(displayType) ? createElement(SubcomponentAnchor, {
|
|
254
|
+
key: "type",
|
|
255
|
+
name: displayType
|
|
256
|
+
}, displayType) : createElement(ParamType, { key: "type" }, displayType);
|
|
175
257
|
return createElement(ParamType, { key: "type" }, param.type);
|
|
176
258
|
}
|
|
177
|
-
function renderParam(param, subcomponentNames) {
|
|
178
|
-
const type = renderType(param, subcomponentNames);
|
|
259
|
+
function renderParam(param, subcomponentNames, data) {
|
|
260
|
+
const type = renderType(param, subcomponentNames, data);
|
|
179
261
|
return [
|
|
180
262
|
createElement(ParamName, { key: "name" }, param.name),
|
|
181
263
|
createElement("span", { key: "colon" }, ": "),
|
|
@@ -185,26 +267,26 @@ function renderParam(param, subcomponentNames) {
|
|
|
185
267
|
function isBlockParam(param) {
|
|
186
268
|
return Object.hasOwn(param, "name") && Object.hasOwn(param, "type");
|
|
187
269
|
}
|
|
188
|
-
function renderParams(params, subcomponentNames) {
|
|
270
|
+
function renderParams(params, subcomponentNames, data) {
|
|
189
271
|
return params.map((param, i) => {
|
|
190
272
|
if (!isBlockParam(param)) {
|
|
191
273
|
const children = [
|
|
192
274
|
createElement("span", { key: "open" }, "- {"),
|
|
193
|
-
createElement("br"),
|
|
194
|
-
...Object.
|
|
195
|
-
createElement("br"),
|
|
275
|
+
createElement("br", { key: "br-open" }),
|
|
276
|
+
...Object.entries(param).flatMap(([key, p]) => [createElement(Indent, { key: `indent-${key}` }), renderParam(p, subcomponentNames, data)]),
|
|
277
|
+
createElement("br", { key: "br-close" }),
|
|
196
278
|
createElement("span", { key: "close" }, "}")
|
|
197
279
|
];
|
|
198
280
|
return createElement(Fragment, { key: i }, ...children);
|
|
199
281
|
}
|
|
200
282
|
const isNamed = param.name && !param.name.startsWith("param");
|
|
201
|
-
const displayType = param
|
|
283
|
+
const displayType = displayTypeName(param, data);
|
|
202
284
|
const isSubcomponent = subcomponentNames.has(displayType);
|
|
203
285
|
const children = [];
|
|
204
286
|
const typeChildren = [];
|
|
205
|
-
if (isSubcomponent) typeChildren.push(createElement(
|
|
287
|
+
if (isSubcomponent) typeChildren.push(createElement(SubcomponentAnchor, {
|
|
206
288
|
key: "type",
|
|
207
|
-
|
|
289
|
+
name: displayType
|
|
208
290
|
}, displayType));
|
|
209
291
|
else typeChildren.push(createElement(ParamType, { key: "type" }, displayType));
|
|
210
292
|
if (isNamed) children.push(createElement("span", { key: "sep" }, "- "), createElement(ParamName, { key: "name" }, param.name), createElement("span", { key: "colon" }, ": "), ...typeChildren);
|
|
@@ -214,7 +296,7 @@ function renderParams(params, subcomponentNames) {
|
|
|
214
296
|
return createElement(Fragment, { key: i }, ...rows);
|
|
215
297
|
});
|
|
216
298
|
}
|
|
217
|
-
function BlocksTable({ blocks, subcomponentNames,
|
|
299
|
+
function BlocksTable({ blocks, subcomponentNames, data }) {
|
|
218
300
|
const entries = Object.entries(blocks).toSorted(([nameA, _a], [nameB, _b]) => {
|
|
219
301
|
if (nameA === "default") return -1;
|
|
220
302
|
if (nameB === "default") return -1;
|
|
@@ -223,22 +305,20 @@ function BlocksTable({ blocks, subcomponentNames, defaultName }) {
|
|
|
223
305
|
if (entries.length === 0) return;
|
|
224
306
|
const rows = [];
|
|
225
307
|
for (const [name, block] of entries) {
|
|
226
|
-
const displayName =
|
|
308
|
+
const displayName = `<:${name}>`;
|
|
227
309
|
rows.push(createElement("tr", { key: name }, createElement(BlocksNameCell, void 0, displayName)));
|
|
228
310
|
if (block.params.length > 0) {
|
|
229
|
-
const params = renderParams(block.params, subcomponentNames);
|
|
230
|
-
rows.push(createElement("tr",
|
|
311
|
+
const params = renderParams(block.params, subcomponentNames, data);
|
|
312
|
+
rows.push(createElement("tr", { key: `${name}-params` }, createElement("td", void 0, ...params)));
|
|
231
313
|
}
|
|
232
314
|
}
|
|
233
315
|
return createElement(TableWrapper, { className: "docblock-argstable sb-unstyled" }, createElement("tbody", { className: "docblock-argstable-body" }, rows));
|
|
234
316
|
}
|
|
235
|
-
function BlocksSection({ blocks, subcomponentNames }) {
|
|
236
|
-
const { preparedMeta } = useOf("meta", ["meta"]);
|
|
237
|
-
const componentName = preparedMeta.title;
|
|
317
|
+
function BlocksSection({ blocks, subcomponentNames, data }) {
|
|
238
318
|
return createElement(BlocksDiv, void 0, createElement(Subheading, void 0, "Blocks"), BlocksTable({
|
|
239
319
|
blocks,
|
|
240
320
|
subcomponentNames,
|
|
241
|
-
|
|
321
|
+
data
|
|
242
322
|
}));
|
|
243
323
|
}
|
|
244
324
|
//#endregion
|
|
@@ -314,7 +394,7 @@ const SectionLabel = styled.div(({ theme }) => ({
|
|
|
314
394
|
fontSize: theme.typography.size.m1 - 2,
|
|
315
395
|
marginBottom: 8
|
|
316
396
|
}));
|
|
317
|
-
function renderSubcomponentSignature(sig, subcomponentNames,
|
|
397
|
+
function renderSubcomponentSignature(sig, subcomponentNames, data) {
|
|
318
398
|
const children = [];
|
|
319
399
|
if (sig.element) children.push(createElement(ElementBlock, { element: sig.element }));
|
|
320
400
|
if (Object.keys(sig.args).length > 0) children.push(createElement(SectionLabel, void 0, "Args"), createElement(ArgTypes, { include: Object.keys(sig.args) }));
|
|
@@ -324,11 +404,11 @@ function renderSubcomponentSignature(sig, subcomponentNames, defaultName) {
|
|
|
324
404
|
}, "Blocks"), createElement(BlocksTable, {
|
|
325
405
|
blocks: sig.blocks,
|
|
326
406
|
subcomponentNames,
|
|
327
|
-
|
|
407
|
+
data
|
|
328
408
|
}));
|
|
329
409
|
return children;
|
|
330
410
|
}
|
|
331
|
-
function SubcomponentsArea({ components }) {
|
|
411
|
+
function SubcomponentsArea({ components, data }) {
|
|
332
412
|
if (components.length === 0) return;
|
|
333
413
|
const subcomponentNames = new Set(components.map((c) => c.name));
|
|
334
414
|
const entries = components.map((comp) => {
|
|
@@ -337,7 +417,7 @@ function SubcomponentsArea({ components }) {
|
|
|
337
417
|
key: "import",
|
|
338
418
|
style: { marginBottom: 12 }
|
|
339
419
|
}, createElement("span", void 0, "from '"), createElement(ParamType, void 0, comp.importPath), createElement("span", void 0, "'")));
|
|
340
|
-
else if (comp.signature) children.push(...renderSubcomponentSignature(comp.signature, subcomponentNames,
|
|
420
|
+
else if (comp.signature) children.push(...renderSubcomponentSignature(comp.signature, subcomponentNames, data));
|
|
341
421
|
return createElement(SubEntry, {
|
|
342
422
|
id: `subcomponent-${comp.name}`,
|
|
343
423
|
key: comp.name
|
|
@@ -346,60 +426,23 @@ function SubcomponentsArea({ components }) {
|
|
|
346
426
|
return createElement(SubcomponentsSection, void 0, createElement(H2, void 0, "Subcomponents"), ...entries);
|
|
347
427
|
}
|
|
348
428
|
//#endregion
|
|
349
|
-
//#region src/client/docs/signature.ts
|
|
350
|
-
function applyModifiers(signature, modifiers) {
|
|
351
|
-
if (!modifiers || modifiers.length === 0) return signature;
|
|
352
|
-
const blockedKeys = /* @__PURE__ */ new Set();
|
|
353
|
-
const pickedKeys = /* @__PURE__ */ new Set();
|
|
354
|
-
for (const mod of modifiers) {
|
|
355
|
-
if (mod.name === "WithBoundArgs" || mod.name === "Omit") for (const key of mod.typeArgs) blockedKeys.add(key);
|
|
356
|
-
if (mod.name === "Pick") for (const key of mod.typeArgs) pickedKeys.add(key);
|
|
357
|
-
}
|
|
358
|
-
const filtered = pickedKeys.size > 0 ? Object.fromEntries(Object.entries(signature.args).filter(([k]) => pickedKeys.has(k))) : Object.fromEntries(Object.entries(signature.args).filter(([k]) => !blockedKeys.has(k)));
|
|
359
|
-
return {
|
|
360
|
-
...signature,
|
|
361
|
-
args: filtered
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
function collectSubcomponents(blocks, data) {
|
|
365
|
-
const seen = /* @__PURE__ */ new Set();
|
|
366
|
-
const result = [];
|
|
367
|
-
for (const block of Object.values(blocks)) for (const param of unwrapBlockParams(block.params)) {
|
|
368
|
-
if (!param.componentRef) continue;
|
|
369
|
-
const { filePath, exportName, importPath, modifiers } = param.componentRef;
|
|
370
|
-
if (seen.has(param.name)) continue;
|
|
371
|
-
seen.add(param.name);
|
|
372
|
-
if (importPath) result.push({
|
|
373
|
-
name: param.name,
|
|
374
|
-
importPath
|
|
375
|
-
});
|
|
376
|
-
else if (filePath && Object.hasOwn(data, filePath)) {
|
|
377
|
-
const entry = data[filePath];
|
|
378
|
-
if (Object.hasOwn(entry.signatures, exportName)) {
|
|
379
|
-
const sig = entry.signatures[exportName];
|
|
380
|
-
result.push({
|
|
381
|
-
name: param.name,
|
|
382
|
-
signature: applyModifiers(sig, modifiers)
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
return result;
|
|
388
|
-
}
|
|
389
|
-
//#endregion
|
|
390
429
|
//#region src/client/docs/page.ts
|
|
391
430
|
function addSignature(signature, data) {
|
|
392
431
|
const children = [];
|
|
393
432
|
if (signature.element) children.push(createElement(ElementBlock, { element: signature.element }));
|
|
394
|
-
if (Object.keys(signature.args).length > 0) children.push(createElement(Subheading, void 0, "Args"), createElement(Controls
|
|
433
|
+
if (Object.keys(signature.args).length > 0) children.push(createElement(Subheading, void 0, "Args"), createElement(Controls));
|
|
395
434
|
if (Object.keys(signature.blocks).length > 0) {
|
|
396
435
|
const subcomponents = collectSubcomponents(signature.blocks, data);
|
|
397
436
|
const subcomponentNames = new Set(subcomponents.map((s) => s.name));
|
|
398
437
|
children.push(createElement(BlocksSection, {
|
|
399
438
|
blocks: signature.blocks,
|
|
400
|
-
subcomponentNames
|
|
439
|
+
subcomponentNames,
|
|
440
|
+
data
|
|
441
|
+
}));
|
|
442
|
+
if (subcomponents.length > 0) children.push(createElement(SubcomponentsArea, {
|
|
443
|
+
components: subcomponents,
|
|
444
|
+
data
|
|
401
445
|
}));
|
|
402
|
-
if (subcomponents.length > 0) children.push(createElement(SubcomponentsArea, { components: subcomponents }));
|
|
403
446
|
}
|
|
404
447
|
if (Object.keys(signature.style.customProperties).length > 0) {
|
|
405
448
|
const entries = Object.entries(signature.style.customProperties).map(([name, description]) => ({
|
|
@@ -422,16 +465,19 @@ function Page() {
|
|
|
422
465
|
const resolved = useOf("meta", ["meta"]);
|
|
423
466
|
const data = emberData;
|
|
424
467
|
const storyFile = resolved.preparedMeta?.parameters?.fileName;
|
|
425
|
-
const
|
|
468
|
+
const storyEntry = storyFile ? data[storyFile] : void 0;
|
|
469
|
+
const storyComponent = storyEntry && "component" in storyEntry ? storyEntry.component : void 0;
|
|
426
470
|
const compFile = storyComponent?.file;
|
|
427
|
-
const
|
|
471
|
+
const compEntry = compFile ? data[compFile] : void 0;
|
|
472
|
+
const signatureName = storyComponent?.signatureName ?? "";
|
|
473
|
+
const signature = compEntry && "signatures" in compEntry ? compEntry.signatures[signatureName] : void 0;
|
|
428
474
|
const children = [
|
|
429
475
|
createElement(Title),
|
|
430
476
|
createElement(Subtitle),
|
|
431
477
|
createElement(Description),
|
|
432
478
|
createElement(Primary)
|
|
433
479
|
];
|
|
434
|
-
if (signature) children.push(...addSignature(signature,
|
|
480
|
+
if (signature) children.push(...addSignature(signature, data));
|
|
435
481
|
children.push(createElement(Stories));
|
|
436
482
|
return createElement(Fragment, void 0, ...children);
|
|
437
483
|
}
|
|
@@ -539,6 +585,10 @@ function resolveSig(entry) {
|
|
|
539
585
|
if (!compEntry || !("signatures" in compEntry)) return void 0;
|
|
540
586
|
return compEntry.signatures[comp.signatureName];
|
|
541
587
|
}
|
|
588
|
+
/** Last path segment of a CSF title — used to match stories without `fileName`. */
|
|
589
|
+
function titleLeaf(title) {
|
|
590
|
+
return title?.split("/").pop();
|
|
591
|
+
}
|
|
542
592
|
const argTypesEnhancers = [(context) => {
|
|
543
593
|
const filePath = context.parameters.fileName;
|
|
544
594
|
if (filePath && Object.hasOwn(data, filePath)) {
|
|
@@ -549,7 +599,10 @@ const argTypesEnhancers = [(context) => {
|
|
|
549
599
|
};
|
|
550
600
|
return context.argTypes;
|
|
551
601
|
}
|
|
552
|
-
|
|
602
|
+
const leaf = titleLeaf(context.title);
|
|
603
|
+
if (leaf) for (const entry of Object.values(data)) {
|
|
604
|
+
if (!("meta" in entry)) continue;
|
|
605
|
+
if (titleLeaf(entry.meta.title) !== leaf) continue;
|
|
553
606
|
const sig = resolveSig(entry);
|
|
554
607
|
if (sig) return {
|
|
555
608
|
...buildArgTypes(sig),
|