@storybook/react-native 6.5.3 → 6.5.4-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.
Files changed (34) hide show
  1. package/dist/constants.js +4 -1
  2. package/dist/hooks.js +75 -36
  3. package/dist/index.js +40 -18
  4. package/dist/preview/View.js +165 -88
  5. package/dist/preview/components/OnDeviceUI/OnDeviceUI.js +127 -81
  6. package/dist/preview/components/OnDeviceUI/Panel.js +24 -15
  7. package/dist/preview/components/OnDeviceUI/absolute-positioned-keyboard-aware-view.js +17 -10
  8. package/dist/preview/components/OnDeviceUI/addons/Addons.js +32 -23
  9. package/dist/preview/components/OnDeviceUI/addons/AddonsSkeleton.js +69 -41
  10. package/dist/preview/components/OnDeviceUI/addons/List.js +15 -9
  11. package/dist/preview/components/OnDeviceUI/addons/Wrapper.js +27 -18
  12. package/dist/preview/components/OnDeviceUI/addons/index.js +8 -1
  13. package/dist/preview/components/OnDeviceUI/animation.js +37 -29
  14. package/dist/preview/components/OnDeviceUI/index.js +8 -1
  15. package/dist/preview/components/OnDeviceUI/navigation/Navigation.js +31 -24
  16. package/dist/preview/components/OnDeviceUI/navigation/NavigationBar.js +26 -14
  17. package/dist/preview/components/OnDeviceUI/navigation/NavigationButton.js +26 -17
  18. package/dist/preview/components/OnDeviceUI/navigation/constants.js +6 -3
  19. package/dist/preview/components/OnDeviceUI/navigation/index.js +8 -1
  20. package/dist/preview/components/Shared/icons.js +28 -10
  21. package/dist/preview/components/Shared/layout.js +21 -4
  22. package/dist/preview/components/Shared/tabs.js +41 -27
  23. package/dist/preview/components/Shared/theme.js +11 -8
  24. package/dist/preview/components/StoryListView/StoryListView.js +161 -97
  25. package/dist/preview/components/StoryListView/index.js +8 -1
  26. package/dist/preview/components/StoryView/StoryView.js +30 -14
  27. package/dist/preview/components/StoryView/index.js +8 -1
  28. package/dist/preview/executeLoadable.d.ts +4 -1
  29. package/dist/preview/executeLoadable.js +43 -23
  30. package/dist/preview/rn-host-detect.js +3 -1
  31. package/dist/preview/start.js +80 -55
  32. package/dist/types/types-6.0.js +2 -1
  33. package/dist/types/types.js +2 -1
  34. package/package.json +3 -3
@@ -1,91 +1,115 @@
1
- import { addons } from '@storybook/addons';
2
- import Channel from '@storybook/channels';
3
- import { ClientApi, setGlobalRender } from '@storybook/client-api';
4
- import Events from '@storybook/core-events';
5
- import { PreviewWeb } from '@storybook/preview-web';
6
- import React from 'react';
7
- import { executeLoadableForChanges } from './executeLoadable';
8
- import { View } from './View';
9
- export const render = (args, context) => {
10
- const { id, component: Component } = context;
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 addons_1 = require("@storybook/addons");
19
+ var channels_1 = __importDefault(require("@storybook/channels"));
20
+ var client_api_1 = require("@storybook/client-api");
21
+ var core_events_1 = __importDefault(require("@storybook/core-events"));
22
+ var preview_web_1 = require("@storybook/preview-web");
23
+ var react_1 = __importDefault(require("react"));
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;
11
28
  if (!Component) {
12
- throw new Error(`Unable to render story ${id} as the component annotation is missing from the default export`);
29
+ throw new Error("Unable to render story ".concat(id, " as the component annotation is missing from the default export"));
13
30
  }
14
- return React.createElement(Component, Object.assign({}, args));
31
+ return react_1.default.createElement(Component, __assign({}, args));
15
32
  };
16
- export function start() {
33
+ exports.render = render;
34
+ function start() {
17
35
  // TODO: can we get settings from main.js and set the channel here?
18
- const channel = new Channel({ async: true });
19
- addons.setChannel(channel);
20
- const clientApi = new ClientApi();
21
- const previewView = {
22
- prepareForStory: () => null,
23
- showNoPreview: () => { },
24
- showPreparingStory: () => { },
25
- applyLayout: () => { },
26
- showErrorDisplay: (e) => {
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) {
27
45
  console.log(e);
28
46
  },
29
- showStoryDuringRender: () => { },
30
- showMain: () => { },
31
- checkIfLayoutExists: () => { },
32
- showStory: () => { },
47
+ showStoryDuringRender: function () { },
48
+ showMain: function () { },
49
+ checkIfLayoutExists: function () { },
50
+ showStory: function () { },
33
51
  docsRoot: null,
34
- prepareForDocs: () => null,
35
- showDocs: () => { },
36
- preparingTimeout: setTimeout(() => { }, 0),
37
- showMode: () => { },
38
- showPreparingDocs: () => { },
52
+ prepareForDocs: function () { return null; },
53
+ showDocs: function () { },
54
+ preparingTimeout: setTimeout(function () { }, 0),
55
+ showMode: function () { },
56
+ showPreparingDocs: function () { },
39
57
  storyRoot: null,
40
58
  testing: false,
41
59
  };
42
- const urlStore = {
60
+ var urlStore = {
43
61
  selection: { storyId: '', viewMode: 'story' },
44
62
  selectionSpecifier: null,
45
- setQueryParams: () => { },
46
- setSelection: (selection) => {
63
+ setQueryParams: function () { },
64
+ setSelection: function (selection) {
47
65
  preview.urlStore.selection = selection;
48
66
  },
49
67
  };
50
- const preview = new PreviewWeb(urlStore, previewView);
68
+ var preview = new preview_web_1.PreviewWeb(urlStore, previewView);
51
69
  clientApi.storyStore = preview.storyStore;
52
- setGlobalRender(render);
53
- let initialized = false;
70
+ (0, client_api_1.setGlobalRender)(exports.render);
71
+ var initialized = false;
54
72
  function onStoriesChanged() {
55
- const storyIndex = clientApi.getStoryIndex();
56
- preview.onStoriesChanged({ storyIndex });
73
+ var storyIndex = clientApi.getStoryIndex();
74
+ preview.onStoriesChanged({ storyIndex: storyIndex });
57
75
  view._storyIndex = storyIndex;
58
76
  }
59
- const view = new View(preview);
77
+ var view = new View_1.View(preview);
60
78
  return {
61
- view,
62
- forceReRender: () => channel.emit(Events.FORCE_RE_RENDER),
63
- clientApi,
64
- preview,
79
+ view: view,
80
+ forceReRender: function () { return channel.emit(core_events_1.default.FORCE_RE_RENDER); },
81
+ clientApi: clientApi,
82
+ preview: preview,
65
83
  // This gets called each time the user calls configure (i.e. once per HMR)
66
84
  // The first time, it constructs thecurrentSelection preview, subsequently it updates it
67
- configure(loadable, m) {
85
+ configure: function (loadable, m) {
68
86
  clientApi.addParameters({ framework: 'react-native' });
69
87
  // We need to run the `executeLoadableForChanges` function *inside* the `getProjectAnnotations
70
88
  // function in case it throws. So we also need to process its output there also
71
- const getProjectAnnotations = () => {
72
- const { added, removed } = executeLoadableForChanges(loadable, m);
73
- Array.from(added.entries()).forEach(([fileName, fileExports]) => clientApi.facade.addStoriesFromExports(fileName, fileExports));
74
- Array.from(removed.entries()).forEach(([fileName]) => clientApi.facade.clearFilenameExports(fileName));
75
- return Object.assign(Object.assign({}, clientApi.facade.projectAnnotations), { renderToDOM: (context) => {
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) {
76
100
  view._setStory(context.storyContext);
77
101
  } });
78
102
  };
79
- const importFn = (path) => clientApi.importFn(path);
103
+ var importFn = function (path) { return clientApi.importFn(path); };
80
104
  if (!initialized) {
81
105
  preview.initialize({
82
- getStoryIndex: () => {
83
- const index = clientApi.getStoryIndex();
106
+ getStoryIndex: function () {
107
+ var index = clientApi.getStoryIndex();
84
108
  view._storyIndex = index;
85
109
  return index;
86
110
  },
87
- importFn,
88
- getProjectAnnotations,
111
+ importFn: importFn,
112
+ getProjectAnnotations: getProjectAnnotations,
89
113
  });
90
114
  initialized = true;
91
115
  }
@@ -97,3 +121,4 @@ export function start() {
97
121
  },
98
122
  };
99
123
  }
124
+ exports.start = start;
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native",
3
- "version": "6.5.3",
3
+ "version": "6.5.4-alpha.0",
4
4
  "description": "A better way to develop React Native Components for your app",
5
5
  "keywords": [
6
6
  "react",
@@ -14,7 +14,7 @@
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "https://github.com/storybookjs/react-native.git",
17
- "directory": "app/react-native"
17
+ "directory": "packages/react-native"
18
18
  },
19
19
  "license": "MIT",
20
20
  "main": "dist/index.js",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "464967fd130b46df44f91395d08e6a25afa36679"
91
+ "gitHead": "3ab16a135c9881a69957fd330174b37e8f2bc634"
92
92
  }