ember-storybook 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"source-decorator.d.ts","sourceRoot":"","sources":["../../../src/client/docs/source-decorator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAa,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AA0BlF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAsB9F;AAcD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,MAAM,CA8BR;AAoCD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAexE;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAC5B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,GAAG,SAAS,CA4CpB;AAED,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,aAAa,CAoB5D,CAAC"}
1
+ {"version":3,"file":"source-decorator.d.ts","sourceRoot":"","sources":["../../../src/client/docs/source-decorator.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAa,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AA0BlF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAsB9F;AAcD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,MAAM,CA8BR;AAoCD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAexE;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAC5B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,GAAG,SAAS,CA4CpB;AAED,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,aAAa,CAqB5D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"render-story.d.ts","sourceRoot":"","sources":["../../src/client/render-story.gts"],"names":[],"mappings":"AAiCA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAM3C,UAAU,oBAAoB;IAC5B,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,qBAAa,WAAY,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IAC9D,MAAM;;;;;;OAYH;CASJ"}
1
+ {"version":3,"file":"render-story.d.ts","sourceRoot":"","sources":["../../src/client/render-story.gts"],"names":[],"mappings":"AAoCA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAQ3C,UAAU,oBAAoB;IAC5B,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,qBAAa,WAAY,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IAC9D,MAAM;;;;;;OAaH;CASJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/client/render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI3E,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,aAAa,CAc7C,CAAC;AAuEF,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,uBAmH9C"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/client/render.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAgB,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAiB3E,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,aAAa,CAc7C,CAAC;AAsEF,wBAAsB,cAAc,CAClC,EACE,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,YAAY,EACb,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE,EAChE,aAAa,EAAE,aAAa,CAAC,eAAe,CAAC,uBA4F9C"}
@@ -0,0 +1,46 @@
1
+ type Args = Record<string, unknown>;
2
+ /**
3
+ * Structural shapes of `@ember/application` and `@ember/application/instance`.
4
+ * Used so the resolver can be unit tested without importing Ember at runtime.
5
+ */
6
+ export interface ApplicationClass {
7
+ prototype: object;
8
+ create(options?: Record<string, unknown>): {
9
+ buildInstance(): object;
10
+ };
11
+ }
12
+ export type ApplicationInstanceClass = new (...args: never[]) => object;
13
+ /**
14
+ * The result of the framework's default `render` function.
15
+ *
16
+ * Storybook's decorator pipeline delivers the (possibly decorator-transformed)
17
+ * args to `render` via `originalStoryFn(args, context)` — but nothing else. To
18
+ * make those args reach `renderToCanvas`, `render` reports them back alongside
19
+ * the component instead of returning a bare component.
20
+ */
21
+ export interface EmberStoryResult {
22
+ component: object;
23
+ args: Args;
24
+ }
25
+ export declare function isEmberStoryResult(value: unknown): value is EmberStoryResult;
26
+ /**
27
+ * Normalizes whatever `storyFn()` returned into `{ component, args }`.
28
+ *
29
+ * - A story rendered through the framework's `render` returns an `EmberStoryResult`
30
+ * whose `args` are the final (decorated) args.
31
+ * - A story with its own `render` (e.g. a template) returns the component/template
32
+ * directly; in that case the args are the raw `fallbackArgs` (the story already
33
+ * captured what it needs).
34
+ */
35
+ export declare function normalizeStoryResult(result: unknown, fallbackArgs: Args): {
36
+ component: object;
37
+ args: Args;
38
+ };
39
+ export declare function createAppResolver(params: {
40
+ application: ApplicationClass;
41
+ applicationInstance: ApplicationInstanceClass;
42
+ }): (appOption: unknown, opts: {
43
+ rootElement: HTMLElement;
44
+ }) => object;
45
+ export {};
46
+ //# sourceMappingURL=story-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"story-result.d.ts","sourceRoot":"","sources":["../../src/client/story-result.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QAAE,aAAa,IAAI,MAAM,CAAA;KAAE,CAAC;CACxE;AAED,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,MAAM,CAAC;AAExE;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAS5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,OAAO,EACf,YAAY,EAAE,IAAI,GACjB;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;CACZ,CAMA;AAmBD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,mBAAmB,EAAE,wBAAwB,CAAC;CAC/C,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;IAAE,WAAW,EAAE,WAAW,CAAA;CAAE,KAAK,MAAM,CA2CrE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=story-result.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"story-result.test.d.ts","sourceRoot":"","sources":["../../src/client/story-result.test.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { n as renderToCanvas, t as render } from "../render-B0rRnyCZ.mjs";
1
+ import { n as renderToCanvas, t as render } from "../render-D_vlc6Py.mjs";
2
2
  import { enhanceArgTypes } from "storybook/internal/docs-tools";
3
3
  //#region src/client/config.ts
4
4
  const parameters = {
@@ -1,3 +1,4 @@
1
+ import { n as isEmberStoryResult } from "../../story-result-CCx6LMia.mjs";
1
2
  import { t as unwrapBlockParams } from "../../block-params-C68OkWMC.mjs";
2
3
  import { emitTransformCode, useEffect, useRef } from "storybook/preview-api";
3
4
  import { SourceType } from "storybook/internal/docs-tools";
@@ -517,7 +518,8 @@ const sourceDecorator = (storyFn, context) => {
517
518
  const source = useRef(void 0);
518
519
  const story = storyFn();
519
520
  useEffect(() => {
520
- const renderedForSource = context.originalStoryFn(context.args, context);
521
+ const rendered = context.originalStoryFn(context.args, context);
522
+ const renderedForSource = isEmberStoryResult(rendered) ? rendered.component : rendered;
521
523
  if (!skipSourceRender(context)) {
522
524
  const code = generateSource(renderedForSource, context.args, context.argTypes, context.id) ?? void 0;
523
525
  emitTransformCode(code, context);
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":["emberData","data","byName","Map","entry","Object","values","comp","component","signatureName","compEntry","file","undefined","sig","signatures","set","mapTypeToControl","type","category","options","buildArgTypes","argTypes","name","arg","entries","args","description","raw","required","control","table","summary","defaultValue","extractArgTypes","displayName","get","Heading","createElement","styled","isHtmlElement","name","test","TableWrapper","table","theme","fontFamily","typography","fonts","base","borderSpacing","color","defaultText","fontSize","size","s2","lineHeight","textAlign","width","marginTop","marginBottom","marginInline","padding","border","verticalAlign","textOverflow","paddingLeft","paddingRight","th","textMutedColor","paddingTop","paddingBottom","td","tbody","filter","background","content","borderTop","appBorderColor","borderBlockStart","borderBlockEnd","borderInlineStart","borderInlineEnd","borderTopLeftRadius","appBorderRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","borderColor","renderHead","columns","className","map","col","renderBody","entries","entry","key","style","fontWeight","description","H2","weight","bold","letterSpacing","textTransform","Subheading","useOf","createElement","Fragment","styled","TableWrapper","ParamType","code","theme","color","secondary","fontSize","fontWeight","ParamName","span","defaultText","ParamRow","div","typography","size","s2","lineHeight","marginBottom","ParamDesc","textMutedColor","s1","marginLeft","BlocksDiv","marginTop","BlocksNameCell","td","position","weight","bold","background","app","SubcomponentLink","a","primary","cursor","textDecoration","Indent","marginInlineStart","renderType","param","subcomponentNames","type","displayType","componentRef","exportName","typeIsSubcomponent","has","key","href","renderParam","name","isBlockParam","Object","hasOwn","renderParams","params","map","i","children","values","p","isNamed","startsWith","isSubcomponent","typeChildren","push","rows","description","BlocksTable","blocks","defaultName","entries","toSorted","nameA","_a","nameB","_b","length","block","displayName","undefined","className","BlocksSection","preparedMeta","componentName","title","createElement","styled","isHtmlElement","ElementWrapper","div","theme","fontFamily","typography","fonts","base","color","defaultText","fontSize","size","s2","lineHeight","marginTop","marginBottom","span","fontWeight","marginRight","code","secondary","textDecoration","a","ElementBlock","element","elements","split","map","s","trim","filter","Boolean","length","children","key","i","name","entries","push","inner","href","target","rel","undefined","createElement","renderBody","renderHead","TableWrapper","renderPartsBody","entries","className","map","entry","key","name","style","fontSize","fontWeight","description","PartsTable","CssPropertiesTable","ArgTypes","Subheading","createElement","styled","BlocksTable","ParamRow","ParamType","ElementBlock","H2","SubcomponentsSection","div","marginTop","marginBottom","SubEntry","SectionLabel","theme","fontWeight","color","defaultText","fontSize","typography","size","m1","renderSubcomponentSignature","sig","subcomponentNames","defaultName","children","element","push","Object","keys","args","length","undefined","include","blocks","key","style","SubcomponentsArea","components","Set","map","c","name","entries","comp","importPath","signature","id","unwrapBlockParams","applyModifiers","signature","modifiers","length","blockedKeys","Set","pickedKeys","mod","name","key","typeArgs","add","filtered","size","Object","fromEntries","entries","args","filter","k","has","collectSubcomponents","blocks","data","seen","result","block","values","param","params","componentRef","filePath","exportName","importPath","push","hasOwn","entry","signatures","sig","Controls","Description","Primary","Stories","Subheading","Subtitle","Title","useOf","createElement","Fragment","emberData","BlocksSection","ElementBlock","CssPropertiesTable","PartsTable","SubcomponentsArea","H2","collectSubcomponents","addSignature","signature","data","children","element","push","Object","keys","args","length","undefined","include","blocks","subcomponents","subcomponentNames","Set","map","s","name","components","style","customProperties","entries","description","parts","unshift","Page","resolved","storyFile","preparedMeta","parameters","fileName","storyEntry","storyComponent","component","compFile","file","compEntry","signatures","signatureName","SourceType","emitTransformCode","useEffect","useRef","emberData","unwrapBlockParams","data","skipSourceRender","context","sourceParams","parameters","docs","source","type","DYNAMIC","isArgsStory","__isArgsStory","code","CODE","toArgument","key","value","argTypes","undefined","JSON","stringify","String","Object","hasOwn","generateBlockContent","blockInfo","params","length","paramNames","map","p","name","join","generateBlockSourceCode","sig","args","indent","blockNames","keys","blocks","blockName","arg","slotBindings","content","push","byStoryId","getByStoryId","entry","values","storyId","entries","componentName","signatureName","inlineTemplate","signatureForComponent","comp","component","compEntry","file","signatures","resolveTemplateArgs","template","replaceAll","_match","generateSource","meta","propsArray","filter","k","v","Boolean","blockCode","propsStr","sourceDecorator","storyFn","story","renderedForSource","originalStoryFn","id","current","SourceType","emberData","buildArgTypes","Page","sourceDecorator","data","resolveSig","entry","undefined","comp","component","signatureName","compEntry","file","signatures","argTypesEnhancers","context","filePath","parameters","fileName","Object","hasOwn","sig","argTypes","titleName","title","split","pop","values","docs","source","type","DYNAMIC","language","page","decorators"],"sources":["../../../src/client/docs/extractArgTypes.ts","../../../src/client/docs/blocks/ui.ts","../../../src/client/docs/blocks/blocks.ts","../../../src/client/docs/blocks/element.ts","../../../src/client/docs/blocks/style.ts","../../../src/client/docs/blocks/subcomponents.ts","../../../src/client/docs/signature.ts","../../../src/client/docs/page.ts","../../../src/client/docs/source-decorator.ts","../../../src/client/docs/config.ts"],"sourcesContent":["import emberData from 'virtual:ember-storybook';\n\nimport type { StorySource } from '../../node/types';\nimport type { ArgTypeInfo, ComponentSignature } from 'ember-docgen';\n\nconst data = emberData as Record<\n string,\n {\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n>;\n\nconst byName = new Map<string, ComponentSignature>();\n\nfor (const entry of Object.values(data)) {\n const comp = entry.component;\n\n if (!comp?.signatureName) continue;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n const sig = compEntry?.signatures?.[comp.signatureName];\n\n if (sig) {\n byName.set(comp.signatureName, sig);\n }\n}\n\nfunction mapTypeToControl(\n type: ArgTypeInfo\n):\n | false\n | { type: 'text' }\n | { type: 'number' }\n | { type: 'boolean' }\n | { type: 'select'; options: string[] }\n | { type: 'object' }\n | { type: 'function' }\n | { type: 'date' } {\n switch (type.category) {\n case 'string': {\n return { type: 'text' };\n }\n case 'number': {\n return { type: 'number' };\n }\n case 'boolean': {\n return { type: 'boolean' };\n }\n case 'function': {\n return { type: 'function' };\n }\n case 'enum': {\n return { type: 'select', options: type.options ?? [] };\n }\n\n default: {\n return { type: 'object' };\n }\n }\n}\n\nexport function buildArgTypes(sig: ComponentSignature): Record<string, unknown> {\n const argTypes: Record<string, unknown> = {};\n\n for (const [name, arg] of Object.entries(sig.args)) {\n argTypes[name] = {\n name,\n description: arg.description || undefined,\n type: {\n name: arg.type.raw,\n required: arg.required\n },\n control: mapTypeToControl(arg.type),\n table: {\n type: { summary: arg.type.raw },\n defaultValue: arg.defaultValue ? { summary: arg.defaultValue } : undefined\n }\n };\n }\n\n return argTypes;\n}\n\nexport function extractArgTypes(\n component: Record<string, unknown>\n): Record<string, unknown> | null {\n const name =\n (component.name as string | undefined) ?? (component.displayName as string | undefined);\n\n // eslint-disable-next-line unicorn/no-null\n if (!name) return null;\n\n const sig = byName.get(name);\n\n // eslint-disable-next-line unicorn/no-null\n if (!sig) return null;\n\n return buildArgTypes(sig);\n}\n","/* eslint-disable unicorn/no-null */\nimport { Heading } from '@storybook/addon-docs/blocks';\nimport { createElement } from 'react';\nimport { styled, type Theme } from 'storybook/theming';\n\nexport interface Entry {\n name: string;\n description?: string;\n}\n\ntype StyleProps = { theme: Theme };\n\nexport function isHtmlElement(name: string): boolean {\n return /^HTML[A-Z]\\w*Element$/.test(name);\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nexport const TableWrapper = styled.table(({ theme }: StyleProps) => ({\n fontFamily: theme.typography.fonts.base,\n borderSpacing: 0,\n color: theme.color.defaultText,\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n textAlign: 'left',\n width: '100%',\n marginTop: 25,\n marginBottom: 40,\n marginInline: 1,\n 'td, th': {\n padding: 0,\n border: 'none',\n verticalAlign: 'top',\n textOverflow: 'ellipsis'\n },\n 'th:first-of-type, td:first-of-type': {\n paddingLeft: 20\n },\n 'th:last-of-type, td:last-of-type': {\n paddingRight: 20\n },\n th: {\n color: theme.textMutedColor as string,\n paddingTop: 10,\n paddingBottom: 10,\n paddingLeft: 15,\n paddingRight: 15\n },\n td: {\n paddingTop: '10px',\n paddingBottom: '10px',\n '&:not(:first-of-type)': {\n paddingLeft: 15,\n paddingRight: 15\n },\n '&:last-of-type': {\n paddingRight: 20\n }\n },\n tbody: {\n filter:\n theme.base === 'light'\n ? 'drop-shadow(0px 1px 3px rgba(0, 0, 0, 0.10))'\n : 'drop-shadow(0px 1px 3px rgba(0, 0, 0, 0.20))',\n '> tr > *': {\n background: theme.background.content,\n borderTop: `1px solid ${theme.appBorderColor}`\n },\n '> tr:first-of-type > *': {\n borderBlockStart: `1px solid ${theme.appBorderColor}`\n },\n '> tr:last-of-type > *': {\n borderBlockEnd: `1px solid ${theme.appBorderColor}`\n },\n '> tr > *:first-of-type': {\n borderInlineStart: `1px solid ${theme.appBorderColor}`\n },\n '> tr > *:last-of-type': {\n borderInlineEnd: `1px solid ${theme.appBorderColor}`\n },\n '> tr:first-of-type > td:first-of-type': {\n borderTopLeftRadius: theme.appBorderRadius\n },\n '> tr:first-of-type > td:last-of-type': {\n borderTopRightRadius: theme.appBorderRadius\n },\n '> tr:last-of-type > td:first-of-type': {\n borderBottomLeftRadius: theme.appBorderRadius\n },\n '> tr:last-of-type > td:last-of-type': {\n borderBottomRightRadius: theme.appBorderRadius\n }\n },\n '@media (forced-colors: active)': {\n tbody: {\n filter: 'none',\n '> tr > *': {\n borderColor: 'CanvasText'\n }\n }\n }\n}));\n\nexport function renderHead(columns: string[]) {\n return createElement(\n 'thead',\n { className: 'docblock-argstable-head' },\n createElement(\n 'tr',\n null,\n ...columns.map((col) => createElement('th', null, createElement('span', null, col)))\n )\n );\n}\n\nexport function renderBody(entries: Entry[]) {\n return createElement(\n 'tbody',\n { className: 'docblock-argstable-body' },\n ...entries.map((entry) =>\n createElement(\n 'tr',\n { key: entry.name },\n createElement(\n 'td',\n null,\n createElement('span', { style: { fontWeight: 'bold' } }, entry.name)\n ),\n createElement('td', null, entry.description ?? '')\n )\n )\n );\n}\n\nexport const H2 = styled(Heading)(({ theme }) => ({\n fontSize: `${theme.typography.size.s2 - 1}px`,\n fontWeight: theme.typography.weight.bold,\n lineHeight: '16px',\n letterSpacing: '0.35em',\n textTransform: 'uppercase',\n color: theme.textMutedColor as string,\n border: 0,\n marginBottom: '12px',\n '&:first-of-type': { marginTop: '56px' }\n}));\n","import { Subheading, useOf } from '@storybook/addon-docs/blocks';\nimport { createElement, Fragment, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { TableWrapper } from './ui';\n\nimport type { BlockInfo, BlockParam, HashBlockParam } from 'ember-docgen';\n\nexport const ParamType = styled.code(({ theme }) => ({\n color: theme.color.secondary,\n fontSize: 12,\n fontWeight: 'bold'\n}));\n\nconst ParamName = styled.span(({ theme }) => ({\n fontWeight: 'bold',\n color: theme.color.defaultText\n}));\n\nexport const ParamRow = styled.div(({ theme }) => ({\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n marginBottom: 2\n}));\n\nconst ParamDesc = styled.div(({ theme }) => ({\n color: theme.textMutedColor as string,\n fontSize: theme.typography.size.s1,\n lineHeight: '17px',\n marginBottom: 8,\n marginLeft: 20\n}));\n\nconst BlocksDiv = styled.div(() => ({\n marginTop: 25,\n marginBottom: 40\n}));\n\nconst BlocksNameCell = styled.td(({ theme }) => ({\n position: 'relative',\n fontWeight: theme.typography.weight.bold,\n fontSize: theme.typography.size.s1,\n background: `${theme.background.app} !important`,\n '& ~ td': {\n background: `${theme.background.app} !important`\n }\n}));\n\nconst SubcomponentLink = styled.a(({ theme }) => ({\n color: theme.color.primary,\n fontWeight: 'bold',\n cursor: 'pointer',\n textDecoration: 'none',\n '&:hover': { textDecoration: 'underline' }\n}));\n\nconst Indent = styled.span(() => ({\n marginInlineStart: '20px'\n}));\n\nfunction renderType(param: BlockParam, subcomponentNames: Set<string>): ReactNode {\n if (param.type === 'Invokable') {\n const displayType = param.componentRef?.exportName ?? param.type;\n const typeIsSubcomponent = subcomponentNames.has(displayType);\n\n return typeIsSubcomponent\n ? createElement(\n SubcomponentLink,\n { key: 'type', href: `#subcomponent-${displayType}` },\n displayType\n )\n : createElement(ParamType, { key: 'type' }, displayType);\n }\n\n return createElement(ParamType, { key: 'type' }, param.type);\n}\n\nfunction renderParam(param: BlockParam, subcomponentNames: Set<string>): ReactNode[] {\n const type = renderType(param, subcomponentNames);\n const name = createElement(ParamName, { key: 'name' }, param.name);\n\n return [name, createElement('span', { key: 'colon' }, ': '), type];\n}\n\nfunction isBlockParam(param: BlockParam | HashBlockParam): param is BlockParam {\n return Object.hasOwn(param, 'name') && Object.hasOwn(param, 'type');\n}\n\nfunction renderParams(params: BlockInfo['params'], subcomponentNames: Set<string>): ReactNode[] {\n return params.map((param, i) => {\n if (!isBlockParam(param)) {\n const children: ReactNode[] = [\n createElement('span', { key: 'open' }, '- {'),\n createElement('br'),\n ...Object.values(param).map((p) => [\n createElement(Indent),\n renderParam(p, subcomponentNames)\n ]),\n createElement('br'),\n createElement('span', { key: 'close' }, '}')\n ];\n\n return createElement(Fragment, { key: i }, ...children);\n }\n\n const isNamed = param.name && !param.name.startsWith('param');\n const displayType = param.componentRef?.exportName ?? param.type;\n\n const isSubcomponent = subcomponentNames.has(displayType);\n\n const children: ReactNode[] = [];\n const typeChildren: ReactNode[] = [];\n\n if (isSubcomponent) {\n typeChildren.push(\n createElement(\n SubcomponentLink,\n { key: 'type', href: `#subcomponent-${displayType}` },\n displayType\n )\n );\n } else {\n typeChildren.push(createElement(ParamType, { key: 'type' }, displayType));\n }\n\n if (isNamed) {\n children.push(\n createElement('span', { key: 'sep' }, '- '),\n createElement(ParamName, { key: 'name' }, param.name),\n createElement('span', { key: 'colon' }, ': '),\n ...typeChildren\n );\n } else {\n children.push(createElement('span', { key: 'sep' }, '- '), ...typeChildren);\n }\n\n const rows: ReactNode[] = [createElement(ParamRow, { key: 'row' }, ...children)];\n\n if (param.description) {\n rows.push(createElement(ParamDesc, { key: 'desc' }, param.description));\n }\n\n return createElement(Fragment, { key: i }, ...rows);\n });\n}\n\nexport function BlocksTable({\n blocks,\n subcomponentNames,\n defaultName\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n defaultName: string;\n}) {\n const entries = Object.entries(blocks).toSorted(([nameA, _a], [nameB, _b]) => {\n if (nameA === 'default') return -1;\n if (nameB === 'default') return -1;\n\n return 0;\n });\n\n if (entries.length === 0) return;\n\n const rows = [];\n\n for (const [name, block] of entries) {\n const displayName = name === 'default' ? `<${defaultName}>` : `<:${name}>`;\n\n rows.push(\n createElement('tr', { key: name }, createElement(BlocksNameCell, undefined, displayName))\n );\n\n if (block.params.length > 0) {\n const params = renderParams(block.params, subcomponentNames);\n\n rows.push(createElement('tr', undefined, createElement('td', undefined, ...params)));\n }\n }\n\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n createElement('tbody', { className: 'docblock-argstable-body' }, rows)\n );\n}\n\nexport function BlocksSection({\n blocks,\n subcomponentNames\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n}) {\n const { preparedMeta } = useOf('meta', ['meta']);\n const componentName = preparedMeta.title;\n\n return createElement(\n BlocksDiv,\n undefined,\n createElement(Subheading, undefined, 'Blocks'),\n BlocksTable({ blocks, subcomponentNames, defaultName: componentName })\n );\n}\n","import { createElement, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { isHtmlElement } from './ui';\n\nconst ElementWrapper = styled.div(({ theme }) => ({\n fontFamily: theme.typography.fonts.base,\n color: theme.color.defaultText,\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n marginTop: 25,\n marginBottom: 40,\n span: {\n '&:first-of-type': {\n fontWeight: 'bold',\n marginRight: 8\n }\n },\n code: {\n fontSize: 12,\n fontWeight: 'bold'\n },\n 'a code': {\n color: theme.color.secondary,\n textDecoration: 'none'\n },\n a: {\n color: theme.color.secondary,\n textDecoration: 'none',\n '&:hover': {\n textDecoration: 'underline'\n }\n }\n}));\n\nexport function ElementBlock({ element }: { element: string }) {\n const elements = element\n .split(' | ')\n .map((s) => s.trim())\n .filter(Boolean);\n\n if (elements.length === 0) return;\n\n const children: ReactNode[] = [createElement('span', { key: 'label' }, 'Element:')];\n\n for (const [i, name] of elements.entries()) {\n if (i > 0) {\n children.push(createElement('span', { key: `sep-${i}` }, ' | '));\n }\n\n const inner = isHtmlElement(name)\n ? createElement(\n 'a',\n {\n key: `link-${name}`,\n href: `https://developer.mozilla.org/en-US/docs/Web/API/${name}`,\n target: '_blank',\n rel: 'noopener noreferrer'\n },\n name\n )\n : name;\n\n children.push(createElement('code', { key: name }, inner));\n }\n\n return createElement(ElementWrapper, undefined, ...children);\n}\n","/* eslint-disable unicorn/no-null */\nimport { createElement } from 'react';\n\nimport { type Entry, renderBody, renderHead, TableWrapper } from './ui';\n\nfunction renderPartsBody(entries: Entry[]) {\n return createElement(\n 'tbody',\n { className: 'docblock-argstable-body' },\n ...entries.map((entry) =>\n createElement(\n 'tr',\n { key: entry.name },\n createElement(\n 'td',\n null,\n createElement(\n 'code',\n { style: { fontSize: 12, fontWeight: 'bold' } },\n `[part=\"${entry.name}\"]`\n )\n ),\n createElement('td', null, entry.description ?? '')\n )\n )\n );\n}\n\nexport function PartsTable({ entries }: { entries: Entry[] }) {\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n renderHead(['Part', 'Description']),\n renderPartsBody(entries)\n );\n}\n\nexport function CssPropertiesTable({ entries }: { entries: Entry[] }) {\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n renderHead(['Property', 'Value']),\n renderBody(entries)\n );\n}\n","import { ArgTypes, Subheading } from '@storybook/addon-docs/blocks';\nimport { createElement, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { BlocksTable, ParamRow, ParamType } from './blocks';\nimport { ElementBlock } from './element';\nimport { H2 } from './ui';\n\nimport type { SubcomponentRef } from '../signature';\nimport type { ComponentSignature } from 'ember-docgen';\n\nconst SubcomponentsSection = styled.div(() => ({\n marginTop: 25,\n marginBottom: 40\n}));\n\nconst SubEntry = styled.div(() => ({\n marginBottom: 24,\n '&:last-child': { marginBottom: 0 }\n}));\n\nconst SectionLabel = styled.div(({ theme }) => ({\n fontWeight: 'bold',\n color: theme.color.defaultText,\n fontSize: theme.typography.size.m1 - 2,\n marginBottom: 8\n}));\n\nfunction renderSubcomponentSignature(\n sig: ComponentSignature,\n subcomponentNames: Set<string>,\n defaultName: string\n): ReactNode[] {\n const children: ReactNode[] = [];\n\n if (sig.element) {\n children.push(createElement(ElementBlock, { element: sig.element }));\n }\n\n if (Object.keys(sig.args).length > 0) {\n children.push(\n createElement(SectionLabel, undefined, 'Args'),\n createElement(ArgTypes, { include: Object.keys(sig.args) })\n );\n }\n\n if (Object.keys(sig.blocks).length > 0) {\n children.push(\n createElement(SectionLabel, { key: 'blocks-label', style: { marginTop: 12 } }, 'Blocks'),\n createElement(BlocksTable, { blocks: sig.blocks, subcomponentNames, defaultName })\n );\n }\n\n return children;\n}\n\nexport function SubcomponentsArea({ components }: { components: SubcomponentRef[] }) {\n if (components.length === 0) return;\n\n const subcomponentNames = new Set(components.map((c) => c.name));\n\n const entries = components.map((comp) => {\n const children: ReactNode[] = [createElement(Subheading, undefined, comp.name)];\n\n if (comp.importPath) {\n children.push(\n createElement(\n ParamRow,\n { key: 'import', style: { marginBottom: 12 } },\n createElement('span', undefined, \"from '\"),\n createElement(ParamType, undefined, comp.importPath),\n createElement('span', undefined, \"'\")\n )\n );\n } else if (comp.signature) {\n children.push(...renderSubcomponentSignature(comp.signature, subcomponentNames, comp.name));\n }\n\n return createElement(\n SubEntry,\n { id: `subcomponent-${comp.name}`, key: comp.name },\n ...children\n );\n });\n\n return createElement(\n SubcomponentsSection,\n undefined,\n createElement(H2, undefined, 'Subcomponents'),\n ...entries\n );\n}\n","import { unwrapBlockParams } from './block-params';\n\nimport type { ComponentFile, EmberMeta } from '../../node/types';\nimport type { BlockInfo, ComponentSignature } from 'ember-docgen';\n\nexport interface SubcomponentRef {\n name: string;\n signature?: ComponentSignature;\n importPath?: string;\n}\n\nexport function applyModifiers(\n signature: ComponentSignature,\n modifiers?: { name: string; typeArgs: string[] }[]\n): ComponentSignature {\n if (!modifiers || modifiers.length === 0) return signature;\n\n const blockedKeys = new Set<string>();\n const pickedKeys = new Set<string>();\n\n for (const mod of modifiers) {\n if (mod.name === 'WithBoundArgs' || mod.name === 'Omit') {\n for (const key of mod.typeArgs) blockedKeys.add(key);\n }\n\n if (mod.name === 'Pick') {\n for (const key of mod.typeArgs) pickedKeys.add(key);\n }\n }\n\n const filtered =\n pickedKeys.size > 0\n ? Object.fromEntries(Object.entries(signature.args).filter(([k]) => pickedKeys.has(k)))\n : Object.fromEntries(Object.entries(signature.args).filter(([k]) => !blockedKeys.has(k)));\n\n return { ...signature, args: filtered };\n}\n\nexport function collectSubcomponents(\n blocks: Record<string, BlockInfo>,\n data: EmberMeta\n): SubcomponentRef[] {\n const seen = new Set<string>();\n\n const result: SubcomponentRef[] = [];\n\n for (const block of Object.values(blocks)) {\n for (const param of unwrapBlockParams(block.params)) {\n if (!param.componentRef) {\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n continue;\n }\n\n const { filePath, exportName, importPath, modifiers } = param.componentRef;\n\n if (seen.has(param.name)) {\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n continue;\n }\n\n seen.add(param.name);\n\n if (importPath) {\n result.push({ name: param.name, importPath });\n } else if (filePath && Object.hasOwn(data, filePath)) {\n const entry = data[filePath] as ComponentFile;\n\n if (Object.hasOwn(entry.signatures, exportName)) {\n const sig = entry.signatures[exportName];\n\n result.push({\n name: param.name,\n signature: applyModifiers(sig, modifiers)\n });\n }\n }\n }\n }\n\n return result;\n}\n","import {\n Controls,\n Description,\n Primary,\n Stories,\n Subheading,\n Subtitle,\n Title,\n useOf\n} from '@storybook/addon-docs/blocks';\nimport { createElement, Fragment, type ReactNode } from 'react';\nimport emberData from 'virtual:ember-storybook';\n\nimport { BlocksSection } from './blocks/blocks';\nimport { ElementBlock } from './blocks/element';\nimport { CssPropertiesTable, PartsTable } from './blocks/style';\nimport { SubcomponentsArea } from './blocks/subcomponents';\nimport { H2 } from './blocks/ui';\nimport { collectSubcomponents } from './signature';\n\nimport type { EmberMeta, StorySource } from '../../node/types';\nimport type { ComponentSignature } from 'ember-docgen';\n\nfunction addSignature(signature: ComponentSignature, data: EmberMeta) {\n const children: ReactNode[] = [];\n\n if (signature.element) {\n children.push(createElement(ElementBlock, { element: signature.element }));\n }\n\n if (Object.keys(signature.args).length > 0) {\n children.push(\n createElement(Subheading, undefined, 'Args'),\n // createElement(ArgTypes, { include: Object.keys(signature.args) }),\n createElement(Controls, { include: Object.keys(signature.args) })\n );\n }\n\n if (Object.keys(signature.blocks).length > 0) {\n const subcomponents = collectSubcomponents(signature.blocks, data);\n const subcomponentNames = new Set(subcomponents.map((s) => s.name));\n\n children.push(createElement(BlocksSection, { blocks: signature.blocks, subcomponentNames }));\n\n if (subcomponents.length > 0) {\n children.push(createElement(SubcomponentsArea, { components: subcomponents }));\n }\n }\n\n if (Object.keys(signature.style.customProperties).length > 0) {\n const entries = Object.entries(signature.style.customProperties).map(([name, description]) => ({\n name,\n description\n }));\n\n children.push(\n createElement(Subheading, undefined, 'CSS Custom Properties'),\n createElement(CssPropertiesTable, { entries })\n );\n }\n\n if (Object.keys(signature.style.parts).length > 0) {\n const entries = Object.entries(signature.style.parts).map(([name, description]) => ({\n name,\n description\n }));\n\n children.push(\n createElement(Subheading, undefined, 'Parts'),\n createElement(PartsTable, { entries })\n );\n }\n\n if (children.length > 0) {\n children.unshift(createElement(H2, undefined, 'Signature'));\n }\n\n return children;\n}\n\nexport default function Page() {\n const resolved: {\n preparedMeta?: {\n argTypes?: Record<string, unknown>;\n title?: string;\n parameters?: Record<string, unknown>;\n };\n } = useOf('meta', ['meta']);\n\n const data = emberData as Record<\n string,\n {\n meta?: unknown;\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n >;\n const storyFile = resolved.preparedMeta?.parameters?.fileName as string | undefined;\n const storyEntry = storyFile ? data[storyFile] : undefined;\n const storyComponent = storyEntry?.component;\n const compFile = storyComponent?.file;\n const compEntry = compFile ? data[compFile] : undefined;\n const signature = compEntry?.signatures?.[storyComponent?.signatureName ?? ''];\n\n const children: ReactNode[] = [\n createElement(Title),\n createElement(Subtitle),\n createElement(Description),\n createElement(Primary)\n ];\n\n if (signature) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n children.push(...addSignature(signature, emberData));\n }\n\n children.push(createElement(Stories));\n\n return createElement(Fragment, undefined, ...children);\n}\n","import { SourceType } from 'storybook/internal/docs-tools';\nimport { emitTransformCode, useEffect, useRef } from 'storybook/preview-api';\nimport emberData from 'virtual:ember-storybook';\n\nimport { unwrapBlockParams } from './block-params';\n\nimport type { StorySource } from '../../node/types';\nimport type { StoryFn } from '../public-types';\nimport type { EmberRenderer } from '../types';\nimport type { BlockInfo, ComponentSignature } from 'ember-docgen';\nimport type { Args, ArgTypes, DecoratorFunction } from 'storybook/internal/types';\n\nconst data = emberData as Record<\n string,\n {\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n>;\n\nfunction skipSourceRender(context: Parameters<DecoratorFunction<EmberRenderer>>[1]) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const sourceParams = context.parameters.docs?.source;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (sourceParams?.type === SourceType.DYNAMIC) {\n return false;\n }\n\n const isArgsStory = context.parameters.__isArgsStory as boolean;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access\n return (!isArgsStory || sourceParams?.code) ?? sourceParams?.type === SourceType.CODE;\n}\n\nexport function toArgument(key: string, value: unknown, argTypes: ArgTypes): string | undefined {\n if (value !== undefined && value !== null) {\n if (typeof value === 'string') {\n return `@${key}=${JSON.stringify(value)}`;\n }\n\n if (typeof value === 'number' || typeof value === 'boolean') {\n return `@${key}={{${String(value)}}}`;\n }\n\n if (Object.hasOwn(argTypes, key)) {\n return `@${key}={{@${key}}}`;\n }\n\n return undefined;\n }\n\n if (value === undefined && Object.hasOwn(argTypes, key)) {\n return `@${key}={{@${key}}}`;\n }\n\n return undefined;\n}\n\nfunction generateBlockContent(blockInfo: BlockInfo): string {\n if (blockInfo.params.length === 0) {\n return '...';\n }\n\n const paramNames = unwrapBlockParams(blockInfo.params)\n .map((p) => p.name)\n .join(', ');\n\n return `{{yield ${paramNames}}}`;\n}\n\nexport function generateBlockSourceCode(\n sig: ComponentSignature,\n args: Args,\n indent: string\n): string {\n const blockNames = Object.keys(sig.blocks);\n\n if (blockNames.length === 0) return '';\n\n const blocks: string[] = [];\n\n for (const blockName of blockNames) {\n const blockInfo = sig.blocks[blockName];\n const arg = (args as Record<string, unknown>)[blockName];\n\n if (arg === undefined && blockInfo.params.length === 0) {\n continue;\n }\n\n const params = unwrapBlockParams(blockInfo.params)\n .map((p) => p.name)\n .join(' ');\n const slotBindings = params ? ` as |${params}|` : '';\n\n const content = generateBlockContent(blockInfo);\n\n if (blockName === 'default' && !slotBindings) {\n blocks.push(content);\n } else {\n blocks.push(`${indent} <:${blockName}${slotBindings}>${content}</:${blockName}>`);\n }\n }\n\n return blocks.join('\\n');\n}\n\nlet byStoryId: Record<string, StorySource> | undefined;\n\nfunction getByStoryId(): Record<string, StorySource> {\n if (byStoryId) return byStoryId;\n\n byStoryId = {};\n\n for (const entry of Object.values(data)) {\n for (const [storyId, source] of Object.entries(entry.source ?? {})) {\n byStoryId[storyId] = {\n componentName: source.componentName,\n signatureName: source.signatureName,\n inlineTemplate: source.inlineTemplate\n };\n }\n }\n\n return byStoryId;\n}\n\nfunction signatureForComponent(name: string): ComponentSignature | undefined {\n for (const entry of Object.values(data)) {\n const comp = entry.component;\n\n if (comp?.signatureName !== name) continue;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n\n return compEntry?.signatures?.[comp.signatureName];\n }\n\n return undefined;\n}\n\nexport function resolveTemplateArgs(template: string, args: Args): string {\n return template.replaceAll(/\\{\\{args\\.(\\w+)\\}\\}/g, (_match, key) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const value = (args as Record<string, unknown>)[key];\n\n if (typeof value === 'string') {\n return JSON.stringify(value);\n }\n\n if (typeof value === 'number' || typeof value === 'boolean') {\n return `{{${String(value)}}}`;\n }\n\n return `{{@${key}}}`;\n });\n}\n\nexport function generateSource(\n component: { name?: string },\n args: Args,\n argTypes: ArgTypes,\n storyId?: string\n): string | undefined {\n const meta = storyId ? getByStoryId()[storyId] : undefined;\n\n if (meta?.inlineTemplate) {\n return resolveTemplateArgs(meta.inlineTemplate, args);\n }\n\n const name = meta?.componentName ?? component.name;\n\n if (!name || name === '(unknown template-only component)') {\n return undefined;\n }\n\n // Default-exported components are keyed by the `__DEFAULT__` sentinel in the\n // signatures map, while `name` is the real component name. Look the signature\n // up by the sentinel so blocks/args still resolve.\n const sig = signatureForComponent(meta?.signatureName ?? name);\n\n const propsArray = Object.entries(args)\n .filter(([k]) => !sig || !Object.hasOwn(sig.blocks, k))\n .map(([k, v]) => toArgument(k, v, argTypes))\n .filter(Boolean);\n\n const blockCode = sig ? generateBlockSourceCode(sig, args, '') : '';\n\n const propsStr = propsArray.join(' ');\n\n if (!blockCode) {\n if (propsArray.length === 0) {\n return `<${name} />`;\n }\n\n if (propsArray.length > 3) {\n return `<${name}\\n ${propsArray.join('\\n ')}\\n/>`;\n }\n\n return `<${name} ${propsStr} />`;\n }\n\n if (propsArray.length === 0) {\n return `<${name}>\\n${blockCode}\\n</${name}>`;\n }\n\n return `<${name} ${propsStr}>\\n${blockCode}\\n</${name}>`;\n}\n\nexport const sourceDecorator: DecoratorFunction<EmberRenderer> = (storyFn, context) => {\n const source = useRef<string | undefined>(undefined);\n const story = storyFn();\n\n useEffect(() => {\n // Always generate the source from the ORIGINAL story, not the decorator-wrapped\n // `storyFn()` result. A decorator wraps the story in another component, so its\n // `.name` (e.g. `IntlDecorator`) would leak into the generated source block.\n const renderedForSource = (context.originalStoryFn as StoryFn)(context.args, context);\n\n if (!skipSourceRender(context)) {\n const code =\n generateSource(renderedForSource, context.args, context.argTypes, context.id) ?? undefined;\n\n void emitTransformCode(code, context);\n source.current = code;\n }\n });\n\n return story;\n};\n","import { SourceType } from 'storybook/internal/docs-tools';\nimport emberData from 'virtual:ember-storybook';\n\nimport { buildArgTypes } from './extractArgTypes';\nimport Page from './page';\nimport { sourceDecorator } from './source-decorator';\n\nimport type { ComponentFile, EmberMeta, StoryFile } from '../../node/types';\nimport type { EmberRenderer } from '../types';\nimport type { ComponentSignature } from 'ember-docgen';\nimport type {\n DecoratorFunction,\n Parameters,\n StoryContextForEnhancers,\n StrictArgTypes\n} from 'storybook/internal/types';\n\nconst data = emberData as EmberMeta;\n\nfunction resolveSig(entry: StoryFile | ComponentFile): ComponentSignature | undefined {\n if (!('component' in entry)) return undefined;\n\n const comp = entry.component;\n\n if (!comp.signatureName) return undefined;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n\n if (!compEntry || !('signatures' in compEntry)) return undefined;\n\n return compEntry.signatures[comp.signatureName];\n}\n\nexport const argTypesEnhancers: ((\n context: StoryContextForEnhancers<EmberRenderer>\n) => StrictArgTypes)[] = [\n (context) => {\n const filePath = (context.parameters as Record<string, unknown>).fileName as string | undefined;\n\n if (filePath && Object.hasOwn(data, filePath)) {\n const sig = resolveSig(data[filePath]);\n\n if (sig) {\n return { ...buildArgTypes(sig), ...context.argTypes } as StrictArgTypes;\n }\n\n return context.argTypes;\n }\n\n const titleName = context.title.split('/').pop();\n\n if (titleName) {\n for (const entry of Object.values(data)) {\n const sig = resolveSig(entry);\n\n if (sig) {\n return { ...buildArgTypes(sig), ...context.argTypes } as StrictArgTypes;\n }\n }\n }\n\n return context.argTypes;\n }\n];\n\nexport const parameters: Parameters = {\n docs: {\n source: {\n type: SourceType.DYNAMIC,\n language: 'html'\n },\n page: Page\n }\n};\n\nexport const decorators: DecoratorFunction<EmberRenderer>[] = [sourceDecorator];\n"],"mappings":";;;;;;;;AAKA,MAAMC,SAAOD;AASb,MAAME,yBAAS,IAAIC,IAAgC;AAEnD,KAAK,MAAMC,SAASC,OAAOC,OAAOL,MAAI,GAAG;CACvC,MAAMM,OAAOH,MAAMI;CAEnB,IAAI,CAACD,MAAME,eAAe;CAG1B,MAAMI,OADYN,KAAKI,OAAOV,OAAKM,KAAKI,QAAQC,KAAAA,EAAAA,EACzBE,aAAaP,KAAKE;CAEzC,IAAII,KACFX,OAAOa,IAAIR,KAAKE,eAAeI,GAAG;AAEtC;AAEA,SAASG,iBACPC,MASmB;CACnB,QAAQA,KAAKC,UAAb;EACE,KAAK,UACH,OAAO,EAAED,MAAM,OAAO;EAExB,KAAK,UACH,OAAO,EAAEA,MAAM,SAAS;EAE1B,KAAK,WACH,OAAO,EAAEA,MAAM,UAAU;EAE3B,KAAK,YACH,OAAO,EAAEA,MAAM,WAAW;EAE5B,KAAK,QACH,OAAO;GAAEA,MAAM;GAAUE,SAASF,KAAKE,WAAW,CAAA;EAAG;EAGvD,SACE,OAAO,EAAEF,MAAM,SAAS;CAE5B;AACF;AAEA,SAAgBG,cAAcP,KAAkD;CAC9E,MAAMQ,WAAoC,CAAC;CAE3C,KAAK,MAAM,CAACC,MAAMC,QAAQlB,OAAOmB,QAAQX,IAAIY,IAAI,GAC/CJ,SAASC,QAAQ;EACfA;EACAI,aAAaH,IAAIG,eAAed,KAAAA;EAChCK,MAAM;GACJK,MAAMC,IAAIN,KAAKU;GACfC,UAAUL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D,OAAOP,QAAQO;CACjB;CAIA,IAFkBP,QAAQS,MAAMC,MAAM,GAAG,CAAC,CAACC,IAEvCH,GACF,KAAK,MAAMjB,SAASa,OAAOQ,OAAOvB,IAAI,GAAG;EACvC,MAAMiB,MAAMhB,WAAWC,KAAK;EAE5B,IAAIe,KACF,OAAO;GAAE,GAAGpB,cAAcoB,GAAG;GAAG,GAAGN,QAAQO;EAAS;CAExD;CAGF,OAAOP,QAAQO;AACjB,CAAC;AAGH,MAAaL,aAAyB,EACpCW,MAAM;CACJC,QAAQ;EACNC,MAAM/B,WAAWgC;EACjBC,UAAU;CACZ;CACAC,MAAM/B;AACR,EACF;AAEA,MAAagC,aAAiD,CAAC/B,eAAe"}
1
+ {"version":3,"file":"config.mjs","names":["emberData","data","byName","Map","entry","Object","values","comp","component","signatureName","compEntry","file","undefined","sig","signatures","set","mapTypeToControl","type","category","options","buildArgTypes","argTypes","name","arg","entries","args","description","raw","required","control","table","summary","defaultValue","extractArgTypes","displayName","get","Heading","createElement","styled","isHtmlElement","name","test","TableWrapper","table","theme","fontFamily","typography","fonts","base","borderSpacing","color","defaultText","fontSize","size","s2","lineHeight","textAlign","width","marginTop","marginBottom","marginInline","padding","border","verticalAlign","textOverflow","paddingLeft","paddingRight","th","textMutedColor","paddingTop","paddingBottom","td","tbody","filter","background","content","borderTop","appBorderColor","borderBlockStart","borderBlockEnd","borderInlineStart","borderInlineEnd","borderTopLeftRadius","appBorderRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","borderColor","renderHead","columns","className","map","col","renderBody","entries","entry","key","style","fontWeight","description","H2","weight","bold","letterSpacing","textTransform","Subheading","useOf","createElement","Fragment","styled","TableWrapper","ParamType","code","theme","color","secondary","fontSize","fontWeight","ParamName","span","defaultText","ParamRow","div","typography","size","s2","lineHeight","marginBottom","ParamDesc","textMutedColor","s1","marginLeft","BlocksDiv","marginTop","BlocksNameCell","td","position","weight","bold","background","app","SubcomponentLink","a","primary","cursor","textDecoration","Indent","marginInlineStart","renderType","param","subcomponentNames","type","displayType","componentRef","exportName","typeIsSubcomponent","has","key","href","renderParam","name","isBlockParam","Object","hasOwn","renderParams","params","map","i","children","values","p","isNamed","startsWith","isSubcomponent","typeChildren","push","rows","description","BlocksTable","blocks","defaultName","entries","toSorted","nameA","_a","nameB","_b","length","block","displayName","undefined","className","BlocksSection","preparedMeta","componentName","title","createElement","styled","isHtmlElement","ElementWrapper","div","theme","fontFamily","typography","fonts","base","color","defaultText","fontSize","size","s2","lineHeight","marginTop","marginBottom","span","fontWeight","marginRight","code","secondary","textDecoration","a","ElementBlock","element","elements","split","map","s","trim","filter","Boolean","length","children","key","i","name","entries","push","inner","href","target","rel","undefined","createElement","renderBody","renderHead","TableWrapper","renderPartsBody","entries","className","map","entry","key","name","style","fontSize","fontWeight","description","PartsTable","CssPropertiesTable","ArgTypes","Subheading","createElement","styled","BlocksTable","ParamRow","ParamType","ElementBlock","H2","SubcomponentsSection","div","marginTop","marginBottom","SubEntry","SectionLabel","theme","fontWeight","color","defaultText","fontSize","typography","size","m1","renderSubcomponentSignature","sig","subcomponentNames","defaultName","children","element","push","Object","keys","args","length","undefined","include","blocks","key","style","SubcomponentsArea","components","Set","map","c","name","entries","comp","importPath","signature","id","unwrapBlockParams","applyModifiers","signature","modifiers","length","blockedKeys","Set","pickedKeys","mod","name","key","typeArgs","add","filtered","size","Object","fromEntries","entries","args","filter","k","has","collectSubcomponents","blocks","data","seen","result","block","values","param","params","componentRef","filePath","exportName","importPath","push","hasOwn","entry","signatures","sig","Controls","Description","Primary","Stories","Subheading","Subtitle","Title","useOf","createElement","Fragment","emberData","BlocksSection","ElementBlock","CssPropertiesTable","PartsTable","SubcomponentsArea","H2","collectSubcomponents","addSignature","signature","data","children","element","push","Object","keys","args","length","undefined","include","blocks","subcomponents","subcomponentNames","Set","map","s","name","components","style","customProperties","entries","description","parts","unshift","Page","resolved","storyFile","preparedMeta","parameters","fileName","storyEntry","storyComponent","component","compFile","file","compEntry","signatures","signatureName","SourceType","emitTransformCode","useEffect","useRef","emberData","isEmberStoryResult","unwrapBlockParams","data","skipSourceRender","context","sourceParams","parameters","docs","source","type","DYNAMIC","isArgsStory","__isArgsStory","code","CODE","toArgument","key","value","argTypes","undefined","JSON","stringify","String","Object","hasOwn","generateBlockContent","blockInfo","params","length","paramNames","map","p","name","join","generateBlockSourceCode","sig","args","indent","blockNames","keys","blocks","blockName","arg","slotBindings","content","push","byStoryId","getByStoryId","entry","values","storyId","entries","componentName","signatureName","inlineTemplate","signatureForComponent","comp","component","compEntry","file","signatures","resolveTemplateArgs","template","replaceAll","_match","generateSource","meta","propsArray","filter","k","v","Boolean","blockCode","propsStr","sourceDecorator","storyFn","story","rendered","originalStoryFn","renderedForSource","id","current","SourceType","emberData","buildArgTypes","Page","sourceDecorator","data","resolveSig","entry","undefined","comp","component","signatureName","compEntry","file","signatures","argTypesEnhancers","context","filePath","parameters","fileName","Object","hasOwn","sig","argTypes","titleName","title","split","pop","values","docs","source","type","DYNAMIC","language","page","decorators"],"sources":["../../../src/client/docs/extractArgTypes.ts","../../../src/client/docs/blocks/ui.ts","../../../src/client/docs/blocks/blocks.ts","../../../src/client/docs/blocks/element.ts","../../../src/client/docs/blocks/style.ts","../../../src/client/docs/blocks/subcomponents.ts","../../../src/client/docs/signature.ts","../../../src/client/docs/page.ts","../../../src/client/docs/source-decorator.ts","../../../src/client/docs/config.ts"],"sourcesContent":["import emberData from 'virtual:ember-storybook';\n\nimport type { StorySource } from '../../node/types';\nimport type { ArgTypeInfo, ComponentSignature } from 'ember-docgen';\n\nconst data = emberData as Record<\n string,\n {\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n>;\n\nconst byName = new Map<string, ComponentSignature>();\n\nfor (const entry of Object.values(data)) {\n const comp = entry.component;\n\n if (!comp?.signatureName) continue;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n const sig = compEntry?.signatures?.[comp.signatureName];\n\n if (sig) {\n byName.set(comp.signatureName, sig);\n }\n}\n\nfunction mapTypeToControl(\n type: ArgTypeInfo\n):\n | false\n | { type: 'text' }\n | { type: 'number' }\n | { type: 'boolean' }\n | { type: 'select'; options: string[] }\n | { type: 'object' }\n | { type: 'function' }\n | { type: 'date' } {\n switch (type.category) {\n case 'string': {\n return { type: 'text' };\n }\n case 'number': {\n return { type: 'number' };\n }\n case 'boolean': {\n return { type: 'boolean' };\n }\n case 'function': {\n return { type: 'function' };\n }\n case 'enum': {\n return { type: 'select', options: type.options ?? [] };\n }\n\n default: {\n return { type: 'object' };\n }\n }\n}\n\nexport function buildArgTypes(sig: ComponentSignature): Record<string, unknown> {\n const argTypes: Record<string, unknown> = {};\n\n for (const [name, arg] of Object.entries(sig.args)) {\n argTypes[name] = {\n name,\n description: arg.description || undefined,\n type: {\n name: arg.type.raw,\n required: arg.required\n },\n control: mapTypeToControl(arg.type),\n table: {\n type: { summary: arg.type.raw },\n defaultValue: arg.defaultValue ? { summary: arg.defaultValue } : undefined\n }\n };\n }\n\n return argTypes;\n}\n\nexport function extractArgTypes(\n component: Record<string, unknown>\n): Record<string, unknown> | null {\n const name =\n (component.name as string | undefined) ?? (component.displayName as string | undefined);\n\n // eslint-disable-next-line unicorn/no-null\n if (!name) return null;\n\n const sig = byName.get(name);\n\n // eslint-disable-next-line unicorn/no-null\n if (!sig) return null;\n\n return buildArgTypes(sig);\n}\n","/* eslint-disable unicorn/no-null */\nimport { Heading } from '@storybook/addon-docs/blocks';\nimport { createElement } from 'react';\nimport { styled, type Theme } from 'storybook/theming';\n\nexport interface Entry {\n name: string;\n description?: string;\n}\n\ntype StyleProps = { theme: Theme };\n\nexport function isHtmlElement(name: string): boolean {\n return /^HTML[A-Z]\\w*Element$/.test(name);\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nexport const TableWrapper = styled.table(({ theme }: StyleProps) => ({\n fontFamily: theme.typography.fonts.base,\n borderSpacing: 0,\n color: theme.color.defaultText,\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n textAlign: 'left',\n width: '100%',\n marginTop: 25,\n marginBottom: 40,\n marginInline: 1,\n 'td, th': {\n padding: 0,\n border: 'none',\n verticalAlign: 'top',\n textOverflow: 'ellipsis'\n },\n 'th:first-of-type, td:first-of-type': {\n paddingLeft: 20\n },\n 'th:last-of-type, td:last-of-type': {\n paddingRight: 20\n },\n th: {\n color: theme.textMutedColor as string,\n paddingTop: 10,\n paddingBottom: 10,\n paddingLeft: 15,\n paddingRight: 15\n },\n td: {\n paddingTop: '10px',\n paddingBottom: '10px',\n '&:not(:first-of-type)': {\n paddingLeft: 15,\n paddingRight: 15\n },\n '&:last-of-type': {\n paddingRight: 20\n }\n },\n tbody: {\n filter:\n theme.base === 'light'\n ? 'drop-shadow(0px 1px 3px rgba(0, 0, 0, 0.10))'\n : 'drop-shadow(0px 1px 3px rgba(0, 0, 0, 0.20))',\n '> tr > *': {\n background: theme.background.content,\n borderTop: `1px solid ${theme.appBorderColor}`\n },\n '> tr:first-of-type > *': {\n borderBlockStart: `1px solid ${theme.appBorderColor}`\n },\n '> tr:last-of-type > *': {\n borderBlockEnd: `1px solid ${theme.appBorderColor}`\n },\n '> tr > *:first-of-type': {\n borderInlineStart: `1px solid ${theme.appBorderColor}`\n },\n '> tr > *:last-of-type': {\n borderInlineEnd: `1px solid ${theme.appBorderColor}`\n },\n '> tr:first-of-type > td:first-of-type': {\n borderTopLeftRadius: theme.appBorderRadius\n },\n '> tr:first-of-type > td:last-of-type': {\n borderTopRightRadius: theme.appBorderRadius\n },\n '> tr:last-of-type > td:first-of-type': {\n borderBottomLeftRadius: theme.appBorderRadius\n },\n '> tr:last-of-type > td:last-of-type': {\n borderBottomRightRadius: theme.appBorderRadius\n }\n },\n '@media (forced-colors: active)': {\n tbody: {\n filter: 'none',\n '> tr > *': {\n borderColor: 'CanvasText'\n }\n }\n }\n}));\n\nexport function renderHead(columns: string[]) {\n return createElement(\n 'thead',\n { className: 'docblock-argstable-head' },\n createElement(\n 'tr',\n null,\n ...columns.map((col) => createElement('th', null, createElement('span', null, col)))\n )\n );\n}\n\nexport function renderBody(entries: Entry[]) {\n return createElement(\n 'tbody',\n { className: 'docblock-argstable-body' },\n ...entries.map((entry) =>\n createElement(\n 'tr',\n { key: entry.name },\n createElement(\n 'td',\n null,\n createElement('span', { style: { fontWeight: 'bold' } }, entry.name)\n ),\n createElement('td', null, entry.description ?? '')\n )\n )\n );\n}\n\nexport const H2 = styled(Heading)(({ theme }) => ({\n fontSize: `${theme.typography.size.s2 - 1}px`,\n fontWeight: theme.typography.weight.bold,\n lineHeight: '16px',\n letterSpacing: '0.35em',\n textTransform: 'uppercase',\n color: theme.textMutedColor as string,\n border: 0,\n marginBottom: '12px',\n '&:first-of-type': { marginTop: '56px' }\n}));\n","import { Subheading, useOf } from '@storybook/addon-docs/blocks';\nimport { createElement, Fragment, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { TableWrapper } from './ui';\n\nimport type { BlockInfo, BlockParam, HashBlockParam } from 'ember-docgen';\n\nexport const ParamType = styled.code(({ theme }) => ({\n color: theme.color.secondary,\n fontSize: 12,\n fontWeight: 'bold'\n}));\n\nconst ParamName = styled.span(({ theme }) => ({\n fontWeight: 'bold',\n color: theme.color.defaultText\n}));\n\nexport const ParamRow = styled.div(({ theme }) => ({\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n marginBottom: 2\n}));\n\nconst ParamDesc = styled.div(({ theme }) => ({\n color: theme.textMutedColor as string,\n fontSize: theme.typography.size.s1,\n lineHeight: '17px',\n marginBottom: 8,\n marginLeft: 20\n}));\n\nconst BlocksDiv = styled.div(() => ({\n marginTop: 25,\n marginBottom: 40\n}));\n\nconst BlocksNameCell = styled.td(({ theme }) => ({\n position: 'relative',\n fontWeight: theme.typography.weight.bold,\n fontSize: theme.typography.size.s1,\n background: `${theme.background.app} !important`,\n '& ~ td': {\n background: `${theme.background.app} !important`\n }\n}));\n\nconst SubcomponentLink = styled.a(({ theme }) => ({\n color: theme.color.primary,\n fontWeight: 'bold',\n cursor: 'pointer',\n textDecoration: 'none',\n '&:hover': { textDecoration: 'underline' }\n}));\n\nconst Indent = styled.span(() => ({\n marginInlineStart: '20px'\n}));\n\nfunction renderType(param: BlockParam, subcomponentNames: Set<string>): ReactNode {\n if (param.type === 'Invokable') {\n const displayType = param.componentRef?.exportName ?? param.type;\n const typeIsSubcomponent = subcomponentNames.has(displayType);\n\n return typeIsSubcomponent\n ? createElement(\n SubcomponentLink,\n { key: 'type', href: `#subcomponent-${displayType}` },\n displayType\n )\n : createElement(ParamType, { key: 'type' }, displayType);\n }\n\n return createElement(ParamType, { key: 'type' }, param.type);\n}\n\nfunction renderParam(param: BlockParam, subcomponentNames: Set<string>): ReactNode[] {\n const type = renderType(param, subcomponentNames);\n const name = createElement(ParamName, { key: 'name' }, param.name);\n\n return [name, createElement('span', { key: 'colon' }, ': '), type];\n}\n\nfunction isBlockParam(param: BlockParam | HashBlockParam): param is BlockParam {\n return Object.hasOwn(param, 'name') && Object.hasOwn(param, 'type');\n}\n\nfunction renderParams(params: BlockInfo['params'], subcomponentNames: Set<string>): ReactNode[] {\n return params.map((param, i) => {\n if (!isBlockParam(param)) {\n const children: ReactNode[] = [\n createElement('span', { key: 'open' }, '- {'),\n createElement('br'),\n ...Object.values(param).map((p) => [\n createElement(Indent),\n renderParam(p, subcomponentNames)\n ]),\n createElement('br'),\n createElement('span', { key: 'close' }, '}')\n ];\n\n return createElement(Fragment, { key: i }, ...children);\n }\n\n const isNamed = param.name && !param.name.startsWith('param');\n const displayType = param.componentRef?.exportName ?? param.type;\n\n const isSubcomponent = subcomponentNames.has(displayType);\n\n const children: ReactNode[] = [];\n const typeChildren: ReactNode[] = [];\n\n if (isSubcomponent) {\n typeChildren.push(\n createElement(\n SubcomponentLink,\n { key: 'type', href: `#subcomponent-${displayType}` },\n displayType\n )\n );\n } else {\n typeChildren.push(createElement(ParamType, { key: 'type' }, displayType));\n }\n\n if (isNamed) {\n children.push(\n createElement('span', { key: 'sep' }, '- '),\n createElement(ParamName, { key: 'name' }, param.name),\n createElement('span', { key: 'colon' }, ': '),\n ...typeChildren\n );\n } else {\n children.push(createElement('span', { key: 'sep' }, '- '), ...typeChildren);\n }\n\n const rows: ReactNode[] = [createElement(ParamRow, { key: 'row' }, ...children)];\n\n if (param.description) {\n rows.push(createElement(ParamDesc, { key: 'desc' }, param.description));\n }\n\n return createElement(Fragment, { key: i }, ...rows);\n });\n}\n\nexport function BlocksTable({\n blocks,\n subcomponentNames,\n defaultName\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n defaultName: string;\n}) {\n const entries = Object.entries(blocks).toSorted(([nameA, _a], [nameB, _b]) => {\n if (nameA === 'default') return -1;\n if (nameB === 'default') return -1;\n\n return 0;\n });\n\n if (entries.length === 0) return;\n\n const rows = [];\n\n for (const [name, block] of entries) {\n const displayName = name === 'default' ? `<${defaultName}>` : `<:${name}>`;\n\n rows.push(\n createElement('tr', { key: name }, createElement(BlocksNameCell, undefined, displayName))\n );\n\n if (block.params.length > 0) {\n const params = renderParams(block.params, subcomponentNames);\n\n rows.push(createElement('tr', undefined, createElement('td', undefined, ...params)));\n }\n }\n\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n createElement('tbody', { className: 'docblock-argstable-body' }, rows)\n );\n}\n\nexport function BlocksSection({\n blocks,\n subcomponentNames\n}: {\n blocks: Record<string, BlockInfo>;\n subcomponentNames: Set<string>;\n}) {\n const { preparedMeta } = useOf('meta', ['meta']);\n const componentName = preparedMeta.title;\n\n return createElement(\n BlocksDiv,\n undefined,\n createElement(Subheading, undefined, 'Blocks'),\n BlocksTable({ blocks, subcomponentNames, defaultName: componentName })\n );\n}\n","import { createElement, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { isHtmlElement } from './ui';\n\nconst ElementWrapper = styled.div(({ theme }) => ({\n fontFamily: theme.typography.fonts.base,\n color: theme.color.defaultText,\n fontSize: theme.typography.size.s2 - 1,\n lineHeight: '19px',\n marginTop: 25,\n marginBottom: 40,\n span: {\n '&:first-of-type': {\n fontWeight: 'bold',\n marginRight: 8\n }\n },\n code: {\n fontSize: 12,\n fontWeight: 'bold'\n },\n 'a code': {\n color: theme.color.secondary,\n textDecoration: 'none'\n },\n a: {\n color: theme.color.secondary,\n textDecoration: 'none',\n '&:hover': {\n textDecoration: 'underline'\n }\n }\n}));\n\nexport function ElementBlock({ element }: { element: string }) {\n const elements = element\n .split(' | ')\n .map((s) => s.trim())\n .filter(Boolean);\n\n if (elements.length === 0) return;\n\n const children: ReactNode[] = [createElement('span', { key: 'label' }, 'Element:')];\n\n for (const [i, name] of elements.entries()) {\n if (i > 0) {\n children.push(createElement('span', { key: `sep-${i}` }, ' | '));\n }\n\n const inner = isHtmlElement(name)\n ? createElement(\n 'a',\n {\n key: `link-${name}`,\n href: `https://developer.mozilla.org/en-US/docs/Web/API/${name}`,\n target: '_blank',\n rel: 'noopener noreferrer'\n },\n name\n )\n : name;\n\n children.push(createElement('code', { key: name }, inner));\n }\n\n return createElement(ElementWrapper, undefined, ...children);\n}\n","/* eslint-disable unicorn/no-null */\nimport { createElement } from 'react';\n\nimport { type Entry, renderBody, renderHead, TableWrapper } from './ui';\n\nfunction renderPartsBody(entries: Entry[]) {\n return createElement(\n 'tbody',\n { className: 'docblock-argstable-body' },\n ...entries.map((entry) =>\n createElement(\n 'tr',\n { key: entry.name },\n createElement(\n 'td',\n null,\n createElement(\n 'code',\n { style: { fontSize: 12, fontWeight: 'bold' } },\n `[part=\"${entry.name}\"]`\n )\n ),\n createElement('td', null, entry.description ?? '')\n )\n )\n );\n}\n\nexport function PartsTable({ entries }: { entries: Entry[] }) {\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n renderHead(['Part', 'Description']),\n renderPartsBody(entries)\n );\n}\n\nexport function CssPropertiesTable({ entries }: { entries: Entry[] }) {\n return createElement(\n TableWrapper,\n { className: 'docblock-argstable sb-unstyled' },\n renderHead(['Property', 'Value']),\n renderBody(entries)\n );\n}\n","import { ArgTypes, Subheading } from '@storybook/addon-docs/blocks';\nimport { createElement, type ReactNode } from 'react';\nimport { styled } from 'storybook/theming';\n\nimport { BlocksTable, ParamRow, ParamType } from './blocks';\nimport { ElementBlock } from './element';\nimport { H2 } from './ui';\n\nimport type { SubcomponentRef } from '../signature';\nimport type { ComponentSignature } from 'ember-docgen';\n\nconst SubcomponentsSection = styled.div(() => ({\n marginTop: 25,\n marginBottom: 40\n}));\n\nconst SubEntry = styled.div(() => ({\n marginBottom: 24,\n '&:last-child': { marginBottom: 0 }\n}));\n\nconst SectionLabel = styled.div(({ theme }) => ({\n fontWeight: 'bold',\n color: theme.color.defaultText,\n fontSize: theme.typography.size.m1 - 2,\n marginBottom: 8\n}));\n\nfunction renderSubcomponentSignature(\n sig: ComponentSignature,\n subcomponentNames: Set<string>,\n defaultName: string\n): ReactNode[] {\n const children: ReactNode[] = [];\n\n if (sig.element) {\n children.push(createElement(ElementBlock, { element: sig.element }));\n }\n\n if (Object.keys(sig.args).length > 0) {\n children.push(\n createElement(SectionLabel, undefined, 'Args'),\n createElement(ArgTypes, { include: Object.keys(sig.args) })\n );\n }\n\n if (Object.keys(sig.blocks).length > 0) {\n children.push(\n createElement(SectionLabel, { key: 'blocks-label', style: { marginTop: 12 } }, 'Blocks'),\n createElement(BlocksTable, { blocks: sig.blocks, subcomponentNames, defaultName })\n );\n }\n\n return children;\n}\n\nexport function SubcomponentsArea({ components }: { components: SubcomponentRef[] }) {\n if (components.length === 0) return;\n\n const subcomponentNames = new Set(components.map((c) => c.name));\n\n const entries = components.map((comp) => {\n const children: ReactNode[] = [createElement(Subheading, undefined, comp.name)];\n\n if (comp.importPath) {\n children.push(\n createElement(\n ParamRow,\n { key: 'import', style: { marginBottom: 12 } },\n createElement('span', undefined, \"from '\"),\n createElement(ParamType, undefined, comp.importPath),\n createElement('span', undefined, \"'\")\n )\n );\n } else if (comp.signature) {\n children.push(...renderSubcomponentSignature(comp.signature, subcomponentNames, comp.name));\n }\n\n return createElement(\n SubEntry,\n { id: `subcomponent-${comp.name}`, key: comp.name },\n ...children\n );\n });\n\n return createElement(\n SubcomponentsSection,\n undefined,\n createElement(H2, undefined, 'Subcomponents'),\n ...entries\n );\n}\n","import { unwrapBlockParams } from './block-params';\n\nimport type { ComponentFile, EmberMeta } from '../../node/types';\nimport type { BlockInfo, ComponentSignature } from 'ember-docgen';\n\nexport interface SubcomponentRef {\n name: string;\n signature?: ComponentSignature;\n importPath?: string;\n}\n\nexport function applyModifiers(\n signature: ComponentSignature,\n modifiers?: { name: string; typeArgs: string[] }[]\n): ComponentSignature {\n if (!modifiers || modifiers.length === 0) return signature;\n\n const blockedKeys = new Set<string>();\n const pickedKeys = new Set<string>();\n\n for (const mod of modifiers) {\n if (mod.name === 'WithBoundArgs' || mod.name === 'Omit') {\n for (const key of mod.typeArgs) blockedKeys.add(key);\n }\n\n if (mod.name === 'Pick') {\n for (const key of mod.typeArgs) pickedKeys.add(key);\n }\n }\n\n const filtered =\n pickedKeys.size > 0\n ? Object.fromEntries(Object.entries(signature.args).filter(([k]) => pickedKeys.has(k)))\n : Object.fromEntries(Object.entries(signature.args).filter(([k]) => !blockedKeys.has(k)));\n\n return { ...signature, args: filtered };\n}\n\nexport function collectSubcomponents(\n blocks: Record<string, BlockInfo>,\n data: EmberMeta\n): SubcomponentRef[] {\n const seen = new Set<string>();\n\n const result: SubcomponentRef[] = [];\n\n for (const block of Object.values(blocks)) {\n for (const param of unwrapBlockParams(block.params)) {\n if (!param.componentRef) {\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n continue;\n }\n\n const { filePath, exportName, importPath, modifiers } = param.componentRef;\n\n if (seen.has(param.name)) {\n // eslint-disable-next-line unicorn/no-break-in-nested-loop\n continue;\n }\n\n seen.add(param.name);\n\n if (importPath) {\n result.push({ name: param.name, importPath });\n } else if (filePath && Object.hasOwn(data, filePath)) {\n const entry = data[filePath] as ComponentFile;\n\n if (Object.hasOwn(entry.signatures, exportName)) {\n const sig = entry.signatures[exportName];\n\n result.push({\n name: param.name,\n signature: applyModifiers(sig, modifiers)\n });\n }\n }\n }\n }\n\n return result;\n}\n","import {\n Controls,\n Description,\n Primary,\n Stories,\n Subheading,\n Subtitle,\n Title,\n useOf\n} from '@storybook/addon-docs/blocks';\nimport { createElement, Fragment, type ReactNode } from 'react';\nimport emberData from 'virtual:ember-storybook';\n\nimport { BlocksSection } from './blocks/blocks';\nimport { ElementBlock } from './blocks/element';\nimport { CssPropertiesTable, PartsTable } from './blocks/style';\nimport { SubcomponentsArea } from './blocks/subcomponents';\nimport { H2 } from './blocks/ui';\nimport { collectSubcomponents } from './signature';\n\nimport type { EmberMeta, StorySource } from '../../node/types';\nimport type { ComponentSignature } from 'ember-docgen';\n\nfunction addSignature(signature: ComponentSignature, data: EmberMeta) {\n const children: ReactNode[] = [];\n\n if (signature.element) {\n children.push(createElement(ElementBlock, { element: signature.element }));\n }\n\n if (Object.keys(signature.args).length > 0) {\n children.push(\n createElement(Subheading, undefined, 'Args'),\n // createElement(ArgTypes, { include: Object.keys(signature.args) }),\n createElement(Controls, { include: Object.keys(signature.args) })\n );\n }\n\n if (Object.keys(signature.blocks).length > 0) {\n const subcomponents = collectSubcomponents(signature.blocks, data);\n const subcomponentNames = new Set(subcomponents.map((s) => s.name));\n\n children.push(createElement(BlocksSection, { blocks: signature.blocks, subcomponentNames }));\n\n if (subcomponents.length > 0) {\n children.push(createElement(SubcomponentsArea, { components: subcomponents }));\n }\n }\n\n if (Object.keys(signature.style.customProperties).length > 0) {\n const entries = Object.entries(signature.style.customProperties).map(([name, description]) => ({\n name,\n description\n }));\n\n children.push(\n createElement(Subheading, undefined, 'CSS Custom Properties'),\n createElement(CssPropertiesTable, { entries })\n );\n }\n\n if (Object.keys(signature.style.parts).length > 0) {\n const entries = Object.entries(signature.style.parts).map(([name, description]) => ({\n name,\n description\n }));\n\n children.push(\n createElement(Subheading, undefined, 'Parts'),\n createElement(PartsTable, { entries })\n );\n }\n\n if (children.length > 0) {\n children.unshift(createElement(H2, undefined, 'Signature'));\n }\n\n return children;\n}\n\nexport default function Page() {\n const resolved: {\n preparedMeta?: {\n argTypes?: Record<string, unknown>;\n title?: string;\n parameters?: Record<string, unknown>;\n };\n } = useOf('meta', ['meta']);\n\n const data = emberData as Record<\n string,\n {\n meta?: unknown;\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n >;\n const storyFile = resolved.preparedMeta?.parameters?.fileName as string | undefined;\n const storyEntry = storyFile ? data[storyFile] : undefined;\n const storyComponent = storyEntry?.component;\n const compFile = storyComponent?.file;\n const compEntry = compFile ? data[compFile] : undefined;\n const signature = compEntry?.signatures?.[storyComponent?.signatureName ?? ''];\n\n const children: ReactNode[] = [\n createElement(Title),\n createElement(Subtitle),\n createElement(Description),\n createElement(Primary)\n ];\n\n if (signature) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n children.push(...addSignature(signature, emberData));\n }\n\n children.push(createElement(Stories));\n\n return createElement(Fragment, undefined, ...children);\n}\n","import { SourceType } from 'storybook/internal/docs-tools';\nimport { emitTransformCode, useEffect, useRef } from 'storybook/preview-api';\nimport emberData from 'virtual:ember-storybook';\n\nimport { isEmberStoryResult } from '../story-result';\nimport { unwrapBlockParams } from './block-params';\n\nimport type { StorySource } from '../../node/types';\nimport type { StoryFn } from '../public-types';\nimport type { EmberRenderer } from '../types';\nimport type { BlockInfo, ComponentSignature } from 'ember-docgen';\nimport type { Args, ArgTypes, DecoratorFunction } from 'storybook/internal/types';\n\nconst data = emberData as Record<\n string,\n {\n component?: { file?: string; signatureName?: string };\n source?: Record<string, StorySource>;\n signatures?: Record<string, ComponentSignature>;\n }\n>;\n\nfunction skipSourceRender(context: Parameters<DecoratorFunction<EmberRenderer>>[1]) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const sourceParams = context.parameters.docs?.source;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (sourceParams?.type === SourceType.DYNAMIC) {\n return false;\n }\n\n const isArgsStory = context.parameters.__isArgsStory as boolean;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access\n return (!isArgsStory || sourceParams?.code) ?? sourceParams?.type === SourceType.CODE;\n}\n\nexport function toArgument(key: string, value: unknown, argTypes: ArgTypes): string | undefined {\n if (value !== undefined && value !== null) {\n if (typeof value === 'string') {\n return `@${key}=${JSON.stringify(value)}`;\n }\n\n if (typeof value === 'number' || typeof value === 'boolean') {\n return `@${key}={{${String(value)}}}`;\n }\n\n if (Object.hasOwn(argTypes, key)) {\n return `@${key}={{@${key}}}`;\n }\n\n return undefined;\n }\n\n if (value === undefined && Object.hasOwn(argTypes, key)) {\n return `@${key}={{@${key}}}`;\n }\n\n return undefined;\n}\n\nfunction generateBlockContent(blockInfo: BlockInfo): string {\n if (blockInfo.params.length === 0) {\n return '...';\n }\n\n const paramNames = unwrapBlockParams(blockInfo.params)\n .map((p) => p.name)\n .join(', ');\n\n return `{{yield ${paramNames}}}`;\n}\n\nexport function generateBlockSourceCode(\n sig: ComponentSignature,\n args: Args,\n indent: string\n): string {\n const blockNames = Object.keys(sig.blocks);\n\n if (blockNames.length === 0) return '';\n\n const blocks: string[] = [];\n\n for (const blockName of blockNames) {\n const blockInfo = sig.blocks[blockName];\n const arg = (args as Record<string, unknown>)[blockName];\n\n if (arg === undefined && blockInfo.params.length === 0) {\n continue;\n }\n\n const params = unwrapBlockParams(blockInfo.params)\n .map((p) => p.name)\n .join(' ');\n const slotBindings = params ? ` as |${params}|` : '';\n\n const content = generateBlockContent(blockInfo);\n\n if (blockName === 'default' && !slotBindings) {\n blocks.push(content);\n } else {\n blocks.push(`${indent} <:${blockName}${slotBindings}>${content}</:${blockName}>`);\n }\n }\n\n return blocks.join('\\n');\n}\n\nlet byStoryId: Record<string, StorySource> | undefined;\n\nfunction getByStoryId(): Record<string, StorySource> {\n if (byStoryId) return byStoryId;\n\n byStoryId = {};\n\n for (const entry of Object.values(data)) {\n for (const [storyId, source] of Object.entries(entry.source ?? {})) {\n byStoryId[storyId] = {\n componentName: source.componentName,\n signatureName: source.signatureName,\n inlineTemplate: source.inlineTemplate\n };\n }\n }\n\n return byStoryId;\n}\n\nfunction signatureForComponent(name: string): ComponentSignature | undefined {\n for (const entry of Object.values(data)) {\n const comp = entry.component;\n\n if (comp?.signatureName !== name) continue;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n\n return compEntry?.signatures?.[comp.signatureName];\n }\n\n return undefined;\n}\n\nexport function resolveTemplateArgs(template: string, args: Args): string {\n return template.replaceAll(/\\{\\{args\\.(\\w+)\\}\\}/g, (_match, key) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const value = (args as Record<string, unknown>)[key];\n\n if (typeof value === 'string') {\n return JSON.stringify(value);\n }\n\n if (typeof value === 'number' || typeof value === 'boolean') {\n return `{{${String(value)}}}`;\n }\n\n return `{{@${key}}}`;\n });\n}\n\nexport function generateSource(\n component: { name?: string },\n args: Args,\n argTypes: ArgTypes,\n storyId?: string\n): string | undefined {\n const meta = storyId ? getByStoryId()[storyId] : undefined;\n\n if (meta?.inlineTemplate) {\n return resolveTemplateArgs(meta.inlineTemplate, args);\n }\n\n const name = meta?.componentName ?? component.name;\n\n if (!name || name === '(unknown template-only component)') {\n return undefined;\n }\n\n // Default-exported components are keyed by the `__DEFAULT__` sentinel in the\n // signatures map, while `name` is the real component name. Look the signature\n // up by the sentinel so blocks/args still resolve.\n const sig = signatureForComponent(meta?.signatureName ?? name);\n\n const propsArray = Object.entries(args)\n .filter(([k]) => !sig || !Object.hasOwn(sig.blocks, k))\n .map(([k, v]) => toArgument(k, v, argTypes))\n .filter(Boolean);\n\n const blockCode = sig ? generateBlockSourceCode(sig, args, '') : '';\n\n const propsStr = propsArray.join(' ');\n\n if (!blockCode) {\n if (propsArray.length === 0) {\n return `<${name} />`;\n }\n\n if (propsArray.length > 3) {\n return `<${name}\\n ${propsArray.join('\\n ')}\\n/>`;\n }\n\n return `<${name} ${propsStr} />`;\n }\n\n if (propsArray.length === 0) {\n return `<${name}>\\n${blockCode}\\n</${name}>`;\n }\n\n return `<${name} ${propsStr}>\\n${blockCode}\\n</${name}>`;\n}\n\nexport const sourceDecorator: DecoratorFunction<EmberRenderer> = (storyFn, context) => {\n const source = useRef<string | undefined>(undefined);\n const story = storyFn();\n\n useEffect(() => {\n // Always generate the source from the ORIGINAL story, not the decorator-wrapped\n // `storyFn()` result. A decorator wraps the story in another component, so its\n // `.name` (e.g. `IntlDecorator`) would leak into the generated source block.\n const rendered = (context.originalStoryFn as StoryFn)(context.args, context);\n const renderedForSource = isEmberStoryResult(rendered) ? rendered.component : rendered;\n\n if (!skipSourceRender(context)) {\n const code =\n generateSource(renderedForSource, context.args, context.argTypes, context.id) ?? undefined;\n\n void emitTransformCode(code, context);\n source.current = code;\n }\n });\n\n return story;\n};\n","import { SourceType } from 'storybook/internal/docs-tools';\nimport emberData from 'virtual:ember-storybook';\n\nimport { buildArgTypes } from './extractArgTypes';\nimport Page from './page';\nimport { sourceDecorator } from './source-decorator';\n\nimport type { ComponentFile, EmberMeta, StoryFile } from '../../node/types';\nimport type { EmberRenderer } from '../types';\nimport type { ComponentSignature } from 'ember-docgen';\nimport type {\n DecoratorFunction,\n Parameters,\n StoryContextForEnhancers,\n StrictArgTypes\n} from 'storybook/internal/types';\n\nconst data = emberData as EmberMeta;\n\nfunction resolveSig(entry: StoryFile | ComponentFile): ComponentSignature | undefined {\n if (!('component' in entry)) return undefined;\n\n const comp = entry.component;\n\n if (!comp.signatureName) return undefined;\n\n const compEntry = comp.file ? data[comp.file] : undefined;\n\n if (!compEntry || !('signatures' in compEntry)) return undefined;\n\n return compEntry.signatures[comp.signatureName];\n}\n\nexport const argTypesEnhancers: ((\n context: StoryContextForEnhancers<EmberRenderer>\n) => StrictArgTypes)[] = [\n (context) => {\n const filePath = (context.parameters as Record<string, unknown>).fileName as string | undefined;\n\n if (filePath && Object.hasOwn(data, filePath)) {\n const sig = resolveSig(data[filePath]);\n\n if (sig) {\n return { ...buildArgTypes(sig), ...context.argTypes } as StrictArgTypes;\n }\n\n return context.argTypes;\n }\n\n const titleName = context.title.split('/').pop();\n\n if (titleName) {\n for (const entry of Object.values(data)) {\n const sig = resolveSig(entry);\n\n if (sig) {\n return { ...buildArgTypes(sig), ...context.argTypes } as StrictArgTypes;\n }\n }\n }\n\n return context.argTypes;\n }\n];\n\nexport const parameters: Parameters = {\n docs: {\n source: {\n type: SourceType.DYNAMIC,\n language: 'html'\n },\n page: Page\n }\n};\n\nexport const decorators: DecoratorFunction<EmberRenderer>[] = [sourceDecorator];\n"],"mappings":";;;;;;;;;AAKA,MAAMC,SAAOD;AASb,MAAME,yBAAS,IAAIC,IAAgC;AAEnD,KAAK,MAAMC,SAASC,OAAOC,OAAOL,MAAI,GAAG;CACvC,MAAMM,OAAOH,MAAMI;CAEnB,IAAI,CAACD,MAAME,eAAe;CAG1B,MAAMI,OADYN,KAAKI,OAAOV,OAAKM,KAAKI,QAAQC,KAAAA,EAAAA,EACzBE,aAAaP,KAAKE;CAEzC,IAAII,KACFX,OAAOa,IAAIR,KAAKE,eAAeI,GAAG;AAEtC;AAEA,SAASG,iBACPC,MASmB;CACnB,QAAQA,KAAKC,UAAb;EACE,KAAK,UACH,OAAO,EAAED,MAAM,OAAO;EAExB,KAAK,UACH,OAAO,EAAEA,MAAM,SAAS;EAE1B,KAAK,WACH,OAAO,EAAEA,MAAM,UAAU;EAE3B,KAAK,YACH,OAAO,EAAEA,MAAM,WAAW;EAE5B,KAAK,QACH,OAAO;GAAEA,MAAM;GAAUE,SAASF,KAAKE,WAAW,CAAA;EAAG;EAGvD,SACE,OAAO,EAAEF,MAAM,SAAS;CAE5B;AACF;AAEA,SAAgBG,cAAcP,KAAkD;CAC9E,MAAMQ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KAAKE;AACnC;AAEA,MAAaI,oBAEY,EACtBC,YAAY;CACX,MAAMC,WAAYD,QAAQE,WAAuCC;CAEjE,IAAIF,YAAYG,OAAOC,OAAOhB,MAAMY,QAAQ,GAAG;EAC7C,MAAMK,MAAMhB,WAAWD,KAAKY,SAAS;EAErC,IAAIK,KACF,OAAO;GAAE,GAAGpB,cAAcoB,GAAG;GAAG,GAAGN,QAAQO;EAAS;EAGtD,OAAOP,QAAQO;CACjB;CAIA,IAFkBP,QAAQS,MAAMC,MAAM,GAAG,CAAC,CAACC,IAEvCH,GACF,KAAK,MAAMjB,SAASa,OAAOQ,OAAOvB,IAAI,GAAG;EACvC,MAAMiB,MAAMhB,WAAWC,KAAK;EAE5B,IAAIe,KACF,OAAO;GAAE,GAAGpB,cAAcoB,GAAG;GAAG,GAAGN,QAAQO;EAAS;CAExD;CAGF,OAAOP,QAAQO;AACjB,CAAC;AAGH,MAAaL,aAAyB,EACpCW,MAAM;CACJC,QAAQ;EACNC,MAAM/B,WAAWgC;EACjBC,UAAU;CACZ;CACAC,MAAM/B;AACR,EACF;AAEA,MAAagC,aAAiD,CAAC/B,eAAe"}
@@ -1,3 +1,3 @@
1
- import { n as renderToCanvas } from "../render-B0rRnyCZ.mjs";
2
- import { n as setProjectAnnotations, t as RenderStory } from "../client-CjnOdn6v.mjs";
1
+ import { n as renderToCanvas } from "../render-D_vlc6Py.mjs";
2
+ import { n as setProjectAnnotations, t as RenderStory } from "../client-7-bGnBBX.mjs";
3
3
  export { RenderStory, renderToCanvas, setProjectAnnotations };
@@ -1,9 +1,10 @@
1
- import { r as render_exports } from "./render-B0rRnyCZ.mjs";
1
+ import { r as render_exports } from "./render-D_vlc6Py.mjs";
2
+ import { r as normalizeStoryResult } from "./story-result-CCx6LMia.mjs";
2
3
  import { setDefaultProjectAnnotations, setProjectAnnotations } from "storybook/preview-api";
4
+ import { renderComponent } from "@ember/renderer";
3
5
  import { template } from "@ember/template-compiler";
4
6
  import Component from "@glimmer/component";
5
7
  import { getOwner } from "@ember/owner";
6
- import { renderComponent } from "@ember/renderer";
7
8
  import { modifier } from "ember-modifier";
8
9
  //#region src/client/globals.ts
9
10
  globalThis.STORYBOOK_ENV = "ember";
@@ -36,12 +37,11 @@ function setProjectAnnotations$1(projectAnnotations) {
36
37
  //#region src/client/render-story.gts
37
38
  var RenderStory = class extends Component {
38
39
  render = modifier((element) => {
39
- const component = this.args.story();
40
- const owner = getOwner(this);
40
+ const { component, args } = normalizeStoryResult(this.args.story(), this.args.args);
41
41
  const result = renderComponent(component, {
42
- args: this.args.args,
42
+ args,
43
43
  into: element,
44
- owner
44
+ owner: getOwner(this)
45
45
  });
46
46
  return () => {
47
47
  result.destroy();
@@ -59,4 +59,4 @@ var RenderStory = class extends Component {
59
59
  //#endregion
60
60
  export { setProjectAnnotations$1 as n, RenderStory as t };
61
61
 
62
- //# sourceMappingURL=client-CjnOdn6v.mjs.map
62
+ //# sourceMappingURL=client-7-bGnBBX.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-CjnOdn6v.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\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 component = this.args.story();\n const owner = getOwner(this);\n const result = renderComponent(component, {\n args: this.args.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;;;AC1BA,IAAa,cAAb,cAAiC,UAAU;CACzC,SAAS,UAAU,YAAS;EAC1B,MAAM,YAAY,KAAK,KAAK,MAAK;EACjC,MAAM,QAAQ,SAAS,IAAI;EAC3B,MAAM,SAAS,gBAAgB,WAAW;GACxC,MAAM,KAAK,KAAK;GAChB,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-7-bGnBBX.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 } = normalizeStoryResult(story, this.args.args);\n const owner = getOwner(this);\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,SAAS,qBADd,KAAK,KAAK,MACyB,GAAO,KAAK,KAAK,IAAI;EAEtE,MAAM,SAAS,gBAAgB,WAAW;GACxC;GACA,MAAM;GACN,OAJY,SAAS,IAIrB;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,3 +1,3 @@
1
- import { n as renderToCanvas } from "./render-B0rRnyCZ.mjs";
2
- import { n as setProjectAnnotations, t as RenderStory } from "./client-CjnOdn6v.mjs";
1
+ import { n as renderToCanvas } from "./render-D_vlc6Py.mjs";
2
+ import { n as setProjectAnnotations, t as RenderStory } from "./client-7-bGnBBX.mjs";
3
3
  export { RenderStory, renderToCanvas, setProjectAnnotations };
@@ -0,0 +1,125 @@
1
+ import { r as normalizeStoryResult, t as createAppResolver } from "./story-result-CCx6LMia.mjs";
2
+ import "node:module";
3
+ import Application from "@ember/application";
4
+ import ApplicationInstance from "@ember/application/instance";
5
+ import { destroy } from "@ember/destroyable";
6
+ import { renderComponent } from "@ember/renderer";
7
+ import { VERSION } from "@ember/version";
8
+ //#region \0rolldown/runtime.js
9
+ var __defProp = Object.defineProperty;
10
+ var __exportAll = (all, no_symbols) => {
11
+ let target = {};
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
17
+ return target;
18
+ };
19
+ //#endregion
20
+ //#region src/client/render.ts
21
+ var render_exports = /* @__PURE__ */ __exportAll({
22
+ render: () => render,
23
+ renderToCanvas: () => renderToCanvas
24
+ });
25
+ function isEmberBelow(major, minor) {
26
+ const [maj, min] = VERSION.split(".").map(Number);
27
+ return maj < major || maj === major && min < minor;
28
+ }
29
+ const render = (args, context) => {
30
+ const { id, component } = context;
31
+ if (typeof component === "function") return {
32
+ component,
33
+ args
34
+ };
35
+ if (typeof component === "object") return {
36
+ component,
37
+ args
38
+ };
39
+ throw new Error(`Unable to render story ${id} as the component annotation is missing from the default export`);
40
+ };
41
+ function shallowEqual(a, b) {
42
+ const aKeys = Object.keys(a);
43
+ const bKeys = Object.keys(b);
44
+ return aKeys.length === bKeys.length && aKeys.every((key) => Object.hasOwn(b, key) && Object.is(a[key], b[key]));
45
+ }
46
+ const contexts = /* @__PURE__ */ new Map();
47
+ const resolveAppOption = createAppResolver({
48
+ application: Application,
49
+ applicationInstance: ApplicationInstance
50
+ });
51
+ function initApp(appOption, opts) {
52
+ return resolveAppOption(appOption, opts);
53
+ }
54
+ async function bootApp(storyContext, canvasElement) {
55
+ const ember = storyContext.parameters.ember;
56
+ if (!ember?.app) {
57
+ const options = Object.keys(storyContext.parameters).filter((key) => key.toLowerCase().includes("ember")).join(", ");
58
+ throw new Error([
59
+ "ember-storybook: no Ember application configured for this story.",
60
+ "Set `parameters.ember.app` in your preview (e.g. `.storybook/preview.ts`) to a function",
61
+ "returning an Application or ApplicationInstance. When not provided, every render would",
62
+ `boot a bare Application without any resolver, failing with an obscure error. Found \`parameters\` keys: ${options || "(none)"}.`
63
+ ].join(" "));
64
+ }
65
+ const application = initApp(ember.app, { rootElement: canvasElement });
66
+ if (ember.owner) for (const [key, obj] of Object.entries(ember.owner)) {
67
+ application.unregister(key);
68
+ application.register(key, obj);
69
+ }
70
+ ember.configure?.(application);
71
+ await application.boot();
72
+ ember.updateGlobals?.(storyContext.globals, application);
73
+ return application;
74
+ }
75
+ async function renderToCanvas({ storyFn, showMain, storyContext, forceRemount }, canvasElement) {
76
+ function unregister(element) {
77
+ const context = contexts.get(element);
78
+ if (!context) return;
79
+ contexts.delete(element);
80
+ context.renderer?.destroy();
81
+ context.mount.remove();
82
+ destroy(context.application);
83
+ }
84
+ const { component, args } = normalizeStoryResult(storyFn(), storyContext.args);
85
+ const existing = contexts.get(canvasElement);
86
+ const globalsChanged = existing !== void 0 && !forceRemount && !shallowEqual(existing.globals, storyContext.globals);
87
+ if (existing && !forceRemount && !globalsChanged && shallowEqual(existing.args, args)) return () => {
88
+ unregister(canvasElement);
89
+ };
90
+ let application;
91
+ if (isEmberBelow(6, 12)) {
92
+ if (existing) unregister(canvasElement);
93
+ application = await bootApp(storyContext, canvasElement);
94
+ } else if (existing && !forceRemount) {
95
+ if (globalsChanged) storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, existing.application);
96
+ application = existing.application;
97
+ existing.renderer?.destroy();
98
+ existing.mount.remove();
99
+ } else {
100
+ if (existing) unregister(canvasElement);
101
+ application = await bootApp(storyContext, canvasElement);
102
+ }
103
+ const mount = document.createElement("div");
104
+ canvasElement.append(mount);
105
+ const renderer = renderComponent(component, {
106
+ args,
107
+ into: mount,
108
+ owner: application
109
+ });
110
+ contexts.set(canvasElement, {
111
+ application,
112
+ mount,
113
+ renderer,
114
+ args,
115
+ globals: { ...storyContext.globals }
116
+ });
117
+ showMain();
118
+ return () => {
119
+ unregister(canvasElement);
120
+ };
121
+ }
122
+ //#endregion
123
+ export { renderToCanvas as n, render_exports as r, render as t };
124
+
125
+ //# sourceMappingURL=render-D_vlc6Py.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-D_vlc6Py.mjs","names":["Application","ApplicationInstance","destroy","renderComponent","VERSION","createAppResolver","normalizeStoryResult","isEmberBelow","major","minor","maj","min","split","map","Number","render","args","context","id","component","Error","shallowEqual","a","b","aKeys","Object","keys","bKeys","length","every","key","hasOwn","is","contexts","Map","resolveAppOption","application","applicationInstance","initApp","appOption","opts","bootApp","storyContext","canvasElement","ember","parameters","app","options","filter","toLowerCase","includes","join","rootElement","owner","obj","entries","unregister","register","configure","boot","updateGlobals","globals","renderToCanvas","storyFn","showMain","forceRemount","element","get","delete","renderer","mount","remove","storyResult","existing","globalsChanged","undefined","document","createElement","append","into","set"],"sources":["../src/client/render.ts"],"sourcesContent":["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 { createAppResolver, type EmberStoryResult, normalizeStoryResult } from './story-result';\n\nimport type { AppParamater, EmberRenderer, StoryContext } 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\n if (typeof component === 'function') {\n return { component, args };\n }\n\n if (typeof component === 'object') {\n return { component, args };\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\ntype RenderContextCache = {\n application: ApplicationInstance;\n renderer?: RenderResult;\n mount: HTMLElement;\n args: Args;\n globals: Record<string, unknown>;\n};\n\nconst contexts = new Map<EmberRenderer['canvasElement'], RenderContextCache>();\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 context.renderer?.destroy();\n context.mount.remove();\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 { component, args } = normalizeStoryResult(storyResult, storyContext.args);\n\n const existing = contexts.get(canvasElement);\n const globalsChanged =\n existing !== undefined &&\n !forceRemount &&\n !shallowEqual(existing.globals, storyContext.globals);\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 // 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 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 (existing && !forceRemount) {\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 existing.renderer?.destroy();\n existing.mount.remove();\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 renderer = renderComponent(component, {\n args,\n into: mount,\n owner: application\n });\n\n contexts.set(canvasElement, {\n application,\n mount,\n renderer,\n args,\n globals: { ...storyContext.globals }\n });\n\n showMain();\n\n return () => {\n unregister(canvasElement);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,SAASO,aAAaC,OAAeC,OAAwB;CAC3D,MAAM,CAACC,KAAKC,OAAOP,QAAQQ,MAAM,GAAG,CAAC,CAACC,IAAIC,MAAM;CAEhD,OAAOJ,MAAMF,SAAUE,QAAQF,SAASG,MAAMF;AAChD;AAEA,MAAaM,UAAsCC,MAAMC,YAA8B;CACrF,MAAM,EAAEC,IAAIC,cAAcF;CAE1B,IAAI,OAAOE,cAAc,YACvB,OAAO;EAAEA;EAAWH;CAAK;CAG3B,IAAI,OAAOG,cAAc,UACvB,OAAO;EAAEA;EAAWH;CAAK;CAG3B,MAAM,IAAII,MACR,0BAA0BF,GAAE,gEAC9B;AACF;AAEA,SAASG,aAAaC,GAA4BC,GAA4B;CAC5E,MAAMC,QAAQC,OAAOC,KAAKJ,CAAC;CAC3B,MAAMK,QAAQF,OAAOC,KAAKH,CAAC;CAE3B,OACEC,MAAMI,WAAWD,MAAMC,UACvBJ,MAAMK,OAAOC,QAAQL,OAAOM,OAAOR,GAAGO,GAAG,KAAKL,OAAOO,GAAGV,EAAEQ,MAAMP,EAAEO,IAAI,CAAC;AAE3E;AAUA,MAAMG,2BAAW,IAAIC,IAAwD;AAE7E,MAAMC,mBAAmB9B,kBAAkB;CACzC+B,aAAapC;CACbqC,qBAAqBpC;AACvB,CAAC;AAED,SAASqC,QAAQC,WAAyBC,MAAoC;CAC5E,OAAOL,iBAAiBI,WAAWC,IAAI;AACzC;AAEA,eAAeC,QACbC,cACAC,eAC8B;CAC9B,MAAMC,QAAQF,aAAaG,WAAWD;CAEtC,IAAI,C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,aAAa;EACXwC,WAAWb,aAAa;CAC1B;CAMF,IAAIP;CAEJ,IAAI7B,aAAa,GAAG,EAAE,GAAG;EAMvB,IAAIkE,UACFjB,WAAWb,aAAa;EAG1BP,cAAc,MAAMK,QAAQC,cAAcC,aAAa;CACzD,OAAO,IAAI8B,YAAY,CAACR,cAAc;EAIpC,IAAIS,gBACFhC,aAAaG,WAAWD,OAAOgB,gBAAgBlB,aAAamB,SAASY,SAASrC,WAAW;EAG3FA,cAAcqC,SAASrC;EACvBqC,SAASJ,UAAUnE,QAAQ;EAC3BuE,SAASH,MAAMC,OAAO;CACxB,OAAO;EACL,IAAIE,UACFjB,WAAWb,aAAa;EAG1BP,cAAc,MAAMK,QAAQC,cAAcC,aAAa;CACzD;CAEA,MAAM2B,QAAQM,SAASC,cAAc,KAAK;CAE1ClC,cAAcmC,OAAOR,KAAK;CAE1B,MAAMD,WAAWlE,gBAAgBgB,WAAW;EAC1CH;EACA+D,MAAMT;EACNjB,OAAOjB;CACT,CAAC;CAEDH,SAAS+C,IAAIrC,eAAe;EAC1BP;EACAkC;EACAD;EACArD;EACA6C,SAAS,EAAE,GAAGnB,aAAamB,QAAQ;CACrC,CAAC;CAEDG,SAAS;CAET,aAAa;EACXR,WAAWb,aAAa;CAC1B;AACF"}
@@ -0,0 +1,74 @@
1
+ //#region src/client/story-result.ts
2
+ /**
3
+ * Structural shapes of `@ember/application` and `@ember/application/instance`.
4
+ * Used so the resolver can be unit tested without importing Ember at runtime.
5
+ */
6
+ /**
7
+ * The result of the framework's default `render` function.
8
+ *
9
+ * Storybook's decorator pipeline delivers the (possibly decorator-transformed)
10
+ * args to `render` via `originalStoryFn(args, context)` — but nothing else. To
11
+ * make those args reach `renderToCanvas`, `render` reports them back alongside
12
+ * the component instead of returning a bare component.
13
+ */
14
+ function isEmberStoryResult(value) {
15
+ return typeof value === "object" && value !== null && "component" in value && "args" in value && value.args !== null && typeof value.args === "object";
16
+ }
17
+ /**
18
+ * Normalizes whatever `storyFn()` returned into `{ component, args }`.
19
+ *
20
+ * - A story rendered through the framework's `render` returns an `EmberStoryResult`
21
+ * whose `args` are the final (decorated) args.
22
+ * - A story with its own `render` (e.g. a template) returns the component/template
23
+ * directly; in that case the args are the raw `fallbackArgs` (the story already
24
+ * captured what it needs).
25
+ */
26
+ function normalizeStoryResult(result, fallbackArgs) {
27
+ if (isEmberStoryResult(result)) return {
28
+ component: result.component,
29
+ args: result.args
30
+ };
31
+ return {
32
+ component: result,
33
+ args: fallbackArgs
34
+ };
35
+ }
36
+ /**
37
+ * Builds a resolver that turns an `ember.app` parameter into an app
38
+ * instance. The Ember classes are injected so the logic can be unit tested
39
+ * without a running Ember app.
40
+ *
41
+ * Resolves the `AppParamater` union the way `bootApp` needs it:
42
+ * - An ApplicationInstance is returned unchanged.
43
+ * - An Application class (base or subclass) is built via `create(...).buildInstance()`.
44
+ * - Anything else is treated as a factory returning either, and recursed into.
45
+ */
46
+ function getAppOptions(opts) {
47
+ return {
48
+ ...opts,
49
+ autoboot: false
50
+ };
51
+ }
52
+ function createAppResolver(params) {
53
+ const { application, applicationInstance } = params;
54
+ const applicationCtor = application;
55
+ const applicationInstanceCtor = applicationInstance;
56
+ function isApplicationClass(maybeApp) {
57
+ if (typeof maybeApp !== "function") return false;
58
+ const candidate = maybeApp;
59
+ return typeof candidate.create === "function" && (maybeApp === applicationCtor || candidate.prototype instanceof applicationCtor);
60
+ }
61
+ function buildAppInstance(app, opts) {
62
+ return app.create(getAppOptions(opts)).buildInstance();
63
+ }
64
+ function initApp(appOption, opts) {
65
+ if (appOption instanceof applicationInstanceCtor) return appOption;
66
+ if (isApplicationClass(appOption)) return buildAppInstance(appOption, opts);
67
+ return initApp(appOption(getAppOptions(opts)), opts);
68
+ }
69
+ return initApp;
70
+ }
71
+ //#endregion
72
+ export { isEmberStoryResult as n, normalizeStoryResult as r, createAppResolver as t };
73
+
74
+ //# sourceMappingURL=story-result-CCx6LMia.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"story-result-CCx6LMia.mjs","names":["isEmberStoryResult","value","args","normalizeStoryResult","result","fallbackArgs","component","getAppOptions","opts","autoboot","createAppResolver","params","application","applicationInstance","applicationCtor","applicationInstanceCtor","isApplicationClass","maybeApp","candidate","create","prototype","buildAppInstance","app","buildInstance","initApp","appOption"],"sources":["../src/client/story-result.ts"],"sourcesContent":["type Args = Record<string, unknown>;\n\n/**\n * Structural shapes of `@ember/application` and `@ember/application/instance`.\n * Used so the resolver can be unit tested without importing Ember at runtime.\n */\nexport interface ApplicationClass {\n prototype: object;\n create(options?: Record<string, unknown>): { buildInstance(): object };\n}\n\nexport type ApplicationInstanceClass = new (...args: never[]) => object;\n\n/**\n * The result of the framework's default `render` function.\n *\n * Storybook's decorator pipeline delivers the (possibly decorator-transformed)\n * args to `render` via `originalStoryFn(args, context)` — but nothing else. To\n * make those args reach `renderToCanvas`, `render` reports them back alongside\n * the component instead of returning a bare component.\n */\nexport interface EmberStoryResult {\n component: object;\n args: Args;\n}\n\nexport function isEmberStoryResult(value: unknown): value is EmberStoryResult {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'component' in value &&\n 'args' in value &&\n value.args !== null &&\n typeof value.args === 'object'\n );\n}\n\n/**\n * Normalizes whatever `storyFn()` returned into `{ component, args }`.\n *\n * - A story rendered through the framework's `render` returns an `EmberStoryResult`\n * whose `args` are the final (decorated) args.\n * - A story with its own `render` (e.g. a template) returns the component/template\n * directly; in that case the args are the raw `fallbackArgs` (the story already\n * captured what it needs).\n */\nexport function normalizeStoryResult(\n result: unknown,\n fallbackArgs: Args\n): {\n component: object;\n args: Args;\n} {\n if (isEmberStoryResult(result)) {\n return { component: result.component, args: result.args };\n }\n\n return { component: result as object, args: fallbackArgs };\n}\n\n/**\n * Builds a resolver that turns an `ember.app` parameter into an app\n * instance. The Ember classes are injected so the logic can be unit tested\n * without a running Ember app.\n *\n * Resolves the `AppParamater` union the way `bootApp` needs it:\n * - An ApplicationInstance is returned unchanged.\n * - An Application class (base or subclass) is built via `create(...).buildInstance()`.\n * - Anything else is treated as a factory returning either, and recursed into.\n */\nfunction getAppOptions(opts: { rootElement: HTMLElement }) {\n return {\n ...opts,\n autoboot: false\n };\n}\n\nexport function createAppResolver(params: {\n application: ApplicationClass;\n applicationInstance: ApplicationInstanceClass;\n}): (appOption: unknown, opts: { rootElement: HTMLElement }) => object {\n const { application, applicationInstance } = params;\n\n const applicationCtor = application as unknown as new (...args: never[]) => object;\n const applicationInstanceCtor = applicationInstance;\n\n function isApplicationClass(maybeApp: unknown): boolean {\n if (typeof maybeApp !== 'function') {\n return false;\n }\n\n const candidate = maybeApp as unknown as { create?: unknown; prototype?: object };\n\n return (\n typeof candidate.create === 'function' &&\n // The base `Application` class itself fails the `prototype instanceof`\n // check (Ember's factory bootstrap means its own prototype isn't an\n // instance of itself), so accept it by identity as well.\n (maybeApp === applicationCtor || candidate.prototype instanceof applicationCtor)\n );\n }\n\n function buildAppInstance(app: ApplicationClass, opts: { rootElement: HTMLElement }) {\n return app.create(getAppOptions(opts)).buildInstance();\n }\n\n function initApp(appOption: unknown, opts: { rootElement: HTMLElement }): object {\n if (appOption instanceof applicationInstanceCtor) {\n return appOption;\n }\n\n if (isApplicationClass(appOption)) {\n return buildAppInstance(appOption as ApplicationClass, opts);\n }\n\n // eslint-disable-next-line unicorn/no-useless-recursion\n return initApp(\n (appOption as (options?: Record<string, unknown>) => unknown)(getAppOptions(opts)),\n opts\n );\n }\n\n return initApp;\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,SAAgBA,mBAAmBC,OAA2C;CAC5E,OACE,OAAOA,UAAU,YACjBA,UAAU,QACV,eAAeA,SACf,UAAUA,SACVA,MAAMC,SAAS,QACf,OAAOD,MAAMC,SAAS;AAE1B;;;;;;;;;;AAWA,SAAgBC,qBACdC,QACAC,cAIA;CACA,IAAIL,mBAAmBI,MAAM,GAC3B,OAAO;EAAEE,WAAWF,OAAOE;EAAWJ,MAAME,OAAOF;CAAK;CAG1D,OAAO;EAAEI,WAAWF;EAAkBF,MAAMG;CAAa;AAC3D;;;;;;;;;;;AAYA,SAASE,cAAcC,MAAoC;CACzD,OAAO;EACL,GAAGA;EACHC,UAAU;CACZ;AACF;AAEA,SAAgBC,kBAAkBC,QAGqC;CACrE,MAAM,EAAEC,aAAaC,wBAAwBF;CAE7C,MAAMG,kBAAkBF;CACxB,MAAMG,0BAA0BF;CAEhC,SAASG,mBAAmBC,UAA4B;EACtD,IAAI,OAAOA,aAAa,YACtB,OAAO;EAGT,MAAMC,YAAYD;EAElB,OACE,OAAOC,UAAUC,WAAW,eAI3BF,aAAaH,mBAAmBI,UAAUE,qBAAqBN;CAEpE;CAEA,SAASO,iBAAiBC,KAAuBd,MAAoC;EACnF,OAAOc,IAAIH,OAAOZ,cAAcC,IAAI,CAAC,CAAC,CAACe,cAAc;CACvD;CAEA,SAASC,QAAQC,WAAoBjB,MAA4C;EAC/E,IAAIiB,qBAAqBV,yBACvB,OAAOU;EAGT,IAAIT,mBAAmBS,SAAS,GAC9B,OAAOJ,iBAAiBI,WAA+BjB,IAAI;EAI7D,OAAOgB,QACJC,UAA6DlB,cAAcC,IAAI,CAAC,GACjFA,IACF;CACF;CAEA,OAAOgB;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-storybook",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "license": "MIT",
5
5
  "description": "Storybook for Ember: Develop, document, and test UI components in isolation",
6
6
  "keywords": [
@@ -1,125 +0,0 @@
1
- import "node:module";
2
- import Application from "@ember/application";
3
- import ApplicationInstance from "@ember/application/instance";
4
- //#region \0rolldown/runtime.js
5
- var __defProp = Object.defineProperty;
6
- var __exportAll = (all, no_symbols) => {
7
- let target = {};
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
12
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
13
- return target;
14
- };
15
- //#endregion
16
- //#region src/client/render.ts
17
- var render_exports = /* @__PURE__ */ __exportAll({
18
- render: () => render,
19
- renderToCanvas: () => renderToCanvas
20
- });
21
- const render = (args, context) => {
22
- const { id, component } = context;
23
- if (typeof component === "function") return component;
24
- if (typeof component === "object") return component;
25
- throw new Error(`Unable to render story ${id} as the component annotation is missing from the default export`);
26
- };
27
- function shallowEqual(a, b) {
28
- const aKeys = Object.keys(a);
29
- const bKeys = Object.keys(b);
30
- return aKeys.length === bKeys.length && aKeys.every((key) => Object.hasOwn(b, key) && Object.is(a[key], b[key]));
31
- }
32
- const contexts = /* @__PURE__ */ new Map();
33
- function getAppOptions(opts) {
34
- return {
35
- ...opts,
36
- autoboot: false
37
- };
38
- }
39
- function buildAppInstance(application, opts) {
40
- return application.create(getAppOptions(opts)).buildInstance();
41
- }
42
- function isApplication(maybeApp) {
43
- return maybeApp.create !== void 0 && maybeApp.superclass && maybeApp.superclass.name === "EmberApp";
44
- }
45
- function initApp(appOption, opts) {
46
- if (appOption instanceof ApplicationInstance) return appOption;
47
- if (isApplication(appOption)) return buildAppInstance(appOption, opts);
48
- return initApp(appOption(getAppOptions(opts)), opts);
49
- }
50
- function updateArgs(currentArgs, nextArgs) {
51
- for (const key of Object.keys(currentArgs)) if (!Object.hasOwn(nextArgs, key)) delete currentArgs[key];
52
- Object.assign(currentArgs, nextArgs);
53
- }
54
- async function renderToCanvas({ storyFn, showMain, storyContext, forceRemount }, canvasElement) {
55
- const { trackedObject } = await import("@ember/reactive/collections");
56
- const { renderComponent } = await import("@ember/renderer");
57
- const { destroy } = await import("@ember/destroyable");
58
- const args = storyContext.args;
59
- const Component = storyFn();
60
- function unmount(element) {
61
- const context = contexts.get(element);
62
- if (!context) return;
63
- contexts.delete(element);
64
- context.renderer?.destroy();
65
- context.mount.remove();
66
- destroy(context.application);
67
- }
68
- if (forceRemount) unmount(canvasElement);
69
- const context = contexts.get(canvasElement);
70
- if (context && !forceRemount) {
71
- const argsChanged = !shallowEqual(context.args, args);
72
- const globalsChanged = !shallowEqual(context.globals, storyContext.globals);
73
- if (globalsChanged) {
74
- storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, context.application);
75
- context.globals = { ...storyContext.globals };
76
- }
77
- if (argsChanged || !globalsChanged) {
78
- updateArgs(context.args, args);
79
- context.renderer = renderComponent(Component, {
80
- args: context.args,
81
- into: context.mount,
82
- owner: context.application
83
- });
84
- }
85
- return () => {
86
- unmount(canvasElement);
87
- };
88
- }
89
- const mount = document.createElement("div");
90
- canvasElement.append(mount);
91
- let application;
92
- if (storyContext.parameters.ember?.app) {
93
- const appOption = storyContext.parameters.ember.app;
94
- application = initApp(appOption, { rootElement: canvasElement });
95
- }
96
- application ??= buildAppInstance(Application, { rootElement: canvasElement });
97
- if (storyContext.parameters.ember?.owner) for (const [key, obj] of Object.entries(storyContext.parameters.ember.owner)) {
98
- application.unregister(key);
99
- application.register(key, obj);
100
- }
101
- storyContext.parameters.ember?.configure?.(application);
102
- await application.boot();
103
- storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, application);
104
- const trackedArgs = trackedObject({ ...args });
105
- contexts.set(canvasElement, {
106
- application,
107
- mount,
108
- args: trackedArgs,
109
- globals: storyContext.globals
110
- });
111
- const result = renderComponent(Component, {
112
- args: trackedArgs,
113
- into: mount,
114
- owner: application
115
- });
116
- contexts.get(canvasElement).renderer = result;
117
- showMain();
118
- return () => {
119
- unmount(canvasElement);
120
- };
121
- }
122
- //#endregion
123
- export { renderToCanvas as n, render_exports as r, render as t };
124
-
125
- //# sourceMappingURL=render-B0rRnyCZ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-B0rRnyCZ.mjs","names":["Application","ApplicationInstance","render","args","context","id","component","Error","shallowEqual","a","b","aKeys","Object","keys","bKeys","length","every","key","hasOwn","is","contexts","Map","getAppOptions","opts","autoboot","buildAppInstance","application","create","buildInstance","isApplication","maybeApp","undefined","superclass","name","initApp","appOption","updateArgs","currentArgs","nextArgs","assign","renderToCanvas","storyFn","showMain","storyContext","forceRemount","canvasElement","trackedObject","renderComponent","destroy","Component","unmount","element","get","delete","renderer","mount","remove","argsChanged","globalsChanged","globals","parameters","ember","updateGlobals","result","into","owner","document","createElement","append","app","rootElement","obj","entries","unregister","register","configure","boot","trackedArgs","set"],"sources":["../src/client/render.ts"],"sourcesContent":["import Application from '@ember/application';\nimport ApplicationInstance from '@ember/application/instance';\n\nimport type { AppParamater, EmberRenderer, StoryContext } 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\nexport const render: ArgsStoryFn<EmberRenderer> = (args, context) => {\n const { id, component } = context;\n\n if (typeof component === 'function') {\n return component;\n }\n\n if (typeof component === 'object') {\n return component;\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\ntype RenderContextCache = {\n application: ApplicationInstance;\n renderer?: RenderResult;\n mount: HTMLElement;\n args: Args;\n globals: Record<string, unknown>;\n};\n\nconst contexts = new Map<EmberRenderer['canvasElement'], RenderContextCache>();\n\nfunction getAppOptions(opts: { rootElement: HTMLElement }) {\n return {\n ...opts,\n autoboot: false\n };\n}\n\nfunction buildAppInstance(application: typeof Application, opts: { rootElement: HTMLElement }) {\n return application.create(getAppOptions(opts)).buildInstance();\n}\n\nfunction isApplication(maybeApp: object): maybeApp is typeof Application {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (\n // @ts-expect-error well, ember types\n maybeApp.create !== undefined &&\n // @ts-expect-error well, ember types\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n maybeApp.superclass &&\n // @ts-expect-error well, ember types\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n maybeApp.superclass.name === 'EmberApp'\n );\n}\n\nfunction initApp(appOption: AppParamater, opts: { rootElement: HTMLElement }): ApplicationInstance {\n if (appOption instanceof ApplicationInstance) {\n return appOption;\n }\n\n if (isApplication(appOption)) {\n return buildAppInstance(appOption, opts);\n }\n\n // eslint-disable-next-line unicorn/no-useless-recursion\n return initApp(appOption(getAppOptions(opts)), opts);\n}\n\nfunction updateArgs(currentArgs: Args, nextArgs: Args) {\n for (const key of Object.keys(currentArgs)) {\n if (!Object.hasOwn(nextArgs, key)) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete currentArgs[key];\n }\n }\n\n Object.assign(currentArgs, nextArgs);\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 const { trackedObject } = await import('@ember/reactive/collections');\n const { renderComponent } = await import('@ember/renderer');\n const { destroy } = await import('@ember/destroyable');\n\n const args = storyContext.args;\n const Component = storyFn();\n\n function unmount(element: EmberRenderer['canvasElement']) {\n const context = contexts.get(element);\n\n if (!context) {\n return;\n }\n\n contexts.delete(element);\n context.renderer?.destroy();\n\n context.mount.remove();\n\n destroy(context.application);\n }\n\n if (forceRemount) {\n unmount(canvasElement);\n }\n\n // this check does not work:\n // when globals are updated, that are interesting for a decorator\n // this check would prevent that update\n\n const context = contexts.get(canvasElement);\n\n if (context && !forceRemount) {\n const argsChanged = !shallowEqual(context.args, args);\n const globalsChanged = !shallowEqual(context.globals, storyContext.globals);\n\n if (globalsChanged) {\n storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, context.application);\n context.globals = { ...storyContext.globals };\n }\n\n if (argsChanged || !globalsChanged) {\n updateArgs(context.args, args);\n\n const result = renderComponent(Component, {\n args: context.args,\n into: context.mount,\n owner: context.application\n });\n\n context.renderer = result;\n }\n\n return () => {\n unmount(canvasElement);\n };\n }\n\n // fresh mount element per render, so ember's RENDER_CACHE never has a stale\n // entry for the `into` element (this is what caused the `insertBefore` error)\n const mount = document.createElement('div');\n\n canvasElement.append(mount);\n\n // find the ember app for the story\n let application: ApplicationInstance | undefined;\n\n if (storyContext.parameters.ember?.app) {\n const appOption = storyContext.parameters.ember.app;\n\n application = initApp(appOption, { rootElement: canvasElement });\n }\n\n application ??= buildAppInstance(Application, { rootElement: canvasElement });\n\n // modify the owner for the story\n if (storyContext.parameters.ember?.owner) {\n for (const [key, obj] of Object.entries(storyContext.parameters.ember.owner) as [\n `${string}:${string}`,\n object\n ][]) {\n application.unregister(key);\n application.register(key, obj);\n }\n }\n\n // configure and boot the instance so ember registers necessary environments\n storyContext.parameters.ember?.configure?.(application);\n await application.boot();\n storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, application);\n\n const trackedArgs = trackedObject({ ...args });\n\n contexts.set(canvasElement, {\n application,\n mount,\n args: trackedArgs,\n globals: storyContext.globals\n });\n\n const result = renderComponent(Component, {\n args: trackedArgs,\n into: mount,\n owner: application\n });\n\n (contexts.get(canvasElement) as RenderContextCache).renderer = result;\n\n showMain();\n\n return () => {\n unmount(canvasElement);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,MAAaE,UAAsCC,MAAMC,YAAY;CACnE,MAAM,EAAEC,IAAIC,cAAcF;CAE1B,IAAI,OAAOE,cAAc,YACvB,OAAOA;CAGT,IAAI,OAAOA,cAAc,UACvB,OAAOA;CAGT,MAAM,IAAIC,MACR,0BAA0BF,GAAE,gEAC9B;AACF;AAEA,SAASG,aAAaC,GAA4BC,GAA4B;CAC5E,MAAMC,QAAQC,OAAOC,KAAKJ,CAAC;CAC3B,MAAMK,QAAQF,OAAOC,KAAKH,CAAC;CAE3B,OACEC,MAAMI,WAAWD,MAAMC,UACvBJ,MAAMK,OAAOC,QAAQL,OAAOM,OAAOR,GAAGO,GAAG,KAAKL,OAAOO,GAAGV,EAAEQ,MAAMP,EAAEO,IAAI,CAAC;AAE3E;AAU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