@fluentui-react-native/storybook-desktop-runtime 0.2.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/.cache/tsconfig.tsbuildinfo +1 -0
- package/CHANGELOG.md +25 -0
- package/README.md +21 -0
- package/config/metro.cjs +125 -0
- package/config/react-native-safe-area-context.cjs +22 -0
- package/lib/DesktopDriverBridge.d.ts +7 -0
- package/lib/DesktopDriverBridge.d.ts.map +1 -0
- package/lib/DesktopDriverBridge.js +52 -0
- package/lib/DesktopDriverBridge.js.map +1 -0
- package/lib/DesktopStoryRoot.d.ts +8 -0
- package/lib/DesktopStoryRoot.d.ts.map +1 -0
- package/lib/DesktopStoryRoot.js +57 -0
- package/lib/DesktopStoryRoot.js.map +1 -0
- package/lib/DesktopStorybookConfig.d.ts +28 -0
- package/lib/DesktopStorybookConfig.d.ts.map +1 -0
- package/lib/DesktopStorybookConfig.js +23 -0
- package/lib/DesktopStorybookConfig.js.map +1 -0
- package/lib/StorybookTheme.d.ts +4 -0
- package/lib/StorybookTheme.d.ts.map +1 -0
- package/lib/StorybookTheme.js +79 -0
- package/lib/StorybookTheme.js.map +1 -0
- package/lib/StorybookUI.d.ts +2 -0
- package/lib/StorybookUI.d.ts.map +1 -0
- package/lib/StorybookUI.js +2 -0
- package/lib/StorybookUI.js.map +1 -0
- package/lib/StorybookUI.win32.d.ts +3 -0
- package/lib/StorybookUI.win32.d.ts.map +1 -0
- package/lib/StorybookUI.win32.js +171 -0
- package/lib/StorybookUI.win32.js.map +1 -0
- package/lib/Win32AddonsPanel.d.ts +9 -0
- package/lib/Win32AddonsPanel.d.ts.map +1 -0
- package/lib/Win32AddonsPanel.js +72 -0
- package/lib/Win32AddonsPanel.js.map +1 -0
- package/lib/Win32CalloutPortal.d.ts +16 -0
- package/lib/Win32CalloutPortal.d.ts.map +1 -0
- package/lib/Win32CalloutPortal.js +17 -0
- package/lib/Win32CalloutPortal.js.map +1 -0
- package/lib/Win32ResizeHandle.d.ts +8 -0
- package/lib/Win32ResizeHandle.d.ts.map +1 -0
- package/lib/Win32ResizeHandle.js +46 -0
- package/lib/Win32ResizeHandle.js.map +1 -0
- package/lib/createDesktopStorybookApp.d.ts +9 -0
- package/lib/createDesktopStorybookApp.d.ts.map +1 -0
- package/lib/createDesktopStorybookApp.js +38 -0
- package/lib/createDesktopStorybookApp.js.map +1 -0
- package/lib/createDesktopStorybookPreview.d.ts +3 -0
- package/lib/createDesktopStorybookPreview.d.ts.map +1 -0
- package/lib/createDesktopStorybookPreview.js +21 -0
- package/lib/createDesktopStorybookPreview.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/package.json +106 -0
- package/src/DesktopDriverBridge.tsx +66 -0
- package/src/DesktopStoryRoot.tsx +88 -0
- package/src/DesktopStorybookConfig.tsx +58 -0
- package/src/StorybookTheme.tsx +114 -0
- package/src/StorybookUI.ts +1 -0
- package/src/StorybookUI.win32.tsx +330 -0
- package/src/Win32AddonsPanel.tsx +135 -0
- package/src/Win32CalloutPortal.tsx +73 -0
- package/src/Win32ResizeHandle.tsx +67 -0
- package/src/createDesktopStorybookApp.tsx +72 -0
- package/src/createDesktopStorybookPreview.tsx +31 -0
- package/src/index.ts +12 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Pressable, StyleSheet, Text, View } from 'react-native';
|
|
4
|
+
import { ThemeProvider } from '@storybook/react-native-theming';
|
|
5
|
+
import { StorageProvider } from '@storybook/react-native-ui-common';
|
|
6
|
+
import { Sidebar } from '@storybook/react-native-ui-lite';
|
|
7
|
+
import { useDesktopStorybookTestID } from './DesktopStorybookConfig';
|
|
8
|
+
import { Win32AddonsPanel } from './Win32AddonsPanel';
|
|
9
|
+
import { Win32CalloutPortal } from './Win32CalloutPortal';
|
|
10
|
+
import { Win32ResizeHandle } from './Win32ResizeHandle';
|
|
11
|
+
const emptyRefs = {};
|
|
12
|
+
const emptyStatus = {};
|
|
13
|
+
export const StorybookUIComponent = ({ children, setStory, storage, story, storyHash, theme }) => {
|
|
14
|
+
const storiesAnchorRef = React.useRef(null);
|
|
15
|
+
const addonsAnchorRef = React.useRef(null);
|
|
16
|
+
const [sidebarVisible, setSidebarVisible] = React.useState(true);
|
|
17
|
+
const [sidebarWidth, setSidebarWidth] = React.useState(280);
|
|
18
|
+
const [addonsVisible, setAddonsVisible] = React.useState(true);
|
|
19
|
+
const [addonsHeight, setAddonsHeight] = React.useState(280);
|
|
20
|
+
const [storyDrawerOpen, setStoryDrawerOpen] = React.useState(false);
|
|
21
|
+
const [addonsPanelOpen, setAddonsPanelOpen] = React.useState(false);
|
|
22
|
+
const chromeTestID = useDesktopStorybookTestID('win32-chrome');
|
|
23
|
+
const sidebarTestID = useDesktopStorybookTestID('win32-sidebar');
|
|
24
|
+
const sidebarResizeTestID = useDesktopStorybookTestID('win32-sidebar-resize');
|
|
25
|
+
const toolbarTestID = useDesktopStorybookTestID('win32-desktop-toolbar');
|
|
26
|
+
const showSidebarTestID = useDesktopStorybookTestID('win32-show-sidebar');
|
|
27
|
+
const popoutStoriesTestID = useDesktopStorybookTestID('win32-popout-stories');
|
|
28
|
+
const showAddonsTestID = useDesktopStorybookTestID('win32-show-addons');
|
|
29
|
+
const popoutAddonsTestID = useDesktopStorybookTestID('win32-popout-addons');
|
|
30
|
+
const previewTestID = useDesktopStorybookTestID('win32-preview');
|
|
31
|
+
const addonsResizeTestID = useDesktopStorybookTestID('win32-addons-resize');
|
|
32
|
+
const inlineAddonsTestID = useDesktopStorybookTestID('win32-inline-addons');
|
|
33
|
+
const storyDrawerTestID = useDesktopStorybookTestID('win32-story-drawer');
|
|
34
|
+
const closeStoriesTestID = useDesktopStorybookTestID('win32-close-stories');
|
|
35
|
+
const addonsDrawerTestID = useDesktopStorybookTestID('win32-addons-drawer');
|
|
36
|
+
const hideSidebarTestID = useDesktopStorybookTestID('win32-hide-sidebar');
|
|
37
|
+
const setSelection = React.useCallback((selection) => {
|
|
38
|
+
if (selection?.storyId) {
|
|
39
|
+
setStory(selection.storyId);
|
|
40
|
+
setStoryDrawerOpen(false);
|
|
41
|
+
setSidebarVisible(true);
|
|
42
|
+
}
|
|
43
|
+
}, [setStory]);
|
|
44
|
+
const closeStoryDrawer = React.useCallback(() => {
|
|
45
|
+
setStoryDrawerOpen(false);
|
|
46
|
+
setSidebarVisible(true);
|
|
47
|
+
}, []);
|
|
48
|
+
const closeAddonsDrawer = React.useCallback(() => {
|
|
49
|
+
setAddonsPanelOpen(false);
|
|
50
|
+
setAddonsVisible(true);
|
|
51
|
+
}, []);
|
|
52
|
+
const resizeSidebar = React.useCallback((delta) => {
|
|
53
|
+
setSidebarWidth((current) => Math.min(Math.max(current + delta, 200), 480));
|
|
54
|
+
}, []);
|
|
55
|
+
const resizeAddons = React.useCallback((delta) => {
|
|
56
|
+
setAddonsHeight((current) => Math.min(Math.max(current - delta, 160), 520));
|
|
57
|
+
}, []);
|
|
58
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(StorageProvider, { storage: storage, children: _jsxs(View, { style: styles.root, testID: chromeTestID, children: [sidebarVisible ? (_jsxs(_Fragment, { children: [_jsxs(View, { style: [
|
|
59
|
+
styles.sidebar,
|
|
60
|
+
{
|
|
61
|
+
backgroundColor: theme.background.content,
|
|
62
|
+
borderColor: theme.appBorderColor,
|
|
63
|
+
width: sidebarWidth,
|
|
64
|
+
},
|
|
65
|
+
], testID: sidebarTestID, children: [_jsxs(View, { accessibilityLabel: "Storybook sidebar", accessible: true, style: styles.sidebarHeader, testID: `${sidebarTestID}-header`, children: [_jsx(Text, { style: [styles.sidebarTitle, { color: theme.barTextColor }], children: "Stories" }), _jsx(Pressable, { accessibilityLabel: "Hide story sidebar", accessibilityRole: "button", onPress: () => setSidebarVisible(false), style: styles.headerButton, testID: hideSidebarTestID, children: _jsx(Text, { style: { color: theme.color.mediumdark }, children: "Hide" }) })] }), _jsx(View, { style: styles.sidebarContent, children: _jsx(Sidebar, { index: storyHash, indexError: undefined, previewInitialized: true, refs: emptyRefs, setSelection: setSelection, status: emptyStatus, storyId: story?.id }) })] }), _jsx(Win32ResizeHandle, { direction: "horizontal", onResize: resizeSidebar, testID: sidebarResizeTestID })] })) : null, _jsxs(View, { style: styles.main, children: [!sidebarVisible ? (_jsxs(View, { accessibilityLabel: "Storybook desktop toolbar", accessible: true, style: [styles.toolbar, { backgroundColor: theme.background.content, borderBottomColor: theme.appBorderColor }], testID: toolbarTestID, children: [_jsx(Pressable, { accessibilityRole: "button", onPress: () => setSidebarVisible(true), style: [styles.toolbarButton, { backgroundColor: theme.button.background, borderColor: theme.appBorderColor }], testID: showSidebarTestID, children: _jsx(Text, { style: { color: theme.color.mediumdark }, children: "Show stories" }) }), _jsx(Pressable, { accessibilityRole: "button", onPress: () => setStoryDrawerOpen(true), ref: storiesAnchorRef, style: ({ pressed }) => [
|
|
66
|
+
styles.toolbarButton,
|
|
67
|
+
{
|
|
68
|
+
backgroundColor: storyDrawerOpen ? theme.barSelectedColor : theme.button.background,
|
|
69
|
+
borderColor: theme.appBorderColor,
|
|
70
|
+
opacity: pressed ? 0.75 : 1,
|
|
71
|
+
},
|
|
72
|
+
], testID: popoutStoriesTestID, children: _jsx(Text, { style: { color: storyDrawerOpen ? theme.color.lightest : theme.color.mediumdark }, children: "Pop out stories" }) }), !addonsVisible ? (_jsx(Pressable, { accessibilityRole: "button", onPress: () => setAddonsVisible(true), style: [styles.toolbarButton, { backgroundColor: theme.button.background, borderColor: theme.appBorderColor }], testID: showAddonsTestID, children: _jsx(Text, { style: { color: theme.color.mediumdark }, children: "Show addons" }) })) : null, _jsx(Pressable, { accessibilityRole: "button", onPress: () => {
|
|
73
|
+
setAddonsVisible(false);
|
|
74
|
+
setAddonsPanelOpen(true);
|
|
75
|
+
}, ref: addonsAnchorRef, style: ({ pressed }) => [
|
|
76
|
+
styles.toolbarButton,
|
|
77
|
+
{
|
|
78
|
+
backgroundColor: addonsPanelOpen ? theme.barSelectedColor : theme.button.background,
|
|
79
|
+
borderColor: theme.appBorderColor,
|
|
80
|
+
opacity: pressed ? 0.75 : 1,
|
|
81
|
+
},
|
|
82
|
+
], testID: popoutAddonsTestID, children: _jsx(Text, { style: { color: addonsPanelOpen ? theme.color.lightest : theme.color.mediumdark }, children: "Pop out addons" }) }), _jsx(Text, { numberOfLines: 1, style: [styles.currentStory, { color: theme.textMutedColor }], children: story ? `${story.title}/${story.name}` : 'No story selected' })] })) : null, _jsx(View, { style: styles.preview, testID: previewTestID, children: children }), addonsVisible ? (_jsxs(_Fragment, { children: [_jsx(Win32ResizeHandle, { direction: "vertical", onResize: resizeAddons, testID: addonsResizeTestID }), _jsx(View, { style: [
|
|
83
|
+
styles.addons,
|
|
84
|
+
{
|
|
85
|
+
backgroundColor: theme.background.content,
|
|
86
|
+
height: addonsHeight,
|
|
87
|
+
},
|
|
88
|
+
], testID: inlineAddonsTestID, children: _jsx(Win32AddonsPanel, { onClose: () => setAddonsVisible(false), parameters: story?.parameters, storyId: story?.id }) })] })) : null] }), _jsxs(Win32CalloutPortal, { accessibilityLabel: "Storybook stories", directionalHint: "bottomLeftEdge", height: 600, onDismiss: closeStoryDrawer, target: storiesAnchorRef, testID: storyDrawerTestID, visible: storyDrawerOpen, width: 360, children: [_jsxs(View, { style: styles.drawerHeader, children: [_jsx(Text, { style: [styles.drawerTitle, { color: theme.barTextColor }], children: "Stories" }), _jsx(Pressable, { accessibilityLabel: "Close story drawer", accessibilityRole: "button", onPress: closeStoryDrawer, style: styles.closeButton, testID: closeStoriesTestID, children: _jsx(Text, { style: { color: theme.color.mediumdark }, children: "Close" }) })] }), _jsx(View, { style: styles.drawerContent, children: _jsx(Sidebar, { index: storyHash, indexError: undefined, previewInitialized: true, refs: emptyRefs, setSelection: setSelection, status: emptyStatus, storyId: story?.id }) })] }), _jsx(Win32CalloutPortal, { accessibilityLabel: "Storybook addons", directionalHint: "bottomLeftEdge", height: 480, onDismiss: closeAddonsDrawer, target: addonsAnchorRef, testID: addonsDrawerTestID, visible: addonsPanelOpen, width: 520, children: _jsx(Win32AddonsPanel, { onClose: closeAddonsDrawer, parameters: story?.parameters, storyId: story?.id }) })] }) }) }));
|
|
89
|
+
};
|
|
90
|
+
const styles = StyleSheet.create({
|
|
91
|
+
root: {
|
|
92
|
+
flex: 1,
|
|
93
|
+
flexDirection: 'row',
|
|
94
|
+
},
|
|
95
|
+
sidebar: {
|
|
96
|
+
borderRightWidth: 1,
|
|
97
|
+
},
|
|
98
|
+
sidebarHeader: {
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
flexDirection: 'row',
|
|
101
|
+
justifyContent: 'space-between',
|
|
102
|
+
minHeight: 44,
|
|
103
|
+
paddingHorizontal: 12,
|
|
104
|
+
},
|
|
105
|
+
sidebarTitle: {
|
|
106
|
+
fontSize: 16,
|
|
107
|
+
fontWeight: '600',
|
|
108
|
+
},
|
|
109
|
+
sidebarContent: {
|
|
110
|
+
flex: 1,
|
|
111
|
+
},
|
|
112
|
+
headerButton: {
|
|
113
|
+
alignItems: 'center',
|
|
114
|
+
justifyContent: 'center',
|
|
115
|
+
minHeight: 32,
|
|
116
|
+
paddingHorizontal: 8,
|
|
117
|
+
},
|
|
118
|
+
main: {
|
|
119
|
+
flex: 1,
|
|
120
|
+
},
|
|
121
|
+
toolbar: {
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
borderBottomWidth: 1,
|
|
124
|
+
flexDirection: 'row',
|
|
125
|
+
gap: 8,
|
|
126
|
+
minHeight: 44,
|
|
127
|
+
paddingHorizontal: 10,
|
|
128
|
+
paddingVertical: 6,
|
|
129
|
+
},
|
|
130
|
+
toolbarButton: {
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
borderRadius: 4,
|
|
133
|
+
borderWidth: 1,
|
|
134
|
+
justifyContent: 'center',
|
|
135
|
+
minHeight: 30,
|
|
136
|
+
paddingHorizontal: 12,
|
|
137
|
+
},
|
|
138
|
+
currentStory: {
|
|
139
|
+
flex: 1,
|
|
140
|
+
fontSize: 11,
|
|
141
|
+
marginStart: 4,
|
|
142
|
+
},
|
|
143
|
+
addons: {
|
|
144
|
+
minHeight: 160,
|
|
145
|
+
},
|
|
146
|
+
drawerHeader: {
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
flexDirection: 'row',
|
|
149
|
+
justifyContent: 'space-between',
|
|
150
|
+
minHeight: 44,
|
|
151
|
+
paddingHorizontal: 12,
|
|
152
|
+
},
|
|
153
|
+
drawerTitle: {
|
|
154
|
+
fontSize: 16,
|
|
155
|
+
fontWeight: '600',
|
|
156
|
+
},
|
|
157
|
+
closeButton: {
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
justifyContent: 'center',
|
|
160
|
+
minHeight: 32,
|
|
161
|
+
paddingHorizontal: 8,
|
|
162
|
+
},
|
|
163
|
+
drawerContent: {
|
|
164
|
+
flex: 1,
|
|
165
|
+
minHeight: 420,
|
|
166
|
+
},
|
|
167
|
+
preview: {
|
|
168
|
+
flex: 1,
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
//# sourceMappingURL=StorybookUI.win32.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorybookUI.win32.js","sourceRoot":"","sources":["../src/StorybookUI.win32.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAE1D,OAAO,EAAE,y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E,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,CAAC;KACrB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC;KACR;IACD,OAAO,EAAE;QACP,UAAU,EAAE,QAAQ;QACpB,iBAAiB,EAAE,CAAC;QACpB,aAAa,EAAE,KAAK;QACpB,GAAG,EAAE,CAAC;QACN,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,CAAC;KACnB;IACD,aAAa,EAAE;QACb,UAAU,EAAE,QAAQ;QACpB,YAAY,EAAE,CAAC;QACf,WAAW,EAAE,CAAC;QACd,cAAc,EAAE,QAAQ;QACxB,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,EAAE;KACtB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,CAAC;KACf;IACD,MAAM,EAAE;QACN,SAAS,EAAE,GAAG;KACf;IACD,YAAY,EAAE;QACZ,UAAU,EAAE,QAAQ;QACpB,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;QAC/B,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,EAAE;KACtB;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;KAClB;IACD,WAAW,EAAE;QACX,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,CAAC;KACrB;IACD,aAAa,EAAE;QACb,IAAI,EAAE,CAAC;QACP,SAAS,EAAE,GAAG;KACf;IACD,OAAO,EAAE;QACP,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Parameters } from 'storybook/internal/csf';
|
|
2
|
+
type Win32AddonsPanelProps = {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
parameters?: Parameters;
|
|
5
|
+
storyId?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function Win32AddonsPanel({ onClose, parameters, storyId }: Win32AddonsPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=Win32AddonsPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Win32AddonsPanel.d.ts","sourceRoot":"","sources":["../src/Win32AddonsPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAOzD,KAAK,qBAAqB,GAAG;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAMF,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,qBAAqB,2CA8EvF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
4
|
+
import { useTheme } from '@storybook/react-native-theming';
|
|
5
|
+
import { Addon_TypesEnum } from 'storybook/internal/types';
|
|
6
|
+
import { addons } from 'storybook/manager-api';
|
|
7
|
+
import { useDesktopStorybookTestID } from './DesktopStorybookConfig';
|
|
8
|
+
function preferredPanelId(panels) {
|
|
9
|
+
return panels.find(([id]) => id.includes('actions'))?.[0] ?? panels[0]?.[0];
|
|
10
|
+
}
|
|
11
|
+
export function Win32AddonsPanel({ onClose, parameters, storyId }) {
|
|
12
|
+
const theme = useTheme();
|
|
13
|
+
const panelTestID = useDesktopStorybookTestID('win32-addons-panel');
|
|
14
|
+
const addonTestID = useDesktopStorybookTestID('win32-addon');
|
|
15
|
+
const closeTestID = useDesktopStorybookTestID('win32-close-addons');
|
|
16
|
+
const panels = React.useMemo(() => {
|
|
17
|
+
const allPanels = addons.getElements(Addon_TypesEnum.PANEL);
|
|
18
|
+
return Object.entries(allPanels).filter(([, panel]) => !panel.paramKey || !parameters?.[panel.paramKey]?.disable);
|
|
19
|
+
}, [parameters]);
|
|
20
|
+
const [selectedPanelId, setSelectedPanelId] = React.useState(() => preferredPanelId(panels));
|
|
21
|
+
const activePanel = panels.find(([id]) => id === selectedPanelId) ?? panels[0];
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
if (!panels.some(([id]) => id === selectedPanelId)) {
|
|
24
|
+
setSelectedPanelId(preferredPanelId(panels));
|
|
25
|
+
}
|
|
26
|
+
}, [panels, selectedPanelId]);
|
|
27
|
+
return (_jsxs(View, { style: styles.root, testID: panelTestID, children: [_jsxs(View, { accessibilityLabel: "Storybook addons panel", accessible: true, style: [styles.header, { borderBottomColor: theme.appBorderColor }], testID: `${panelTestID}-header`, children: [_jsx(ScrollView, { contentContainerStyle: styles.tabs, horizontal: true, keyboardShouldPersistTaps: "handled", showsHorizontalScrollIndicator: false, children: panels.map(([id, panel]) => {
|
|
28
|
+
const title = typeof panel.title === 'function' ? panel.title({}) : panel.title;
|
|
29
|
+
const selected = id === activePanel?.[0];
|
|
30
|
+
return (_jsx(Pressable, { accessibilityLabel: String(title), accessibilityRole: "tab", accessibilityState: { selected }, onPress: () => setSelectedPanelId(id), style: [
|
|
31
|
+
styles.tab,
|
|
32
|
+
selected && {
|
|
33
|
+
borderBottomColor: theme.barSelectedColor,
|
|
34
|
+
borderBottomWidth: 2,
|
|
35
|
+
},
|
|
36
|
+
], testID: `${addonTestID}-${id.replace(/[^a-z0-9]+/gi, '-').toLowerCase()}`, children: _jsx(Text, { style: { color: selected ? theme.barSelectedColor : theme.color.mediumdark }, children: String(title) }) }, id));
|
|
37
|
+
}) }), _jsx(Pressable, { accessibilityLabel: "Close addons panel", accessibilityRole: "button", onPress: onClose, style: styles.closeButton, testID: closeTestID, children: _jsx(Text, { style: { color: theme.color.mediumdark }, children: "Close" }) })] }), _jsx(ScrollView, { contentContainerStyle: styles.panelContent, keyboardShouldPersistTaps: "handled", children: !storyId ? (_jsx(Text, { style: { color: theme.color.mediumdark }, children: "No story selected." })) : !activePanel ? (_jsx(Text, { style: { color: theme.color.mediumdark }, children: "No addons loaded." })) : (_jsx(PanelRenderer, { panel: activePanel[1] })) }, storyId)] }));
|
|
38
|
+
}
|
|
39
|
+
function PanelRenderer({ panel }) {
|
|
40
|
+
return panel.render({ active: true });
|
|
41
|
+
}
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
root: {
|
|
44
|
+
flex: 1,
|
|
45
|
+
minHeight: 240,
|
|
46
|
+
},
|
|
47
|
+
header: {
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
borderBottomWidth: 1,
|
|
50
|
+
flexDirection: 'row',
|
|
51
|
+
},
|
|
52
|
+
tabs: {
|
|
53
|
+
alignItems: 'stretch',
|
|
54
|
+
},
|
|
55
|
+
tab: {
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
minHeight: 40,
|
|
59
|
+
paddingHorizontal: 14,
|
|
60
|
+
},
|
|
61
|
+
closeButton: {
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
minHeight: 40,
|
|
65
|
+
paddingHorizontal: 12,
|
|
66
|
+
},
|
|
67
|
+
panelContent: {
|
|
68
|
+
flexGrow: 1,
|
|
69
|
+
padding: 12,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=Win32AddonsPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Win32AddonsPanel.js","sourceRoot":"","sources":["../src/Win32AddonsPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,UAA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EAAE,mCAA2B,CAC1E,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CACjB,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,kCAA0B,CACzE,CAAC,CAAC,CAAC,CACF,KAAC,aAAa,IAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,GAAI,CACzC,IAP0D,OAAO,CAQvD,IACR,CACR,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,EAAE,KAAK,EAA6B;IACzD,OAAO,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC;QACP,SAAS,EAAE,GAAG;KACf;IACD,MAAM,EAAE;QACN,UAAU,EAAE,QAAQ;QACpB,iBAAiB,EAAE,CAAC;QACpB,aAAa,EAAE,KAAK;KACrB;IACD,IAAI,EAAE;QACJ,UAAU,EAAE,SAAS;KACtB;IACD,GAAG,EAAE;QACH,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,EAAE;KACtB;IACD,WAAW,EAAE;QACX,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,EAAE;KACtB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,CAAC;QACX,OAAO,EAAE,EAAE;KACZ;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { CalloutProps, DirectionalHint } from '@fluentui-react-native/callout';
|
|
3
|
+
type Win32CalloutPortalProps = React.PropsWithChildren<{
|
|
4
|
+
accessibilityLabel: string;
|
|
5
|
+
directionalHint: DirectionalHint;
|
|
6
|
+
height: number;
|
|
7
|
+
onDismiss: () => void;
|
|
8
|
+
onShow?: () => void;
|
|
9
|
+
target: CalloutProps['target'];
|
|
10
|
+
testID: string;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
width: number;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function Win32CalloutPortal({ accessibilityLabel, children, directionalHint, height, onDismiss, onShow, target, testID, visible, width, }: Win32CalloutPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=Win32CalloutPortal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Win32CalloutPortal.d.ts","sourceRoot":"","sources":["../src/Win32CalloutPortal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGpF,KAAK,uBAAuB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,eAAe,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,wBAAgB,kBAAkB,CAAC,EACjC,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,MAAM,EACN,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,EACN,OAAO,EACP,KAAK,GACN,EAAE,uBAAuB,2CAoCzB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import { Callout } from '@fluentui-react-native/callout';
|
|
4
|
+
import { useTheme } from '@storybook/react-native-theming';
|
|
5
|
+
export function Win32CalloutPortal({ accessibilityLabel, children, directionalHint, height, onDismiss, onShow, target, testID, visible, width, }) {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
if (!visible) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return (_jsx(Callout, { accessibilityLabel: accessibilityLabel, accessibilityRole: "dialog", backgroundColor: theme.background.content, borderColor: theme.appBorderColor, borderRadius: 8, borderWidth: 1, directionalHint: directionalHint, gapSpace: 4, maxHeight: height, maxWidth: width, minPadding: 12, minWidth: width, onDismiss: onDismiss, onShow: onShow, setInitialFocus: true, target: target, testID: testID, children: _jsx(View, { collapsable: false, style: [styles.content, { backgroundColor: theme.background.content, height, width }], testID: `${testID}-content`, children: children }) }));
|
|
11
|
+
}
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
content: {
|
|
14
|
+
overflow: 'hidden',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=Win32CalloutPortal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Win32CalloutPortal.js","sourceRoot":"","sources":["../src/Win32CalloutPortal.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAc3D,MAAM,UAAU,kBAAkB,CAAC,EACjC,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,MAAM,EACN,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,EACN,OAAO,EACP,KAAK,GACmB;IACxB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,OAAO,IACN,kBAAkB,EAAE,kBAAkB,EACtC,iBAAiB,EAAC,QAAQ,EAC1B,eAAe,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,EACzC,WAAW,EAAE,KAAK,CAAC,cAAc,EACjC,YAAY,EAAE,CAAC,EACf,WAAW,EAAE,CAAC,EACd,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,KAAK,EACf,UAAU,EAAE,EAAE,EACd,QAAQ,EAAE,KAAK,EACf,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,eAAe,QACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,YAEd,KAAC,IAAI,IACH,WAAW,EAAE,KAAK,EAClB,KAAK,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EACrF,MAAM,EAAE,GAAG,MAAM,UAAU,YAE1B,QAAQ,GACJ,GACC,CACX,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Win32ResizeHandleProps = {
|
|
2
|
+
direction: 'horizontal' | 'vertical';
|
|
3
|
+
onResize: (delta: number) => void;
|
|
4
|
+
testID: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function Win32ResizeHandle({ direction, onResize, testID }: Win32ResizeHandleProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=Win32ResizeHandle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Win32ResizeHandle.d.ts","sourceRoot":"","sources":["../src/Win32ResizeHandle.tsx"],"names":[],"mappings":"AAKA,KAAK,sBAAsB,GAAG;IAC5B,SAAS,EAAE,YAAY,GAAG,UAAU,CAAC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,sBAAsB,2CA0CxF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { PanResponder, StyleSheet, View } from 'react-native';
|
|
4
|
+
import { useTheme } from '@storybook/react-native-theming';
|
|
5
|
+
export function Win32ResizeHandle({ direction, onResize, testID }) {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
const previousDeltaRef = React.useRef(0);
|
|
8
|
+
const [active, setActive] = React.useState(false);
|
|
9
|
+
const horizontal = direction === 'horizontal';
|
|
10
|
+
const panResponder = React.useMemo(() => PanResponder.create({
|
|
11
|
+
onMoveShouldSetPanResponder: () => true,
|
|
12
|
+
onPanResponderGrant: () => {
|
|
13
|
+
previousDeltaRef.current = 0;
|
|
14
|
+
setActive(true);
|
|
15
|
+
},
|
|
16
|
+
onPanResponderMove: (_, gestureState) => {
|
|
17
|
+
const nextDelta = horizontal ? gestureState.dx : gestureState.dy;
|
|
18
|
+
onResize(nextDelta - previousDeltaRef.current);
|
|
19
|
+
previousDeltaRef.current = nextDelta;
|
|
20
|
+
},
|
|
21
|
+
onPanResponderRelease: () => setActive(false),
|
|
22
|
+
onPanResponderTerminate: () => setActive(false),
|
|
23
|
+
onPanResponderTerminationRequest: () => false,
|
|
24
|
+
onShouldBlockNativeResponder: () => true,
|
|
25
|
+
}), [horizontal, onResize]);
|
|
26
|
+
return (_jsx(View, { ...panResponder.panHandlers, accessibilityLabel: horizontal ? 'Resize story sidebar' : 'Resize addons panel', accessibilityRole: "adjustable", accessible: true, style: [
|
|
27
|
+
horizontal ? styles.horizontal : styles.vertical,
|
|
28
|
+
{
|
|
29
|
+
backgroundColor: active ? theme.barSelectedColor : 'transparent',
|
|
30
|
+
borderColor: active ? theme.barSelectedColor : theme.appBorderColor,
|
|
31
|
+
},
|
|
32
|
+
], testID: testID }));
|
|
33
|
+
}
|
|
34
|
+
const styles = StyleSheet.create({
|
|
35
|
+
horizontal: {
|
|
36
|
+
alignSelf: 'stretch',
|
|
37
|
+
borderLeftWidth: 1,
|
|
38
|
+
width: 6,
|
|
39
|
+
},
|
|
40
|
+
vertical: {
|
|
41
|
+
borderTopWidth: 1,
|
|
42
|
+
height: 6,
|
|
43
|
+
width: '100%',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=Win32ResizeHandle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Win32ResizeHandle.js","sourceRoot":"","sources":["../src/Win32ResizeHandle.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAQ3D,MAAM,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAA0B;IACvF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACzC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,SAAS,KAAK,YAAY,CAAC;IAC9C,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAChC,GA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,cAAc;aACpE;SACF,EACD,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE;QACV,SAAS,EAAE,SAAS;QACpB,eAAe,EAAE,CAAC;QAClB,KAAK,EAAE,CAAC;KACT;IACD,QAAQ,EAAE;QACR,cAAc,EAAE,CAAC;QACjB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,MAAM;KACd;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { View } from '@storybook/react-native';
|
|
2
|
+
export type DesktopStorybookOptions = {
|
|
3
|
+
enableWebsockets?: boolean;
|
|
4
|
+
host?: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
testIDPrefix?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function createDesktopStorybookApp(view: Pick<View, 'getStorybookUI'>, { enableWebsockets, host, port, testIDPrefix }?: DesktopStorybookOptions): () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=createDesktopStorybookApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDesktopStorybookApp.d.ts","sourceRoot":"","sources":["../src/createDesktopStorybookApp.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAQpD,MAAM,MAAM,uBAAuB,GAAG;IACpC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAClC,EAAE,gBAAuB,EAAE,IAAkB,EAAE,IAAI,EAAE,YAAkC,EAAE,GAAE,uBAA4B,iDAqCxH"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet, View as NativeView } from 'react-native';
|
|
3
|
+
import { DesktopDriverBridge } from './DesktopDriverBridge';
|
|
4
|
+
import { DesktopStorybookConfigProvider, useDesktopStorybookTestID } from './DesktopStorybookConfig';
|
|
5
|
+
import { StorybookThemeHost } from './StorybookTheme';
|
|
6
|
+
import { StorybookUIComponent } from './StorybookUI';
|
|
7
|
+
export function createDesktopStorybookApp(view, { enableWebsockets = true, host = '127.0.0.1', port, testIDPrefix = 'storybook-desktop' } = {}) {
|
|
8
|
+
const runtimeInstance = globalThis.__FURN_DESKTOP_STORYBOOK_INSTANCE__;
|
|
9
|
+
const memoryStore = {};
|
|
10
|
+
const storage = {
|
|
11
|
+
getItem: async (key) => (key in memoryStore ? memoryStore[key] : null),
|
|
12
|
+
setItem: async (key, value) => {
|
|
13
|
+
memoryStore[key] = value;
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const StorybookUI = view.getStorybookUI({
|
|
17
|
+
enableWebsockets,
|
|
18
|
+
host,
|
|
19
|
+
port: port ?? runtimeInstance?.storybookPort ?? 7007,
|
|
20
|
+
CustomUIComponent: StorybookUIComponent,
|
|
21
|
+
storage,
|
|
22
|
+
});
|
|
23
|
+
function DesktopStorybookApp() {
|
|
24
|
+
const resolvedTestIDPrefix = runtimeInstance?.testIDPrefix ?? testIDPrefix;
|
|
25
|
+
return (_jsx(DesktopStorybookConfigProvider, { runtimeInstance: runtimeInstance, testIDPrefix: resolvedTestIDPrefix, children: _jsxs(DesktopStorybookAppRoot, { children: [_jsx(DesktopDriverBridge, {}), _jsx(StorybookThemeHost, { children: _jsx(StorybookUI, {}) })] }) }));
|
|
26
|
+
}
|
|
27
|
+
return DesktopStorybookApp;
|
|
28
|
+
}
|
|
29
|
+
function DesktopStorybookAppRoot({ children }) {
|
|
30
|
+
const testID = useDesktopStorybookTestID('app-root');
|
|
31
|
+
return (_jsx(NativeView, { style: styles.root, testID: testID, children: children }));
|
|
32
|
+
}
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
root: {
|
|
35
|
+
flex: 1,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=createDesktopStorybookApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDesktopStorybookApp.js","sourceRoot":"","sources":["../src/createDesktopStorybookApp.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,8BAA8B,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AASrD,MAAM,UAAU,yBAAyB,CACvC,IAAkC,EAClC,EAAE,gBAAgB,GAAG,IAAI,EAAE,IAAI,GAAG,WAAW,EAAE,IAAI,EAAE,YAAY,GAAG,mBAAmB,EAAE,GAA4B,EAAE;IAEvH,MAAM,eAAe,GACnB,UAGD,CAAC,mCAAmC,CAAC;IACtC,MAAM,WAAW,GAA2B,EAAE,CAAC;IAC/C,MAAM,OAAO,GAAG;QACd,OAAO,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9E,OAAO,EAAE,KAAK,EAAE,GAAW,EAAE,KAAa,EAAE,EAAE;YAC5C,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC3B,CAAC;KACF,CAAC;IACF,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC;QACtC,gBAAgB;QAChB,IAAI;QACJ,IAAI,EAAE,IAAI,IAAI,eAAe,EAAE,aAAa,IAAI,IAAI;QACpD,iBAAiB,EAAE,oBAAoB;QACvC,OAAO;KACR,CAAC,CAAC;IAEH,SAAS,mBAAmB;QAC1B,MAAM,oBAAoB,GAAG,eAAe,EAAE,YAAY,IAAI,YAAY,CAAC;QAC3E,OAAO,CACL,KAAC,8BAA8B,IAAC,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,oBAAoB,YAClG,MAAC,uBAAuB,eACtB,KAAC,mBAAmB,KAAG,EACvB,KAAC,kBAAkB,cACjB,KAAC,WAAW,KAAG,GACI,IACG,GACK,CAClC,CAAC;IACJ,CAAC;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED,SAAS,uBAAuB,CAAC,EAAE,QAAQ,EAA2B;IACpE,MAAM,MAAM,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACrD,OAAO,CACL,KAAC,UAAU,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,YAC3C,QAAQ,GACE,CACd,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDesktopStorybookPreview.d.ts","sourceRoot":"","sources":["../src/createDesktopStorybookPreview.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAKvD,wBAAgB,6BAA6B,IAAI,OAAO,CAevD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import { DesktopStoryRoot } from './DesktopStoryRoot';
|
|
4
|
+
import { StorybookThemeProvider } from './StorybookTheme';
|
|
5
|
+
export function createDesktopStorybookPreview() {
|
|
6
|
+
return {
|
|
7
|
+
decorators: [
|
|
8
|
+
(Story, context) => (_jsx(StorybookThemeProvider, { children: _jsx(DesktopStoryRoot, { storyId: context.id, children: _jsx(View, { style: styles.story, children: _jsx(Story, {}) }) }) })),
|
|
9
|
+
],
|
|
10
|
+
parameters: {},
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const styles = StyleSheet.create({
|
|
14
|
+
story: {
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
flex: 1,
|
|
17
|
+
justifyContent: 'center',
|
|
18
|
+
padding: 16,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=createDesktopStorybookPreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDesktopStorybookPreview.js","sourceRoot":"","sources":["../src/createDesktopStorybookPreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,UAAU,6BAA6B;IAC3C,OAAO;QACL,UAAU,EAAE;YACV,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,CAClB,KAAC,sBAAsB,cACrB,KAAC,gBAAgB,IAAC,OAAO,EAAE,OAAO,CAAC,EAAE,YACnC,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YACvB,KAAC,KAAK,KAAG,GACJ,GACU,GACI,CAC1B;SACF;QACD,UAAU,EAAE,EAAE;KACf,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE;QACL,UAAU,EAAE,QAAQ;QACpB,IAAI,EAAE,CAAC;QACP,cAAc,EAAE,QAAQ;QACxB,OAAO,EAAE,EAAE;KACZ;CACF,CAAC,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createDesktopStorybookApp } from './createDesktopStorybookApp';
|
|
2
|
+
export type { DesktopStorybookOptions } from './createDesktopStorybookApp';
|
|
3
|
+
export { createDesktopStorybookPreview } from './createDesktopStorybookPreview';
|
|
4
|
+
export { desktopPrepareStoryEvent, desktopRequestHelloEvent, desktopRuntimeHelloEvent, desktopStoryErrorEvent, desktopStoryReadyEvent, } from './DesktopDriverBridge';
|
|
5
|
+
export { DesktopStoryRoot } from './DesktopStoryRoot';
|
|
6
|
+
export type { DesktopRuntimeSelection, DesktopStorybookRuntimeInstance } from './DesktopStorybookConfig';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,YAAY,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createDesktopStorybookApp } from './createDesktopStorybookApp';
|
|
2
|
+
export { createDesktopStorybookPreview } from './createDesktopStorybookPreview';
|
|
3
|
+
export { desktopPrepareStoryEvent, desktopRequestHelloEvent, desktopRuntimeHelloEvent, desktopStoryErrorEvent, desktopStoryReadyEvent, } from './DesktopDriverBridge';
|
|
4
|
+
export { DesktopStoryRoot } from './DesktopStoryRoot';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|