ember-storybook 0.3.1 → 0.3.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/client/docs/config.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,wBAAwB,EACxB,cAAc,EACf,MAAM,0BAA0B,CAAC;AAuBlC,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAC/B,OAAO,EAAE,wBAAwB,CAAC,aAAa,CAAC,KAC7C,cAAc,CAAC,EAoCnB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAQxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,aAAa,CAAC,EAAsB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/client/docs/config.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,wBAAwB,EACxB,cAAc,EACf,MAAM,0BAA0B,CAAC;AAuBlC,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAC/B,OAAO,EAAE,wBAAwB,CAAC,aAAa,CAAC,KAC7C,cAAc,CAAC,EAkCnB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAQxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,aAAa,CAAC,EAAsB,CAAC"}
@@ -1,9 +1,4 @@
1
1
  import type { ComponentSignature } from 'ember-docgen';
2
- /**
3
- * Returns a new argTypes object with entries sorted alphabetically by name,
4
- * matching Storybook's `alpha` sort order. The input object is not mutated.
5
- */
6
- export declare function sortArgTypes(argTypes: Record<string, unknown>): Record<string, unknown>;
7
2
  export declare function buildArgTypes(sig: ComponentSignature): Record<string, unknown>;
8
3
  /**
9
4
  * Merges signature-derived argTypes with the story-provided argTypes.
@@ -17,6 +12,12 @@ export declare function buildArgTypes(sig: ComponentSignature): Record<string, u
17
12
  * The `type` object is deep-merged: a story-provided partial `type` (e.g.
18
13
  * `type: 'string'`) keeps the signature's `required` flag unless the story
19
14
  * explicitly sets it, while the story's `type.name` still wins.
15
+ *
16
+ * Key order is meaningful: story-provided keys come first in the order the
17
+ * user defined them (user intent wins), followed by the remaining
18
+ * signature-derived keys in declaration order. Alphabetising is a display
19
+ * concern handled by Storybook itself (`parameters.controls.sort` for the
20
+ * panel, `parameters.docs.controls.sort` for the docs Controls block).
20
21
  */
21
22
  export declare function mergeArgTypes(signatureArgTypes: Record<string, unknown>, storyArgTypes: Record<string, unknown>): Record<string, unknown>;
22
23
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"extractArgTypes.d.ts","sourceRoot":"","sources":["../../../src/client/docs/extractArgTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAoCpE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEvF;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoB9E;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA8BzB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,kBAAkB,EACvB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,OAAO,CAET"}
1
+ {"version":3,"file":"extractArgTypes.d.ts","sourceRoot":"","sources":["../../../src/client/docs/extractArgTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAoCpE,wBAAgB,aAAa,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoB9E;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAC3B,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsCzB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,kBAAkB,EACvB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,OAAO,CAET"}
@@ -60,6 +60,18 @@ export interface OutletResolveInput {
60
60
  * `placeholder` renders the injected marker, anything else leaves a hole.
61
61
  */
62
62
  export declare function resolveOutletStub({ route, mode, placeholder }: OutletResolveInput): Promise<OutletStub | undefined>;
63
+ /**
64
+ * Whether the component's *own* template references `{{outlet}}` — i.e. it is a
65
+ * route template, which is how an unannotated route-story is recognized (#62).
66
+ *
67
+ * A template factory caches a per-owner (plus ownerless) `TemplateImpl`; its
68
+ * `parsedLayout.block` is the parsed wire-format tuple
69
+ * `[statements, locals, upvars]`. Free names — every helper/keyword the
70
+ * template resolves, from the whole template including nested blocks — live
71
+ * exactly once in `upvars`, so checking that slot cannot mistake a string
72
+ * literal `"-outlet"` used as an argument for a real outlet.
73
+ */
74
+ export declare function templateUsesOutlet(component: object): boolean;
63
75
  /**
64
76
  * Builds the `OutletState` for a route story.
65
77
  *
@@ -1 +1 @@
1
- {"version":3,"file":"outlet.d.ts","sourceRoot":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
- {"version":3,"file":"render-story.d.ts","sourceRoot":"","sources":["../../src/client/render-story.gts"],"names":[],"mappings":"AAgDA,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;;;;;;OAyBH;CASJ"}
1
+ {"version":3,"file":"render-story.d.ts","sourceRoot":"","sources":["../../src/client/render-story.gts"],"names":[],"mappings":"AAiDA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAS3C,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;;;;;;OAyBH;CASJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/client/render.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAGV,aAAa,EAGb,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAiB3E,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,aAAa,CAgB7C,CAAC;AA8LF,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,uBAwI9C"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/client/render.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAGV,aAAa,EAGb,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAiB3E,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,aAAa,CAgB7C,CAAC;AA8MF,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,uBAmK9C"}
@@ -24,7 +24,12 @@ export interface OutletStub {
24
24
  controller?: unknown;
25
25
  }
26
26
  /**
27
- * Opt-in marker that a story renders a *route* template rather than a component.
27
+ * Route options for a story that renders a *route* template rather than a
28
+ * component.
29
+ *
30
+ * A story is rendered as a route story when this parameter is present, or when
31
+ * the story's template references `{{outlet}}` (#62) — the latter implicitly,
32
+ * with empty route parameters.
28
33
  *
29
34
  * Route templates receive only `@model` and `@controller` (that is all Ember's
30
35
  * outlet hands them), and their `{{outlet}}` is stubbed via {@link OutletStub}.
@@ -45,7 +50,11 @@ export interface EmberParameters {
45
50
  configure?: (app: ApplicationInstance) => void;
46
51
  owner?: Record<`${string}:${string}`, object>;
47
52
  updateGlobals?: (globals: Record<string, unknown>, owner: Owner) => void;
48
- /** Present => render through Ember's outlet root so `{{outlet}}` works. */
53
+ /**
54
+ * Present => render through Ember's outlet root so `{{outlet}}` works.
55
+ * A template that uses `{{outlet}}` is rendered that way even without
56
+ * this parameter — then with empty route parameters (#62).
57
+ */
49
58
  route?: RouteParameters;
50
59
  };
51
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"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AAY;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,aAAc,SAAQ,WAAW;IAGhD,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,eAAe,CAAC;IAC5B,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,MAAM,YAAY,GAAG,mBAAmB,CAAC,aAAa,CAAC,GAAG;IAC9D,UAAU,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,GAAG,eAAe,CAAC;IAC/E,OAAO,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,GAAG,YAAY,CAAC;CACvE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as renderToCanvas, t as render } from "../render-DzZ1vCNM.mjs";
1
+ import { n as renderToCanvas, t as render } from "../render-DZQu-NF7.mjs";
2
2
  import { t as OUTLET_GLOBAL_KEY } from "../outlet-key-Dhm2WHYN.mjs";
3
3
  import { enhanceArgTypes } from "storybook/internal/docs-tools";
4
4
  //#region src/client/config.ts
@@ -21,13 +21,6 @@ function mapTypeToControl(type) {
21
21
  default: return { type: "object" };
22
22
  }
23
23
  }
24
- /**
25
- * Returns a new argTypes object with entries sorted alphabetically by name,
26
- * matching Storybook's `alpha` sort order. The input object is not mutated.
27
- */
28
- function sortArgTypes(argTypes) {
29
- return Object.fromEntries(Object.entries(argTypes).toSorted(([a], [b]) => a.localeCompare(b)));
30
- }
31
24
  function buildArgTypes(sig) {
32
25
  const argTypes = {};
33
26
  for (const [name, arg] of Object.entries(sig.args)) argTypes[name] = {
@@ -43,7 +36,7 @@ function buildArgTypes(sig) {
43
36
  defaultValue: arg.defaultValue ? { summary: arg.defaultValue } : void 0
44
37
  }
45
38
  };
46
- return sortArgTypes(argTypes);
39
+ return argTypes;
47
40
  }
48
41
  function isObject(value) {
49
42
  return typeof value === "object" && value !== null;
@@ -60,12 +53,18 @@ function isObject(value) {
60
53
  * The `type` object is deep-merged: a story-provided partial `type` (e.g.
61
54
  * `type: 'string'`) keeps the signature's `required` flag unless the story
62
55
  * explicitly sets it, while the story's `type.name` still wins.
56
+ *
57
+ * Key order is meaningful: story-provided keys come first in the order the
58
+ * user defined them (user intent wins), followed by the remaining
59
+ * signature-derived keys in declaration order. Alphabetising is a display
60
+ * concern handled by Storybook itself (`parameters.controls.sort` for the
61
+ * panel, `parameters.docs.controls.sort` for the docs Controls block).
63
62
  */
64
63
  function mergeArgTypes(signatureArgTypes, storyArgTypes) {
65
- const merged = { ...signatureArgTypes };
64
+ const merged = {};
66
65
  for (const [name, storyArg] of Object.entries(storyArgTypes)) {
67
66
  if (storyArg === void 0) continue;
68
- const sigArg = merged[name];
67
+ const sigArg = signatureArgTypes[name];
69
68
  if (!isObject(sigArg) || !isObject(storyArg)) {
70
69
  merged[name] = storyArg;
71
70
  continue;
@@ -81,6 +80,7 @@ function mergeArgTypes(signatureArgTypes, storyArgTypes) {
81
80
  };
82
81
  merged[name] = mergedArg;
83
82
  }
83
+ for (const [name, sigArg] of Object.entries(signatureArgTypes)) if (!Object.hasOwn(merged, name)) merged[name] = sigArg;
84
84
  return merged;
85
85
  }
86
86
  /**
@@ -701,17 +701,17 @@ const argTypesEnhancers = [(context) => {
701
701
  const filePath = context.parameters.fileName;
702
702
  if (filePath && Object.hasOwn(data, filePath)) {
703
703
  const sig = resolveSig(data[filePath]);
704
- if (sig) return sortArgTypes(mergeArgTypes(buildArgTypes(sig), context.argTypes));
705
- return sortArgTypes(context.argTypes);
704
+ if (sig) return mergeArgTypes(buildArgTypes(sig), context.argTypes);
705
+ return context.argTypes;
706
706
  }
707
707
  const leaf = titleLeaf(context.title);
708
708
  if (leaf) for (const entry of Object.values(data)) {
709
709
  if (!("meta" in entry)) continue;
710
710
  if (titleLeaf(entry.meta.title) !== leaf) continue;
711
711
  const sig = resolveSig(entry);
712
- if (sig) return sortArgTypes(mergeArgTypes(buildArgTypes(sig), context.argTypes));
712
+ if (sig) return mergeArgTypes(buildArgTypes(sig), context.argTypes);
713
713
  }
714
- return sortArgTypes(context.argTypes);
714
+ return context.argTypes;
715
715
  }];
716
716
  const parameters = { docs: {
717
717
  source: {
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":["mapTypeToControl","type","category","options","sortArgTypes","argTypes","Object","fromEntries","entries","toSorted","a","b","localeCompare","buildArgTypes","sig","name","arg","args","description","undefined","raw","required","control","table","summary","defaultValue","isObject","value","mergeArgTypes","signatureArgTypes","storyArgTypes","merged","storyArg","sigArg","storyFields","filter","mergedArg","shouldShowArgsSection","metaArgTypes","keys","length","unwrapBlockParams","DEFAULT_EXPORT","hasSignatureMap","entry","Object","hasOwn","componentDisplayName","ref","data","filePath","exportName","undefined","rawEntry","componentEntry","meta","applyModifiers","signature","modifiers","length","blockedKeys","Set","pickedKeys","mod","name","key","typeArgs","add","filtered","size","fromEntries","entries","args","filter","k","has","collectSubcomponents","blocks","seen","result","block","values","param","params","componentRef","importPath","local","push","signatures","sig","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","DocsContext","Subheading","createElement","Fragment","useContext","NAVIGATE_URL","styled","componentDisplayName","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","CodeLine","SubcomponentAnchor","name","children","context","hash","href","target","onClick","event","preventDefault","document","querySelector","CSS","escape","slice","scrollIntoView","behavior","block","channel","emit","displayTypeName","param","data","componentRef","local","undefined","type","isBlockParam","Object","hasOwn","isNamedParam","Boolean","startsWith","memberEntriesOf","nested","length","flatMap","entry","entries","renderTypeValue","subcomponentNames","displayType","has","key","descLine","depth","description","style","codeLine","paddingInlineStart","renderParamBlock","head","lines","i","memberName","memberParam","memberKey","memberEntries","push","desc","renderParams","params","keyPrefix","rows","BlocksTable","blocks","toSorted","nameA","_a","nameB","_b","displayName","className","BlocksSection","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","PureArgsTable","Subheading","createElement","styled","buildArgTypes","BlocksTable","ParamRow","ParamType","ElementBlock","H2","SubcomponentsSection","div","marginTop","marginBottom","SubEntry","SectionLabel","theme","fontWeight","color","defaultText","fontSize","typography","size","m1","renderSubcomponentSignature","sig","subcomponentNames","data","children","element","push","Object","keys","args","length","undefined","rows","blocks","key","style","SubcomponentsArea","components","Set","map","c","name","entries","comp","importPath","signature","id","Controls","Description","Primary","Stories","Subheading","Subtitle","Title","useOf","createElement","Fragment","emberData","BlocksSection","ElementBlock","CssPropertiesTable","PartsTable","SubcomponentsArea","H2","shouldShowArgsSection","collectSubcomponents","addSignature","signature","data","metaArgTypes","children","element","push","undefined","Object","keys","blocks","length","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","signatureName","signatures","argTypes","SourceType","emitTransformCode","useEffect","useRef","emberData","isEmberStoryResult","unwrapBlockParamsShallow","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","mergeArgTypes","sortArgTypes","Page","sourceDecorator","data","resolveSig","entry","undefined","comp","component","signatureName","compEntry","file","signatures","titleLeaf","title","split","pop","argTypesEnhancers","context","filePath","parameters","fileName","Object","hasOwn","sig","argTypes","leaf","values","meta","docs","source","type","DYNAMIC","language","page","decorators"],"sources":["../../../src/client/docs/extractArgTypes.ts","../../../src/client/docs/signature.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/page.ts","../../../src/client/docs/source-decorator.ts","../../../src/client/docs/config.ts"],"sourcesContent":["import type { ArgTypeInfo, ComponentSignature } from 'ember-docgen';\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\n/**\n * Returns a new argTypes object with entries sorted alphabetically by name,\n * matching Storybook's `alpha` sort order. The input object is not mutated.\n */\nexport function sortArgTypes(argTypes: Record<string, unknown>): Record<string, unknown> {\n return Object.fromEntries(Object.entries(argTypes).toSorted(([a], [b]) => a.localeCompare(b)));\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 sortArgTypes(argTypes);\n}\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Merges signature-derived argTypes with the story-provided argTypes.\n *\n * Signature argTypes are the base; story argTypes enhance them for better\n * rendering (custom `name`, `control`, `options`, ...). For args present in\n * both, story fields win — but only when they carry an actual value, so an\n * explicit `undefined` never masks a signature field. The signature keeps the\n * `table` and `description` the story does not override.\n *\n * The `type` object is deep-merged: a story-provided partial `type` (e.g.\n * `type: 'string'`) keeps the signature's `required` flag unless the story\n * explicitly sets it, while the story's `type.name` still wins.\n */\nexport function mergeArgTypes(\n signatureArgTypes: Record<string, unknown>,\n storyArgTypes: Record<string, unknown>\n): Record<string, unknown> {\n const merged: Record<string, unknown> = { ...signatureArgTypes };\n\n for (const [name, storyArg] of Object.entries(storyArgTypes)) {\n if (storyArg === undefined) continue;\n\n const sigArg = merged[name];\n\n if (!isObject(sigArg) || !isObject(storyArg)) {\n merged[name] = storyArg;\n continue;\n }\n\n const storyFields = Object.fromEntries(\n Object.entries(storyArg).filter(([, value]) => value !== undefined)\n );\n\n const mergedArg = { ...sigArg, ...storyFields };\n\n // Deep-merge `type` so a story-provided partial `type` does not drop the\n // signature's `required` flag (issue #48). The story's `type.name` still\n // wins; `required` survives unless the story explicitly sets it.\n if (isObject(sigArg.type) && isObject(storyFields.type)) {\n mergedArg.type = { ...sigArg.type, ...storyFields.type };\n }\n\n merged[name] = mergedArg;\n }\n\n return merged;\n}\n\n/**\n * Whether the docs page should render the Args/controls table: either the\n * component signature exposes args, or the meta carries story-provided\n * argTypes (e.g. for a template-only component with story argTypes but no\n * signature args).\n */\nexport function shouldShowArgsSection(\n sig: ComponentSignature,\n metaArgTypes?: Record<string, unknown>\n): boolean {\n return Object.keys(sig.args).length > 0 || Object.keys(metaArgTypes ?? {}).length > 0;\n}\n","import { unwrapBlockParams } from './block-params';\n\nimport type { ComponentMap } from '../../node/parser';\nimport type { ComponentFile, EmberMeta } from '../../node/types';\nimport type { BlockInfo, ComponentSignature } from 'ember-docgen';\n\n/**\n * Key used for default exports in signature/component maps. Mirrors\n * ember-docgen's `Default` sentinel — duplicated as a literal so client\n * code does not pull ember-docgen's node-only dependencies into the bundle.\n */\nexport const DEFAULT_EXPORT = '__DEFAULT__';\n\nexport interface SubcomponentRef {\n name: string;\n signature?: ComponentSignature;\n importPath?: string;\n}\n\n/**\n * Resolve the human-facing name of a referenced component export.\n *\n * Prefers the component's own declaration name over its export alias and\n * resolves the default-export sentinel to the real class name via the\n * component file's declaration map. Returns `undefined` when no better\n * name is known.\n */\nfunction hasSignatureMap(entry: unknown): entry is ComponentFile {\n return typeof entry === 'object' && entry !== null && Object.hasOwn(entry, 'signatures');\n}\n\nexport function componentDisplayName(\n ref: undefined | { filePath?: string; exportName?: string },\n data: EmberMeta\n): string | undefined {\n if (!ref?.filePath || !ref.exportName) return undefined;\n\n const rawEntry: unknown = data[ref.filePath];\n\n const componentEntry = hasSignatureMap(rawEntry) ? rawEntry : undefined;\n\n if (!componentEntry) {\n return ref.exportName === DEFAULT_EXPORT ? undefined : ref.exportName;\n }\n\n // Transitive component files contribute only `signatures` (no declaration\n // map) — fall back to the export name instead of the unresolved meta.\n const meta = (componentEntry as { meta?: ComponentMap }).meta;\n\n if (ref.exportName === DEFAULT_EXPORT) {\n return meta?.[DEFAULT_EXPORT];\n }\n\n return meta?.[ref.exportName] ?? ref.exportName;\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 // Local components (non-exported) are named by the yield key — the\n // declaration name is an implementation detail.\n const name = param.componentRef.local\n ? param.name\n : (componentDisplayName(param.componentRef, data) ?? param.name);\n\n if (seen.has(name)) {\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n continue;\n }\n\n seen.add(name);\n\n if (importPath) {\n result.push({ 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,\n signature: applyModifiers(sig, modifiers)\n });\n }\n } else if (filePath) {\n // Project-local file without an extractable signature\n // (e.g. a bare template-only component) — still list it by name.\n result.push({ name });\n }\n }\n }\n\n return result;\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 { DocsContext, Subheading } from '@storybook/addon-docs/blocks';\nimport { createElement, Fragment, type MouseEvent, type ReactNode, useContext } from 'react';\nimport { NAVIGATE_URL } from 'storybook/internal/core-events';\nimport { styled } from 'storybook/theming';\n\nimport { componentDisplayName } from '../signature';\nimport { TableWrapper } from './ui';\n\nimport type { EmberMeta } from '../../../node/types';\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 CodeLine = styled.div(({ theme }) => ({\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px'\n}));\n\n/**\n * In-page anchor to a subcomponent section. Mirrors Storybook's own\n * in-docs navigation (TableOfContents / AnchorInPage): the default anchor\n * behavior is prevented — it would resolve against the preview iframe's\n * `<base>` and navigate away from Storybook — and instead the docs page\n * scrolls to the target while `NAVIGATE_URL` keeps the address-bar hash\n * (deep-linkable) in sync via the manager.\n */\nfunction SubcomponentAnchor({ name, children }: { name: string; children?: ReactNode }) {\n const context = useContext(DocsContext);\n const hash = `#subcomponent-${name}`;\n\n return createElement(\n SubcomponentLink,\n {\n href: hash,\n target: '_self',\n onClick: (event: MouseEvent) => {\n event.preventDefault();\n\n const target = document.querySelector(`#${CSS.escape(hash.slice(1))}`);\n\n if (target) {\n target.scrollIntoView({ behavior: 'smooth', block: 'start' });\n context.channel.emit(NAVIGATE_URL, hash);\n }\n }\n },\n children\n );\n}\n\n/** Display name for a block param's type: the referenced component's own\n * name when available, the yield key for local components, otherwise the\n * raw type string. */\nfunction displayTypeName(param: BlockParam, data?: EmberMeta): string {\n if (param.componentRef?.local) return param.name;\n\n return (data ? componentDisplayName(param.componentRef, data) : undefined) ?? param.type;\n}\n\nfunction isBlockParam(param: BlockParam | HashBlockParam): param is BlockParam {\n return Object.hasOwn(param, 'name') && Object.hasOwn(param, 'type');\n}\n\ntype MemberEntry = [name: string, param: BlockParam];\n\nfunction isNamedParam(name: string): boolean {\n return Boolean(name) && !name.startsWith('param');\n}\n\n/**\n * A `BlockParam` whose type was unfolded from a named non-component type is\n * an object just like an inline yield hash — normalize its members to\n * `[name, param]` entries. `undefined` for scalar params.\n */\nfunction memberEntriesOf(param: BlockParam): MemberEntry[] | undefined {\n const nested = param.nested;\n\n if (!nested || nested.length === 0) return undefined;\n\n return nested.flatMap((entry): MemberEntry[] =>\n isBlockParam(entry) ? [[entry.name, entry]] : Object.entries(entry)\n );\n}\n\nfunction renderTypeValue(\n param: BlockParam,\n subcomponentNames: Set<string>,\n data?: EmberMeta\n): ReactNode {\n const displayType = displayTypeName(param, data);\n\n return subcomponentNames.has(displayType)\n ? createElement(SubcomponentAnchor, { key: 'type', name: displayType }, displayType)\n : createElement(ParamType, { key: 'type' }, displayType);\n}\n\nfunction descLine(param: BlockParam, key: string, depth?: number): ReactNode | undefined {\n if (!param.description) return undefined;\n\n const style = depth === undefined ? undefined : { marginBottom: 0, marginLeft: depth * 20 + 10 };\n\n return createElement(ParamDesc, { key, style }, param.description);\n}\n\nfunction codeLine(key: string, depth: number, children: ReactNode[]): ReactNode {\n return createElement(CodeLine, { key, style: { paddingInlineStart: depth * 20 } }, ...children);\n}\n\n/**\n * Render an object param JSON-style: an opening brace line (optionally\n * prefixed `name: `), member lines one level deeper, and a closing brace —\n * no dashes, no blank lines between the object's lines. Object members\n * recurse; scalar members render as `name: type`.\n */\nfunction renderParamBlock(\n name: string | undefined,\n entries: MemberEntry[],\n subcomponentNames: Set<string>,\n data: EmberMeta | undefined,\n depth: number,\n key: string\n): ReactNode[] {\n const head: ReactNode[] = name ? [createElement(ParamName, { key: `${key}-n` }, name), ': '] : [];\n\n const lines = [codeLine(`${key}-o`, depth, [...head, '{'])];\n\n for (const [i, [memberName, memberParam]] of entries.entries()) {\n const memberKey = `${key}-${i}`;\n const memberEntries = memberEntriesOf(memberParam);\n\n if (memberEntries) {\n lines.push(\n ...renderParamBlock(\n memberName,\n memberEntries,\n subcomponentNames,\n data,\n depth + 1,\n memberKey\n )\n );\n } else {\n lines.push(\n codeLine(`${memberKey}-l`, depth + 1, [\n createElement(ParamName, { key: `${memberKey}-n` }, memberName),\n ': ',\n renderTypeValue(memberParam, subcomponentNames, data)\n ])\n );\n }\n\n const desc = descLine(memberParam, `${memberKey}-d`, depth + 1);\n\n if (desc) lines.push(desc);\n }\n\n lines.push(codeLine(`${key}-x`, depth, ['}']));\n\n return lines;\n}\n\nfunction renderParams(\n params: BlockInfo['params'],\n subcomponentNames: Set<string>,\n data?: EmberMeta,\n keyPrefix = 'p'\n): ReactNode[] {\n return params.flatMap((param, i) => {\n const key = `${keyPrefix}-${i}`;\n\n if (!isBlockParam(param)) {\n // Inline yield hash — an object, never a dashed list item.\n return renderParamBlock(undefined, Object.entries(param), subcomponentNames, data, 0, key);\n }\n\n const entries = memberEntriesOf(param);\n\n if (entries) {\n // A named non-component type unfolded into its members — an object.\n const name = isNamedParam(param.name) ? param.name : undefined;\n const lines = renderParamBlock(name, entries, subcomponentNames, data, 0, key);\n const desc = descLine(param, `${key}-d`, 0);\n\n if (desc) lines.push(desc);\n\n return lines;\n }\n\n // Positional param — a list item with a dash.\n const type = renderTypeValue(param, subcomponentNames, data);\n const children: ReactNode[] = isNamedParam(param.name)\n ? ['- ', createElement(ParamName, { key: 'name' }, param.name), ': ', type]\n : ['- ', type];\n\n const rows: ReactNode[] = [createElement(ParamRow, { key: 'row' }, ...children)];\n const desc = descLine(param, 'desc');\n\n if (desc) rows.push(desc);\n\n return createElement(Fragment, { key }, ...rows);\n });\n}\n\nexport function BlocksTable({\n blocks,\n subcomponentNames,\n data\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n data?: EmberMeta;\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}>`;\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, data);\n\n rows.push(\n createElement('tr', { key: `${name}-params` }, createElement('td', undefined, ...params))\n );\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 data\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n data?: EmberMeta;\n}) {\n return createElement(\n BlocksDiv,\n undefined,\n createElement(Subheading, undefined, 'Blocks'),\n BlocksTable({ blocks, subcomponentNames, data })\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 { PureArgsTable, Subheading } from '@storybook/addon-docs/blocks';\nimport { createElement, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { buildArgTypes } from '../extractArgTypes';\nimport { BlocksTable, ParamRow, ParamType } from './blocks';\nimport { ElementBlock } from './element';\nimport { H2 } from './ui';\n\nimport type { EmberMeta } from '../../../node/types';\nimport type { SubcomponentRef } from '../signature';\nimport type { ComponentSignature } from 'ember-docgen';\nimport type { ArgTypes } from 'storybook/internal/types';\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 data?: EmberMeta\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 // Render from the subcomponent's own signature — the global argTypes\n // store only carries the main component's args.\n children.push(\n createElement(SectionLabel, undefined, 'Args'),\n createElement(PureArgsTable, { rows: buildArgTypes(sig) as ArgTypes })\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, data })\n );\n }\n\n return children;\n}\n\nexport function SubcomponentsArea({\n components,\n data\n}: {\n components: SubcomponentRef[];\n data?: EmberMeta;\n}) {\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, data));\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 {\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 { shouldShowArgsSection } from './extractArgTypes';\nimport { collectSubcomponents } from './signature';\n\nimport type { EmberMeta } from '../../node/types';\nimport type { ComponentSignature } from 'ember-docgen';\n\nfunction addSignature(\n signature: ComponentSignature,\n data: EmberMeta,\n metaArgTypes?: Record<string, unknown>\n) {\n const children: ReactNode[] = [];\n\n if (signature.element) {\n children.push(createElement(ElementBlock, { element: signature.element }));\n }\n\n // Render unfiltered — the argTypes enhancer already merges\n // buildArgTypes(signature) into the store, so this mirrors\n // the Controls panel exactly. Also render story-provided argTypes\n // when the signature has no args (e.g. template-only components).\n if (shouldShowArgsSection(signature, metaArgTypes)) {\n children.push(createElement(Subheading, undefined, 'Args'), createElement(Controls));\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(\n createElement(BlocksSection, { blocks: signature.blocks, subcomponentNames, data })\n );\n\n if (subcomponents.length > 0) {\n children.push(createElement(SubcomponentsArea, { components: subcomponents, data }));\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 EmberMeta;\n const storyFile = resolved.preparedMeta?.parameters?.fileName as string | undefined;\n const storyEntry = storyFile ? data[storyFile] : undefined;\n const storyComponent = storyEntry && 'component' in storyEntry ? storyEntry.component : undefined;\n const compFile = storyComponent?.file;\n const compEntry = compFile ? data[compFile] : undefined;\n const signatureName = storyComponent?.signatureName ?? '';\n const signature =\n compEntry && 'signatures' in compEntry ? compEntry.signatures[signatureName] : undefined;\n\n const children: ReactNode[] = [\n createElement(Title),\n createElement(Subtitle),\n createElement(Description),\n createElement(Primary)\n ];\n\n if (signature) {\n children.push(...addSignature(signature, data, resolved.preparedMeta?.argTypes));\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 { unwrapBlockParamsShallow } 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 = unwrapBlockParamsShallow(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 = unwrapBlockParamsShallow(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, mergeArgTypes, sortArgTypes } 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\n/** Last path segment of a CSF title — used to match stories without `fileName`. */\nfunction titleLeaf(title: string | undefined): string | undefined {\n return title?.split('/').pop();\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 sortArgTypes(mergeArgTypes(buildArgTypes(sig), context.argTypes)) as StrictArgTypes;\n }\n\n return sortArgTypes(context.argTypes) as StrictArgTypes;\n }\n\n // No `parameters.fileName` — fall back to matching the CSF title leaf\n // against indexed story files instead of picking an arbitrary signature.\n const leaf = titleLeaf(context.title);\n\n if (leaf) {\n for (const entry of Object.values(data)) {\n if (!('meta' in entry)) continue;\n\n if (titleLeaf(entry.meta.title) !== leaf) continue;\n\n const sig = resolveSig(entry);\n\n if (sig) {\n return sortArgTypes(\n mergeArgTypes(buildArgTypes(sig), context.argTypes)\n ) as StrictArgTypes;\n }\n }\n }\n\n return sortArgTypes(context.argTypes) as StrictArgTypes;\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":";;;;;;;;;;AAEA,SAASA,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;EAGv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QE,WAAuCC;CAEjE,IAAIF,YAAYG,OAAOC,OAAOpB,MAAMgB,QAAQ,GAAG;EAC7C,MAAMK,MAAMpB,WAAWD,KAAKgB,SAAS;EAErC,IAAIK,KACF,OAAOxB,aAAaD,cAAcD,cAAc0B,GAAG,GAAGN,QAAQO,QAAQ,CAAC;EAGzE,OAAOzB,aAAakB,QAAQO,QAAQ;CACtC;CAIA,MAAMC,OAAOb,UAAUK,QAAQJ,KAAK;CAEpC,IAAIY,MACF,KAAK,MAAMrB,SAASiB,OAAOK,OAAOxB,IAAI,GAAG;EACvC,IAAI,EAAE,UAAUE,QAAQ;EAExB,IAAIQ,UAAUR,MAAMuB,KAAKd,KAAK,MAAMY,MAAM;EAE1C,MAAMF,MAAMpB,WAAWC,KAAK;EAE5B,IAAImB,KACF,OAAOxB,aACLD,cAAcD,cAAc0B,GAAG,GAAGN,QAAQO,QAAQ,CACpD;CAEJ;CAGF,OAAOzB,aAAakB,QAAQO,QAAQ;AACtC,CAAC;AAGH,MAAaL,aAAyB,EACpCS,MAAM;CACJC,QAAQ;EACNC,MAAMnC,WAAWoC;EACjBC,UAAU;CACZ;CACAC,MAAMjC;AACR,EACF;AAEA,MAAakC,aAAiD,CAACjC,eAAe"}
1
+ {"version":3,"file":"config.mjs","names":["mapTypeToControl","type","category","options","buildArgTypes","sig","argTypes","name","arg","Object","entries","args","description","undefined","raw","required","control","table","summary","defaultValue","isObject","value","mergeArgTypes","signatureArgTypes","storyArgTypes","merged","storyArg","sigArg","storyFields","fromEntries","filter","mergedArg","hasOwn","shouldShowArgsSection","metaArgTypes","keys","length","unwrapBlockParams","DEFAULT_EXPORT","hasSignatureMap","entry","Object","hasOwn","componentDisplayName","ref","data","filePath","exportName","undefined","rawEntry","componentEntry","meta","applyModifiers","signature","modifiers","length","blockedKeys","Set","pickedKeys","mod","name","key","typeArgs","add","filtered","size","fromEntries","entries","args","filter","k","has","collectSubcomponents","blocks","seen","result","block","values","param","params","componentRef","importPath","local","push","signatures","sig","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","DocsContext","Subheading","createElement","Fragment","useContext","NAVIGATE_URL","styled","componentDisplayName","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","CodeLine","SubcomponentAnchor","name","children","context","hash","href","target","onClick","event","preventDefault","document","querySelector","CSS","escape","slice","scrollIntoView","behavior","block","channel","emit","displayTypeName","param","data","componentRef","local","undefined","type","isBlockParam","Object","hasOwn","isNamedParam","Boolean","startsWith","memberEntriesOf","nested","length","flatMap","entry","entries","renderTypeValue","subcomponentNames","displayType","has","key","descLine","depth","description","style","codeLine","paddingInlineStart","renderParamBlock","head","lines","i","memberName","memberParam","memberKey","memberEntries","push","desc","renderParams","params","keyPrefix","rows","BlocksTable","blocks","toSorted","nameA","_a","nameB","_b","displayName","className","BlocksSection","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","PureArgsTable","Subheading","createElement","styled","buildArgTypes","BlocksTable","ParamRow","ParamType","ElementBlock","H2","SubcomponentsSection","div","marginTop","marginBottom","SubEntry","SectionLabel","theme","fontWeight","color","defaultText","fontSize","typography","size","m1","renderSubcomponentSignature","sig","subcomponentNames","data","children","element","push","Object","keys","args","length","undefined","rows","blocks","key","style","SubcomponentsArea","components","Set","map","c","name","entries","comp","importPath","signature","id","Controls","Description","Primary","Stories","Subheading","Subtitle","Title","useOf","createElement","Fragment","emberData","BlocksSection","ElementBlock","CssPropertiesTable","PartsTable","SubcomponentsArea","H2","shouldShowArgsSection","collectSubcomponents","addSignature","signature","data","metaArgTypes","children","element","push","undefined","Object","keys","blocks","length","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","signatureName","signatures","argTypes","SourceType","emitTransformCode","useEffect","useRef","emberData","isEmberStoryResult","unwrapBlockParamsShallow","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","mergeArgTypes","Page","sourceDecorator","data","resolveSig","entry","undefined","comp","component","signatureName","compEntry","file","signatures","titleLeaf","title","split","pop","argTypesEnhancers","context","filePath","parameters","fileName","Object","hasOwn","sig","argTypes","leaf","values","meta","docs","source","type","DYNAMIC","language","page","decorators"],"sources":["../../../src/client/docs/extractArgTypes.ts","../../../src/client/docs/signature.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/page.ts","../../../src/client/docs/source-decorator.ts","../../../src/client/docs/config.ts"],"sourcesContent":["import type { ArgTypeInfo, ComponentSignature } from 'ember-docgen';\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\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Merges signature-derived argTypes with the story-provided argTypes.\n *\n * Signature argTypes are the base; story argTypes enhance them for better\n * rendering (custom `name`, `control`, `options`, ...). For args present in\n * both, story fields win — but only when they carry an actual value, so an\n * explicit `undefined` never masks a signature field. The signature keeps the\n * `table` and `description` the story does not override.\n *\n * The `type` object is deep-merged: a story-provided partial `type` (e.g.\n * `type: 'string'`) keeps the signature's `required` flag unless the story\n * explicitly sets it, while the story's `type.name` still wins.\n *\n * Key order is meaningful: story-provided keys come first in the order the\n * user defined them (user intent wins), followed by the remaining\n * signature-derived keys in declaration order. Alphabetising is a display\n * concern handled by Storybook itself (`parameters.controls.sort` for the\n * panel, `parameters.docs.controls.sort` for the docs Controls block).\n */\nexport function mergeArgTypes(\n signatureArgTypes: Record<string, unknown>,\n storyArgTypes: Record<string, unknown>\n): Record<string, unknown> {\n const merged: Record<string, unknown> = {};\n\n // Story keys first, in the order the user defined them.\n for (const [name, storyArg] of Object.entries(storyArgTypes)) {\n if (storyArg === undefined) continue;\n\n const sigArg = signatureArgTypes[name];\n\n if (!isObject(sigArg) || !isObject(storyArg)) {\n merged[name] = storyArg;\n continue;\n }\n\n const storyFields = Object.fromEntries(\n Object.entries(storyArg).filter(([, value]) => value !== undefined)\n );\n\n const mergedArg = { ...sigArg, ...storyFields };\n\n // Deep-merge `type` so a story-provided partial `type` does not drop the\n // signature's `required` flag (issue #48). The story's `type.name` still\n // wins; `required` survives unless the story explicitly sets it.\n if (isObject(sigArg.type) && isObject(storyFields.type)) {\n mergedArg.type = { ...sigArg.type, ...storyFields.type };\n }\n\n merged[name] = mergedArg;\n }\n\n // Signature-only keys follow, in the component's declaration order.\n for (const [name, sigArg] of Object.entries(signatureArgTypes)) {\n if (!Object.hasOwn(merged, name)) {\n merged[name] = sigArg;\n }\n }\n\n return merged;\n}\n\n/**\n * Whether the docs page should render the Args/controls table: either the\n * component signature exposes args, or the meta carries story-provided\n * argTypes (e.g. for a template-only component with story argTypes but no\n * signature args).\n */\nexport function shouldShowArgsSection(\n sig: ComponentSignature,\n metaArgTypes?: Record<string, unknown>\n): boolean {\n return Object.keys(sig.args).length > 0 || Object.keys(metaArgTypes ?? {}).length > 0;\n}\n","import { unwrapBlockParams } from './block-params';\n\nimport type { ComponentMap } from '../../node/parser';\nimport type { ComponentFile, EmberMeta } from '../../node/types';\nimport type { BlockInfo, ComponentSignature } from 'ember-docgen';\n\n/**\n * Key used for default exports in signature/component maps. Mirrors\n * ember-docgen's `Default` sentinel — duplicated as a literal so client\n * code does not pull ember-docgen's node-only dependencies into the bundle.\n */\nexport const DEFAULT_EXPORT = '__DEFAULT__';\n\nexport interface SubcomponentRef {\n name: string;\n signature?: ComponentSignature;\n importPath?: string;\n}\n\n/**\n * Resolve the human-facing name of a referenced component export.\n *\n * Prefers the component's own declaration name over its export alias and\n * resolves the default-export sentinel to the real class name via the\n * component file's declaration map. Returns `undefined` when no better\n * name is known.\n */\nfunction hasSignatureMap(entry: unknown): entry is ComponentFile {\n return typeof entry === 'object' && entry !== null && Object.hasOwn(entry, 'signatures');\n}\n\nexport function componentDisplayName(\n ref: undefined | { filePath?: string; exportName?: string },\n data: EmberMeta\n): string | undefined {\n if (!ref?.filePath || !ref.exportName) return undefined;\n\n const rawEntry: unknown = data[ref.filePath];\n\n const componentEntry = hasSignatureMap(rawEntry) ? rawEntry : undefined;\n\n if (!componentEntry) {\n return ref.exportName === DEFAULT_EXPORT ? undefined : ref.exportName;\n }\n\n // Transitive component files contribute only `signatures` (no declaration\n // map) — fall back to the export name instead of the unresolved meta.\n const meta = (componentEntry as { meta?: ComponentMap }).meta;\n\n if (ref.exportName === DEFAULT_EXPORT) {\n return meta?.[DEFAULT_EXPORT];\n }\n\n return meta?.[ref.exportName] ?? ref.exportName;\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 // Local components (non-exported) are named by the yield key — the\n // declaration name is an implementation detail.\n const name = param.componentRef.local\n ? param.name\n : (componentDisplayName(param.componentRef, data) ?? param.name);\n\n if (seen.has(name)) {\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n continue;\n }\n\n seen.add(name);\n\n if (importPath) {\n result.push({ 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,\n signature: applyModifiers(sig, modifiers)\n });\n }\n } else if (filePath) {\n // Project-local file without an extractable signature\n // (e.g. a bare template-only component) — still list it by name.\n result.push({ name });\n }\n }\n }\n\n return result;\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 { DocsContext, Subheading } from '@storybook/addon-docs/blocks';\nimport { createElement, Fragment, type MouseEvent, type ReactNode, useContext } from 'react';\nimport { NAVIGATE_URL } from 'storybook/internal/core-events';\nimport { styled } from 'storybook/theming';\n\nimport { componentDisplayName } from '../signature';\nimport { TableWrapper } from './ui';\n\nimport type { EmberMeta } from '../../../node/types';\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 CodeLine = styled.div(({ theme }) => ({\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px'\n}));\n\n/**\n * In-page anchor to a subcomponent section. Mirrors Storybook's own\n * in-docs navigation (TableOfContents / AnchorInPage): the default anchor\n * behavior is prevented — it would resolve against the preview iframe's\n * `<base>` and navigate away from Storybook — and instead the docs page\n * scrolls to the target while `NAVIGATE_URL` keeps the address-bar hash\n * (deep-linkable) in sync via the manager.\n */\nfunction SubcomponentAnchor({ name, children }: { name: string; children?: ReactNode }) {\n const context = useContext(DocsContext);\n const hash = `#subcomponent-${name}`;\n\n return createElement(\n SubcomponentLink,\n {\n href: hash,\n target: '_self',\n onClick: (event: MouseEvent) => {\n event.preventDefault();\n\n const target = document.querySelector(`#${CSS.escape(hash.slice(1))}`);\n\n if (target) {\n target.scrollIntoView({ behavior: 'smooth', block: 'start' });\n context.channel.emit(NAVIGATE_URL, hash);\n }\n }\n },\n children\n );\n}\n\n/** Display name for a block param's type: the referenced component's own\n * name when available, the yield key for local components, otherwise the\n * raw type string. */\nfunction displayTypeName(param: BlockParam, data?: EmberMeta): string {\n if (param.componentRef?.local) return param.name;\n\n return (data ? componentDisplayName(param.componentRef, data) : undefined) ?? param.type;\n}\n\nfunction isBlockParam(param: BlockParam | HashBlockParam): param is BlockParam {\n return Object.hasOwn(param, 'name') && Object.hasOwn(param, 'type');\n}\n\ntype MemberEntry = [name: string, param: BlockParam];\n\nfunction isNamedParam(name: string): boolean {\n return Boolean(name) && !name.startsWith('param');\n}\n\n/**\n * A `BlockParam` whose type was unfolded from a named non-component type is\n * an object just like an inline yield hash — normalize its members to\n * `[name, param]` entries. `undefined` for scalar params.\n */\nfunction memberEntriesOf(param: BlockParam): MemberEntry[] | undefined {\n const nested = param.nested;\n\n if (!nested || nested.length === 0) return undefined;\n\n return nested.flatMap((entry): MemberEntry[] =>\n isBlockParam(entry) ? [[entry.name, entry]] : Object.entries(entry)\n );\n}\n\nfunction renderTypeValue(\n param: BlockParam,\n subcomponentNames: Set<string>,\n data?: EmberMeta\n): ReactNode {\n const displayType = displayTypeName(param, data);\n\n return subcomponentNames.has(displayType)\n ? createElement(SubcomponentAnchor, { key: 'type', name: displayType }, displayType)\n : createElement(ParamType, { key: 'type' }, displayType);\n}\n\nfunction descLine(param: BlockParam, key: string, depth?: number): ReactNode | undefined {\n if (!param.description) return undefined;\n\n const style = depth === undefined ? undefined : { marginBottom: 0, marginLeft: depth * 20 + 10 };\n\n return createElement(ParamDesc, { key, style }, param.description);\n}\n\nfunction codeLine(key: string, depth: number, children: ReactNode[]): ReactNode {\n return createElement(CodeLine, { key, style: { paddingInlineStart: depth * 20 } }, ...children);\n}\n\n/**\n * Render an object param JSON-style: an opening brace line (optionally\n * prefixed `name: `), member lines one level deeper, and a closing brace —\n * no dashes, no blank lines between the object's lines. Object members\n * recurse; scalar members render as `name: type`.\n */\nfunction renderParamBlock(\n name: string | undefined,\n entries: MemberEntry[],\n subcomponentNames: Set<string>,\n data: EmberMeta | undefined,\n depth: number,\n key: string\n): ReactNode[] {\n const head: ReactNode[] = name ? [createElement(ParamName, { key: `${key}-n` }, name), ': '] : [];\n\n const lines = [codeLine(`${key}-o`, depth, [...head, '{'])];\n\n for (const [i, [memberName, memberParam]] of entries.entries()) {\n const memberKey = `${key}-${i}`;\n const memberEntries = memberEntriesOf(memberParam);\n\n if (memberEntries) {\n lines.push(\n ...renderParamBlock(\n memberName,\n memberEntries,\n subcomponentNames,\n data,\n depth + 1,\n memberKey\n )\n );\n } else {\n lines.push(\n codeLine(`${memberKey}-l`, depth + 1, [\n createElement(ParamName, { key: `${memberKey}-n` }, memberName),\n ': ',\n renderTypeValue(memberParam, subcomponentNames, data)\n ])\n );\n }\n\n const desc = descLine(memberParam, `${memberKey}-d`, depth + 1);\n\n if (desc) lines.push(desc);\n }\n\n lines.push(codeLine(`${key}-x`, depth, ['}']));\n\n return lines;\n}\n\nfunction renderParams(\n params: BlockInfo['params'],\n subcomponentNames: Set<string>,\n data?: EmberMeta,\n keyPrefix = 'p'\n): ReactNode[] {\n return params.flatMap((param, i) => {\n const key = `${keyPrefix}-${i}`;\n\n if (!isBlockParam(param)) {\n // Inline yield hash — an object, never a dashed list item.\n return renderParamBlock(undefined, Object.entries(param), subcomponentNames, data, 0, key);\n }\n\n const entries = memberEntriesOf(param);\n\n if (entries) {\n // A named non-component type unfolded into its members — an object.\n const name = isNamedParam(param.name) ? param.name : undefined;\n const lines = renderParamBlock(name, entries, subcomponentNames, data, 0, key);\n const desc = descLine(param, `${key}-d`, 0);\n\n if (desc) lines.push(desc);\n\n return lines;\n }\n\n // Positional param — a list item with a dash.\n const type = renderTypeValue(param, subcomponentNames, data);\n const children: ReactNode[] = isNamedParam(param.name)\n ? ['- ', createElement(ParamName, { key: 'name' }, param.name), ': ', type]\n : ['- ', type];\n\n const rows: ReactNode[] = [createElement(ParamRow, { key: 'row' }, ...children)];\n const desc = descLine(param, 'desc');\n\n if (desc) rows.push(desc);\n\n return createElement(Fragment, { key }, ...rows);\n });\n}\n\nexport function BlocksTable({\n blocks,\n subcomponentNames,\n data\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n data?: EmberMeta;\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}>`;\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, data);\n\n rows.push(\n createElement('tr', { key: `${name}-params` }, createElement('td', undefined, ...params))\n );\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 data\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n data?: EmberMeta;\n}) {\n return createElement(\n BlocksDiv,\n undefined,\n createElement(Subheading, undefined, 'Blocks'),\n BlocksTable({ blocks, subcomponentNames, data })\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 { PureArgsTable, Subheading } from '@storybook/addon-docs/blocks';\nimport { createElement, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { buildArgTypes } from '../extractArgTypes';\nimport { BlocksTable, ParamRow, ParamType } from './blocks';\nimport { ElementBlock } from './element';\nimport { H2 } from './ui';\n\nimport type { EmberMeta } from '../../../node/types';\nimport type { SubcomponentRef } from '../signature';\nimport type { ComponentSignature } from 'ember-docgen';\nimport type { ArgTypes } from 'storybook/internal/types';\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 data?: EmberMeta\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 // Render from the subcomponent's own signature — the global argTypes\n // store only carries the main component's args.\n children.push(\n createElement(SectionLabel, undefined, 'Args'),\n createElement(PureArgsTable, { rows: buildArgTypes(sig) as ArgTypes })\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, data })\n );\n }\n\n return children;\n}\n\nexport function SubcomponentsArea({\n components,\n data\n}: {\n components: SubcomponentRef[];\n data?: EmberMeta;\n}) {\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, data));\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 {\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 { shouldShowArgsSection } from './extractArgTypes';\nimport { collectSubcomponents } from './signature';\n\nimport type { EmberMeta } from '../../node/types';\nimport type { ComponentSignature } from 'ember-docgen';\n\nfunction addSignature(\n signature: ComponentSignature,\n data: EmberMeta,\n metaArgTypes?: Record<string, unknown>\n) {\n const children: ReactNode[] = [];\n\n if (signature.element) {\n children.push(createElement(ElementBlock, { element: signature.element }));\n }\n\n // Render unfiltered — the argTypes enhancer already merges\n // buildArgTypes(signature) into the store, so this mirrors\n // the Controls panel exactly. Also render story-provided argTypes\n // when the signature has no args (e.g. template-only components).\n if (shouldShowArgsSection(signature, metaArgTypes)) {\n children.push(createElement(Subheading, undefined, 'Args'), createElement(Controls));\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(\n createElement(BlocksSection, { blocks: signature.blocks, subcomponentNames, data })\n );\n\n if (subcomponents.length > 0) {\n children.push(createElement(SubcomponentsArea, { components: subcomponents, data }));\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 EmberMeta;\n const storyFile = resolved.preparedMeta?.parameters?.fileName as string | undefined;\n const storyEntry = storyFile ? data[storyFile] : undefined;\n const storyComponent = storyEntry && 'component' in storyEntry ? storyEntry.component : undefined;\n const compFile = storyComponent?.file;\n const compEntry = compFile ? data[compFile] : undefined;\n const signatureName = storyComponent?.signatureName ?? '';\n const signature =\n compEntry && 'signatures' in compEntry ? compEntry.signatures[signatureName] : undefined;\n\n const children: ReactNode[] = [\n createElement(Title),\n createElement(Subtitle),\n createElement(Description),\n createElement(Primary)\n ];\n\n if (signature) {\n children.push(...addSignature(signature, data, resolved.preparedMeta?.argTypes));\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 { unwrapBlockParamsShallow } 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 = unwrapBlockParamsShallow(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 = unwrapBlockParamsShallow(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, mergeArgTypes } 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\n/** Last path segment of a CSF title — used to match stories without `fileName`. */\nfunction titleLeaf(title: string | undefined): string | undefined {\n return title?.split('/').pop();\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 mergeArgTypes(buildArgTypes(sig), context.argTypes) as StrictArgTypes;\n }\n\n return context.argTypes;\n }\n\n // No `parameters.fileName` — fall back to matching the CSF title leaf\n // against indexed story files instead of picking an arbitrary signature.\n const leaf = titleLeaf(context.title);\n\n if (leaf) {\n for (const entry of Object.values(data)) {\n if (!('meta' in entry)) continue;\n\n if (titleLeaf(entry.meta.title) !== leaf) continue;\n\n const sig = resolveSig(entry);\n\n if (sig) {\n return mergeArgTypes(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":";;;;;;;;;;AAEA,SAASA,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,cAAcC,KAAkD;CAC9E,MAAMC,WAAoC,CAAC;CAE3C,KAAK,MAAM,CAACC,MAAMC,QAAQC,OAAOC,QAAQL,IAAIM,IAAI,GAC/CL,SAASC,QAAQ;EACfA;EACAK,aAAaJ,IAAII,eAAeC,KAAAA;EAChCZ,MAAM;GACJM,MAAMC,IAAIP,KAAKa;GACfC,UAAUP,IAAIO;EAChB;EACAC,SAAShB,iBAAiBQ,IAAIP,IAAI;EAClCgB,OAAO;GACLhB,MAAM,EAAEiB,SAASV,IAAIP,KAAKa,IAAI;GAC9BK,cAAcX,IAAIW,eAAe,EAAED,SAASV,IAAIW,aAAa,IAAIN,KAAAA;EACnE;CACF;CAGF,OAAOP;AACT;AAEA,SAASc,SAASC,OAAkD;CAClE,OAAO,OAAOA,UAAU,YAAYA,UAAU;AAChD;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgBC,cACdC,mBACAC,eACyB;CACzB,MAAMC,SAAkC,CAAC;CA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C,eAAe"}
@@ -1,4 +1,4 @@
1
- import { n as renderToCanvas } from "../render-DzZ1vCNM.mjs";
2
- import { n as setProjectAnnotations, t as RenderStory } from "../client-BN1WZuKz.mjs";
3
- import { t as OutletPlaceholder } from "../outlet-placeholder-BL2iFDVf.mjs";
1
+ import { n as renderToCanvas } from "../render-DZQu-NF7.mjs";
2
+ import { n as setProjectAnnotations, t as RenderStory } from "../client-704tbFeh.mjs";
3
+ import { t as OutletPlaceholder } from "../outlet-placeholder-C1-eUqzj.mjs";
4
4
  export { OutletPlaceholder, RenderStory, renderToCanvas, setProjectAnnotations };
@@ -1,5 +1,5 @@
1
- import { r as render_exports } from "./render-DzZ1vCNM.mjs";
2
- import "./outlet-placeholder-BL2iFDVf.mjs";
1
+ import { i as templateUsesOutlet, r as render_exports } from "./render-DZQu-NF7.mjs";
2
+ import "./outlet-placeholder-C1-eUqzj.mjs";
3
3
  import { r as normalizeStoryResult } from "./story-result-D9erht0M.mjs";
4
4
  import { template } from "@ember/template-compiler";
5
5
  import { setDefaultProjectAnnotations, setProjectAnnotations } from "storybook/preview-api";
@@ -40,7 +40,7 @@ var RenderStory = class extends Component {
40
40
  render = modifier((element) => {
41
41
  const { component, args, route } = normalizeStoryResult(this.args.story(), this.args.args);
42
42
  const owner = getOwner(this);
43
- if (route) throw new Error("ember-storybook: this story sets `parameters.ember.route`, but route stories can only be rendered by `renderToCanvas`, not through <RenderStory> (portable stories).");
43
+ if (route || templateUsesOutlet(component)) throw new Error("ember-storybook: this story renders a route template (it uses `{{outlet}}`), but route stories can only be rendered by `renderToCanvas`, not through <RenderStory> (portable stories).");
44
44
  const result = renderComponent(component, {
45
45
  args,
46
46
  into: element,
@@ -62,4 +62,4 @@ var RenderStory = class extends Component {
62
62
  //#endregion
63
63
  export { setProjectAnnotations$1 as n, RenderStory as t };
64
64
 
65
- //# sourceMappingURL=client-BN1WZuKz.mjs.map
65
+ //# sourceMappingURL=client-704tbFeh.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-BN1WZuKz.mjs","names":["globalThis","STORYBOOK_ENV","setDefaultProjectAnnotations","setProjectAnnotations","originalSetProjectAnnotations","INTERNAL_DEFAULT_PROJECT_ANNOTATIONS","projectAnnotations"],"sources":["../src/client/globals.ts","../src/client/portable-stories.ts","../src/client/render-story.gts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\n// eslint-disable-next-line unicorn/no-global-object-property-assignment\nglobalThis.STORYBOOK_ENV = 'ember';\n","import {\n setDefaultProjectAnnotations,\n setProjectAnnotations as originalSetProjectAnnotations\n} from 'storybook/preview-api';\n\nimport * as INTERNAL_DEFAULT_PROJECT_ANNOTATIONS from './render';\n\nimport type { EmberRenderer } from './types';\nimport type {\n NamedOrDefaultProjectAnnotations,\n NormalizedProjectAnnotations\n} from 'storybook/internal/types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/preact';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations:\n | NamedOrDefaultProjectAnnotations<EmberRenderer>\n | NamedOrDefaultProjectAnnotations<EmberRenderer>[]\n): NormalizedProjectAnnotations<EmberRenderer> {\n setDefaultProjectAnnotations(INTERNAL_DEFAULT_PROJECT_ANNOTATIONS);\n\n return originalSetProjectAnnotations(projectAnnotations);\n}\n","import Component from '@glimmer/component';\nimport { getOwner } from '@ember/owner';\nimport { renderComponent } from '@ember/renderer';\n\nimport { modifier } from 'ember-modifier';\n\nimport { normalizeStoryResult } from './story-result';\n\ninterface RenderStorySignature {\n Args: {\n story: () => object;\n args: Record<string, unknown>;\n };\n Element: HTMLDivElement;\n}\n\nexport class RenderStory extends Component<RenderStorySignature> {\n render = modifier((element: HTMLDivElement) => {\n const story = this.args.story();\n const { component, args, route } = normalizeStoryResult(story, this.args.args);\n const owner = getOwner(this);\n\n if (route) {\n // `{{outlet}}` is resolved from Glimmer's dynamic scope, which only a root\n // render can seed. Rendering it in here would nest a second outlet root\n // inside an already-rendering tree, so route stories are canvas-only.\n throw new Error(\n 'ember-storybook: this story sets `parameters.ember.route`, but route stories ' +\n 'can only be rendered by `renderToCanvas`, not through <RenderStory> ' +\n '(portable stories).'\n );\n }\n\n const result = renderComponent(component, {\n args,\n into: element,\n owner\n });\n\n return () => {\n result.destroy();\n };\n });\n\n <template>\n <div {{this.render}}></div>\n </template>\n}\n"],"mappings":";;;;;;;;;;AAGAA,WAAWC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;AC6B3B,SAAgBE,wBACdG,oBAG6C;CAC7CJ,6BAA6BG,cAAoC;CAEjE,OAAOD,sBAA8BE,kBAAkB;AACzD;;;ACxBA,IAAa,cAAb,cAAiC,UAAU;CACzC,SAAS,UAAU,YAAS;EAE1B,MAAM,EAAE,WAAW,MAAM,UAAU,qBADrB,KAAK,KAAK,MACgC,GAAO,KAAK,KAAK,IAAI;EAC7E,MAAM,QAAQ,SAAS,IAAI;EAE3B,IAAI,OAIF,MAAM,IAAI,MACR,sKAEE;EAIN,MAAM,SAAS,gBAAgB,WAAW;GACxC;GACA,MAAM;GACN;EACF,CAAA;EAEA,aAAO;GACL,OAAO,QAAO;EAChB;CACF,CAAA;CAEA;EAAA,SAAU,+BAEV;GAAA,WAAA;GAAA,OAAA;IAAA,OAAA,KAAA,UAAA,EAAW;GAAD;EAAA,CAAA;CAAA;AACZ"}
1
+ {"version":3,"file":"client-704tbFeh.mjs","names":["globalThis","STORYBOOK_ENV","setDefaultProjectAnnotations","setProjectAnnotations","originalSetProjectAnnotations","INTERNAL_DEFAULT_PROJECT_ANNOTATIONS","projectAnnotations"],"sources":["../src/client/globals.ts","../src/client/portable-stories.ts","../src/client/render-story.gts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\n// eslint-disable-next-line unicorn/no-global-object-property-assignment\nglobalThis.STORYBOOK_ENV = 'ember';\n","import {\n setDefaultProjectAnnotations,\n setProjectAnnotations as originalSetProjectAnnotations\n} from 'storybook/preview-api';\n\nimport * as INTERNAL_DEFAULT_PROJECT_ANNOTATIONS from './render';\n\nimport type { EmberRenderer } from './types';\nimport type {\n NamedOrDefaultProjectAnnotations,\n NormalizedProjectAnnotations\n} from 'storybook/internal/types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/preact';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations:\n | NamedOrDefaultProjectAnnotations<EmberRenderer>\n | NamedOrDefaultProjectAnnotations<EmberRenderer>[]\n): NormalizedProjectAnnotations<EmberRenderer> {\n setDefaultProjectAnnotations(INTERNAL_DEFAULT_PROJECT_ANNOTATIONS);\n\n return originalSetProjectAnnotations(projectAnnotations);\n}\n","import Component from '@glimmer/component';\nimport { getOwner } from '@ember/owner';\nimport { renderComponent } from '@ember/renderer';\n\nimport { modifier } from 'ember-modifier';\n\nimport { templateUsesOutlet } from './outlet';\nimport { normalizeStoryResult } from './story-result';\n\ninterface RenderStorySignature {\n Args: {\n story: () => object;\n args: Record<string, unknown>;\n };\n Element: HTMLDivElement;\n}\n\nexport class RenderStory extends Component<RenderStorySignature> {\n render = modifier((element: HTMLDivElement) => {\n const story = this.args.story();\n const { component, args, route } = normalizeStoryResult(story, this.args.args);\n const owner = getOwner(this);\n\n if (route || templateUsesOutlet(component)) {\n // `{{outlet}}` is resolved from Glimmer's dynamic scope, which only a root\n // render can seed. Rendering it in here would nest a second outlet root\n // inside an already-rendering tree, so route stories are canvas-only.\n throw new Error(\n 'ember-storybook: this story renders a route template (it uses `{{outlet}}`), ' +\n 'but route stories can only be rendered by `renderToCanvas`, not through ' +\n '<RenderStory> (portable stories).'\n );\n }\n\n const result = renderComponent(component, {\n args,\n into: element,\n owner\n });\n\n return () => {\n result.destroy();\n };\n });\n\n <template>\n <div {{this.render}}></div>\n </template>\n}\n"],"mappings":";;;;;;;;;;AAGAA,WAAWC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;AC6B3B,SAAgBE,wBACdG,oBAG6C;CAC7CJ,6BAA6BG,cAAoC;CAEjE,OAAOD,sBAA8BE,kBAAkB;AACzD;;;ACvBA,IAAa,cAAb,cAAiC,UAAU;CACzC,SAAS,UAAU,YAAS;EAE1B,MAAM,EAAE,WAAW,MAAM,UAAU,qBADrB,KAAK,KAAK,MACgC,GAAO,KAAK,KAAK,IAAI;EAC7E,MAAM,QAAQ,SAAS,IAAI;EAE3B,IAAI,SAAS,mBAAmB,SAAA,GAI9B,MAAM,IAAI,MACR,wLAEE;EAIN,MAAM,SAAS,gBAAgB,WAAW;GACxC;GACA,MAAM;GACN;EACF,CAAA;EAEA,aAAO;GACL,OAAO,QAAO;EAChB;CACF,CAAA;CAEA;EAAA,SAAU,+BAEV;GAAA,WAAA;GAAA,OAAA;IAAA,OAAA,KAAA,UAAA,EAAW;GAAD;EAAA,CAAA;CAAA;AACZ"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as renderToCanvas } from "./render-DzZ1vCNM.mjs";
2
- import { n as setProjectAnnotations, t as RenderStory } from "./client-BN1WZuKz.mjs";
3
- import { t as OutletPlaceholder } from "./outlet-placeholder-BL2iFDVf.mjs";
1
+ import { n as renderToCanvas } from "./render-DZQu-NF7.mjs";
2
+ import { n as setProjectAnnotations, t as RenderStory } from "./client-704tbFeh.mjs";
3
+ import { t as OutletPlaceholder } from "./outlet-placeholder-C1-eUqzj.mjs";
4
4
  export { OutletPlaceholder, RenderStory, renderToCanvas, setProjectAnnotations };
@@ -1,4 +1,4 @@
1
- import { i as __exportAll } from "./render-DzZ1vCNM.mjs";
1
+ import { a as __exportAll } from "./render-DZQu-NF7.mjs";
2
2
  import { template } from "@ember/template-compiler";
3
3
  //#region src/client/outlet-placeholder.gts
4
4
  var outlet_placeholder_exports = /* @__PURE__ */ __exportAll({ OutletPlaceholder: () => OutletPlaceholder });
@@ -28,4 +28,4 @@ const OutletPlaceholder = template(`<div
28
28
  //#endregion
29
29
  export { outlet_placeholder_exports as n, OutletPlaceholder as t };
30
30
 
31
- //# sourceMappingURL=outlet-placeholder-BL2iFDVf.mjs.map
31
+ //# sourceMappingURL=outlet-placeholder-C1-eUqzj.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"outlet-placeholder-BL2iFDVf.mjs","names":[],"sources":["../src/client/outlet-placeholder.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\n\ninterface OutletPlaceholderSignature {\n Element: HTMLDivElement;\n Args: {\n /** Shown inside the box. A route template only receives `@model`. */\n model?: string;\n };\n}\n\n/**\n * A visible stand-in for `{{outlet}}`, for route stories where an empty hole is\n * hard to see (e.g. on the docs page).\n *\n * It is rendered *as a route template*, so it must be template-only (the outlet\n * only accepts a raw template or an internal-manager component) and the only\n * value it can receive is `@model` — pass a string to label the box:\n *\n * ```js\n * parameters: {\n * ember: { route: { outlet: { template: OutletPlaceholder, model: 'settings' } } }\n * }\n * ```\n */\nexport const OutletPlaceholder: TOC<OutletPlaceholderSignature> = <template>\n <div\n class=\"ember-storybook-outlet-placeholder\"\n style=\"border: 1px dashed #999; padding: 0.5rem; color: #666; font: italic 0.8rem/1.4 monospace;\"\n data-storybook-outlet\n >\n {{if @model @model \"outlet\"}}\n </div>\n</template>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,MAAa,oBAAqD,SAAU;;;;;;SAQ5E,EAAA,OAAA;CAAA,OAAA,KAAA,UAAA,EAAW;AAAD,EAAA,CAAA"}
1
+ {"version":3,"file":"outlet-placeholder-C1-eUqzj.mjs","names":[],"sources":["../src/client/outlet-placeholder.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\n\ninterface OutletPlaceholderSignature {\n Element: HTMLDivElement;\n Args: {\n /** Shown inside the box. A route template only receives `@model`. */\n model?: string;\n };\n}\n\n/**\n * A visible stand-in for `{{outlet}}`, for route stories where an empty hole is\n * hard to see (e.g. on the docs page).\n *\n * It is rendered *as a route template*, so it must be template-only (the outlet\n * only accepts a raw template or an internal-manager component) and the only\n * value it can receive is `@model` — pass a string to label the box:\n *\n * ```js\n * parameters: {\n * ember: { route: { outlet: { template: OutletPlaceholder, model: 'settings' } } }\n * }\n * ```\n */\nexport const OutletPlaceholder: TOC<OutletPlaceholderSignature> = <template>\n <div\n class=\"ember-storybook-outlet-placeholder\"\n style=\"border: 1px dashed #999; padding: 0.5rem; color: #666; font: italic 0.8rem/1.4 monospace;\"\n data-storybook-outlet\n >\n {{if @model @model \"outlet\"}}\n </div>\n</template>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,MAAa,oBAAqD,SAAU;;;;;;SAQ5E,EAAA,OAAA;CAAA,OAAA,KAAA,UAAA,EAAW;AAAD,EAAA,CAAA"}
@@ -6,6 +6,7 @@ import ApplicationInstance from "@ember/application/instance";
6
6
  import { destroy } from "@ember/destroyable";
7
7
  import { renderComponent, renderSettled } from "@ember/renderer";
8
8
  import { VERSION } from "@ember/version";
9
+ import { getComponentTemplate } from "@ember/component";
9
10
  import { run } from "@ember/runloop";
10
11
  //#region \0rolldown/runtime.js
11
12
  var __defProp = Object.defineProperty;
@@ -42,6 +43,42 @@ async function resolveOutletStub({ route, mode, placeholder }) {
42
43
  if (route.outlet?.template) return route.outlet;
43
44
  return mode === "placeholder" ? await placeholder() : void 0;
44
45
  }
46
+ /**
47
+ * The name `{{outlet}}` compiles to: the built-in keyword helper
48
+ * `{{component (-outlet)}}` (see ember-source's `transform-wrap-mount-and-outlet`).
49
+ */
50
+ const OUTLET_KEYWORD = "-outlet";
51
+ /**
52
+ * The ownerless template a template factory hands out, reduced to the one
53
+ * intimate API we read. `parsedLayout` is deliberately absent from Ember's
54
+ * public types (ember-source keeps it "because some addons use these intimate
55
+ * APIs"), so the shape is declared here rather than imported.
56
+ */
57
+ /**
58
+ * Story components are normally classes or template-only components (both
59
+ * reachable via `getComponentTemplate`); a raw `createTemplateFactory` result
60
+ * used directly as the component is only recognizable by its `__meta` marker.
61
+ */
62
+ function asTemplateFactory(component) {
63
+ return typeof component === "function" && "__meta" in component ? component : void 0;
64
+ }
65
+ /**
66
+ * Whether the component's *own* template references `{{outlet}}` — i.e. it is a
67
+ * route template, which is how an unannotated route-story is recognized (#62).
68
+ *
69
+ * A template factory caches a per-owner (plus ownerless) `TemplateImpl`; its
70
+ * `parsedLayout.block` is the parsed wire-format tuple
71
+ * `[statements, locals, upvars]`. Free names — every helper/keyword the
72
+ * template resolves, from the whole template including nested blocks — live
73
+ * exactly once in `upvars`, so checking that slot cannot mistake a string
74
+ * literal `"-outlet"` used as an argument for a real outlet.
75
+ */
76
+ function templateUsesOutlet(component) {
77
+ const factory = getComponentTemplate(component) ?? asTemplateFactory(component);
78
+ if (!factory) return false;
79
+ const block = factory(void 0)?.parsedLayout?.block;
80
+ return Array.isArray(block) && Array.isArray(block[2]) && block[2].includes(OUTLET_KEYWORD);
81
+ }
45
82
  function mainOutlet(child) {
46
83
  return { main: child };
47
84
  }
@@ -165,6 +202,12 @@ function relevantGlobals(route, globals) {
165
202
  }
166
203
  const contexts = /* @__PURE__ */ new Map();
167
204
  /**
205
+ * Route parameters assumed for a story whose template references `{{outlet}}`
206
+ * but that never set `parameters.ember.route` (#62). Frozen and module-level so
207
+ * the identity is stable across renders of the same story.
208
+ */
209
+ const DEFAULT_ROUTE = Object.freeze({});
210
+ /**
168
211
  * Tears the mounted story down, leaving the booted app alone so it can be
169
212
  * reused.
170
213
  *
@@ -187,7 +230,7 @@ function teardownMount(context) {
187
230
  * story — down with it.
188
231
  */
189
232
  async function loadPlaceholderStub() {
190
- const { OutletPlaceholder } = await import("./outlet-placeholder-BL2iFDVf.mjs").then((n) => n.n);
233
+ const { OutletPlaceholder } = await import("./outlet-placeholder-C1-eUqzj.mjs").then((n) => n.n);
191
234
  return {
192
235
  name: "outlet",
193
236
  template: OutletPlaceholder
@@ -245,9 +288,14 @@ async function bootApp(storyContext, canvasElement) {
245
288
  application.unregister(key);
246
289
  application.register(key, obj);
247
290
  }
248
- ember.configure?.(application);
249
- await application.boot();
250
- ember.updateGlobals?.(storyContext.globals, application);
291
+ try {
292
+ ember.configure?.(application);
293
+ await application.boot();
294
+ ember.updateGlobals?.(storyContext.globals, application);
295
+ } catch (error) {
296
+ destroy(application);
297
+ throw error;
298
+ }
251
299
  return application;
252
300
  }
253
301
  async function renderToCanvas({ storyFn, showMain, storyContext, forceRemount }, canvasElement) {
@@ -259,7 +307,7 @@ async function renderToCanvas({ storyFn, showMain, storyContext, forceRemount },
259
307
  destroy(context.application);
260
308
  }
261
309
  const { component, args, route: routeFromStory } = normalizeStoryResult(storyFn(), storyContext.args);
262
- const route = routeFromStory ?? storyContext.parameters.ember?.route;
310
+ const route = routeFromStory ?? storyContext.parameters.ember?.route ?? (templateUsesOutlet(component) ? DEFAULT_ROUTE : void 0);
263
311
  const existing = contexts.get(canvasElement);
264
312
  const previousGlobals = relevantGlobals(route, existing?.globals ?? {});
265
313
  const currentGlobals = relevantGlobals(route, storyContext.globals);
@@ -267,63 +315,73 @@ async function renderToCanvas({ storyFn, showMain, storyContext, forceRemount },
267
315
  if (existing && !forceRemount && !globalsChanged && shallowEqual(existing.args, args)) return () => {
268
316
  unregister(canvasElement);
269
317
  };
270
- if (route && existing?.outletView && !forceRemount) {
271
- if (globalsChanged) storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, existing.application);
272
- await updateOutletView(existing.outletView, await routeOutletState({
318
+ let application;
319
+ let mount;
320
+ try {
321
+ if (route && existing?.outletView && !forceRemount) {
322
+ if (globalsChanged) storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, existing.application);
323
+ await updateOutletView(existing.outletView, await routeOutletState({
324
+ component,
325
+ args,
326
+ route,
327
+ globals: storyContext.globals,
328
+ storyName: storyContext.name,
329
+ application: existing.application
330
+ }));
331
+ contexts.set(canvasElement, {
332
+ ...existing,
333
+ args,
334
+ globals: { ...storyContext.globals }
335
+ });
336
+ showMain();
337
+ return () => {
338
+ unregister(canvasElement);
339
+ };
340
+ }
341
+ const canReuseApp = existing !== void 0 && !forceRemount && Boolean(existing.outletView) === Boolean(route);
342
+ if (isEmberBelow(6, 12)) {
343
+ if (existing) unregister(canvasElement);
344
+ application = await bootApp(storyContext, canvasElement);
345
+ } else if (canReuseApp) {
346
+ if (globalsChanged) storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, existing.application);
347
+ application = existing.application;
348
+ teardownMount(existing);
349
+ } else {
350
+ if (existing) unregister(canvasElement);
351
+ application = await bootApp(storyContext, canvasElement);
352
+ }
353
+ mount = document.createElement("div");
354
+ canvasElement.append(mount);
355
+ const mounted = await mountStory({
356
+ application,
273
357
  component,
274
358
  args,
275
359
  route,
276
360
  globals: storyContext.globals,
277
361
  storyName: storyContext.name,
278
- application: existing.application
279
- }));
362
+ mount
363
+ });
280
364
  contexts.set(canvasElement, {
281
- ...existing,
365
+ application,
366
+ mount,
282
367
  args,
283
- globals: { ...storyContext.globals }
368
+ globals: { ...storyContext.globals },
369
+ ...mounted
284
370
  });
285
371
  showMain();
286
372
  return () => {
287
373
  unregister(canvasElement);
288
374
  };
375
+ } catch (error) {
376
+ if (contexts.has(canvasElement)) unregister(canvasElement);
377
+ else {
378
+ mount?.remove();
379
+ if (application) destroy(application);
380
+ }
381
+ throw error;
289
382
  }
290
- const canReuseApp = existing !== void 0 && !forceRemount && Boolean(existing.outletView) === Boolean(route);
291
- let application;
292
- if (isEmberBelow(6, 12)) {
293
- if (existing) unregister(canvasElement);
294
- application = await bootApp(storyContext, canvasElement);
295
- } else if (canReuseApp) {
296
- if (globalsChanged) storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, existing.application);
297
- application = existing.application;
298
- teardownMount(existing);
299
- } else {
300
- if (existing) unregister(canvasElement);
301
- application = await bootApp(storyContext, canvasElement);
302
- }
303
- const mount = document.createElement("div");
304
- canvasElement.append(mount);
305
- const mounted = await mountStory({
306
- application,
307
- component,
308
- args,
309
- route,
310
- globals: storyContext.globals,
311
- storyName: storyContext.name,
312
- mount
313
- });
314
- contexts.set(canvasElement, {
315
- application,
316
- mount,
317
- args,
318
- globals: { ...storyContext.globals },
319
- ...mounted
320
- });
321
- showMain();
322
- return () => {
323
- unregister(canvasElement);
324
- };
325
383
  }
326
384
  //#endregion
327
- export { __exportAll as i, renderToCanvas as n, render_exports as r, render as t };
385
+ export { __exportAll as a, templateUsesOutlet as i, renderToCanvas as n, render_exports as r, render as t };
328
386
 
329
- //# sourceMappingURL=render-DzZ1vCNM.mjs.map
387
+ //# sourceMappingURL=render-DZQu-NF7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-DZQu-NF7.mjs","names":["getComponentTemplate","renderSettled","run","DEFAULT_OUTLET_NAME","resolveOutletStub","route","mode","placeholder","outlet","template","undefined","OUTLET_KEYWORD","asTemplateFactory","component","templateUsesOutlet","factory","block","parsedLayout","Array","isArray","includes","mainOutlet","child","main","buildChildRenderState","stub","owner","render","name","model","controller","outlets","buildRouteOutletState","args","storyName","createOutletView","container","state","element","factoryFor","Error","view","create","environment","lookup","application","setOutletState","appendTo","mountOutletView","updateOutletView","Application","ApplicationInstance","destroy","renderComponent","VERSION","OUTLET_GLOBAL_KEY","buildRouteOutletState","mountOutletView","resolveOutletStub","templateUsesOutlet","updateOutletView","createAppResolver","normalizeStoryResult","isEmberBelow","major","minor","maj","min","split","map","Number","render","args","context","id","component","ember","parameters","route","Error","shallowEqual","a","b","aKeys","Object","keys","bKeys","length","every","key","hasOwn","is","withoutOutletGlobal","globals","fromEntries","entries","filter","relevantGlobals","contexts","Map","DEFAULT_ROUTE","freeze","teardownMount","renderer","mount","remove","loadPlaceholderStub","OutletPlaceholder","name","template","routeOutletState","storyName","application","outlet","mode","placeholder","owner","mountStory","into","outletView","resolveAppOption","applicationInstance","initApp","appOption","opts","bootApp","storyContext","canvasElement","app","options","toLowerCase","includes","join","rootElement","obj","unregister","register","configure","boot","updateGlobals","error","renderToCanvas","storyFn","showMain","forceRemount","element","get","delete","storyResult","routeFromStory","undefined","existing","previousGlobals","currentGlobals","globalsChanged","set","canReuseApp","Boolean","document","createElement","append","mounted","has"],"sources":["../src/client/outlet.ts","../src/client/render.ts"],"sourcesContent":["import { getComponentTemplate } from '@ember/component';\nimport { renderSettled } from '@ember/renderer';\nimport { run } from '@ember/runloop';\n\nimport type { OutletMode, OutletStub, RouteParameters } from './types';\nimport type ApplicationInstance from '@ember/application/instance';\n\n/**\n * What Ember's outlet hands a route template. A route template is *not* a\n * component story: it receives exactly `@model` and `@controller`, because that\n * is all `{{outlet}}` passes down (`OUTLET_COMPONENT_TEMPLATE` in ember-source).\n */\nexport interface OutletRenderState {\n owner: object;\n name: string;\n controller: unknown;\n model: unknown;\n template: object;\n}\n\n/**\n * Mirrors ember-source's internal `OutletState`. The shape is structural, not\n * nominal, so a plain object is accepted by `setOutletState`; the leaf's\n * `outlets.main` is what a nested `{{outlet}}` reads.\n */\nexport interface OutletState {\n render: OutletRenderState;\n outlets: { main: OutletState | undefined };\n}\n\nexport interface RouteStoryInput {\n /** The route template — the story's `component`. */\n template: object;\n /** `parameters.ember.route`. */\n route: RouteParameters;\n /**\n * The resolved stub for `{{outlet}}` — see {@link resolveOutletStub}.\n * `undefined` leaves the outlet as a hole.\n */\n outlet?: OutletStub;\n /** Final (decorated) story args; `model`/`controller` feed the route. */\n args: Record<string, unknown>;\n /** Story name, used when `route.name` is not given. */\n storyName: string;\n /** The booted app instance the route renders under. */\n owner: object;\n}\n\nconst DEFAULT_OUTLET_NAME = 'outlet';\n\nexport interface OutletResolveInput {\n /** `parameters.ember.route` of the story being rendered. */\n route: RouteParameters;\n /** Value of the `outlet` global (see `src/outlet-key.ts`), if any. */\n mode?: OutletMode;\n /**\n * Produces the stub rendered when the global asks for a visible placeholder.\n * Called lazily (and so may be an async chunk load) and only when needed;\n * injected so this module stays free of Ember-owned template components.\n */\n placeholder: () => OutletStub | Promise<OutletStub>;\n}\n\n/**\n * Decides what `{{outlet}}` renders.\n *\n * An explicit `route.outlet` is author intent and always wins, so a story stays\n * deterministic no matter how the toolbar is set. Otherwise the global decides:\n * `placeholder` renders the injected marker, anything else leaves a hole.\n */\nexport async function resolveOutletStub({\n route,\n mode,\n placeholder\n}: OutletResolveInput): Promise<OutletStub | undefined> {\n if (route.outlet?.template) {\n return route.outlet;\n }\n\n return mode === 'placeholder' ? await placeholder() : undefined;\n}\n\n/**\n * The name `{{outlet}}` compiles to: the built-in keyword helper\n * `{{component (-outlet)}}` (see ember-source's `transform-wrap-mount-and-outlet`).\n */\nconst OUTLET_KEYWORD = '-outlet';\n\n/**\n * The ownerless template a template factory hands out, reduced to the one\n * intimate API we read. `parsedLayout` is deliberately absent from Ember's\n * public types (ember-source keeps it \"because some addons use these intimate\n * APIs\"), so the shape is declared here rather than imported.\n */\ninterface ParsedTemplate {\n parsedLayout?: { block?: unknown };\n}\n\n/**\n * Story components are normally classes or template-only components (both\n * reachable via `getComponentTemplate`); a raw `createTemplateFactory` result\n * used directly as the component is only recognizable by its `__meta` marker.\n */\nfunction asTemplateFactory(\n component: object\n): ((owner?: unknown) => ParsedTemplate | undefined) | undefined {\n return typeof component === 'function' && '__meta' in component\n ? (component as unknown as (owner?: unknown) => ParsedTemplate | undefined)\n : undefined;\n}\n\n/**\n * Whether the component's *own* template references `{{outlet}}` — i.e. it is a\n * route template, which is how an unannotated route-story is recognized (#62).\n *\n * A template factory caches a per-owner (plus ownerless) `TemplateImpl`; its\n * `parsedLayout.block` is the parsed wire-format tuple\n * `[statements, locals, upvars]`. Free names — every helper/keyword the\n * template resolves, from the whole template including nested blocks — live\n * exactly once in `upvars`, so checking that slot cannot mistake a string\n * literal `\"-outlet\"` used as an argument for a real outlet.\n */\nexport function templateUsesOutlet(component: object): boolean {\n const factory = getComponentTemplate(component) ?? asTemplateFactory(component);\n\n if (!factory) {\n return false;\n }\n\n // Calling the factory with no owner returns the memoized ownerless template —\n // pure data: no owner, no compilation, no side effects on later owner renders.\n const template = (factory as unknown as (owner?: unknown) => ParsedTemplate | undefined)(\n undefined\n );\n const block = template?.parsedLayout?.block;\n\n return (\n Array.isArray(block) &&\n Array.isArray(block[2]) &&\n (block[2] as unknown[]).includes(OUTLET_KEYWORD)\n );\n}\n\n// Ember has no named outlets any more: every `{{outlet}}` is the \"main\" one.\nfunction mainOutlet(child: OutletState | undefined): OutletState['outlets'] {\n return { main: child };\n}\n\nfunction buildChildRenderState(stub: OutletStub, owner: object): OutletState {\n return {\n render: {\n owner,\n name: stub.name ?? DEFAULT_OUTLET_NAME,\n template: stub.template as object,\n model: stub.model,\n controller: stub.controller\n },\n // One level only: a stubbed child route is a leaf, so a `{{outlet}}` inside\n // it renders a hole as well.\n outlets: mainOutlet(undefined)\n };\n}\n\n/**\n * Builds the `OutletState` for a route story.\n *\n * `{{outlet}}` reads its child from Glimmer's *dynamic scope*, which\n * `renderComponent` never populates — so route templates are rendered through\n * Ember's own outlet root instead, and this is the state handed to it. Leaving\n * `outlets.main` undefined is what makes `{{outlet}}` render a hole.\n */\nexport function buildRouteOutletState({\n template,\n route,\n outlet,\n args,\n storyName,\n owner\n}: RouteStoryInput): OutletState {\n const child = outlet?.template ? buildChildRenderState(outlet, owner) : undefined;\n\n return {\n render: {\n owner,\n name: route.name ?? storyName,\n template,\n model: route.model ?? args.model,\n controller: route.controller ?? args.controller\n },\n outlets: mainOutlet(child)\n };\n}\n\n/**\n * Ember's `OutletView` (the router's top-level view), reduced to the surface\n * this module drives. It is only reachable through the container, so the type is\n * declared here rather than imported from `@ember/-internals`.\n */\nexport interface OutletView {\n appendTo(target: HTMLElement): void;\n setOutletState(state: OutletState): void;\n}\n\ninterface OutletViewFactory {\n create(options: Record<string, unknown>): OutletView;\n}\n\n/**\n * The private container entries backing Ember's outlet root — the very full\n * names `Router._setOutlets()` uses. Casting through this interface keeps the\n * unsound lookups in one place instead of spread across the renderer.\n */\ninterface OutletContainer {\n factoryFor(fullName: string): OutletViewFactory | undefined;\n lookup(fullName: string): unknown;\n}\n\n/**\n * `{{outlet}}` compiles to Ember's built-in `-outlet` keyword helper, which reads\n * its child from Glimmer's *dynamic scope*. `renderComponent` starts that scope\n * empty, so a route template rendered as a plain component crashes. Route stories\n * are therefore rendered through the same outlet root `Router._setOutlets()` uses\n * — reached by container name, never imported.\n */\nfunction createOutletView(\n container: OutletContainer,\n state: OutletState,\n element: HTMLElement\n): OutletView {\n const factory = container.factoryFor('view:-outlet');\n\n if (!factory) {\n throw new Error(\n 'ember-storybook: this story sets `parameters.ember.route`, but `view:-outlet` ' +\n 'is not registered on this Ember build, so {{outlet}} cannot be rendered. ' +\n \"Route stories render through Ember's own outlet root, which the router \" +\n '(`Router._setOutlets()`) uses as well.'\n );\n }\n\n const view = factory.create({\n environment: container.lookup('-environment:main'),\n application: container.lookup('application:main'),\n // The outlet root renders `{{outlet}}` itself; the story's route template\n // arrives through the state below, as `outlets.main`.\n template: container.lookup('template:-outlet')\n });\n\n view.setOutletState(state);\n\n // `appendTo` schedules on the `render` queue, so flush the run loop to render.\n run(() => {\n view.appendTo(element);\n });\n\n return view;\n}\n\n/**\n * Renders `state` into `element` through Ember's outlet root and waits for the\n * render to settle.\n */\nexport async function mountOutletView(\n application: ApplicationInstance,\n state: OutletState,\n element: HTMLElement\n): Promise<OutletView> {\n const view = createOutletView(application as unknown as OutletContainer, state, element);\n\n await renderSettled();\n\n return view;\n}\n\n/**\n * Swaps what the outlet renders, in place. This is how the router updates a live\n * route tree, so arg changes do not tear the route's components down.\n */\nexport async function updateOutletView(view: OutletView, state: OutletState): Promise<void> {\n view.setOutletState(state);\n await renderSettled();\n}\n","import Application from '@ember/application';\nimport ApplicationInstance from '@ember/application/instance';\nimport { destroy } from '@ember/destroyable';\nimport { renderComponent } from '@ember/renderer';\nimport { VERSION } from '@ember/version';\n\nimport { OUTLET_GLOBAL_KEY } from '../outlet-key';\nimport {\n buildRouteOutletState,\n mountOutletView,\n resolveOutletStub,\n templateUsesOutlet,\n updateOutletView\n} from './outlet';\nimport { createAppResolver, type EmberStoryResult, normalizeStoryResult } from './story-result';\n\nimport type { OutletView } from './outlet';\nimport type {\n AppParamater,\n EmberGlobals,\n EmberRenderer,\n OutletStub,\n RouteParameters,\n StoryContext\n} from './types';\nimport type { RenderResult } from '@ember/-internals/glimmer/lib/renderer';\nimport type { ArgsStoryFn, RenderContext } from 'storybook/internal/types';\n\ntype Args = Record<string, unknown>;\n\n// ember-source < 6.12 built a brand-new `BaseRenderer` (EvaluationContext) on\n// every `renderComponent` call and had no per-owner renderer cache. Re-rendering\n// an already-rendered owner therefore produced multiple live EvaluationContexts\n// that corrupted glimmer's shared opcode table, crashing with\n// \"Cannot read properties of null (reading 'syscall')\". 6.12+ added that cache\n// (`RENDERER_CACHE` keyed by owner), so reusing an app across renders is only\n// safe from 6.12 onward.\nfunction isEmberBelow(major: number, minor: number): boolean {\n const [maj, min] = VERSION.split('.').map(Number);\n\n return maj < major || (maj === major && min < minor);\n}\n\nexport const render: ArgsStoryFn<EmberRenderer> = (args, context): EmberStoryResult => {\n const { id, component } = context;\n // `ArgsStoryFn`'s context types `parameters` loosely; the framework's own\n // `StoryContext` carries the typed `ember` bag.\n const { ember } = context.parameters as StoryContext['parameters'];\n const route = ember?.route;\n\n if (typeof component === 'function' || typeof component === 'object') {\n // `route` is reported back like `args` are: `<RenderStory>` gets nothing but\n // the story result, and it needs to know a story is a route story.\n return { component, args, route };\n }\n\n throw new Error(\n `Unable to render story ${id} as the component annotation is missing from the default export`\n );\n};\n\nfunction shallowEqual(a: Record<string, unknown>, b: Record<string, unknown>) {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n\n return (\n aKeys.length === bKeys.length &&\n aKeys.every((key) => Object.hasOwn(b, key) && Object.is(a[key], b[key]))\n );\n}\n\nconst withoutOutletGlobal = (globals: Record<string, unknown>) =>\n Object.fromEntries(Object.entries(globals).filter(([key]) => key !== OUTLET_GLOBAL_KEY));\n\n/**\n * Globals the renderer actually reacts to.\n *\n * The outlet menu only concerns route stories, so for a plain component story its\n * value is stripped: toggling \"Ember\" would otherwise count as a globals change\n * and needlessly remount (throwing away the component's state).\n */\nfunction relevantGlobals(\n route: RouteParameters | undefined,\n globals: Record<string, unknown>\n): Record<string, unknown> {\n return route ? globals : withoutOutletGlobal(globals);\n}\n\ntype RenderContextCache = {\n application: ApplicationInstance;\n mount: HTMLElement;\n args: Args;\n globals: Record<string, unknown>;\n // A story is mounted either as a plain component (`renderer`) or, for route\n // templates, through Ember's outlet root (`outletView`) — never both.\n renderer?: RenderResult;\n outletView?: OutletView;\n};\n\nconst contexts = new Map<EmberRenderer['canvasElement'], RenderContextCache>();\n\n/**\n * Route parameters assumed for a story whose template references `{{outlet}}`\n * but that never set `parameters.ember.route` (#62). Frozen and module-level so\n * the identity is stable across renders of the same story.\n */\nconst DEFAULT_ROUTE: RouteParameters = Object.freeze({});\n\n/**\n * Tears the mounted story down, leaving the booted app alone so it can be\n * reused.\n *\n * Route stories are deliberately not cleaned up here: the outlet root is dropped\n * by destroying the app (which clears *and deregisters* its roots), and\n * `Renderer.cleanupRootFor()` would empty the root list without deregistering —\n * leaving the renderer in the global set so the next append would assert \"Cannot\n * register the same renderer twice\".\n */\nfunction teardownMount(context: RenderContextCache) {\n context.renderer?.destroy();\n context.mount.remove();\n}\n\n/**\n * The stub rendered when the toolbar asks for a visible placeholder.\n *\n * Loaded on demand rather than imported: folding the compiled template into the\n * boot chunk makes the bundler emit a `node:module` `createRequire` shim into it,\n * which throws in the browser and takes `renderToCanvas` — and with it every\n * story — down with it.\n */\nasync function loadPlaceholderStub(): Promise<OutletStub> {\n // Typed explicitly: the `.gts` module has no declaration reachable from here.\n const { OutletPlaceholder } = (await import('./outlet-placeholder.gts')) as {\n OutletPlaceholder: object;\n };\n\n // A route template receives only @model/@controller, so the marker renders its\n // own \"outlet\" label when the author did not supply one.\n return { name: 'outlet', template: OutletPlaceholder };\n}\n\nasync function routeOutletState({\n component,\n args,\n route,\n globals,\n storyName,\n application\n}: {\n component: object;\n args: Args;\n route: RouteParameters;\n globals: EmberGlobals;\n storyName: string;\n application: ApplicationInstance;\n}) {\n return buildRouteOutletState({\n template: component,\n route,\n outlet: await resolveOutletStub({\n route,\n mode: globals[OUTLET_GLOBAL_KEY],\n placeholder: loadPlaceholderStub\n }),\n args,\n storyName,\n owner: application\n });\n}\n\nasync function mountStory({\n application,\n component,\n args,\n route,\n globals,\n storyName,\n mount\n}: {\n application: ApplicationInstance;\n component: object;\n args: Args;\n route?: RouteParameters;\n globals: EmberGlobals;\n storyName: string;\n mount: HTMLElement;\n}): Promise<Pick<RenderContextCache, 'renderer' | 'outletView'>> {\n if (!route) {\n return {\n renderer: renderComponent(component, { args, into: mount, owner: application })\n };\n }\n\n // `{{outlet}}` reads its child from Glimmer's dynamic scope, which\n // `renderComponent` never populates — so a route template rendered as a plain\n // component throws instead of rendering. Route stories (annotated, or detected\n // by their template's `{{outlet}}`, see `renderToCanvas`) go through Ember's\n // own outlet root; the toolbar global decides whether `{{outlet}}` is a hole\n // or a placeholder (an explicit `route.outlet` overrides it).\n const outletView = await mountOutletView(\n application,\n await routeOutletState({ component, args, route, globals, storyName, application }),\n mount\n );\n\n return { outletView };\n}\n\nconst resolveAppOption = createAppResolver({\n application: Application,\n applicationInstance: ApplicationInstance\n});\n\nfunction initApp(appOption: AppParamater, opts: { rootElement: HTMLElement }) {\n return resolveAppOption(appOption, opts) as ApplicationInstance;\n}\n\nasync function bootApp(\n storyContext: StoryContext,\n canvasElement: EmberRenderer['canvasElement']\n): Promise<ApplicationInstance> {\n const ember = storyContext.parameters.ember;\n\n if (!ember?.app) {\n const options = Object.keys(storyContext.parameters)\n .filter((key) => key.toLowerCase().includes('ember'))\n .join(', ');\n\n throw new Error(\n [\n 'ember-storybook: no Ember application configured for this story.',\n 'Set `parameters.ember.app` in your preview (e.g. `.storybook/preview.ts`) to a function',\n 'returning an Application or ApplicationInstance. When not provided, every render would',\n `boot a bare Application without any resolver, failing with an obscure error. Found \\`parameters\\` keys: ${options || '(none)'}.`\n ].join(' ')\n );\n }\n\n const application: ApplicationInstance = initApp(ember.app, { rootElement: canvasElement });\n\n // modify the owner for the story\n if (ember.owner) {\n for (const [key, obj] of Object.entries(ember.owner) as [`${string}:${string}`, object][]) {\n application.unregister(key);\n application.register(key, obj);\n }\n }\n\n // configure and boot the instance so ember registers necessary environments\n try {\n ember.configure?.(application);\n await application.boot();\n ember.updateGlobals?.(storyContext.globals, application);\n } catch (error) {\n // A half-booted app may not survive the failed render: the next render\n // would boot a second app onto the same root element, which Ember asserts\n // against (\"You cannot use the same root element ... multiple times\").\n destroy(application);\n throw error;\n }\n\n return application;\n}\n\nexport async function renderToCanvas(\n {\n storyFn,\n showMain,\n storyContext,\n forceRemount\n }: RenderContext<EmberRenderer> & { storyContext: StoryContext },\n canvasElement: EmberRenderer['canvasElement']\n) {\n function unregister(element: EmberRenderer['canvasElement']) {\n const context = contexts.get(element);\n\n if (!context) {\n return;\n }\n\n contexts.delete(element);\n teardownMount(context);\n destroy(context.application);\n }\n\n // The story function carries the decorator pipeline; the framework's `render`\n // reports the final (possibly decorator-transformed) args back in its result.\n const storyResult = storyFn();\n const {\n component,\n args,\n route: routeFromStory\n } = normalizeStoryResult(storyResult, storyContext.args);\n // Stories that define their own `render` never report a route back, so the\n // parameter is the fallback. A story whose template contains `{{outlet}}` but\n // that was never annotated is a route story too: rendering it as a plain\n // component crashes on the outlet keyword (#62), so it is mounted through the\n // outlet root with empty route parameters — hole/placeholder per the toolbar.\n const route =\n routeFromStory ??\n storyContext.parameters.ember?.route ??\n (templateUsesOutlet(component) ? DEFAULT_ROUTE : undefined);\n\n const existing = contexts.get(canvasElement);\n const previousGlobals = relevantGlobals(route, existing?.globals ?? {});\n const currentGlobals = relevantGlobals(route, storyContext.globals);\n const globalsChanged =\n existing !== undefined && !forceRemount && !shallowEqual(previousGlobals, currentGlobals);\n\n // Nothing to do: a globals-only change (or a no-op call) must not tear down the\n // mounted component.\n if (existing && !forceRemount && !globalsChanged && shallowEqual(existing.args, args)) {\n return () => {\n unregister(canvasElement);\n };\n }\n\n // An outlet root is not tracked by the mount cache that broke component re-renders\n // (#27, #33), so it can be updated in place exactly the way the router swaps route\n // state. That preserves the route tree's component state and avoids re-appending.\n //\n // The whole update-or-mount section is guarded: a booted app must never survive\n // a failed render, or the retry boots a second app onto the same `canvasElement`\n // and Ember's EventDispatcher assert masks the real error (#62).\n let application: ApplicationInstance | undefined;\n let mount: HTMLElement | undefined;\n\n try {\n if (route && existing?.outletView && !forceRemount) {\n if (globalsChanged) {\n storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, existing.application);\n }\n\n await updateOutletView(\n existing.outletView,\n await routeOutletState({\n component,\n args,\n route,\n globals: storyContext.globals,\n storyName: storyContext.name,\n application: existing.application\n })\n );\n\n contexts.set(canvasElement, { ...existing, args, globals: { ...storyContext.globals } });\n\n showMain();\n\n return () => {\n unregister(canvasElement);\n };\n }\n\n // Reuse the booted app across arg/globals updates, but always render into a\n // fresh mount: reusing the same mount makes Ember's render cache serve a stale\n // entry, which destroyed renders with obscure node errors (#27, #33).\n //\n // A route story and a component story cannot share an app: the outlet root can\n // only be dropped by destroying the app, so switching modes remounts.\n const canReuseApp =\n existing !== undefined && !forceRemount && Boolean(existing.outletView) === Boolean(route);\n\n if (isEmberBelow(6, 12)) {\n // Exception: ember-source < 6.12 has no per-owner renderer cache, so every\n // `renderComponent` call builds a new renderer (EvaluationContext) and\n // re-rendering an already-rendered owner corrupts the shared opcode table,\n // crashing with \"reading 'syscall'\". Boot a fresh app on every render instead,\n // so each owner is only ever rendered once (at the cost of app state + perf).\n if (existing) {\n unregister(canvasElement);\n }\n\n application = await bootApp(storyContext, canvasElement);\n } else if (canReuseApp) {\n // ember-source >= 6.12 caches one renderer per owner, so we can keep the same\n // app instance across re-renders. This preserves component/app state (@tracked\n // fields, services) and avoids re-booting on every control/global change.\n if (globalsChanged) {\n storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, existing.application);\n }\n\n application = existing.application;\n teardownMount(existing);\n } else {\n if (existing) {\n unregister(canvasElement);\n }\n\n application = await bootApp(storyContext, canvasElement);\n }\n\n mount = document.createElement('div');\n\n canvasElement.append(mount);\n\n const mounted = await mountStory({\n application,\n component,\n args,\n route,\n globals: storyContext.globals,\n storyName: storyContext.name,\n mount\n });\n\n contexts.set(canvasElement, {\n application,\n mount,\n args,\n globals: { ...storyContext.globals },\n ...mounted\n });\n\n showMain();\n\n return () => {\n unregister(canvasElement);\n };\n } catch (error) {\n // `unregister` covers the reuse paths (the still-registered context owns the\n // app); the fresh-boot paths have no context yet, so destroy their app here.\n if (contexts.has(canvasElement)) {\n unregister(canvasElement);\n } else {\n mount?.remove();\n\n if (application) {\n destroy(application);\n }\n }\n\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAMG,sBAAsB;;;;;;;;AAsB5B,eAAsBC,kBAAkB,EACtCC,OACAC,MACAC,eACsD;CACtD,IAAIF,MAAMG,QAAQC,UAChB,OAAOJ,MAAMG;CAGf,OAAOF,SAAS,gBAAgB,MAAMC,YAAY,IAAIG,KAAAA;AACxD;;;;;AAMA,MAAMC,iBAAiB;;;;;;;;;;;;AAiBvB,SAASC,kBACPC,WAC+D;CAC/D,OAAO,OAAOA,cAAc,cAAc,YAAYA,YACjDA,YACDH,KAAAA;AACN;;;;;;;;;;;;AAaA,SAAgBI,mBAAmBD,WAA4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Aa;GAG1Bf,cAAc,MAAMa,QAAQC,cAAcC,aAAa;EACzD;EAEAvB,QAAQsD,SAASC,cAAc,KAAK;EAEpChC,cAAciC,OAAOxD,KAAK;EAE1B,MAAMyD,UAAU,MAAM5C,WAAW;GAC/BL;GACArC;GACAH;GACAM;GACAe,SAASiC,aAAajC;GACtBkB,WAAWe,aAAalB;GACxBJ;EACF,CAAC;EAEDN,SAASyD,IAAI5B,eAAe;GAC1Bf;GACAR;GACAhC;GACAqB,SAAS,EAAE,GAAGiC,aAAajC,QAAQ;GACnC,GAAGoE;EACL,CAAC;EAEDlB,SAAS;EAET,aAAa;GACXR,WAAWR,aAAa;EAC1B;CACF,SAASa,OAAO;EAGd,IAAI1C,SAASgE,IAAInC,aAAa,GAC5BQ,WAAWR,aAAa;OACnB;GACLvB,OAAOC,OAAO;GAEd,IAAIO,aACF5D,QAAQ4D,WAAW;EAEvB;EAEA,MAAM4B;CACR;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-storybook",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "license": "MIT",
5
5
  "description": "Storybook for Ember: Develop, document, and test UI components in isolation",
6
6
  "keywords": [
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-DzZ1vCNM.mjs","names":["renderSettled","run","DEFAULT_OUTLET_NAME","resolveOutletStub","route","mode","placeholder","outlet","template","undefined","mainOutlet","child","main","buildChildRenderState","stub","owner","render","name","model","controller","outlets","buildRouteOutletState","args","storyName","createOutletView","container","state","element","factory","factoryFor","Error","view","create","environment","lookup","application","setOutletState","appendTo","mountOutletView","updateOutletView","Application","ApplicationInstance","destroy","renderComponent","VERSION","OUTLET_GLOBAL_KEY","buildRouteOutletState","mountOutletView","resolveOutletStub","updateOutletView","createAppResolver","normalizeStoryResult","isEmberBelow","major","minor","maj","min","split","map","Number","render","args","context","id","component","ember","parameters","route","Error","shallowEqual","a","b","aKeys","Object","keys","bKeys","length","every","key","hasOwn","is","withoutOutletGlobal","globals","fromEntries","entries","filter","relevantGlobals","contexts","Map","teardownMount","renderer","mount","remove","loadPlaceholderStub","OutletPlaceholder","name","template","routeOutletState","storyName","application","outlet","mode","placeholder","owner","mountStory","into","outletView","resolveAppOption","applicationInstance","initApp","appOption","opts","bootApp","storyContext","canvasElement","app","options","toLowerCase","includes","join","rootElement","obj","unregister","register","configure","boot","updateGlobals","renderToCanvas","storyFn","showMain","forceRemount","element","get","delete","storyResult","routeFromStory","existing","previousGlobals","currentGlobals","globalsChanged","undefined","set","canReuseApp","Boolean","document","createElement","append","mounted"],"sources":["../src/client/outlet.ts","../src/client/render.ts"],"sourcesContent":["import { renderSettled } from '@ember/renderer';\nimport { run } from '@ember/runloop';\n\nimport type { OutletMode, OutletStub, RouteParameters } from './types';\nimport type ApplicationInstance from '@ember/application/instance';\n\n/**\n * What Ember's outlet hands a route template. A route template is *not* a\n * component story: it receives exactly `@model` and `@controller`, because that\n * is all `{{outlet}}` passes down (`OUTLET_COMPONENT_TEMPLATE` in ember-source).\n */\nexport interface OutletRenderState {\n owner: object;\n name: string;\n controller: unknown;\n model: unknown;\n template: object;\n}\n\n/**\n * Mirrors ember-source's internal `OutletState`. The shape is structural, not\n * nominal, so a plain object is accepted by `setOutletState`; the leaf's\n * `outlets.main` is what a nested `{{outlet}}` reads.\n */\nexport interface OutletState {\n render: OutletRenderState;\n outlets: { main: OutletState | undefined };\n}\n\nexport interface RouteStoryInput {\n /** The route template — the story's `component`. */\n template: object;\n /** `parameters.ember.route`. */\n route: RouteParameters;\n /**\n * The resolved stub for `{{outlet}}` — see {@link resolveOutletStub}.\n * `undefined` leaves the outlet as a hole.\n */\n outlet?: OutletStub;\n /** Final (decorated) story args; `model`/`controller` feed the route. */\n args: Record<string, unknown>;\n /** Story name, used when `route.name` is not given. */\n storyName: string;\n /** The booted app instance the route renders under. */\n owner: object;\n}\n\nconst DEFAULT_OUTLET_NAME = 'outlet';\n\nexport interface OutletResolveInput {\n /** `parameters.ember.route` of the story being rendered. */\n route: RouteParameters;\n /** Value of the `outlet` global (see `src/outlet-key.ts`), if any. */\n mode?: OutletMode;\n /**\n * Produces the stub rendered when the global asks for a visible placeholder.\n * Called lazily (and so may be an async chunk load) and only when needed;\n * injected so this module stays free of Ember-owned template components.\n */\n placeholder: () => OutletStub | Promise<OutletStub>;\n}\n\n/**\n * Decides what `{{outlet}}` renders.\n *\n * An explicit `route.outlet` is author intent and always wins, so a story stays\n * deterministic no matter how the toolbar is set. Otherwise the global decides:\n * `placeholder` renders the injected marker, anything else leaves a hole.\n */\nexport async function resolveOutletStub({\n route,\n mode,\n placeholder\n}: OutletResolveInput): Promise<OutletStub | undefined> {\n if (route.outlet?.template) {\n return route.outlet;\n }\n\n return mode === 'placeholder' ? await placeholder() : undefined;\n}\n\n// Ember has no named outlets any more: every `{{outlet}}` is the \"main\" one.\nfunction mainOutlet(child: OutletState | undefined): OutletState['outlets'] {\n return { main: child };\n}\n\nfunction buildChildRenderState(stub: OutletStub, owner: object): OutletState {\n return {\n render: {\n owner,\n name: stub.name ?? DEFAULT_OUTLET_NAME,\n template: stub.template as object,\n model: stub.model,\n controller: stub.controller\n },\n // One level only: a stubbed child route is a leaf, so a `{{outlet}}` inside\n // it renders a hole as well.\n outlets: mainOutlet(undefined)\n };\n}\n\n/**\n * Builds the `OutletState` for a route story.\n *\n * `{{outlet}}` reads its child from Glimmer's *dynamic scope*, which\n * `renderComponent` never populates — so route templates are rendered through\n * Ember's own outlet root instead, and this is the state handed to it. Leaving\n * `outlets.main` undefined is what makes `{{outlet}}` render a hole.\n */\nexport function buildRouteOutletState({\n template,\n route,\n outlet,\n args,\n storyName,\n owner\n}: RouteStoryInput): OutletState {\n const child = outlet?.template ? buildChildRenderState(outlet, owner) : undefined;\n\n return {\n render: {\n owner,\n name: route.name ?? storyName,\n template,\n model: route.model ?? args.model,\n controller: route.controller ?? args.controller\n },\n outlets: mainOutlet(child)\n };\n}\n\n/**\n * Ember's `OutletView` (the router's top-level view), reduced to the surface\n * this module drives. It is only reachable through the container, so the type is\n * declared here rather than imported from `@ember/-internals`.\n */\nexport interface OutletView {\n appendTo(target: HTMLElement): void;\n setOutletState(state: OutletState): void;\n}\n\ninterface OutletViewFactory {\n create(options: Record<string, unknown>): OutletView;\n}\n\n/**\n * The private container entries backing Ember's outlet root — the very full\n * names `Router._setOutlets()` uses. Casting through this interface keeps the\n * unsound lookups in one place instead of spread across the renderer.\n */\ninterface OutletContainer {\n factoryFor(fullName: string): OutletViewFactory | undefined;\n lookup(fullName: string): unknown;\n}\n\n/**\n * `{{outlet}}` compiles to Ember's built-in `-outlet` keyword helper, which reads\n * its child from Glimmer's *dynamic scope*. `renderComponent` starts that scope\n * empty, so a route template rendered as a plain component crashes. Route stories\n * are therefore rendered through the same outlet root `Router._setOutlets()` uses\n * — reached by container name, never imported.\n */\nfunction createOutletView(\n container: OutletContainer,\n state: OutletState,\n element: HTMLElement\n): OutletView {\n const factory = container.factoryFor('view:-outlet');\n\n if (!factory) {\n throw new Error(\n 'ember-storybook: this story sets `parameters.ember.route`, but `view:-outlet` ' +\n 'is not registered on this Ember build, so {{outlet}} cannot be rendered. ' +\n \"Route stories render through Ember's own outlet root, which the router \" +\n '(`Router._setOutlets()`) uses as well.'\n );\n }\n\n const view = factory.create({\n environment: container.lookup('-environment:main'),\n application: container.lookup('application:main'),\n // The outlet root renders `{{outlet}}` itself; the story's route template\n // arrives through the state below, as `outlets.main`.\n template: container.lookup('template:-outlet')\n });\n\n view.setOutletState(state);\n\n // `appendTo` schedules on the `render` queue, so flush the run loop to render.\n run(() => {\n view.appendTo(element);\n });\n\n return view;\n}\n\n/**\n * Renders `state` into `element` through Ember's outlet root and waits for the\n * render to settle.\n */\nexport async function mountOutletView(\n application: ApplicationInstance,\n state: OutletState,\n element: HTMLElement\n): Promise<OutletView> {\n const view = createOutletView(application as unknown as OutletContainer, state, element);\n\n await renderSettled();\n\n return view;\n}\n\n/**\n * Swaps what the outlet renders, in place. This is how the router updates a live\n * route tree, so arg changes do not tear the route's components down.\n */\nexport async function updateOutletView(view: OutletView, state: OutletState): Promise<void> {\n view.setOutletState(state);\n await renderSettled();\n}\n","import Application from '@ember/application';\nimport ApplicationInstance from '@ember/application/instance';\nimport { destroy } from '@ember/destroyable';\nimport { renderComponent } from '@ember/renderer';\nimport { VERSION } from '@ember/version';\n\nimport { OUTLET_GLOBAL_KEY } from '../outlet-key';\nimport {\n buildRouteOutletState,\n mountOutletView,\n resolveOutletStub,\n updateOutletView\n} from './outlet';\nimport { createAppResolver, type EmberStoryResult, normalizeStoryResult } from './story-result';\n\nimport type { OutletView } from './outlet';\nimport type {\n AppParamater,\n EmberGlobals,\n EmberRenderer,\n OutletStub,\n RouteParameters,\n StoryContext\n} from './types';\nimport type { RenderResult } from '@ember/-internals/glimmer/lib/renderer';\nimport type { ArgsStoryFn, RenderContext } from 'storybook/internal/types';\n\ntype Args = Record<string, unknown>;\n\n// ember-source < 6.12 built a brand-new `BaseRenderer` (EvaluationContext) on\n// every `renderComponent` call and had no per-owner renderer cache. Re-rendering\n// an already-rendered owner therefore produced multiple live EvaluationContexts\n// that corrupted glimmer's shared opcode table, crashing with\n// \"Cannot read properties of null (reading 'syscall')\". 6.12+ added that cache\n// (`RENDERER_CACHE` keyed by owner), so reusing an app across renders is only\n// safe from 6.12 onward.\nfunction isEmberBelow(major: number, minor: number): boolean {\n const [maj, min] = VERSION.split('.').map(Number);\n\n return maj < major || (maj === major && min < minor);\n}\n\nexport const render: ArgsStoryFn<EmberRenderer> = (args, context): EmberStoryResult => {\n const { id, component } = context;\n // `ArgsStoryFn`'s context types `parameters` loosely; the framework's own\n // `StoryContext` carries the typed `ember` bag.\n const { ember } = context.parameters as StoryContext['parameters'];\n const route = ember?.route;\n\n if (typeof component === 'function' || typeof component === 'object') {\n // `route` is reported back like `args` are: `<RenderStory>` gets nothing but\n // the story result, and it needs to know a story is a route story.\n return { component, args, route };\n }\n\n throw new Error(\n `Unable to render story ${id} as the component annotation is missing from the default export`\n );\n};\n\nfunction shallowEqual(a: Record<string, unknown>, b: Record<string, unknown>) {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n\n return (\n aKeys.length === bKeys.length &&\n aKeys.every((key) => Object.hasOwn(b, key) && Object.is(a[key], b[key]))\n );\n}\n\nconst withoutOutletGlobal = (globals: Record<string, unknown>) =>\n Object.fromEntries(Object.entries(globals).filter(([key]) => key !== OUTLET_GLOBAL_KEY));\n\n/**\n * Globals the renderer actually reacts to.\n *\n * The outlet menu only concerns route stories, so for a plain component story its\n * value is stripped: toggling \"Ember\" would otherwise count as a globals change\n * and needlessly remount (throwing away the component's state).\n */\nfunction relevantGlobals(\n route: RouteParameters | undefined,\n globals: Record<string, unknown>\n): Record<string, unknown> {\n return route ? globals : withoutOutletGlobal(globals);\n}\n\ntype RenderContextCache = {\n application: ApplicationInstance;\n mount: HTMLElement;\n args: Args;\n globals: Record<string, unknown>;\n // A story is mounted either as a plain component (`renderer`) or, for route\n // templates, through Ember's outlet root (`outletView`) — never both.\n renderer?: RenderResult;\n outletView?: OutletView;\n};\n\nconst contexts = new Map<EmberRenderer['canvasElement'], RenderContextCache>();\n\n/**\n * Tears the mounted story down, leaving the booted app alone so it can be\n * reused.\n *\n * Route stories are deliberately not cleaned up here: the outlet root is dropped\n * by destroying the app (which clears *and deregisters* its roots), and\n * `Renderer.cleanupRootFor()` would empty the root list without deregistering —\n * leaving the renderer in the global set so the next append would assert \"Cannot\n * register the same renderer twice\".\n */\nfunction teardownMount(context: RenderContextCache) {\n context.renderer?.destroy();\n context.mount.remove();\n}\n\n/**\n * The stub rendered when the toolbar asks for a visible placeholder.\n *\n * Loaded on demand rather than imported: folding the compiled template into the\n * boot chunk makes the bundler emit a `node:module` `createRequire` shim into it,\n * which throws in the browser and takes `renderToCanvas` — and with it every\n * story — down with it.\n */\nasync function loadPlaceholderStub(): Promise<OutletStub> {\n // Typed explicitly: the `.gts` module has no declaration reachable from here.\n const { OutletPlaceholder } = (await import('./outlet-placeholder.gts')) as {\n OutletPlaceholder: object;\n };\n\n // A route template receives only @model/@controller, so the marker renders its\n // own \"outlet\" label when the author did not supply one.\n return { name: 'outlet', template: OutletPlaceholder };\n}\n\nasync function routeOutletState({\n component,\n args,\n route,\n globals,\n storyName,\n application\n}: {\n component: object;\n args: Args;\n route: RouteParameters;\n globals: EmberGlobals;\n storyName: string;\n application: ApplicationInstance;\n}) {\n return buildRouteOutletState({\n template: component,\n route,\n outlet: await resolveOutletStub({\n route,\n mode: globals[OUTLET_GLOBAL_KEY],\n placeholder: loadPlaceholderStub\n }),\n args,\n storyName,\n owner: application\n });\n}\n\nasync function mountStory({\n application,\n component,\n args,\n route,\n globals,\n storyName,\n mount\n}: {\n application: ApplicationInstance;\n component: object;\n args: Args;\n route?: RouteParameters;\n globals: EmberGlobals;\n storyName: string;\n mount: HTMLElement;\n}): Promise<Pick<RenderContextCache, 'renderer' | 'outletView'>> {\n if (!route) {\n return {\n renderer: renderComponent(component, { args, into: mount, owner: application })\n };\n }\n\n // `{{outlet}}` reads its child from Glimmer's dynamic scope, which\n // `renderComponent` never populates — so a route template rendered as a plain\n // component throws instead of rendering. Route stories go through Ember's own\n // outlet root; the toolbar global decides whether `{{outlet}}` is a hole or a\n // placeholder (an explicit `route.outlet` overrides it).\n const outletView = await mountOutletView(\n application,\n await routeOutletState({ component, args, route, globals, storyName, application }),\n mount\n );\n\n return { outletView };\n}\n\nconst resolveAppOption = createAppResolver({\n application: Application,\n applicationInstance: ApplicationInstance\n});\n\nfunction initApp(appOption: AppParamater, opts: { rootElement: HTMLElement }) {\n return resolveAppOption(appOption, opts) as ApplicationInstance;\n}\n\nasync function bootApp(\n storyContext: StoryContext,\n canvasElement: EmberRenderer['canvasElement']\n): Promise<ApplicationInstance> {\n const ember = storyContext.parameters.ember;\n\n if (!ember?.app) {\n const options = Object.keys(storyContext.parameters)\n .filter((key) => key.toLowerCase().includes('ember'))\n .join(', ');\n\n throw new Error(\n [\n 'ember-storybook: no Ember application configured for this story.',\n 'Set `parameters.ember.app` in your preview (e.g. `.storybook/preview.ts`) to a function',\n 'returning an Application or ApplicationInstance. When not provided, every render would',\n `boot a bare Application without any resolver, failing with an obscure error. Found \\`parameters\\` keys: ${options || '(none)'}.`\n ].join(' ')\n );\n }\n\n const application: ApplicationInstance = initApp(ember.app, { rootElement: canvasElement });\n\n // modify the owner for the story\n if (ember.owner) {\n for (const [key, obj] of Object.entries(ember.owner) as [`${string}:${string}`, object][]) {\n application.unregister(key);\n application.register(key, obj);\n }\n }\n\n // configure and boot the instance so ember registers necessary environments\n ember.configure?.(application);\n await application.boot();\n ember.updateGlobals?.(storyContext.globals, application);\n\n return application;\n}\n\nexport async function renderToCanvas(\n {\n storyFn,\n showMain,\n storyContext,\n forceRemount\n }: RenderContext<EmberRenderer> & { storyContext: StoryContext },\n canvasElement: EmberRenderer['canvasElement']\n) {\n function unregister(element: EmberRenderer['canvasElement']) {\n const context = contexts.get(element);\n\n if (!context) {\n return;\n }\n\n contexts.delete(element);\n teardownMount(context);\n destroy(context.application);\n }\n\n // The story function carries the decorator pipeline; the framework's `render`\n // reports the final (possibly decorator-transformed) args back in its result.\n const storyResult = storyFn();\n const {\n component,\n args,\n route: routeFromStory\n } = normalizeStoryResult(storyResult, storyContext.args);\n // Stories that define their own `render` never report a route back, so the\n // parameter is the fallback.\n const route = routeFromStory ?? storyContext.parameters.ember?.route;\n\n const existing = contexts.get(canvasElement);\n const previousGlobals = relevantGlobals(route, existing?.globals ?? {});\n const currentGlobals = relevantGlobals(route, storyContext.globals);\n const globalsChanged =\n existing !== undefined && !forceRemount && !shallowEqual(previousGlobals, currentGlobals);\n\n // Nothing to do: a globals-only change (or a no-op call) must not tear down the\n // mounted component.\n if (existing && !forceRemount && !globalsChanged && shallowEqual(existing.args, args)) {\n return () => {\n unregister(canvasElement);\n };\n }\n\n // An outlet root is not tracked by the mount cache that broke component re-renders\n // (#27, #33), so it can be updated in place exactly the way the router swaps route\n // state. That preserves the route tree's component state and avoids re-appending.\n if (route && existing?.outletView && !forceRemount) {\n if (globalsChanged) {\n storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, existing.application);\n }\n\n await updateOutletView(\n existing.outletView,\n await routeOutletState({\n component,\n args,\n route,\n globals: storyContext.globals,\n storyName: storyContext.name,\n application: existing.application\n })\n );\n\n contexts.set(canvasElement, { ...existing, args, globals: { ...storyContext.globals } });\n\n showMain();\n\n return () => {\n unregister(canvasElement);\n };\n }\n\n // Reuse the booted app across arg/globals updates, but always render into a\n // fresh mount: reusing the same mount makes Ember's render cache serve a stale\n // entry, which destroyed renders with obscure node errors (#27, #33).\n //\n // A route story and a component story cannot share an app: the outlet root can\n // only be dropped by destroying the app, so switching modes remounts.\n const canReuseApp =\n existing !== undefined && !forceRemount && Boolean(existing.outletView) === Boolean(route);\n\n let application: ApplicationInstance;\n\n if (isEmberBelow(6, 12)) {\n // Exception: ember-source < 6.12 has no per-owner renderer cache, so every\n // `renderComponent` call builds a new renderer (EvaluationContext) and\n // re-rendering an already-rendered owner corrupts the shared opcode table,\n // crashing with \"reading 'syscall'\". Boot a fresh app on every render instead,\n // so each owner is only ever rendered once (at the cost of app state + perf).\n if (existing) {\n unregister(canvasElement);\n }\n\n application = await bootApp(storyContext, canvasElement);\n } else if (canReuseApp) {\n // ember-source >= 6.12 caches one renderer per owner, so we can keep the same\n // app instance across re-renders. This preserves component/app state (@tracked\n // fields, services) and avoids re-booting on every control/global change.\n if (globalsChanged) {\n storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, existing.application);\n }\n\n application = existing.application;\n teardownMount(existing);\n } else {\n if (existing) {\n unregister(canvasElement);\n }\n\n application = await bootApp(storyContext, canvasElement);\n }\n\n const mount = document.createElement('div');\n\n canvasElement.append(mount);\n\n const mounted = await mountStory({\n application,\n component,\n args,\n route,\n globals: storyContext.globals,\n storyName: storyContext.name,\n mount\n });\n\n contexts.set(canvasElement, {\n application,\n mount,\n args,\n globals: { ...storyContext.globals },\n ...mounted\n });\n\n showMain();\n\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