ember-storybook 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +112 -41
  2. package/package.json +3 -4
package/README.md CHANGED
@@ -1,67 +1,138 @@
1
1
  # Storybook for Ember
2
2
 
3
- Storybook for Ember is a UI development environment for your Ember components.
4
- With it, you can visualize different states of your UI components and develop them interactively.
3
+ Develop, document, and test your UI components in isolation. A workshop for your components.
5
4
 
6
- ![Storybook Screenshot](https://github.com/storybookjs/storybook/blob/main/media/storybook-intro.gif)
5
+ `ember-storybook` is a [Storybook](https://storybook.js.org) framework for modern Ember apps.
7
6
 
8
- Storybook runs outside of your app.
9
- So you can develop UI components in isolation without worrying about app specific dependencies and requirements.
7
+ - **Controls from your signatures.** Controls and Signature are generated from the component itself.
8
+ - **Stories, tests, docs — one source.** The same story feeds the docs page, the play function, and Vitest
9
+ browser tests.
10
+ - **Route stories included.** Templates with `{{outlet}}` are a first-class story type.
10
11
 
11
- ## Getting Started
12
-
13
- For more information visit: [storybook.js.org](https://storybook.js.org?ref=readme)
12
+ ## Requirements
14
13
 
15
- ---
14
+ - ember v6.8
15
+ - storybook v10
16
16
 
17
- Storybook also comes with a lot of [addons](https://storybook.js.org/addons?ref=readme) and a great API to customize as you wish.
18
- You can also build a [static version](https://storybook.js.org/docs/sharing/publish-storybook?renderer=ember&ref=readme) of your Storybook and deploy it anywhere you want.
17
+ ## Installation
19
18
 
20
- ## Docs
19
+ ```sh
20
+ pnpm add -D storybook ember-storybook
21
+ ```
21
22
 
22
- - [Basics](https://storybook.js.org/docs/get-started/install?renderer=ember&ref=readme)
23
- - [Configurations](https://storybook.js.org/docs/configure?renderer=ember&ref=readme)
24
- - [Addons](https://storybook.js.org/docs/configure/user-interface/storybook-addons?renderer=ember&ref=readme)
23
+ ## Getting Started
25
24
 
26
- ## CSF Next
25
+ Add the two config files, then write a story next to your component.
27
26
 
28
- This framework supports the [CSF Next factory syntax](https://storybook.js.org/docs/api/csf/csf-next)
29
- alongside classic CSF. Wire up `defineMain` and `definePreview`, then build
30
- stories from `preview.meta()` — story `args` are inferred from the component's
31
- Ember signature:
27
+ **`.storybook/main.ts`**
32
28
 
33
29
  ```ts
34
- // .storybook/main.ts
35
- import { defineMain } from 'ember-storybook/node';
30
+ import type { StorybookConfig } from 'ember-storybook';
31
+
32
+ const config: StorybookConfig = {
33
+ stories: ['../app/**/*.stories.g(j|t)s'],
34
+ framework: 'ember-storybook',
35
+ };
36
36
 
37
- export default defineMain({
38
- stories: ['../**/*.stories.g(j|t)s'],
39
- addons: ['@storybook/addon-docs']
40
- });
37
+ export default config;
41
38
  ```
42
39
 
40
+ **`.storybook/preview.ts`**
41
+
43
42
  ```ts
44
- // .storybook/preview.ts
45
- import { definePreview } from 'ember-storybook';
46
- import addonDocs from '@storybook/addon-docs';
43
+ import { createApp } from '../app/app';
44
+
45
+ import type { Preview } from 'ember-storybook';
47
46
 
48
- export default definePreview({
49
- addons: [addonDocs()],
47
+ const preview: Preview = {
50
48
  parameters: {
51
- ember: { app: createApp }
52
- }
53
- });
49
+ ember: {
50
+ app: createApp,
51
+ },
52
+ },
53
+ };
54
+
55
+ export default preview;
54
56
  ```
55
57
 
58
+ An empty App is booted by default, but you can set it yourself — pass an `Application`, an
59
+ `ApplicationInstance`, or a factory function returning one.
60
+
61
+ **`app/components/button.stories.gts`**
62
+
56
63
  ```gts
57
- // button.stories.gts
58
- import preview from '../.storybook/preview';
59
- import { Button } from './button.gts';
64
+ import Button from './button.gts';
65
+
66
+ import type { Meta, StoryObj } from 'ember-storybook';
67
+
68
+ export default {
69
+ title: 'Example/Button',
70
+ component: Button,
71
+ } satisfies Meta;
60
72
 
61
- const meta = preview.meta({ component: Button });
73
+ export const Basic: StoryObj = {
74
+ args: {
75
+ intent: 'action',
76
+ },
77
+ };
78
+ ```
79
+
80
+ The component is rendered with every arg passed down as a named argument (`@intent`) — no render function
81
+ needed.
62
82
 
63
- export const Primary = meta.story({ args: { label: 'Click me' } });
64
- export const Small = Primary.extend({ args: { size: 'small' } });
83
+ Add the scripts and run it:
84
+
85
+ ```json
86
+ {
87
+ "scripts": {
88
+ "storybook": "storybook dev -p 6006",
89
+ "build-storybook": "storybook build"
90
+ }
91
+ }
65
92
  ```
66
93
 
67
- Learn more about Storybook at [storybook.js.org](https://storybook.js.org/?ref=readme).
94
+ ```sh
95
+ pnpm storybook
96
+ ```
97
+
98
+ ## Documentation
99
+
100
+ Full documentation lives at **[ember-integrations.github.io/ember-storybook](https://ember-integrations.github.io/ember-storybook/)**.
101
+
102
+ Getting Started
103
+
104
+ - **[Install & First Story](https://ember-integrations.github.io/ember-storybook/getting-started)** — requirements, install, and the two config files
105
+
106
+ Guide
107
+
108
+ - **[Writing Stories](https://ember-integrations.github.io/ember-storybook/guide/writing-stories)** — args, controls, and both CSF dialects (CSF v3 and CSF Next)
109
+ - **[Decorators](https://ember-integrations.github.io/ember-storybook/guide/decorators)** — wrap stories with context and layout
110
+ - **[Route Stories](https://ember-integrations.github.io/ember-storybook/guide/route-stories)** — stories for route templates and `{{outlet}}`
111
+ - **[App Context & Globals](https://ember-integrations.github.io/ember-storybook/guide/context-and-globals)** — `app`, `owner`, `configure`, and `updateGlobals`
112
+ - **[Auto-Docs](https://ember-integrations.github.io/ember-storybook/guide/auto-docs)** — docs pages generated from your component signatures
113
+ - **[Testing](https://ember-integrations.github.io/ember-storybook/guide/testing)** — turn stories into Vitest browser tests and play functions
114
+ - **[Sharing & Deploying](https://ember-integrations.github.io/ember-storybook/guide/sharing)** — build a static Storybook and ship it anywhere
115
+ - **[Migrating](https://ember-integrations.github.io/ember-storybook/configuration/migration)** — moving from `@storybook/ember` to `ember-storybook`
116
+
117
+ Config
118
+
119
+ - **[`main.ts`](https://ember-integrations.github.io/ember-storybook/configuration/main-ts)** — build configuration and available addons
120
+ - **[Ember Parameters](https://ember-integrations.github.io/ember-storybook/configuration/ember-parameters)** — every option under `parameters.ember`
121
+
122
+ ## References
123
+
124
+ ### Ember
125
+
126
+ - [Ember Guides](https://guides.emberjs.com/) — the official guides
127
+ - [Ember API](https://api.emberjs.com/) — `Application`, `ApplicationInstance`, and the rest of the API
128
+ - [Glimmer components](https://guides.emberjs.com/release/components/built-in-components/)
129
+
130
+ ### Storybook
131
+
132
+ - [Storybook](https://storybook.js.org) — homepage
133
+ - [Write stories](https://storybook.js.org/docs/writing-stories) — CSF, args, decorators
134
+ - [Write tests](https://storybook.js.org/docs/writing-tests) — play functions and `@storybook/addon-vitest`
135
+
136
+ ## License
137
+
138
+ [MIT](https://github.com/ember-integrations/ember-storybook/blob/main/LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-storybook",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "license": "MIT",
5
5
  "description": "Storybook for Ember: Develop, document, and test UI components in isolation",
6
6
  "keywords": [
@@ -13,6 +13,7 @@
13
13
  "bugs": {
14
14
  "url": "https://github.com/ember-integrations/ember-storybook/issues"
15
15
  },
16
+ "homepage": "https://ember-integrations.github.io/ember-storybook",
16
17
  "repository": {
17
18
  "type": "git",
18
19
  "url": "https://github.com/ember-integrations/ember-storybook"
@@ -77,9 +78,7 @@
77
78
  "typedoc-plugin-ember": "0.0.3"
78
79
  },
79
80
  "peerDependencies": {
80
- "@glimmer/component": "^2.1.1",
81
- "ember-source": ">=6.8.0",
82
- "storybook": "^10.5.0",
81
+ "storybook": "^10.0.0",
83
82
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
84
83
  },
85
84
  "devDependencies": {