@storybook/ember 7.0.0-alpha.3 → 7.0.0-alpha.30

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/README.md CHANGED
@@ -12,7 +12,7 @@ So you can develop UI components in isolation without worrying about app specifi
12
12
 
13
13
  ```sh
14
14
  cd my-ember-app
15
- npx sb init
15
+ npx storybook init
16
16
  ```
17
17
 
18
18
  For more information visit: [storybook.js.org](https://storybook.js.org)
@@ -31,14 +31,14 @@ exports.clearDecorators = clearDecorators;
31
31
  exports.addParameters = addParameters;
32
32
  exports.addDecorator = addDecorator;
33
33
  exports.setAddon = setAddon;
34
- const framework = 'ember';
34
+ const FRAMEWORK = 'ember';
35
35
 
36
36
  const storiesOf = (kind, m) => clientApi.storiesOf(kind, m).addParameters({
37
- framework
37
+ framework: FRAMEWORK
38
38
  });
39
39
 
40
40
  exports.storiesOf = storiesOf;
41
41
 
42
- const configure = (loadable, m) => coreConfigure(framework, loadable, m);
42
+ const configure = (loadable, m) => coreConfigure(FRAMEWORK, loadable, m);
43
43
 
44
44
  exports.configure = configure;
@@ -7,15 +7,18 @@ exports.renderToDOM = renderToDOM;
7
7
 
8
8
  var _global = _interopRequireDefault(require("global"));
9
9
 
10
- var _tsDedent = _interopRequireDefault(require("ts-dedent"));
10
+ var _tsDedent = require("ts-dedent");
11
+
12
+ var _component = _interopRequireDefault(require("@ember/component"));
11
13
 
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
16
+ // @ts-ignore
14
17
  const {
15
18
  window: globalWindow,
16
19
  document
17
20
  } = _global.default;
18
- const rootEl = document.getElementById('root');
21
+ const rootEl = document.getElementById('storybook-root');
19
22
 
20
23
  const config = globalWindow.require(`${globalWindow.STORYBOOK_NAME}/config/environment`);
21
24
 
@@ -45,7 +48,7 @@ function render(options, el) {
45
48
  const appInstancePrivate = app.buildInstance();
46
49
  return appInstancePrivate.boot().then(() => appInstancePrivate);
47
50
  }).then(instance => {
48
- instance.register('component:story-mode', Ember.Component.extend(Object.assign({
51
+ instance.register('component:story-mode', _component.default.extend(Object.assign({
49
52
  layout: template || options
50
53
  }, context)));
51
54
  const component = instance.lookup('component:story-mode');
@@ -75,7 +78,7 @@ function renderToDOM({
75
78
  if (!element) {
76
79
  showError({
77
80
  title: `Expecting a Ember element from the story: "${name}" of "${kind}".`,
78
- description: (0, _tsDedent.default)`
81
+ description: (0, _tsDedent.dedent)`
79
82
  Did you forget to return the Ember element from the story?
80
83
  Use "() => hbs('{{component}}')" or "() => { return {
81
84
  template: hbs\`{{component}}\`
@@ -4,12 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.core = exports.addons = void 0;
7
+
8
+ var _path = _interopRequireDefault(require("path"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
7
12
  const addons = [require.resolve('./server/framework-preset-babel-ember'), require.resolve('./server/framework-preset-ember-docs')];
8
13
  exports.addons = addons;
9
14
 
10
- const core = async config => {
15
+ const core = async (config, options) => {
16
+ const framework = await options.presets.apply('framework');
11
17
  return Object.assign({}, config, {
12
- builder: require.resolve('@storybook/builder-webpack5')
18
+ builder: {
19
+ name: _path.default.dirname(require.resolve(_path.default.join('@storybook/builder-webpack5', 'package.json'))),
20
+ options: typeof framework === 'string' ? {} : framework.options.builder || {}
21
+ }
13
22
  });
14
23
  };
15
24
 
@@ -34,9 +34,12 @@ function babel(config, options) {
34
34
  if (options && options.presetsList) {
35
35
  options.presetsList.forEach(function (e, index) {
36
36
  if (e.preset && e.preset.emberOptions) {
37
- emberOptions = e.preset.emberOptions; // eslint-disable-next-line no-param-reassign
37
+ emberOptions = e.preset.emberOptions;
38
38
 
39
- delete options.presetsList[index].preset.emberOptions;
39
+ if (options.presetsList) {
40
+ // eslint-disable-next-line no-param-reassign
41
+ delete options.presetsList[index].preset.emberOptions;
42
+ }
40
43
  }
41
44
  });
42
45
  }
@@ -51,7 +54,7 @@ function babel(config, options) {
51
54
  }
52
55
  }], [require.resolve('babel-plugin-ember-modules-api-polyfill')]];
53
56
  return _objectSpread(_objectSpread({}, config), {}, {
54
- plugins: [].concat(babelConfigPlugins, extraPlugins)
57
+ plugins: [...babelConfigPlugins, ...extraPlugins]
55
58
  });
56
59
  }
57
60
 
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -14,9 +14,9 @@ export const {
14
14
  getStorybook,
15
15
  raw
16
16
  } = clientApi;
17
- const framework = 'ember';
17
+ const FRAMEWORK = 'ember';
18
18
  export const storiesOf = (kind, m) => clientApi.storiesOf(kind, m).addParameters({
19
- framework
19
+ framework: FRAMEWORK
20
20
  });
21
- export const configure = (loadable, m) => coreConfigure(framework, loadable, m);
21
+ export const configure = (loadable, m) => coreConfigure(FRAMEWORK, loadable, m);
22
22
  export { forceReRender };
@@ -1,10 +1,13 @@
1
1
  import global from 'global';
2
- import dedent from 'ts-dedent';
2
+ import { dedent } from 'ts-dedent';
3
+ // @ts-ignore
4
+ import Component from '@ember/component'; // eslint-disable-line import/no-unresolved
5
+
3
6
  const {
4
7
  window: globalWindow,
5
8
  document
6
9
  } = global;
7
- const rootEl = document.getElementById('root');
10
+ const rootEl = document.getElementById('storybook-root');
8
11
 
9
12
  const config = globalWindow.require(`${globalWindow.STORYBOOK_NAME}/config/environment`);
10
13
 
@@ -34,7 +37,7 @@ function render(options, el) {
34
37
  const appInstancePrivate = app.buildInstance();
35
38
  return appInstancePrivate.boot().then(() => appInstancePrivate);
36
39
  }).then(instance => {
37
- instance.register('component:story-mode', Ember.Component.extend(Object.assign({
40
+ instance.register('component:story-mode', Component.extend(Object.assign({
38
41
  layout: template || options
39
42
  }, context)));
40
43
  const component = instance.lookup('component:story-mode');
@@ -1,6 +1,11 @@
1
+ import path from 'path';
1
2
  export const addons = [require.resolve('./server/framework-preset-babel-ember'), require.resolve('./server/framework-preset-ember-docs')];
2
- export const core = async config => {
3
+ export const core = async (config, options) => {
4
+ const framework = await options.presets.apply('framework');
3
5
  return Object.assign({}, config, {
4
- builder: require.resolve('@storybook/builder-webpack5')
6
+ builder: {
7
+ name: path.dirname(require.resolve(path.join('@storybook/builder-webpack5', 'package.json'))),
8
+ options: typeof framework === 'string' ? {} : framework.options.builder || {}
9
+ }
5
10
  });
6
11
  };
@@ -24,9 +24,12 @@ export function babel(config, options) {
24
24
  if (options && options.presetsList) {
25
25
  options.presetsList.forEach(function (e, index) {
26
26
  if (e.preset && e.preset.emberOptions) {
27
- emberOptions = e.preset.emberOptions; // eslint-disable-next-line no-param-reassign
27
+ emberOptions = e.preset.emberOptions;
28
28
 
29
- delete options.presetsList[index].preset.emberOptions;
29
+ if (options.presetsList) {
30
+ // eslint-disable-next-line no-param-reassign
31
+ delete options.presetsList[index].preset.emberOptions;
32
+ }
30
33
  }
31
34
  });
32
35
  }
@@ -41,7 +44,7 @@ export function babel(config, options) {
41
44
  }
42
45
  }], [require.resolve('babel-plugin-ember-modules-api-polyfill')]];
43
46
  return _objectSpread(_objectSpread({}, config), {}, {
44
- plugins: [].concat(babelConfigPlugins, extraPlugins)
47
+ plugins: [...babelConfigPlugins, ...extraPlugins]
45
48
  });
46
49
  }
47
50
  export var previewAnnotations = function (entry = []) {
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
1
  export { renderToDOM } from './render';
2
2
  export declare const parameters: {
3
- framework: string;
3
+ framework: "ember";
4
4
  };
@@ -1,8 +1,8 @@
1
1
  import './globals';
2
2
  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
- globals?: import("@storybook/csf").Globals;
5
- globalTypes?: import("@storybook/csf").GlobalTypes;
4
+ globals?: import("@storybook/csf").Globals | undefined;
5
+ globalTypes?: import("@storybook/csf").GlobalTypes | undefined;
6
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
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;
@@ -1,3 +1,3 @@
1
- import { RenderContext } from '@storybook/store';
1
+ import type { RenderContext } from '@storybook/store';
2
2
  import { EmberFramework } from './types';
3
- export declare function renderToDOM({ storyFn, kind, name, showMain, showError }: RenderContext<EmberFramework>, domElement: HTMLElement): void;
3
+ export declare function renderToDOM({ storyFn, kind, name, showMain, showError }: RenderContext<EmberFramework>, domElement: Element): void;
@@ -1,11 +1,4 @@
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
- }>;
1
+ import type { PresetProperty } from '@storybook/core-common';
2
+ import type { StorybookConfig } from './types';
3
+ export declare const addons: PresetProperty<'addons', StorybookConfig>;
4
+ export declare const core: PresetProperty<'core', StorybookConfig>;
@@ -0,0 +1,25 @@
1
+ import type { StorybookConfig as StorybookConfigBase, TypescriptOptions as TypescriptOptionsReact } from '@storybook/core-webpack';
2
+ import type { StorybookConfigWebpack, BuilderOptions, TypescriptOptions as TypescriptOptionsBuilder } from '@storybook/builder-webpack5';
3
+ declare type FrameworkName = '@storybook/ember-webpack5';
4
+ declare type BuilderName = '@storybook/builder-webpack5';
5
+ export declare type FrameworkOptions = {
6
+ builder?: BuilderOptions;
7
+ };
8
+ declare type StorybookConfigFramework = {
9
+ framework: FrameworkName | {
10
+ name: FrameworkName;
11
+ options: FrameworkOptions;
12
+ };
13
+ core?: StorybookConfigBase['core'] & {
14
+ builder?: BuilderName | {
15
+ name: BuilderName;
16
+ options: BuilderOptions;
17
+ };
18
+ };
19
+ typescript?: Partial<TypescriptOptionsBuilder & TypescriptOptionsReact> & StorybookConfigBase['typescript'];
20
+ };
21
+ /**
22
+ * The interface for Storybook configuration in `main.ts` files.
23
+ */
24
+ export declare type StorybookConfig = Omit<StorybookConfigBase, keyof StorybookConfigWebpack | keyof StorybookConfigFramework> & StorybookConfigWebpack & StorybookConfigFramework;
25
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/ember",
3
- "version": "7.0.0-alpha.3",
3
+ "version": "7.0.0-alpha.30",
4
4
  "description": "Storybook for Ember: Develop Ember Component in isolation with Hot Reloading.",
5
5
  "homepage": "https://github.com/storybookjs/storybook/tree/main/frameworks/ember",
6
6
  "bugs": {
@@ -26,28 +26,30 @@
26
26
  "*.d.ts"
27
27
  ],
28
28
  "scripts": {
29
- "prepare": "node ../../scripts/prepare.js"
29
+ "check": "tsc --noEmit",
30
+ "prepare": "node ../../../scripts/prepare.js"
30
31
  },
31
32
  "dependencies": {
32
- "@storybook/builder-webpack5": "7.0.0-alpha.3",
33
- "@storybook/core-client": "7.0.0-alpha.3",
34
- "@storybook/core-common": "7.0.0-alpha.3",
35
- "@storybook/core-server": "7.0.0-alpha.3",
36
- "@storybook/docs-tools": "7.0.0-alpha.3",
37
- "@storybook/store": "7.0.0-alpha.3",
38
- "core-js": "^3.8.2",
33
+ "@storybook/builder-webpack5": "7.0.0-alpha.30",
34
+ "@storybook/core-client": "7.0.0-alpha.30",
35
+ "@storybook/core-common": "7.0.0-alpha.30",
36
+ "@storybook/docs-tools": "7.0.0-alpha.30",
37
+ "@storybook/store": "7.0.0-alpha.30",
39
38
  "global": "^4.4.0",
40
39
  "react": "16.14.0",
41
40
  "react-dom": "16.14.0",
42
41
  "read-pkg-up": "^7.0.1",
43
- "regenerator-runtime": "^0.13.7",
44
42
  "ts-dedent": "^2.0.0"
45
43
  },
44
+ "devDependencies": {
45
+ "typescript": "~4.6.3"
46
+ },
46
47
  "peerDependencies": {
47
48
  "@babel/core": "*",
49
+ "@types/ember__component": "4.0.8",
48
50
  "babel-plugin-ember-modules-api-polyfill": "^2.12.0",
49
51
  "babel-plugin-htmlbars-inline-precompile": "2 || 3",
50
- "ember-source": "^3.16.0"
52
+ "ember-source": "~3.28.1"
51
53
  },
52
54
  "engines": {
53
55
  "node": ">=10.13.0"
@@ -55,5 +57,5 @@
55
57
  "publishConfig": {
56
58
  "access": "public"
57
59
  },
58
- "gitHead": "629b056190993bcee6445471b8cb27208eb401a9"
60
+ "gitHead": "aabf7b595cb13d8a86dca27ad3d6039205bd55d6"
59
61
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Kadira Inc. <hello@kadira.io>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
package/standalone.js DELETED
@@ -1,7 +0,0 @@
1
- const build = require('@storybook/core-server/standalone');
2
-
3
- async function buildStandalone(options) {
4
- return build(options);
5
- }
6
-
7
- module.exports = buildStandalone;