ember-storybook 0.1.3 → 0.1.5
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/client/docs/source-decorator.d.ts.map +1 -1
- package/declarations/client/render-story.d.ts.map +1 -1
- package/declarations/client/render.d.ts.map +1 -1
- package/declarations/client/story-result.d.ts +46 -0
- package/declarations/client/story-result.d.ts.map +1 -0
- package/declarations/client/story-result.test.d.ts +2 -0
- package/declarations/client/story-result.test.d.ts.map +1 -0
- 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/config.mjs +1 -1
- package/dist/client/docs/config.mjs +143 -88
- package/dist/client/docs/config.mjs.map +1 -1
- package/dist/client/index.mjs +2 -2
- package/dist/{client-CjnOdn6v.mjs → client-7-bGnBBX.mjs} +7 -7
- package/dist/{client-CjnOdn6v.mjs.map → client-7-bGnBBX.mjs.map} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/preset.mjs +523 -763
- package/dist/preset.mjs.map +1 -1
- package/dist/render-D_vlc6Py.mjs +125 -0
- package/dist/render-D_vlc6Py.mjs.map +1 -0
- package/dist/story-result-CCx6LMia.mjs +74 -0
- package/dist/story-result-CCx6LMia.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/render-B0rRnyCZ.mjs +0 -125
- package/dist/render-B0rRnyCZ.mjs.map +0 -1
|
@@ -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":"source-decorator.d.ts","sourceRoot":"","sources":["../../../src/client/docs/source-decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"source-decorator.d.ts","sourceRoot":"","sources":["../../../src/client/docs/source-decorator.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAa,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AA0BlF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAsB9F;AAcD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,MAAM,CA8BR;AAoCD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAexE;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAC5B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,GAAG,SAAS,CA4CpB;AAED,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,aAAa,CAqB5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-story.d.ts","sourceRoot":"","sources":["../../src/client/render-story.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render-story.d.ts","sourceRoot":"","sources":["../../src/client/render-story.gts"],"names":[],"mappings":"AAoCA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAQ3C,UAAU,oBAAoB;IAC5B,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,qBAAa,WAAY,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IAC9D,MAAM;;;;;;OAaH;CASJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/client/render.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/client/render.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAgB,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAiB3E,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,aAAa,CAc7C,CAAC;AAsEF,wBAAsB,cAAc,CAClC,EACE,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,YAAY,EACb,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE,EAChE,aAAa,EAAE,aAAa,CAAC,eAAe,CAAC,uBA4F9C"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
type Args = Record<string, unknown>;
|
|
2
|
+
/**
|
|
3
|
+
* Structural shapes of `@ember/application` and `@ember/application/instance`.
|
|
4
|
+
* Used so the resolver can be unit tested without importing Ember at runtime.
|
|
5
|
+
*/
|
|
6
|
+
export interface ApplicationClass {
|
|
7
|
+
prototype: object;
|
|
8
|
+
create(options?: Record<string, unknown>): {
|
|
9
|
+
buildInstance(): object;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export type ApplicationInstanceClass = new (...args: never[]) => object;
|
|
13
|
+
/**
|
|
14
|
+
* The result of the framework's default `render` function.
|
|
15
|
+
*
|
|
16
|
+
* Storybook's decorator pipeline delivers the (possibly decorator-transformed)
|
|
17
|
+
* args to `render` via `originalStoryFn(args, context)` — but nothing else. To
|
|
18
|
+
* make those args reach `renderToCanvas`, `render` reports them back alongside
|
|
19
|
+
* the component instead of returning a bare component.
|
|
20
|
+
*/
|
|
21
|
+
export interface EmberStoryResult {
|
|
22
|
+
component: object;
|
|
23
|
+
args: Args;
|
|
24
|
+
}
|
|
25
|
+
export declare function isEmberStoryResult(value: unknown): value is EmberStoryResult;
|
|
26
|
+
/**
|
|
27
|
+
* Normalizes whatever `storyFn()` returned into `{ component, args }`.
|
|
28
|
+
*
|
|
29
|
+
* - A story rendered through the framework's `render` returns an `EmberStoryResult`
|
|
30
|
+
* whose `args` are the final (decorated) args.
|
|
31
|
+
* - A story with its own `render` (e.g. a template) returns the component/template
|
|
32
|
+
* directly; in that case the args are the raw `fallbackArgs` (the story already
|
|
33
|
+
* captured what it needs).
|
|
34
|
+
*/
|
|
35
|
+
export declare function normalizeStoryResult(result: unknown, fallbackArgs: Args): {
|
|
36
|
+
component: object;
|
|
37
|
+
args: Args;
|
|
38
|
+
};
|
|
39
|
+
export declare function createAppResolver(params: {
|
|
40
|
+
application: ApplicationClass;
|
|
41
|
+
applicationInstance: ApplicationInstanceClass;
|
|
42
|
+
}): (appOption: unknown, opts: {
|
|
43
|
+
rootElement: HTMLElement;
|
|
44
|
+
}) => object;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=story-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story-result.d.ts","sourceRoot":"","sources":["../../src/client/story-result.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QAAE,aAAa,IAAI,MAAM,CAAA;KAAE,CAAC;CACxE;AAED,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,MAAM,CAAC;AAExE;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAS5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,OAAO,EACf,YAAY,EAAE,IAAI,GACjB;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;CACZ,CAMA;AAmBD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,mBAAmB,EAAE,wBAAwB,CAAC;CAC/C,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;IAAE,WAAW,EAAE,WAAW,CAAA;CAAE,KAAK,MAAM,CA2CrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story-result.test.d.ts","sourceRoot":"","sources":["../../src/client/story-result.test.ts"],"names":[],"mappings":""}
|
|
@@ -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,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
-
import { n as renderToCanvas, t as render } from "../render-
|
|
1
|
+
import { n as renderToCanvas, t as render } from "../render-D_vlc6Py.mjs";
|
|
2
2
|
import { enhanceArgTypes } from "storybook/internal/docs-tools";
|
|
3
3
|
//#region src/client/config.ts
|
|
4
4
|
const parameters = {
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
+
import { n as isEmberStoryResult } from "../../story-result-CCx6LMia.mjs";
|
|
1
2
|
import { t as unwrapBlockParams } from "../../block-params-C68OkWMC.mjs";
|
|
2
3
|
import { emitTransformCode, useEffect, useRef } from "storybook/preview-api";
|
|
3
4
|
import { SourceType } from "storybook/internal/docs-tools";
|
|
4
5
|
import emberData from "virtual:ember-storybook";
|
|
5
|
-
import { ArgTypes, Controls, Description, Heading, Primary, Stories, Subheading, Subtitle, Title, useOf } from "@storybook/addon-docs/blocks";
|
|
6
|
-
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";
|
|
7
9
|
import { styled } from "storybook/theming";
|
|
8
10
|
//#region src/client/docs/extractArgTypes.ts
|
|
9
|
-
const data$2 = emberData;
|
|
10
|
-
const byName = /* @__PURE__ */ new Map();
|
|
11
|
-
for (const entry of Object.values(data$2)) {
|
|
12
|
-
const comp = entry.component;
|
|
13
|
-
if (!comp?.signatureName) continue;
|
|
14
|
-
const sig = (comp.file ? data$2[comp.file] : void 0)?.signatures?.[comp.signatureName];
|
|
15
|
-
if (sig) byName.set(comp.signatureName, sig);
|
|
16
|
-
}
|
|
17
11
|
function mapTypeToControl(type) {
|
|
18
12
|
switch (type.category) {
|
|
19
13
|
case "string": return { type: "text" };
|
|
@@ -44,6 +38,65 @@ function buildArgTypes(sig) {
|
|
|
44
38
|
};
|
|
45
39
|
return argTypes;
|
|
46
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
|
+
}
|
|
47
100
|
//#endregion
|
|
48
101
|
//#region src/client/docs/blocks/ui.ts
|
|
49
102
|
function isHtmlElement(name) {
|
|
@@ -163,18 +216,48 @@ const SubcomponentLink = styled.a(({ theme }) => ({
|
|
|
163
216
|
"&:hover": { textDecoration: "underline" }
|
|
164
217
|
}));
|
|
165
218
|
const Indent = styled.span(() => ({ marginInlineStart: "20px" }));
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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);
|
|
174
257
|
return createElement(ParamType, { key: "type" }, param.type);
|
|
175
258
|
}
|
|
176
|
-
function renderParam(param, subcomponentNames) {
|
|
177
|
-
const type = renderType(param, subcomponentNames);
|
|
259
|
+
function renderParam(param, subcomponentNames, data) {
|
|
260
|
+
const type = renderType(param, subcomponentNames, data);
|
|
178
261
|
return [
|
|
179
262
|
createElement(ParamName, { key: "name" }, param.name),
|
|
180
263
|
createElement("span", { key: "colon" }, ": "),
|
|
@@ -184,26 +267,26 @@ function renderParam(param, subcomponentNames) {
|
|
|
184
267
|
function isBlockParam(param) {
|
|
185
268
|
return Object.hasOwn(param, "name") && Object.hasOwn(param, "type");
|
|
186
269
|
}
|
|
187
|
-
function renderParams(params, subcomponentNames) {
|
|
270
|
+
function renderParams(params, subcomponentNames, data) {
|
|
188
271
|
return params.map((param, i) => {
|
|
189
272
|
if (!isBlockParam(param)) {
|
|
190
273
|
const children = [
|
|
191
274
|
createElement("span", { key: "open" }, "- {"),
|
|
192
|
-
createElement("br"),
|
|
193
|
-
...Object.
|
|
194
|
-
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" }),
|
|
195
278
|
createElement("span", { key: "close" }, "}")
|
|
196
279
|
];
|
|
197
280
|
return createElement(Fragment, { key: i }, ...children);
|
|
198
281
|
}
|
|
199
282
|
const isNamed = param.name && !param.name.startsWith("param");
|
|
200
|
-
const displayType = param
|
|
283
|
+
const displayType = displayTypeName(param, data);
|
|
201
284
|
const isSubcomponent = subcomponentNames.has(displayType);
|
|
202
285
|
const children = [];
|
|
203
286
|
const typeChildren = [];
|
|
204
|
-
if (isSubcomponent) typeChildren.push(createElement(
|
|
287
|
+
if (isSubcomponent) typeChildren.push(createElement(SubcomponentAnchor, {
|
|
205
288
|
key: "type",
|
|
206
|
-
|
|
289
|
+
name: displayType
|
|
207
290
|
}, displayType));
|
|
208
291
|
else typeChildren.push(createElement(ParamType, { key: "type" }, displayType));
|
|
209
292
|
if (isNamed) children.push(createElement("span", { key: "sep" }, "- "), createElement(ParamName, { key: "name" }, param.name), createElement("span", { key: "colon" }, ": "), ...typeChildren);
|
|
@@ -213,7 +296,7 @@ function renderParams(params, subcomponentNames) {
|
|
|
213
296
|
return createElement(Fragment, { key: i }, ...rows);
|
|
214
297
|
});
|
|
215
298
|
}
|
|
216
|
-
function BlocksTable({ blocks, subcomponentNames,
|
|
299
|
+
function BlocksTable({ blocks, subcomponentNames, data }) {
|
|
217
300
|
const entries = Object.entries(blocks).toSorted(([nameA, _a], [nameB, _b]) => {
|
|
218
301
|
if (nameA === "default") return -1;
|
|
219
302
|
if (nameB === "default") return -1;
|
|
@@ -222,22 +305,20 @@ function BlocksTable({ blocks, subcomponentNames, defaultName }) {
|
|
|
222
305
|
if (entries.length === 0) return;
|
|
223
306
|
const rows = [];
|
|
224
307
|
for (const [name, block] of entries) {
|
|
225
|
-
const displayName =
|
|
308
|
+
const displayName = `<:${name}>`;
|
|
226
309
|
rows.push(createElement("tr", { key: name }, createElement(BlocksNameCell, void 0, displayName)));
|
|
227
310
|
if (block.params.length > 0) {
|
|
228
|
-
const params = renderParams(block.params, subcomponentNames);
|
|
229
|
-
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)));
|
|
230
313
|
}
|
|
231
314
|
}
|
|
232
315
|
return createElement(TableWrapper, { className: "docblock-argstable sb-unstyled" }, createElement("tbody", { className: "docblock-argstable-body" }, rows));
|
|
233
316
|
}
|
|
234
|
-
function BlocksSection({ blocks, subcomponentNames }) {
|
|
235
|
-
const { preparedMeta } = useOf("meta", ["meta"]);
|
|
236
|
-
const componentName = preparedMeta.title;
|
|
317
|
+
function BlocksSection({ blocks, subcomponentNames, data }) {
|
|
237
318
|
return createElement(BlocksDiv, void 0, createElement(Subheading, void 0, "Blocks"), BlocksTable({
|
|
238
319
|
blocks,
|
|
239
320
|
subcomponentNames,
|
|
240
|
-
|
|
321
|
+
data
|
|
241
322
|
}));
|
|
242
323
|
}
|
|
243
324
|
//#endregion
|
|
@@ -313,7 +394,7 @@ const SectionLabel = styled.div(({ theme }) => ({
|
|
|
313
394
|
fontSize: theme.typography.size.m1 - 2,
|
|
314
395
|
marginBottom: 8
|
|
315
396
|
}));
|
|
316
|
-
function renderSubcomponentSignature(sig, subcomponentNames,
|
|
397
|
+
function renderSubcomponentSignature(sig, subcomponentNames, data) {
|
|
317
398
|
const children = [];
|
|
318
399
|
if (sig.element) children.push(createElement(ElementBlock, { element: sig.element }));
|
|
319
400
|
if (Object.keys(sig.args).length > 0) children.push(createElement(SectionLabel, void 0, "Args"), createElement(ArgTypes, { include: Object.keys(sig.args) }));
|
|
@@ -323,11 +404,11 @@ function renderSubcomponentSignature(sig, subcomponentNames, defaultName) {
|
|
|
323
404
|
}, "Blocks"), createElement(BlocksTable, {
|
|
324
405
|
blocks: sig.blocks,
|
|
325
406
|
subcomponentNames,
|
|
326
|
-
|
|
407
|
+
data
|
|
327
408
|
}));
|
|
328
409
|
return children;
|
|
329
410
|
}
|
|
330
|
-
function SubcomponentsArea({ components }) {
|
|
411
|
+
function SubcomponentsArea({ components, data }) {
|
|
331
412
|
if (components.length === 0) return;
|
|
332
413
|
const subcomponentNames = new Set(components.map((c) => c.name));
|
|
333
414
|
const entries = components.map((comp) => {
|
|
@@ -336,7 +417,7 @@ function SubcomponentsArea({ components }) {
|
|
|
336
417
|
key: "import",
|
|
337
418
|
style: { marginBottom: 12 }
|
|
338
419
|
}, createElement("span", void 0, "from '"), createElement(ParamType, void 0, comp.importPath), createElement("span", void 0, "'")));
|
|
339
|
-
else if (comp.signature) children.push(...renderSubcomponentSignature(comp.signature, subcomponentNames,
|
|
420
|
+
else if (comp.signature) children.push(...renderSubcomponentSignature(comp.signature, subcomponentNames, data));
|
|
340
421
|
return createElement(SubEntry, {
|
|
341
422
|
id: `subcomponent-${comp.name}`,
|
|
342
423
|
key: comp.name
|
|
@@ -345,60 +426,23 @@ function SubcomponentsArea({ components }) {
|
|
|
345
426
|
return createElement(SubcomponentsSection, void 0, createElement(H2, void 0, "Subcomponents"), ...entries);
|
|
346
427
|
}
|
|
347
428
|
//#endregion
|
|
348
|
-
//#region src/client/docs/signature.ts
|
|
349
|
-
function applyModifiers(signature, modifiers) {
|
|
350
|
-
if (!modifiers || modifiers.length === 0) return signature;
|
|
351
|
-
const blockedKeys = /* @__PURE__ */ new Set();
|
|
352
|
-
const pickedKeys = /* @__PURE__ */ new Set();
|
|
353
|
-
for (const mod of modifiers) {
|
|
354
|
-
if (mod.name === "WithBoundArgs" || mod.name === "Omit") for (const key of mod.typeArgs) blockedKeys.add(key);
|
|
355
|
-
if (mod.name === "Pick") for (const key of mod.typeArgs) pickedKeys.add(key);
|
|
356
|
-
}
|
|
357
|
-
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)));
|
|
358
|
-
return {
|
|
359
|
-
...signature,
|
|
360
|
-
args: filtered
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
function collectSubcomponents(blocks, data) {
|
|
364
|
-
const seen = /* @__PURE__ */ new Set();
|
|
365
|
-
const result = [];
|
|
366
|
-
for (const block of Object.values(blocks)) for (const param of unwrapBlockParams(block.params)) {
|
|
367
|
-
if (!param.componentRef) continue;
|
|
368
|
-
const { filePath, exportName, importPath, modifiers } = param.componentRef;
|
|
369
|
-
if (seen.has(param.name)) continue;
|
|
370
|
-
seen.add(param.name);
|
|
371
|
-
if (importPath) result.push({
|
|
372
|
-
name: param.name,
|
|
373
|
-
importPath
|
|
374
|
-
});
|
|
375
|
-
else if (filePath && Object.hasOwn(data, filePath)) {
|
|
376
|
-
const entry = data[filePath];
|
|
377
|
-
if (Object.hasOwn(entry.signatures, exportName)) {
|
|
378
|
-
const sig = entry.signatures[exportName];
|
|
379
|
-
result.push({
|
|
380
|
-
name: param.name,
|
|
381
|
-
signature: applyModifiers(sig, modifiers)
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
return result;
|
|
387
|
-
}
|
|
388
|
-
//#endregion
|
|
389
429
|
//#region src/client/docs/page.ts
|
|
390
430
|
function addSignature(signature, data) {
|
|
391
431
|
const children = [];
|
|
392
432
|
if (signature.element) children.push(createElement(ElementBlock, { element: signature.element }));
|
|
393
|
-
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));
|
|
394
434
|
if (Object.keys(signature.blocks).length > 0) {
|
|
395
435
|
const subcomponents = collectSubcomponents(signature.blocks, data);
|
|
396
436
|
const subcomponentNames = new Set(subcomponents.map((s) => s.name));
|
|
397
437
|
children.push(createElement(BlocksSection, {
|
|
398
438
|
blocks: signature.blocks,
|
|
399
|
-
subcomponentNames
|
|
439
|
+
subcomponentNames,
|
|
440
|
+
data
|
|
441
|
+
}));
|
|
442
|
+
if (subcomponents.length > 0) children.push(createElement(SubcomponentsArea, {
|
|
443
|
+
components: subcomponents,
|
|
444
|
+
data
|
|
400
445
|
}));
|
|
401
|
-
if (subcomponents.length > 0) children.push(createElement(SubcomponentsArea, { components: subcomponents }));
|
|
402
446
|
}
|
|
403
447
|
if (Object.keys(signature.style.customProperties).length > 0) {
|
|
404
448
|
const entries = Object.entries(signature.style.customProperties).map(([name, description]) => ({
|
|
@@ -421,16 +465,19 @@ function Page() {
|
|
|
421
465
|
const resolved = useOf("meta", ["meta"]);
|
|
422
466
|
const data = emberData;
|
|
423
467
|
const storyFile = resolved.preparedMeta?.parameters?.fileName;
|
|
424
|
-
const
|
|
468
|
+
const storyEntry = storyFile ? data[storyFile] : void 0;
|
|
469
|
+
const storyComponent = storyEntry && "component" in storyEntry ? storyEntry.component : void 0;
|
|
425
470
|
const compFile = storyComponent?.file;
|
|
426
|
-
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;
|
|
427
474
|
const children = [
|
|
428
475
|
createElement(Title),
|
|
429
476
|
createElement(Subtitle),
|
|
430
477
|
createElement(Description),
|
|
431
478
|
createElement(Primary)
|
|
432
479
|
];
|
|
433
|
-
if (signature) children.push(...addSignature(signature,
|
|
480
|
+
if (signature) children.push(...addSignature(signature, data));
|
|
434
481
|
children.push(createElement(Stories));
|
|
435
482
|
return createElement(Fragment, void 0, ...children);
|
|
436
483
|
}
|
|
@@ -517,7 +564,8 @@ const sourceDecorator = (storyFn, context) => {
|
|
|
517
564
|
const source = useRef(void 0);
|
|
518
565
|
const story = storyFn();
|
|
519
566
|
useEffect(() => {
|
|
520
|
-
const
|
|
567
|
+
const rendered = context.originalStoryFn(context.args, context);
|
|
568
|
+
const renderedForSource = isEmberStoryResult(rendered) ? rendered.component : rendered;
|
|
521
569
|
if (!skipSourceRender(context)) {
|
|
522
570
|
const code = generateSource(renderedForSource, context.args, context.argTypes, context.id) ?? void 0;
|
|
523
571
|
emitTransformCode(code, context);
|
|
@@ -537,6 +585,10 @@ function resolveSig(entry) {
|
|
|
537
585
|
if (!compEntry || !("signatures" in compEntry)) return void 0;
|
|
538
586
|
return compEntry.signatures[comp.signatureName];
|
|
539
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
|
+
}
|
|
540
592
|
const argTypesEnhancers = [(context) => {
|
|
541
593
|
const filePath = context.parameters.fileName;
|
|
542
594
|
if (filePath && Object.hasOwn(data, filePath)) {
|
|
@@ -547,7 +599,10 @@ const argTypesEnhancers = [(context) => {
|
|
|
547
599
|
};
|
|
548
600
|
return context.argTypes;
|
|
549
601
|
}
|
|
550
|
-
|
|
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;
|
|
551
606
|
const sig = resolveSig(entry);
|
|
552
607
|
if (sig) return {
|
|
553
608
|
...buildArgTypes(sig),
|