@storybook/react-native 7.6.8-alpha.0 → 7.6.9-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/V6.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { P as Params, R as ReactNativeFramework } from './View-7a09870e.js';
3
- export { C as ComponentMeta, c as ComponentStory, a as ComponentStoryFn, b as ComponentStoryObj, M as Meta, f as Story, d as StoryFn, S as StoryFnReactReturnType, e as StoryObj } from './View-7a09870e.js';
2
+ import { h as Params, b as ReactNativeRenderer } from './View-63944515.js';
3
+ export { D as Decorator, L as Loadable, e as Loader, M as Meta, g as Preview, P as PreviewError, a as RenderStoryFunction, R as RequireContext, f as StoryContext, c as StoryFn, S as StoryFnReactReturnType, d as StoryObj } from './View-63944515.js';
4
4
  import { ClientApi } from '@storybook/preview-api';
5
- import { b as Addon_StoryApi } from './index.d-82fc9196.js';
6
- export { a as ArgTypes, A as Args, P as Parameters, S as StoryContext } from './index.d-82fc9196.js';
5
+ import { b as Addon_StoryApi } from './index.d-c716d0d7.js';
6
+ export { a as ArgTypes, A as Args, P as Parameters, R as RenderContext, S as StrictArgs } from './index.d-c716d0d7.js';
7
7
  import { ReactNode } from 'react';
8
8
  export { Theme, darkTheme, theme } from '@storybook/react-native-theming';
9
9
  import '@storybook/csf';
10
10
  import '@storybook/preview-web';
11
+ import 'type-fest';
11
12
  import '@storybook/channels';
12
13
 
13
14
  declare const configure: (loadable: any, m: {
@@ -16,7 +17,7 @@ declare const configure: (loadable: any, m: {
16
17
  };
17
18
  }) => void;
18
19
 
19
- type C = ClientApi<ReactNativeFramework>;
20
+ type C = ClientApi<ReactNativeRenderer>;
20
21
  declare const addDecorator: C['addDecorator'];
21
22
  declare const addParameters: C['addParameters'];
22
23
  declare const addArgsEnhancer: C['addArgsEnhancer'];
@@ -25,4 +26,4 @@ declare const raw: C['raw'];
25
26
  declare const storiesOf: (kind: string, m: any) => Addon_StoryApi<ReactNode>;
26
27
  declare const getStorybookUI: (params?: Partial<Params>) => () => react_jsx_runtime.JSX.Element;
27
28
 
28
- export { ReactNativeFramework, addArgTypesEnhancer, addArgsEnhancer, addDecorator, addParameters, configure, getStorybookUI, raw, storiesOf };
29
+ export { ReactNativeRenderer, addArgTypesEnhancer, addArgsEnhancer, addDecorator, addParameters, configure, getStorybookUI, raw, storiesOf };
package/dist/V6.js CHANGED
@@ -547,17 +547,16 @@ var createStore = () => {
547
547
  };
548
548
  const mountDependencies = (atom2, atomState, prevDependencies) => {
549
549
  const depSet = new Set(atomState.d.keys());
550
+ const maybeUnmountAtomSet = /* @__PURE__ */ new Set();
550
551
  prevDependencies == null ? void 0 : prevDependencies.forEach((_, a) => {
551
552
  if (depSet.has(a)) {
552
553
  depSet.delete(a);
553
554
  return;
554
555
  }
556
+ maybeUnmountAtomSet.add(a);
555
557
  const mounted = mountedMap.get(a);
556
558
  if (mounted) {
557
559
  mounted.t.delete(atom2);
558
- if (canUnmountAtom(a, mounted)) {
559
- unmountAtom(a);
560
- }
561
560
  }
562
561
  });
563
562
  depSet.forEach((a) => {
@@ -568,6 +567,12 @@ var createStore = () => {
568
567
  mountAtom(a, atom2);
569
568
  }
570
569
  });
570
+ maybeUnmountAtomSet.forEach((a) => {
571
+ const mounted = mountedMap.get(a);
572
+ if (mounted && canUnmountAtom(a, mounted)) {
573
+ unmountAtom(a);
574
+ }
575
+ });
571
576
  };
572
577
  const flushPending = () => {
573
578
  let flushed;
@@ -667,11 +672,6 @@ if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
667
672
  }
668
673
  var getDefaultStore = () => {
669
674
  if (!defaultStore) {
670
- if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production" && globalThis.__NUMBER_OF_JOTAI_INSTANCES__ !== 1) {
671
- console.warn(
672
- "Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"
673
- );
674
- }
675
675
  defaultStore = createStore();
676
676
  }
677
677
  return defaultStore;
@@ -0,0 +1,111 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Renderer, StoryContext as StoryContext$2 } from '@storybook/csf';
3
+ import { PreviewWithSelection } from '@storybook/preview-web';
4
+ import { Theme } from '@storybook/react-native-theming';
5
+ import { L as LoaderFunction, R as RenderContext, A as Args, C as ComponentAnnotations, c as AnnotatedStoryFn, d as ArgsStoryFn, e as ArgsFromMeta, f as StoryAnnotations, S as StrictArgs, D as DecoratorFunction, g as StoryContext$1, h as ProjectAnnotations, i as StoryIndex } from './index.d-c716d0d7.js';
6
+ import { ComponentType, ComponentProps } from 'react';
7
+ import { Simplify, SetOptional } from 'type-fest';
8
+ import { Channel } from '@storybook/channels';
9
+
10
+ interface PreviewError {
11
+ message?: string;
12
+ stack?: string;
13
+ }
14
+ interface RequireContext {
15
+ keys: () => string[];
16
+ (id: string): any;
17
+ resolve(id: string): string;
18
+ }
19
+ type Loadable = RequireContext | RequireContext[] | LoaderFunction;
20
+
21
+ type RenderStoryFunction = (context: RenderContext) => void;
22
+ type StoryFnReactReturnType = JSX.Element;
23
+ interface ReactNativeRenderer extends Renderer {
24
+ component: ComponentType<any>;
25
+ storyResult: StoryFnReactReturnType;
26
+ }
27
+
28
+ /**
29
+ * Metadata to configure the stories for a component.
30
+ *
31
+ * @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
32
+ */
33
+ type Meta<TCmpOrArgs = Args> = [TCmpOrArgs] extends [ComponentType<any>] ? ComponentAnnotations<ReactNativeRenderer, ComponentProps<TCmpOrArgs>> : ComponentAnnotations<ReactNativeRenderer, TCmpOrArgs>;
34
+ /**
35
+ * Story function that represents a CSFv2 component example.
36
+ *
37
+ * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
38
+ */
39
+ type StoryFn<TCmpOrArgs = Args> = [TCmpOrArgs] extends [ComponentType<any>] ? AnnotatedStoryFn<ReactNativeRenderer, ComponentProps<TCmpOrArgs>> : AnnotatedStoryFn<ReactNativeRenderer, TCmpOrArgs>;
40
+ /**
41
+ * Story object that represents a CSFv3 component example.
42
+ *
43
+ * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
44
+ */
45
+ type StoryObj<TMetaOrCmpOrArgs = Args> = [TMetaOrCmpOrArgs] extends [
46
+ {
47
+ render?: ArgsStoryFn<ReactNativeRenderer, any>;
48
+ component?: infer Component;
49
+ args?: infer DefaultArgs;
50
+ }
51
+ ] ? Simplify<(Component extends ComponentType<any> ? ComponentProps<Component> : unknown) & ArgsFromMeta<ReactNativeRenderer, TMetaOrCmpOrArgs>> extends infer TArgs ? StoryAnnotations<ReactNativeRenderer, AddMocks<TArgs, DefaultArgs>, SetOptional<TArgs, keyof TArgs & keyof DefaultArgs>> : never : TMetaOrCmpOrArgs extends ComponentType<any> ? StoryAnnotations<ReactNativeRenderer, ComponentProps<TMetaOrCmpOrArgs>> : StoryAnnotations<ReactNativeRenderer, TMetaOrCmpOrArgs>;
52
+ type AddMocks<TArgs, DefaultArgs> = Simplify<{
53
+ [T in keyof TArgs]: T extends keyof DefaultArgs ? DefaultArgs[T] extends (...args: any) => any & {
54
+ mock: {};
55
+ } ? DefaultArgs[T] : TArgs[T] : TArgs[T];
56
+ }>;
57
+ type Decorator<TArgs = StrictArgs> = DecoratorFunction<ReactNativeRenderer, TArgs>;
58
+ type Loader<TArgs = StrictArgs> = LoaderFunction<ReactNativeRenderer, TArgs>;
59
+ type StoryContext<TArgs = StrictArgs> = StoryContext$1<ReactNativeRenderer, TArgs>;
60
+ type Preview = ProjectAnnotations<ReactNativeRenderer>;
61
+
62
+ type StoryKind = string;
63
+ type StoryName = string;
64
+ type InitialSelection = `${StoryKind}--${StoryName}` | {
65
+ /**
66
+ * Kind is the default export name or the storiesOf("name") name
67
+ */
68
+ kind: StoryKind;
69
+ /**
70
+ * Name is the named export or the .add("name") name
71
+ */
72
+ name: StoryName;
73
+ };
74
+ type DeepPartial<T> = T extends object ? {
75
+ [P in keyof T]?: DeepPartial<T[P]>;
76
+ } : T;
77
+ type Params = {
78
+ onDeviceUI?: boolean;
79
+ enableWebsockets?: boolean;
80
+ query?: string;
81
+ host?: string;
82
+ port?: number;
83
+ secured?: boolean;
84
+ initialSelection?: InitialSelection;
85
+ shouldPersistSelection?: boolean;
86
+ tabOpen?: number;
87
+ isUIHidden?: boolean;
88
+ isSplitPanelVisible?: boolean;
89
+ shouldDisableKeyboardAvoidingView?: boolean;
90
+ keyboardAvoidingViewVerticalOffset?: number;
91
+ theme: DeepPartial<Theme>;
92
+ };
93
+ declare class View {
94
+ _storyIndex: StoryIndex;
95
+ _setStory: (story: StoryContext$2<ReactNativeRenderer>) => void;
96
+ _forceRerender: () => void;
97
+ _ready: boolean;
98
+ _preview: PreviewWithSelection<ReactNativeRenderer>;
99
+ _asyncStorageStoryId: string;
100
+ _webUrl: string;
101
+ _channel: Channel;
102
+ constructor(preview: PreviewWithSelection<ReactNativeRenderer>, channel: Channel);
103
+ _getInitialStory: ({ initialSelection, shouldPersistSelection, }?: Partial<Params>) => Promise<{
104
+ storySpecifier: string;
105
+ viewMode: string;
106
+ }>;
107
+ _getServerChannel: (params?: Partial<Params>) => Channel;
108
+ getStorybookUI: (params?: Partial<Params>) => () => react_jsx_runtime.JSX.Element;
109
+ }
110
+
111
+ export { Decorator as D, Loadable as L, Meta as M, PreviewError as P, RequireContext as R, StoryFnReactReturnType as S, View as V, RenderStoryFunction as a, ReactNativeRenderer as b, StoryFn as c, StoryObj as d, Loader as e, StoryContext as f, Preview as g, Params as h };