@storybook/preact 6.4.0-beta.24 → 6.4.0-beta.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/index.js +83 -0
- package/dist/cjs/client/preview/config.js +19 -0
- package/dist/cjs/client/preview/globals.js +11 -0
- package/dist/cjs/client/preview/index.js +50 -0
- package/dist/cjs/client/preview/render.js +100 -0
- package/dist/cjs/client/preview/types-6-0.js +1 -0
- package/dist/cjs/client/preview/types-7-0.js +1 -0
- package/dist/cjs/client/preview/types.js +1 -0
- package/dist/cjs/server/build.js +9 -0
- package/dist/cjs/server/framework-preset-preact.js +46 -0
- package/dist/cjs/server/index.js +9 -0
- package/dist/cjs/server/options.js +17 -0
- package/dist/cjs/typings.d.js +1 -0
- package/dist/esm/client/index.js +2 -0
- package/dist/esm/client/preview/config.js +4 -0
- package/dist/esm/client/preview/globals.js +6 -0
- package/dist/esm/client/preview/index.js +27 -0
- package/dist/esm/client/preview/render.js +61 -0
- package/dist/esm/client/preview/types-6-0.js +0 -0
- package/dist/esm/client/preview/types-7-0.js +0 -0
- package/dist/esm/client/preview/types.js +0 -0
- package/dist/esm/server/build.js +3 -0
- package/dist/esm/server/framework-preset-preact.js +29 -0
- package/dist/esm/server/index.js +3 -0
- package/dist/esm/server/options.js +8 -0
- package/dist/esm/typings.d.js +0 -0
- package/dist/modern/client/index.js +2 -0
- package/dist/modern/client/preview/config.js +4 -0
- package/dist/modern/client/preview/globals.js +8 -0
- package/dist/modern/client/preview/index.js +19 -0
- package/dist/modern/client/preview/render.js +57 -0
- package/dist/modern/client/preview/types-6-0.js +0 -0
- package/dist/modern/client/preview/types-7-0.js +0 -0
- package/dist/modern/client/preview/types.js +0 -0
- package/dist/modern/server/build.js +3 -0
- package/dist/modern/server/framework-preset-preact.js +29 -0
- package/dist/modern/server/index.js +3 -0
- package/dist/modern/server/options.js +8 -0
- package/dist/modern/typings.d.js +0 -0
- package/dist/ts3.4/client/index.d.ts +2 -0
- package/dist/ts3.4/client/preview/config.d.ts +4 -0
- package/dist/ts3.4/client/preview/globals.d.ts +1 -0
- package/dist/ts3.4/client/preview/index.d.ts +24 -0
- package/dist/ts3.4/client/preview/render.d.ts +3 -0
- package/dist/ts3.4/client/preview/types-6-0.d.ts +35 -0
- package/dist/ts3.4/client/preview/types-7-0.d.ts +9 -0
- package/dist/ts3.4/client/preview/types.d.ts +14 -0
- package/dist/ts3.4/server/build.d.ts +1 -0
- package/dist/ts3.4/server/framework-preset-preact.d.ts +102 -0
- package/dist/ts3.4/server/index.d.ts +1 -0
- package/dist/ts3.4/server/options.d.ts +3 -0
- package/dist/ts3.9/client/index.d.ts +2 -0
- package/dist/ts3.9/client/preview/config.d.ts +4 -0
- package/dist/ts3.9/client/preview/globals.d.ts +1 -0
- package/dist/ts3.9/client/preview/index.d.ts +24 -0
- package/dist/ts3.9/client/preview/render.d.ts +3 -0
- package/dist/ts3.9/client/preview/types-6-0.d.ts +35 -0
- package/dist/ts3.9/client/preview/types-7-0.d.ts +9 -0
- package/dist/ts3.9/client/preview/types.d.ts +14 -0
- package/dist/ts3.9/server/build.d.ts +1 -0
- package/dist/ts3.9/server/framework-preset-preact.d.ts +102 -0
- package/dist/ts3.9/server/index.d.ts +1 -0
- package/dist/ts3.9/server/options.d.ts +3 -0
- package/package.json +6 -6
@@ -0,0 +1,83 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
4
|
+
|
5
|
+
require("core-js/modules/es.object.keys.js");
|
6
|
+
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
8
|
+
value: true
|
9
|
+
});
|
10
|
+
var _exportNames = {
|
11
|
+
storiesOf: true,
|
12
|
+
setAddon: true,
|
13
|
+
addDecorator: true,
|
14
|
+
addParameters: true,
|
15
|
+
configure: true,
|
16
|
+
getStorybook: true,
|
17
|
+
forceReRender: true,
|
18
|
+
raw: true
|
19
|
+
};
|
20
|
+
Object.defineProperty(exports, "storiesOf", {
|
21
|
+
enumerable: true,
|
22
|
+
get: function get() {
|
23
|
+
return _preview.storiesOf;
|
24
|
+
}
|
25
|
+
});
|
26
|
+
Object.defineProperty(exports, "setAddon", {
|
27
|
+
enumerable: true,
|
28
|
+
get: function get() {
|
29
|
+
return _preview.setAddon;
|
30
|
+
}
|
31
|
+
});
|
32
|
+
Object.defineProperty(exports, "addDecorator", {
|
33
|
+
enumerable: true,
|
34
|
+
get: function get() {
|
35
|
+
return _preview.addDecorator;
|
36
|
+
}
|
37
|
+
});
|
38
|
+
Object.defineProperty(exports, "addParameters", {
|
39
|
+
enumerable: true,
|
40
|
+
get: function get() {
|
41
|
+
return _preview.addParameters;
|
42
|
+
}
|
43
|
+
});
|
44
|
+
Object.defineProperty(exports, "configure", {
|
45
|
+
enumerable: true,
|
46
|
+
get: function get() {
|
47
|
+
return _preview.configure;
|
48
|
+
}
|
49
|
+
});
|
50
|
+
Object.defineProperty(exports, "getStorybook", {
|
51
|
+
enumerable: true,
|
52
|
+
get: function get() {
|
53
|
+
return _preview.getStorybook;
|
54
|
+
}
|
55
|
+
});
|
56
|
+
Object.defineProperty(exports, "forceReRender", {
|
57
|
+
enumerable: true,
|
58
|
+
get: function get() {
|
59
|
+
return _preview.forceReRender;
|
60
|
+
}
|
61
|
+
});
|
62
|
+
Object.defineProperty(exports, "raw", {
|
63
|
+
enumerable: true,
|
64
|
+
get: function get() {
|
65
|
+
return _preview.raw;
|
66
|
+
}
|
67
|
+
});
|
68
|
+
|
69
|
+
var _preview = require("./preview");
|
70
|
+
|
71
|
+
var _types = require("./preview/types-6-0");
|
72
|
+
|
73
|
+
Object.keys(_types).forEach(function (key) {
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
75
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
76
|
+
if (key in exports && exports[key] === _types[key]) return;
|
77
|
+
Object.defineProperty(exports, key, {
|
78
|
+
enumerable: true,
|
79
|
+
get: function get() {
|
80
|
+
return _types[key];
|
81
|
+
}
|
82
|
+
});
|
83
|
+
});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "renderToDOM", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _render.renderToDOM;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
exports.parameters = void 0;
|
13
|
+
|
14
|
+
var _render = require("./render");
|
15
|
+
|
16
|
+
var parameters = {
|
17
|
+
framework: 'preact'
|
18
|
+
};
|
19
|
+
exports.parameters = parameters;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _global = _interopRequireDefault(require("global"));
|
4
|
+
|
5
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
|
+
|
7
|
+
var globalWindow = _global.default.window;
|
8
|
+
|
9
|
+
if (globalWindow) {
|
10
|
+
globalWindow.STORYBOOK_ENV = 'preact';
|
11
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.raw = exports.getStorybook = exports.forceReRender = exports.setAddon = exports.clearDecorators = exports.addParameters = exports.addDecorator = exports.configure = exports.storiesOf = void 0;
|
7
|
+
|
8
|
+
require("core-js/modules/es.array.concat.js");
|
9
|
+
|
10
|
+
var _client = require("@storybook/core/client");
|
11
|
+
|
12
|
+
require("./globals");
|
13
|
+
|
14
|
+
var _render = require("./render");
|
15
|
+
|
16
|
+
/* eslint-disable prefer-destructuring */
|
17
|
+
var framework = 'preact';
|
18
|
+
var api = (0, _client.start)(_render.renderToDOM);
|
19
|
+
|
20
|
+
var storiesOf = function storiesOf(kind, m) {
|
21
|
+
return api.clientApi.storiesOf(kind, m).addParameters({
|
22
|
+
framework: framework
|
23
|
+
});
|
24
|
+
};
|
25
|
+
|
26
|
+
exports.storiesOf = storiesOf;
|
27
|
+
|
28
|
+
var configure = function configure() {
|
29
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
30
|
+
args[_key] = arguments[_key];
|
31
|
+
}
|
32
|
+
|
33
|
+
return api.configure.apply(api, [framework].concat(args));
|
34
|
+
};
|
35
|
+
|
36
|
+
exports.configure = configure;
|
37
|
+
var addDecorator = api.clientApi.addDecorator;
|
38
|
+
exports.addDecorator = addDecorator;
|
39
|
+
var addParameters = api.clientApi.addParameters;
|
40
|
+
exports.addParameters = addParameters;
|
41
|
+
var clearDecorators = api.clientApi.clearDecorators;
|
42
|
+
exports.clearDecorators = clearDecorators;
|
43
|
+
var setAddon = api.clientApi.setAddon;
|
44
|
+
exports.setAddon = setAddon;
|
45
|
+
var forceReRender = api.forceReRender;
|
46
|
+
exports.forceReRender = forceReRender;
|
47
|
+
var getStorybook = api.clientApi.getStorybook;
|
48
|
+
exports.getStorybook = getStorybook;
|
49
|
+
var raw = api.clientApi.raw;
|
50
|
+
exports.raw = raw;
|
@@ -0,0 +1,100 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
+
|
5
|
+
require("core-js/modules/es.array.slice.js");
|
6
|
+
|
7
|
+
require("core-js/modules/es.object.freeze.js");
|
8
|
+
|
9
|
+
require("core-js/modules/es.weak-map.js");
|
10
|
+
|
11
|
+
require("core-js/modules/es.object.to-string.js");
|
12
|
+
|
13
|
+
require("core-js/modules/es.string.iterator.js");
|
14
|
+
|
15
|
+
require("core-js/modules/es.array.iterator.js");
|
16
|
+
|
17
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
18
|
+
|
19
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
20
|
+
|
21
|
+
require("core-js/modules/es.symbol.js");
|
22
|
+
|
23
|
+
require("core-js/modules/es.symbol.description.js");
|
24
|
+
|
25
|
+
require("core-js/modules/es.symbol.iterator.js");
|
26
|
+
|
27
|
+
Object.defineProperty(exports, "__esModule", {
|
28
|
+
value: true
|
29
|
+
});
|
30
|
+
exports.renderToDOM = renderToDOM;
|
31
|
+
|
32
|
+
require("core-js/modules/es.function.name.js");
|
33
|
+
|
34
|
+
require("core-js/modules/es.array.concat.js");
|
35
|
+
|
36
|
+
var preact = _interopRequireWildcard(require("preact"));
|
37
|
+
|
38
|
+
var _tsDedent = _interopRequireDefault(require("ts-dedent"));
|
39
|
+
|
40
|
+
var _templateObject;
|
41
|
+
|
42
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
43
|
+
|
44
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
45
|
+
|
46
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
|
47
|
+
|
48
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
49
|
+
|
50
|
+
var renderedStory;
|
51
|
+
|
52
|
+
function preactRender(story, domElement) {
|
53
|
+
if (preact.Fragment) {
|
54
|
+
// Preact 10 only:
|
55
|
+
preact.render(story, domElement);
|
56
|
+
} else {
|
57
|
+
renderedStory = preact.render(story, domElement, renderedStory);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
var StoryHarness = function StoryHarness(_ref) {
|
62
|
+
var showError = _ref.showError,
|
63
|
+
name = _ref.name,
|
64
|
+
title = _ref.title,
|
65
|
+
storyFn = _ref.storyFn,
|
66
|
+
domElement = _ref.domElement;
|
67
|
+
var content = preact.h(storyFn, null);
|
68
|
+
|
69
|
+
if (!content) {
|
70
|
+
showError({
|
71
|
+
title: "Expecting a Preact element from the story: \"".concat(name, "\" of \"").concat(title, "\"."),
|
72
|
+
description: (0, _tsDedent.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n Did you forget to return the Preact element from the story?\n Use \"() => (<MyComp/>)\" or \"() => { return <MyComp/>; }\" when defining the story.\n "])))
|
73
|
+
});
|
74
|
+
return null;
|
75
|
+
}
|
76
|
+
|
77
|
+
return content;
|
78
|
+
};
|
79
|
+
|
80
|
+
function renderToDOM(_ref2, domElement) {
|
81
|
+
var storyFn = _ref2.storyFn,
|
82
|
+
title = _ref2.title,
|
83
|
+
name = _ref2.name,
|
84
|
+
showMain = _ref2.showMain,
|
85
|
+
showError = _ref2.showError,
|
86
|
+
forceRemount = _ref2.forceRemount;
|
87
|
+
|
88
|
+
if (forceRemount) {
|
89
|
+
preactRender(null, domElement);
|
90
|
+
}
|
91
|
+
|
92
|
+
showMain();
|
93
|
+
preactRender(preact.h(StoryHarness, {
|
94
|
+
name: name,
|
95
|
+
title: title,
|
96
|
+
showError: showError,
|
97
|
+
storyFn: storyFn,
|
98
|
+
domElement: domElement
|
99
|
+
}), domElement);
|
100
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _server = require("@storybook/core/server");
|
4
|
+
|
5
|
+
var _options = _interopRequireDefault(require("./options"));
|
6
|
+
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
+
|
9
|
+
(0, _server.buildStatic)(_options.default);
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.babelDefault = babelDefault;
|
7
|
+
exports.webpackFinal = webpackFinal;
|
8
|
+
exports.config = void 0;
|
9
|
+
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
11
|
+
|
12
|
+
var _coreCommon = require("@storybook/core-common");
|
13
|
+
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
17
|
+
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
19
|
+
|
20
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
21
|
+
|
22
|
+
function babelDefault(config) {
|
23
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
24
|
+
plugins: [...config.plugins, [require.resolve('@babel/plugin-transform-react-jsx'), {
|
25
|
+
pragma: 'h'
|
26
|
+
}, 'preset']]
|
27
|
+
});
|
28
|
+
}
|
29
|
+
|
30
|
+
function webpackFinal(config) {
|
31
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
32
|
+
resolve: _objectSpread(_objectSpread({}, config.resolve), {}, {
|
33
|
+
alias: _objectSpread(_objectSpread({}, config.resolve.alias), {}, {
|
34
|
+
react: _path.default.dirname(require.resolve('preact/compat/package.json')),
|
35
|
+
'react-dom/test-utils': _path.default.dirname(require.resolve('preact/test-utils/package.json')),
|
36
|
+
'react-dom': _path.default.dirname(require.resolve('preact/compat/package.json'))
|
37
|
+
})
|
38
|
+
})
|
39
|
+
});
|
40
|
+
}
|
41
|
+
|
42
|
+
var config = function (entry = []) {
|
43
|
+
return [...entry, (0, _coreCommon.findDistEsm)(__dirname, 'client/preview/config')];
|
44
|
+
};
|
45
|
+
|
46
|
+
exports.config = config;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _server = require("@storybook/core/server");
|
4
|
+
|
5
|
+
var _options = _interopRequireDefault(require("./options"));
|
6
|
+
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
+
|
9
|
+
(0, _server.buildDev)(_options.default);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _readPkgUp = require("read-pkg-up");
|
9
|
+
|
10
|
+
var _default = {
|
11
|
+
packageJson: (0, _readPkgUp.sync)({
|
12
|
+
cwd: __dirname
|
13
|
+
}).packageJson,
|
14
|
+
framework: 'preact',
|
15
|
+
frameworkPresets: [require.resolve('./framework-preset-preact.js')]
|
16
|
+
};
|
17
|
+
exports.default = _default;
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import "core-js/modules/es.array.concat.js";
|
2
|
+
|
3
|
+
/* eslint-disable prefer-destructuring */
|
4
|
+
import { start } from '@storybook/core/client';
|
5
|
+
import './globals';
|
6
|
+
import { renderToDOM } from './render';
|
7
|
+
var framework = 'preact';
|
8
|
+
var api = start(renderToDOM);
|
9
|
+
export var storiesOf = function storiesOf(kind, m) {
|
10
|
+
return api.clientApi.storiesOf(kind, m).addParameters({
|
11
|
+
framework: framework
|
12
|
+
});
|
13
|
+
};
|
14
|
+
export var configure = function configure() {
|
15
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
16
|
+
args[_key] = arguments[_key];
|
17
|
+
}
|
18
|
+
|
19
|
+
return api.configure.apply(api, [framework].concat(args));
|
20
|
+
};
|
21
|
+
export var addDecorator = api.clientApi.addDecorator;
|
22
|
+
export var addParameters = api.clientApi.addParameters;
|
23
|
+
export var clearDecorators = api.clientApi.clearDecorators;
|
24
|
+
export var setAddon = api.clientApi.setAddon;
|
25
|
+
export var forceReRender = api.forceReRender;
|
26
|
+
export var getStorybook = api.clientApi.getStorybook;
|
27
|
+
export var raw = api.clientApi.raw;
|
@@ -0,0 +1,61 @@
|
|
1
|
+
var _templateObject;
|
2
|
+
|
3
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
4
|
+
|
5
|
+
import "core-js/modules/es.function.name.js";
|
6
|
+
import "core-js/modules/es.array.concat.js";
|
7
|
+
import "core-js/modules/es.array.slice.js";
|
8
|
+
import "core-js/modules/es.object.freeze.js";
|
9
|
+
import * as preact from 'preact';
|
10
|
+
import dedent from 'ts-dedent';
|
11
|
+
var renderedStory;
|
12
|
+
|
13
|
+
function preactRender(story, domElement) {
|
14
|
+
if (preact.Fragment) {
|
15
|
+
// Preact 10 only:
|
16
|
+
preact.render(story, domElement);
|
17
|
+
} else {
|
18
|
+
renderedStory = preact.render(story, domElement, renderedStory);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
var StoryHarness = function StoryHarness(_ref) {
|
23
|
+
var showError = _ref.showError,
|
24
|
+
name = _ref.name,
|
25
|
+
title = _ref.title,
|
26
|
+
storyFn = _ref.storyFn,
|
27
|
+
domElement = _ref.domElement;
|
28
|
+
var content = preact.h(storyFn, null);
|
29
|
+
|
30
|
+
if (!content) {
|
31
|
+
showError({
|
32
|
+
title: "Expecting a Preact element from the story: \"".concat(name, "\" of \"").concat(title, "\"."),
|
33
|
+
description: dedent(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n Did you forget to return the Preact element from the story?\n Use \"() => (<MyComp/>)\" or \"() => { return <MyComp/>; }\" when defining the story.\n "])))
|
34
|
+
});
|
35
|
+
return null;
|
36
|
+
}
|
37
|
+
|
38
|
+
return content;
|
39
|
+
};
|
40
|
+
|
41
|
+
export function renderToDOM(_ref2, domElement) {
|
42
|
+
var storyFn = _ref2.storyFn,
|
43
|
+
title = _ref2.title,
|
44
|
+
name = _ref2.name,
|
45
|
+
showMain = _ref2.showMain,
|
46
|
+
showError = _ref2.showError,
|
47
|
+
forceRemount = _ref2.forceRemount;
|
48
|
+
|
49
|
+
if (forceRemount) {
|
50
|
+
preactRender(null, domElement);
|
51
|
+
}
|
52
|
+
|
53
|
+
showMain();
|
54
|
+
preactRender(preact.h(StoryHarness, {
|
55
|
+
name: name,
|
56
|
+
title: title,
|
57
|
+
showError: showError,
|
58
|
+
storyFn: storyFn,
|
59
|
+
domElement: domElement
|
60
|
+
}), domElement);
|
61
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
2
|
+
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
4
|
+
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
|
+
|
7
|
+
import path from 'path';
|
8
|
+
import { findDistEsm } from '@storybook/core-common';
|
9
|
+
export function babelDefault(config) {
|
10
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
11
|
+
plugins: [...config.plugins, [require.resolve('@babel/plugin-transform-react-jsx'), {
|
12
|
+
pragma: 'h'
|
13
|
+
}, 'preset']]
|
14
|
+
});
|
15
|
+
}
|
16
|
+
export function webpackFinal(config) {
|
17
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
18
|
+
resolve: _objectSpread(_objectSpread({}, config.resolve), {}, {
|
19
|
+
alias: _objectSpread(_objectSpread({}, config.resolve.alias), {}, {
|
20
|
+
react: path.dirname(require.resolve('preact/compat/package.json')),
|
21
|
+
'react-dom/test-utils': path.dirname(require.resolve('preact/test-utils/package.json')),
|
22
|
+
'react-dom': path.dirname(require.resolve('preact/compat/package.json'))
|
23
|
+
})
|
24
|
+
})
|
25
|
+
});
|
26
|
+
}
|
27
|
+
export var config = function (entry = []) {
|
28
|
+
return [...entry, findDistEsm(__dirname, 'client/preview/config')];
|
29
|
+
};
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/* eslint-disable prefer-destructuring */
|
2
|
+
import { start } from '@storybook/core/client';
|
3
|
+
import './globals';
|
4
|
+
import { renderToDOM } from './render';
|
5
|
+
const framework = 'preact';
|
6
|
+
const api = start(renderToDOM);
|
7
|
+
export const storiesOf = (kind, m) => {
|
8
|
+
return api.clientApi.storiesOf(kind, m).addParameters({
|
9
|
+
framework
|
10
|
+
});
|
11
|
+
};
|
12
|
+
export const configure = (...args) => api.configure(framework, ...args);
|
13
|
+
export const addDecorator = api.clientApi.addDecorator;
|
14
|
+
export const addParameters = api.clientApi.addParameters;
|
15
|
+
export const clearDecorators = api.clientApi.clearDecorators;
|
16
|
+
export const setAddon = api.clientApi.setAddon;
|
17
|
+
export const forceReRender = api.forceReRender;
|
18
|
+
export const getStorybook = api.clientApi.getStorybook;
|
19
|
+
export const raw = api.clientApi.raw;
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import * as preact from 'preact';
|
2
|
+
import dedent from 'ts-dedent';
|
3
|
+
let renderedStory;
|
4
|
+
|
5
|
+
function preactRender(story, domElement) {
|
6
|
+
if (preact.Fragment) {
|
7
|
+
// Preact 10 only:
|
8
|
+
preact.render(story, domElement);
|
9
|
+
} else {
|
10
|
+
renderedStory = preact.render(story, domElement, renderedStory);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
const StoryHarness = ({
|
15
|
+
showError,
|
16
|
+
name,
|
17
|
+
title,
|
18
|
+
storyFn,
|
19
|
+
domElement
|
20
|
+
}) => {
|
21
|
+
const content = preact.h(storyFn, null);
|
22
|
+
|
23
|
+
if (!content) {
|
24
|
+
showError({
|
25
|
+
title: `Expecting a Preact element from the story: "${name}" of "${title}".`,
|
26
|
+
description: dedent`
|
27
|
+
Did you forget to return the Preact element from the story?
|
28
|
+
Use "() => (<MyComp/>)" or "() => { return <MyComp/>; }" when defining the story.
|
29
|
+
`
|
30
|
+
});
|
31
|
+
return null;
|
32
|
+
}
|
33
|
+
|
34
|
+
return content;
|
35
|
+
};
|
36
|
+
|
37
|
+
export function renderToDOM({
|
38
|
+
storyFn,
|
39
|
+
title,
|
40
|
+
name,
|
41
|
+
showMain,
|
42
|
+
showError,
|
43
|
+
forceRemount
|
44
|
+
}, domElement) {
|
45
|
+
if (forceRemount) {
|
46
|
+
preactRender(null, domElement);
|
47
|
+
}
|
48
|
+
|
49
|
+
showMain();
|
50
|
+
preactRender(preact.h(StoryHarness, {
|
51
|
+
name,
|
52
|
+
title,
|
53
|
+
showError,
|
54
|
+
storyFn,
|
55
|
+
domElement
|
56
|
+
}), domElement);
|
57
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
2
|
+
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
4
|
+
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
|
+
|
7
|
+
import path from 'path';
|
8
|
+
import { findDistEsm } from '@storybook/core-common';
|
9
|
+
export function babelDefault(config) {
|
10
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
11
|
+
plugins: [...config.plugins, [require.resolve('@babel/plugin-transform-react-jsx'), {
|
12
|
+
pragma: 'h'
|
13
|
+
}, 'preset']]
|
14
|
+
});
|
15
|
+
}
|
16
|
+
export function webpackFinal(config) {
|
17
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
18
|
+
resolve: _objectSpread(_objectSpread({}, config.resolve), {}, {
|
19
|
+
alias: _objectSpread(_objectSpread({}, config.resolve.alias), {}, {
|
20
|
+
react: path.dirname(require.resolve('preact/compat/package.json')),
|
21
|
+
'react-dom/test-utils': path.dirname(require.resolve('preact/test-utils/package.json')),
|
22
|
+
'react-dom': path.dirname(require.resolve('preact/compat/package.json'))
|
23
|
+
})
|
24
|
+
})
|
25
|
+
});
|
26
|
+
}
|
27
|
+
export var config = function (entry = []) {
|
28
|
+
return [...entry, findDistEsm(__dirname, 'client/preview/config')];
|
29
|
+
};
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/// <reference types="webpack-env" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
import { ClientStoryApi, Loadable } from '@storybook/addons';
|
4
|
+
import './globals';
|
5
|
+
import { IStorybookSection } from './types';
|
6
|
+
import { PreactFramework } from './types-6-0';
|
7
|
+
export interface ClientApi extends ClientStoryApi<PreactFramework['storyResult']> {
|
8
|
+
setAddon(addon: any): void;
|
9
|
+
configure(loader: Loadable, module: NodeModule): void;
|
10
|
+
getStorybook(): IStorybookSection[];
|
11
|
+
clearDecorators(): void;
|
12
|
+
forceReRender(): void;
|
13
|
+
raw: () => any;
|
14
|
+
load: (...args: any[]) => void;
|
15
|
+
}
|
16
|
+
export declare const storiesOf: ClientApi['storiesOf'];
|
17
|
+
export declare const configure: ClientApi['configure'];
|
18
|
+
export declare const addDecorator: ClientApi['addDecorator'];
|
19
|
+
export declare const addParameters: ClientApi['addParameters'];
|
20
|
+
export declare const clearDecorators: ClientApi['clearDecorators'];
|
21
|
+
export declare const setAddon: ClientApi['setAddon'];
|
22
|
+
export declare const forceReRender: ClientApi['forceReRender'];
|
23
|
+
export declare const getStorybook: ClientApi['getStorybook'];
|
24
|
+
export declare const raw: ClientApi['raw'];
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { AnyComponent } from 'preact';
|
2
|
+
import { Args, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
|
3
|
+
import { StoryFnPreactReturnType } from './types';
|
4
|
+
export { Args, ArgTypes, Parameters, StoryContext } from '@storybook/csf';
|
5
|
+
export declare type PreactFramework = {
|
6
|
+
component: AnyComponent<any, any>;
|
7
|
+
storyResult: StoryFnPreactReturnType;
|
8
|
+
};
|
9
|
+
/**
|
10
|
+
* Metadata to configure the stories for a component.
|
11
|
+
*
|
12
|
+
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
13
|
+
*/
|
14
|
+
export declare type Meta<TArgs = Args> = ComponentAnnotations<PreactFramework, TArgs>;
|
15
|
+
/**
|
16
|
+
* Story function that represents a CSFv2 component example.
|
17
|
+
*
|
18
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
19
|
+
*/
|
20
|
+
export declare type StoryFn<TArgs = Args> = AnnotatedStoryFn<PreactFramework, TArgs>;
|
21
|
+
/**
|
22
|
+
* Story function that represents a CSFv3 component example.
|
23
|
+
*
|
24
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
25
|
+
*/
|
26
|
+
export declare type StoryObj<TArgs = Args> = StoryAnnotations<PreactFramework, TArgs>;
|
27
|
+
/**
|
28
|
+
* Story function that represents a CSFv2 component example.
|
29
|
+
*
|
30
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
31
|
+
*
|
32
|
+
* NOTE that in Storybook 7.0, this type will be renamed to `StoryFn` and replaced by the current `StoryObj` type.
|
33
|
+
*
|
34
|
+
*/
|
35
|
+
export declare type Story<TArgs = Args> = StoryFn<TArgs>;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { Args } from '@storybook/csf';
|
2
|
+
import { StoryObj } from './types-6-0';
|
3
|
+
export { StoryFn, StoryObj, Meta } from './types-6-0';
|
4
|
+
/**
|
5
|
+
* Story function that represents a CSFv3 component example.
|
6
|
+
*
|
7
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
8
|
+
*/
|
9
|
+
export declare type Story<TArgs = Args> = StoryObj<TArgs>;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export { RenderContext } from '@storybook/core';
|
2
|
+
export declare type StoryFnPreactReturnType = string | Node | preact.JSX.Element;
|
3
|
+
export interface ShowErrorArgs {
|
4
|
+
title: string;
|
5
|
+
description: string;
|
6
|
+
}
|
7
|
+
export interface IStorybookStory {
|
8
|
+
name: string;
|
9
|
+
render: (context: any) => any;
|
10
|
+
}
|
11
|
+
export interface IStorybookSection {
|
12
|
+
kind: string;
|
13
|
+
stories: IStorybookStory[];
|
14
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import { TransformOptions } from '@babel/core';
|
2
|
+
import { Configuration } from 'webpack';
|
3
|
+
import { StorybookConfig } from '@storybook/core-common';
|
4
|
+
export declare function babelDefault(config: TransformOptions): {
|
5
|
+
plugins: (string | object)[];
|
6
|
+
ast?: boolean;
|
7
|
+
auxiliaryCommentAfter?: string;
|
8
|
+
auxiliaryCommentBefore?: string;
|
9
|
+
root?: string;
|
10
|
+
rootMode?: "root" | "upward" | "upward-optional";
|
11
|
+
configFile?: string | boolean;
|
12
|
+
babelrc?: boolean;
|
13
|
+
babelrcRoots?: string | boolean | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
|
14
|
+
envName?: string;
|
15
|
+
exclude?: string | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
|
16
|
+
code?: boolean;
|
17
|
+
comments?: boolean;
|
18
|
+
compact?: boolean | "auto";
|
19
|
+
cwd?: string;
|
20
|
+
caller?: import("@babel/core").TransformCaller;
|
21
|
+
env?: {
|
22
|
+
[index: string]: TransformOptions;
|
23
|
+
};
|
24
|
+
extends?: string;
|
25
|
+
filename?: string;
|
26
|
+
filenameRelative?: string;
|
27
|
+
generatorOpts?: import("@babel/generator").GeneratorOptions;
|
28
|
+
getModuleId?: (moduleName: string) => string;
|
29
|
+
highlightCode?: boolean;
|
30
|
+
ignore?: import("@babel/core").MatchPattern[];
|
31
|
+
include?: string | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
|
32
|
+
inputSourceMap?: object;
|
33
|
+
minified?: boolean;
|
34
|
+
moduleId?: string;
|
35
|
+
moduleIds?: boolean;
|
36
|
+
moduleRoot?: string;
|
37
|
+
only?: import("@babel/core").MatchPattern[];
|
38
|
+
overrides?: TransformOptions[];
|
39
|
+
parserOpts?: import("@babel/parser").ParserOptions;
|
40
|
+
presets?: import("@babel/core").PluginItem[];
|
41
|
+
retainLines?: boolean;
|
42
|
+
shouldPrintComment?: (commentContents: string) => boolean;
|
43
|
+
sourceFileName?: string;
|
44
|
+
sourceMaps?: boolean | "inline" | "both";
|
45
|
+
sourceRoot?: string;
|
46
|
+
sourceType?: "script" | "module" | "unambiguous";
|
47
|
+
test?: string | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
|
48
|
+
wrapPluginVisitorMethod?: (pluginAlias: string, visitorType: "enter" | "exit", callback: (path: import("@babel/traverse").NodePath<import("@babel/types").Node>, state: any) => void) => (path: import("@babel/traverse").NodePath<import("@babel/types").Node>, state: any) => void;
|
49
|
+
};
|
50
|
+
export declare function webpackFinal(config: Configuration): {
|
51
|
+
resolve: {
|
52
|
+
alias: {
|
53
|
+
react: string;
|
54
|
+
'react-dom/test-utils': string;
|
55
|
+
'react-dom': string;
|
56
|
+
};
|
57
|
+
modules?: string[];
|
58
|
+
descriptionFiles?: string[];
|
59
|
+
mainFields?: string[] | string[][];
|
60
|
+
aliasFields?: string[] | string[][];
|
61
|
+
mainFiles?: string[];
|
62
|
+
extensions?: string[];
|
63
|
+
enforceExtension?: boolean;
|
64
|
+
unsafeCache?: boolean | {};
|
65
|
+
cachePredicate?(data: {
|
66
|
+
path: string;
|
67
|
+
request: string;
|
68
|
+
}): boolean;
|
69
|
+
plugins?: import("webpack").ResolvePlugin[];
|
70
|
+
symlinks?: boolean;
|
71
|
+
cacheWithContext?: boolean;
|
72
|
+
roots?: string[];
|
73
|
+
};
|
74
|
+
mode?: "development" | "production" | "none";
|
75
|
+
name?: string;
|
76
|
+
context?: string;
|
77
|
+
entry?: string | string[] | import("webpack").Entry | import("webpack").EntryFunc;
|
78
|
+
devtool?: import("webpack").Options.Devtool;
|
79
|
+
output?: import("webpack").Output;
|
80
|
+
module?: import("webpack").Module;
|
81
|
+
resolveLoader?: import("webpack").ResolveLoader;
|
82
|
+
externals?: string | RegExp | import("webpack").ExternalsObjectElement | import("webpack").ExternalsFunctionElement | import("webpack").ExternalsElement[];
|
83
|
+
target?: "node" | "web" | "webworker" | "async-node" | "node-webkit" | "atom" | "electron" | "electron-renderer" | "electron-preload" | "electron-main" | ((compiler?: any) => void);
|
84
|
+
bail?: boolean;
|
85
|
+
profile?: boolean;
|
86
|
+
cache?: boolean | object;
|
87
|
+
watch?: boolean;
|
88
|
+
watchOptions?: import("webpack").ICompiler.WatchOptions;
|
89
|
+
node?: false | import("webpack").Node;
|
90
|
+
amd?: {
|
91
|
+
[moduleName: string]: boolean;
|
92
|
+
};
|
93
|
+
recordsPath?: string;
|
94
|
+
recordsInputPath?: string;
|
95
|
+
recordsOutputPath?: string;
|
96
|
+
plugins?: import("webpack").Plugin[];
|
97
|
+
stats?: import("webpack").Stats.ToStringOptions;
|
98
|
+
performance?: false | import("webpack").Options.Performance;
|
99
|
+
parallelism?: number;
|
100
|
+
optimization?: import("webpack").Options.Optimization;
|
101
|
+
};
|
102
|
+
export declare const config: StorybookConfig['config'];
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/// <reference types="webpack-env" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
import { ClientStoryApi, Loadable } from '@storybook/addons';
|
4
|
+
import './globals';
|
5
|
+
import { IStorybookSection } from './types';
|
6
|
+
import { PreactFramework } from './types-6-0';
|
7
|
+
export interface ClientApi extends ClientStoryApi<PreactFramework['storyResult']> {
|
8
|
+
setAddon(addon: any): void;
|
9
|
+
configure(loader: Loadable, module: NodeModule): void;
|
10
|
+
getStorybook(): IStorybookSection[];
|
11
|
+
clearDecorators(): void;
|
12
|
+
forceReRender(): void;
|
13
|
+
raw: () => any;
|
14
|
+
load: (...args: any[]) => void;
|
15
|
+
}
|
16
|
+
export declare const storiesOf: ClientApi['storiesOf'];
|
17
|
+
export declare const configure: ClientApi['configure'];
|
18
|
+
export declare const addDecorator: ClientApi['addDecorator'];
|
19
|
+
export declare const addParameters: ClientApi['addParameters'];
|
20
|
+
export declare const clearDecorators: ClientApi['clearDecorators'];
|
21
|
+
export declare const setAddon: ClientApi['setAddon'];
|
22
|
+
export declare const forceReRender: ClientApi['forceReRender'];
|
23
|
+
export declare const getStorybook: ClientApi['getStorybook'];
|
24
|
+
export declare const raw: ClientApi['raw'];
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { AnyComponent } from 'preact';
|
2
|
+
import { Args, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
|
3
|
+
import { StoryFnPreactReturnType } from './types';
|
4
|
+
export type { Args, ArgTypes, Parameters, StoryContext } from '@storybook/csf';
|
5
|
+
export declare type PreactFramework = {
|
6
|
+
component: AnyComponent<any, any>;
|
7
|
+
storyResult: StoryFnPreactReturnType;
|
8
|
+
};
|
9
|
+
/**
|
10
|
+
* Metadata to configure the stories for a component.
|
11
|
+
*
|
12
|
+
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
13
|
+
*/
|
14
|
+
export declare type Meta<TArgs = Args> = ComponentAnnotations<PreactFramework, TArgs>;
|
15
|
+
/**
|
16
|
+
* Story function that represents a CSFv2 component example.
|
17
|
+
*
|
18
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
19
|
+
*/
|
20
|
+
export declare type StoryFn<TArgs = Args> = AnnotatedStoryFn<PreactFramework, TArgs>;
|
21
|
+
/**
|
22
|
+
* Story function that represents a CSFv3 component example.
|
23
|
+
*
|
24
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
25
|
+
*/
|
26
|
+
export declare type StoryObj<TArgs = Args> = StoryAnnotations<PreactFramework, TArgs>;
|
27
|
+
/**
|
28
|
+
* Story function that represents a CSFv2 component example.
|
29
|
+
*
|
30
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
31
|
+
*
|
32
|
+
* NOTE that in Storybook 7.0, this type will be renamed to `StoryFn` and replaced by the current `StoryObj` type.
|
33
|
+
*
|
34
|
+
*/
|
35
|
+
export declare type Story<TArgs = Args> = StoryFn<TArgs>;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { Args } from '@storybook/csf';
|
2
|
+
import type { StoryObj } from './types-6-0';
|
3
|
+
export type { StoryFn, StoryObj, Meta } from './types-6-0';
|
4
|
+
/**
|
5
|
+
* Story function that represents a CSFv3 component example.
|
6
|
+
*
|
7
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
8
|
+
*/
|
9
|
+
export declare type Story<TArgs = Args> = StoryObj<TArgs>;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export type { RenderContext } from '@storybook/core';
|
2
|
+
export declare type StoryFnPreactReturnType = string | Node | preact.JSX.Element;
|
3
|
+
export interface ShowErrorArgs {
|
4
|
+
title: string;
|
5
|
+
description: string;
|
6
|
+
}
|
7
|
+
export interface IStorybookStory {
|
8
|
+
name: string;
|
9
|
+
render: (context: any) => any;
|
10
|
+
}
|
11
|
+
export interface IStorybookSection {
|
12
|
+
kind: string;
|
13
|
+
stories: IStorybookStory[];
|
14
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import { TransformOptions } from '@babel/core';
|
2
|
+
import { Configuration } from 'webpack';
|
3
|
+
import { StorybookConfig } from '@storybook/core-common';
|
4
|
+
export declare function babelDefault(config: TransformOptions): {
|
5
|
+
plugins: (string | object)[];
|
6
|
+
ast?: boolean;
|
7
|
+
auxiliaryCommentAfter?: string;
|
8
|
+
auxiliaryCommentBefore?: string;
|
9
|
+
root?: string;
|
10
|
+
rootMode?: "root" | "upward" | "upward-optional";
|
11
|
+
configFile?: string | boolean;
|
12
|
+
babelrc?: boolean;
|
13
|
+
babelrcRoots?: string | boolean | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
|
14
|
+
envName?: string;
|
15
|
+
exclude?: string | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
|
16
|
+
code?: boolean;
|
17
|
+
comments?: boolean;
|
18
|
+
compact?: boolean | "auto";
|
19
|
+
cwd?: string;
|
20
|
+
caller?: import("@babel/core").TransformCaller;
|
21
|
+
env?: {
|
22
|
+
[index: string]: TransformOptions;
|
23
|
+
};
|
24
|
+
extends?: string;
|
25
|
+
filename?: string;
|
26
|
+
filenameRelative?: string;
|
27
|
+
generatorOpts?: import("@babel/generator").GeneratorOptions;
|
28
|
+
getModuleId?: (moduleName: string) => string;
|
29
|
+
highlightCode?: boolean;
|
30
|
+
ignore?: import("@babel/core").MatchPattern[];
|
31
|
+
include?: string | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
|
32
|
+
inputSourceMap?: object;
|
33
|
+
minified?: boolean;
|
34
|
+
moduleId?: string;
|
35
|
+
moduleIds?: boolean;
|
36
|
+
moduleRoot?: string;
|
37
|
+
only?: import("@babel/core").MatchPattern[];
|
38
|
+
overrides?: TransformOptions[];
|
39
|
+
parserOpts?: import("@babel/parser").ParserOptions;
|
40
|
+
presets?: import("@babel/core").PluginItem[];
|
41
|
+
retainLines?: boolean;
|
42
|
+
shouldPrintComment?: (commentContents: string) => boolean;
|
43
|
+
sourceFileName?: string;
|
44
|
+
sourceMaps?: boolean | "inline" | "both";
|
45
|
+
sourceRoot?: string;
|
46
|
+
sourceType?: "script" | "module" | "unambiguous";
|
47
|
+
test?: string | RegExp | ((filename: string, context: import("@babel/core").MatchPatternContext) => boolean) | import("@babel/core").MatchPattern[];
|
48
|
+
wrapPluginVisitorMethod?: (pluginAlias: string, visitorType: "enter" | "exit", callback: (path: import("@babel/traverse").NodePath<import("@babel/types").Node>, state: any) => void) => (path: import("@babel/traverse").NodePath<import("@babel/types").Node>, state: any) => void;
|
49
|
+
};
|
50
|
+
export declare function webpackFinal(config: Configuration): {
|
51
|
+
resolve: {
|
52
|
+
alias: {
|
53
|
+
react: string;
|
54
|
+
'react-dom/test-utils': string;
|
55
|
+
'react-dom': string;
|
56
|
+
};
|
57
|
+
modules?: string[];
|
58
|
+
descriptionFiles?: string[];
|
59
|
+
mainFields?: string[] | string[][];
|
60
|
+
aliasFields?: string[] | string[][];
|
61
|
+
mainFiles?: string[];
|
62
|
+
extensions?: string[];
|
63
|
+
enforceExtension?: boolean;
|
64
|
+
unsafeCache?: boolean | {};
|
65
|
+
cachePredicate?(data: {
|
66
|
+
path: string;
|
67
|
+
request: string;
|
68
|
+
}): boolean;
|
69
|
+
plugins?: import("webpack").ResolvePlugin[];
|
70
|
+
symlinks?: boolean;
|
71
|
+
cacheWithContext?: boolean;
|
72
|
+
roots?: string[];
|
73
|
+
};
|
74
|
+
mode?: "development" | "production" | "none";
|
75
|
+
name?: string;
|
76
|
+
context?: string;
|
77
|
+
entry?: string | string[] | import("webpack").Entry | import("webpack").EntryFunc;
|
78
|
+
devtool?: import("webpack").Options.Devtool;
|
79
|
+
output?: import("webpack").Output;
|
80
|
+
module?: import("webpack").Module;
|
81
|
+
resolveLoader?: import("webpack").ResolveLoader;
|
82
|
+
externals?: string | RegExp | import("webpack").ExternalsObjectElement | import("webpack").ExternalsFunctionElement | import("webpack").ExternalsElement[];
|
83
|
+
target?: "node" | "web" | "webworker" | "async-node" | "node-webkit" | "atom" | "electron" | "electron-renderer" | "electron-preload" | "electron-main" | ((compiler?: any) => void);
|
84
|
+
bail?: boolean;
|
85
|
+
profile?: boolean;
|
86
|
+
cache?: boolean | object;
|
87
|
+
watch?: boolean;
|
88
|
+
watchOptions?: import("webpack").ICompiler.WatchOptions;
|
89
|
+
node?: false | import("webpack").Node;
|
90
|
+
amd?: {
|
91
|
+
[moduleName: string]: boolean;
|
92
|
+
};
|
93
|
+
recordsPath?: string;
|
94
|
+
recordsInputPath?: string;
|
95
|
+
recordsOutputPath?: string;
|
96
|
+
plugins?: import("webpack").Plugin[];
|
97
|
+
stats?: import("webpack").Stats.ToStringOptions;
|
98
|
+
performance?: false | import("webpack").Options.Performance;
|
99
|
+
parallelism?: number;
|
100
|
+
optimization?: import("webpack").Options.Optimization;
|
101
|
+
};
|
102
|
+
export declare const config: StorybookConfig['config'];
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@storybook/preact",
|
3
|
-
"version": "6.4.0-beta.
|
3
|
+
"version": "6.4.0-beta.28",
|
4
4
|
"description": "Storybook for Preact: Develop Preact Component in isolation.",
|
5
5
|
"keywords": [
|
6
6
|
"storybook"
|
@@ -46,11 +46,11 @@
|
|
46
46
|
},
|
47
47
|
"dependencies": {
|
48
48
|
"@babel/plugin-transform-react-jsx": "^7.12.12",
|
49
|
-
"@storybook/addons": "6.4.0-beta.
|
50
|
-
"@storybook/core": "6.4.0-beta.
|
51
|
-
"@storybook/core-common": "6.4.0-beta.
|
49
|
+
"@storybook/addons": "6.4.0-beta.28",
|
50
|
+
"@storybook/core": "6.4.0-beta.28",
|
51
|
+
"@storybook/core-common": "6.4.0-beta.28",
|
52
52
|
"@storybook/csf": "0.0.2--canary.87bc651.0",
|
53
|
-
"@storybook/store": "6.4.0-beta.
|
53
|
+
"@storybook/store": "6.4.0-beta.28",
|
54
54
|
"@types/webpack-env": "^1.16.0",
|
55
55
|
"core-js": "^3.8.2",
|
56
56
|
"global": "^4.4.0",
|
@@ -74,6 +74,6 @@
|
|
74
74
|
"publishConfig": {
|
75
75
|
"access": "public"
|
76
76
|
},
|
77
|
-
"gitHead": "
|
77
|
+
"gitHead": "72316abb8354d1f84d2bf8f645b18aeb315768c3",
|
78
78
|
"sbmodern": "dist/modern/client/index.js"
|
79
79
|
}
|