@storybook/ember 7.1.0-alpha.9 → 7.1.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@storybook/ember",
3
- "version": "7.1.0-alpha.9",
3
+ "version": "7.1.0-beta.0",
4
4
  "description": "Storybook for Ember: Develop Ember Component in isolation with Hot Reloading.",
5
- "homepage": "https://github.com/storybookjs/storybook/tree/main/frameworks/ember",
5
+ "homepage": "https://github.com/storybookjs/storybook/tree/next/code/frameworks/ember",
6
6
  "bugs": {
7
7
  "url": "https://github.com/storybookjs/storybook/issues"
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/storybookjs/storybook.git",
12
- "directory": "frameworks/ember"
12
+ "directory": "code/frameworks/ember"
13
13
  },
14
14
  "funding": {
15
15
  "type": "opencollective",
@@ -31,12 +31,12 @@
31
31
  "prep": "../../../scripts/prepare/tsc.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@storybook/builder-webpack5": "7.1.0-alpha.9",
35
- "@storybook/core-common": "7.1.0-alpha.9",
36
- "@storybook/docs-tools": "7.1.0-alpha.9",
34
+ "@storybook/builder-webpack5": "7.1.0-beta.0",
35
+ "@storybook/core-common": "7.1.0-beta.0",
36
+ "@storybook/docs-tools": "7.1.0-beta.0",
37
37
  "@storybook/global": "^5.0.0",
38
- "@storybook/preview-api": "7.1.0-alpha.9",
39
- "@storybook/types": "7.1.0-alpha.9",
38
+ "@storybook/preview-api": "7.1.0-beta.0",
39
+ "@storybook/types": "7.1.0-beta.0",
40
40
  "ts-dedent": "^2.0.0"
41
41
  },
42
42
  "devDependencies": {
@@ -59,5 +59,5 @@
59
59
  "access": "public"
60
60
  },
61
61
  "bundler": {},
62
- "gitHead": "ec112401efaae6d3d4996c790a30301177570da9"
63
- }
62
+ "gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17"
63
+ }
package/preset.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./dist/cjs/preset');
1
+ module.exports = require('./dist/preset');
@@ -0,0 +1,12 @@
1
+ import { enhanceArgTypes } from '@storybook/docs-tools';
2
+ import { extractArgTypes, extractComponentDescription } from './jsondoc';
3
+
4
+ export const parameters = {
5
+ docs: {
6
+ story: { iframeHeight: '80px' },
7
+ extractArgTypes,
8
+ extractComponentDescription,
9
+ },
10
+ };
11
+
12
+ export const argTypesEnhancers = [enhanceArgTypes];
@@ -0,0 +1 @@
1
+ export { setJSONDoc } from './jsondoc';
@@ -0,0 +1,50 @@
1
+ /* eslint-disable no-underscore-dangle */
2
+ import { global } from '@storybook/global';
3
+
4
+ export const setJSONDoc = (jsondoc) => {
5
+ global.__EMBER_GENERATED_DOC_JSON__ = jsondoc;
6
+ };
7
+ export const getJSONDoc = () => {
8
+ return global.__EMBER_GENERATED_DOC_JSON__;
9
+ };
10
+
11
+ export const extractArgTypes = (componentName) => {
12
+ const json = getJSONDoc();
13
+ if (!(json && json.included)) {
14
+ return null;
15
+ }
16
+ const componentDoc = json.included.find((doc) => doc.attributes.name === componentName);
17
+
18
+ if (!componentDoc) {
19
+ return null;
20
+ }
21
+ return componentDoc.attributes.arguments.reduce((acc, prop) => {
22
+ acc[prop.name] = {
23
+ name: prop.name,
24
+ defaultValue: prop.defaultValue,
25
+ description: prop.description,
26
+ table: {
27
+ defaultValue: { summary: prop.defaultValue },
28
+ type: {
29
+ summary: prop.type,
30
+ required: prop.tags.length ? prop.tags.some((tag) => tag.name === 'required') : false,
31
+ },
32
+ },
33
+ };
34
+ return acc;
35
+ }, {});
36
+ };
37
+
38
+ export const extractComponentDescription = (componentName) => {
39
+ const json = getJSONDoc();
40
+ if (!(json && json.included)) {
41
+ return null;
42
+ }
43
+ const componentDoc = json.included.find((doc) => doc.attributes.name === componentName);
44
+
45
+ if (!componentDoc) {
46
+ return null;
47
+ }
48
+
49
+ return componentDoc.attributes.description;
50
+ };
@@ -0,0 +1,9 @@
1
+ import { extractArgTypes, extractComponentDescription } from './jsondoc';
2
+
3
+ export const parameters = {
4
+ docs: {
5
+ story: { iframeHeight: '80px' },
6
+ extractArgTypes,
7
+ extractComponentDescription,
8
+ },
9
+ };
@@ -0,0 +1 @@
1
+ export { setJSONDoc } from './jsondoc';
@@ -0,0 +1,50 @@
1
+ /* eslint-disable no-underscore-dangle */
2
+ import { global } from '@storybook/global';
3
+
4
+ export const setJSONDoc = (jsondoc) => {
5
+ global.__EMBER_GENERATED_DOC_JSON__ = jsondoc;
6
+ };
7
+ export const getJSONDoc = () => {
8
+ return global.__EMBER_GENERATED_DOC_JSON__;
9
+ };
10
+
11
+ export const extractArgTypes = (componentName) => {
12
+ const json = getJSONDoc();
13
+ if (!(json && json.included)) {
14
+ return null;
15
+ }
16
+ const componentDoc = json.included.find((doc) => doc.attributes.name === componentName);
17
+
18
+ if (!componentDoc) {
19
+ return null;
20
+ }
21
+ return componentDoc.attributes.arguments.reduce((acc, prop) => {
22
+ acc[prop.name] = {
23
+ name: prop.name,
24
+ defaultValue: prop.defaultValue,
25
+ description: prop.description,
26
+ table: {
27
+ defaultValue: { summary: prop.defaultValue },
28
+ type: {
29
+ summary: prop.type,
30
+ required: prop.tags.length ? prop.tags.some((tag) => tag.name === 'required') : false,
31
+ },
32
+ },
33
+ };
34
+ return acc;
35
+ }, {});
36
+ };
37
+
38
+ export const extractComponentDescription = (componentName) => {
39
+ const json = getJSONDoc();
40
+ if (!(json && json.included)) {
41
+ return null;
42
+ }
43
+ const componentDoc = json.included.find((doc) => doc.attributes.name === componentName);
44
+
45
+ if (!componentDoc) {
46
+ return null;
47
+ }
48
+
49
+ return componentDoc.attributes.description;
50
+ };
@@ -0,0 +1,4 @@
1
+ declare module 'ember-source/dist/ember-template-compiler';
2
+
3
+ declare var STORYBOOK_ENV: 'ember';
4
+ declare var STORYBOOK_NAME: any;