@storybook/ember 6.5.9 → 7.0.0-alpha.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.
- package/dist/cjs/client/docs/config.js +2 -2
- package/dist/cjs/client/docs/index.js +1 -1
- package/dist/cjs/client/docs/jsondoc.js +10 -26
- package/dist/cjs/client/preview/config.js +2 -2
- package/dist/cjs/client/preview/docs/config.js +1 -1
- package/dist/cjs/client/preview/docs/index.js +1 -1
- package/dist/cjs/client/preview/docs/jsondoc.js +10 -26
- package/dist/cjs/client/preview/globals.js +3 -1
- package/dist/cjs/client/preview/index.js +19 -21
- package/dist/cjs/client/preview/render.js +36 -45
- package/dist/cjs/{client/index.js → index.js} +13 -12
- package/dist/cjs/preset.js +16 -0
- package/dist/esm/client/docs/config.js +4 -4
- package/dist/esm/client/docs/jsondoc.js +10 -22
- package/dist/esm/client/preview/config.js +1 -1
- package/dist/esm/client/preview/docs/config.js +3 -3
- package/dist/esm/client/preview/docs/jsondoc.js +10 -22
- package/dist/esm/client/preview/globals.js +3 -1
- package/dist/esm/client/preview/index.js +19 -23
- package/dist/esm/client/preview/render.js +36 -40
- package/dist/esm/index.js +3 -0
- package/dist/esm/preset.js +6 -0
- package/dist/{ts3.9 → types}/src/client/preview/config.d.ts +0 -0
- package/dist/{ts3.9 → types}/src/client/preview/globals.d.ts +0 -0
- package/dist/{ts3.9 → types}/src/client/preview/index.d.ts +2 -2
- package/dist/{ts3.9 → types}/src/client/preview/render.d.ts +0 -0
- package/dist/{ts3.9 → types}/src/client/preview/types.d.ts +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/preset.d.ts +11 -0
- package/dist/{ts3.9 → types}/src/server/framework-preset-babel-ember.d.ts +0 -0
- package/dist/{ts3.9 → types}/src/server/framework-preset-ember-docs.d.ts +0 -0
- package/package.json +13 -25
- package/preset.js +1 -1
- package/standalone.js +2 -3
- package/bin/build.js +0 -4
- package/bin/index.js +0 -3
- package/dist/cjs/server/build.js +0 -9
- package/dist/cjs/server/index.js +0 -9
- package/dist/cjs/server/options.js +0 -17
- package/dist/cjs/server/preset.js +0 -8
- package/dist/esm/client/index.js +0 -5
- package/dist/esm/server/build.js +0 -3
- package/dist/esm/server/index.js +0 -3
- package/dist/esm/server/options.js +0 -8
- package/dist/esm/server/preset.js +0 -1
- package/dist/modern/client/docs/config.js +0 -10
- package/dist/modern/client/docs/index.js +0 -1
- package/dist/modern/client/docs/jsondoc.js +0 -57
- package/dist/modern/client/index.js +0 -5
- package/dist/modern/client/preview/config.js +0 -4
- package/dist/modern/client/preview/docs/config.js +0 -8
- package/dist/modern/client/preview/docs/index.js +0 -1
- package/dist/modern/client/preview/docs/jsondoc.js +0 -57
- package/dist/modern/client/preview/globals.js +0 -6
- package/dist/modern/client/preview/index.js +0 -22
- package/dist/modern/client/preview/render.js +0 -79
- package/dist/modern/client/preview/types.js +0 -0
- package/dist/modern/server/build.js +0 -3
- package/dist/modern/server/framework-preset-babel-ember.js +0 -49
- package/dist/modern/server/framework-preset-ember-docs.js +0 -6
- package/dist/modern/server/index.js +0 -3
- package/dist/modern/server/options.js +0 -8
- package/dist/modern/server/preset.js +0 -1
- package/dist/ts3.4/src/client/index.d.ts +0 -1
- package/dist/ts3.4/src/client/preview/config.d.ts +0 -4
- package/dist/ts3.4/src/client/preview/globals.d.ts +0 -1
- package/dist/ts3.4/src/client/preview/index.d.ts +0 -9
- package/dist/ts3.4/src/client/preview/render.d.ts +0 -3
- package/dist/ts3.4/src/client/preview/types.d.ts +0 -14
- package/dist/ts3.4/src/server/build.d.ts +0 -1
- package/dist/ts3.4/src/server/framework-preset-babel-ember.d.ts +0 -4
- package/dist/ts3.4/src/server/framework-preset-ember-docs.d.ts +0 -2
- package/dist/ts3.4/src/server/index.d.ts +0 -1
- package/dist/ts3.4/src/server/options.d.ts +0 -3
- package/dist/ts3.4/src/server/preset.d.ts +0 -2
- package/dist/ts3.9/src/client/index.d.ts +0 -1
- package/dist/ts3.9/src/server/build.d.ts +0 -1
- package/dist/ts3.9/src/server/index.d.ts +0 -1
- package/dist/ts3.9/src/server/options.d.ts +0 -3
- package/dist/ts3.9/src/server/preset.d.ts +0 -2
@@ -1,34 +1,26 @@
|
|
1
|
-
import "core-js/modules/es.array.find.js";
|
2
|
-
import "core-js/modules/es.object.to-string.js";
|
3
|
-
import "core-js/modules/es.function.name.js";
|
4
|
-
import "core-js/modules/es.symbol.js";
|
5
|
-
import "core-js/modules/es.symbol.description.js";
|
6
|
-
|
7
1
|
/* eslint-disable no-underscore-dangle */
|
8
2
|
|
9
3
|
/* global window */
|
10
|
-
export
|
4
|
+
export const setJSONDoc = jsondoc => {
|
11
5
|
window.__EMBER_GENERATED_DOC_JSON__ = jsondoc;
|
12
6
|
};
|
13
|
-
export
|
7
|
+
export const getJSONDoc = () => {
|
14
8
|
return window.__EMBER_GENERATED_DOC_JSON__;
|
15
9
|
};
|
16
|
-
export
|
17
|
-
|
10
|
+
export const extractArgTypes = componentName => {
|
11
|
+
const json = getJSONDoc();
|
18
12
|
|
19
13
|
if (!(json && json.included)) {
|
20
14
|
return null;
|
21
15
|
}
|
22
16
|
|
23
|
-
|
24
|
-
return doc.attributes.name === componentName;
|
25
|
-
});
|
17
|
+
const componentDoc = json.included.find(doc => doc.attributes.name === componentName);
|
26
18
|
|
27
19
|
if (!componentDoc) {
|
28
20
|
return null;
|
29
21
|
}
|
30
22
|
|
31
|
-
return componentDoc.attributes.arguments.reduce(
|
23
|
+
return componentDoc.attributes.arguments.reduce((acc, prop) => {
|
32
24
|
acc[prop.name] = {
|
33
25
|
name: prop.name,
|
34
26
|
defaultValue: prop.defaultValue,
|
@@ -39,25 +31,21 @@ export var extractArgTypes = function extractArgTypes(componentName) {
|
|
39
31
|
},
|
40
32
|
type: {
|
41
33
|
summary: prop.type,
|
42
|
-
required: prop.tags.length ? prop.tags.some(
|
43
|
-
return tag.name === 'required';
|
44
|
-
}) : false
|
34
|
+
required: prop.tags.length ? prop.tags.some(tag => tag.name === 'required') : false
|
45
35
|
}
|
46
36
|
}
|
47
37
|
};
|
48
38
|
return acc;
|
49
39
|
}, {});
|
50
40
|
};
|
51
|
-
export
|
52
|
-
|
41
|
+
export const extractComponentDescription = componentName => {
|
42
|
+
const json = getJSONDoc();
|
53
43
|
|
54
44
|
if (!(json && json.included)) {
|
55
45
|
return null;
|
56
46
|
}
|
57
47
|
|
58
|
-
|
59
|
-
return doc.attributes.name === componentName;
|
60
|
-
});
|
48
|
+
const componentDoc = json.included.find(doc => doc.attributes.name === componentName);
|
61
49
|
|
62
50
|
if (!componentDoc) {
|
63
51
|
return null;
|
@@ -1,26 +1,22 @@
|
|
1
|
-
import { start } from '@storybook/core';
|
1
|
+
import { start } from '@storybook/core-client';
|
2
2
|
import './globals';
|
3
3
|
import { renderToDOM } from './render';
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
export
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
};
|
23
|
-
export var configure = function configure(loadable, m) {
|
24
|
-
return coreConfigure(framework, loadable, m);
|
25
|
-
};
|
4
|
+
const {
|
5
|
+
configure: coreConfigure,
|
6
|
+
clientApi,
|
7
|
+
forceReRender
|
8
|
+
} = start(renderToDOM);
|
9
|
+
export const {
|
10
|
+
setAddon,
|
11
|
+
addDecorator,
|
12
|
+
addParameters,
|
13
|
+
clearDecorators,
|
14
|
+
getStorybook,
|
15
|
+
raw
|
16
|
+
} = clientApi;
|
17
|
+
const framework = 'ember';
|
18
|
+
export const storiesOf = (kind, m) => clientApi.storiesOf(kind, m).addParameters({
|
19
|
+
framework
|
20
|
+
});
|
21
|
+
export const configure = (loadable, m) => coreConfigure(framework, loadable, m);
|
26
22
|
export { forceReRender };
|
@@ -1,53 +1,43 @@
|
|
1
|
-
var _templateObject;
|
2
|
-
|
3
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
4
|
-
|
5
|
-
import "core-js/modules/es.object.assign.js";
|
6
|
-
import "core-js/modules/es.function.name.js";
|
7
|
-
import "core-js/modules/es.array.concat.js";
|
8
|
-
import "core-js/modules/es.array.slice.js";
|
9
|
-
import "core-js/modules/es.object.freeze.js";
|
10
1
|
import global from 'global';
|
11
2
|
import dedent from 'ts-dedent';
|
12
|
-
|
13
|
-
|
14
|
-
|
3
|
+
const {
|
4
|
+
window: globalWindow,
|
5
|
+
document
|
6
|
+
} = global;
|
7
|
+
const rootEl = document.getElementById('root');
|
15
8
|
|
16
|
-
|
9
|
+
const config = globalWindow.require(`${globalWindow.STORYBOOK_NAME}/config/environment`);
|
17
10
|
|
18
|
-
|
11
|
+
const app = globalWindow.require(`${globalWindow.STORYBOOK_NAME}/app`).default.create(Object.assign({
|
19
12
|
autoboot: false,
|
20
13
|
rootElement: rootEl
|
21
14
|
}, config.APP));
|
22
15
|
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
let lastPromise = app.boot();
|
17
|
+
let hasRendered = false;
|
18
|
+
let isRendering = false;
|
26
19
|
|
27
20
|
function render(options, el) {
|
28
21
|
if (isRendering) return;
|
29
22
|
isRendering = true;
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
const {
|
24
|
+
template,
|
25
|
+
context = {},
|
26
|
+
element
|
27
|
+
} = options;
|
34
28
|
|
35
29
|
if (hasRendered) {
|
36
|
-
lastPromise = lastPromise.then(
|
37
|
-
return instance.destroy();
|
38
|
-
});
|
30
|
+
lastPromise = lastPromise.then(instance => instance.destroy());
|
39
31
|
}
|
40
32
|
|
41
|
-
lastPromise = lastPromise.then(
|
42
|
-
|
43
|
-
return appInstancePrivate.boot().then(
|
44
|
-
|
45
|
-
});
|
46
|
-
}).then(function (instance) {
|
33
|
+
lastPromise = lastPromise.then(() => {
|
34
|
+
const appInstancePrivate = app.buildInstance();
|
35
|
+
return appInstancePrivate.boot().then(() => appInstancePrivate);
|
36
|
+
}).then(instance => {
|
47
37
|
instance.register('component:story-mode', Ember.Component.extend(Object.assign({
|
48
38
|
layout: template || options
|
49
39
|
}, context)));
|
50
|
-
|
40
|
+
const component = instance.lookup('component:story-mode');
|
51
41
|
|
52
42
|
if (element) {
|
53
43
|
component.appendTo(element);
|
@@ -62,18 +52,24 @@ function render(options, el) {
|
|
62
52
|
});
|
63
53
|
}
|
64
54
|
|
65
|
-
export function renderToDOM(
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
55
|
+
export function renderToDOM({
|
56
|
+
storyFn,
|
57
|
+
kind,
|
58
|
+
name,
|
59
|
+
showMain,
|
60
|
+
showError
|
61
|
+
}, domElement) {
|
62
|
+
const element = storyFn();
|
72
63
|
|
73
64
|
if (!element) {
|
74
65
|
showError({
|
75
|
-
title:
|
76
|
-
description: dedent
|
66
|
+
title: `Expecting a Ember element from the story: "${name}" of "${kind}".`,
|
67
|
+
description: dedent`
|
68
|
+
Did you forget to return the Ember element from the story?
|
69
|
+
Use "() => hbs('{{component}}')" or "() => { return {
|
70
|
+
template: hbs\`{{component}}\`
|
71
|
+
} }" when defining the story.
|
72
|
+
`
|
77
73
|
});
|
78
74
|
return;
|
79
75
|
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export const addons = [require.resolve('./server/framework-preset-babel-ember'), require.resolve('./server/framework-preset-ember-docs')];
|
2
|
+
export const core = async config => {
|
3
|
+
return Object.assign({}, config, {
|
4
|
+
builder: require.resolve('@storybook/builder-webpack5')
|
5
|
+
});
|
6
|
+
};
|
File without changes
|
File without changes
|
@@ -3,7 +3,7 @@ declare const forceReRender: (() => never) | (() => void);
|
|
3
3
|
export declare const setAddon: ((addon: any) => void) | (() => never), addDecorator: (() => never) | ((decorator: import("@storybook/csf").DecoratorFunction<import("./types").EmberFramework, import("@storybook/csf").Args>) => void), addParameters: (({ globals, globalTypes, ...parameters }: import("@storybook/csf").Parameters & {
|
4
4
|
globals?: import("@storybook/csf").Globals;
|
5
5
|
globalTypes?: import("@storybook/csf").GlobalTypes;
|
6
|
-
}) => void) | (() => never), clearDecorators: (() => void) | (() => never), getStorybook: (() => never) | (() => import("
|
7
|
-
export declare const storiesOf: (kind: string, m: any) => import("
|
6
|
+
}) => void) | (() => never), clearDecorators: (() => void) | (() => never), getStorybook: (() => never) | (() => import("lib/client-api/dist/types/ClientApi").GetStorybookKind<import("./types").EmberFramework>[]), raw: (() => never) | (() => import("lib/store/dist/types").BoundStory<import("./types").EmberFramework>[]);
|
7
|
+
export declare const storiesOf: (kind: string, m: any) => import("lib/addons/dist/types").StoryApi<import("./types").OptionsArgs>;
|
8
8
|
export declare const configure: (loadable: any, m: any) => void;
|
9
9
|
export { forceReRender };
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
export { storiesOf, setAddon, addDecorator, addParameters, configure, getStorybook, forceReRender, raw, } from './client/preview';
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { StorybookConfig } from '@storybook/core-common';
|
2
|
+
export declare const addons: StorybookConfig['addons'];
|
3
|
+
export declare const core: (config: StorybookConfig['core']) => Promise<{
|
4
|
+
builder: string;
|
5
|
+
disableWebpackDefaults?: boolean;
|
6
|
+
channelOptions?: Partial<import("telejson").Options>;
|
7
|
+
disableProjectJson?: boolean;
|
8
|
+
disableTelemetry?: boolean;
|
9
|
+
enableCrashReports?: boolean;
|
10
|
+
crossOriginIsolated?: boolean;
|
11
|
+
}>;
|
File without changes
|
File without changes
|
package/package.json
CHANGED
@@ -1,38 +1,25 @@
|
|
1
1
|
{
|
2
2
|
"name": "@storybook/ember",
|
3
|
-
"version": "
|
3
|
+
"version": "7.0.0-alpha.2",
|
4
4
|
"description": "Storybook for Ember: Develop Ember Component in isolation with Hot Reloading.",
|
5
|
-
"homepage": "https://github.com/storybookjs/storybook/tree/main/
|
5
|
+
"homepage": "https://github.com/storybookjs/storybook/tree/main/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": "
|
12
|
+
"directory": "frameworks/ember"
|
13
13
|
},
|
14
14
|
"funding": {
|
15
15
|
"type": "opencollective",
|
16
16
|
"url": "https://opencollective.com/storybook"
|
17
17
|
},
|
18
18
|
"license": "MIT",
|
19
|
-
"main": "dist/cjs/
|
20
|
-
"module": "dist/esm/
|
21
|
-
"types": "dist/
|
22
|
-
"typesVersions": {
|
23
|
-
"<3.8": {
|
24
|
-
"dist/ts3.9/*": [
|
25
|
-
"dist/ts3.4/*"
|
26
|
-
]
|
27
|
-
}
|
28
|
-
},
|
29
|
-
"bin": {
|
30
|
-
"build-storybook": "./bin/build.js",
|
31
|
-
"start-storybook": "./bin/index.js",
|
32
|
-
"storybook-server": "./bin/index.js"
|
33
|
-
},
|
19
|
+
"main": "dist/cjs/index.js",
|
20
|
+
"module": "dist/esm/index.js",
|
21
|
+
"types": "dist/types/index.d.ts",
|
34
22
|
"files": [
|
35
|
-
"bin/**/*",
|
36
23
|
"dist/**/*",
|
37
24
|
"README.md",
|
38
25
|
"*.js",
|
@@ -42,10 +29,12 @@
|
|
42
29
|
"prepare": "node ../../scripts/prepare.js"
|
43
30
|
},
|
44
31
|
"dependencies": {
|
45
|
-
"@storybook/
|
46
|
-
"@storybook/core-
|
47
|
-
"@storybook/
|
48
|
-
"@storybook/
|
32
|
+
"@storybook/builder-webpack5": "7.0.0-alpha.2",
|
33
|
+
"@storybook/core-client": "7.0.0-alpha.2",
|
34
|
+
"@storybook/core-common": "7.0.0-alpha.2",
|
35
|
+
"@storybook/core-server": "7.0.0-alpha.2",
|
36
|
+
"@storybook/docs-tools": "7.0.0-alpha.2",
|
37
|
+
"@storybook/store": "7.0.0-alpha.2",
|
49
38
|
"core-js": "^3.8.2",
|
50
39
|
"global": "^4.4.0",
|
51
40
|
"react": "16.14.0",
|
@@ -66,6 +55,5 @@
|
|
66
55
|
"publishConfig": {
|
67
56
|
"access": "public"
|
68
57
|
},
|
69
|
-
"gitHead": "
|
70
|
-
"sbmodern": "dist/modern/client/index.js"
|
58
|
+
"gitHead": "44920e2b6bd51981bac5124743c29fb9f5517e44"
|
71
59
|
}
|
package/preset.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
module.exports = require('./dist/cjs/
|
1
|
+
module.exports = require('./dist/cjs/preset');
|
package/standalone.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
const build = require('@storybook/core/standalone');
|
2
|
-
const frameworkOptions = require('./dist/cjs/server/options').default;
|
1
|
+
const build = require('@storybook/core-server/standalone');
|
3
2
|
|
4
3
|
async function buildStandalone(options) {
|
5
|
-
return build(options
|
4
|
+
return build(options);
|
6
5
|
}
|
7
6
|
|
8
7
|
module.exports = buildStandalone;
|
package/bin/build.js
DELETED
package/bin/index.js
DELETED
package/dist/cjs/server/build.js
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _server = require("@storybook/core/server");
|
4
|
-
|
5
|
-
var _options = _interopRequireDefault(require("./options"));
|
6
|
-
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
-
|
9
|
-
(0, _server.buildStatic)(_options.default);
|
package/dist/cjs/server/index.js
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _server = require("@storybook/core/server");
|
4
|
-
|
5
|
-
var _options = _interopRequireDefault(require("./options"));
|
6
|
-
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
-
|
9
|
-
(0, _server.buildDev)(_options.default);
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _readPkgUp = require("read-pkg-up");
|
9
|
-
|
10
|
-
var _default = {
|
11
|
-
packageJson: (0, _readPkgUp.sync)({
|
12
|
-
cwd: __dirname
|
13
|
-
}).packageJson,
|
14
|
-
framework: 'ember',
|
15
|
-
frameworkPresets: [require.resolve('./preset')]
|
16
|
-
};
|
17
|
-
exports.default = _default;
|
package/dist/esm/client/index.js
DELETED
package/dist/esm/server/build.js
DELETED
package/dist/esm/server/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export var addons = [require.resolve('./framework-preset-babel-ember'), require.resolve('./framework-preset-ember-docs')];
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { enhanceArgTypes } from '@storybook/docs-tools';
|
2
|
-
import { extractArgTypes, extractComponentDescription } from './jsondoc';
|
3
|
-
export const parameters = {
|
4
|
-
docs: {
|
5
|
-
iframeHeight: 80,
|
6
|
-
extractArgTypes,
|
7
|
-
extractComponentDescription
|
8
|
-
}
|
9
|
-
};
|
10
|
-
export const argTypesEnhancers = [enhanceArgTypes];
|
@@ -1 +0,0 @@
|
|
1
|
-
export { setJSONDoc } from './jsondoc';
|
@@ -1,57 +0,0 @@
|
|
1
|
-
import "core-js/modules/es.array.reduce.js";
|
2
|
-
|
3
|
-
/* eslint-disable no-underscore-dangle */
|
4
|
-
|
5
|
-
/* global window */
|
6
|
-
export const setJSONDoc = jsondoc => {
|
7
|
-
window.__EMBER_GENERATED_DOC_JSON__ = jsondoc;
|
8
|
-
};
|
9
|
-
export const getJSONDoc = () => {
|
10
|
-
return window.__EMBER_GENERATED_DOC_JSON__;
|
11
|
-
};
|
12
|
-
export const extractArgTypes = componentName => {
|
13
|
-
const json = getJSONDoc();
|
14
|
-
|
15
|
-
if (!(json && json.included)) {
|
16
|
-
return null;
|
17
|
-
}
|
18
|
-
|
19
|
-
const componentDoc = json.included.find(doc => doc.attributes.name === componentName);
|
20
|
-
|
21
|
-
if (!componentDoc) {
|
22
|
-
return null;
|
23
|
-
}
|
24
|
-
|
25
|
-
return componentDoc.attributes.arguments.reduce((acc, prop) => {
|
26
|
-
acc[prop.name] = {
|
27
|
-
name: prop.name,
|
28
|
-
defaultValue: prop.defaultValue,
|
29
|
-
description: prop.description,
|
30
|
-
table: {
|
31
|
-
defaultValue: {
|
32
|
-
summary: prop.defaultValue
|
33
|
-
},
|
34
|
-
type: {
|
35
|
-
summary: prop.type,
|
36
|
-
required: prop.tags.length ? prop.tags.some(tag => tag.name === 'required') : false
|
37
|
-
}
|
38
|
-
}
|
39
|
-
};
|
40
|
-
return acc;
|
41
|
-
}, {});
|
42
|
-
};
|
43
|
-
export const extractComponentDescription = componentName => {
|
44
|
-
const json = getJSONDoc();
|
45
|
-
|
46
|
-
if (!(json && json.included)) {
|
47
|
-
return null;
|
48
|
-
}
|
49
|
-
|
50
|
-
const componentDoc = json.included.find(doc => doc.attributes.name === componentName);
|
51
|
-
|
52
|
-
if (!componentDoc) {
|
53
|
-
return null;
|
54
|
-
}
|
55
|
-
|
56
|
-
return componentDoc.attributes.description;
|
57
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export { setJSONDoc } from './jsondoc';
|
@@ -1,57 +0,0 @@
|
|
1
|
-
import "core-js/modules/es.array.reduce.js";
|
2
|
-
|
3
|
-
/* eslint-disable no-underscore-dangle */
|
4
|
-
|
5
|
-
/* global window */
|
6
|
-
export const setJSONDoc = jsondoc => {
|
7
|
-
window.__EMBER_GENERATED_DOC_JSON__ = jsondoc;
|
8
|
-
};
|
9
|
-
export const getJSONDoc = () => {
|
10
|
-
return window.__EMBER_GENERATED_DOC_JSON__;
|
11
|
-
};
|
12
|
-
export const extractArgTypes = componentName => {
|
13
|
-
const json = getJSONDoc();
|
14
|
-
|
15
|
-
if (!(json && json.included)) {
|
16
|
-
return null;
|
17
|
-
}
|
18
|
-
|
19
|
-
const componentDoc = json.included.find(doc => doc.attributes.name === componentName);
|
20
|
-
|
21
|
-
if (!componentDoc) {
|
22
|
-
return null;
|
23
|
-
}
|
24
|
-
|
25
|
-
return componentDoc.attributes.arguments.reduce((acc, prop) => {
|
26
|
-
acc[prop.name] = {
|
27
|
-
name: prop.name,
|
28
|
-
defaultValue: prop.defaultValue,
|
29
|
-
description: prop.description,
|
30
|
-
table: {
|
31
|
-
defaultValue: {
|
32
|
-
summary: prop.defaultValue
|
33
|
-
},
|
34
|
-
type: {
|
35
|
-
summary: prop.type,
|
36
|
-
required: prop.tags.length ? prop.tags.some(tag => tag.name === 'required') : false
|
37
|
-
}
|
38
|
-
}
|
39
|
-
};
|
40
|
-
return acc;
|
41
|
-
}, {});
|
42
|
-
};
|
43
|
-
export const extractComponentDescription = componentName => {
|
44
|
-
const json = getJSONDoc();
|
45
|
-
|
46
|
-
if (!(json && json.included)) {
|
47
|
-
return null;
|
48
|
-
}
|
49
|
-
|
50
|
-
const componentDoc = json.included.find(doc => doc.attributes.name === componentName);
|
51
|
-
|
52
|
-
if (!componentDoc) {
|
53
|
-
return null;
|
54
|
-
}
|
55
|
-
|
56
|
-
return componentDoc.attributes.description;
|
57
|
-
};
|