@storybook/vue3 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/README.md +1 -43
- package/dist/cjs/config.js +36 -0
- package/dist/cjs/{client/docs → docs}/config.js +2 -5
- package/dist/cjs/docs/extractArgTypes.js +53 -0
- package/dist/cjs/{client/index.js → index.js} +20 -32
- package/dist/cjs/{client/preview → preview}/config.js +4 -4
- package/dist/cjs/{client/preview → preview}/decorateStory.js +18 -27
- package/dist/cjs/{client/preview → preview}/globals.js +3 -1
- package/dist/cjs/preview/index.js +67 -0
- package/dist/cjs/preview/render.js +84 -0
- package/dist/cjs/{client/preview → preview}/types-6-0.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/esm/config.js +6 -0
- package/dist/{modern/client → esm}/docs/config.js +0 -2
- package/dist/{modern/client → esm}/docs/extractArgTypes.js +0 -0
- package/dist/esm/index.js +4 -0
- package/dist/{modern/client → esm}/preview/config.js +0 -0
- package/dist/{modern/client → esm}/preview/decorateStory.js +0 -1
- package/dist/{modern/client → esm}/preview/globals.js +0 -0
- package/dist/{modern/client → esm}/preview/index.js +3 -4
- package/dist/esm/preview/render.js +66 -0
- package/dist/esm/{client/preview → preview}/types-6-0.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/types/config.d.ts +10 -0
- package/dist/{ts3.9/client → types}/docs/config.d.ts +1 -2
- package/dist/{ts3.9/client → types}/docs/extractArgTypes.d.ts +0 -0
- package/dist/{ts3.9/client → types}/index.d.ts +1 -1
- package/dist/{ts3.9/client → types}/preview/config.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/decorateStory.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/globals.d.ts +0 -0
- package/dist/{ts3.9/client → types}/preview/index.d.ts +3 -4
- package/dist/types/preview/render.d.ts +6 -0
- package/dist/{ts3.9/client → types}/preview/types-6-0.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 +1 -1
- package/package.json +14 -39
- package/preview.js +1 -0
- package/bin/build.js +0 -4
- package/bin/index.js +0 -3
- package/dist/cjs/client/docs/extractArgTypes.js +0 -62
- package/dist/cjs/client/docs/prepareForInline.js +0 -61
- package/dist/cjs/client/preview/index.js +0 -62
- package/dist/cjs/client/preview/render.js +0 -82
- package/dist/cjs/server/build.js +0 -9
- package/dist/cjs/server/framework-preset-vue3-docs.js +0 -50
- package/dist/cjs/server/framework-preset-vue3.js +0 -66
- 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/docs/config.js +0 -12
- package/dist/esm/client/docs/extractArgTypes.js +0 -45
- package/dist/esm/client/docs/prepareForInline.js +0 -22
- package/dist/esm/client/index.js +0 -6
- package/dist/esm/client/preview/config.js +0 -5
- package/dist/esm/client/preview/decorateStory.js +0 -64
- package/dist/esm/client/preview/globals.js +0 -4
- package/dist/esm/client/preview/index.js +0 -38
- package/dist/esm/client/preview/render.js +0 -60
- package/dist/esm/server/build.js +0 -3
- package/dist/esm/server/framework-preset-vue3-docs.js +0 -37
- package/dist/esm/server/framework-preset-vue3.js +0 -52
- 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/prepareForInline.js +0 -22
- package/dist/modern/client/index.js +0 -6
- package/dist/modern/client/preview/render.js +0 -60
- package/dist/modern/client/preview/types-6-0.js +0 -1
- package/dist/modern/client/preview/types-7-0.js +0 -1
- package/dist/modern/client/preview/types.js +0 -1
- package/dist/modern/server/build.js +0 -3
- package/dist/modern/server/framework-preset-vue3-docs.js +0 -37
- package/dist/modern/server/framework-preset-vue3.js +0 -52
- 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/client/docs/config.d.ts +0 -10
- package/dist/ts3.4/client/docs/extractArgTypes.d.ts +0 -2
- package/dist/ts3.4/client/docs/prepareForInline.d.ts +0 -4
- package/dist/ts3.4/client/index.d.ts +0 -2
- package/dist/ts3.4/client/preview/config.d.ts +0 -5
- package/dist/ts3.4/client/preview/decorateStory.d.ts +0 -3
- package/dist/ts3.4/client/preview/globals.d.ts +0 -1
- package/dist/ts3.4/client/preview/index.d.ts +0 -31
- package/dist/ts3.4/client/preview/render.d.ts +0 -7
- package/dist/ts3.4/client/preview/types-6-0.d.ts +0 -35
- package/dist/ts3.4/client/preview/types-7-0.d.ts +0 -9
- package/dist/ts3.4/client/preview/types.d.ts +0 -15
- package/dist/ts3.4/server/build.d.ts +0 -1
- package/dist/ts3.4/server/framework-preset-vue3-docs.d.ts +0 -3
- package/dist/ts3.4/server/framework-preset-vue3.d.ts +0 -4
- 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 -2
- package/dist/ts3.9/client/docs/prepareForInline.d.ts +0 -4
- package/dist/ts3.9/client/preview/render.d.ts +0 -7
- package/dist/ts3.9/server/build.d.ts +0 -1
- package/dist/ts3.9/server/framework-preset-vue3-docs.d.ts +0 -3
- package/dist/ts3.9/server/framework-preset-vue3.d.ts +0 -4
- 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 -2
- package/preset.js +0 -1
- package/standalone.js +0 -8
- package/types-6-0.d.ts +0 -1
- package/types-7-0.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,43 +1 @@
|
|
|
1
|
-
# Storybook
|
|
2
|
-
|
|
3
|
-
Storybook for Vue 3 is a UI development environment for your Vue 3 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-vue3-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/vue/sharing/publish-storybook) of your Storybook and deploy it anywhere you want.
|
|
24
|
-
|
|
25
|
-
## Extending the Vue application
|
|
26
|
-
|
|
27
|
-
Storybook creates a [Vue 3 application](https://v3.vuejs.org/api/application-api.html#application-api) for your component preview which can be imported as `import { app } from '@storybook/vue3'`.
|
|
28
|
-
|
|
29
|
-
When using global custom components (`app.component`), directives (`app.directive`), extensions (`app.use`), or other application methods, you will need to configure those in the `./storybook/preview.js` file.
|
|
30
|
-
|
|
31
|
-
For example:
|
|
32
|
-
|
|
33
|
-
```js
|
|
34
|
-
// .storybook/preview.js
|
|
35
|
-
|
|
36
|
-
import { app } from '@storybook/vue3';
|
|
37
|
-
|
|
38
|
-
app.use(MyPlugin);
|
|
39
|
-
app.component('my-component', MyComponent);
|
|
40
|
-
app.mixin({
|
|
41
|
-
/* My mixin */
|
|
42
|
-
});
|
|
43
|
-
```
|
|
1
|
+
# Storybook Vue3 renderer
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
parameters: true,
|
|
8
|
+
argTypesEnhancers: true
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "argTypesEnhancers", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _config.argTypesEnhancers;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
exports.parameters = void 0;
|
|
17
|
+
|
|
18
|
+
var _config = require("./docs/config");
|
|
19
|
+
|
|
20
|
+
var _config2 = require("./preview/config");
|
|
21
|
+
|
|
22
|
+
Object.keys(_config2).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
25
|
+
if (key in exports && exports[key] === _config2[key]) return;
|
|
26
|
+
Object.defineProperty(exports, key, {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return _config2[key];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
const parameters = Object.assign({
|
|
34
|
+
framework: 'vue3'
|
|
35
|
+
}, _config.parameters);
|
|
36
|
+
exports.parameters = parameters;
|
|
@@ -9,16 +9,13 @@ var _docsTools = require("@storybook/docs-tools");
|
|
|
9
9
|
|
|
10
10
|
var _extractArgTypes = require("./extractArgTypes");
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var parameters = {
|
|
12
|
+
const parameters = {
|
|
15
13
|
docs: {
|
|
16
14
|
inlineStories: true,
|
|
17
|
-
prepareForInline: _prepareForInline.prepareForInline,
|
|
18
15
|
extractArgTypes: _extractArgTypes.extractArgTypes,
|
|
19
16
|
extractComponentDescription: _docsTools.extractComponentDescription
|
|
20
17
|
}
|
|
21
18
|
};
|
|
22
19
|
exports.parameters = parameters;
|
|
23
|
-
|
|
20
|
+
const argTypesEnhancers = [_docsTools.enhanceArgTypes];
|
|
24
21
|
exports.argTypesEnhancers = argTypesEnhancers;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.extractArgTypes = void 0;
|
|
7
|
+
|
|
8
|
+
var _docsTools = require("@storybook/docs-tools");
|
|
9
|
+
|
|
10
|
+
const SECTIONS = ['props', 'events', 'slots'];
|
|
11
|
+
|
|
12
|
+
const extractArgTypes = component => {
|
|
13
|
+
if (!(0, _docsTools.hasDocgen)(component)) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const results = {};
|
|
18
|
+
SECTIONS.forEach(section => {
|
|
19
|
+
const props = (0, _docsTools.extractComponentProps)(component, section);
|
|
20
|
+
props.forEach(({
|
|
21
|
+
propDef,
|
|
22
|
+
docgenInfo,
|
|
23
|
+
jsDocTags
|
|
24
|
+
}) => {
|
|
25
|
+
const {
|
|
26
|
+
name,
|
|
27
|
+
type,
|
|
28
|
+
description,
|
|
29
|
+
defaultValue: defaultSummary,
|
|
30
|
+
required
|
|
31
|
+
} = propDef;
|
|
32
|
+
const sbType = section === 'props' ? (0, _docsTools.convert)(docgenInfo) : {
|
|
33
|
+
name: 'void'
|
|
34
|
+
};
|
|
35
|
+
results[name] = {
|
|
36
|
+
name,
|
|
37
|
+
description,
|
|
38
|
+
type: Object.assign({
|
|
39
|
+
required
|
|
40
|
+
}, sbType),
|
|
41
|
+
table: {
|
|
42
|
+
type,
|
|
43
|
+
jsDocTags,
|
|
44
|
+
defaultValue: defaultSummary,
|
|
45
|
+
category: section
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
return results;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.extractArgTypes = extractArgTypes;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
10
4
|
value: true
|
|
11
5
|
});
|
|
@@ -18,66 +12,59 @@ var _exportNames = {
|
|
|
18
12
|
getStorybook: true,
|
|
19
13
|
forceReRender: true,
|
|
20
14
|
raw: true,
|
|
21
|
-
|
|
22
|
-
activeStoryComponent: true
|
|
15
|
+
setup: true
|
|
23
16
|
};
|
|
24
|
-
Object.defineProperty(exports, "activeStoryComponent", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _preview.activeStoryComponent;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
17
|
Object.defineProperty(exports, "addDecorator", {
|
|
31
18
|
enumerable: true,
|
|
32
|
-
get: function
|
|
19
|
+
get: function () {
|
|
33
20
|
return _preview.addDecorator;
|
|
34
21
|
}
|
|
35
22
|
});
|
|
36
23
|
Object.defineProperty(exports, "addParameters", {
|
|
37
24
|
enumerable: true,
|
|
38
|
-
get: function
|
|
25
|
+
get: function () {
|
|
39
26
|
return _preview.addParameters;
|
|
40
27
|
}
|
|
41
28
|
});
|
|
42
|
-
Object.defineProperty(exports, "app", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _preview.app;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
29
|
Object.defineProperty(exports, "configure", {
|
|
49
30
|
enumerable: true,
|
|
50
|
-
get: function
|
|
31
|
+
get: function () {
|
|
51
32
|
return _preview.configure;
|
|
52
33
|
}
|
|
53
34
|
});
|
|
54
35
|
Object.defineProperty(exports, "forceReRender", {
|
|
55
36
|
enumerable: true,
|
|
56
|
-
get: function
|
|
37
|
+
get: function () {
|
|
57
38
|
return _preview.forceReRender;
|
|
58
39
|
}
|
|
59
40
|
});
|
|
60
41
|
Object.defineProperty(exports, "getStorybook", {
|
|
61
42
|
enumerable: true,
|
|
62
|
-
get: function
|
|
43
|
+
get: function () {
|
|
63
44
|
return _preview.getStorybook;
|
|
64
45
|
}
|
|
65
46
|
});
|
|
66
47
|
Object.defineProperty(exports, "raw", {
|
|
67
48
|
enumerable: true,
|
|
68
|
-
get: function
|
|
49
|
+
get: function () {
|
|
69
50
|
return _preview.raw;
|
|
70
51
|
}
|
|
71
52
|
});
|
|
72
53
|
Object.defineProperty(exports, "setAddon", {
|
|
73
54
|
enumerable: true,
|
|
74
|
-
get: function
|
|
55
|
+
get: function () {
|
|
75
56
|
return _preview.setAddon;
|
|
76
57
|
}
|
|
77
58
|
});
|
|
59
|
+
Object.defineProperty(exports, "setup", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () {
|
|
62
|
+
return _preview.setup;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
78
65
|
Object.defineProperty(exports, "storiesOf", {
|
|
79
66
|
enumerable: true,
|
|
80
|
-
get: function
|
|
67
|
+
get: function () {
|
|
81
68
|
return _preview.storiesOf;
|
|
82
69
|
}
|
|
83
70
|
});
|
|
@@ -92,12 +79,13 @@ Object.keys(_types).forEach(function (key) {
|
|
|
92
79
|
if (key in exports && exports[key] === _types[key]) return;
|
|
93
80
|
Object.defineProperty(exports, key, {
|
|
94
81
|
enumerable: true,
|
|
95
|
-
get: function
|
|
82
|
+
get: function () {
|
|
96
83
|
return _types[key];
|
|
97
84
|
}
|
|
98
85
|
});
|
|
99
86
|
});
|
|
100
87
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
88
|
+
var _module, _module$hot;
|
|
89
|
+
|
|
90
|
+
// optimization: stop HMR propagation in webpack
|
|
91
|
+
(_module = module) === null || _module === void 0 ? void 0 : (_module$hot = _module.hot) === null || _module$hot === void 0 ? void 0 : _module$hot.decline();
|
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "applyDecorators", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _decorateStory.decorateStory;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports.parameters = void 0;
|
|
13
13
|
Object.defineProperty(exports, "render", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function
|
|
15
|
+
get: function () {
|
|
16
16
|
return _render.render;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "renderToDOM", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function
|
|
21
|
+
get: function () {
|
|
22
22
|
return _render.renderToDOM;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -27,7 +27,7 @@ var _render = require("./render");
|
|
|
27
27
|
|
|
28
28
|
var _decorateStory = require("./decorateStory");
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const parameters = {
|
|
31
31
|
framework: 'vue3'
|
|
32
32
|
};
|
|
33
33
|
exports.parameters = parameters;
|
|
@@ -5,12 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.decorateStory = decorateStory;
|
|
7
7
|
|
|
8
|
-
require("core-js/modules/es.function.name.js");
|
|
9
|
-
|
|
10
|
-
require("core-js/modules/es.object.assign.js");
|
|
11
|
-
|
|
12
|
-
require("core-js/modules/es.object.to-string.js");
|
|
13
|
-
|
|
14
8
|
var _vue = require("vue");
|
|
15
9
|
|
|
16
10
|
var _store = require("@storybook/store");
|
|
@@ -29,7 +23,7 @@ function normalizeFunctionalComponent(options) {
|
|
|
29
23
|
}
|
|
30
24
|
|
|
31
25
|
function prepare(rawStory, innerStory) {
|
|
32
|
-
|
|
26
|
+
const story = rawStory;
|
|
33
27
|
|
|
34
28
|
if (story == null) {
|
|
35
29
|
return null;
|
|
@@ -44,32 +38,29 @@ function prepare(rawStory, innerStory) {
|
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
return {
|
|
47
|
-
render
|
|
41
|
+
render() {
|
|
48
42
|
return (0, _vue.h)(story);
|
|
49
43
|
}
|
|
44
|
+
|
|
50
45
|
};
|
|
51
46
|
}
|
|
52
47
|
|
|
53
48
|
function decorateStory(storyFn, decorators) {
|
|
54
|
-
return decorators.reduce(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
49
|
+
return decorators.reduce((decorated, decorator) => context => {
|
|
50
|
+
let story;
|
|
51
|
+
const decoratedStory = decorator(update => {
|
|
52
|
+
story = decorated(Object.assign({}, context, (0, _store.sanitizeStoryContextUpdate)(update)));
|
|
53
|
+
return story;
|
|
54
|
+
}, context);
|
|
55
|
+
|
|
56
|
+
if (!story) {
|
|
57
|
+
story = decorated(context);
|
|
58
|
+
}
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
if (decoratedStory === story) {
|
|
61
|
+
return story;
|
|
62
|
+
}
|
|
69
63
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}, function (context) {
|
|
73
|
-
return prepare(storyFn(context));
|
|
74
|
-
});
|
|
64
|
+
return prepare(decoratedStory, story);
|
|
65
|
+
}, context => prepare(storyFn(context)));
|
|
75
66
|
}
|
|
@@ -4,6 +4,8 @@ var _global = _interopRequireDefault(require("global"));
|
|
|
4
4
|
|
|
5
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const {
|
|
8
|
+
window: globalWindow
|
|
9
|
+
} = _global.default;
|
|
8
10
|
globalWindow.STORYBOOK_REACT_CLASSES = {};
|
|
9
11
|
globalWindow.STORYBOOK_ENV = 'vue3';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setAddon = exports.raw = exports.getStorybook = exports.forceReRender = exports.configure = exports.clearDecorators = exports.addParameters = exports.addDecorator = void 0;
|
|
7
|
+
Object.defineProperty(exports, "setup", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _render.setup;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
exports.storiesOf = void 0;
|
|
14
|
+
|
|
15
|
+
var _coreClient = require("@storybook/core-client");
|
|
16
|
+
|
|
17
|
+
require("./globals");
|
|
18
|
+
|
|
19
|
+
var _decorateStory = require("./decorateStory");
|
|
20
|
+
|
|
21
|
+
var _render = require("./render");
|
|
22
|
+
|
|
23
|
+
const framework = 'vue3';
|
|
24
|
+
const api = (0, _coreClient.start)(_render.renderToDOM, {
|
|
25
|
+
decorateStory: _decorateStory.decorateStory,
|
|
26
|
+
render: _render.render
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const storiesOf = (kind, m) => {
|
|
30
|
+
return api.clientApi.storiesOf(kind, m).addParameters({
|
|
31
|
+
framework
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.storiesOf = storiesOf;
|
|
36
|
+
|
|
37
|
+
const configure = (...args) => api.configure(framework, ...args);
|
|
38
|
+
|
|
39
|
+
exports.configure = configure;
|
|
40
|
+
const {
|
|
41
|
+
addDecorator
|
|
42
|
+
} = api.clientApi;
|
|
43
|
+
exports.addDecorator = addDecorator;
|
|
44
|
+
const {
|
|
45
|
+
addParameters
|
|
46
|
+
} = api.clientApi;
|
|
47
|
+
exports.addParameters = addParameters;
|
|
48
|
+
const {
|
|
49
|
+
clearDecorators
|
|
50
|
+
} = api.clientApi;
|
|
51
|
+
exports.clearDecorators = clearDecorators;
|
|
52
|
+
const {
|
|
53
|
+
setAddon
|
|
54
|
+
} = api.clientApi;
|
|
55
|
+
exports.setAddon = setAddon;
|
|
56
|
+
const {
|
|
57
|
+
forceReRender
|
|
58
|
+
} = api;
|
|
59
|
+
exports.forceReRender = forceReRender;
|
|
60
|
+
const {
|
|
61
|
+
getStorybook
|
|
62
|
+
} = api.clientApi;
|
|
63
|
+
exports.getStorybook = getStorybook;
|
|
64
|
+
const {
|
|
65
|
+
raw
|
|
66
|
+
} = api.clientApi;
|
|
67
|
+
exports.raw = raw;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.render = void 0;
|
|
7
|
+
exports.renderToDOM = renderToDOM;
|
|
8
|
+
exports.setup = void 0;
|
|
9
|
+
|
|
10
|
+
var _tsDedent = _interopRequireDefault(require("ts-dedent"));
|
|
11
|
+
|
|
12
|
+
var _vue = require("vue");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
const render = (props, context) => {
|
|
17
|
+
const {
|
|
18
|
+
id,
|
|
19
|
+
component: Component
|
|
20
|
+
} = context;
|
|
21
|
+
|
|
22
|
+
if (!Component) {
|
|
23
|
+
throw new Error(`Unable to render story ${id} as the component annotation is missing from the default export`);
|
|
24
|
+
} // TODO remove this hack
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
return (0, _vue.h)(Component, props);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.render = render;
|
|
31
|
+
|
|
32
|
+
let setupFunction = app => {};
|
|
33
|
+
|
|
34
|
+
const setup = fn => {
|
|
35
|
+
setupFunction = fn;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.setup = setup;
|
|
39
|
+
const map = new Map();
|
|
40
|
+
|
|
41
|
+
function renderToDOM({
|
|
42
|
+
title,
|
|
43
|
+
name,
|
|
44
|
+
storyFn,
|
|
45
|
+
showMain,
|
|
46
|
+
showError,
|
|
47
|
+
showException
|
|
48
|
+
}, domElement) {
|
|
49
|
+
// TODO: explain cyclical nature of these app => story => mount
|
|
50
|
+
let element;
|
|
51
|
+
const storybookApp = (0, _vue.createApp)({
|
|
52
|
+
unmounted() {
|
|
53
|
+
map.delete(domElement);
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
render() {
|
|
57
|
+
map.set(domElement, storybookApp);
|
|
58
|
+
setupFunction(storybookApp);
|
|
59
|
+
return (0, _vue.h)(element);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
});
|
|
63
|
+
storybookApp.config.errorHandler = showException;
|
|
64
|
+
element = storyFn();
|
|
65
|
+
|
|
66
|
+
if (!element) {
|
|
67
|
+
showError({
|
|
68
|
+
title: `Expecting a Vue component from the story: "${name}" of "${title}".`,
|
|
69
|
+
description: (0, _tsDedent.default)`
|
|
70
|
+
Did you forget to return the Vue component from the story?
|
|
71
|
+
Use "() => ({ template: '<my-comp></my-comp>' })" or "() => ({ components: MyComp, template: '<my-comp></my-comp>' })" when defining the story.
|
|
72
|
+
`
|
|
73
|
+
});
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
showMain();
|
|
78
|
+
|
|
79
|
+
if (map.has(domElement)) {
|
|
80
|
+
map.get(domElement).unmount(domElement);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
storybookApp.mount(domElement);
|
|
84
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { extractComponentDescription, enhanceArgTypes } from '@storybook/docs-tools';
|
|
2
2
|
import { extractArgTypes } from './extractArgTypes';
|
|
3
|
-
import { prepareForInline } from './prepareForInline';
|
|
4
3
|
export const parameters = {
|
|
5
4
|
docs: {
|
|
6
5
|
inlineStories: true,
|
|
7
|
-
prepareForInline,
|
|
8
6
|
extractArgTypes,
|
|
9
7
|
extractComponentDescription
|
|
10
8
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { start } from '@storybook/core';
|
|
1
|
+
import { start } from '@storybook/core-client';
|
|
2
2
|
import './globals';
|
|
3
3
|
import { decorateStory } from './decorateStory';
|
|
4
|
-
import { render, renderToDOM
|
|
4
|
+
import { render, renderToDOM } from './render';
|
|
5
5
|
const framework = 'vue3';
|
|
6
6
|
const api = start(renderToDOM, {
|
|
7
7
|
decorateStory,
|
|
@@ -34,5 +34,4 @@ export const {
|
|
|
34
34
|
export const {
|
|
35
35
|
raw
|
|
36
36
|
} = api.clientApi;
|
|
37
|
-
export
|
|
38
|
-
export { activeStoryComponent } from './render';
|
|
37
|
+
export { setup } from './render';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import dedent from 'ts-dedent';
|
|
2
|
+
import { createApp, h } from 'vue';
|
|
3
|
+
export const render = (props, context) => {
|
|
4
|
+
const {
|
|
5
|
+
id,
|
|
6
|
+
component: Component
|
|
7
|
+
} = context;
|
|
8
|
+
|
|
9
|
+
if (!Component) {
|
|
10
|
+
throw new Error(`Unable to render story ${id} as the component annotation is missing from the default export`);
|
|
11
|
+
} // TODO remove this hack
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
return h(Component, props);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let setupFunction = app => {};
|
|
18
|
+
|
|
19
|
+
export const setup = fn => {
|
|
20
|
+
setupFunction = fn;
|
|
21
|
+
};
|
|
22
|
+
const map = new Map();
|
|
23
|
+
export function renderToDOM({
|
|
24
|
+
title,
|
|
25
|
+
name,
|
|
26
|
+
storyFn,
|
|
27
|
+
showMain,
|
|
28
|
+
showError,
|
|
29
|
+
showException
|
|
30
|
+
}, domElement) {
|
|
31
|
+
// TODO: explain cyclical nature of these app => story => mount
|
|
32
|
+
let element;
|
|
33
|
+
const storybookApp = createApp({
|
|
34
|
+
unmounted() {
|
|
35
|
+
map.delete(domElement);
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
render() {
|
|
39
|
+
map.set(domElement, storybookApp);
|
|
40
|
+
setupFunction(storybookApp);
|
|
41
|
+
return h(element);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
});
|
|
45
|
+
storybookApp.config.errorHandler = showException;
|
|
46
|
+
element = storyFn();
|
|
47
|
+
|
|
48
|
+
if (!element) {
|
|
49
|
+
showError({
|
|
50
|
+
title: `Expecting a Vue component from the story: "${name}" of "${title}".`,
|
|
51
|
+
description: dedent`
|
|
52
|
+
Did you forget to return the Vue component from the story?
|
|
53
|
+
Use "() => ({ template: '<my-comp></my-comp>' })" or "() => ({ components: MyComp, template: '<my-comp></my-comp>' })" when defining the story.
|
|
54
|
+
`
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
showMain();
|
|
60
|
+
|
|
61
|
+
if (map.has(domElement)) {
|
|
62
|
+
map.get(domElement).unmount(domElement);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
storybookApp.mount(domElement);
|
|
66
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const parameters: {
|
|
2
|
+
docs: {
|
|
3
|
+
inlineStories: boolean;
|
|
4
|
+
extractArgTypes: import("lib/docs-tools/dist/types").ArgTypesExtractor;
|
|
5
|
+
extractComponentDescription: typeof import("lib/docs-tools/dist/types").extractComponentDescription;
|
|
6
|
+
};
|
|
7
|
+
framework: string;
|
|
8
|
+
};
|
|
9
|
+
export { argTypesEnhancers } from './docs/config';
|
|
10
|
+
export * from './preview/config';
|