vitest-native 0.7.0 → 0.9.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 (46) hide show
  1. package/CHANGELOG.md +373 -0
  2. package/README.md +32 -14
  3. package/dist/cli.cjs +506 -0
  4. package/dist/cli.d.cts +4 -0
  5. package/dist/cli.d.mts +4 -0
  6. package/dist/cli.mjs +502 -0
  7. package/dist/ecosystem-BIWaVwYL.cjs +294 -0
  8. package/dist/ecosystem-EFtHnKS9.mjs +256 -0
  9. package/dist/{index-DbfKy_bm.d.mts → index-CEgRDdhd.d.cts} +22 -3
  10. package/dist/{index-BgzErxHj.d.cts → index-j-0tueBr.d.mts} +20 -5
  11. package/dist/index.cjs +345 -200
  12. package/dist/index.d.cts +1 -1
  13. package/dist/index.d.mts +1 -1
  14. package/dist/index.mjs +341 -196
  15. package/dist/jest-compat/setup.mjs +65 -1
  16. package/dist/native/boundary.mjs +108 -30
  17. package/dist/native/compile-cache.mjs +45 -0
  18. package/dist/native/explain.mjs +69 -0
  19. package/dist/native/hooks.mjs +77 -4
  20. package/dist/native/loader.mjs +36 -7
  21. package/dist/native/match.mjs +107 -8
  22. package/dist/native/registry.mjs +471 -0
  23. package/dist/native/reset.mjs +18 -12
  24. package/dist/native/runner.mjs +13 -7
  25. package/dist/native/setup.mjs +44 -0
  26. package/dist/native/transform.mjs +88 -19
  27. package/dist/native/worker.mjs +13 -0
  28. package/dist/pool-CJmjRgsB.mjs +117 -0
  29. package/dist/pool-DzsEo9vv.cjs +121 -0
  30. package/dist/{preset-map-CNBOeqAu.cjs → preset-map-CG4FMtsl.cjs} +5 -1
  31. package/dist/{preset-map-C1UwEald.mjs → preset-map-CNsZKfvu.mjs} +5 -1
  32. package/dist/{presets-BTG8fiNF.cjs → presets-C4faM3ds.cjs} +838 -2
  33. package/dist/{presets-BFuAMwYQ.mjs → presets-CuDrNA_W.mjs} +761 -3
  34. package/dist/presets.cjs +5 -1
  35. package/dist/presets.d.cts +2 -2
  36. package/dist/presets.d.mts +2 -2
  37. package/dist/presets.mjs +2 -2
  38. package/dist/setup.cjs +327 -347
  39. package/dist/setup.mjs +318 -338
  40. package/docs/hot-default-design.md +129 -0
  41. package/docs/migrating-from-jest.md +43 -7
  42. package/docs/migrating-from-vitest-react-native.md +1 -1
  43. package/docs/release-readiness.md +2 -1
  44. package/package.json +23 -7
  45. package/dist/pool-B7LBfcMQ.mjs +0 -67
  46. package/dist/pool-p54QV1dQ.cjs +0 -69
@@ -442,7 +442,26 @@ function buildPressableHostProps(props, ref) {
442
442
  //#endregion
443
443
  //#region src/mocks/components/Pressable.ts
444
444
  function createPressableMock() {
445
- const Pressable = react.default.forwardRef((props, ref) => react.default.createElement("Pressable", buildPressableHostProps(props, ref)));
445
+ const Pressable = react.default.forwardRef((props, ref) => {
446
+ const { style, children, onPressIn, onPressOut, ...rest } = props;
447
+ const [pressed, setPressed] = react.default.useState(false);
448
+ const state = { pressed };
449
+ const resolvedStyle = typeof style === "function" ? style(state) : style;
450
+ const resolvedChildren = typeof children === "function" ? children(state) : children;
451
+ const hostProps = buildPressableHostProps({
452
+ ...rest,
453
+ style: resolvedStyle,
454
+ onPressIn: (e) => {
455
+ setPressed(true);
456
+ onPressIn?.(e);
457
+ },
458
+ onPressOut: (e) => {
459
+ setPressed(false);
460
+ onPressOut?.(e);
461
+ }
462
+ }, ref);
463
+ return react.default.createElement("Pressable", hostProps, resolvedChildren);
464
+ });
446
465
  Pressable.displayName = "Pressable";
447
466
  return Pressable;
448
467
  }
@@ -1802,12 +1821,750 @@ function vectorIcons() {
1802
1821
  };
1803
1822
  }
1804
1823
  //#endregion
1824
+ //#region src/presets/flash-list.ts
1825
+ function flashList() {
1826
+ return {
1827
+ name: "flashList",
1828
+ modules: { "@shopify/flash-list": {
1829
+ exports: [
1830
+ "FlashList",
1831
+ "AnimatedFlashList",
1832
+ "LayoutCommitObserver",
1833
+ "ViewToken",
1834
+ "RenderTargetOptions",
1835
+ "useRecyclingState",
1836
+ "useLayoutState",
1837
+ "useMappingHelper",
1838
+ "useFlashListContext",
1839
+ "useBenchmark"
1840
+ ],
1841
+ factory: () => {
1842
+ const renderElement = (Component) => {
1843
+ if (Component == null) return null;
1844
+ if (react.default.isValidElement(Component)) return Component;
1845
+ return react.default.createElement(Component);
1846
+ };
1847
+ function createFlashList(name) {
1848
+ const List = react.default.forwardRef((props, ref) => {
1849
+ const { data, renderItem, keyExtractor, extraData, ListHeaderComponent, ListFooterComponent, ListEmptyComponent, ...rest } = props;
1850
+ react.default.useImperativeHandle(ref, () => ({
1851
+ scrollToEnd: () => {},
1852
+ scrollToIndex: () => {},
1853
+ scrollToItem: () => {},
1854
+ scrollToOffset: () => {},
1855
+ scrollToTop: () => {},
1856
+ flashScrollIndicators: () => {},
1857
+ recordInteraction: () => {},
1858
+ recomputeViewableItems: () => {},
1859
+ prepareForLayoutAnimationRender: () => {},
1860
+ getScrollableNode: () => null,
1861
+ getNativeScrollRef: () => null
1862
+ }));
1863
+ const items = Array.isArray(data) ? data : [];
1864
+ const rows = items.length === 0 ? renderElement(ListEmptyComponent) : items.map((item, index) => {
1865
+ const element = renderItem ? renderItem({
1866
+ item,
1867
+ index,
1868
+ extraData,
1869
+ target: "Cell"
1870
+ }) : null;
1871
+ if (element == null) return null;
1872
+ const key = keyExtractor ? keyExtractor(item, index) : String(index);
1873
+ return react.default.createElement(react.default.Fragment, { key }, element);
1874
+ });
1875
+ return react.default.createElement(name, rest, renderElement(ListHeaderComponent), rows, renderElement(ListFooterComponent));
1876
+ });
1877
+ List.displayName = name;
1878
+ return List;
1879
+ }
1880
+ const FlashList = createFlashList("FlashList");
1881
+ const LayoutCommitObserver = react.default.forwardRef((props, ref) => react.default.createElement("LayoutCommitObserver", {
1882
+ ...props,
1883
+ ref
1884
+ }, props.children));
1885
+ LayoutCommitObserver.displayName = "LayoutCommitObserver";
1886
+ return {
1887
+ __esModule: true,
1888
+ default: FlashList,
1889
+ FlashList,
1890
+ AnimatedFlashList: createFlashList("AnimatedFlashList"),
1891
+ LayoutCommitObserver,
1892
+ RenderTargetOptions: {
1893
+ Cell: "Cell",
1894
+ StickyHeader: "StickyHeader",
1895
+ Measurement: "Measurement"
1896
+ },
1897
+ ViewToken: function ViewToken() {},
1898
+ useRecyclingState: (initialState) => react.default.useState(initialState),
1899
+ useLayoutState: (initialState) => react.default.useState(initialState),
1900
+ useMappingHelper: () => ({ getMappingKey: (_item, index) => String(index) }),
1901
+ useFlashListContext: () => void 0,
1902
+ useBenchmark: () => {}
1903
+ };
1904
+ }
1905
+ } }
1906
+ };
1907
+ }
1908
+ //#endregion
1909
+ //#region src/mocks/components/TextInput.ts
1910
+ function createTextInputMock() {
1911
+ const TextInput = react.default.forwardRef((props, ref) => {
1912
+ const instanceMethods = {
1913
+ focus: vitest.vi.fn(),
1914
+ blur: vitest.vi.fn(),
1915
+ clear: vitest.vi.fn(),
1916
+ isFocused: vitest.vi.fn(() => false),
1917
+ setNativeProps: vitest.vi.fn()
1918
+ };
1919
+ react.default.useImperativeHandle(ref, () => instanceMethods);
1920
+ return react.default.createElement("TextInput", {
1921
+ ...props,
1922
+ ref
1923
+ });
1924
+ });
1925
+ TextInput.displayName = "TextInput";
1926
+ return TextInput;
1927
+ }
1928
+ //#endregion
1929
+ //#region src/mocks/components/ScrollView.ts
1930
+ function createScrollViewMock() {
1931
+ const ScrollView = react.default.forwardRef((props, ref) => {
1932
+ const { children, refreshControl, ...rest } = props;
1933
+ const instanceMethods = {
1934
+ scrollTo: vitest.vi.fn(),
1935
+ scrollToEnd: vitest.vi.fn(),
1936
+ flashScrollIndicators: vitest.vi.fn(),
1937
+ getScrollResponder: vitest.vi.fn(() => ({})),
1938
+ getInnerViewNode: vitest.vi.fn(),
1939
+ setNativeProps: vitest.vi.fn()
1940
+ };
1941
+ react.default.useImperativeHandle(ref, () => instanceMethods);
1942
+ return react.default.createElement("RCTScrollView", {
1943
+ ...rest,
1944
+ ref
1945
+ }, refreshControl, react.default.createElement("View", null, children));
1946
+ });
1947
+ ScrollView.displayName = "ScrollView";
1948
+ return ScrollView;
1949
+ }
1950
+ //#endregion
1951
+ //#region src/mocks/components/FlatList.ts
1952
+ function createFlatListMock() {
1953
+ const FlatList = react.default.forwardRef((props, ref) => {
1954
+ const { data, renderItem, keyExtractor, ListHeaderComponent, ListFooterComponent, ListEmptyComponent, ItemSeparatorComponent, refreshControl, ...rest } = props;
1955
+ const instanceMethods = {
1956
+ scrollToEnd: vitest.vi.fn(),
1957
+ scrollToIndex: vitest.vi.fn(),
1958
+ scrollToItem: vitest.vi.fn(),
1959
+ scrollToOffset: vitest.vi.fn(),
1960
+ recordInteraction: vitest.vi.fn(),
1961
+ flashScrollIndicators: vitest.vi.fn(),
1962
+ getScrollResponder: vitest.vi.fn(() => ({})),
1963
+ getNativeScrollRef: vitest.vi.fn(),
1964
+ getScrollableNode: vitest.vi.fn(),
1965
+ setNativeProps: vitest.vi.fn()
1966
+ };
1967
+ react.default.useImperativeHandle(ref, () => instanceMethods);
1968
+ const children = [];
1969
+ if (ListHeaderComponent) children.push(react.default.createElement("FlatList-Header", { key: "__header" }, typeof ListHeaderComponent === "function" ? react.default.createElement(ListHeaderComponent) : ListHeaderComponent));
1970
+ if (data && data.length > 0) data.forEach((item, index) => {
1971
+ const key = keyExtractor ? keyExtractor(item, index) : String(index);
1972
+ children.push(react.default.createElement(react.default.Fragment, { key }, renderItem({
1973
+ item,
1974
+ index,
1975
+ separators: {
1976
+ highlight: vitest.vi.fn(),
1977
+ unhighlight: vitest.vi.fn(),
1978
+ updateProps: vitest.vi.fn()
1979
+ }
1980
+ })));
1981
+ if (ItemSeparatorComponent && index < data.length - 1) children.push(react.default.createElement(react.default.Fragment, { key: `separator-${index}` }, typeof ItemSeparatorComponent === "function" ? react.default.createElement(ItemSeparatorComponent) : ItemSeparatorComponent));
1982
+ });
1983
+ else if (ListEmptyComponent) children.push(react.default.createElement("FlatList-Empty", { key: "__empty" }, typeof ListEmptyComponent === "function" ? react.default.createElement(ListEmptyComponent) : ListEmptyComponent));
1984
+ if (ListFooterComponent) children.push(react.default.createElement("FlatList-Footer", { key: "__footer" }, typeof ListFooterComponent === "function" ? react.default.createElement(ListFooterComponent) : ListFooterComponent));
1985
+ if (refreshControl) children.unshift(refreshControl);
1986
+ return react.default.createElement("FlatList", {
1987
+ ...rest,
1988
+ ref
1989
+ }, ...children);
1990
+ });
1991
+ FlatList.displayName = "FlatList";
1992
+ return FlatList;
1993
+ }
1994
+ //#endregion
1995
+ //#region src/mocks/components/SectionList.ts
1996
+ function createSectionListMock() {
1997
+ const SectionList = react.default.forwardRef((props, ref) => {
1998
+ const { sections, renderItem, renderSectionHeader, renderSectionFooter, keyExtractor, refreshControl, ListEmptyComponent, ListHeaderComponent, ListFooterComponent, ItemSeparatorComponent, SectionSeparatorComponent, ...rest } = props;
1999
+ const instanceMethods = {
2000
+ scrollToEnd: vitest.vi.fn(),
2001
+ scrollToIndex: vitest.vi.fn(),
2002
+ scrollToLocation: vitest.vi.fn(),
2003
+ recordInteraction: vitest.vi.fn(),
2004
+ flashScrollIndicators: vitest.vi.fn(),
2005
+ getScrollResponder: vitest.vi.fn(() => ({})),
2006
+ getNativeScrollRef: vitest.vi.fn(),
2007
+ getScrollableNode: vitest.vi.fn(),
2008
+ setNativeProps: vitest.vi.fn()
2009
+ };
2010
+ react.default.useImperativeHandle(ref, () => instanceMethods);
2011
+ const children = [];
2012
+ if (ListHeaderComponent) children.push(react.default.createElement("SectionList-Header", { key: "__header" }, typeof ListHeaderComponent === "function" ? react.default.createElement(ListHeaderComponent) : ListHeaderComponent));
2013
+ if (sections) sections.forEach((section, sectionIndex) => {
2014
+ if (renderSectionHeader) children.push(react.default.createElement(react.default.Fragment, { key: `header-${sectionIndex}` }, renderSectionHeader({ section })));
2015
+ if (SectionSeparatorComponent && sectionIndex > 0) children.push(react.default.createElement(react.default.Fragment, { key: `section-sep-${sectionIndex}` }, typeof SectionSeparatorComponent === "function" ? react.default.createElement(SectionSeparatorComponent) : SectionSeparatorComponent));
2016
+ if (section.data) section.data.forEach((item, index) => {
2017
+ const key = keyExtractor ? keyExtractor(item, index) : `${sectionIndex}-${index}`;
2018
+ children.push(react.default.createElement(react.default.Fragment, { key }, renderItem({
2019
+ item,
2020
+ index,
2021
+ section,
2022
+ separators: {
2023
+ highlight: vitest.vi.fn(),
2024
+ unhighlight: vitest.vi.fn(),
2025
+ updateProps: vitest.vi.fn()
2026
+ }
2027
+ })));
2028
+ if (ItemSeparatorComponent && index < section.data.length - 1) children.push(react.default.createElement(react.default.Fragment, { key: `sep-${sectionIndex}-${index}` }, typeof ItemSeparatorComponent === "function" ? react.default.createElement(ItemSeparatorComponent) : ItemSeparatorComponent));
2029
+ });
2030
+ if (renderSectionFooter) children.push(react.default.createElement(react.default.Fragment, { key: `footer-${sectionIndex}` }, renderSectionFooter({ section })));
2031
+ });
2032
+ if (ListFooterComponent) children.push(react.default.createElement("SectionList-Footer", { key: "__footer" }, typeof ListFooterComponent === "function" ? react.default.createElement(ListFooterComponent) : ListFooterComponent));
2033
+ if (refreshControl) children.unshift(refreshControl);
2034
+ if ((!sections || sections.length === 0) && ListEmptyComponent) children.push(react.default.createElement("SectionList-Empty", { key: "__empty" }, typeof ListEmptyComponent === "function" ? react.default.createElement(ListEmptyComponent) : ListEmptyComponent));
2035
+ return react.default.createElement("SectionList", {
2036
+ ...rest,
2037
+ ref
2038
+ }, ...children);
2039
+ });
2040
+ SectionList.displayName = "SectionList";
2041
+ return SectionList;
2042
+ }
2043
+ //#endregion
2044
+ //#region src/mocks/components/VirtualizedList.ts
2045
+ function createVirtualizedListMock() {
2046
+ const VirtualizedList = react.default.forwardRef((props, ref) => {
2047
+ const { data, renderItem, keyExtractor, getItemCount, getItem, ListHeaderComponent, ListFooterComponent, ListEmptyComponent, ...rest } = props;
2048
+ const instanceMethods = {
2049
+ scrollToEnd: vitest.vi.fn(),
2050
+ scrollToIndex: vitest.vi.fn(),
2051
+ scrollToItem: vitest.vi.fn(),
2052
+ scrollToOffset: vitest.vi.fn(),
2053
+ recordInteraction: vitest.vi.fn(),
2054
+ flashScrollIndicators: vitest.vi.fn(),
2055
+ getScrollResponder: vitest.vi.fn(() => ({})),
2056
+ getNativeScrollRef: vitest.vi.fn(),
2057
+ getScrollableNode: vitest.vi.fn(),
2058
+ setNativeProps: vitest.vi.fn()
2059
+ };
2060
+ react.default.useImperativeHandle(ref, () => instanceMethods);
2061
+ const children = [];
2062
+ if (ListHeaderComponent) children.push(react.default.createElement("VirtualizedList-Header", { key: "__header" }, typeof ListHeaderComponent === "function" ? react.default.createElement(ListHeaderComponent) : ListHeaderComponent));
2063
+ const itemCount = getItemCount ? getItemCount(data) : data ? data.length : 0;
2064
+ if (itemCount > 0) for (let index = 0; index < itemCount; index++) {
2065
+ const item = getItem ? getItem(data, index) : data[index];
2066
+ const key = keyExtractor ? keyExtractor(item, index) : String(index);
2067
+ children.push(react.default.createElement(react.default.Fragment, { key }, renderItem({
2068
+ item,
2069
+ index,
2070
+ separators: {}
2071
+ })));
2072
+ }
2073
+ else if (ListEmptyComponent) children.push(react.default.createElement("VirtualizedList-Empty", { key: "__empty" }, typeof ListEmptyComponent === "function" ? react.default.createElement(ListEmptyComponent) : ListEmptyComponent));
2074
+ if (ListFooterComponent) children.push(react.default.createElement("VirtualizedList-Footer", { key: "__footer" }, typeof ListFooterComponent === "function" ? react.default.createElement(ListFooterComponent) : ListFooterComponent));
2075
+ return react.default.createElement("VirtualizedList", {
2076
+ ...rest,
2077
+ ref
2078
+ }, ...children);
2079
+ });
2080
+ VirtualizedList.displayName = "VirtualizedList";
2081
+ return VirtualizedList;
2082
+ }
2083
+ //#endregion
2084
+ //#region src/mocks/components/TouchableOpacity.ts
2085
+ function createTouchableOpacityMock() {
2086
+ const TouchableOpacity = react.default.forwardRef((props, ref) => react.default.createElement("TouchableOpacity", buildPressableHostProps(props, ref)));
2087
+ TouchableOpacity.displayName = "TouchableOpacity";
2088
+ return TouchableOpacity;
2089
+ }
2090
+ //#endregion
2091
+ //#region src/mocks/components/TouchableHighlight.ts
2092
+ function createTouchableHighlightMock() {
2093
+ const TouchableHighlight = react.default.forwardRef((props, ref) => react.default.createElement("TouchableHighlight", buildPressableHostProps(props, ref)));
2094
+ TouchableHighlight.displayName = "TouchableHighlight";
2095
+ return TouchableHighlight;
2096
+ }
2097
+ //#endregion
2098
+ //#region src/mocks/components/TouchableWithoutFeedback.ts
2099
+ function createTouchableWithoutFeedbackMock() {
2100
+ const TouchableWithoutFeedback = react.default.forwardRef((props, ref) => react.default.createElement("TouchableWithoutFeedback", buildPressableHostProps(props, ref)));
2101
+ TouchableWithoutFeedback.displayName = "TouchableWithoutFeedback";
2102
+ return TouchableWithoutFeedback;
2103
+ }
2104
+ //#endregion
2105
+ //#region src/presets/bottom-sheet.ts
2106
+ function bottomSheet() {
2107
+ return {
2108
+ name: "bottomSheet",
2109
+ modules: { "@gorhom/bottom-sheet": {
2110
+ exports: [
2111
+ "BottomSheetModal",
2112
+ "BottomSheetModalProvider",
2113
+ "BottomSheetView",
2114
+ "BottomSheetDraggableView",
2115
+ "BottomSheetScrollView",
2116
+ "BottomSheetFlatList",
2117
+ "BottomSheetSectionList",
2118
+ "BottomSheetVirtualizedList",
2119
+ "BottomSheetFlashList",
2120
+ "BottomSheetTextInput",
2121
+ "BottomSheetBackdrop",
2122
+ "BottomSheetFooter",
2123
+ "BottomSheetFooterContainer",
2124
+ "BottomSheetHandle",
2125
+ "TouchableOpacity",
2126
+ "TouchableHighlight",
2127
+ "TouchableWithoutFeedback",
2128
+ "useBottomSheet",
2129
+ "useBottomSheetModal",
2130
+ "useBottomSheetInternal",
2131
+ "useBottomSheetModalInternal",
2132
+ "useBottomSheetSpringConfigs",
2133
+ "useBottomSheetTimingConfigs",
2134
+ "useBottomSheetDynamicSnapPoints",
2135
+ "createBottomSheetScrollableComponent",
2136
+ "enableLogging",
2137
+ "SNAP_POINT_TYPE",
2138
+ "SHEET_STATE",
2139
+ "SCROLLABLE_TYPE",
2140
+ "SCROLLABLE_STATUS",
2141
+ "ANIMATION_STATUS",
2142
+ "ANIMATION_SOURCE",
2143
+ "ANIMATION_METHOD",
2144
+ "KEYBOARD_STATUS",
2145
+ "GESTURE_SOURCE"
2146
+ ],
2147
+ factory: () => {
2148
+ function container(name, methods = {}) {
2149
+ const Component = react.default.forwardRef((props, ref) => {
2150
+ react.default.useImperativeHandle(ref, () => methods);
2151
+ return react.default.createElement(name, props, props.children);
2152
+ });
2153
+ Component.displayName = name;
2154
+ return Component;
2155
+ }
2156
+ const sheetMethods = {
2157
+ expand: () => {},
2158
+ collapse: () => {},
2159
+ close: () => {},
2160
+ forceClose: () => {},
2161
+ snapToIndex: () => {},
2162
+ snapToPosition: () => {}
2163
+ };
2164
+ const modalMethods = {
2165
+ ...sheetMethods,
2166
+ present: () => {},
2167
+ dismiss: () => {}
2168
+ };
2169
+ return {
2170
+ __esModule: true,
2171
+ default: container("BottomSheet", sheetMethods),
2172
+ BottomSheetModal: container("BottomSheetModal", modalMethods),
2173
+ BottomSheetModalProvider: container("BottomSheetModalProvider"),
2174
+ BottomSheetView: container("BottomSheetView"),
2175
+ BottomSheetDraggableView: container("BottomSheetDraggableView"),
2176
+ BottomSheetBackdrop: container("BottomSheetBackdrop"),
2177
+ BottomSheetFooter: container("BottomSheetFooter"),
2178
+ BottomSheetFooterContainer: container("BottomSheetFooterContainer"),
2179
+ BottomSheetHandle: container("BottomSheetHandle"),
2180
+ BottomSheetScrollView: createScrollViewMock(),
2181
+ BottomSheetFlatList: createFlatListMock(),
2182
+ BottomSheetSectionList: createSectionListMock(),
2183
+ BottomSheetVirtualizedList: createVirtualizedListMock(),
2184
+ BottomSheetFlashList: createFlatListMock(),
2185
+ BottomSheetTextInput: createTextInputMock(),
2186
+ TouchableOpacity: createTouchableOpacityMock(),
2187
+ TouchableHighlight: createTouchableHighlightMock(),
2188
+ TouchableWithoutFeedback: createTouchableWithoutFeedbackMock(),
2189
+ useBottomSheet: () => ({
2190
+ ...sheetMethods,
2191
+ animatedIndex: { value: 0 },
2192
+ animatedPosition: { value: 0 }
2193
+ }),
2194
+ useBottomSheetModal: () => ({
2195
+ dismiss: vitest.vi.fn(),
2196
+ dismissAll: vitest.vi.fn()
2197
+ }),
2198
+ useBottomSheetInternal: () => ({}),
2199
+ useBottomSheetModalInternal: () => ({}),
2200
+ useBottomSheetSpringConfigs: (config) => config,
2201
+ useBottomSheetTimingConfigs: (config) => config,
2202
+ useBottomSheetDynamicSnapPoints: () => ({
2203
+ animatedHandleHeight: { value: 0 },
2204
+ animatedSnapPoints: { value: [] },
2205
+ animatedContentHeight: { value: 0 },
2206
+ handleContentLayout: vitest.vi.fn()
2207
+ }),
2208
+ createBottomSheetScrollableComponent: vitest.vi.fn(() => createScrollViewMock()),
2209
+ enableLogging: vitest.vi.fn(),
2210
+ SNAP_POINT_TYPE: {
2211
+ PROVIDED: 0,
2212
+ DYNAMIC: 1
2213
+ },
2214
+ SHEET_STATE: {
2215
+ CLOSED: 0,
2216
+ OPENED: 1,
2217
+ EXTENDED: 2,
2218
+ OVER_EXTENDED: 3,
2219
+ FILL_PARENT: 4
2220
+ },
2221
+ SCROLLABLE_TYPE: {
2222
+ UNDETERMINED: 0,
2223
+ VIEW: 1,
2224
+ FLATLIST: 2,
2225
+ SCROLLVIEW: 3,
2226
+ SECTIONLIST: 4,
2227
+ VIRTUALIZEDLIST: 5
2228
+ },
2229
+ SCROLLABLE_STATUS: {
2230
+ LOCKED: 0,
2231
+ UNLOCKED: 1,
2232
+ UNDETERMINED: 2
2233
+ },
2234
+ ANIMATION_STATUS: {
2235
+ UNDETERMINED: 0,
2236
+ RUNNING: 1,
2237
+ STOPPED: 2,
2238
+ INTERRUPTED: 3
2239
+ },
2240
+ ANIMATION_SOURCE: {
2241
+ NONE: 0,
2242
+ MOUNT: 1,
2243
+ GESTURE: 2,
2244
+ USER: 3,
2245
+ CONTAINER_RESIZE: 4,
2246
+ SNAP_POINT_CHANGE: 5,
2247
+ KEYBOARD: 6
2248
+ },
2249
+ ANIMATION_METHOD: {
2250
+ TIMING: 0,
2251
+ SPRING: 1
2252
+ },
2253
+ KEYBOARD_STATUS: {
2254
+ UNDETERMINED: 0,
2255
+ SHOWN: 1,
2256
+ HIDDEN: 2
2257
+ },
2258
+ GESTURE_SOURCE: {
2259
+ UNDETERMINED: 0,
2260
+ SCROLLABLE: 1,
2261
+ HANDLE: 2,
2262
+ CONTENT: 3
2263
+ }
2264
+ };
2265
+ }
2266
+ } }
2267
+ };
2268
+ }
2269
+ //#endregion
2270
+ //#region src/mocks/components/View.ts
2271
+ function createViewMock() {
2272
+ const View = react.default.forwardRef((props, ref) => {
2273
+ return react.default.createElement("View", {
2274
+ ...props,
2275
+ ref
2276
+ });
2277
+ });
2278
+ View.displayName = "View";
2279
+ return View;
2280
+ }
2281
+ //#endregion
2282
+ //#region src/presets/keyboard-controller.ts
2283
+ function keyboardController() {
2284
+ return {
2285
+ name: "keyboardController",
2286
+ modules: { "react-native-keyboard-controller": {
2287
+ exports: [
2288
+ "KeyboardProvider",
2289
+ "KeyboardControllerView",
2290
+ "KeyboardGestureArea",
2291
+ "OverKeyboardView",
2292
+ "KeyboardBackgroundView",
2293
+ "KeyboardExtender",
2294
+ "KeyboardStickyView",
2295
+ "KeyboardAvoidingView",
2296
+ "KeyboardAwareScrollView",
2297
+ "KeyboardChatScrollView",
2298
+ "KeyboardToolbar",
2299
+ "KeyboardController",
2300
+ "KeyboardEvents",
2301
+ "AndroidSoftInputModes",
2302
+ "DefaultKeyboardToolbarTheme",
2303
+ "useKeyboardAnimation",
2304
+ "useReanimatedKeyboardAnimation",
2305
+ "useResizeMode",
2306
+ "useGenericKeyboardHandler",
2307
+ "useKeyboardHandler",
2308
+ "useKeyboardContext",
2309
+ "useKeyboardState",
2310
+ "useReanimatedFocusedInput",
2311
+ "useFocusedInputHandler",
2312
+ "useKeyboardController",
2313
+ "useWindowDimensions"
2314
+ ],
2315
+ factory: () => {
2316
+ function hostComponent(name) {
2317
+ const Component = react.default.forwardRef((props, ref) => react.default.createElement(name, {
2318
+ ...props,
2319
+ ref
2320
+ }, props.children));
2321
+ Component.displayName = name;
2322
+ return Component;
2323
+ }
2324
+ const sharedValue = (value) => ({
2325
+ value,
2326
+ get: () => value,
2327
+ set: () => {}
2328
+ });
2329
+ const animationValues = {
2330
+ animated: {
2331
+ progress: sharedValue(0),
2332
+ height: sharedValue(0)
2333
+ },
2334
+ reanimated: {
2335
+ progress: sharedValue(0),
2336
+ height: sharedValue(0)
2337
+ }
2338
+ };
2339
+ const lastKeyboardEvent = {
2340
+ height: 0,
2341
+ duration: 0,
2342
+ timestamp: 0,
2343
+ target: 0,
2344
+ type: "default",
2345
+ appearance: "default"
2346
+ };
2347
+ const keyboardState = {
2348
+ ...lastKeyboardEvent,
2349
+ isVisible: false
2350
+ };
2351
+ const focusedInput = { input: sharedValue({
2352
+ target: 1,
2353
+ parentScrollViewTarget: -1,
2354
+ layout: {
2355
+ x: 0,
2356
+ y: 0,
2357
+ width: 200,
2358
+ height: 40,
2359
+ absoluteX: 0,
2360
+ absoluteY: 100
2361
+ }
2362
+ }) };
2363
+ const KeyboardToolbar = Object.assign(createViewMock(), {
2364
+ Background: hostComponent("KeyboardToolbar.Background"),
2365
+ Content: hostComponent("KeyboardToolbar.Content"),
2366
+ Prev: hostComponent("KeyboardToolbar.Prev"),
2367
+ Next: hostComponent("KeyboardToolbar.Next"),
2368
+ Done: hostComponent("KeyboardToolbar.Done"),
2369
+ Group: hostComponent("KeyboardToolbar.Group")
2370
+ });
2371
+ return {
2372
+ KeyboardProvider: hostComponent("KeyboardProvider"),
2373
+ KeyboardControllerView: hostComponent("KeyboardControllerView"),
2374
+ KeyboardGestureArea: hostComponent("KeyboardGestureArea"),
2375
+ OverKeyboardView: hostComponent("OverKeyboardView"),
2376
+ KeyboardBackgroundView: hostComponent("KeyboardBackgroundView"),
2377
+ KeyboardExtender: hostComponent("KeyboardExtender"),
2378
+ KeyboardStickyView: createViewMock(),
2379
+ KeyboardAvoidingView: createViewMock(),
2380
+ KeyboardAwareScrollView: createScrollViewMock(),
2381
+ KeyboardChatScrollView: createScrollViewMock(),
2382
+ KeyboardToolbar,
2383
+ KeyboardController: {
2384
+ setInputMode: vitest.vi.fn(),
2385
+ setDefaultMode: vitest.vi.fn(),
2386
+ preload: vitest.vi.fn(),
2387
+ dismiss: vitest.vi.fn(() => Promise.resolve()),
2388
+ setFocusTo: vitest.vi.fn(),
2389
+ isVisible: vitest.vi.fn(() => false),
2390
+ state: vitest.vi.fn(() => lastKeyboardEvent),
2391
+ viewPositionInWindow: vitest.vi.fn(() => Promise.resolve({
2392
+ x: 0,
2393
+ y: 0,
2394
+ width: 0,
2395
+ height: 0
2396
+ }))
2397
+ },
2398
+ KeyboardEvents: { addListener: vitest.vi.fn(() => ({ remove: vitest.vi.fn() })) },
2399
+ AndroidSoftInputModes: {
2400
+ SOFT_INPUT_ADJUST_NOTHING: 48,
2401
+ SOFT_INPUT_ADJUST_PAN: 32,
2402
+ SOFT_INPUT_ADJUST_RESIZE: 16,
2403
+ SOFT_INPUT_ADJUST_UNSPECIFIED: 0,
2404
+ SOFT_INPUT_IS_FORWARD_NAVIGATION: 256,
2405
+ SOFT_INPUT_MASK_ADJUST: 240,
2406
+ SOFT_INPUT_MASK_STATE: 15,
2407
+ SOFT_INPUT_MODE_CHANGED: 512,
2408
+ SOFT_INPUT_STATE_ALWAYS_HIDDEN: 3,
2409
+ SOFT_INPUT_STATE_ALWAYS_VISIBLE: 5,
2410
+ SOFT_INPUT_STATE_HIDDEN: 2,
2411
+ SOFT_INPUT_STATE_UNCHANGED: 1,
2412
+ SOFT_INPUT_STATE_UNSPECIFIED: 0,
2413
+ SOFT_INPUT_STATE_VISIBLE: 4
2414
+ },
2415
+ DefaultKeyboardToolbarTheme: {
2416
+ light: {
2417
+ primary: "#2c2c2c",
2418
+ disabled: "#B0BEC5",
2419
+ background: "#f3f3f4",
2420
+ ripple: "#bcbcbcbc"
2421
+ },
2422
+ dark: {
2423
+ primary: "#fafafa",
2424
+ disabled: "#707070",
2425
+ background: "#2C2C2E",
2426
+ ripple: "#F8F8F888"
2427
+ }
2428
+ },
2429
+ useKeyboardAnimation: () => animationValues.animated,
2430
+ useReanimatedKeyboardAnimation: () => animationValues.reanimated,
2431
+ useResizeMode: () => {},
2432
+ useGenericKeyboardHandler: () => {},
2433
+ useKeyboardHandler: () => {},
2434
+ useKeyboardContext: () => animationValues,
2435
+ useKeyboardState: (selector) => selector ? selector(keyboardState) : keyboardState,
2436
+ useReanimatedFocusedInput: () => focusedInput,
2437
+ useFocusedInputHandler: () => {},
2438
+ useKeyboardController: () => ({
2439
+ enabled: true,
2440
+ setEnabled: vitest.vi.fn()
2441
+ }),
2442
+ useWindowDimensions: () => ({
2443
+ width: 390,
2444
+ height: 844,
2445
+ scale: 3,
2446
+ fontScale: 1
2447
+ })
2448
+ };
2449
+ }
2450
+ } }
2451
+ };
2452
+ }
2453
+ //#endregion
2454
+ //#region src/presets/worklets.ts
2455
+ const RuntimeKind = {
2456
+ ReactNative: 1,
2457
+ UI: 2,
2458
+ Worker: 3
2459
+ };
2460
+ const NOOP = () => {};
2461
+ const ID = (value) => value;
2462
+ const invoke = (callback) => callback();
2463
+ function worklets() {
2464
+ return {
2465
+ name: "worklets",
2466
+ modules: { "react-native-worklets": {
2467
+ exports: [
2468
+ "runOnJS",
2469
+ "runOnUI",
2470
+ "runOnUIAsync",
2471
+ "runOnUISync",
2472
+ "scheduleOnRN",
2473
+ "scheduleOnUI",
2474
+ "runOnRuntime",
2475
+ "runOnRuntimeAsync",
2476
+ "runOnRuntimeSync",
2477
+ "scheduleOnRuntime",
2478
+ "executeOnUIRuntimeSync",
2479
+ "createWorkletRuntime",
2480
+ "getRuntimeKind",
2481
+ "isRNRuntime",
2482
+ "isUIRuntime",
2483
+ "isWorkerRuntime",
2484
+ "isWorkletRuntime",
2485
+ "RuntimeKind",
2486
+ "makeShareable",
2487
+ "makeShareableCloneRecursive",
2488
+ "makeShareableCloneOnUIRecursive",
2489
+ "isShareable",
2490
+ "isShareableRef",
2491
+ "createShareable",
2492
+ "shareableMappingCache",
2493
+ "createSerializable",
2494
+ "isSerializableRef",
2495
+ "registerCustomSerializable",
2496
+ "serializableMappingCache",
2497
+ "createSynchronizable",
2498
+ "isSynchronizable",
2499
+ "getStaticFeatureFlag",
2500
+ "getDynamicFeatureFlag",
2501
+ "setDynamicFeatureFlag",
2502
+ "callMicrotasks",
2503
+ "isWorkletFunction",
2504
+ "WorkletsModule",
2505
+ "UIRuntimeId"
2506
+ ],
2507
+ factory: () => {
2508
+ const runOnJS = (fn) => fn;
2509
+ const runOnUI = (fn) => fn;
2510
+ const runOnUIAsync = (worklet, ...args) => Promise.resolve(worklet(...args));
2511
+ const api = {
2512
+ __esModule: true,
2513
+ runOnJS,
2514
+ runOnUI,
2515
+ runOnUIAsync,
2516
+ runOnUISync: invoke,
2517
+ scheduleOnRN: (fn, ...args) => fn(...args),
2518
+ scheduleOnUI: (worklet, ...args) => worklet(...args),
2519
+ runOnRuntime: ID,
2520
+ runOnRuntimeAsync: (_runtime, worklet, ...args) => Promise.resolve(worklet(...args)),
2521
+ runOnRuntimeSync: (_runtime, worklet, ...args) => worklet(...args),
2522
+ scheduleOnRuntime: invoke,
2523
+ executeOnUIRuntimeSync: ID,
2524
+ callMicrotasks: NOOP,
2525
+ createWorkletRuntime: () => ({}),
2526
+ getRuntimeKind: () => RuntimeKind.ReactNative,
2527
+ RuntimeKind,
2528
+ isRNRuntime: () => true,
2529
+ isUIRuntime: () => false,
2530
+ isWorkerRuntime: () => false,
2531
+ isWorkletRuntime: () => false,
2532
+ UIRuntimeId: 1,
2533
+ makeShareable: ID,
2534
+ makeShareableCloneRecursive: ID,
2535
+ makeShareableCloneOnUIRecursive: ID,
2536
+ createShareable: ID,
2537
+ isShareable: () => false,
2538
+ isShareableRef: () => true,
2539
+ shareableMappingCache: /* @__PURE__ */ new Map(),
2540
+ createSerializable: ID,
2541
+ isSerializableRef: ID,
2542
+ registerCustomSerializable: NOOP,
2543
+ serializableMappingCache: /* @__PURE__ */ new Map(),
2544
+ createSynchronizable: ID,
2545
+ isSynchronizable: () => false,
2546
+ getStaticFeatureFlag: () => false,
2547
+ getDynamicFeatureFlag: () => false,
2548
+ setDynamicFeatureFlag: NOOP,
2549
+ isWorkletFunction: () => false,
2550
+ WorkletsModule: {}
2551
+ };
2552
+ api.default = api;
2553
+ return api;
2554
+ }
2555
+ } }
2556
+ };
2557
+ }
2558
+ //#endregion
1805
2559
  //#region src/presets/index.ts
1806
2560
  var presets_exports = /* @__PURE__ */ require_chunk.__exportAll({
1807
2561
  asyncStorage: () => asyncStorage,
2562
+ bottomSheet: () => bottomSheet,
1808
2563
  deviceInfo: () => deviceInfo,
1809
2564
  expo: () => expo,
2565
+ flashList: () => flashList,
1810
2566
  gestureHandler: () => gestureHandler,
2567
+ keyboardController: () => keyboardController,
1811
2568
  mmkv: () => mmkv,
1812
2569
  navigation: () => navigation,
1813
2570
  reanimated: () => reanimated,
@@ -1815,7 +2572,8 @@ var presets_exports = /* @__PURE__ */ require_chunk.__exportAll({
1815
2572
  screens: () => screens,
1816
2573
  svg: () => svg,
1817
2574
  vectorIcons: () => vectorIcons,
1818
- webview: () => webview
2575
+ webview: () => webview,
2576
+ worklets: () => worklets
1819
2577
  });
1820
2578
  //#endregion
1821
2579
  Object.defineProperty(exports, "asyncStorage", {
@@ -1824,18 +2582,78 @@ Object.defineProperty(exports, "asyncStorage", {
1824
2582
  return asyncStorage;
1825
2583
  }
1826
2584
  });
2585
+ Object.defineProperty(exports, "bottomSheet", {
2586
+ enumerable: true,
2587
+ get: function() {
2588
+ return bottomSheet;
2589
+ }
2590
+ });
1827
2591
  Object.defineProperty(exports, "buildPressableHostProps", {
1828
2592
  enumerable: true,
1829
2593
  get: function() {
1830
2594
  return buildPressableHostProps;
1831
2595
  }
1832
2596
  });
2597
+ Object.defineProperty(exports, "createFlatListMock", {
2598
+ enumerable: true,
2599
+ get: function() {
2600
+ return createFlatListMock;
2601
+ }
2602
+ });
1833
2603
  Object.defineProperty(exports, "createPressableMock", {
1834
2604
  enumerable: true,
1835
2605
  get: function() {
1836
2606
  return createPressableMock;
1837
2607
  }
1838
2608
  });
2609
+ Object.defineProperty(exports, "createScrollViewMock", {
2610
+ enumerable: true,
2611
+ get: function() {
2612
+ return createScrollViewMock;
2613
+ }
2614
+ });
2615
+ Object.defineProperty(exports, "createSectionListMock", {
2616
+ enumerable: true,
2617
+ get: function() {
2618
+ return createSectionListMock;
2619
+ }
2620
+ });
2621
+ Object.defineProperty(exports, "createTextInputMock", {
2622
+ enumerable: true,
2623
+ get: function() {
2624
+ return createTextInputMock;
2625
+ }
2626
+ });
2627
+ Object.defineProperty(exports, "createTouchableHighlightMock", {
2628
+ enumerable: true,
2629
+ get: function() {
2630
+ return createTouchableHighlightMock;
2631
+ }
2632
+ });
2633
+ Object.defineProperty(exports, "createTouchableOpacityMock", {
2634
+ enumerable: true,
2635
+ get: function() {
2636
+ return createTouchableOpacityMock;
2637
+ }
2638
+ });
2639
+ Object.defineProperty(exports, "createTouchableWithoutFeedbackMock", {
2640
+ enumerable: true,
2641
+ get: function() {
2642
+ return createTouchableWithoutFeedbackMock;
2643
+ }
2644
+ });
2645
+ Object.defineProperty(exports, "createViewMock", {
2646
+ enumerable: true,
2647
+ get: function() {
2648
+ return createViewMock;
2649
+ }
2650
+ });
2651
+ Object.defineProperty(exports, "createVirtualizedListMock", {
2652
+ enumerable: true,
2653
+ get: function() {
2654
+ return createVirtualizedListMock;
2655
+ }
2656
+ });
1839
2657
  Object.defineProperty(exports, "deviceInfo", {
1840
2658
  enumerable: true,
1841
2659
  get: function() {
@@ -1848,12 +2666,24 @@ Object.defineProperty(exports, "expo", {
1848
2666
  return expo;
1849
2667
  }
1850
2668
  });
2669
+ Object.defineProperty(exports, "flashList", {
2670
+ enumerable: true,
2671
+ get: function() {
2672
+ return flashList;
2673
+ }
2674
+ });
1851
2675
  Object.defineProperty(exports, "gestureHandler", {
1852
2676
  enumerable: true,
1853
2677
  get: function() {
1854
2678
  return gestureHandler;
1855
2679
  }
1856
2680
  });
2681
+ Object.defineProperty(exports, "keyboardController", {
2682
+ enumerable: true,
2683
+ get: function() {
2684
+ return keyboardController;
2685
+ }
2686
+ });
1857
2687
  Object.defineProperty(exports, "mmkv", {
1858
2688
  enumerable: true,
1859
2689
  get: function() {
@@ -1908,3 +2738,9 @@ Object.defineProperty(exports, "webview", {
1908
2738
  return webview;
1909
2739
  }
1910
2740
  });
2741
+ Object.defineProperty(exports, "worklets", {
2742
+ enumerable: true,
2743
+ get: function() {
2744
+ return worklets;
2745
+ }
2746
+ });