@storybook/react-native 6.5.5 → 6.5.6-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +125 -18
- package/dist/index.js +1591 -41
- package/package.json +7 -8
- package/dist/constants.d.ts +0 -5
- package/dist/constants.js +0 -8
- package/dist/hooks.d.ts +0 -67
- package/dist/hooks.js +0 -168
- package/dist/preview/View.d.ts +0 -50
- package/dist/preview/View.js +0 -183
- package/dist/preview/components/OnDeviceUI/OnDeviceUI.d.ts +0 -12
- package/dist/preview/components/OnDeviceUI/OnDeviceUI.js +0 -163
- package/dist/preview/components/OnDeviceUI/Panel.d.ts +0 -9
- package/dist/preview/components/OnDeviceUI/Panel.js +0 -28
- package/dist/preview/components/OnDeviceUI/absolute-positioned-keyboard-aware-view.d.ts +0 -12
- package/dist/preview/components/OnDeviceUI/absolute-positioned-keyboard-aware-view.js +0 -31
- package/dist/preview/components/OnDeviceUI/addons/Addons.d.ts +0 -6
- package/dist/preview/components/OnDeviceUI/addons/Addons.js +0 -34
- package/dist/preview/components/OnDeviceUI/addons/AddonsSkeleton.d.ts +0 -14
- package/dist/preview/components/OnDeviceUI/addons/AddonsSkeleton.js +0 -78
- package/dist/preview/components/OnDeviceUI/addons/List.d.ts +0 -9
- package/dist/preview/components/OnDeviceUI/addons/List.js +0 -18
- package/dist/preview/components/OnDeviceUI/addons/Wrapper.d.ts +0 -8
- package/dist/preview/components/OnDeviceUI/addons/Wrapper.js +0 -31
- package/dist/preview/components/OnDeviceUI/addons/index.d.ts +0 -1
- package/dist/preview/components/OnDeviceUI/addons/index.js +0 -8
- package/dist/preview/components/OnDeviceUI/animation.d.ts +0 -61
- package/dist/preview/components/OnDeviceUI/animation.js +0 -116
- package/dist/preview/components/OnDeviceUI/index.d.ts +0 -1
- package/dist/preview/components/OnDeviceUI/index.js +0 -8
- package/dist/preview/components/OnDeviceUI/navigation/Navigation.d.ts +0 -9
- package/dist/preview/components/OnDeviceUI/navigation/Navigation.js +0 -54
- package/dist/preview/components/OnDeviceUI/navigation/NavigationBar.d.ts +0 -8
- package/dist/preview/components/OnDeviceUI/navigation/NavigationBar.js +0 -24
- package/dist/preview/components/OnDeviceUI/navigation/NavigationButton.d.ts +0 -2
- package/dist/preview/components/OnDeviceUI/navigation/NavigationButton.js +0 -23
- package/dist/preview/components/OnDeviceUI/navigation/constants.d.ts +0 -3
- package/dist/preview/components/OnDeviceUI/navigation/constants.js +0 -6
- package/dist/preview/components/OnDeviceUI/navigation/index.d.ts +0 -1
- package/dist/preview/components/OnDeviceUI/navigation/index.js +0 -8
- package/dist/preview/components/Shared/icons.d.ts +0 -53
- package/dist/preview/components/Shared/icons.js +0 -72
- package/dist/preview/components/Shared/layout.d.ts +0 -26
- package/dist/preview/components/Shared/layout.js +0 -24
- package/dist/preview/components/Shared/tabs.d.ts +0 -20
- package/dist/preview/components/Shared/tabs.js +0 -48
- package/dist/preview/components/StoryListView/StoryListView.d.ts +0 -7
- package/dist/preview/components/StoryListView/StoryListView.js +0 -201
- package/dist/preview/components/StoryListView/getNestedStories.d.ts +0 -10
- package/dist/preview/components/StoryListView/getNestedStories.js +0 -95
- package/dist/preview/components/StoryListView/getNestedStories.test.d.ts +0 -1
- package/dist/preview/components/StoryListView/getNestedStories.test.js +0 -237
- package/dist/preview/components/StoryListView/index.d.ts +0 -1
- package/dist/preview/components/StoryListView/index.js +0 -8
- package/dist/preview/components/StoryView/StoryView.d.ts +0 -3
- package/dist/preview/components/StoryView/StoryView.js +0 -47
- package/dist/preview/components/StoryView/index.d.ts +0 -1
- package/dist/preview/components/StoryView/index.js +0 -8
- package/dist/preview/executeLoadable.d.ts +0 -27
- package/dist/preview/executeLoadable.js +0 -95
- package/dist/preview/rn-host-detect.d.ts +0 -1
- package/dist/preview/rn-host-detect.js +0 -63
- package/dist/preview/start.d.ts +0 -16
- package/dist/preview/start.js +0 -124
- package/dist/types/types-6.0.d.ts +0 -72
- package/dist/types/types-6.0.js +0 -2
- package/dist/types/types.d.ts +0 -14
- package/dist/types/types.js +0 -2
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executeLoadableForChanges = exports.executeLoadable = void 0;
|
|
4
|
-
var client_logger_1 = require("@storybook/client-logger");
|
|
5
|
-
/**
|
|
6
|
-
* Executes a Loadable (function that returns exports or require context(s))
|
|
7
|
-
* and returns a map of filename => module exports
|
|
8
|
-
*
|
|
9
|
-
* @param loadable Loadable
|
|
10
|
-
* @returns Map<Path, ModuleExports>
|
|
11
|
-
*/
|
|
12
|
-
function executeLoadable(loadable) {
|
|
13
|
-
var reqs = null;
|
|
14
|
-
// todo discuss / improve type check
|
|
15
|
-
if (Array.isArray(loadable)) {
|
|
16
|
-
reqs = loadable;
|
|
17
|
-
}
|
|
18
|
-
else if (loadable.keys) {
|
|
19
|
-
reqs = [loadable]; // todo: test with metro require context
|
|
20
|
-
}
|
|
21
|
-
var exportsMap = new Map();
|
|
22
|
-
if (reqs) {
|
|
23
|
-
reqs.forEach(function (req) {
|
|
24
|
-
req.keys().forEach(function (filename) {
|
|
25
|
-
try {
|
|
26
|
-
var fileExports = req(filename);
|
|
27
|
-
exportsMap.set(
|
|
28
|
-
// NOTE context.resolve is not yet implemented for metro
|
|
29
|
-
// typeof req.resolve === 'function' ? req.resolve(filename) : filename,
|
|
30
|
-
filename, fileExports);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
var errorString = error.message && error.stack ? "".concat(error.message, "\n ").concat(error.stack) : error.toString();
|
|
34
|
-
client_logger_1.logger.error("Unexpected error while loading ".concat(filename, ": ").concat(errorString));
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
var exported = loadable();
|
|
41
|
-
if (typeof exported === 'object') {
|
|
42
|
-
var csfExports = Object.entries(exported).filter(function (_a) {
|
|
43
|
-
var _key = _a[0], value = _a[1];
|
|
44
|
-
return value.default != null;
|
|
45
|
-
});
|
|
46
|
-
exportsMap = new Map(csfExports.map(function (_a) {
|
|
47
|
-
var filePath = _a[0], fileExports = _a[1];
|
|
48
|
-
return [filePath, fileExports];
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return exportsMap;
|
|
53
|
-
}
|
|
54
|
-
exports.executeLoadable = executeLoadable;
|
|
55
|
-
global.lastExportsMap = new Map();
|
|
56
|
-
/**
|
|
57
|
-
* Executes a Loadable (function that returns exports or require context(s))
|
|
58
|
-
* and compares it's output to the last time it was run (as stored on a node module)
|
|
59
|
-
*
|
|
60
|
-
* @param loadable Loadable
|
|
61
|
-
* @param m NodeModule
|
|
62
|
-
* @returns { added: Map<Path, ModuleExports>, removed: Map<Path, ModuleExports> }
|
|
63
|
-
*/
|
|
64
|
-
function executeLoadableForChanges(loadable, m) {
|
|
65
|
-
var _a;
|
|
66
|
-
if ((_a = m === null || m === void 0 ? void 0 : m.hot) === null || _a === void 0 ? void 0 : _a.accept) {
|
|
67
|
-
m.hot.accept();
|
|
68
|
-
}
|
|
69
|
-
var lastExportsMap = global.lastExportsMap;
|
|
70
|
-
var exportsMap = executeLoadable(loadable);
|
|
71
|
-
var added = new Map();
|
|
72
|
-
Array.from(exportsMap.entries())
|
|
73
|
-
// Ignore files that do not have a default export
|
|
74
|
-
.filter(function (_a) {
|
|
75
|
-
var fileExports = _a[1];
|
|
76
|
-
return !!fileExports.default;
|
|
77
|
-
})
|
|
78
|
-
// Ignore exports that are equal (by reference) to last time, this means the file hasn't changed
|
|
79
|
-
.filter(function (_a) {
|
|
80
|
-
var fileName = _a[0], fileExports = _a[1];
|
|
81
|
-
return lastExportsMap.get(fileName) !== fileExports;
|
|
82
|
-
})
|
|
83
|
-
.forEach(function (_a) {
|
|
84
|
-
var fileName = _a[0], fileExports = _a[1];
|
|
85
|
-
return added.set(fileName, fileExports);
|
|
86
|
-
});
|
|
87
|
-
var removed = new Map();
|
|
88
|
-
Array.from(lastExportsMap.keys())
|
|
89
|
-
.filter(function (fileName) { return !exportsMap.has(fileName); })
|
|
90
|
-
.forEach(function (fileName) { return removed.set(fileName, lastExportsMap.get(fileName)); });
|
|
91
|
-
// Save the value for the dispose() call above
|
|
92
|
-
global.lastExportsMap = exportsMap;
|
|
93
|
-
return { added: added, removed: removed };
|
|
94
|
-
}
|
|
95
|
-
exports.executeLoadableForChanges = executeLoadableForChanges;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function getHost(hostname: any): any;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/*
|
|
4
|
-
* It only for Debug Remotely mode for Android
|
|
5
|
-
* When __DEV__ === false, we can't use window.require('NativeModules')
|
|
6
|
-
*/
|
|
7
|
-
function getByRemoteConfig(hostname) {
|
|
8
|
-
var _a;
|
|
9
|
-
var remoteModuleConfig = (_a = window === null || window === void 0 ? void 0 : window.__fbBatchedBridgeConfig) === null || _a === void 0 ? void 0 : _a.remoteModuleConfig;
|
|
10
|
-
if (!Array.isArray(remoteModuleConfig) ||
|
|
11
|
-
(hostname !== 'localhost' && hostname !== '127.0.0.1')) {
|
|
12
|
-
return { hostname: hostname, passed: false };
|
|
13
|
-
}
|
|
14
|
-
var constants = (remoteModuleConfig.find(getConstants) || [])[1];
|
|
15
|
-
if (constants) {
|
|
16
|
-
var serverHost = constants.ServerHost || hostname;
|
|
17
|
-
return { hostname: serverHost.split(':')[0], passed: true };
|
|
18
|
-
}
|
|
19
|
-
return { hostname: hostname, passed: false };
|
|
20
|
-
}
|
|
21
|
-
function getConstants(config) {
|
|
22
|
-
return config && (config[0] === 'AndroidConstants' || config[0] === 'PlatformConstants');
|
|
23
|
-
}
|
|
24
|
-
function getByRNRequirePolyfill(hostname) {
|
|
25
|
-
var NativeModules;
|
|
26
|
-
var PlatformConstants;
|
|
27
|
-
var AndroidConstants;
|
|
28
|
-
if (typeof window === 'undefined' ||
|
|
29
|
-
!window.__DEV__ ||
|
|
30
|
-
typeof window.require !== 'function' ||
|
|
31
|
-
// RN >= 0.56
|
|
32
|
-
// TODO: Get NativeModules for RN >= 0.56
|
|
33
|
-
window.require.name === 'metroRequire') {
|
|
34
|
-
return hostname;
|
|
35
|
-
}
|
|
36
|
-
NativeModules = window.require('NativeModules');
|
|
37
|
-
if (!NativeModules || (!NativeModules.PlatformConstants && !NativeModules.AndroidConstants)) {
|
|
38
|
-
return hostname;
|
|
39
|
-
}
|
|
40
|
-
PlatformConstants = NativeModules.PlatformConstants;
|
|
41
|
-
AndroidConstants = NativeModules.AndroidConstants;
|
|
42
|
-
var serverHost = (PlatformConstants ? PlatformConstants.ServerHost : AndroidConstants.ServerHost) || hostname;
|
|
43
|
-
return serverHost.split(':')[0];
|
|
44
|
-
}
|
|
45
|
-
/*
|
|
46
|
-
* Get React Native server IP if hostname is `localhost`
|
|
47
|
-
* On Android emulator, the IP of host is `10.0.2.2` (Genymotion: 10.0.3.2)
|
|
48
|
-
*/
|
|
49
|
-
function getHost(hostname) {
|
|
50
|
-
// Check if it in React Native environment
|
|
51
|
-
if (typeof __fbBatchedBridge !== 'object' ||
|
|
52
|
-
(hostname !== 'localhost' && hostname !== '127.0.0.1')) {
|
|
53
|
-
return hostname;
|
|
54
|
-
}
|
|
55
|
-
var result = getByRemoteConfig(hostname);
|
|
56
|
-
// Leave if get hostname by remote config successful
|
|
57
|
-
if (result.passed) {
|
|
58
|
-
return result.hostname;
|
|
59
|
-
}
|
|
60
|
-
// Otherwise, use RN's require polyfill
|
|
61
|
-
return getByRNRequirePolyfill(hostname);
|
|
62
|
-
}
|
|
63
|
-
exports.default = getHost;
|
package/dist/preview/start.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="webpack-env" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { ClientApi } from '@storybook/client-api';
|
|
4
|
-
import { Loadable } from '@storybook/core-client';
|
|
5
|
-
import type { ArgsStoryFn } from '@storybook/csf';
|
|
6
|
-
import { PreviewWeb } from '@storybook/preview-web';
|
|
7
|
-
import type { ReactNativeFramework } from '../types/types-6.0';
|
|
8
|
-
import { View } from './View';
|
|
9
|
-
export declare const render: ArgsStoryFn<ReactNativeFramework>;
|
|
10
|
-
export declare function start(): {
|
|
11
|
-
view: View;
|
|
12
|
-
forceReRender: () => void;
|
|
13
|
-
clientApi: ClientApi<ReactNativeFramework>;
|
|
14
|
-
preview: PreviewWeb<ReactNativeFramework>;
|
|
15
|
-
configure(loadable: Loadable, m: NodeModule): void;
|
|
16
|
-
};
|
package/dist/preview/start.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.start = exports.render = void 0;
|
|
18
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
var addons_1 = require("@storybook/addons");
|
|
20
|
-
var channels_1 = __importDefault(require("@storybook/channels"));
|
|
21
|
-
var client_api_1 = require("@storybook/client-api");
|
|
22
|
-
var core_events_1 = __importDefault(require("@storybook/core-events"));
|
|
23
|
-
var preview_web_1 = require("@storybook/preview-web");
|
|
24
|
-
var executeLoadable_1 = require("./executeLoadable");
|
|
25
|
-
var View_1 = require("./View");
|
|
26
|
-
var render = function (args, context) {
|
|
27
|
-
var id = context.id, Component = context.component;
|
|
28
|
-
if (!Component) {
|
|
29
|
-
throw new Error("Unable to render story ".concat(id, " as the component annotation is missing from the default export"));
|
|
30
|
-
}
|
|
31
|
-
return (0, jsx_runtime_1.jsx)(Component, __assign({}, args));
|
|
32
|
-
};
|
|
33
|
-
exports.render = render;
|
|
34
|
-
function start() {
|
|
35
|
-
// TODO: can we get settings from main.js and set the channel here?
|
|
36
|
-
var channel = new channels_1.default({ async: true });
|
|
37
|
-
addons_1.addons.setChannel(channel);
|
|
38
|
-
var clientApi = new client_api_1.ClientApi();
|
|
39
|
-
var previewView = {
|
|
40
|
-
prepareForStory: function () { return null; },
|
|
41
|
-
showNoPreview: function () { },
|
|
42
|
-
showPreparingStory: function () { },
|
|
43
|
-
applyLayout: function () { },
|
|
44
|
-
showErrorDisplay: function (e) {
|
|
45
|
-
console.log(e);
|
|
46
|
-
},
|
|
47
|
-
showStoryDuringRender: function () { },
|
|
48
|
-
showMain: function () { },
|
|
49
|
-
checkIfLayoutExists: function () { },
|
|
50
|
-
showStory: function () { },
|
|
51
|
-
docsRoot: null,
|
|
52
|
-
prepareForDocs: function () { return null; },
|
|
53
|
-
showDocs: function () { },
|
|
54
|
-
preparingTimeout: setTimeout(function () { }, 0),
|
|
55
|
-
showMode: function () { },
|
|
56
|
-
showPreparingDocs: function () { },
|
|
57
|
-
storyRoot: null,
|
|
58
|
-
testing: false,
|
|
59
|
-
};
|
|
60
|
-
var urlStore = {
|
|
61
|
-
selection: null,
|
|
62
|
-
selectionSpecifier: null,
|
|
63
|
-
setQueryParams: function () { },
|
|
64
|
-
setSelection: function (selection) {
|
|
65
|
-
preview.urlStore.selection = selection;
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
var preview = new preview_web_1.PreviewWeb(urlStore, previewView);
|
|
69
|
-
clientApi.storyStore = preview.storyStore;
|
|
70
|
-
(0, client_api_1.setGlobalRender)(exports.render);
|
|
71
|
-
var initialized = false;
|
|
72
|
-
function onStoriesChanged() {
|
|
73
|
-
var storyIndex = clientApi.getStoryIndex();
|
|
74
|
-
preview.onStoriesChanged({ storyIndex: storyIndex });
|
|
75
|
-
view._storyIndex = storyIndex;
|
|
76
|
-
}
|
|
77
|
-
var view = new View_1.View(preview);
|
|
78
|
-
return {
|
|
79
|
-
view: view,
|
|
80
|
-
forceReRender: function () { return channel.emit(core_events_1.default.FORCE_RE_RENDER); },
|
|
81
|
-
clientApi: clientApi,
|
|
82
|
-
preview: preview,
|
|
83
|
-
// This gets called each time the user calls configure (i.e. once per HMR)
|
|
84
|
-
// The first time, it constructs thecurrentSelection preview, subsequently it updates it
|
|
85
|
-
configure: function (loadable, m) {
|
|
86
|
-
clientApi.addParameters({ framework: 'react-native' });
|
|
87
|
-
// We need to run the `executeLoadableForChanges` function *inside* the `getProjectAnnotations
|
|
88
|
-
// function in case it throws. So we also need to process its output there also
|
|
89
|
-
var getProjectAnnotations = function () {
|
|
90
|
-
var _a = (0, executeLoadable_1.executeLoadableForChanges)(loadable, m), added = _a.added, removed = _a.removed;
|
|
91
|
-
Array.from(added.entries()).forEach(function (_a) {
|
|
92
|
-
var fileName = _a[0], fileExports = _a[1];
|
|
93
|
-
return clientApi.facade.addStoriesFromExports(fileName, fileExports);
|
|
94
|
-
});
|
|
95
|
-
Array.from(removed.entries()).forEach(function (_a) {
|
|
96
|
-
var fileName = _a[0];
|
|
97
|
-
return clientApi.facade.clearFilenameExports(fileName);
|
|
98
|
-
});
|
|
99
|
-
return __assign(__assign({}, clientApi.facade.projectAnnotations), { renderToDOM: function (context) {
|
|
100
|
-
view._setStory(context.storyContext);
|
|
101
|
-
} });
|
|
102
|
-
};
|
|
103
|
-
var importFn = function (path) { return clientApi.importFn(path); };
|
|
104
|
-
if (!initialized) {
|
|
105
|
-
preview.initialize({
|
|
106
|
-
getStoryIndex: function () {
|
|
107
|
-
var index = clientApi.getStoryIndex();
|
|
108
|
-
view._storyIndex = index;
|
|
109
|
-
return index;
|
|
110
|
-
},
|
|
111
|
-
importFn: importFn,
|
|
112
|
-
getProjectAnnotations: getProjectAnnotations,
|
|
113
|
-
});
|
|
114
|
-
initialized = true;
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
// TODO -- why don't we care about the new annotations?
|
|
118
|
-
getProjectAnnotations();
|
|
119
|
-
onStoriesChanged();
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
exports.start = start;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { ComponentProps, ComponentType, JSXElementConstructor, ReactElement } from 'react';
|
|
2
|
-
import type { Args, ComponentAnnotations, StoryAnnotations, AnnotatedStoryFn } from '@storybook/csf';
|
|
3
|
-
export type StoryFnReactReturnType = ReactElement<unknown>;
|
|
4
|
-
export type { Args, ArgTypes, Parameters, StoryContext } from '@storybook/addons';
|
|
5
|
-
export type ReactNativeFramework = {
|
|
6
|
-
component: ComponentType<any>;
|
|
7
|
-
storyResult: StoryFnReactReturnType;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* For the common case where a component's stories are simple components that receives args as props:
|
|
11
|
-
*
|
|
12
|
-
* ```tsx
|
|
13
|
-
* export default { ... } as ComponentMeta<typeof Button>;
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export type ComponentMeta<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Meta<ComponentProps<T>>;
|
|
17
|
-
/**
|
|
18
|
-
* For the common case where a (CSFv2) story is a simple component that receives args as props:
|
|
19
|
-
*
|
|
20
|
-
* ```tsx
|
|
21
|
-
* const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export type ComponentStoryFn<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryFn<ComponentProps<T>>;
|
|
25
|
-
/**
|
|
26
|
-
* For the common case where a (CSFv3) story is a simple component that receives args as props:
|
|
27
|
-
*
|
|
28
|
-
* ```tsx
|
|
29
|
-
* const MyStory: ComponentStory<typeof Button> = {
|
|
30
|
-
* args: { buttonArg1: 'val' },
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export type ComponentStoryObj<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryObj<ComponentProps<T>>;
|
|
35
|
-
/**
|
|
36
|
-
* For the common case where a (CSFv2) story is a simple component that receives args as props:
|
|
37
|
-
*
|
|
38
|
-
* ```tsx
|
|
39
|
-
* const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* NOTE: this is an alias for `ComponentStoryFn`.
|
|
43
|
-
* In Storybook v7, `ComponentStory` will alias `ComponentStoryObj`
|
|
44
|
-
*/
|
|
45
|
-
export type ComponentStory<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Story<ComponentProps<T>>;
|
|
46
|
-
/**
|
|
47
|
-
* Metadata to configure the stories for a component.
|
|
48
|
-
*
|
|
49
|
-
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
50
|
-
*/
|
|
51
|
-
export type Meta<TArgs = Args> = ComponentAnnotations<ReactNativeFramework, TArgs>;
|
|
52
|
-
/**
|
|
53
|
-
* Story function that represents a CSFv2 component example.
|
|
54
|
-
*
|
|
55
|
-
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
56
|
-
*/
|
|
57
|
-
export type StoryFn<TArgs = Args> = AnnotatedStoryFn<ReactNativeFramework, TArgs>;
|
|
58
|
-
/**
|
|
59
|
-
* Story function that represents a CSFv3 component example.
|
|
60
|
-
*
|
|
61
|
-
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
62
|
-
*/
|
|
63
|
-
export type StoryObj<TArgs = Args> = StoryAnnotations<ReactNativeFramework, TArgs>;
|
|
64
|
-
/**
|
|
65
|
-
* Story function that represents a CSFv2 component example.
|
|
66
|
-
*
|
|
67
|
-
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
68
|
-
*
|
|
69
|
-
* NOTE that in Storybook 7.0, this type will be renamed to `StoryFn` and replaced by the current `StoryObj` type.
|
|
70
|
-
*
|
|
71
|
-
*/
|
|
72
|
-
export type Story<TArgs = Args> = StoryFn<TArgs>;
|
package/dist/types/types-6.0.js
DELETED
package/dist/types/types.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { RenderContext, RenderContextWithoutStoryContext } from '@storybook/client-api';
|
|
2
|
-
export interface PreviewError {
|
|
3
|
-
message?: string;
|
|
4
|
-
stack?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface RequireContext {
|
|
7
|
-
keys: () => string[];
|
|
8
|
-
(id: string): any;
|
|
9
|
-
resolve(id: string): string;
|
|
10
|
-
}
|
|
11
|
-
export type LoaderFunction = () => void | any[];
|
|
12
|
-
export type Loadable = RequireContext | RequireContext[] | LoaderFunction;
|
|
13
|
-
export type { RenderContext, RenderContextWithoutStoryContext };
|
|
14
|
-
export type RenderStoryFunction = (context: RenderContext) => void;
|
package/dist/types/types.js
DELETED