ember-storybook 0.1.2 → 0.1.4

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.
Files changed (36) hide show
  1. package/declarations/client/docs/preview-patch.d.ts +7 -0
  2. package/declarations/client/docs/preview-patch.d.ts.map +1 -0
  3. package/declarations/client/docs/renderer.d.ts +8 -0
  4. package/declarations/client/docs/renderer.d.ts.map +1 -0
  5. package/declarations/client/docs/source-decorator.d.ts.map +1 -1
  6. package/declarations/client/render-story.d.ts.map +1 -1
  7. package/declarations/client/render.d.ts.map +1 -1
  8. package/declarations/client/story-result.d.ts +46 -0
  9. package/declarations/client/story-result.d.ts.map +1 -0
  10. package/declarations/client/story-result.test.d.ts +2 -0
  11. package/declarations/client/story-result.test.d.ts.map +1 -0
  12. package/declarations/client/types.d.ts +3 -0
  13. package/declarations/client/types.d.ts.map +1 -1
  14. package/declarations/preset.d.ts.map +1 -1
  15. package/dist/client/config.mjs +1 -1
  16. package/dist/client/docs/config.mjs +3 -1
  17. package/dist/client/docs/config.mjs.map +1 -1
  18. package/dist/client/docs/preview-patch.mjs +15 -0
  19. package/dist/client/docs/preview-patch.mjs.map +1 -0
  20. package/dist/client/docs/renderer.mjs +48 -0
  21. package/dist/client/docs/renderer.mjs.map +1 -0
  22. package/dist/client/index.mjs +2 -2
  23. package/dist/{client-Cn86nY-K.mjs → client-7-bGnBBX.mjs} +7 -7
  24. package/dist/{client-Cn86nY-K.mjs.map → client-7-bGnBBX.mjs.map} +1 -1
  25. package/dist/index.mjs +2 -2
  26. package/dist/preset.mjs +11 -1
  27. package/dist/preset.mjs.map +1 -1
  28. package/dist/react-BcVz11Jd.mjs +64 -0
  29. package/dist/react-BcVz11Jd.mjs.map +1 -0
  30. package/dist/render-D_vlc6Py.mjs +125 -0
  31. package/dist/render-D_vlc6Py.mjs.map +1 -0
  32. package/dist/story-result-CCx6LMia.mjs +74 -0
  33. package/dist/story-result-CCx6LMia.mjs.map +1 -0
  34. package/package.json +7 -1
  35. package/dist/render-UnP87BCQ.mjs +0 -87
  36. package/dist/render-UnP87BCQ.mjs.map +0 -1
@@ -0,0 +1,7 @@
1
+ import { DocsRenderer } from './renderer';
2
+ export declare const parameters: {
3
+ docs: {
4
+ renderer: () => Promise<DocsRenderer>;
5
+ };
6
+ };
7
+ //# sourceMappingURL=preview-patch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-patch.d.ts","sourceRoot":"","sources":["../../../src/client/docs/preview-patch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAY1C,eAAO,MAAM,UAAU;;;;CAMtB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { DocsContextProps } from 'storybook/internal/types';
2
+ export declare class DocsRenderer {
3
+ render: (context: DocsContextProps, docsParameter: {
4
+ components?: Record<string, unknown>;
5
+ }, element: HTMLElement) => Promise<void>;
6
+ unmount: (element: HTMLElement) => void;
7
+ }
8
+ //# sourceMappingURL=renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/client/docs/renderer.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAqCjE,qBAAa,YAAY;IACvB,MAAM,GACJ,SAAS,gBAAgB,EACzB,eAAe;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EACvD,SAAS,WAAW,mBAqBpB;IAEF,OAAO,GAAI,SAAS,WAAW,UAE7B;CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"source-decorator.d.ts","sourceRoot":"","sources":["../../../src/client/docs/source-decorator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAa,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK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,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":"AAiCA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAM3C,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;;;;;;OAYH;CASJ"}
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":"AAGA,OAAO,KAAK,EAAgB,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI3E,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,aAAa,CAc7C,CAAC;AAiDF,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,uBAiF9C"}
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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=story-result.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"story-result.test.d.ts","sourceRoot":"","sources":["../../src/client/story-result.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,6 @@
1
1
  import type Application from '@ember/application';
2
2
  import type ApplicationInstance from '@ember/application/instance';
3
+ import type Owner from '@ember/owner';
3
4
  import type { StoryContext as DefaultStoryContext, WebRenderer } from 'storybook/internal/types';
4
5
  export type { RenderContext } from 'storybook/internal/types';
5
6
  export interface ShowErrorArgs {
@@ -10,7 +11,9 @@ export type AppParamater = typeof Application | ApplicationInstance | ((options?
10
11
  export interface EmberParameters {
11
12
  ember?: {
12
13
  app?: AppParamater;
14
+ configure?: (app: ApplicationInstance) => void;
13
15
  owner?: Record<`${string}:${string}`, object>;
16
+ updateGlobals?: (globals: Record<string, unknown>, owner: Owner) => void;
14
17
  };
15
18
  }
16
19
  export interface EmberRenderer extends WebRenderer {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,WAAW,EAAE,MAAM,0BAA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AAC;AAEF,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,WAAW,CActD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,eAAe,CAAC,uBAAuB,CAE1E,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,cAAc,CAAC,MAAM,CAcvC,CAAC"}
1
+ {"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../src/preset.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,mBAAmB,EAAsB,MAAM,yBAAyB,CAAC;AAKvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAoB/D,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,oBAAoB,CAkBnE,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAkBtD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,eAAe,CAAC,uBAAuB,CAE1E,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,cAAc,CAAC,MAAM,CAcvC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as renderToCanvas, t as render } from "../render-UnP87BCQ.mjs";
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,3 +1,4 @@
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";
@@ -517,7 +518,8 @@ const sourceDecorator = (storyFn, context) => {
517
518
  const source = useRef(void 0);
518
519
  const story = storyFn();
519
520
  useEffect(() => {
520
- const renderedForSource = context.originalStoryFn(context.args, context);
521
+ const rendered = context.originalStoryFn(context.args, context);
522
+ const renderedForSource = isEmberStoryResult(rendered) ? rendered.component : rendered;
521
523
  if (!skipSourceRender(context)) {
522
524
  const code = generateSource(renderedForSource, context.args, context.argTypes, context.id) ?? void 0;
523
525
  emitTransformCode(code, context);
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":["emberData","data","byName","Map","entry","Object","values","comp","component","signatureName","compEntry","file","undefined","sig","signatures","set","mapTypeToControl","type","category","options","buildArgTypes","argTypes","name","arg","entries","args","description","raw","required","control","table","summary","defaultValue","extractArgTypes","displayName","get","Heading","createElement","styled","isHtmlElement","name","test","TableWrapper","table","theme","fontFamily","typography","fonts","base","borderSpacing","color","defaultText","fontSize","size","s2","lineHeight","textAlign","width","marginTop","marginBottom","marginInline","padding","border","verticalAlign","textOverflow","paddingLeft","paddingRight","th","textMutedColor","paddingTop","paddingBottom","td","tbody","filter","background","content","borderTop","appBorderColor","borderBlockStart","borderBlockEnd","borderInlineStart","borderInlineEnd","borderTopLeftRadius","appBorderRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","borderColor","renderHead","columns","className","map","col","renderBody","entries","entry","key","style","fontWeight","description","H2","weight","bold","letterSpacing","textTransform","Subheading","useOf","createElement","Fragment","styled","TableWrapper","ParamType","code","theme","color","secondary","fontSize","fontWeight","ParamName","span","defaultText","ParamRow","div","typography","size","s2","lineHeight","marginBottom","ParamDesc","textMutedColor","s1","marginLeft","BlocksDiv","marginTop","BlocksNameCell","td","position","weight","bold","background","app","SubcomponentLink","a","primary","cursor","textDecoration","Indent","marginInlineStart","renderType","param","subcomponentNames","type","displayType","componentRef","exportName","typeIsSubcomponent","has","key","href","renderParam","name","isBlockParam","Object","hasOwn","renderParams","params","map","i","children","values","p","isNamed","startsWith","isSubcomponent","typeChildren","push","rows","description","BlocksTable","blocks","defaultName","entries","toSorted","nameA","_a","nameB","_b","length","block","displayName","undefined","className","BlocksSection","preparedMeta","componentName","title","createElement","styled","isHtmlElement","ElementWrapper","div","theme","fontFamily","typography","fonts","base","color","defaultText","fontSize","size","s2","lineHeight","marginTop","marginBottom","span","fontWeight","marginRight","code","secondary","textDecoration","a","ElementBlock","element","elements","split","map","s","trim","filter","Boolean","length","children","key","i","name","entries","push","inner","href","target","rel","undefined","createElement","renderBody","renderHead","TableWrapper","renderPartsBody","entries","className","map","entry","key","name","style","fontSize","fontWeight","description","PartsTable","CssPropertiesTable","ArgTypes","Subheading","createElement","styled","BlocksTable","ParamRow","ParamType","ElementBlock","H2","SubcomponentsSection","div","marginTop","marginBottom","SubEntry","SectionLabel","theme","fontWeight","color","defaultText","fontSize","typography","size","m1","renderSubcomponentSignature","sig","subcomponentNames","defaultName","children","element","push","Object","keys","args","length","undefined","include","blocks","key","style","SubcomponentsArea","components","Set","map","c","name","entries","comp","importPath","signature","id","unwrapBlockParams","applyModifiers","signature","modifiers","length","blockedKeys","Set","pickedKeys","mod","name","key","typeArgs","add","filtered","size","Object","fromEntries","entries","args","filter","k","has","collectSubcomponents","blocks","data","seen","result","block","values","param","params","componentRef","filePath","exportName","importPath","push","hasOwn","entry","signatures","sig","Controls","Description","Primary","Stories","Subheading","Subtitle","Title","useOf","createElement","Fragment","emberData","BlocksSection","ElementBlock","CssPropertiesTable","PartsTable","SubcomponentsArea","H2","collectSubcomponents","addSignature","signature","data","children","element","push","Object","keys","args","length","undefined","include","blocks","subcomponents","subcomponentNames","Set","map","s","name","components","style","customProperties","entries","description","parts","unshift","Page","resolved","storyFile","preparedMeta","parameters","fileName","storyEntry","storyComponent","component","compFile","file","compEntry","signatures","signatureName","SourceType","emitTransformCode","useEffect","useRef","emberData","unwrapBlockParams","data","skipSourceRender","context","sourceParams","parameters","docs","source","type","DYNAMIC","isArgsStory","__isArgsStory","code","CODE","toArgument","key","value","argTypes","undefined","JSON","stringify","String","Object","hasOwn","generateBlockContent","blockInfo","params","length","paramNames","map","p","name","join","generateBlockSourceCode","sig","args","indent","blockNames","keys","blocks","blockName","arg","slotBindings","content","push","byStoryId","getByStoryId","entry","values","storyId","entries","componentName","signatureName","inlineTemplate","signatureForComponent","comp","component","compEntry","file","signatures","resolveTemplateArgs","template","replaceAll","_match","generateSource","meta","propsArray","filter","k","v","Boolean","blockCode","propsStr","sourceDecorator","storyFn","story","renderedForSource","originalStoryFn","id","current","SourceType","emberData","buildArgTypes","Page","sourceDecorator","data","resolveSig","entry","undefined","comp","component","signatureName","compEntry","file","signatures","argTypesEnhancers","context","filePath","parameters","fileName","Object","hasOwn","sig","argTypes","titleName","title","split","pop","values","docs","source","type","DYNAMIC","language","page","decorators"],"sources":["../../../src/client/docs/extractArgTypes.ts","../../../src/client/docs/blocks/ui.ts","../../../src/client/docs/blocks/blocks.ts","../../../src/client/docs/blocks/element.ts","../../../src/client/docs/blocks/style.ts","../../../src/client/docs/blocks/subcomponents.ts","../../../src/client/docs/signature.ts","../../../src/client/docs/page.ts","../../../src/client/docs/source-decorator.ts","../../../src/client/docs/config.ts"],"sourcesContent":["import emberData from 'virtual:ember-storybook';\n\nimport type { StorySource } from '../../node/types';\nimport type { ArgTypeInfo, ComponentSignature } from 'ember-docgen';\n\nconst data = emberData as Record<\n string,\n {\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n>;\n\nconst byName = new Map<string, ComponentSignature>();\n\nfor (const entry of Object.values(data)) {\n const comp = entry.component;\n\n if (!comp?.signatureName) continue;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n const sig = compEntry?.signatures?.[comp.signatureName];\n\n if (sig) {\n byName.set(comp.signatureName, sig);\n }\n}\n\nfunction mapTypeToControl(\n type: ArgTypeInfo\n):\n | false\n | { type: 'text' }\n | { type: 'number' }\n | { type: 'boolean' }\n | { type: 'select'; options: string[] }\n | { type: 'object' }\n | { type: 'function' }\n | { type: 'date' } {\n switch (type.category) {\n case 'string': {\n return { type: 'text' };\n }\n case 'number': {\n return { type: 'number' };\n }\n case 'boolean': {\n return { type: 'boolean' };\n }\n case 'function': {\n return { type: 'function' };\n }\n case 'enum': {\n return { type: 'select', options: type.options ?? [] };\n }\n\n default: {\n return { type: 'object' };\n }\n }\n}\n\nexport function buildArgTypes(sig: ComponentSignature): Record<string, unknown> {\n const argTypes: Record<string, unknown> = {};\n\n for (const [name, arg] of Object.entries(sig.args)) {\n argTypes[name] = {\n name,\n description: arg.description || undefined,\n type: {\n name: arg.type.raw,\n required: arg.required\n },\n control: mapTypeToControl(arg.type),\n table: {\n type: { summary: arg.type.raw },\n defaultValue: arg.defaultValue ? { summary: arg.defaultValue } : undefined\n }\n };\n }\n\n return argTypes;\n}\n\nexport function extractArgTypes(\n component: Record<string, unknown>\n): Record<string, unknown> | null {\n const name =\n (component.name as string | undefined) ?? (component.displayName as string | undefined);\n\n // eslint-disable-next-line unicorn/no-null\n if (!name) return null;\n\n const sig = byName.get(name);\n\n // eslint-disable-next-line unicorn/no-null\n if (!sig) return null;\n\n return buildArgTypes(sig);\n}\n","/* eslint-disable unicorn/no-null */\nimport { Heading } from '@storybook/addon-docs/blocks';\nimport { createElement } from 'react';\nimport { styled, type Theme } from 'storybook/theming';\n\nexport interface Entry {\n name: string;\n description?: string;\n}\n\ntype StyleProps = { theme: Theme };\n\nexport function isHtmlElement(name: string): boolean {\n return /^HTML[A-Z]\\w*Element$/.test(name);\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nexport const TableWrapper = styled.table(({ theme }: StyleProps) => ({\n fontFamily: theme.typography.fonts.base,\n borderSpacing: 0,\n color: theme.color.defaultText,\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n textAlign: 'left',\n width: '100%',\n marginTop: 25,\n marginBottom: 40,\n marginInline: 1,\n 'td, th': {\n padding: 0,\n border: 'none',\n verticalAlign: 'top',\n textOverflow: 'ellipsis'\n },\n 'th:first-of-type, td:first-of-type': {\n paddingLeft: 20\n },\n 'th:last-of-type, td:last-of-type': {\n paddingRight: 20\n },\n th: {\n color: theme.textMutedColor as string,\n paddingTop: 10,\n paddingBottom: 10,\n paddingLeft: 15,\n paddingRight: 15\n },\n td: {\n paddingTop: '10px',\n paddingBottom: '10px',\n '&:not(:first-of-type)': {\n paddingLeft: 15,\n paddingRight: 15\n },\n '&:last-of-type': {\n paddingRight: 20\n }\n },\n tbody: {\n filter:\n theme.base === 'light'\n ? 'drop-shadow(0px 1px 3px rgba(0, 0, 0, 0.10))'\n : 'drop-shadow(0px 1px 3px rgba(0, 0, 0, 0.20))',\n '> tr > *': {\n background: theme.background.content,\n borderTop: `1px solid ${theme.appBorderColor}`\n },\n '> tr:first-of-type > *': {\n borderBlockStart: `1px solid ${theme.appBorderColor}`\n },\n '> tr:last-of-type > *': {\n borderBlockEnd: `1px solid ${theme.appBorderColor}`\n },\n '> tr > *:first-of-type': {\n borderInlineStart: `1px solid ${theme.appBorderColor}`\n },\n '> tr > *:last-of-type': {\n borderInlineEnd: `1px solid ${theme.appBorderColor}`\n },\n '> tr:first-of-type > td:first-of-type': {\n borderTopLeftRadius: theme.appBorderRadius\n },\n '> tr:first-of-type > td:last-of-type': {\n borderTopRightRadius: theme.appBorderRadius\n },\n '> tr:last-of-type > td:first-of-type': {\n borderBottomLeftRadius: theme.appBorderRadius\n },\n '> tr:last-of-type > td:last-of-type': {\n borderBottomRightRadius: theme.appBorderRadius\n }\n },\n '@media (forced-colors: active)': {\n tbody: {\n filter: 'none',\n '> tr > *': {\n borderColor: 'CanvasText'\n }\n }\n }\n}));\n\nexport function renderHead(columns: string[]) {\n return createElement(\n 'thead',\n { className: 'docblock-argstable-head' },\n createElement(\n 'tr',\n null,\n ...columns.map((col) => createElement('th', null, createElement('span', null, col)))\n )\n );\n}\n\nexport function renderBody(entries: Entry[]) {\n return createElement(\n 'tbody',\n { className: 'docblock-argstable-body' },\n ...entries.map((entry) =>\n createElement(\n 'tr',\n { key: entry.name },\n createElement(\n 'td',\n null,\n createElement('span', { style: { fontWeight: 'bold' } }, entry.name)\n ),\n createElement('td', null, entry.description ?? '')\n )\n )\n );\n}\n\nexport const H2 = styled(Heading)(({ theme }) => ({\n fontSize: `${theme.typography.size.s2 - 1}px`,\n fontWeight: theme.typography.weight.bold,\n lineHeight: '16px',\n letterSpacing: '0.35em',\n textTransform: 'uppercase',\n color: theme.textMutedColor as string,\n border: 0,\n marginBottom: '12px',\n '&:first-of-type': { marginTop: '56px' }\n}));\n","import { Subheading, useOf } from '@storybook/addon-docs/blocks';\nimport { createElement, Fragment, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { TableWrapper } from './ui';\n\nimport type { BlockInfo, BlockParam, HashBlockParam } from 'ember-docgen';\n\nexport const ParamType = styled.code(({ theme }) => ({\n color: theme.color.secondary,\n fontSize: 12,\n fontWeight: 'bold'\n}));\n\nconst ParamName = styled.span(({ theme }) => ({\n fontWeight: 'bold',\n color: theme.color.defaultText\n}));\n\nexport const ParamRow = styled.div(({ theme }) => ({\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n marginBottom: 2\n}));\n\nconst ParamDesc = styled.div(({ theme }) => ({\n color: theme.textMutedColor as string,\n fontSize: theme.typography.size.s1,\n lineHeight: '17px',\n marginBottom: 8,\n marginLeft: 20\n}));\n\nconst BlocksDiv = styled.div(() => ({\n marginTop: 25,\n marginBottom: 40\n}));\n\nconst BlocksNameCell = styled.td(({ theme }) => ({\n position: 'relative',\n fontWeight: theme.typography.weight.bold,\n fontSize: theme.typography.size.s1,\n background: `${theme.background.app} !important`,\n '& ~ td': {\n background: `${theme.background.app} !important`\n }\n}));\n\nconst SubcomponentLink = styled.a(({ theme }) => ({\n color: theme.color.primary,\n fontWeight: 'bold',\n cursor: 'pointer',\n textDecoration: 'none',\n '&:hover': { textDecoration: 'underline' }\n}));\n\nconst Indent = styled.span(() => ({\n marginInlineStart: '20px'\n}));\n\nfunction renderType(param: BlockParam, subcomponentNames: Set<string>): ReactNode {\n if (param.type === 'Invokable') {\n const displayType = param.componentRef?.exportName ?? param.type;\n const typeIsSubcomponent = subcomponentNames.has(displayType);\n\n return typeIsSubcomponent\n ? createElement(\n SubcomponentLink,\n { key: 'type', href: `#subcomponent-${displayType}` },\n displayType\n )\n : createElement(ParamType, { key: 'type' }, displayType);\n }\n\n return createElement(ParamType, { key: 'type' }, param.type);\n}\n\nfunction renderParam(param: BlockParam, subcomponentNames: Set<string>): ReactNode[] {\n const type = renderType(param, subcomponentNames);\n const name = createElement(ParamName, { key: 'name' }, param.name);\n\n return [name, createElement('span', { key: 'colon' }, ': '), type];\n}\n\nfunction isBlockParam(param: BlockParam | HashBlockParam): param is BlockParam {\n return Object.hasOwn(param, 'name') && Object.hasOwn(param, 'type');\n}\n\nfunction renderParams(params: BlockInfo['params'], subcomponentNames: Set<string>): ReactNode[] {\n return params.map((param, i) => {\n if (!isBlockParam(param)) {\n const children: ReactNode[] = [\n createElement('span', { key: 'open' }, '- {'),\n createElement('br'),\n ...Object.values(param).map((p) => [\n createElement(Indent),\n renderParam(p, subcomponentNames)\n ]),\n createElement('br'),\n createElement('span', { key: 'close' }, '}')\n ];\n\n return createElement(Fragment, { key: i }, ...children);\n }\n\n const isNamed = param.name && !param.name.startsWith('param');\n const displayType = param.componentRef?.exportName ?? param.type;\n\n const isSubcomponent = subcomponentNames.has(displayType);\n\n const children: ReactNode[] = [];\n const typeChildren: ReactNode[] = [];\n\n if (isSubcomponent) {\n typeChildren.push(\n createElement(\n SubcomponentLink,\n { key: 'type', href: `#subcomponent-${displayType}` },\n displayType\n )\n );\n } else {\n typeChildren.push(createElement(ParamType, { key: 'type' }, displayType));\n }\n\n if (isNamed) {\n children.push(\n createElement('span', { key: 'sep' }, '- '),\n createElement(ParamName, { key: 'name' }, param.name),\n createElement('span', { key: 'colon' }, ': '),\n ...typeChildren\n );\n } else {\n children.push(createElement('span', { key: 'sep' }, '- '), ...typeChildren);\n }\n\n const rows: ReactNode[] = [createElement(ParamRow, { key: 'row' }, ...children)];\n\n if (param.description) {\n rows.push(createElement(ParamDesc, { key: 'desc' }, param.description));\n }\n\n return createElement(Fragment, { key: i }, ...rows);\n });\n}\n\nexport function BlocksTable({\n blocks,\n subcomponentNames,\n defaultName\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n defaultName: string;\n}) {\n const entries = Object.entries(blocks).toSorted(([nameA, _a], [nameB, _b]) => {\n if (nameA === 'default') return -1;\n if (nameB === 'default') return -1;\n\n return 0;\n });\n\n if (entries.length === 0) return;\n\n const rows = [];\n\n for (const [name, block] of entries) {\n const displayName = name === 'default' ? `<${defaultName}>` : `<:${name}>`;\n\n rows.push(\n createElement('tr', { key: name }, createElement(BlocksNameCell, undefined, displayName))\n );\n\n if (block.params.length > 0) {\n const params = renderParams(block.params, subcomponentNames);\n\n rows.push(createElement('tr', undefined, createElement('td', undefined, ...params)));\n }\n }\n\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n createElement('tbody', { className: 'docblock-argstable-body' }, rows)\n );\n}\n\nexport function BlocksSection({\n blocks,\n subcomponentNames\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n}) {\n const { preparedMeta } = useOf('meta', ['meta']);\n const componentName = preparedMeta.title;\n\n return createElement(\n BlocksDiv,\n undefined,\n createElement(Subheading, undefined, 'Blocks'),\n BlocksTable({ blocks, subcomponentNames, defaultName: componentName })\n );\n}\n","import { createElement, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { isHtmlElement } from './ui';\n\nconst ElementWrapper = styled.div(({ theme }) => ({\n fontFamily: theme.typography.fonts.base,\n color: theme.color.defaultText,\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n marginTop: 25,\n marginBottom: 40,\n span: {\n '&:first-of-type': {\n fontWeight: 'bold',\n marginRight: 8\n }\n },\n code: {\n fontSize: 12,\n fontWeight: 'bold'\n },\n 'a code': {\n color: theme.color.secondary,\n textDecoration: 'none'\n },\n a: {\n color: theme.color.secondary,\n textDecoration: 'none',\n '&:hover': {\n textDecoration: 'underline'\n }\n }\n}));\n\nexport function ElementBlock({ element }: { element: string }) {\n const elements = element\n .split(' | ')\n .map((s) => s.trim())\n .filter(Boolean);\n\n if (elements.length === 0) return;\n\n const children: ReactNode[] = [createElement('span', { key: 'label' }, 'Element:')];\n\n for (const [i, name] of elements.entries()) {\n if (i > 0) {\n children.push(createElement('span', { key: `sep-${i}` }, ' | '));\n }\n\n const inner = isHtmlElement(name)\n ? createElement(\n 'a',\n {\n key: `link-${name}`,\n href: `https://developer.mozilla.org/en-US/docs/Web/API/${name}`,\n target: '_blank',\n rel: 'noopener noreferrer'\n },\n name\n )\n : name;\n\n children.push(createElement('code', { key: name }, inner));\n }\n\n return createElement(ElementWrapper, undefined, ...children);\n}\n","/* eslint-disable unicorn/no-null */\nimport { createElement } from 'react';\n\nimport { type Entry, renderBody, renderHead, TableWrapper } from './ui';\n\nfunction renderPartsBody(entries: Entry[]) {\n return createElement(\n 'tbody',\n { className: 'docblock-argstable-body' },\n ...entries.map((entry) =>\n createElement(\n 'tr',\n { key: entry.name },\n createElement(\n 'td',\n null,\n createElement(\n 'code',\n { style: { fontSize: 12, fontWeight: 'bold' } },\n `[part=\"${entry.name}\"]`\n )\n ),\n createElement('td', null, entry.description ?? '')\n )\n )\n );\n}\n\nexport function PartsTable({ entries }: { entries: Entry[] }) {\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n renderHead(['Part', 'Description']),\n renderPartsBody(entries)\n );\n}\n\nexport function CssPropertiesTable({ entries }: { entries: Entry[] }) {\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n renderHead(['Property', 'Value']),\n renderBody(entries)\n );\n}\n","import { ArgTypes, Subheading } from '@storybook/addon-docs/blocks';\nimport { createElement, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { BlocksTable, ParamRow, ParamType } from './blocks';\nimport { ElementBlock } from './element';\nimport { H2 } from './ui';\n\nimport type { SubcomponentRef } from '../signature';\nimport type { ComponentSignature } from 'ember-docgen';\n\nconst SubcomponentsSection = styled.div(() => ({\n marginTop: 25,\n marginBottom: 40\n}));\n\nconst SubEntry = styled.div(() => ({\n marginBottom: 24,\n '&:last-child': { marginBottom: 0 }\n}));\n\nconst SectionLabel = styled.div(({ theme }) => ({\n fontWeight: 'bold',\n color: theme.color.defaultText,\n fontSize: theme.typography.size.m1 - 2,\n marginBottom: 8\n}));\n\nfunction renderSubcomponentSignature(\n sig: ComponentSignature,\n subcomponentNames: Set<string>,\n defaultName: string\n): ReactNode[] {\n const children: ReactNode[] = [];\n\n if (sig.element) {\n children.push(createElement(ElementBlock, { element: sig.element }));\n }\n\n if (Object.keys(sig.args).length > 0) {\n children.push(\n createElement(SectionLabel, undefined, 'Args'),\n createElement(ArgTypes, { include: Object.keys(sig.args) })\n );\n }\n\n if (Object.keys(sig.blocks).length > 0) {\n children.push(\n createElement(SectionLabel, { key: 'blocks-label', style: { marginTop: 12 } }, 'Blocks'),\n createElement(BlocksTable, { blocks: sig.blocks, subcomponentNames, defaultName })\n );\n }\n\n return children;\n}\n\nexport function SubcomponentsArea({ components }: { components: SubcomponentRef[] }) {\n if (components.length === 0) return;\n\n const subcomponentNames = new Set(components.map((c) => c.name));\n\n const entries = components.map((comp) => {\n const children: ReactNode[] = [createElement(Subheading, undefined, comp.name)];\n\n if (comp.importPath) {\n children.push(\n createElement(\n ParamRow,\n { key: 'import', style: { marginBottom: 12 } },\n createElement('span', undefined, \"from '\"),\n createElement(ParamType, undefined, comp.importPath),\n createElement('span', undefined, \"'\")\n )\n );\n } else if (comp.signature) {\n children.push(...renderSubcomponentSignature(comp.signature, subcomponentNames, comp.name));\n }\n\n return createElement(\n SubEntry,\n { id: `subcomponent-${comp.name}`, key: comp.name },\n ...children\n );\n });\n\n return createElement(\n SubcomponentsSection,\n undefined,\n createElement(H2, undefined, 'Subcomponents'),\n ...entries\n );\n}\n","import { unwrapBlockParams } from './block-params';\n\nimport type { ComponentFile, EmberMeta } from '../../node/types';\nimport type { BlockInfo, ComponentSignature } from 'ember-docgen';\n\nexport interface SubcomponentRef {\n name: string;\n signature?: ComponentSignature;\n importPath?: string;\n}\n\nexport function applyModifiers(\n signature: ComponentSignature,\n modifiers?: { name: string; typeArgs: string[] }[]\n): ComponentSignature {\n if (!modifiers || modifiers.length === 0) return signature;\n\n const blockedKeys = new Set<string>();\n const pickedKeys = new Set<string>();\n\n for (const mod of modifiers) {\n if (mod.name === 'WithBoundArgs' || mod.name === 'Omit') {\n for (const key of mod.typeArgs) blockedKeys.add(key);\n }\n\n if (mod.name === 'Pick') {\n for (const key of mod.typeArgs) pickedKeys.add(key);\n }\n }\n\n const filtered =\n pickedKeys.size > 0\n ? Object.fromEntries(Object.entries(signature.args).filter(([k]) => pickedKeys.has(k)))\n : Object.fromEntries(Object.entries(signature.args).filter(([k]) => !blockedKeys.has(k)));\n\n return { ...signature, args: filtered };\n}\n\nexport function collectSubcomponents(\n blocks: Record<string, BlockInfo>,\n data: EmberMeta\n): SubcomponentRef[] {\n const seen = new Set<string>();\n\n const result: SubcomponentRef[] = [];\n\n for (const block of Object.values(blocks)) {\n for (const param of unwrapBlockParams(block.params)) {\n if (!param.componentRef) {\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n continue;\n }\n\n const { filePath, exportName, importPath, modifiers } = param.componentRef;\n\n if (seen.has(param.name)) {\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n continue;\n }\n\n seen.add(param.name);\n\n if (importPath) {\n result.push({ name: param.name, importPath });\n } else if (filePath && Object.hasOwn(data, filePath)) {\n const entry = data[filePath] as ComponentFile;\n\n if (Object.hasOwn(entry.signatures, exportName)) {\n const sig = entry.signatures[exportName];\n\n result.push({\n name: param.name,\n signature: applyModifiers(sig, modifiers)\n });\n }\n }\n }\n }\n\n return result;\n}\n","import {\n Controls,\n Description,\n Primary,\n Stories,\n Subheading,\n Subtitle,\n Title,\n useOf\n} from '@storybook/addon-docs/blocks';\nimport { createElement, Fragment, type ReactNode } from 'react';\nimport emberData from 'virtual:ember-storybook';\n\nimport { BlocksSection } from './blocks/blocks';\nimport { ElementBlock } from './blocks/element';\nimport { CssPropertiesTable, PartsTable } from './blocks/style';\nimport { SubcomponentsArea } from './blocks/subcomponents';\nimport { H2 } from './blocks/ui';\nimport { collectSubcomponents } from './signature';\n\nimport type { EmberMeta, StorySource } from '../../node/types';\nimport type { ComponentSignature } from 'ember-docgen';\n\nfunction addSignature(signature: ComponentSignature, data: EmberMeta) {\n const children: ReactNode[] = [];\n\n if (signature.element) {\n children.push(createElement(ElementBlock, { element: signature.element }));\n }\n\n if (Object.keys(signature.args).length > 0) {\n children.push(\n createElement(Subheading, undefined, 'Args'),\n // createElement(ArgTypes, { include: Object.keys(signature.args) }),\n createElement(Controls, { include: Object.keys(signature.args) })\n );\n }\n\n if (Object.keys(signature.blocks).length > 0) {\n const subcomponents = collectSubcomponents(signature.blocks, data);\n const subcomponentNames = new Set(subcomponents.map((s) => s.name));\n\n children.push(createElement(BlocksSection, { blocks: signature.blocks, subcomponentNames }));\n\n if (subcomponents.length > 0) {\n children.push(createElement(SubcomponentsArea, { components: subcomponents }));\n }\n }\n\n if (Object.keys(signature.style.customProperties).length > 0) {\n const entries = Object.entries(signature.style.customProperties).map(([name, description]) => ({\n name,\n description\n }));\n\n children.push(\n createElement(Subheading, undefined, 'CSS Custom Properties'),\n createElement(CssPropertiesTable, { entries })\n );\n }\n\n if (Object.keys(signature.style.parts).length > 0) {\n const entries = Object.entries(signature.style.parts).map(([name, description]) => ({\n name,\n description\n }));\n\n children.push(\n createElement(Subheading, undefined, 'Parts'),\n createElement(PartsTable, { entries })\n );\n }\n\n if (children.length > 0) {\n children.unshift(createElement(H2, undefined, 'Signature'));\n }\n\n return children;\n}\n\nexport default function Page() {\n const resolved: {\n preparedMeta?: {\n argTypes?: Record<string, unknown>;\n title?: string;\n parameters?: Record<string, unknown>;\n };\n } = useOf('meta', ['meta']);\n\n const data = emberData as Record<\n string,\n {\n meta?: unknown;\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n >;\n const storyFile = resolved.preparedMeta?.parameters?.fileName as string | undefined;\n const storyEntry = storyFile ? data[storyFile] : undefined;\n const storyComponent = storyEntry?.component;\n const compFile = storyComponent?.file;\n const compEntry = compFile ? data[compFile] : undefined;\n const signature = compEntry?.signatures?.[storyComponent?.signatureName ?? ''];\n\n const children: ReactNode[] = [\n createElement(Title),\n createElement(Subtitle),\n createElement(Description),\n createElement(Primary)\n ];\n\n if (signature) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n children.push(...addSignature(signature, emberData));\n }\n\n children.push(createElement(Stories));\n\n return createElement(Fragment, undefined, ...children);\n}\n","import { SourceType } from 'storybook/internal/docs-tools';\nimport { emitTransformCode, useEffect, useRef } from 'storybook/preview-api';\nimport emberData from 'virtual:ember-storybook';\n\nimport { unwrapBlockParams } from './block-params';\n\nimport type { StorySource } from '../../node/types';\nimport type { StoryFn } from '../public-types';\nimport type { EmberRenderer } from '../types';\nimport type { BlockInfo, ComponentSignature } from 'ember-docgen';\nimport type { Args, ArgTypes, DecoratorFunction } from 'storybook/internal/types';\n\nconst data = emberData as Record<\n string,\n {\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n>;\n\nfunction skipSourceRender(context: Parameters<DecoratorFunction<EmberRenderer>>[1]) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const sourceParams = context.parameters.docs?.source;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (sourceParams?.type === SourceType.DYNAMIC) {\n return false;\n }\n\n const isArgsStory = context.parameters.__isArgsStory as boolean;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access\n return (!isArgsStory || sourceParams?.code) ?? sourceParams?.type === SourceType.CODE;\n}\n\nexport function toArgument(key: string, value: unknown, argTypes: ArgTypes): string | undefined {\n if (value !== undefined && value !== null) {\n if (typeof value === 'string') {\n return `@${key}=${JSON.stringify(value)}`;\n }\n\n if (typeof value === 'number' || typeof value === 'boolean') {\n return `@${key}={{${String(value)}}}`;\n }\n\n if (Object.hasOwn(argTypes, key)) {\n return `@${key}={{@${key}}}`;\n }\n\n return undefined;\n }\n\n if (value === undefined && Object.hasOwn(argTypes, key)) {\n return `@${key}={{@${key}}}`;\n }\n\n return undefined;\n}\n\nfunction generateBlockContent(blockInfo: BlockInfo): string {\n if (blockInfo.params.length === 0) {\n return '...';\n }\n\n const paramNames = unwrapBlockParams(blockInfo.params)\n .map((p) => p.name)\n .join(', ');\n\n return `{{yield ${paramNames}}}`;\n}\n\nexport function generateBlockSourceCode(\n sig: ComponentSignature,\n args: Args,\n indent: string\n): string {\n const blockNames = Object.keys(sig.blocks);\n\n if (blockNames.length === 0) return '';\n\n const blocks: string[] = [];\n\n for (const blockName of blockNames) {\n const blockInfo = sig.blocks[blockName];\n const arg = (args as Record<string, unknown>)[blockName];\n\n if (arg === undefined && blockInfo.params.length === 0) {\n continue;\n }\n\n const params = unwrapBlockParams(blockInfo.params)\n .map((p) => p.name)\n .join(' ');\n const slotBindings = params ? ` as |${params}|` : '';\n\n const content = generateBlockContent(blockInfo);\n\n if (blockName === 'default' && !slotBindings) {\n blocks.push(content);\n } else {\n blocks.push(`${indent} <:${blockName}${slotBindings}>${content}</:${blockName}>`);\n }\n }\n\n return blocks.join('\\n');\n}\n\nlet byStoryId: Record<string, StorySource> | undefined;\n\nfunction getByStoryId(): Record<string, StorySource> {\n if (byStoryId) return byStoryId;\n\n byStoryId = {};\n\n for (const entry of Object.values(data)) {\n for (const [storyId, source] of Object.entries(entry.source ?? {})) {\n byStoryId[storyId] = {\n componentName: source.componentName,\n signatureName: source.signatureName,\n inlineTemplate: source.inlineTemplate\n };\n }\n }\n\n return byStoryId;\n}\n\nfunction signatureForComponent(name: string): ComponentSignature | undefined {\n for (const entry of Object.values(data)) {\n const comp = entry.component;\n\n if (comp?.signatureName !== name) continue;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n\n return compEntry?.signatures?.[comp.signatureName];\n }\n\n return undefined;\n}\n\nexport function resolveTemplateArgs(template: string, args: Args): string {\n return template.replaceAll(/\\{\\{args\\.(\\w+)\\}\\}/g, (_match, key) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const value = (args as Record<string, unknown>)[key];\n\n if (typeof value === 'string') {\n return JSON.stringify(value);\n }\n\n if (typeof value === 'number' || typeof value === 'boolean') {\n return `{{${String(value)}}}`;\n }\n\n return `{{@${key}}}`;\n });\n}\n\nexport function generateSource(\n component: { name?: string },\n args: Args,\n argTypes: ArgTypes,\n storyId?: string\n): string | undefined {\n const meta = storyId ? getByStoryId()[storyId] : undefined;\n\n if (meta?.inlineTemplate) {\n return resolveTemplateArgs(meta.inlineTemplate, args);\n }\n\n const name = meta?.componentName ?? component.name;\n\n if (!name || name === '(unknown template-only component)') {\n return undefined;\n }\n\n // Default-exported components are keyed by the `__DEFAULT__` sentinel in the\n // signatures map, while `name` is the real component name. Look the signature\n // up by the sentinel so blocks/args still resolve.\n const sig = signatureForComponent(meta?.signatureName ?? name);\n\n const propsArray = Object.entries(args)\n .filter(([k]) => !sig || !Object.hasOwn(sig.blocks, k))\n .map(([k, v]) => toArgument(k, v, argTypes))\n .filter(Boolean);\n\n const blockCode = sig ? generateBlockSourceCode(sig, args, '') : '';\n\n const propsStr = propsArray.join(' ');\n\n if (!blockCode) {\n if (propsArray.length === 0) {\n return `<${name} />`;\n }\n\n if (propsArray.length > 3) {\n return `<${name}\\n ${propsArray.join('\\n ')}\\n/>`;\n }\n\n return `<${name} ${propsStr} />`;\n }\n\n if (propsArray.length === 0) {\n return `<${name}>\\n${blockCode}\\n</${name}>`;\n }\n\n return `<${name} ${propsStr}>\\n${blockCode}\\n</${name}>`;\n}\n\nexport const sourceDecorator: DecoratorFunction<EmberRenderer> = (storyFn, context) => {\n const source = useRef<string | undefined>(undefined);\n const story = storyFn();\n\n useEffect(() => {\n // Always generate the source from the ORIGINAL story, not the decorator-wrapped\n // `storyFn()` result. A decorator wraps the story in another component, so its\n // `.name` (e.g. `IntlDecorator`) would leak into the generated source block.\n const renderedForSource = (context.originalStoryFn as StoryFn)(context.args, context);\n\n if (!skipSourceRender(context)) {\n const code =\n generateSource(renderedForSource, context.args, context.argTypes, context.id) ?? undefined;\n\n void emitTransformCode(code, context);\n source.current = code;\n }\n });\n\n return story;\n};\n","import { SourceType } from 'storybook/internal/docs-tools';\nimport emberData from 'virtual:ember-storybook';\n\nimport { buildArgTypes } from './extractArgTypes';\nimport Page from './page';\nimport { sourceDecorator } from './source-decorator';\n\nimport type { ComponentFile, EmberMeta, StoryFile } from '../../node/types';\nimport type { EmberRenderer } from '../types';\nimport type { ComponentSignature } from 'ember-docgen';\nimport type {\n DecoratorFunction,\n Parameters,\n StoryContextForEnhancers,\n StrictArgTypes\n} from 'storybook/internal/types';\n\nconst data = emberData as EmberMeta;\n\nfunction resolveSig(entry: StoryFile | ComponentFile): ComponentSignature | undefined {\n if (!('component' in entry)) return undefined;\n\n const comp = entry.component;\n\n if (!comp.signatureName) return undefined;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n\n if (!compEntry || !('signatures' in compEntry)) return undefined;\n\n return compEntry.signatures[comp.signatureName];\n}\n\nexport const argTypesEnhancers: ((\n context: StoryContextForEnhancers<EmberRenderer>\n) => StrictArgTypes)[] = [\n (context) => {\n const filePath = (context.parameters as Record<string, unknown>).fileName as string | undefined;\n\n if (filePath && Object.hasOwn(data, filePath)) {\n const sig = resolveSig(data[filePath]);\n\n if (sig) {\n return { ...buildArgTypes(sig), ...context.argTypes } as StrictArgTypes;\n }\n\n return context.argTypes;\n }\n\n const titleName = context.title.split('/').pop();\n\n if (titleName) {\n for (const entry of Object.values(data)) {\n const sig = resolveSig(entry);\n\n if (sig) {\n return { ...buildArgTypes(sig), ...context.argTypes } as StrictArgTypes;\n }\n }\n }\n\n return context.argTypes;\n }\n];\n\nexport const parameters: Parameters = {\n docs: {\n source: {\n type: SourceType.DYNAMIC,\n language: 'html'\n },\n page: Page\n }\n};\n\nexport const decorators: DecoratorFunction<EmberRenderer>[] = [sourceDecorator];\n"],"mappings":";;;;;;;;AAKA,MAAMC,SAAOD;AASb,MAAME,yBAAS,IAAIC,IAAgC;AAEnD,KAAK,MAAMC,SAASC,OAAOC,OAAOL,MAAI,GAAG;CACvC,MAAMM,OAAOH,MAAMI;CAEnB,IAAI,CAACD,MAAME,eAAe;CAG1B,MAAMI,OADYN,KAAKI,OAAOV,OAAKM,KAAKI,QAAQC,KAAAA,EAAAA,EACzBE,aAAaP,KAAKE;CAEzC,IAAII,KACFX,OAAOa,IAAIR,KAAKE,eAAeI,GAAG;AAEtC;AAEA,SAASG,iBACPC,MASmB;CACnB,QAAQA,KAAKC,UAAb;EACE,KAAK,UACH,OAAO,EAAED,MAAM,OAAO;EAExB,KAAK,UACH,OAAO,EAAEA,MAAM,SAAS;EAE1B,KAAK,WACH,OAAO,EAAEA,MAAM,UAAU;EAE3B,KAAK,YACH,OAAO,EAAEA,MAAM,WAAW;EAE5B,KAAK,QACH,OAAO;GAAEA,MAAM;GAAUE,SAASF,KAAKE,WAAW,CAAA;EAAG;EAGvD,SACE,OAAO,EAAEF,MAAM,SAAS;CAE5B;AACF;AAEA,SAAgBG,cAAcP,KAAkD;CAC9E,MAAMQ,WAAoC,CAAC;CAE3C,KAAK,MAAM,CAACC,MAAMC,QAAQlB,OAAOmB,QAAQX,IAAIY,IAAI,GAC/CJ,SAASC,QAAQ;EACfA;EACAI,aAAaH,IAAIG,eAAed,KAAAA;EAChCK,MAAM;GACJK,MAAMC,IAAIN,KAAKU;GACfC,UAAUL,IAAIK;EAChB;EACAC,SAASb,iBAAiBO,IAAIN,IAAI;EAClCa,OAAO;GACLb,MAAM,EAAEc,SAASR,IAAIN,KAAKU,IAAI;GAC9BK,cAAcT,IAAIS,eAAe,EAAED,SAASR,IAAIS,aA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B,WAAWC,KAAK;EAE5B,IAAIe,KACF,OAAO;GAAE,GAAGpB,cAAcoB,GAAG;GAAG,GAAGN,QAAQO;EAAS;CAExD;CAGF,OAAOP,QAAQO;AACjB,CAAC;AAGH,MAAaL,aAAyB,EACpCW,MAAM;CACJC,QAAQ;EACNC,MAAM/B,WAAWgC;EACjBC,UAAU;CACZ;CACAC,MAAM/B;AACR,EACF;AAEA,MAAagC,aAAiD,CAAC/B,eAAe"}
1
+ {"version":3,"file":"config.mjs","names":["emberData","data","byName","Map","entry","Object","values","comp","component","signatureName","compEntry","file","undefined","sig","signatures","set","mapTypeToControl","type","category","options","buildArgTypes","argTypes","name","arg","entries","args","description","raw","required","control","table","summary","defaultValue","extractArgTypes","displayName","get","Heading","createElement","styled","isHtmlElement","name","test","TableWrapper","table","theme","fontFamily","typography","fonts","base","borderSpacing","color","defaultText","fontSize","size","s2","lineHeight","textAlign","width","marginTop","marginBottom","marginInline","padding","border","verticalAlign","textOverflow","paddingLeft","paddingRight","th","textMutedColor","paddingTop","paddingBottom","td","tbody","filter","background","content","borderTop","appBorderColor","borderBlockStart","borderBlockEnd","borderInlineStart","borderInlineEnd","borderTopLeftRadius","appBorderRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","borderColor","renderHead","columns","className","map","col","renderBody","entries","entry","key","style","fontWeight","description","H2","weight","bold","letterSpacing","textTransform","Subheading","useOf","createElement","Fragment","styled","TableWrapper","ParamType","code","theme","color","secondary","fontSize","fontWeight","ParamName","span","defaultText","ParamRow","div","typography","size","s2","lineHeight","marginBottom","ParamDesc","textMutedColor","s1","marginLeft","BlocksDiv","marginTop","BlocksNameCell","td","position","weight","bold","background","app","SubcomponentLink","a","primary","cursor","textDecoration","Indent","marginInlineStart","renderType","param","subcomponentNames","type","displayType","componentRef","exportName","typeIsSubcomponent","has","key","href","renderParam","name","isBlockParam","Object","hasOwn","renderParams","params","map","i","children","values","p","isNamed","startsWith","isSubcomponent","typeChildren","push","rows","description","BlocksTable","blocks","defaultName","entries","toSorted","nameA","_a","nameB","_b","length","block","displayName","undefined","className","BlocksSection","preparedMeta","componentName","title","createElement","styled","isHtmlElement","ElementWrapper","div","theme","fontFamily","typography","fonts","base","color","defaultText","fontSize","size","s2","lineHeight","marginTop","marginBottom","span","fontWeight","marginRight","code","secondary","textDecoration","a","ElementBlock","element","elements","split","map","s","trim","filter","Boolean","length","children","key","i","name","entries","push","inner","href","target","rel","undefined","createElement","renderBody","renderHead","TableWrapper","renderPartsBody","entries","className","map","entry","key","name","style","fontSize","fontWeight","description","PartsTable","CssPropertiesTable","ArgTypes","Subheading","createElement","styled","BlocksTable","ParamRow","ParamType","ElementBlock","H2","SubcomponentsSection","div","marginTop","marginBottom","SubEntry","SectionLabel","theme","fontWeight","color","defaultText","fontSize","typography","size","m1","renderSubcomponentSignature","sig","subcomponentNames","defaultName","children","element","push","Object","keys","args","length","undefined","include","blocks","key","style","SubcomponentsArea","components","Set","map","c","name","entries","comp","importPath","signature","id","unwrapBlockParams","applyModifiers","signature","modifiers","length","blockedKeys","Set","pickedKeys","mod","name","key","typeArgs","add","filtered","size","Object","fromEntries","entries","args","filter","k","has","collectSubcomponents","blocks","data","seen","result","block","values","param","params","componentRef","filePath","exportName","importPath","push","hasOwn","entry","signatures","sig","Controls","Description","Primary","Stories","Subheading","Subtitle","Title","useOf","createElement","Fragment","emberData","BlocksSection","ElementBlock","CssPropertiesTable","PartsTable","SubcomponentsArea","H2","collectSubcomponents","addSignature","signature","data","children","element","push","Object","keys","args","length","undefined","include","blocks","subcomponents","subcomponentNames","Set","map","s","name","components","style","customProperties","entries","description","parts","unshift","Page","resolved","storyFile","preparedMeta","parameters","fileName","storyEntry","storyComponent","component","compFile","file","compEntry","signatures","signatureName","SourceType","emitTransformCode","useEffect","useRef","emberData","isEmberStoryResult","unwrapBlockParams","data","skipSourceRender","context","sourceParams","parameters","docs","source","type","DYNAMIC","isArgsStory","__isArgsStory","code","CODE","toArgument","key","value","argTypes","undefined","JSON","stringify","String","Object","hasOwn","generateBlockContent","blockInfo","params","length","paramNames","map","p","name","join","generateBlockSourceCode","sig","args","indent","blockNames","keys","blocks","blockName","arg","slotBindings","content","push","byStoryId","getByStoryId","entry","values","storyId","entries","componentName","signatureName","inlineTemplate","signatureForComponent","comp","component","compEntry","file","signatures","resolveTemplateArgs","template","replaceAll","_match","generateSource","meta","propsArray","filter","k","v","Boolean","blockCode","propsStr","sourceDecorator","storyFn","story","rendered","originalStoryFn","renderedForSource","id","current","SourceType","emberData","buildArgTypes","Page","sourceDecorator","data","resolveSig","entry","undefined","comp","component","signatureName","compEntry","file","signatures","argTypesEnhancers","context","filePath","parameters","fileName","Object","hasOwn","sig","argTypes","titleName","title","split","pop","values","docs","source","type","DYNAMIC","language","page","decorators"],"sources":["../../../src/client/docs/extractArgTypes.ts","../../../src/client/docs/blocks/ui.ts","../../../src/client/docs/blocks/blocks.ts","../../../src/client/docs/blocks/element.ts","../../../src/client/docs/blocks/style.ts","../../../src/client/docs/blocks/subcomponents.ts","../../../src/client/docs/signature.ts","../../../src/client/docs/page.ts","../../../src/client/docs/source-decorator.ts","../../../src/client/docs/config.ts"],"sourcesContent":["import emberData from 'virtual:ember-storybook';\n\nimport type { StorySource } from '../../node/types';\nimport type { ArgTypeInfo, ComponentSignature } from 'ember-docgen';\n\nconst data = emberData as Record<\n string,\n {\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n>;\n\nconst byName = new Map<string, ComponentSignature>();\n\nfor (const entry of Object.values(data)) {\n const comp = entry.component;\n\n if (!comp?.signatureName) continue;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n const sig = compEntry?.signatures?.[comp.signatureName];\n\n if (sig) {\n byName.set(comp.signatureName, sig);\n }\n}\n\nfunction mapTypeToControl(\n type: ArgTypeInfo\n):\n | false\n | { type: 'text' }\n | { type: 'number' }\n | { type: 'boolean' }\n | { type: 'select'; options: string[] }\n | { type: 'object' }\n | { type: 'function' }\n | { type: 'date' } {\n switch (type.category) {\n case 'string': {\n return { type: 'text' };\n }\n case 'number': {\n return { type: 'number' };\n }\n case 'boolean': {\n return { type: 'boolean' };\n }\n case 'function': {\n return { type: 'function' };\n }\n case 'enum': {\n return { type: 'select', options: type.options ?? [] };\n }\n\n default: {\n return { type: 'object' };\n }\n }\n}\n\nexport function buildArgTypes(sig: ComponentSignature): Record<string, unknown> {\n const argTypes: Record<string, unknown> = {};\n\n for (const [name, arg] of Object.entries(sig.args)) {\n argTypes[name] = {\n name,\n description: arg.description || undefined,\n type: {\n name: arg.type.raw,\n required: arg.required\n },\n control: mapTypeToControl(arg.type),\n table: {\n type: { summary: arg.type.raw },\n defaultValue: arg.defaultValue ? { summary: arg.defaultValue } : undefined\n }\n };\n }\n\n return argTypes;\n}\n\nexport function extractArgTypes(\n component: Record<string, unknown>\n): Record<string, unknown> | null {\n const name =\n (component.name as string | undefined) ?? (component.displayName as string | undefined);\n\n // eslint-disable-next-line unicorn/no-null\n if (!name) return null;\n\n const sig = byName.get(name);\n\n // eslint-disable-next-line unicorn/no-null\n if (!sig) return null;\n\n return buildArgTypes(sig);\n}\n","/* eslint-disable unicorn/no-null */\nimport { Heading } from '@storybook/addon-docs/blocks';\nimport { createElement } from 'react';\nimport { styled, type Theme } from 'storybook/theming';\n\nexport interface Entry {\n name: string;\n description?: string;\n}\n\ntype StyleProps = { theme: Theme };\n\nexport function isHtmlElement(name: string): boolean {\n return /^HTML[A-Z]\\w*Element$/.test(name);\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nexport const TableWrapper = styled.table(({ theme }: StyleProps) => ({\n fontFamily: theme.typography.fonts.base,\n borderSpacing: 0,\n color: theme.color.defaultText,\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n textAlign: 'left',\n width: '100%',\n marginTop: 25,\n marginBottom: 40,\n marginInline: 1,\n 'td, th': {\n padding: 0,\n border: 'none',\n verticalAlign: 'top',\n textOverflow: 'ellipsis'\n },\n 'th:first-of-type, td:first-of-type': {\n paddingLeft: 20\n },\n 'th:last-of-type, td:last-of-type': {\n paddingRight: 20\n },\n th: {\n color: theme.textMutedColor as string,\n paddingTop: 10,\n paddingBottom: 10,\n paddingLeft: 15,\n paddingRight: 15\n },\n td: {\n paddingTop: '10px',\n paddingBottom: '10px',\n '&:not(:first-of-type)': {\n paddingLeft: 15,\n paddingRight: 15\n },\n '&:last-of-type': {\n paddingRight: 20\n }\n },\n tbody: {\n filter:\n theme.base === 'light'\n ? 'drop-shadow(0px 1px 3px rgba(0, 0, 0, 0.10))'\n : 'drop-shadow(0px 1px 3px rgba(0, 0, 0, 0.20))',\n '> tr > *': {\n background: theme.background.content,\n borderTop: `1px solid ${theme.appBorderColor}`\n },\n '> tr:first-of-type > *': {\n borderBlockStart: `1px solid ${theme.appBorderColor}`\n },\n '> tr:last-of-type > *': {\n borderBlockEnd: `1px solid ${theme.appBorderColor}`\n },\n '> tr > *:first-of-type': {\n borderInlineStart: `1px solid ${theme.appBorderColor}`\n },\n '> tr > *:last-of-type': {\n borderInlineEnd: `1px solid ${theme.appBorderColor}`\n },\n '> tr:first-of-type > td:first-of-type': {\n borderTopLeftRadius: theme.appBorderRadius\n },\n '> tr:first-of-type > td:last-of-type': {\n borderTopRightRadius: theme.appBorderRadius\n },\n '> tr:last-of-type > td:first-of-type': {\n borderBottomLeftRadius: theme.appBorderRadius\n },\n '> tr:last-of-type > td:last-of-type': {\n borderBottomRightRadius: theme.appBorderRadius\n }\n },\n '@media (forced-colors: active)': {\n tbody: {\n filter: 'none',\n '> tr > *': {\n borderColor: 'CanvasText'\n }\n }\n }\n}));\n\nexport function renderHead(columns: string[]) {\n return createElement(\n 'thead',\n { className: 'docblock-argstable-head' },\n createElement(\n 'tr',\n null,\n ...columns.map((col) => createElement('th', null, createElement('span', null, col)))\n )\n );\n}\n\nexport function renderBody(entries: Entry[]) {\n return createElement(\n 'tbody',\n { className: 'docblock-argstable-body' },\n ...entries.map((entry) =>\n createElement(\n 'tr',\n { key: entry.name },\n createElement(\n 'td',\n null,\n createElement('span', { style: { fontWeight: 'bold' } }, entry.name)\n ),\n createElement('td', null, entry.description ?? '')\n )\n )\n );\n}\n\nexport const H2 = styled(Heading)(({ theme }) => ({\n fontSize: `${theme.typography.size.s2 - 1}px`,\n fontWeight: theme.typography.weight.bold,\n lineHeight: '16px',\n letterSpacing: '0.35em',\n textTransform: 'uppercase',\n color: theme.textMutedColor as string,\n border: 0,\n marginBottom: '12px',\n '&:first-of-type': { marginTop: '56px' }\n}));\n","import { Subheading, useOf } from '@storybook/addon-docs/blocks';\nimport { createElement, Fragment, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { TableWrapper } from './ui';\n\nimport type { BlockInfo, BlockParam, HashBlockParam } from 'ember-docgen';\n\nexport const ParamType = styled.code(({ theme }) => ({\n color: theme.color.secondary,\n fontSize: 12,\n fontWeight: 'bold'\n}));\n\nconst ParamName = styled.span(({ theme }) => ({\n fontWeight: 'bold',\n color: theme.color.defaultText\n}));\n\nexport const ParamRow = styled.div(({ theme }) => ({\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n marginBottom: 2\n}));\n\nconst ParamDesc = styled.div(({ theme }) => ({\n color: theme.textMutedColor as string,\n fontSize: theme.typography.size.s1,\n lineHeight: '17px',\n marginBottom: 8,\n marginLeft: 20\n}));\n\nconst BlocksDiv = styled.div(() => ({\n marginTop: 25,\n marginBottom: 40\n}));\n\nconst BlocksNameCell = styled.td(({ theme }) => ({\n position: 'relative',\n fontWeight: theme.typography.weight.bold,\n fontSize: theme.typography.size.s1,\n background: `${theme.background.app} !important`,\n '& ~ td': {\n background: `${theme.background.app} !important`\n }\n}));\n\nconst SubcomponentLink = styled.a(({ theme }) => ({\n color: theme.color.primary,\n fontWeight: 'bold',\n cursor: 'pointer',\n textDecoration: 'none',\n '&:hover': { textDecoration: 'underline' }\n}));\n\nconst Indent = styled.span(() => ({\n marginInlineStart: '20px'\n}));\n\nfunction renderType(param: BlockParam, subcomponentNames: Set<string>): ReactNode {\n if (param.type === 'Invokable') {\n const displayType = param.componentRef?.exportName ?? param.type;\n const typeIsSubcomponent = subcomponentNames.has(displayType);\n\n return typeIsSubcomponent\n ? createElement(\n SubcomponentLink,\n { key: 'type', href: `#subcomponent-${displayType}` },\n displayType\n )\n : createElement(ParamType, { key: 'type' }, displayType);\n }\n\n return createElement(ParamType, { key: 'type' }, param.type);\n}\n\nfunction renderParam(param: BlockParam, subcomponentNames: Set<string>): ReactNode[] {\n const type = renderType(param, subcomponentNames);\n const name = createElement(ParamName, { key: 'name' }, param.name);\n\n return [name, createElement('span', { key: 'colon' }, ': '), type];\n}\n\nfunction isBlockParam(param: BlockParam | HashBlockParam): param is BlockParam {\n return Object.hasOwn(param, 'name') && Object.hasOwn(param, 'type');\n}\n\nfunction renderParams(params: BlockInfo['params'], subcomponentNames: Set<string>): ReactNode[] {\n return params.map((param, i) => {\n if (!isBlockParam(param)) {\n const children: ReactNode[] = [\n createElement('span', { key: 'open' }, '- {'),\n createElement('br'),\n ...Object.values(param).map((p) => [\n createElement(Indent),\n renderParam(p, subcomponentNames)\n ]),\n createElement('br'),\n createElement('span', { key: 'close' }, '}')\n ];\n\n return createElement(Fragment, { key: i }, ...children);\n }\n\n const isNamed = param.name && !param.name.startsWith('param');\n const displayType = param.componentRef?.exportName ?? param.type;\n\n const isSubcomponent = subcomponentNames.has(displayType);\n\n const children: ReactNode[] = [];\n const typeChildren: ReactNode[] = [];\n\n if (isSubcomponent) {\n typeChildren.push(\n createElement(\n SubcomponentLink,\n { key: 'type', href: `#subcomponent-${displayType}` },\n displayType\n )\n );\n } else {\n typeChildren.push(createElement(ParamType, { key: 'type' }, displayType));\n }\n\n if (isNamed) {\n children.push(\n createElement('span', { key: 'sep' }, '- '),\n createElement(ParamName, { key: 'name' }, param.name),\n createElement('span', { key: 'colon' }, ': '),\n ...typeChildren\n );\n } else {\n children.push(createElement('span', { key: 'sep' }, '- '), ...typeChildren);\n }\n\n const rows: ReactNode[] = [createElement(ParamRow, { key: 'row' }, ...children)];\n\n if (param.description) {\n rows.push(createElement(ParamDesc, { key: 'desc' }, param.description));\n }\n\n return createElement(Fragment, { key: i }, ...rows);\n });\n}\n\nexport function BlocksTable({\n blocks,\n subcomponentNames,\n defaultName\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n defaultName: string;\n}) {\n const entries = Object.entries(blocks).toSorted(([nameA, _a], [nameB, _b]) => {\n if (nameA === 'default') return -1;\n if (nameB === 'default') return -1;\n\n return 0;\n });\n\n if (entries.length === 0) return;\n\n const rows = [];\n\n for (const [name, block] of entries) {\n const displayName = name === 'default' ? `<${defaultName}>` : `<:${name}>`;\n\n rows.push(\n createElement('tr', { key: name }, createElement(BlocksNameCell, undefined, displayName))\n );\n\n if (block.params.length > 0) {\n const params = renderParams(block.params, subcomponentNames);\n\n rows.push(createElement('tr', undefined, createElement('td', undefined, ...params)));\n }\n }\n\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n createElement('tbody', { className: 'docblock-argstable-body' }, rows)\n );\n}\n\nexport function BlocksSection({\n blocks,\n subcomponentNames\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n}) {\n const { preparedMeta } = useOf('meta', ['meta']);\n const componentName = preparedMeta.title;\n\n return createElement(\n BlocksDiv,\n undefined,\n createElement(Subheading, undefined, 'Blocks'),\n BlocksTable({ blocks, subcomponentNames, defaultName: componentName })\n );\n}\n","import { createElement, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { isHtmlElement } from './ui';\n\nconst ElementWrapper = styled.div(({ theme }) => ({\n fontFamily: theme.typography.fonts.base,\n color: theme.color.defaultText,\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n marginTop: 25,\n marginBottom: 40,\n span: {\n '&:first-of-type': {\n fontWeight: 'bold',\n marginRight: 8\n }\n },\n code: {\n fontSize: 12,\n fontWeight: 'bold'\n },\n 'a code': {\n color: theme.color.secondary,\n textDecoration: 'none'\n },\n a: {\n color: theme.color.secondary,\n textDecoration: 'none',\n '&:hover': {\n textDecoration: 'underline'\n }\n }\n}));\n\nexport function ElementBlock({ element }: { element: string }) {\n const elements = element\n .split(' | ')\n .map((s) => s.trim())\n .filter(Boolean);\n\n if (elements.length === 0) return;\n\n const children: ReactNode[] = [createElement('span', { key: 'label' }, 'Element:')];\n\n for (const [i, name] of elements.entries()) {\n if (i > 0) {\n children.push(createElement('span', { key: `sep-${i}` }, ' | '));\n }\n\n const inner = isHtmlElement(name)\n ? createElement(\n 'a',\n {\n key: `link-${name}`,\n href: `https://developer.mozilla.org/en-US/docs/Web/API/${name}`,\n target: '_blank',\n rel: 'noopener noreferrer'\n },\n name\n )\n : name;\n\n children.push(createElement('code', { key: name }, inner));\n }\n\n return createElement(ElementWrapper, undefined, ...children);\n}\n","/* eslint-disable unicorn/no-null */\nimport { createElement } from 'react';\n\nimport { type Entry, renderBody, renderHead, TableWrapper } from './ui';\n\nfunction renderPartsBody(entries: Entry[]) {\n return createElement(\n 'tbody',\n { className: 'docblock-argstable-body' },\n ...entries.map((entry) =>\n createElement(\n 'tr',\n { key: entry.name },\n createElement(\n 'td',\n null,\n createElement(\n 'code',\n { style: { fontSize: 12, fontWeight: 'bold' } },\n `[part=\"${entry.name}\"]`\n )\n ),\n createElement('td', null, entry.description ?? '')\n )\n )\n );\n}\n\nexport function PartsTable({ entries }: { entries: Entry[] }) {\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n renderHead(['Part', 'Description']),\n renderPartsBody(entries)\n );\n}\n\nexport function CssPropertiesTable({ entries }: { entries: Entry[] }) {\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n renderHead(['Property', 'Value']),\n renderBody(entries)\n );\n}\n","import { ArgTypes, Subheading } from '@storybook/addon-docs/blocks';\nimport { createElement, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { BlocksTable, ParamRow, ParamType } from './blocks';\nimport { ElementBlock } from './element';\nimport { H2 } from './ui';\n\nimport type { SubcomponentRef } from '../signature';\nimport type { ComponentSignature } from 'ember-docgen';\n\nconst SubcomponentsSection = styled.div(() => ({\n marginTop: 25,\n marginBottom: 40\n}));\n\nconst SubEntry = styled.div(() => ({\n marginBottom: 24,\n '&:last-child': { marginBottom: 0 }\n}));\n\nconst SectionLabel = styled.div(({ theme }) => ({\n fontWeight: 'bold',\n color: theme.color.defaultText,\n fontSize: theme.typography.size.m1 - 2,\n marginBottom: 8\n}));\n\nfunction renderSubcomponentSignature(\n sig: ComponentSignature,\n subcomponentNames: Set<string>,\n defaultName: string\n): ReactNode[] {\n const children: ReactNode[] = [];\n\n if (sig.element) {\n children.push(createElement(ElementBlock, { element: sig.element }));\n }\n\n if (Object.keys(sig.args).length > 0) {\n children.push(\n createElement(SectionLabel, undefined, 'Args'),\n createElement(ArgTypes, { include: Object.keys(sig.args) })\n );\n }\n\n if (Object.keys(sig.blocks).length > 0) {\n children.push(\n createElement(SectionLabel, { key: 'blocks-label', style: { marginTop: 12 } }, 'Blocks'),\n createElement(BlocksTable, { blocks: sig.blocks, subcomponentNames, defaultName })\n );\n }\n\n return children;\n}\n\nexport function SubcomponentsArea({ components }: { components: SubcomponentRef[] }) {\n if (components.length === 0) return;\n\n const subcomponentNames = new Set(components.map((c) => c.name));\n\n const entries = components.map((comp) => {\n const children: ReactNode[] = [createElement(Subheading, undefined, comp.name)];\n\n if (comp.importPath) {\n children.push(\n createElement(\n ParamRow,\n { key: 'import', style: { marginBottom: 12 } },\n createElement('span', undefined, \"from '\"),\n createElement(ParamType, undefined, comp.importPath),\n createElement('span', undefined, \"'\")\n )\n );\n } else if (comp.signature) {\n children.push(...renderSubcomponentSignature(comp.signature, subcomponentNames, comp.name));\n }\n\n return createElement(\n SubEntry,\n { id: `subcomponent-${comp.name}`, key: comp.name },\n ...children\n );\n });\n\n return createElement(\n SubcomponentsSection,\n undefined,\n createElement(H2, undefined, 'Subcomponents'),\n ...entries\n );\n}\n","import { unwrapBlockParams } from './block-params';\n\nimport type { ComponentFile, EmberMeta } from '../../node/types';\nimport type { BlockInfo, ComponentSignature } from 'ember-docgen';\n\nexport interface SubcomponentRef {\n name: string;\n signature?: ComponentSignature;\n importPath?: string;\n}\n\nexport function applyModifiers(\n signature: ComponentSignature,\n modifiers?: { name: string; typeArgs: string[] }[]\n): ComponentSignature {\n if (!modifiers || modifiers.length === 0) return signature;\n\n const blockedKeys = new Set<string>();\n const pickedKeys = new Set<string>();\n\n for (const mod of modifiers) {\n if (mod.name === 'WithBoundArgs' || mod.name === 'Omit') {\n for (const key of mod.typeArgs) blockedKeys.add(key);\n }\n\n if (mod.name === 'Pick') {\n for (const key of mod.typeArgs) pickedKeys.add(key);\n }\n }\n\n const filtered =\n pickedKeys.size > 0\n ? Object.fromEntries(Object.entries(signature.args).filter(([k]) => pickedKeys.has(k)))\n : Object.fromEntries(Object.entries(signature.args).filter(([k]) => !blockedKeys.has(k)));\n\n return { ...signature, args: filtered };\n}\n\nexport function collectSubcomponents(\n blocks: Record<string, BlockInfo>,\n data: EmberMeta\n): SubcomponentRef[] {\n const seen = new Set<string>();\n\n const result: SubcomponentRef[] = [];\n\n for (const block of Object.values(blocks)) {\n for (const param of unwrapBlockParams(block.params)) {\n if (!param.componentRef) {\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n continue;\n }\n\n const { filePath, exportName, importPath, modifiers } = param.componentRef;\n\n if (seen.has(param.name)) {\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n continue;\n }\n\n seen.add(param.name);\n\n if (importPath) {\n result.push({ name: param.name, importPath });\n } else if (filePath && Object.hasOwn(data, filePath)) {\n const entry = data[filePath] as ComponentFile;\n\n if (Object.hasOwn(entry.signatures, exportName)) {\n const sig = entry.signatures[exportName];\n\n result.push({\n name: param.name,\n signature: applyModifiers(sig, modifiers)\n });\n }\n }\n }\n }\n\n return result;\n}\n","import {\n Controls,\n Description,\n Primary,\n Stories,\n Subheading,\n Subtitle,\n Title,\n useOf\n} from '@storybook/addon-docs/blocks';\nimport { createElement, Fragment, type ReactNode } from 'react';\nimport emberData from 'virtual:ember-storybook';\n\nimport { BlocksSection } from './blocks/blocks';\nimport { ElementBlock } from './blocks/element';\nimport { CssPropertiesTable, PartsTable } from './blocks/style';\nimport { SubcomponentsArea } from './blocks/subcomponents';\nimport { H2 } from './blocks/ui';\nimport { collectSubcomponents } from './signature';\n\nimport type { EmberMeta, StorySource } from '../../node/types';\nimport type { ComponentSignature } from 'ember-docgen';\n\nfunction addSignature(signature: ComponentSignature, data: EmberMeta) {\n const children: ReactNode[] = [];\n\n if (signature.element) {\n children.push(createElement(ElementBlock, { element: signature.element }));\n }\n\n if (Object.keys(signature.args).length > 0) {\n children.push(\n createElement(Subheading, undefined, 'Args'),\n // createElement(ArgTypes, { include: Object.keys(signature.args) }),\n createElement(Controls, { include: Object.keys(signature.args) })\n );\n }\n\n if (Object.keys(signature.blocks).length > 0) {\n const subcomponents = collectSubcomponents(signature.blocks, data);\n const subcomponentNames = new Set(subcomponents.map((s) => s.name));\n\n children.push(createElement(BlocksSection, { blocks: signature.blocks, subcomponentNames }));\n\n if (subcomponents.length > 0) {\n children.push(createElement(SubcomponentsArea, { components: subcomponents }));\n }\n }\n\n if (Object.keys(signature.style.customProperties).length > 0) {\n const entries = Object.entries(signature.style.customProperties).map(([name, description]) => ({\n name,\n description\n }));\n\n children.push(\n createElement(Subheading, undefined, 'CSS Custom Properties'),\n createElement(CssPropertiesTable, { entries })\n );\n }\n\n if (Object.keys(signature.style.parts).length > 0) {\n const entries = Object.entries(signature.style.parts).map(([name, description]) => ({\n name,\n description\n }));\n\n children.push(\n createElement(Subheading, undefined, 'Parts'),\n createElement(PartsTable, { entries })\n );\n }\n\n if (children.length > 0) {\n children.unshift(createElement(H2, undefined, 'Signature'));\n }\n\n return children;\n}\n\nexport default function Page() {\n const resolved: {\n preparedMeta?: {\n argTypes?: Record<string, unknown>;\n title?: string;\n parameters?: Record<string, unknown>;\n };\n } = useOf('meta', ['meta']);\n\n const data = emberData as Record<\n string,\n {\n meta?: unknown;\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n >;\n const storyFile = resolved.preparedMeta?.parameters?.fileName as string | undefined;\n const storyEntry = storyFile ? data[storyFile] : undefined;\n const storyComponent = storyEntry?.component;\n const compFile = storyComponent?.file;\n const compEntry = compFile ? data[compFile] : undefined;\n const signature = compEntry?.signatures?.[storyComponent?.signatureName ?? ''];\n\n const children: ReactNode[] = [\n createElement(Title),\n createElement(Subtitle),\n createElement(Description),\n createElement(Primary)\n ];\n\n if (signature) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n children.push(...addSignature(signature, emberData));\n }\n\n children.push(createElement(Stories));\n\n return createElement(Fragment, undefined, ...children);\n}\n","import { SourceType } from 'storybook/internal/docs-tools';\nimport { emitTransformCode, useEffect, useRef } from 'storybook/preview-api';\nimport emberData from 'virtual:ember-storybook';\n\nimport { isEmberStoryResult } from '../story-result';\nimport { unwrapBlockParams } from './block-params';\n\nimport type { StorySource } from '../../node/types';\nimport type { StoryFn } from '../public-types';\nimport type { EmberRenderer } from '../types';\nimport type { BlockInfo, ComponentSignature } from 'ember-docgen';\nimport type { Args, ArgTypes, DecoratorFunction } from 'storybook/internal/types';\n\nconst data = emberData as Record<\n string,\n {\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n>;\n\nfunction skipSourceRender(context: Parameters<DecoratorFunction<EmberRenderer>>[1]) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const sourceParams = context.parameters.docs?.source;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (sourceParams?.type === SourceType.DYNAMIC) {\n return false;\n }\n\n const isArgsStory = context.parameters.__isArgsStory as boolean;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access\n return (!isArgsStory || sourceParams?.code) ?? sourceParams?.type === SourceType.CODE;\n}\n\nexport function toArgument(key: string, value: unknown, argTypes: ArgTypes): string | undefined {\n if (value !== undefined && value !== null) {\n if (typeof value === 'string') {\n return `@${key}=${JSON.stringify(value)}`;\n }\n\n if (typeof value === 'number' || typeof value === 'boolean') {\n return `@${key}={{${String(value)}}}`;\n }\n\n if (Object.hasOwn(argTypes, key)) {\n return `@${key}={{@${key}}}`;\n }\n\n return undefined;\n }\n\n if (value === undefined && Object.hasOwn(argTypes, key)) {\n return `@${key}={{@${key}}}`;\n }\n\n return undefined;\n}\n\nfunction generateBlockContent(blockInfo: BlockInfo): string {\n if (blockInfo.params.length === 0) {\n return '...';\n }\n\n const paramNames = unwrapBlockParams(blockInfo.params)\n .map((p) => p.name)\n .join(', ');\n\n return `{{yield ${paramNames}}}`;\n}\n\nexport function generateBlockSourceCode(\n sig: ComponentSignature,\n args: Args,\n indent: string\n): string {\n const blockNames = Object.keys(sig.blocks);\n\n if (blockNames.length === 0) return '';\n\n const blocks: string[] = [];\n\n for (const blockName of blockNames) {\n const blockInfo = sig.blocks[blockName];\n const arg = (args as Record<string, unknown>)[blockName];\n\n if (arg === undefined && blockInfo.params.length === 0) {\n continue;\n }\n\n const params = unwrapBlockParams(blockInfo.params)\n .map((p) => p.name)\n .join(' ');\n const slotBindings = params ? ` as |${params}|` : '';\n\n const content = generateBlockContent(blockInfo);\n\n if (blockName === 'default' && !slotBindings) {\n blocks.push(content);\n } else {\n blocks.push(`${indent} <:${blockName}${slotBindings}>${content}</:${blockName}>`);\n }\n }\n\n return blocks.join('\\n');\n}\n\nlet byStoryId: Record<string, StorySource> | undefined;\n\nfunction getByStoryId(): Record<string, StorySource> {\n if (byStoryId) return byStoryId;\n\n byStoryId = {};\n\n for (const entry of Object.values(data)) {\n for (const [storyId, source] of Object.entries(entry.source ?? {})) {\n byStoryId[storyId] = {\n componentName: source.componentName,\n signatureName: source.signatureName,\n inlineTemplate: source.inlineTemplate\n };\n }\n }\n\n return byStoryId;\n}\n\nfunction signatureForComponent(name: string): ComponentSignature | undefined {\n for (const entry of Object.values(data)) {\n const comp = entry.component;\n\n if (comp?.signatureName !== name) continue;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n\n return compEntry?.signatures?.[comp.signatureName];\n }\n\n return undefined;\n}\n\nexport function resolveTemplateArgs(template: string, args: Args): string {\n return template.replaceAll(/\\{\\{args\\.(\\w+)\\}\\}/g, (_match, key) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const value = (args as Record<string, unknown>)[key];\n\n if (typeof value === 'string') {\n return JSON.stringify(value);\n }\n\n if (typeof value === 'number' || typeof value === 'boolean') {\n return `{{${String(value)}}}`;\n }\n\n return `{{@${key}}}`;\n });\n}\n\nexport function generateSource(\n component: { name?: string },\n args: Args,\n argTypes: ArgTypes,\n storyId?: string\n): string | undefined {\n const meta = storyId ? getByStoryId()[storyId] : undefined;\n\n if (meta?.inlineTemplate) {\n return resolveTemplateArgs(meta.inlineTemplate, args);\n }\n\n const name = meta?.componentName ?? component.name;\n\n if (!name || name === '(unknown template-only component)') {\n return undefined;\n }\n\n // Default-exported components are keyed by the `__DEFAULT__` sentinel in the\n // signatures map, while `name` is the real component name. Look the signature\n // up by the sentinel so blocks/args still resolve.\n const sig = signatureForComponent(meta?.signatureName ?? name);\n\n const propsArray = Object.entries(args)\n .filter(([k]) => !sig || !Object.hasOwn(sig.blocks, k))\n .map(([k, v]) => toArgument(k, v, argTypes))\n .filter(Boolean);\n\n const blockCode = sig ? generateBlockSourceCode(sig, args, '') : '';\n\n const propsStr = propsArray.join(' ');\n\n if (!blockCode) {\n if (propsArray.length === 0) {\n return `<${name} />`;\n }\n\n if (propsArray.length > 3) {\n return `<${name}\\n ${propsArray.join('\\n ')}\\n/>`;\n }\n\n return `<${name} ${propsStr} />`;\n }\n\n if (propsArray.length === 0) {\n return `<${name}>\\n${blockCode}\\n</${name}>`;\n }\n\n return `<${name} ${propsStr}>\\n${blockCode}\\n</${name}>`;\n}\n\nexport const sourceDecorator: DecoratorFunction<EmberRenderer> = (storyFn, context) => {\n const source = useRef<string | undefined>(undefined);\n const story = storyFn();\n\n useEffect(() => {\n // Always generate the source from the ORIGINAL story, not the decorator-wrapped\n // `storyFn()` result. A decorator wraps the story in another component, so its\n // `.name` (e.g. `IntlDecorator`) would leak into the generated source block.\n const rendered = (context.originalStoryFn as StoryFn)(context.args, context);\n const renderedForSource = isEmberStoryResult(rendered) ? rendered.component : rendered;\n\n if (!skipSourceRender(context)) {\n const code =\n generateSource(renderedForSource, context.args, context.argTypes, context.id) ?? undefined;\n\n void emitTransformCode(code, context);\n source.current = code;\n }\n });\n\n return story;\n};\n","import { SourceType } from 'storybook/internal/docs-tools';\nimport emberData from 'virtual:ember-storybook';\n\nimport { buildArgTypes } from './extractArgTypes';\nimport Page from './page';\nimport { sourceDecorator } from './source-decorator';\n\nimport type { ComponentFile, EmberMeta, StoryFile } from '../../node/types';\nimport type { EmberRenderer } from '../types';\nimport type { ComponentSignature } from 'ember-docgen';\nimport type {\n DecoratorFunction,\n Parameters,\n StoryContextForEnhancers,\n StrictArgTypes\n} from 'storybook/internal/types';\n\nconst data = emberData as EmberMeta;\n\nfunction resolveSig(entry: StoryFile | ComponentFile): ComponentSignature | undefined {\n if (!('component' in entry)) return undefined;\n\n const comp = entry.component;\n\n if (!comp.signatureName) return undefined;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n\n if (!compEntry || !('signatures' in compEntry)) return undefined;\n\n return compEntry.signatures[comp.signatureName];\n}\n\nexport const argTypesEnhancers: ((\n context: StoryContextForEnhancers<EmberRenderer>\n) => StrictArgTypes)[] = [\n (context) => {\n const filePath = (context.parameters as Record<string, unknown>).fileName as string | undefined;\n\n if (filePath && Object.hasOwn(data, filePath)) {\n const sig = resolveSig(data[filePath]);\n\n if (sig) {\n return { ...buildArgTypes(sig), ...context.argTypes } as StrictArgTypes;\n }\n\n return context.argTypes;\n }\n\n const titleName = context.title.split('/').pop();\n\n if (titleName) {\n for (const entry of Object.values(data)) {\n const sig = resolveSig(entry);\n\n if (sig) {\n return { ...buildArgTypes(sig), ...context.argTypes } as StrictArgTypes;\n }\n }\n }\n\n return context.argTypes;\n }\n];\n\nexport const parameters: Parameters = {\n docs: {\n source: {\n type: SourceType.DYNAMIC,\n language: 'html'\n },\n page: Page\n }\n};\n\nexport const decorators: DecoratorFunction<EmberRenderer>[] = [sourceDecorator];\n"],"mappings":";;;;;;;;;AAKA,MAAMC,SAAOD;AASb,MAAME,yBAAS,IAAIC,IAAgC;AAEnD,KAAK,MAAMC,SAASC,OAAOC,OAAOL,MAAI,GAAG;CACvC,MAAMM,OAAOH,MAAMI;CAEnB,IAAI,CAACD,MAAME,eAAe;CAG1B,MAAMI,OADYN,KAAKI,OAAOV,OAAKM,KAAKI,QAAQC,KAAAA,EAAAA,EACzBE,aAAaP,KAAKE;CAEzC,IAAII,KACFX,OAAOa,IAAIR,KAAKE,eAAeI,GAAG;AAEtC;AAEA,SAASG,iBACPC,MASmB;CACnB,QAAQA,KAAKC,UAAb;EACE,KAAK,UACH,OAAO,EAAED,MAAM,OAAO;EAExB,KAAK,UACH,OAAO,EAAEA,MAAM,SAAS;EAE1B,KAAK,WACH,OAAO,EAAEA,MAAM,UAAU;EAE3B,KAAK,YACH,OAAO,EAAEA,MAAM,WAAW;EAE5B,KAAK,QACH,OAAO;GAAEA,MAAM;GAAUE,SAASF,KAAKE,WAAW,CAAA;EAAG;EAGvD,SACE,OAAO,EAAEF,MAAM,SAAS;CAE5B;AACF;AAEA,SAAgBG,cAAcP,KAAkD;CAC9E,MAAMQ,WAAoC,CAAC;CAE3C,KAAK,MAAM,CAACC,MAAMC,QAAQlB,OAAOmB,QAAQX,IAAIY,IAAI,GAC/CJ,SAASC,QAAQ;EACfA;EACAI,aAAaH,IAAIG,eAAed,KAAAA;EAChCK,MAA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hB,WAAWD,KAAKY,SAAS;EAErC,IAAIK,KACF,OAAO;GAAE,GAAGpB,cAAcoB,GAAG;GAAG,GAAGN,QAAQO;EAAS;EAGtD,OAAOP,QAAQO;CACjB;CAIA,IAFkBP,QAAQS,MAAMC,MAAM,GAAG,CAAC,CAACC,IAEvCH,GACF,KAAK,MAAMjB,SAASa,OAAOQ,OAAOvB,IAAI,GAAG;EACvC,MAAMiB,MAAMhB,WAAWC,KAAK;EAE5B,IAAIe,KACF,OAAO;GAAE,GAAGpB,cAAcoB,GAAG;GAAG,GAAGN,QAAQO;EAAS;CAExD;CAGF,OAAOP,QAAQO;AACjB,CAAC;AAGH,MAAaL,aAAyB,EACpCW,MAAM;CACJC,QAAQ;EACNC,MAAM/B,WAAWgC;EACjBC,UAAU;CACZ;CACAC,MAAM/B;AACR,EACF;AAEA,MAAagC,aAAiD,CAAC/B,eAAe"}
@@ -0,0 +1,15 @@
1
+ import { DocsRenderer } from "./renderer.mjs";
2
+ import { parameters as parameters$1 } from "@storybook/addon-docs/preview";
3
+ //#region src/client/docs/preview-patch.ts
4
+ const baseParameters = parameters$1;
5
+ const parameters = {
6
+ ...baseParameters,
7
+ docs: {
8
+ ...baseParameters.docs,
9
+ renderer: () => Promise.resolve(new DocsRenderer())
10
+ }
11
+ };
12
+ //#endregion
13
+ export { parameters };
14
+
15
+ //# sourceMappingURL=preview-patch.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-patch.mjs","names":["parameters","baseParametersUntyped","DocsRenderer","baseParameters","docs","renderer","Promise","resolve"],"sources":["../../../src/client/docs/preview-patch.ts"],"sourcesContent":["import { parameters as baseParametersUntyped } from '@storybook/addon-docs/preview';\n\nimport { DocsRenderer } from './renderer';\n\n// Re-exports addon-docs' preview `parameters` with `docs.renderer` overridden by\n// our stable-key renderer (see DocsRenderer). The framework's Vite plugin\n// redirects the addon-docs preview annotation import to this module, so the docs\n// page keeps its React tree stable across re-renders instead of remounting it\n// (which destroyed the inline story canvases and caused a reload on globals\n// changes).\nconst baseParameters = baseParametersUntyped as {\n docs: { renderer?: () => Promise<unknown> };\n};\n\nexport const parameters = {\n ...baseParameters,\n docs: {\n ...baseParameters.docs,\n renderer: () => Promise.resolve(new DocsRenderer())\n }\n};\n"],"mappings":";;;AAUA,MAAMG,iBAAiBF;AAIvB,MAAaD,aAAa;CACxB,GAAGG;CACHC,MAAM;EACJ,GAAGD,eAAeC;EAClBC,gBAAgBC,QAAQC,QAAQ,IAAIL,aAAa,CAAC;CACpD;AACF"}
@@ -0,0 +1,48 @@
1
+ import { AnchorMdx, CodeOrSourceMdx, Docs, HeadersMdx } from "@storybook/addon-docs/blocks";
2
+ import { Component, createElement } from "react";
3
+ import { renderElement, unmountElement } from "@storybook/react-dom-shim";
4
+ //#region src/client/docs/renderer.ts
5
+ const defaultComponents = {
6
+ code: CodeOrSourceMdx,
7
+ a: AnchorMdx,
8
+ ...HeadersMdx
9
+ };
10
+ var ErrorBoundary = class extends Component {
11
+ state = { hasError: false };
12
+ static getDerivedStateFromError() {
13
+ return { hasError: true };
14
+ }
15
+ componentDidCatch(error) {
16
+ this.props.showException(error);
17
+ }
18
+ render() {
19
+ return this.state.hasError ? void 0 : this.props.children;
20
+ }
21
+ };
22
+ var DocsRenderer = class {
23
+ render = async (context, docsParameter, element) => {
24
+ const { MDXProvider } = await import("../../react-BcVz11Jd.mjs");
25
+ const components = {
26
+ ...defaultComponents,
27
+ ...docsParameter.components
28
+ };
29
+ const page = createElement(Docs, {
30
+ context,
31
+ docsParameter
32
+ });
33
+ const provided = createElement(MDXProvider, { components }, page);
34
+ const { promise: renderFailed, reject } = Promise.withResolvers();
35
+ const showException = (error) => {
36
+ reject(error);
37
+ };
38
+ const boundary = createElement(ErrorBoundary, { showException }, provided);
39
+ await Promise.race([renderElement(boundary, element), renderFailed]);
40
+ };
41
+ unmount = (element) => {
42
+ unmountElement(element);
43
+ };
44
+ };
45
+ //#endregion
46
+ export { DocsRenderer };
47
+
48
+ //# sourceMappingURL=renderer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.mjs","names":["AnchorMdx","CodeOrSourceMdx","Docs","HeadersMdx","renderElement","unmountElement","Component","createElement","defaultComponents","code","a","ErrorBoundary","state","hasError","getDerivedStateFromError","componentDidCatch","error","props","showException","render","undefined","children","DocsRenderer","context","docsParameter","element","MDXProvider","components","page","provided","promise","renderFailed","reject","Promise","withResolvers","boundary","race","unmount"],"sources":["../../../src/client/docs/renderer.ts"],"sourcesContent":["// This file is a fork of `@storybook/addon-docs`' `DocsRenderer`, copied from\n// `src/DocsRenderer.tsx` at version 10.5.0. It replicates the docs renderer\n// so we can override a single detail: the `ErrorBoundary` must NOT get a\n// `key={Math.random()}` (see below).\n//\n// RISK: this is a copy of addon-docs internals, not its public API. When\n// `@storybook/addon-docs` is upgraded, the upstream `DocsRenderer` can change\n// (new blocks, different component tree, changed lifecycle) and this fork will\n// silently drift, breaking the docs page. On every addon-docs bump, re-verify\n// this file against the upstream source and port any relevant changes.\nimport { AnchorMdx, CodeOrSourceMdx, Docs, HeadersMdx } from '@storybook/addon-docs/blocks';\nimport { renderElement, unmountElement } from '@storybook/react-dom-shim';\nimport { Component, createElement } from 'react';\n\nimport type { ReactNode } from 'react';\nimport type { DocsContextProps } from 'storybook/internal/types';\n\nconst defaultComponents = {\n code: CodeOrSourceMdx,\n a: AnchorMdx,\n ...HeadersMdx\n};\n\n// Replicates the docs renderer from `@storybook/addon-docs`, except that the\n// ErrorBoundary does NOT get a `key={Math.random()}`. That random key made React\n// unmount and remount the entire docs page on every re-render (e.g. when globals\n// change), which destroyed the inline story canvases and caused the addon to\n// reboot the Ember app. With a stable root the docs page reconciles in place and\n// the canvases stay alive.\n//\n// TRADE-OFF: the upstream key also reset the boundary's `hasError` state on\n// every render. Without it, a transient render error leaves the docs page\n// permanently blank (hasError is never reset) until the app is reloaded.\nclass ErrorBoundary extends Component<\n { showException: (error: unknown) => void; children?: ReactNode },\n { hasError: boolean }\n> {\n override state = { hasError: false };\n\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n override componentDidCatch(error: Error) {\n this.props.showException(error);\n }\n\n override render() {\n return this.state.hasError ? undefined : this.props.children;\n }\n}\n\nexport class DocsRenderer {\n render = async (\n context: DocsContextProps,\n docsParameter: { components?: Record<string, unknown> },\n element: HTMLElement\n ) => {\n const { MDXProvider } = await import('@mdx-js/react');\n\n const components = {\n ...defaultComponents,\n ...docsParameter.components\n } as never;\n\n const page = createElement(Docs, { context, docsParameter });\n const provided = createElement(MDXProvider, { components }, page);\n\n const { promise: renderFailed, reject } = Promise.withResolvers<never>();\n\n const showException = (error: unknown) => {\n reject(error);\n };\n\n const boundary = createElement(ErrorBoundary, { showException }, provided);\n\n await Promise.race([renderElement(boundary, element), renderFailed]);\n };\n\n unmount = (element: HTMLElement) => {\n unmountElement(element);\n };\n}\n"],"mappings":";;;;AAiBA,MAAMQ,oBAAoB;CACxBC,MAAMR;CACNS,GAAGV;CACH,GAAGG;AACL;AAYA,IAAMQ,gBAAN,cAA4BL,UAG1B;CACSM,QAAQ,EAAEC,UAAU,MAAM;CAEnC,OAAOC,2BAA2B;EAChC,OAAO,EAAED,UAAU,KAAK;CAC1B;CAESE,kBAAkBC,OAAc;EACvC,KAAKC,MAAMC,cAAcF,KAAK;CAChC;CAESG,SAAS;EAChB,OAAO,KAAKP,MAAMC,WAAWO,KAAAA,IAAY,KAAKH,MAAMI;CACtD;AACF;AAEA,IAAaC,eAAb,MAA0B;CACxBH,SAAS,OACPI,SACAC,eACAC,YACG;EACH,MAAM,EAAEC,gBAAgB,MAAM,OAAO;EAErC,MAAMC,aAAa;GACjB,GAAGnB;GACH,GAAGgB,cAAcG;EACnB;EAEA,MAAMC,OAAOrB,cAAcL,MAAM;GAAEqB;GAASC;EAAc,CAAC;EAC3D,MAAMK,WAAWtB,cAAcmB,aAAa,EAAEC,WAAW,GAAGC,IAAI;EAEhE,MAAM,EAAEE,SAASC,cAAcC,WAAWC,QAAQC,cAAqB;EAEvE,MAAMhB,iBAAiBF,UAAmB;GACxCgB,OAAOhB,KAAK;EACd;EAEA,MAAMmB,WAAW5B,cAAcI,eAAe,EAAEO,cAAc,GAAGW,QAAQ;EAEzE,MAAMI,QAAQG,KAAK,CAAChC,cAAc+B,UAAUV,OAAO,GAAGM,YAAY,CAAC;CACrE;CAEAM,WAAWZ,YAAyB;EAClCpB,eAAeoB,OAAO;CACxB;AACF"}
@@ -1,3 +1,3 @@
1
- import { n as renderToCanvas } from "../render-UnP87BCQ.mjs";
2
- import { n as setProjectAnnotations, t as RenderStory } from "../client-Cn86nY-K.mjs";
1
+ import { n as renderToCanvas } from "../render-D_vlc6Py.mjs";
2
+ import { n as setProjectAnnotations, t as RenderStory } from "../client-7-bGnBBX.mjs";
3
3
  export { RenderStory, renderToCanvas, setProjectAnnotations };
@@ -1,9 +1,10 @@
1
- import { r as render_exports } from "./render-UnP87BCQ.mjs";
1
+ import { r as render_exports } from "./render-D_vlc6Py.mjs";
2
+ import { r as normalizeStoryResult } from "./story-result-CCx6LMia.mjs";
2
3
  import { setDefaultProjectAnnotations, setProjectAnnotations } from "storybook/preview-api";
4
+ import { renderComponent } from "@ember/renderer";
3
5
  import { template } from "@ember/template-compiler";
4
6
  import Component from "@glimmer/component";
5
7
  import { getOwner } from "@ember/owner";
6
- import { renderComponent } from "@ember/renderer";
7
8
  import { modifier } from "ember-modifier";
8
9
  //#region src/client/globals.ts
9
10
  globalThis.STORYBOOK_ENV = "ember";
@@ -36,12 +37,11 @@ function setProjectAnnotations$1(projectAnnotations) {
36
37
  //#region src/client/render-story.gts
37
38
  var RenderStory = class extends Component {
38
39
  render = modifier((element) => {
39
- const component = this.args.story();
40
- const owner = getOwner(this);
40
+ const { component, args } = normalizeStoryResult(this.args.story(), this.args.args);
41
41
  const result = renderComponent(component, {
42
- args: this.args.args,
42
+ args,
43
43
  into: element,
44
- owner
44
+ owner: getOwner(this)
45
45
  });
46
46
  return () => {
47
47
  result.destroy();
@@ -59,4 +59,4 @@ var RenderStory = class extends Component {
59
59
  //#endregion
60
60
  export { setProjectAnnotations$1 as n, RenderStory as t };
61
61
 
62
- //# sourceMappingURL=client-Cn86nY-K.mjs.map
62
+ //# sourceMappingURL=client-7-bGnBBX.mjs.map