@storybook/react 6.5.7 → 7.0.0-alpha.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/README.md +1 -47
- package/dist/cjs/config.js +51 -0
- package/dist/cjs/{client/docs → docs}/config.js +0 -0
- package/dist/cjs/{client/docs → docs}/extractArgTypes.js +0 -0
- package/dist/cjs/{client/docs → docs}/extractProps.js +0 -0
- package/dist/cjs/{client/docs → docs}/jsxDecorator.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/captions.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/componentTypes.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/createDefaultValue.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/createFromRawDefaultProp.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/generateArray.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/generateObject.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/index.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/defaultValues/prettyIdentifier.js +8 -8
- package/dist/cjs/{client/docs → docs}/lib/generateCode.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/index.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/inspection/acornParser.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/inspection/index.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/inspection/inspectValue.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/inspection/types.js +0 -0
- package/dist/cjs/{client/docs → docs}/lib/isHtmlTag.js +0 -0
- package/dist/cjs/{client/docs → docs}/propTypes/createType.js +0 -0
- package/dist/cjs/{client/docs → docs}/propTypes/generateFuncSignature.js +0 -0
- package/dist/cjs/{client/docs → docs}/propTypes/handleProp.js +0 -0
- package/dist/cjs/{client/docs → docs}/propTypes/rawDefaultPropResolvers.js +0 -0
- package/dist/cjs/{client/docs → docs}/propTypes/sortProps.js +0 -0
- package/dist/cjs/{client/docs → docs}/react-argtypes.stories.js +0 -0
- package/dist/cjs/{client/docs → docs}/typeScript/handleProp.js +0 -0
- package/dist/cjs/{client/index.js → index.js} +4 -3
- package/dist/cjs/{client/preview → preview}/config.js +1 -7
- package/dist/cjs/{client/preview → preview}/globals.js +0 -0
- package/dist/cjs/{client/preview → preview}/index.js +2 -2
- package/dist/cjs/preview/render.js +310 -0
- package/dist/cjs/{client/preview → preview}/types-6-0.js +0 -0
- package/dist/cjs/{client/preview → preview}/types-6-3.js +0 -0
- package/dist/cjs/{client/preview → preview}/types-7-0.js +0 -0
- package/dist/cjs/{client/preview → preview}/types.js +0 -0
- package/dist/cjs/{client/testing → testing}/index.js +0 -0
- package/dist/esm/config.js +6 -0
- package/dist/{modern/client → esm}/docs/config.js +0 -0
- package/dist/{modern/client → esm}/docs/extractArgTypes.js +0 -1
- package/dist/{modern/client → esm}/docs/extractProps.js +0 -0
- package/dist/{modern/client → esm}/docs/jsxDecorator.js +11 -18
- package/dist/{modern/client → esm}/docs/lib/captions.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/componentTypes.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/createDefaultValue.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/createFromRawDefaultProp.js +1 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/generateArray.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/generateObject.js +0 -0
- package/dist/esm/{client/docs → docs}/lib/defaultValues/index.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/defaultValues/prettyIdentifier.js +6 -6
- package/dist/{modern/client → esm}/docs/lib/generateCode.js +0 -0
- package/dist/esm/{client/docs → docs}/lib/index.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/inspection/acornParser.js +0 -0
- package/dist/esm/{client/docs → docs}/lib/inspection/index.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/inspection/inspectValue.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/inspection/types.js +0 -0
- package/dist/{modern/client → esm}/docs/lib/isHtmlTag.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/createType.js +0 -1
- package/dist/{modern/client → esm}/docs/propTypes/generateFuncSignature.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/handleProp.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/rawDefaultPropResolvers.js +0 -0
- package/dist/{modern/client → esm}/docs/propTypes/sortProps.js +0 -0
- package/dist/{modern/client → esm}/docs/react-argtypes.stories.js +0 -0
- package/dist/{modern/client → esm}/docs/typeScript/handleProp.js +0 -0
- package/dist/{modern/client → esm}/index.js +2 -4
- package/dist/esm/preview/config.js +1 -0
- package/dist/{modern/client → esm}/preview/globals.js +0 -0
- package/dist/{modern/client → esm}/preview/index.js +1 -1
- package/dist/{modern/client → esm}/preview/render.js +2 -2
- package/dist/esm/{client/preview → preview}/types-6-0.js +0 -0
- package/dist/esm/{client/preview → preview}/types-6-3.js +0 -0
- package/dist/esm/{client/preview → preview}/types-7-0.js +0 -0
- package/dist/esm/{client/preview → preview}/types.js +0 -0
- package/dist/{modern/client → esm}/testing/index.js +0 -0
- package/dist/types/config.d.ts +11 -0
- package/dist/{ts3.9/client → types}/docs/config.d.ts +1 -1
- package/dist/{ts3.9/client → types}/docs/extractArgTypes.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/extractProps.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/jsxDecorator.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/captions.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/componentTypes.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/createDefaultValue.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/createFromRawDefaultProp.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/generateArray.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/generateObject.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/defaultValues/prettyIdentifier.d.ts +1 -1
- package/dist/{ts3.9/client → types}/docs/lib/generateCode.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/acornParser.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/inspectValue.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/inspection/types.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/lib/isHtmlTag.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/createType.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/generateFuncSignature.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/handleProp.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/rawDefaultPropResolvers.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/propTypes/sortProps.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/react-argtypes.stories.d.ts +0 -0
- package/dist/{ts3.9/client → types}/docs/typeScript/handleProp.d.ts +0 -0
- package/dist/{ts3.9/client → types}/index.d.ts +0 -0
- package/dist/types/preview/config.d.ts +1 -0
- package/dist/{ts3.9/client → types}/preview/globals.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/index.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/render.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types-6-0.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types-6-3.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types-7-0.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/types.d.ts +0 -0
- package/dist/{ts3.9/client → types}/testing/index.d.ts +1 -1
- package/package.json +17 -61
- package/preview.js +1 -0
- package/bin/build.js +0 -4
- package/bin/index.js +0 -3
- package/demo.d.ts +0 -32
- package/demo.js +0 -5
- package/dist/cjs/client/preview/render.js +0 -296
- package/dist/cjs/demo/Button.js +0 -37
- package/dist/cjs/demo/Welcome.js +0 -126
- package/dist/cjs/server/build.js +0 -9
- package/dist/cjs/server/cra-config.js +0 -69
- package/dist/cjs/server/framework-preset-cra.js +0 -35
- package/dist/cjs/server/framework-preset-react-docs.js +0 -68
- package/dist/cjs/server/framework-preset-react-dom-hack.js +0 -31
- package/dist/cjs/server/framework-preset-react.js +0 -98
- package/dist/cjs/server/index.js +0 -9
- package/dist/cjs/server/options.js +0 -17
- package/dist/cjs/server/preset.js +0 -16
- package/dist/esm/client/docs/config.js +0 -16
- package/dist/esm/client/docs/extractArgTypes.js +0 -39
- package/dist/esm/client/docs/extractProps.js +0 -54
- package/dist/esm/client/docs/jsxDecorator.js +0 -218
- package/dist/esm/client/docs/lib/captions.js +0 -6
- package/dist/esm/client/docs/lib/componentTypes.js +0 -9
- package/dist/esm/client/docs/lib/defaultValues/createDefaultValue.js +0 -67
- package/dist/esm/client/docs/lib/defaultValues/createFromRawDefaultProp.js +0 -191
- package/dist/esm/client/docs/lib/defaultValues/generateArray.js +0 -19
- package/dist/esm/client/docs/lib/defaultValues/generateObject.js +0 -19
- package/dist/esm/client/docs/lib/defaultValues/prettyIdentifier.js +0 -22
- package/dist/esm/client/docs/lib/generateCode.js +0 -68
- package/dist/esm/client/docs/lib/inspection/acornParser.js +0 -213
- package/dist/esm/client/docs/lib/inspection/inspectValue.js +0 -16
- package/dist/esm/client/docs/lib/inspection/types.js +0 -12
- package/dist/esm/client/docs/lib/isHtmlTag.js +0 -6
- package/dist/esm/client/docs/propTypes/createType.js +0 -449
- package/dist/esm/client/docs/propTypes/generateFuncSignature.js +0 -62
- package/dist/esm/client/docs/propTypes/handleProp.js +0 -39
- package/dist/esm/client/docs/propTypes/rawDefaultPropResolvers.js +0 -32
- package/dist/esm/client/docs/propTypes/sortProps.js +0 -24
- package/dist/esm/client/docs/react-argtypes.stories.js +0 -97
- package/dist/esm/client/docs/typeScript/handleProp.js +0 -27
- package/dist/esm/client/index.js +0 -7
- package/dist/esm/client/preview/config.js +0 -4
- package/dist/esm/client/preview/globals.js +0 -6
- package/dist/esm/client/preview/index.js +0 -29
- package/dist/esm/client/preview/render.js +0 -255
- package/dist/esm/client/testing/index.js +0 -96
- package/dist/esm/demo/Button.js +0 -26
- package/dist/esm/demo/Welcome.js +0 -114
- package/dist/esm/server/build.js +0 -3
- package/dist/esm/server/cra-config.js +0 -49
- package/dist/esm/server/framework-preset-cra.js +0 -25
- package/dist/esm/server/framework-preset-react-docs.js +0 -49
- package/dist/esm/server/framework-preset-react-dom-hack.js +0 -21
- package/dist/esm/server/framework-preset-react.js +0 -78
- package/dist/esm/server/index.js +0 -3
- package/dist/esm/server/options.js +0 -8
- package/dist/esm/server/preset.js +0 -5
- package/dist/modern/client/docs/lib/defaultValues/index.js +0 -2
- package/dist/modern/client/docs/lib/index.js +0 -4
- package/dist/modern/client/docs/lib/inspection/index.js +0 -2
- package/dist/modern/client/preview/config.js +0 -4
- package/dist/modern/client/preview/types-6-0.js +0 -1
- package/dist/modern/client/preview/types-6-3.js +0 -10
- package/dist/modern/client/preview/types-7-0.js +0 -1
- package/dist/modern/client/preview/types.js +0 -1
- package/dist/modern/demo/Button.js +0 -25
- package/dist/modern/demo/Welcome.js +0 -108
- package/dist/modern/server/build.js +0 -3
- package/dist/modern/server/cra-config.js +0 -49
- package/dist/modern/server/framework-preset-cra.js +0 -25
- package/dist/modern/server/framework-preset-react-docs.js +0 -49
- package/dist/modern/server/framework-preset-react-dom-hack.js +0 -21
- package/dist/modern/server/framework-preset-react.js +0 -78
- package/dist/modern/server/index.js +0 -3
- package/dist/modern/server/options.js +0 -8
- package/dist/modern/server/preset.js +0 -5
- package/dist/ts3.4/client/docs/config.d.ts +0 -13
- package/dist/ts3.4/client/docs/extractArgTypes.d.ts +0 -2
- package/dist/ts3.4/client/docs/extractProps.d.ts +0 -5
- package/dist/ts3.4/client/docs/jsxDecorator.d.ts +0 -23
- package/dist/ts3.4/client/docs/lib/captions.d.ts +0 -6
- package/dist/ts3.4/client/docs/lib/componentTypes.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/defaultValues/createDefaultValue.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/defaultValues/createFromRawDefaultProp.d.ts +0 -11
- package/dist/ts3.4/client/docs/lib/defaultValues/generateArray.d.ts +0 -3
- package/dist/ts3.4/client/docs/lib/defaultValues/generateObject.d.ts +0 -3
- package/dist/ts3.4/client/docs/lib/defaultValues/index.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/defaultValues/prettyIdentifier.d.ts +0 -4
- package/dist/ts3.4/client/docs/lib/generateCode.d.ts +0 -3
- package/dist/ts3.4/client/docs/lib/index.d.ts +0 -4
- package/dist/ts3.4/client/docs/lib/inspection/acornParser.d.ts +0 -7
- package/dist/ts3.4/client/docs/lib/inspection/index.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/inspection/inspectValue.d.ts +0 -2
- package/dist/ts3.4/client/docs/lib/inspection/types.d.ts +0 -50
- package/dist/ts3.4/client/docs/lib/isHtmlTag.d.ts +0 -1
- package/dist/ts3.4/client/docs/propTypes/createType.d.ts +0 -2
- package/dist/ts3.4/client/docs/propTypes/generateFuncSignature.d.ts +0 -4
- package/dist/ts3.4/client/docs/propTypes/handleProp.d.ts +0 -5
- package/dist/ts3.4/client/docs/propTypes/rawDefaultPropResolvers.d.ts +0 -1
- package/dist/ts3.4/client/docs/propTypes/sortProps.d.ts +0 -4
- package/dist/ts3.4/client/docs/react-argtypes.stories.d.ts +0 -1
- package/dist/ts3.4/client/docs/typeScript/handleProp.d.ts +0 -3
- package/dist/ts3.4/client/index.d.ts +0 -4
- package/dist/ts3.4/client/preview/config.d.ts +0 -4
- package/dist/ts3.4/client/preview/globals.d.ts +0 -1
- package/dist/ts3.4/client/preview/index.d.ts +0 -25
- package/dist/ts3.4/client/preview/render.d.ts +0 -5
- package/dist/ts3.4/client/preview/types-6-0.d.ts +0 -35
- package/dist/ts3.4/client/preview/types-6-3.d.ts +0 -40
- package/dist/ts3.4/client/preview/types-7-0.d.ts +0 -21
- package/dist/ts3.4/client/preview/types.d.ts +0 -16
- package/dist/ts3.4/client/testing/index.d.ts +0 -84
- package/dist/ts3.4/demo/Button.d.ts +0 -4
- package/dist/ts3.4/demo/Welcome.d.ts +0 -6
- package/dist/ts3.4/server/build.d.ts +0 -1
- package/dist/ts3.4/server/cra-config.d.ts +0 -4
- package/dist/ts3.4/server/framework-preset-cra.d.ts +0 -3
- package/dist/ts3.4/server/framework-preset-react-docs.d.ts +0 -6
- package/dist/ts3.4/server/framework-preset-react-dom-hack.d.ts +0 -32
- package/dist/ts3.4/server/framework-preset-react.d.ts +0 -6
- package/dist/ts3.4/server/index.d.ts +0 -1
- package/dist/ts3.4/server/options.d.ts +0 -3
- package/dist/ts3.4/server/preset.d.ts +0 -3
- package/dist/ts3.9/client/preview/config.d.ts +0 -4
- package/dist/ts3.9/demo/Button.d.ts +0 -4
- package/dist/ts3.9/demo/Welcome.d.ts +0 -6
- package/dist/ts3.9/server/build.d.ts +0 -1
- package/dist/ts3.9/server/cra-config.d.ts +0 -4
- package/dist/ts3.9/server/framework-preset-cra.d.ts +0 -3
- package/dist/ts3.9/server/framework-preset-react-docs.d.ts +0 -6
- package/dist/ts3.9/server/framework-preset-react-dom-hack.d.ts +0 -32
- package/dist/ts3.9/server/framework-preset-react.d.ts +0 -6
- package/dist/ts3.9/server/index.d.ts +0 -1
- package/dist/ts3.9/server/options.d.ts +0 -3
- package/dist/ts3.9/server/preset.d.ts +0 -3
- package/preset.js +0 -1
- package/standalone.js +0 -8
- package/types/index.ts +0 -19
- package/types-6-0.d.ts +0 -1
- package/types-7-0.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,47 +1 @@
|
|
|
1
|
-
# Storybook
|
|
2
|
-
|
|
3
|
-
Storybook for React is a UI development environment for your React components.
|
|
4
|
-
With it, you can visualize different states of your UI components and develop them interactively.
|
|
5
|
-
|
|
6
|
-

|
|
7
|
-
|
|
8
|
-
Storybook runs outside of your app.
|
|
9
|
-
So you can develop UI components in isolation without worrying about app specific dependencies and requirements.
|
|
10
|
-
|
|
11
|
-
## Getting Started
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
cd my-react-app
|
|
15
|
-
npx sb init
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
For more information visit: [storybook.js.org](https://storybook.js.org)
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
Storybook also comes with a lot of [addons](https://storybook.js.org/addons) and a great API to customize as you wish.
|
|
23
|
-
You can also build a [static version](https://storybook.js.org/docs/react/sharing/publish-storybook) of your Storybook and deploy it anywhere you want.
|
|
24
|
-
|
|
25
|
-
Here are some featured storybooks that you can reference to see how Storybook works:
|
|
26
|
-
|
|
27
|
-
- [Demo of Storybook Design System](https://storybook.js.org/design-system) - [source](https://github.com/storybookjs/design-system)
|
|
28
|
-
|
|
29
|
-
## Create React App
|
|
30
|
-
|
|
31
|
-
Support for [Create React App](https://create-react-app.dev/) is handled by [`@storybook/preset-create-react-app`](https://github.com/storybookjs/presets/tree/master/packages/preset-create-react-app).
|
|
32
|
-
|
|
33
|
-
This preset enables support for all Create React App features, including Sass/SCSS and TypeScript.
|
|
34
|
-
|
|
35
|
-
If you're working on an app that was initialized manually (i.e., without the use of Create React App), ensure that your app has [react-dom](https://www.npmjs.com/package/react-dom) included as a dependency. Failing to do so can lead to unforeseen issues with Storybook and your project.
|
|
36
|
-
|
|
37
|
-
## Typescript
|
|
38
|
-
|
|
39
|
-
`@storybook/react` is now exporting its own types to use with Typescript.
|
|
40
|
-
You don't need to have `@types/storybook__react` installed anymore if it was your case.
|
|
41
|
-
But you probably also need to use types from `@types/node @types/react`.
|
|
42
|
-
|
|
43
|
-
## Docs
|
|
44
|
-
|
|
45
|
-
- [Basics](https://storybook.js.org/docs/react/get-started/introduction)
|
|
46
|
-
- [Configurations](https://storybook.js.org/docs/react/configure/overview)
|
|
47
|
-
- [Addons](https://storybook.js.org/docs/react/configure/storybook-addons)
|
|
1
|
+
# Storybook React renderer
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.to-string.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.object.keys.js");
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
var _exportNames = {
|
|
13
|
+
parameters: true,
|
|
14
|
+
decorators: true,
|
|
15
|
+
argTypesEnhancers: true
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "argTypesEnhancers", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function get() {
|
|
20
|
+
return _config.argTypesEnhancers;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "decorators", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function get() {
|
|
26
|
+
return _config.decorators;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
exports.parameters = void 0;
|
|
30
|
+
|
|
31
|
+
require("core-js/modules/es.object.assign.js");
|
|
32
|
+
|
|
33
|
+
var _config = require("./docs/config");
|
|
34
|
+
|
|
35
|
+
var _config2 = require("./preview/config");
|
|
36
|
+
|
|
37
|
+
Object.keys(_config2).forEach(function (key) {
|
|
38
|
+
if (key === "default" || key === "__esModule") return;
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
40
|
+
if (key in exports && exports[key] === _config2[key]) return;
|
|
41
|
+
Object.defineProperty(exports, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function get() {
|
|
44
|
+
return _config2[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var parameters = Object.assign({
|
|
49
|
+
framework: 'react'
|
|
50
|
+
}, _config.parameters);
|
|
51
|
+
exports.parameters = parameters;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -9,6 +9,14 @@ exports.getPrettyIdentifier = getPrettyIdentifier;
|
|
|
9
9
|
|
|
10
10
|
var _inspection = require("../inspection");
|
|
11
11
|
|
|
12
|
+
function getPrettyFuncIdentifier(identifier, hasArguments) {
|
|
13
|
+
return hasArguments ? "".concat(identifier, "( ... )") : "".concat(identifier, "()");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getPrettyElementIdentifier(identifier) {
|
|
17
|
+
return "<".concat(identifier, " />");
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
function getPrettyIdentifier(inferredType) {
|
|
13
21
|
var type = inferredType.type,
|
|
14
22
|
identifier = inferredType.identifier;
|
|
@@ -23,12 +31,4 @@ function getPrettyIdentifier(inferredType) {
|
|
|
23
31
|
default:
|
|
24
32
|
return identifier;
|
|
25
33
|
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function getPrettyFuncIdentifier(identifier, hasArguments) {
|
|
29
|
-
return hasArguments ? "".concat(identifier, "( ... )") : "".concat(identifier, "()");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function getPrettyElementIdentifier(identifier) {
|
|
33
|
-
return "<".concat(identifier, " />");
|
|
34
34
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -98,6 +98,7 @@ Object.keys(_types).forEach(function (key) {
|
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
var _module, _module$hot;
|
|
102
|
+
|
|
103
|
+
// optimization: stop HMR propagation in webpack
|
|
104
|
+
(_module = module) === null || _module === void 0 ? void 0 : (_module$hot = _module.hot) === null || _module$hot === void 0 ? void 0 : _module$hot.decline();
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.parameters = void 0;
|
|
7
6
|
Object.defineProperty(exports, "render", {
|
|
8
7
|
enumerable: true,
|
|
9
8
|
get: function get() {
|
|
@@ -17,9 +16,4 @@ Object.defineProperty(exports, "renderToDOM", {
|
|
|
17
16
|
}
|
|
18
17
|
});
|
|
19
18
|
|
|
20
|
-
var _render = require("./render");
|
|
21
|
-
|
|
22
|
-
var parameters = {
|
|
23
|
-
framework: 'react'
|
|
24
|
-
};
|
|
25
|
-
exports.parameters = parameters;
|
|
19
|
+
var _render = require("./render");
|
|
File without changes
|
|
@@ -7,7 +7,7 @@ exports.storiesOf = exports.setAddon = exports.raw = exports.getStorybook = expo
|
|
|
7
7
|
|
|
8
8
|
require("core-js/modules/es.array.concat.js");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _coreClient = require("@storybook/core-client");
|
|
11
11
|
|
|
12
12
|
require("./globals");
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ var _render = require("./render");
|
|
|
15
15
|
|
|
16
16
|
/* eslint-disable prefer-destructuring */
|
|
17
17
|
var framework = 'react';
|
|
18
|
-
var api = (0,
|
|
18
|
+
var api = (0, _coreClient.start)(_render.renderToDOM, {
|
|
19
19
|
render: _render.render
|
|
20
20
|
});
|
|
21
21
|
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.symbol.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.symbol.description.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.symbol.iterator.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.symbol.async-iterator.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/es.symbol.to-string-tag.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.json.to-string-tag.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.math.to-string-tag.js");
|
|
18
|
+
|
|
19
|
+
require("core-js/modules/es.object.get-prototype-of.js");
|
|
20
|
+
|
|
21
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
22
|
+
|
|
23
|
+
require("core-js/modules/es.function.name.js");
|
|
24
|
+
|
|
25
|
+
require("core-js/modules/es.array.slice.js");
|
|
26
|
+
|
|
27
|
+
require("core-js/modules/es.weak-map.js");
|
|
28
|
+
|
|
29
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
30
|
+
|
|
31
|
+
require("core-js/modules/es.reflect.construct.js");
|
|
32
|
+
|
|
33
|
+
Object.defineProperty(exports, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
});
|
|
36
|
+
exports.render = void 0;
|
|
37
|
+
exports.renderToDOM = renderToDOM;
|
|
38
|
+
|
|
39
|
+
require("core-js/modules/es.array.iterator.js");
|
|
40
|
+
|
|
41
|
+
require("core-js/modules/es.map.js");
|
|
42
|
+
|
|
43
|
+
require("core-js/modules/es.object.to-string.js");
|
|
44
|
+
|
|
45
|
+
require("core-js/modules/es.string.iterator.js");
|
|
46
|
+
|
|
47
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
48
|
+
|
|
49
|
+
require("core-js/modules/es.promise.js");
|
|
50
|
+
|
|
51
|
+
require("core-js/modules/es.string.starts-with.js");
|
|
52
|
+
|
|
53
|
+
require("core-js/modules/es.array.concat.js");
|
|
54
|
+
|
|
55
|
+
var _global = _interopRequireDefault(require("global"));
|
|
56
|
+
|
|
57
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
58
|
+
|
|
59
|
+
var _reactDom = _interopRequireWildcard(require("react-dom"));
|
|
60
|
+
|
|
61
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
62
|
+
|
|
63
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
64
|
+
|
|
65
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
66
|
+
|
|
67
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
68
|
+
|
|
69
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
70
|
+
|
|
71
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
72
|
+
|
|
73
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
74
|
+
|
|
75
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
76
|
+
|
|
77
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
78
|
+
|
|
79
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
80
|
+
|
|
81
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
82
|
+
|
|
83
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
84
|
+
|
|
85
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
86
|
+
|
|
87
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
88
|
+
|
|
89
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
90
|
+
|
|
91
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
92
|
+
|
|
93
|
+
var FRAMEWORK_OPTIONS = _global.default.FRAMEWORK_OPTIONS; // A map of all rendered React 18 nodes
|
|
94
|
+
|
|
95
|
+
var nodes = new Map();
|
|
96
|
+
|
|
97
|
+
var render = function render(args, context) {
|
|
98
|
+
var id = context.id,
|
|
99
|
+
Component = context.component;
|
|
100
|
+
|
|
101
|
+
if (!Component) {
|
|
102
|
+
throw new Error("Unable to render story ".concat(id, " as the component annotation is missing from the default export"));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement(Component, args);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
exports.render = render;
|
|
109
|
+
|
|
110
|
+
var renderElement = /*#__PURE__*/function () {
|
|
111
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(node, el) {
|
|
112
|
+
var root;
|
|
113
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
114
|
+
while (1) {
|
|
115
|
+
switch (_context.prev = _context.next) {
|
|
116
|
+
case 0:
|
|
117
|
+
_context.next = 2;
|
|
118
|
+
return getReactRoot(el);
|
|
119
|
+
|
|
120
|
+
case 2:
|
|
121
|
+
root = _context.sent;
|
|
122
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
123
|
+
if (root) {
|
|
124
|
+
root.render(node);
|
|
125
|
+
setTimeout(function () {
|
|
126
|
+
resolve(null);
|
|
127
|
+
}, 0);
|
|
128
|
+
} else {
|
|
129
|
+
_reactDom.default.render(node, el, function () {
|
|
130
|
+
return resolve(null);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}));
|
|
134
|
+
|
|
135
|
+
case 4:
|
|
136
|
+
case "end":
|
|
137
|
+
return _context.stop();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, _callee);
|
|
141
|
+
}));
|
|
142
|
+
|
|
143
|
+
return function renderElement(_x, _x2) {
|
|
144
|
+
return _ref.apply(this, arguments);
|
|
145
|
+
};
|
|
146
|
+
}();
|
|
147
|
+
|
|
148
|
+
var canUseNewReactRootApi = _reactDom.version && (_reactDom.version.startsWith('18') || _reactDom.version.startsWith('0.0.0'));
|
|
149
|
+
|
|
150
|
+
var shouldUseNewRootApi = (FRAMEWORK_OPTIONS === null || FRAMEWORK_OPTIONS === void 0 ? void 0 : FRAMEWORK_OPTIONS.legacyRootApi) !== true;
|
|
151
|
+
var isUsingNewReactRootApi = shouldUseNewRootApi && canUseNewReactRootApi;
|
|
152
|
+
|
|
153
|
+
var unmountElement = function unmountElement(el) {
|
|
154
|
+
var root = nodes.get(el);
|
|
155
|
+
|
|
156
|
+
if (root && isUsingNewReactRootApi) {
|
|
157
|
+
root.unmount();
|
|
158
|
+
nodes.delete(el);
|
|
159
|
+
} else {
|
|
160
|
+
_reactDom.default.unmountComponentAtNode(el);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
var getReactRoot = /*#__PURE__*/function () {
|
|
165
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(el) {
|
|
166
|
+
var root, reactDomClient;
|
|
167
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
168
|
+
while (1) {
|
|
169
|
+
switch (_context2.prev = _context2.next) {
|
|
170
|
+
case 0:
|
|
171
|
+
if (isUsingNewReactRootApi) {
|
|
172
|
+
_context2.next = 2;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return _context2.abrupt("return", null);
|
|
177
|
+
|
|
178
|
+
case 2:
|
|
179
|
+
root = nodes.get(el);
|
|
180
|
+
|
|
181
|
+
if (root) {
|
|
182
|
+
_context2.next = 9;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
_context2.next = 6;
|
|
187
|
+
return Promise.resolve().then(function () {
|
|
188
|
+
return _interopRequireWildcard(require('react-dom/client'));
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
case 6:
|
|
192
|
+
reactDomClient = _context2.sent.default;
|
|
193
|
+
root = reactDomClient.createRoot(el);
|
|
194
|
+
nodes.set(el, root);
|
|
195
|
+
|
|
196
|
+
case 9:
|
|
197
|
+
return _context2.abrupt("return", root);
|
|
198
|
+
|
|
199
|
+
case 10:
|
|
200
|
+
case "end":
|
|
201
|
+
return _context2.stop();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}, _callee2);
|
|
205
|
+
}));
|
|
206
|
+
|
|
207
|
+
return function getReactRoot(_x3) {
|
|
208
|
+
return _ref2.apply(this, arguments);
|
|
209
|
+
};
|
|
210
|
+
}();
|
|
211
|
+
|
|
212
|
+
var ErrorBoundary = /*#__PURE__*/function (_ReactComponent) {
|
|
213
|
+
_inherits(ErrorBoundary, _ReactComponent);
|
|
214
|
+
|
|
215
|
+
var _super = _createSuper(ErrorBoundary);
|
|
216
|
+
|
|
217
|
+
function ErrorBoundary() {
|
|
218
|
+
var _this;
|
|
219
|
+
|
|
220
|
+
_classCallCheck(this, ErrorBoundary);
|
|
221
|
+
|
|
222
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
223
|
+
args[_key] = arguments[_key];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
227
|
+
_this.state = {
|
|
228
|
+
hasError: false
|
|
229
|
+
};
|
|
230
|
+
return _this;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
_createClass(ErrorBoundary, [{
|
|
234
|
+
key: "componentDidMount",
|
|
235
|
+
value: function componentDidMount() {
|
|
236
|
+
var hasError = this.state.hasError;
|
|
237
|
+
var showMain = this.props.showMain;
|
|
238
|
+
|
|
239
|
+
if (!hasError) {
|
|
240
|
+
showMain();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}, {
|
|
244
|
+
key: "componentDidCatch",
|
|
245
|
+
value: function componentDidCatch(err) {
|
|
246
|
+
var showException = this.props.showException; // message partially duplicates stack, strip it
|
|
247
|
+
|
|
248
|
+
showException(err);
|
|
249
|
+
}
|
|
250
|
+
}, {
|
|
251
|
+
key: "render",
|
|
252
|
+
value: function render() {
|
|
253
|
+
var hasError = this.state.hasError;
|
|
254
|
+
var children = this.props.children;
|
|
255
|
+
return hasError ? null : children;
|
|
256
|
+
}
|
|
257
|
+
}], [{
|
|
258
|
+
key: "getDerivedStateFromError",
|
|
259
|
+
value: function getDerivedStateFromError() {
|
|
260
|
+
return {
|
|
261
|
+
hasError: true
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
}]);
|
|
265
|
+
|
|
266
|
+
return ErrorBoundary;
|
|
267
|
+
}(_react.Component);
|
|
268
|
+
|
|
269
|
+
var Wrapper = FRAMEWORK_OPTIONS !== null && FRAMEWORK_OPTIONS !== void 0 && FRAMEWORK_OPTIONS.strictMode ? _react.StrictMode : _react.Fragment;
|
|
270
|
+
|
|
271
|
+
function renderToDOM(_x4, _x5) {
|
|
272
|
+
return _renderToDOM.apply(this, arguments);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function _renderToDOM() {
|
|
276
|
+
_renderToDOM = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref3, domElement) {
|
|
277
|
+
var storyContext, unboundStoryFn, showMain, showException, forceRemount, Story, content, element;
|
|
278
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
279
|
+
while (1) {
|
|
280
|
+
switch (_context3.prev = _context3.next) {
|
|
281
|
+
case 0:
|
|
282
|
+
storyContext = _ref3.storyContext, unboundStoryFn = _ref3.unboundStoryFn, showMain = _ref3.showMain, showException = _ref3.showException, forceRemount = _ref3.forceRemount;
|
|
283
|
+
Story = unboundStoryFn;
|
|
284
|
+
content = /*#__PURE__*/_react.default.createElement(ErrorBoundary, {
|
|
285
|
+
showMain: showMain,
|
|
286
|
+
showException: showException
|
|
287
|
+
}, /*#__PURE__*/_react.default.createElement(Story, storyContext)); // For React 15, StrictMode & Fragment doesn't exists.
|
|
288
|
+
|
|
289
|
+
element = Wrapper ? /*#__PURE__*/_react.default.createElement(Wrapper, null, content) : content; // In most cases, we need to unmount the existing set of components in the DOM node.
|
|
290
|
+
// Otherwise, React may not recreate instances for every story run.
|
|
291
|
+
// This could leads to issues like below:
|
|
292
|
+
// https://github.com/storybookjs/react-storybook/issues/81
|
|
293
|
+
// (This is not the case when we change args or globals to the story however)
|
|
294
|
+
|
|
295
|
+
if (forceRemount) {
|
|
296
|
+
unmountElement(domElement);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
_context3.next = 7;
|
|
300
|
+
return renderElement(element, domElement);
|
|
301
|
+
|
|
302
|
+
case 7:
|
|
303
|
+
case "end":
|
|
304
|
+
return _context3.stop();
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}, _callee3);
|
|
308
|
+
}));
|
|
309
|
+
return _renderToDOM.apply(this, arguments);
|
|
310
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|