@storybook/preact 6.4.0-alpha.4 → 6.4.0-alpha.40
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/preview/config.js +19 -0
- package/dist/cjs/client/preview/index.js +2 -4
- package/dist/cjs/client/preview/render.js +17 -20
- package/dist/cjs/client/preview/types-7-0.js +1 -0
- package/dist/esm/client/preview/config.js +4 -0
- package/dist/esm/client/preview/index.js +2 -2
- package/dist/esm/client/preview/render.js +16 -18
- package/dist/esm/client/preview/types-7-0.js +0 -0
- package/dist/modern/client/preview/config.js +4 -0
- package/dist/modern/client/preview/index.js +2 -2
- package/dist/modern/client/preview/render.js +17 -21
- package/dist/modern/client/preview/types-7-0.js +0 -0
- package/dist/ts3.4/client/preview/config.d.ts +4 -0
- package/dist/ts3.4/client/preview/index.d.ts +14 -1
- package/dist/ts3.4/client/preview/render.d.ts +3 -2
- package/dist/ts3.4/client/preview/types-6-0.d.ts +24 -7
- package/dist/ts3.4/client/preview/types-7-0.d.ts +9 -0
- package/dist/ts3.4/client/preview/types.d.ts +1 -13
- package/dist/ts3.9/client/preview/config.d.ts +4 -0
- package/dist/ts3.9/client/preview/index.d.ts +14 -1
- package/dist/ts3.9/client/preview/render.d.ts +3 -2
- package/dist/ts3.9/client/preview/types-6-0.d.ts +24 -7
- package/dist/ts3.9/client/preview/types-7-0.d.ts +9 -0
- package/dist/ts3.9/client/preview/types.d.ts +1 -13
- package/package.json +9 -7
- package/preset.js +7 -0
@@ -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;
|
@@ -11,13 +11,11 @@ var _client = require("@storybook/core/client");
|
|
11
11
|
|
12
12
|
require("./globals");
|
13
13
|
|
14
|
-
var _render =
|
15
|
-
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
+
var _render = require("./render");
|
17
15
|
|
18
16
|
/* eslint-disable prefer-destructuring */
|
19
17
|
var framework = 'preact';
|
20
|
-
var api = (0, _client.start)(_render.
|
18
|
+
var api = (0, _client.start)(_render.renderToDOM);
|
21
19
|
|
22
20
|
var storiesOf = function storiesOf(kind, m) {
|
23
21
|
return api.clientApi.storiesOf(kind, m).addParameters({
|
@@ -27,7 +27,7 @@ require("core-js/modules/es.symbol.iterator.js");
|
|
27
27
|
Object.defineProperty(exports, "__esModule", {
|
28
28
|
value: true
|
29
29
|
});
|
30
|
-
exports.
|
30
|
+
exports.renderToDOM = renderToDOM;
|
31
31
|
|
32
32
|
require("core-js/modules/es.function.name.js");
|
33
33
|
|
@@ -35,8 +35,6 @@ require("core-js/modules/es.array.concat.js");
|
|
35
35
|
|
36
36
|
var preact = _interopRequireWildcard(require("preact"));
|
37
37
|
|
38
|
-
var _global = _interopRequireDefault(require("global"));
|
39
|
-
|
40
38
|
var _tsDedent = _interopRequireDefault(require("ts-dedent"));
|
41
39
|
|
42
40
|
var _templateObject;
|
@@ -49,29 +47,28 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
49
47
|
|
50
48
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
51
49
|
|
52
|
-
var document = _global.default.document;
|
53
|
-
var rootElement = document ? document.getElementById('root') : null;
|
54
50
|
var renderedStory;
|
55
51
|
|
56
|
-
function preactRender(story) {
|
52
|
+
function preactRender(story, domElement) {
|
57
53
|
if (preact.Fragment) {
|
58
54
|
// Preact 10 only:
|
59
|
-
preact.render(story,
|
55
|
+
preact.render(story, domElement);
|
60
56
|
} else {
|
61
|
-
renderedStory = preact.render(story,
|
57
|
+
renderedStory = preact.render(story, domElement, renderedStory);
|
62
58
|
}
|
63
59
|
}
|
64
60
|
|
65
61
|
var StoryHarness = function StoryHarness(_ref) {
|
66
62
|
var showError = _ref.showError,
|
67
63
|
name = _ref.name,
|
68
|
-
|
69
|
-
storyFn = _ref.storyFn
|
64
|
+
title = _ref.title,
|
65
|
+
storyFn = _ref.storyFn,
|
66
|
+
domElement = _ref.domElement;
|
70
67
|
var content = preact.h(storyFn, null);
|
71
68
|
|
72
69
|
if (!content) {
|
73
70
|
showError({
|
74
|
-
title: "Expecting a Preact element from the story: \"".concat(name, "\" of \"").concat(
|
71
|
+
title: "Expecting a Preact element from the story: \"".concat(name, "\" of \"").concat(title, "\"."),
|
75
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 "])))
|
76
73
|
});
|
77
74
|
return null;
|
@@ -80,24 +77,24 @@ var StoryHarness = function StoryHarness(_ref) {
|
|
80
77
|
return content;
|
81
78
|
};
|
82
79
|
|
83
|
-
function
|
80
|
+
function renderToDOM(_ref2, domElement) {
|
84
81
|
var storyFn = _ref2.storyFn,
|
85
|
-
|
82
|
+
title = _ref2.title,
|
86
83
|
name = _ref2.name,
|
87
84
|
showMain = _ref2.showMain,
|
88
85
|
showError = _ref2.showError,
|
89
|
-
|
86
|
+
forceRemount = _ref2.forceRemount;
|
90
87
|
|
91
|
-
|
92
|
-
|
93
|
-
preactRender(null);
|
88
|
+
if (forceRemount) {
|
89
|
+
preactRender(null, domElement);
|
94
90
|
}
|
95
91
|
|
96
92
|
showMain();
|
97
93
|
preactRender(preact.h(StoryHarness, {
|
98
94
|
name: name,
|
99
|
-
|
95
|
+
title: title,
|
100
96
|
showError: showError,
|
101
|
-
storyFn: storyFn
|
102
|
-
|
97
|
+
storyFn: storyFn,
|
98
|
+
domElement: domElement
|
99
|
+
}), domElement);
|
103
100
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -3,9 +3,9 @@ import "core-js/modules/es.array.concat.js";
|
|
3
3
|
/* eslint-disable prefer-destructuring */
|
4
4
|
import { start } from '@storybook/core/client';
|
5
5
|
import './globals';
|
6
|
-
import
|
6
|
+
import { renderToDOM } from './render';
|
7
7
|
var framework = 'preact';
|
8
|
-
var api = start(
|
8
|
+
var api = start(renderToDOM);
|
9
9
|
export var storiesOf = function storiesOf(kind, m) {
|
10
10
|
return api.clientApi.storiesOf(kind, m).addParameters({
|
11
11
|
framework: framework
|
@@ -7,31 +7,29 @@ import "core-js/modules/es.array.concat.js";
|
|
7
7
|
import "core-js/modules/es.array.slice.js";
|
8
8
|
import "core-js/modules/es.object.freeze.js";
|
9
9
|
import * as preact from 'preact';
|
10
|
-
import global from 'global';
|
11
10
|
import dedent from 'ts-dedent';
|
12
|
-
var document = global.document;
|
13
|
-
var rootElement = document ? document.getElementById('root') : null;
|
14
11
|
var renderedStory;
|
15
12
|
|
16
|
-
function preactRender(story) {
|
13
|
+
function preactRender(story, domElement) {
|
17
14
|
if (preact.Fragment) {
|
18
15
|
// Preact 10 only:
|
19
|
-
preact.render(story,
|
16
|
+
preact.render(story, domElement);
|
20
17
|
} else {
|
21
|
-
renderedStory = preact.render(story,
|
18
|
+
renderedStory = preact.render(story, domElement, renderedStory);
|
22
19
|
}
|
23
20
|
}
|
24
21
|
|
25
22
|
var StoryHarness = function StoryHarness(_ref) {
|
26
23
|
var showError = _ref.showError,
|
27
24
|
name = _ref.name,
|
28
|
-
|
29
|
-
storyFn = _ref.storyFn
|
25
|
+
title = _ref.title,
|
26
|
+
storyFn = _ref.storyFn,
|
27
|
+
domElement = _ref.domElement;
|
30
28
|
var content = preact.h(storyFn, null);
|
31
29
|
|
32
30
|
if (!content) {
|
33
31
|
showError({
|
34
|
-
title: "Expecting a Preact element from the story: \"".concat(name, "\" of \"").concat(
|
32
|
+
title: "Expecting a Preact element from the story: \"".concat(name, "\" of \"").concat(title, "\"."),
|
35
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 "])))
|
36
34
|
});
|
37
35
|
return null;
|
@@ -40,24 +38,24 @@ var StoryHarness = function StoryHarness(_ref) {
|
|
40
38
|
return content;
|
41
39
|
};
|
42
40
|
|
43
|
-
export
|
41
|
+
export function renderToDOM(_ref2, domElement) {
|
44
42
|
var storyFn = _ref2.storyFn,
|
45
|
-
|
43
|
+
title = _ref2.title,
|
46
44
|
name = _ref2.name,
|
47
45
|
showMain = _ref2.showMain,
|
48
46
|
showError = _ref2.showError,
|
49
|
-
|
47
|
+
forceRemount = _ref2.forceRemount;
|
50
48
|
|
51
|
-
|
52
|
-
|
53
|
-
preactRender(null);
|
49
|
+
if (forceRemount) {
|
50
|
+
preactRender(null, domElement);
|
54
51
|
}
|
55
52
|
|
56
53
|
showMain();
|
57
54
|
preactRender(preact.h(StoryHarness, {
|
58
55
|
name: name,
|
59
|
-
|
56
|
+
title: title,
|
60
57
|
showError: showError,
|
61
|
-
storyFn: storyFn
|
62
|
-
|
58
|
+
storyFn: storyFn,
|
59
|
+
domElement: domElement
|
60
|
+
}), domElement);
|
63
61
|
}
|
File without changes
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/* eslint-disable prefer-destructuring */
|
2
2
|
import { start } from '@storybook/core/client';
|
3
3
|
import './globals';
|
4
|
-
import
|
4
|
+
import { renderToDOM } from './render';
|
5
5
|
const framework = 'preact';
|
6
|
-
const api = start(
|
6
|
+
const api = start(renderToDOM);
|
7
7
|
export const storiesOf = (kind, m) => {
|
8
8
|
return api.clientApi.storiesOf(kind, m).addParameters({
|
9
9
|
framework
|
@@ -1,32 +1,28 @@
|
|
1
1
|
import * as preact from 'preact';
|
2
|
-
import global from 'global';
|
3
2
|
import dedent from 'ts-dedent';
|
4
|
-
const {
|
5
|
-
document
|
6
|
-
} = global;
|
7
|
-
const rootElement = document ? document.getElementById('root') : null;
|
8
3
|
let renderedStory;
|
9
4
|
|
10
|
-
function preactRender(story) {
|
5
|
+
function preactRender(story, domElement) {
|
11
6
|
if (preact.Fragment) {
|
12
7
|
// Preact 10 only:
|
13
|
-
preact.render(story,
|
8
|
+
preact.render(story, domElement);
|
14
9
|
} else {
|
15
|
-
renderedStory = preact.render(story,
|
10
|
+
renderedStory = preact.render(story, domElement, renderedStory);
|
16
11
|
}
|
17
12
|
}
|
18
13
|
|
19
14
|
const StoryHarness = ({
|
20
15
|
showError,
|
21
16
|
name,
|
22
|
-
|
23
|
-
storyFn
|
17
|
+
title,
|
18
|
+
storyFn,
|
19
|
+
domElement
|
24
20
|
}) => {
|
25
21
|
const content = preact.h(storyFn, null);
|
26
22
|
|
27
23
|
if (!content) {
|
28
24
|
showError({
|
29
|
-
title: `Expecting a Preact element from the story: "${name}" of "${
|
25
|
+
title: `Expecting a Preact element from the story: "${name}" of "${title}".`,
|
30
26
|
description: dedent`
|
31
27
|
Did you forget to return the Preact element from the story?
|
32
28
|
Use "() => (<MyComp/>)" or "() => { return <MyComp/>; }" when defining the story.
|
@@ -38,24 +34,24 @@ const StoryHarness = ({
|
|
38
34
|
return content;
|
39
35
|
};
|
40
36
|
|
41
|
-
export
|
37
|
+
export function renderToDOM({
|
42
38
|
storyFn,
|
43
|
-
|
39
|
+
title,
|
44
40
|
name,
|
45
41
|
showMain,
|
46
42
|
showError,
|
47
|
-
|
48
|
-
}) {
|
49
|
-
|
50
|
-
|
51
|
-
preactRender(null);
|
43
|
+
forceRemount
|
44
|
+
}, domElement) {
|
45
|
+
if (forceRemount) {
|
46
|
+
preactRender(null, domElement);
|
52
47
|
}
|
53
48
|
|
54
49
|
showMain();
|
55
50
|
preactRender(preact.h(StoryHarness, {
|
56
51
|
name,
|
57
|
-
|
52
|
+
title,
|
58
53
|
showError,
|
59
|
-
storyFn
|
60
|
-
|
54
|
+
storyFn,
|
55
|
+
domElement
|
56
|
+
}), domElement);
|
61
57
|
}
|
File without changes
|
@@ -1,5 +1,18 @@
|
|
1
|
+
/// <reference types="webpack-env" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
import { ClientStoryApi, Loadable } from '@storybook/addons';
|
1
4
|
import './globals';
|
2
|
-
import {
|
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
|
+
}
|
3
16
|
export declare const storiesOf: ClientApi['storiesOf'];
|
4
17
|
export declare const configure: ClientApi['configure'];
|
5
18
|
export declare const addDecorator: ClientApi['addDecorator'];
|
@@ -1,2 +1,3 @@
|
|
1
|
-
import { RenderContext } from '
|
2
|
-
|
1
|
+
import { RenderContext } from '@storybook/store';
|
2
|
+
import { PreactFramework } from './types-6-0';
|
3
|
+
export declare function renderToDOM({ storyFn, title, name, showMain, showError, forceRemount }: RenderContext<PreactFramework>, domElement: HTMLElement): void;
|
@@ -1,18 +1,35 @@
|
|
1
1
|
import { AnyComponent } from 'preact';
|
2
|
-
import { Args
|
2
|
+
import { Args, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
|
3
3
|
import { StoryFnPreactReturnType } from './types';
|
4
|
-
export { Args, ArgTypes, Parameters, StoryContext } from '@storybook/
|
5
|
-
declare type
|
6
|
-
|
4
|
+
export { Args, ArgTypes, Parameters, StoryContext } from '@storybook/csf';
|
5
|
+
export declare type PreactFramework = {
|
6
|
+
component: AnyComponent<any, any>;
|
7
|
+
storyResult: StoryFnPreactReturnType;
|
8
|
+
};
|
7
9
|
/**
|
8
10
|
* Metadata to configure the stories for a component.
|
9
11
|
*
|
10
12
|
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
11
13
|
*/
|
12
|
-
export declare type Meta<
|
14
|
+
export declare type Meta<TArgs = Args> = ComponentAnnotations<PreactFramework, TArgs>;
|
13
15
|
/**
|
14
|
-
* Story function that represents a component example.
|
16
|
+
* Story function that represents a CSFv2 component example.
|
15
17
|
*
|
16
18
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
17
19
|
*/
|
18
|
-
export declare type
|
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>;
|
@@ -1,6 +1,3 @@
|
|
1
|
-
/// <reference types="webpack-env" />
|
2
|
-
/// <reference types="node" />
|
3
|
-
import { ClientStoryApi, Loadable } from '@storybook/addons';
|
4
1
|
export { RenderContext } from '@storybook/core';
|
5
2
|
export declare type StoryFnPreactReturnType = string | Node | preact.JSX.Element;
|
6
3
|
export interface ShowErrorArgs {
|
@@ -9,18 +6,9 @@ export interface ShowErrorArgs {
|
|
9
6
|
}
|
10
7
|
export interface IStorybookStory {
|
11
8
|
name: string;
|
12
|
-
render: () => any;
|
9
|
+
render: (context: any) => any;
|
13
10
|
}
|
14
11
|
export interface IStorybookSection {
|
15
12
|
kind: string;
|
16
13
|
stories: IStorybookStory[];
|
17
14
|
}
|
18
|
-
export interface ClientApi extends ClientStoryApi<StoryFnPreactReturnType> {
|
19
|
-
setAddon(addon: any): void;
|
20
|
-
configure(loader: Loadable, module: NodeModule): void;
|
21
|
-
getStorybook(): IStorybookSection[];
|
22
|
-
clearDecorators(): void;
|
23
|
-
forceReRender(): void;
|
24
|
-
raw: () => any;
|
25
|
-
load: (...args: any[]) => void;
|
26
|
-
}
|
@@ -1,5 +1,18 @@
|
|
1
|
+
/// <reference types="webpack-env" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
import { ClientStoryApi, Loadable } from '@storybook/addons';
|
1
4
|
import './globals';
|
2
|
-
import {
|
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
|
+
}
|
3
16
|
export declare const storiesOf: ClientApi['storiesOf'];
|
4
17
|
export declare const configure: ClientApi['configure'];
|
5
18
|
export declare const addDecorator: ClientApi['addDecorator'];
|
@@ -1,2 +1,3 @@
|
|
1
|
-
import { RenderContext } from '
|
2
|
-
|
1
|
+
import { RenderContext } from '@storybook/store';
|
2
|
+
import { PreactFramework } from './types-6-0';
|
3
|
+
export declare function renderToDOM({ storyFn, title, name, showMain, showError, forceRemount }: RenderContext<PreactFramework>, domElement: HTMLElement): void;
|
@@ -1,18 +1,35 @@
|
|
1
1
|
import { AnyComponent } from 'preact';
|
2
|
-
import { Args
|
2
|
+
import { Args, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
|
3
3
|
import { StoryFnPreactReturnType } from './types';
|
4
|
-
export type { Args, ArgTypes, Parameters, StoryContext } from '@storybook/
|
5
|
-
declare type
|
6
|
-
|
4
|
+
export type { Args, ArgTypes, Parameters, StoryContext } from '@storybook/csf';
|
5
|
+
export declare type PreactFramework = {
|
6
|
+
component: AnyComponent<any, any>;
|
7
|
+
storyResult: StoryFnPreactReturnType;
|
8
|
+
};
|
7
9
|
/**
|
8
10
|
* Metadata to configure the stories for a component.
|
9
11
|
*
|
10
12
|
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
11
13
|
*/
|
12
|
-
export declare type Meta<
|
14
|
+
export declare type Meta<TArgs = Args> = ComponentAnnotations<PreactFramework, TArgs>;
|
13
15
|
/**
|
14
|
-
* Story function that represents a component example.
|
16
|
+
* Story function that represents a CSFv2 component example.
|
15
17
|
*
|
16
18
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
17
19
|
*/
|
18
|
-
export declare type
|
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>;
|
@@ -1,6 +1,3 @@
|
|
1
|
-
/// <reference types="webpack-env" />
|
2
|
-
/// <reference types="node" />
|
3
|
-
import { ClientStoryApi, Loadable } from '@storybook/addons';
|
4
1
|
export type { RenderContext } from '@storybook/core';
|
5
2
|
export declare type StoryFnPreactReturnType = string | Node | preact.JSX.Element;
|
6
3
|
export interface ShowErrorArgs {
|
@@ -9,18 +6,9 @@ export interface ShowErrorArgs {
|
|
9
6
|
}
|
10
7
|
export interface IStorybookStory {
|
11
8
|
name: string;
|
12
|
-
render: () => any;
|
9
|
+
render: (context: any) => any;
|
13
10
|
}
|
14
11
|
export interface IStorybookSection {
|
15
12
|
kind: string;
|
16
13
|
stories: IStorybookStory[];
|
17
14
|
}
|
18
|
-
export interface ClientApi extends ClientStoryApi<StoryFnPreactReturnType> {
|
19
|
-
setAddon(addon: any): void;
|
20
|
-
configure(loader: Loadable, module: NodeModule): void;
|
21
|
-
getStorybook(): IStorybookSection[];
|
22
|
-
clearDecorators(): void;
|
23
|
-
forceReRender(): void;
|
24
|
-
raw: () => any;
|
25
|
-
load: (...args: any[]) => void;
|
26
|
-
}
|
package/package.json
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "@storybook/preact",
|
3
|
-
"version": "6.4.0-alpha.
|
3
|
+
"version": "6.4.0-alpha.40",
|
4
4
|
"description": "Storybook for Preact: Develop Preact Component in isolation.",
|
5
5
|
"keywords": [
|
6
6
|
"storybook"
|
7
7
|
],
|
8
|
-
"homepage": "https://github.com/storybookjs/storybook/tree/
|
8
|
+
"homepage": "https://github.com/storybookjs/storybook/tree/main/app/preact",
|
9
9
|
"bugs": {
|
10
10
|
"url": "https://github.com/storybookjs/storybook/issues"
|
11
11
|
},
|
@@ -24,7 +24,7 @@
|
|
24
24
|
"types": "dist/ts3.9/client/index.d.ts",
|
25
25
|
"typesVersions": {
|
26
26
|
"<3.8": {
|
27
|
-
"
|
27
|
+
"dist/ts3.9/*": [
|
28
28
|
"dist/ts3.4/*"
|
29
29
|
]
|
30
30
|
}
|
@@ -46,9 +46,11 @@
|
|
46
46
|
},
|
47
47
|
"dependencies": {
|
48
48
|
"@babel/plugin-transform-react-jsx": "^7.12.12",
|
49
|
-
"@storybook/addons": "6.4.0-alpha.
|
50
|
-
"@storybook/core": "6.4.0-alpha.
|
51
|
-
"@storybook/core-common": "6.4.0-alpha.
|
49
|
+
"@storybook/addons": "6.4.0-alpha.40",
|
50
|
+
"@storybook/core": "6.4.0-alpha.40",
|
51
|
+
"@storybook/core-common": "6.4.0-alpha.40",
|
52
|
+
"@storybook/csf": "0.0.2--canary.6aca495.0",
|
53
|
+
"@storybook/store": "6.4.0-alpha.40",
|
52
54
|
"@types/webpack-env": "^1.16.0",
|
53
55
|
"core-js": "^3.8.2",
|
54
56
|
"global": "^4.4.0",
|
@@ -72,6 +74,6 @@
|
|
72
74
|
"publishConfig": {
|
73
75
|
"access": "public"
|
74
76
|
},
|
75
|
-
"gitHead": "
|
77
|
+
"gitHead": "6b767d7c8f81b45cccd89a224223963fa751ad91",
|
76
78
|
"sbmodern": "dist/modern/client/index.js"
|
77
79
|
}
|