ember-storybook 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/client/outlet-placeholder.d.ts +8 -5
- package/declarations/client/outlet-placeholder.d.ts.map +1 -1
- package/declarations/client/outlet.d.ts +53 -23
- package/declarations/client/outlet.d.ts.map +1 -1
- package/declarations/client/public-types.d.ts +1 -1
- package/declarations/client/public-types.d.ts.map +1 -1
- package/declarations/client/render-story.d.ts.map +1 -1
- package/declarations/client/render.d.ts.map +1 -1
- package/declarations/client/types.d.ts +16 -20
- package/declarations/client/types.d.ts.map +1 -1
- package/declarations/node/parser.d.ts.map +1 -1
- package/dist/client/config.mjs +1 -1
- package/dist/client/index.mjs +3 -3
- package/dist/{client-DdSMlQeh.mjs → client-CTAOSmJ3.mjs} +4 -4
- package/dist/{client-DdSMlQeh.mjs.map → client-CTAOSmJ3.mjs.map} +1 -1
- package/dist/{config-DGk6BP_3.mjs → config-C8o2dGQ2.mjs} +135 -44
- package/dist/config-C8o2dGQ2.mjs.map +1 -0
- package/dist/index.mjs +3 -3
- package/dist/{outlet-placeholder-CgO7fIDo.mjs → outlet-placeholder-CMOzKwEp.mjs} +8 -5
- package/dist/outlet-placeholder-CMOzKwEp.mjs.map +1 -0
- package/dist/preset.mjs +2 -2
- package/dist/preset.mjs.map +1 -1
- package/package.json +6 -6
- package/dist/config-DGk6BP_3.mjs.map +0 -1
- package/dist/outlet-placeholder-CgO7fIDo.mjs.map +0 -1
|
@@ -2,7 +2,7 @@ import type { TOC } from '@ember/component/template-only';
|
|
|
2
2
|
interface OutletPlaceholderSignature {
|
|
3
3
|
Element: HTMLDivElement;
|
|
4
4
|
Args: {
|
|
5
|
-
/** Shown inside the box
|
|
5
|
+
/** Shown inside the box; falls back to the label "outlet". */
|
|
6
6
|
model?: string;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
@@ -10,15 +10,18 @@ interface OutletPlaceholderSignature {
|
|
|
10
10
|
* A visible stand-in for `{{outlet}}`, for route stories where an empty hole is
|
|
11
11
|
* hard to see (e.g. on the docs page).
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* The framework renders it automatically for the toolbar's "placeholder" mode.
|
|
14
|
+
* Authors reach it through the `string` form of `parameters.ember.route.outlet`,
|
|
15
|
+
* which curries the string in as this component's `@model` to label the box:
|
|
16
16
|
*
|
|
17
17
|
* ```js
|
|
18
18
|
* parameters: {
|
|
19
|
-
* ember: { route: { outlet:
|
|
19
|
+
* ember: { route: { outlet: 'settings' } }
|
|
20
20
|
* }
|
|
21
21
|
* ```
|
|
22
|
+
*
|
|
23
|
+
* It can also be passed as a component (`outlet: OutletPlaceholder`), which
|
|
24
|
+
* renders it unlabeled.
|
|
22
25
|
*/
|
|
23
26
|
export declare const OutletPlaceholder: TOC<OutletPlaceholderSignature>;
|
|
24
27
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outlet-placeholder.d.ts","sourceRoot":"","sources":["../../src/client/outlet-placeholder.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"outlet-placeholder.d.ts","sourceRoot":"","sources":["../../src/client/outlet-placeholder.gts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAE1D,UAAU,0BAA0B;IAClC,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,EAAE;QACJ,8DAA8D;QAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,EAAE,GAAG,CAAC,0BAA0B,CAe5D,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { OutletMode,
|
|
1
|
+
import type { OutletMode, RouteParameters } from './types';
|
|
2
2
|
import type ApplicationInstance from '@ember/application/instance';
|
|
3
|
+
import type { ComponentLike } from '@glint/template';
|
|
3
4
|
/**
|
|
4
|
-
* What Ember's outlet hands a route template
|
|
5
|
-
* component story: it receives exactly `@model` and
|
|
6
|
-
*
|
|
5
|
+
* What Ember's outlet root hands a route template on the classic backend. A
|
|
6
|
+
* route template is *not* a component story: it receives exactly `@model` and
|
|
7
|
+
* `@controller` (`OUTLET_COMPONENT_TEMPLATE` in ember-source); its `{{outlet}}`
|
|
8
|
+
* reads the child from the state chain below, not from an argument.
|
|
7
9
|
*/
|
|
8
10
|
export interface OutletRenderState {
|
|
9
11
|
owner: object;
|
|
@@ -29,10 +31,10 @@ export interface RouteStoryInput {
|
|
|
29
31
|
/** `parameters.ember.route`. */
|
|
30
32
|
route: RouteParameters;
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
+
* What the outlet renders — see {@link resolveOutletStub}. `null` leaves the
|
|
35
|
+
* outlet as a hole.
|
|
34
36
|
*/
|
|
35
|
-
outlet?:
|
|
37
|
+
outlet?: ComponentLike | null;
|
|
36
38
|
/** Final (decorated) story args; `model`/`controller` feed the route. */
|
|
37
39
|
args: Record<string, unknown>;
|
|
38
40
|
/** Story name, used when `route.name` is not given. */
|
|
@@ -46,41 +48,58 @@ export interface OutletResolveInput {
|
|
|
46
48
|
/** Value of the `outlet` global (see `src/outlet-key.ts`), if any. */
|
|
47
49
|
mode?: OutletMode;
|
|
48
50
|
/**
|
|
49
|
-
*
|
|
51
|
+
* The component rendered when the global asks for a visible placeholder.
|
|
50
52
|
* Called lazily (and so may be an async chunk load) and only when needed;
|
|
51
53
|
* injected so this module stays free of Ember-owned template components.
|
|
52
54
|
*/
|
|
53
|
-
placeholder: () =>
|
|
55
|
+
placeholder: () => ComponentLike | Promise<ComponentLike>;
|
|
54
56
|
}
|
|
55
57
|
/**
|
|
56
|
-
* Decides what `{{outlet}}` renders.
|
|
58
|
+
* Decides what `{{outlet}}` renders, parsing `parameters.ember.route.outlet` at
|
|
59
|
+
* the boundary. Returns the component for the outlet position — curried, see
|
|
60
|
+
* {@link curryOutlet} — or `null` for a hole.
|
|
57
61
|
*
|
|
58
62
|
* An explicit `route.outlet` is author intent and always wins, so a story stays
|
|
59
|
-
* deterministic no matter how the toolbar is set
|
|
60
|
-
*
|
|
63
|
+
* deterministic no matter how the toolbar is set:
|
|
64
|
+
*
|
|
65
|
+
* - a `string` labels the placeholder (`outlet: 'settings'`);
|
|
66
|
+
* - a component renders in the outlet position (`outlet: MyOutlet` — classes,
|
|
67
|
+
* template-only components and inline `<template>`s; template-only ones are
|
|
68
|
+
* plain objects, so "not the retired `{ template, ... }` bag" is the runtime
|
|
69
|
+
* discriminator).
|
|
70
|
+
*
|
|
71
|
+
* otherwise the global decides: `placeholder` renders the injected marker,
|
|
72
|
+
* anything else leaves a hole.
|
|
61
73
|
*/
|
|
62
|
-
export declare function resolveOutletStub({ route, mode, placeholder }: OutletResolveInput): Promise<
|
|
74
|
+
export declare function resolveOutletStub({ route, mode, placeholder }: OutletResolveInput): Promise<ComponentLike | null>;
|
|
63
75
|
/**
|
|
64
76
|
* Whether the component's *own* template references `{{outlet}}` — i.e. it is a
|
|
65
77
|
* route template, which is how an unannotated route-story is recognized (#62).
|
|
66
78
|
*
|
|
67
79
|
* A template factory caches a per-owner (plus ownerless) `TemplateImpl`; its
|
|
68
80
|
* `parsedLayout.block` is the parsed wire-format tuple
|
|
69
|
-
* `[statements, locals, upvars]`.
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
81
|
+
* `[statements, locals, upvars]`. Which slot reveals the outlet depends on the
|
|
82
|
+
* compiler that produced the template — the app's ember-source:
|
|
83
|
+
*
|
|
84
|
+
* - classic (`< 7.5.0-alpha.2`): the keyword `-outlet` is a free name, so
|
|
85
|
+
* every use of `{{outlet}}` — and only uses of it — lands in `upvars`;
|
|
86
|
+
* checking that slot cannot mistake a string literal `"-outlet"` used as an
|
|
87
|
+
* argument for a real outlet.
|
|
88
|
+
* - RFC 1099 (`>= 7.5.0-alpha.2`): `{{outlet}}` compiles to `<@outlet />`, so
|
|
89
|
+
* `@outlet` shows up as one of the template's own arguments in `locals`.
|
|
73
90
|
*/
|
|
74
91
|
export declare function templateUsesOutlet(component: object): boolean;
|
|
75
92
|
/**
|
|
76
|
-
* Builds the `OutletState` for a route story
|
|
93
|
+
* Builds the `OutletState` for a route story — the outlet-root backend, used on
|
|
94
|
+
* Ember builds that still have `view:-outlet` (see {@link outletRootSupported}).
|
|
77
95
|
*
|
|
78
|
-
* `{{outlet}}` reads its child from
|
|
79
|
-
* `renderComponent` never populates — so route
|
|
80
|
-
* Ember's own outlet root instead, and this is
|
|
81
|
-
* `outlets.main` undefined is what makes
|
|
96
|
+
* `{{outlet}}` compiles to the `-outlet` keyword, which reads its child from
|
|
97
|
+
* Glimmer's *dynamic scope*, which `renderComponent` never populates — so route
|
|
98
|
+
* templates are rendered through Ember's own outlet root instead, and this is
|
|
99
|
+
* the state handed to it. Leaving `outlets.main` undefined is what makes
|
|
100
|
+
* `{{outlet}}` render a hole.
|
|
82
101
|
*/
|
|
83
|
-
export declare function buildRouteOutletState({ template, route, outlet, args, storyName, owner }: RouteStoryInput): OutletState;
|
|
102
|
+
export declare function buildRouteOutletState({ template: routeTemplate, route, outlet, args, storyName, owner }: RouteStoryInput): OutletState;
|
|
84
103
|
/**
|
|
85
104
|
* Ember's `OutletView` (the router's top-level view), reduced to the surface
|
|
86
105
|
* this module drives. It is only reachable through the container, so the type is
|
|
@@ -90,6 +109,17 @@ export interface OutletView {
|
|
|
90
109
|
appendTo(target: HTMLElement): void;
|
|
91
110
|
setOutletState(state: OutletState): void;
|
|
92
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Whether this Ember build still hosts `{{outlet}}` in the classic outlet root.
|
|
114
|
+
*
|
|
115
|
+
* Until 7.5.0-alpha.2 the router always registered `view:-outlet`; the route
|
|
116
|
+
* rendering work merged as emberjs/ember.js `4b5d79a` (series: `68fc807`,
|
|
117
|
+
* `c0522c5`, `4b0f767`, ...) deleted the view, the `template:-outlet` and the
|
|
118
|
+
* `-outlet` keyword outright. The container entry is the switch between the
|
|
119
|
+
* two backends: `beta` (7.4) still ships it while `alpha` (7.5) does not, so
|
|
120
|
+
* the version string cannot decide this — the probe can.
|
|
121
|
+
*/
|
|
122
|
+
export declare function outletRootSupported(owner: object): boolean;
|
|
93
123
|
/**
|
|
94
124
|
* Renders `state` into `element` through Ember's outlet root and waits for the
|
|
95
125
|
* render to settle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outlet.d.ts","sourceRoot":"","sources":["../../src/client/outlet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"outlet.d.ts","sourceRoot":"","sources":["../../src/client/outlet.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE;QAAE,IAAI,EAAE,WAAW,GAAG,SAAS,CAAA;KAAE,CAAC;CAC5C;AAED,MAAM,WAAW,eAAe;IAC9B,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,KAAK,EAAE,eAAe,CAAC;IACvB;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC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AI,CAAC,CAG1F"}
|
|
@@ -23,5 +23,5 @@ export type Decorator<TArgs = StrictArgs> = DecoratorFunction<EmberRenderer, TAr
|
|
|
23
23
|
export type Loader<TArgs = StrictArgs> = LoaderFunction<EmberRenderer, TArgs>;
|
|
24
24
|
export type StoryContext<TArgs = StrictArgs> = GenericStoryContext<EmberRenderer, TArgs>;
|
|
25
25
|
export type Preview = ProjectAnnotations<EmberRenderer>;
|
|
26
|
-
export { type EmberGlobals, type EmberParameters, type EmberRenderer, type OutletMode, type
|
|
26
|
+
export { type EmberGlobals, type EmberParameters, type EmberRenderer, type OutletMode, type RouteParameters } from './types';
|
|
27
27
|
//# sourceMappingURL=public-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-types.d.ts","sourceRoot":"","sources":["../../src/client/public-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EACV,gBAAgB,EAChB,IAAI,EACJ,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,IAAI,mBAAmB,EACnC,UAAU,EACX,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEvF;;;;GAIG;AACH,MAAM,MAAM,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,oBAAoB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAE5E;;;;GAIG;AACH,MAAM,MAAM,OAAO,CAAC,KAAK,GAAG,IAAI,IAAI,gBAAgB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,MAAM,QAAQ,CAAC,KAAK,GAAG,IAAI,IAAI,gBAAgB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAE5E,MAAM,MAAM,SAAS,CAAC,KAA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aAAa,EAAE,KAAK,CAAC,CAAC;AACpF,MAAM,MAAM,MAAM,CAAC,KAAK,GAAG,UAAU,IAAI,cAAc,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAC9E,MAAM,MAAM,YAAY,CAAC,KAAK,GAAG,UAAU,IAAI,mBAAmB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AACzF,MAAM,MAAM,OAAO,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;AAExD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-story.d.ts","sourceRoot":"","sources":["../../src/client/render-story.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render-story.d.ts","sourceRoot":"","sources":["../../src/client/render-story.gts"],"names":[],"mappings":"AAkDA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAS3C,UAAU,oBAAoB;IAC5B,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,qBAAa,WAAY,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IAC9D,MAAM;;;;;;OA0BH;CASJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/client/render.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/client/render.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAGV,aAAa,EAEb,YAAY,EACb,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAiB3E,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,aAAa,CAgB7C,CAAC;AAiPF,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,uBA6L9C"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type Application from '@ember/application';
|
|
2
2
|
import type ApplicationInstance from '@ember/application/instance';
|
|
3
3
|
import type Owner from '@ember/owner';
|
|
4
|
+
import type { ComponentLike } from '@glint/template';
|
|
4
5
|
import type { StoryContext as DefaultStoryContext, WebRenderer } from 'storybook/internal/types';
|
|
5
6
|
export type { RenderContext } from 'storybook/internal/types';
|
|
6
7
|
export interface ShowErrorArgs {
|
|
@@ -8,21 +9,6 @@ export interface ShowErrorArgs {
|
|
|
8
9
|
description: string;
|
|
9
10
|
}
|
|
10
11
|
export type AppParamater = typeof Application | ApplicationInstance | ((options?: Record<string, unknown>) => typeof Application | ApplicationInstance);
|
|
11
|
-
/**
|
|
12
|
-
* A single-level stub rendered in place of `{{outlet}}`. Ember has no named
|
|
13
|
-
* outlets anymore, so a route template has exactly one child, and a story stubs
|
|
14
|
-
* precisely that one child — deeper nesting is not modelled.
|
|
15
|
-
*/
|
|
16
|
-
export interface OutletStub {
|
|
17
|
-
/** Route name surfaced in the placeholder label and the debug render tree. */
|
|
18
|
-
name?: string;
|
|
19
|
-
/** Template/component rendered as the child route. Omitted => empty hole. */
|
|
20
|
-
template?: object;
|
|
21
|
-
/** Value passed to the child as `@model`. */
|
|
22
|
-
model?: unknown;
|
|
23
|
-
/** Value passed to the child as `@controller`. */
|
|
24
|
-
controller?: unknown;
|
|
25
|
-
}
|
|
26
12
|
/**
|
|
27
13
|
* Route options for a story that renders a *route* template rather than a
|
|
28
14
|
* component.
|
|
@@ -31,8 +17,16 @@ export interface OutletStub {
|
|
|
31
17
|
* the story's template references `{{outlet}}` (#62) — the latter implicitly,
|
|
32
18
|
* with empty route parameters.
|
|
33
19
|
*
|
|
34
|
-
* Route templates receive only `@model` and `@
|
|
35
|
-
*
|
|
20
|
+
* Route templates receive only `@model`, `@controller` and `@outlet` — exactly
|
|
21
|
+
* what Ember's own route rendering hands them. Their `{{outlet}}` renders
|
|
22
|
+
* whatever `outlet` says, mirroring the `@outlet` argument:
|
|
23
|
+
*
|
|
24
|
+
* - `string` — the framework placeholder, labeled with the string.
|
|
25
|
+
* - `ComponentLike` — that component renders in the outlet position (one leaf
|
|
26
|
+
* level: a `{{outlet}}` inside it renders a hole). Ember has no named outlets
|
|
27
|
+
* anymore, so there is exactly one outlet to stub.
|
|
28
|
+
* - omitted — the "Ember" toolbar menu decides: `hole` (nothing) or
|
|
29
|
+
* `placeholder` (the unlabeled marker).
|
|
36
30
|
*/
|
|
37
31
|
export interface RouteParameters {
|
|
38
32
|
/** Route name for the debug render tree; falls back to the story name. */
|
|
@@ -41,8 +35,8 @@ export interface RouteParameters {
|
|
|
41
35
|
model?: unknown;
|
|
42
36
|
/** `@controller` for the route template; falls back to `args.controller`. */
|
|
43
37
|
controller?: unknown;
|
|
44
|
-
/** What `{{outlet}}` renders
|
|
45
|
-
outlet?:
|
|
38
|
+
/** What `{{outlet}}` renders; see {@link RouteParameters}. */
|
|
39
|
+
outlet?: string | ComponentLike;
|
|
46
40
|
}
|
|
47
41
|
export interface EmberParameters {
|
|
48
42
|
ember?: {
|
|
@@ -51,7 +45,9 @@ export interface EmberParameters {
|
|
|
51
45
|
owner?: Record<`${string}:${string}`, object>;
|
|
52
46
|
updateGlobals?: (globals: Record<string, unknown>, owner: Owner) => void;
|
|
53
47
|
/**
|
|
54
|
-
* Present => render
|
|
48
|
+
* Present => render so that `{{outlet}}` works: through Ember's outlet root
|
|
49
|
+
* on builds that have it, as a component receiving `@outlet` on RFC 1099
|
|
50
|
+
* route rendering (ember-source >= 7.5.0-alpha.2).
|
|
55
51
|
* A template that uses `{{outlet}}` is rendered that way even without
|
|
56
52
|
* this parameter — then with empty route parameters (#62).
|
|
57
53
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAOtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEjG,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,YAAY,GACpB,OAAO,WAAW,GAClB,mBAAmB,GACnB,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,WAAW,GAAG,mBAAmB,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8DAA8D;IAC9D,MAAM,C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/E;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAExD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAW9F;AAED,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAKnF;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE;QACT;;;WAGG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd;;;;;;;WAOG;QACH,aAAa,CAAC,EAAE,MAAM,CAAC;QAEvB;;;;;WAKG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IAEF,OAAO,EAAE,CAAC,WAAW,GAAG;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CACxD;AAkDD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAkF7E;AAqBD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CA2HvE"}
|
package/dist/client/config.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as render, i as parameters, o as renderToCanvas, r as globalTypes, t as argTypesEnhancers } from "../config-
|
|
1
|
+
import { a as render, i as parameters, o as renderToCanvas, r as globalTypes, t as argTypesEnhancers } from "../config-C8o2dGQ2.mjs";
|
|
2
2
|
export { argTypesEnhancers, globalTypes, parameters, render, renderToCanvas };
|
package/dist/client/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as setProjectAnnotations, r as definePreview, t as RenderStory } from "../client-
|
|
2
|
-
import { o as renderToCanvas } from "../config-
|
|
3
|
-
import { t as OutletPlaceholder } from "../outlet-placeholder-
|
|
1
|
+
import { n as setProjectAnnotations, r as definePreview, t as RenderStory } from "../client-CTAOSmJ3.mjs";
|
|
2
|
+
import { o as renderToCanvas } from "../config-C8o2dGQ2.mjs";
|
|
3
|
+
import { t as OutletPlaceholder } from "../outlet-placeholder-CMOzKwEp.mjs";
|
|
4
4
|
export { OutletPlaceholder, RenderStory, definePreview, renderToCanvas, setProjectAnnotations };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as normalizeStoryResult } from "./story-result-Ds8Z5TZx.mjs";
|
|
2
|
-
import { c as templateUsesOutlet, n as config_exports, s as render_exports } from "./config-
|
|
2
|
+
import { c as templateUsesOutlet, n as config_exports, s as render_exports } from "./config-C8o2dGQ2.mjs";
|
|
3
3
|
import { t as annotations_exports } from "./annotations-DRGjlECb.mjs";
|
|
4
|
-
import "./outlet-placeholder-
|
|
4
|
+
import "./outlet-placeholder-CMOzKwEp.mjs";
|
|
5
5
|
import { definePreview } from "storybook/internal/csf";
|
|
6
6
|
import { renderComponent } from "@ember/renderer";
|
|
7
|
-
import { setDefaultProjectAnnotations, setProjectAnnotations } from "storybook/preview-api";
|
|
8
7
|
import { template } from "@ember/template-compiler";
|
|
8
|
+
import { setDefaultProjectAnnotations, setProjectAnnotations } from "storybook/preview-api";
|
|
9
9
|
import Component from "@glimmer/component";
|
|
10
10
|
import { getOwner } from "@ember/owner";
|
|
11
11
|
import { modifier } from "ember-modifier";
|
|
@@ -125,4 +125,4 @@ var RenderStory = class extends Component {
|
|
|
125
125
|
//#endregion
|
|
126
126
|
export { setProjectAnnotations$1 as n, definePreview$1 as r, RenderStory as t };
|
|
127
127
|
|
|
128
|
-
//# sourceMappingURL=client-
|
|
128
|
+
//# sourceMappingURL=client-CTAOSmJ3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-
|
|
1
|
+
{"version":3,"file":"client-CTAOSmJ3.mjs","names":["globalThis","STORYBOOK_ENV","definePreview","definePreviewBase","frameworkAnnotations","docsAnnotations","internalAnnotations","input","addons","setDefaultProjectAnnotations","setProjectAnnotations","originalSetProjectAnnotations","INTERNAL_DEFAULT_PROJECT_ANNOTATIONS","projectAnnotations"],"sources":["../src/client/globals.ts","../src/client/define-preview.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 { definePreview as definePreviewBase } from 'storybook/internal/csf';\n\nimport * as frameworkAnnotations from './config';\nimport * as docsAnnotations from './docs/annotations';\n\nimport type { EmberRenderer } from './types';\nimport type { TOC } from '@ember/component/template-only';\nimport type { AddonTypes, InferTypes, Meta, Preview, PreviewAddon } from 'storybook/internal/csf';\nimport type {\n Args,\n ArgsStoryFn,\n ComponentAnnotations,\n ProjectAnnotations\n} from 'storybook/internal/types';\n\n/**\n * The component shapes whose args `preview.meta()` infers from:\n *\n * - template-only components (`TOC<S>` / `TemplateOnlyComponent<S>`)\n * - class components (`Component<S>` — matched through the instance `args`)\n *\n * Anything else (untyped components, plain templates) falls back to loose\n * args; `preview.type<{ args: … }>()` overrides the inference explicitly.\n */\ntype EmberComponent<TArgs extends Args> =\n TOC<{ Args: TArgs }> | (abstract new (...args: never[]) => { args: Readonly<TArgs> });\n\ntype Simplify<T> = { [K in keyof T]: T[K] };\n\n/**\n * The framework's own preview annotations.\n *\n * In CSF Next mode Storybook bypasses the preset `previewAnnotations` entirely\n * (the generated iframe entry uses `preview.composed` alone), so `definePreview`\n * must inject them here — the same way `@storybook/react` folds its\n * `entry-preview` modules into the base factory.\n *\n * `./config` carries the renderer (`render`, `renderToCanvas`), the `renderer:\n * 'ember'` parameter and the outlet global; `./docs/annotations` carries the\n * docgen argTypes enhancers and the source decorator. The addon-docs-dependent\n * pieces (the autodocs `Page`, the patched `DocsRenderer`) are NOT imported\n * here: they arrive through the user's own `addonDocs()` registration, which\n * the preset redirects to `./docs/addon-preview` — keeping `@storybook/addon-docs`\n * out of this module's static import graph.\n */\nconst internalAnnotations = [frameworkAnnotations, docsAnnotations];\n\n/**\n * The renderer type parameter all `definePreview` factories carry: the Ember\n * renderer merged with whatever types the registered addons contribute.\n *\n * `InferTypes` collapses to `never` when no addons are registered (the empty\n * array case poisons the whole intersection), so it is neutralized here.\n */\nexport type EmberTypes<Addons extends AddonTypes = AddonTypes> = EmberRenderer & Addons;\n\ntype InferAddonTypes<Addons extends PreviewAddon<never>[]> = [InferTypes<Addons>] extends [never]\n ? AddonTypes\n : InferTypes<Addons>;\n\n/**\n * Type-safe preview configuration for Ember (the CSF Next entry point).\n *\n * ```ts\n * // .storybook/preview.ts\n * import { definePreview } from 'ember-storybook';\n * import addonDocs from '@storybook/addon-docs';\n *\n * export default definePreview({\n * addons: [addonDocs()],\n * parameters: {\n * ember: { app: createApp },\n * },\n * });\n * ```\n */\nexport function definePreview<Addons extends PreviewAddon<never>[]>(\n input: ProjectAnnotations<EmberTypes<InferAddonTypes<Addons>>> & { addons?: Addons }\n): EmberPreview<EmberTypes<InferAddonTypes<Addons>>> {\n return definePreviewBase<EmberTypes<InferAddonTypes<Addons>>, Addons>({\n ...input,\n // After the user's addons so framework values (argTypes enhancers, the\n // source decorator, the renderer itself) win the merge — mirroring the\n // CSF3 order, where the preset appends them last.\n addons: [...(input.addons ?? []), ...internalAnnotations] as unknown as Addons\n }) as unknown as EmberPreview<EmberTypes<InferAddonTypes<Addons>>>;\n}\n\n/**\n * The CSF Next `Preview` specialized for Ember: `preview.meta()` infers story\n * args from the component's signature.\n */\nexport interface EmberPreview<TRenderer extends EmberRenderer> extends Omit<\n Preview<TRenderer>,\n 'meta' | 'type'\n> {\n /**\n * Narrows or extends the inferred annotation types, e.g. to add args that\n * the component signature cannot provide:\n *\n * ```ts\n * const meta = preview.type<{ args: { theme: 'light' | 'dark' } }>().meta({\n * component: Button,\n * });\n * ```\n */\n type<R>(): EmberPreview<TRenderer & R>;\n\n /**\n * Creates the component meta for a story file; `meta.story()` then requires\n * exactly the component's args.\n *\n * ```ts\n * const meta = preview.meta({ component: Button });\n * export const Primary = meta.story({ args: { label: 'Click me' } });\n * ```\n */\n meta<TArgs extends Args, TInput extends ComponentAnnotations<TRenderer & { args: TArgs }, TArgs>>(\n input: TInput & {\n component?: EmberComponent<TArgs>;\n render?: ArgsStoryFn<TRenderer & { args: TArgs }, TArgs>;\n }\n ): Meta<TRenderer & { args: Simplify<TArgs & NonNullable<TInput['args']>> }, TInput>;\n\n meta<TInput extends ComponentAnnotations<TRenderer, TRenderer['args']>>(\n input: TInput\n ): Meta<TRenderer, TInput>;\n}\n","import {\n setDefaultProjectAnnotations,\n setProjectAnnotations as originalSetProjectAnnotations\n} from 'storybook/preview-api';\n\nimport * as INTERNAL_DEFAULT_PROJECT_ANNOTATIONS from './render';\n\nimport type { EmberRenderer } from './types';\nimport type {\n NamedOrDefaultProjectAnnotations,\n NormalizedProjectAnnotations\n} from 'storybook/internal/types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/preact';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations:\n | NamedOrDefaultProjectAnnotations<EmberRenderer>\n | NamedOrDefaultProjectAnnotations<EmberRenderer>[]\n): NormalizedProjectAnnotations<EmberRenderer> {\n setDefaultProjectAnnotations(INTERNAL_DEFAULT_PROJECT_ANNOTATIONS);\n\n return originalSetProjectAnnotations(projectAnnotations);\n}\n","import Component from '@glimmer/component';\nimport { getOwner } from '@ember/owner';\nimport { renderComponent } from '@ember/renderer';\n\nimport { modifier } from 'ember-modifier';\n\nimport { templateUsesOutlet } from './outlet';\nimport { normalizeStoryResult } from './story-result';\n\ninterface RenderStorySignature {\n Args: {\n story: () => object;\n args: Record<string, unknown>;\n };\n Element: HTMLDivElement;\n}\n\nexport class RenderStory extends Component<RenderStorySignature> {\n render = modifier((element: HTMLDivElement) => {\n const story = this.args.story();\n const { component, args, route } = normalizeStoryResult(story, this.args.args);\n const owner = getOwner(this);\n\n if (route || templateUsesOutlet(component)) {\n // Route stories are canvas-only: `renderToCanvas` owns the outlet backend\n // (outlet root on classic builds, the `@outlet` argument on RFC 1099),\n // while nesting this render inside a live tree would seed it without\n // route parameters or the outlet global.\n throw new Error(\n 'ember-storybook: this story renders a route template (it uses `{{outlet}}`), ' +\n 'but route stories can only be rendered by `renderToCanvas`, not through ' +\n '<RenderStory> (portable stories).'\n );\n }\n\n const result = renderComponent(component, {\n args,\n into: element,\n owner\n });\n\n return () => {\n result.destroy();\n };\n });\n\n <template>\n <div {{this.render}}></div>\n </template>\n}\n"],"mappings":";;;;;;;;;;;;AAGAA,WAAWC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0C3B,MAAMK,sBAAsB,CAACF,gBAAsBC,mBAAe;;;;;;;;;;;;;;;;;;;;;;;;AA+BlE,SAAgBH,gBACdK,OACmD;CACnD,OAAOJ,cAA+D;EACpE,GAAGI;EAIHC,QAAQ,CAAC,GAAID,MAAMC,UAAU,CAAA,GAAK,GAAGF,mBAAmB;CAC1D,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;ACtDA,SAAgBI,wBACdG,oBAG6C;CAC7CJ,6BAA6BG,cAAoC;CAEjE,OAAOD,sBAA8BE,kBAAkB;AACzD;;;ACvBA,IAAa,cAAb,cAAiC,UAAU;CACzC,SAAS,UAAU,YAAS;EAE1B,MAAM,EAAE,WAAW,MAAM,UAAU,qBADrB,KAAK,KAAK,MACgC,GAAO,KAAK,KAAK,IAAI;EAC7E,MAAM,QAAQ,SAAS,IAAI;EAE3B,IAAI,SAAS,mBAAmB,SAAA,GAK9B,MAAM,IAAI,MACR,wLAEE;EAIN,MAAM,SAAS,gBAAgB,WAAW;GACxC;GACA,MAAM;GACN;EACF,CAAA;EAEA,aAAO;GACL,OAAO,QAAO;EAChB;CACF,CAAA;CAEA;EAAA,SAAU,+BAEV;GAAA,WAAA;GAAA,OAAA;IAAA,OAAA,KAAA,UAAA,EAAW;GAAD;EAAA,CAAA;CAAA;AACZ"}
|