@legendapp/state 3.0.0-beta.3 → 3.0.0-beta.30

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 (74) hide show
  1. package/.DS_Store +0 -0
  2. package/config/enableReactComponents.js +3 -1
  3. package/config/enableReactComponents.mjs +3 -1
  4. package/config/enableReactTracking.d.mts +2 -1
  5. package/config/enableReactTracking.d.ts +2 -1
  6. package/config/enableReactTracking.js +32 -13
  7. package/config/enableReactTracking.mjs +32 -13
  8. package/index.d.mts +33 -4
  9. package/index.d.ts +33 -4
  10. package/index.js +191 -29
  11. package/index.mjs +191 -29
  12. package/package.json +35 -1
  13. package/persist-plugins/async-storage.js +17 -9
  14. package/persist-plugins/async-storage.mjs +17 -9
  15. package/persist-plugins/expo-sqlite.d.mts +19 -0
  16. package/persist-plugins/expo-sqlite.d.ts +19 -0
  17. package/persist-plugins/expo-sqlite.js +72 -0
  18. package/persist-plugins/expo-sqlite.mjs +69 -0
  19. package/react-native.d.mts +4 -0
  20. package/react-native.d.ts +4 -0
  21. package/react-native.js +53 -0
  22. package/react-native.mjs +40 -0
  23. package/react-reactive/Components.d.mts +19 -0
  24. package/react-reactive/Components.d.ts +19 -0
  25. package/react-reactive/Components.js +53 -0
  26. package/react-reactive/Components.mjs +40 -0
  27. package/react-reactive/enableReactComponents.d.mts +3 -2
  28. package/react-reactive/enableReactComponents.d.ts +3 -2
  29. package/react-reactive/enableReactComponents.js +10 -3
  30. package/react-reactive/enableReactComponents.mjs +10 -3
  31. package/react-reactive/enableReactNativeComponents.d.mts +3 -20
  32. package/react-reactive/enableReactNativeComponents.d.ts +3 -20
  33. package/react-reactive/enableReactNativeComponents.js +8 -3
  34. package/react-reactive/enableReactNativeComponents.mjs +8 -3
  35. package/react-reactive/enableReactive.js +10 -3
  36. package/react-reactive/enableReactive.mjs +10 -3
  37. package/react-reactive/enableReactive.native.js +8 -3
  38. package/react-reactive/enableReactive.native.mjs +8 -3
  39. package/react-reactive/enableReactive.web.js +8 -3
  40. package/react-reactive/enableReactive.web.mjs +8 -3
  41. package/react-web.d.mts +6 -0
  42. package/react-web.d.ts +6 -0
  43. package/react-web.js +39 -0
  44. package/react-web.mjs +37 -0
  45. package/react.d.mts +41 -21
  46. package/react.d.ts +41 -21
  47. package/react.js +36 -23
  48. package/react.mjs +37 -25
  49. package/sync-plugins/crud.d.mts +24 -9
  50. package/sync-plugins/crud.d.ts +24 -9
  51. package/sync-plugins/crud.js +250 -116
  52. package/sync-plugins/crud.mjs +251 -117
  53. package/sync-plugins/firebase.d.mts +7 -3
  54. package/sync-plugins/firebase.d.ts +7 -3
  55. package/sync-plugins/firebase.js +4 -2
  56. package/sync-plugins/firebase.mjs +4 -2
  57. package/sync-plugins/keel.d.mts +12 -13
  58. package/sync-plugins/keel.d.ts +12 -13
  59. package/sync-plugins/keel.js +60 -52
  60. package/sync-plugins/keel.mjs +61 -48
  61. package/sync-plugins/supabase.d.mts +7 -3
  62. package/sync-plugins/supabase.d.ts +7 -3
  63. package/sync-plugins/supabase.js +90 -33
  64. package/sync-plugins/supabase.mjs +91 -34
  65. package/sync-plugins/tanstack-query.d.mts +3 -3
  66. package/sync-plugins/tanstack-query.d.ts +3 -3
  67. package/sync.d.mts +16 -8
  68. package/sync.d.ts +16 -8
  69. package/sync.js +324 -215
  70. package/sync.mjs +323 -215
  71. package/trace.js +5 -6
  72. package/trace.mjs +5 -6
  73. package/types/reactive-native.d.ts +19 -0
  74. package/types/reactive-web.d.ts +7 -0
@@ -0,0 +1,69 @@
1
+ import { applyChanges, internal } from '@legendapp/state';
2
+
3
+ // src/persist-plugins/expo-sqlite.ts
4
+ var { safeParse, safeStringify } = internal;
5
+ var MetadataSuffix = "__m";
6
+ var ObservablePersistSqlite = class {
7
+ constructor(storage) {
8
+ this.data = {};
9
+ if (!storage) {
10
+ console.error(
11
+ "[legend-state] ObservablePersistSqlite failed to initialize. You need to pass the SQLiteStorage instance."
12
+ );
13
+ }
14
+ this.storage = storage;
15
+ }
16
+ getTable(table, init) {
17
+ if (!this.storage)
18
+ return void 0;
19
+ if (this.data[table] === void 0) {
20
+ try {
21
+ const value = this.storage.getItemSync(table);
22
+ this.data[table] = value ? safeParse(value) : init;
23
+ } catch (e) {
24
+ console.error("[legend-state] ObservablePersistSqlite failed to parse", table);
25
+ }
26
+ }
27
+ return this.data[table];
28
+ }
29
+ getMetadata(table) {
30
+ return this.getTable(table + MetadataSuffix, {});
31
+ }
32
+ set(table, changes) {
33
+ if (!this.data[table]) {
34
+ this.data[table] = {};
35
+ }
36
+ this.data[table] = applyChanges(this.data[table], changes);
37
+ this.save(table);
38
+ }
39
+ setMetadata(table, metadata) {
40
+ table = table + MetadataSuffix;
41
+ this.data[table] = metadata;
42
+ this.save(table);
43
+ }
44
+ deleteTable(table) {
45
+ if (!this.storage)
46
+ return void 0;
47
+ delete this.data[table];
48
+ this.storage.removeItemSync(table);
49
+ }
50
+ deleteMetadata(table) {
51
+ this.deleteTable(table + MetadataSuffix);
52
+ }
53
+ // Private
54
+ save(table) {
55
+ if (!this.storage)
56
+ return void 0;
57
+ const v = this.data[table];
58
+ if (v !== void 0 && v !== null) {
59
+ this.storage.setItemSync(table, safeStringify(v));
60
+ } else {
61
+ this.storage.removeItemSync(table);
62
+ }
63
+ }
64
+ };
65
+ function observablePersistSqlite(storage) {
66
+ return new ObservablePersistSqlite(storage);
67
+ }
68
+
69
+ export { ObservablePersistSqlite, observablePersistSqlite };
@@ -0,0 +1,4 @@
1
+ export { $ActivityIndicator, $Button, $FlatList, $Image, $Pressable, $ScrollView, $SectionList, $Switch, $Text, $TextInput, $TouchableWithoutFeedback, $View } from './react-reactive/Components.mjs';
2
+ import 'react';
3
+ import '@legendapp/state/react';
4
+ import 'react-native';
@@ -0,0 +1,4 @@
1
+ export { $ActivityIndicator, $Button, $FlatList, $Image, $Pressable, $ScrollView, $SectionList, $Switch, $Text, $TextInput, $TouchableWithoutFeedback, $View } from './react-reactive/Components.js';
2
+ import 'react';
3
+ import '@legendapp/state/react';
4
+ import 'react-native';
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var react = require('@legendapp/state/react');
4
+ var react$1 = require('react');
5
+ var reactNative = require('react-native');
6
+
7
+ // src/react-reactive/Components.ts
8
+ var $ActivityIndicator = react.reactive(reactNative.ActivityIndicator);
9
+ var $Button = react.reactive(reactNative.Button);
10
+ var $FlatList = react.reactive(reactNative.FlatList, void 0, {
11
+ data: {
12
+ selector: (propsOut, p) => {
13
+ const state = react$1.useRef(0);
14
+ const [renderNum, value] = react.use$(() => [state.current++, p.get(true)]);
15
+ propsOut.extraData = renderNum;
16
+ return value;
17
+ }
18
+ }
19
+ });
20
+ var $Image = react.reactive(reactNative.Image);
21
+ var $Pressable = react.reactive(reactNative.Pressable);
22
+ var $ScrollView = react.reactive(reactNative.ScrollView);
23
+ var $SectionList = react.reactive(reactNative.SectionList);
24
+ var $Switch = react.reactive(reactNative.Switch, void 0, {
25
+ value: {
26
+ handler: "onValueChange",
27
+ getValue: (e) => e,
28
+ defaultValue: false
29
+ }
30
+ });
31
+ var $Text = react.reactive(reactNative.Text);
32
+ var $TextInput = react.reactive(reactNative.TextInput, void 0, {
33
+ value: {
34
+ handler: "onChange",
35
+ getValue: (e) => e.nativeEvent.text,
36
+ defaultValue: ""
37
+ }
38
+ });
39
+ var $TouchableWithoutFeedback = react.reactive(reactNative.TouchableWithoutFeedback);
40
+ var $View = react.reactive(reactNative.View);
41
+
42
+ exports.$ActivityIndicator = $ActivityIndicator;
43
+ exports.$Button = $Button;
44
+ exports.$FlatList = $FlatList;
45
+ exports.$Image = $Image;
46
+ exports.$Pressable = $Pressable;
47
+ exports.$ScrollView = $ScrollView;
48
+ exports.$SectionList = $SectionList;
49
+ exports.$Switch = $Switch;
50
+ exports.$Text = $Text;
51
+ exports.$TextInput = $TextInput;
52
+ exports.$TouchableWithoutFeedback = $TouchableWithoutFeedback;
53
+ exports.$View = $View;
@@ -0,0 +1,40 @@
1
+ import { reactive, use$ } from '@legendapp/state/react';
2
+ import { useRef } from 'react';
3
+ import { ActivityIndicator, Button, FlatList, Image, Pressable, ScrollView, SectionList, Switch, Text, TextInput, TouchableWithoutFeedback, View } from 'react-native';
4
+
5
+ // src/react-reactive/Components.ts
6
+ var $ActivityIndicator = reactive(ActivityIndicator);
7
+ var $Button = reactive(Button);
8
+ var $FlatList = reactive(FlatList, void 0, {
9
+ data: {
10
+ selector: (propsOut, p) => {
11
+ const state = useRef(0);
12
+ const [renderNum, value] = use$(() => [state.current++, p.get(true)]);
13
+ propsOut.extraData = renderNum;
14
+ return value;
15
+ }
16
+ }
17
+ });
18
+ var $Image = reactive(Image);
19
+ var $Pressable = reactive(Pressable);
20
+ var $ScrollView = reactive(ScrollView);
21
+ var $SectionList = reactive(SectionList);
22
+ var $Switch = reactive(Switch, void 0, {
23
+ value: {
24
+ handler: "onValueChange",
25
+ getValue: (e) => e,
26
+ defaultValue: false
27
+ }
28
+ });
29
+ var $Text = reactive(Text);
30
+ var $TextInput = reactive(TextInput, void 0, {
31
+ value: {
32
+ handler: "onChange",
33
+ getValue: (e) => e.nativeEvent.text,
34
+ defaultValue: ""
35
+ }
36
+ });
37
+ var $TouchableWithoutFeedback = reactive(TouchableWithoutFeedback);
38
+ var $View = reactive(View);
39
+
40
+ export { $ActivityIndicator, $Button, $FlatList, $Image, $Pressable, $ScrollView, $SectionList, $Switch, $Text, $TextInput, $TouchableWithoutFeedback, $View };
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import * as _legendapp_state_react from '@legendapp/state/react';
3
+ import * as react_native from 'react-native';
4
+ import { View } from 'react-native';
5
+
6
+ declare const $ActivityIndicator: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.ActivityIndicatorProps>, any>;
7
+ declare const $Button: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.ButtonProps>, any>;
8
+ declare const $FlatList: React.FC<_legendapp_state_react.ShapeWith$<react_native.FlatListProps<unknown>>>;
9
+ declare const $Image: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.ImageProps>, any>;
10
+ declare const $Pressable: React.ForwardRefExoticComponent<_legendapp_state_react.ShapeWith$<react_native.PressableProps & React.RefAttributes<View>>>;
11
+ declare const $ScrollView: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.ScrollViewProps>, any>;
12
+ declare const $SectionList: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.SectionListProps<unknown, unknown>>, any>;
13
+ declare const $Switch: React.FC<_legendapp_state_react.ShapeWith$<react_native.SwitchProps>>;
14
+ declare const $Text: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.TextProps>, any>;
15
+ declare const $TextInput: React.FC<_legendapp_state_react.ShapeWith$<react_native.TextInputProps>>;
16
+ declare const $TouchableWithoutFeedback: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.TouchableWithoutFeedbackProps>, any>;
17
+ declare const $View: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.ViewProps>, any>;
18
+
19
+ export { $ActivityIndicator, $Button, $FlatList, $Image, $Pressable, $ScrollView, $SectionList, $Switch, $Text, $TextInput, $TouchableWithoutFeedback, $View };
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import * as _legendapp_state_react from '@legendapp/state/react';
3
+ import * as react_native from 'react-native';
4
+ import { View } from 'react-native';
5
+
6
+ declare const $ActivityIndicator: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.ActivityIndicatorProps>, any>;
7
+ declare const $Button: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.ButtonProps>, any>;
8
+ declare const $FlatList: React.FC<_legendapp_state_react.ShapeWith$<react_native.FlatListProps<unknown>>>;
9
+ declare const $Image: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.ImageProps>, any>;
10
+ declare const $Pressable: React.ForwardRefExoticComponent<_legendapp_state_react.ShapeWith$<react_native.PressableProps & React.RefAttributes<View>>>;
11
+ declare const $ScrollView: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.ScrollViewProps>, any>;
12
+ declare const $SectionList: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.SectionListProps<unknown, unknown>>, any>;
13
+ declare const $Switch: React.FC<_legendapp_state_react.ShapeWith$<react_native.SwitchProps>>;
14
+ declare const $Text: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.TextProps>, any>;
15
+ declare const $TextInput: React.FC<_legendapp_state_react.ShapeWith$<react_native.TextInputProps>>;
16
+ declare const $TouchableWithoutFeedback: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.TouchableWithoutFeedbackProps>, any>;
17
+ declare const $View: React.ComponentClass<_legendapp_state_react.ShapeWith$<react_native.ViewProps>, any>;
18
+
19
+ export { $ActivityIndicator, $Button, $FlatList, $Image, $Pressable, $ScrollView, $SectionList, $Switch, $Text, $TextInput, $TouchableWithoutFeedback, $View };
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var react = require('@legendapp/state/react');
4
+ var react$1 = require('react');
5
+ var reactNative = require('react-native');
6
+
7
+ // src/react-reactive/Components.ts
8
+ var $ActivityIndicator = react.reactive(reactNative.ActivityIndicator);
9
+ var $Button = react.reactive(reactNative.Button);
10
+ var $FlatList = react.reactive(reactNative.FlatList, void 0, {
11
+ data: {
12
+ selector: (propsOut, p) => {
13
+ const state = react$1.useRef(0);
14
+ const [renderNum, value] = react.use$(() => [state.current++, p.get(true)]);
15
+ propsOut.extraData = renderNum;
16
+ return value;
17
+ }
18
+ }
19
+ });
20
+ var $Image = react.reactive(reactNative.Image);
21
+ var $Pressable = react.reactive(reactNative.Pressable);
22
+ var $ScrollView = react.reactive(reactNative.ScrollView);
23
+ var $SectionList = react.reactive(reactNative.SectionList);
24
+ var $Switch = react.reactive(reactNative.Switch, void 0, {
25
+ value: {
26
+ handler: "onValueChange",
27
+ getValue: (e) => e,
28
+ defaultValue: false
29
+ }
30
+ });
31
+ var $Text = react.reactive(reactNative.Text);
32
+ var $TextInput = react.reactive(reactNative.TextInput, void 0, {
33
+ value: {
34
+ handler: "onChange",
35
+ getValue: (e) => e.nativeEvent.text,
36
+ defaultValue: ""
37
+ }
38
+ });
39
+ var $TouchableWithoutFeedback = react.reactive(reactNative.TouchableWithoutFeedback);
40
+ var $View = react.reactive(reactNative.View);
41
+
42
+ exports.$ActivityIndicator = $ActivityIndicator;
43
+ exports.$Button = $Button;
44
+ exports.$FlatList = $FlatList;
45
+ exports.$Image = $Image;
46
+ exports.$Pressable = $Pressable;
47
+ exports.$ScrollView = $ScrollView;
48
+ exports.$SectionList = $SectionList;
49
+ exports.$Switch = $Switch;
50
+ exports.$Text = $Text;
51
+ exports.$TextInput = $TextInput;
52
+ exports.$TouchableWithoutFeedback = $TouchableWithoutFeedback;
53
+ exports.$View = $View;
@@ -0,0 +1,40 @@
1
+ import { reactive, use$ } from '@legendapp/state/react';
2
+ import { useRef } from 'react';
3
+ import { ActivityIndicator, Button, FlatList, Image, Pressable, ScrollView, SectionList, Switch, Text, TextInput, TouchableWithoutFeedback, View } from 'react-native';
4
+
5
+ // src/react-reactive/Components.ts
6
+ var $ActivityIndicator = reactive(ActivityIndicator);
7
+ var $Button = reactive(Button);
8
+ var $FlatList = reactive(FlatList, void 0, {
9
+ data: {
10
+ selector: (propsOut, p) => {
11
+ const state = useRef(0);
12
+ const [renderNum, value] = use$(() => [state.current++, p.get(true)]);
13
+ propsOut.extraData = renderNum;
14
+ return value;
15
+ }
16
+ }
17
+ });
18
+ var $Image = reactive(Image);
19
+ var $Pressable = reactive(Pressable);
20
+ var $ScrollView = reactive(ScrollView);
21
+ var $SectionList = reactive(SectionList);
22
+ var $Switch = reactive(Switch, void 0, {
23
+ value: {
24
+ handler: "onValueChange",
25
+ getValue: (e) => e,
26
+ defaultValue: false
27
+ }
28
+ });
29
+ var $Text = reactive(Text);
30
+ var $TextInput = reactive(TextInput, void 0, {
31
+ value: {
32
+ handler: "onChange",
33
+ getValue: (e) => e.nativeEvent.text,
34
+ defaultValue: ""
35
+ }
36
+ });
37
+ var $TouchableWithoutFeedback = reactive(TouchableWithoutFeedback);
38
+ var $View = reactive(View);
39
+
40
+ export { $ActivityIndicator, $Button, $FlatList, $Image, $Pressable, $ScrollView, $SectionList, $Switch, $Text, $TextInput, $TouchableWithoutFeedback, $View };
@@ -1,9 +1,10 @@
1
1
  import { FCReactiveObject, configureReactive } from '@legendapp/state/react';
2
2
 
3
- declare function enableReactComponents(config: typeof configureReactive): void;
3
+ declare function enableReactComponents_(config: typeof configureReactive): void;
4
+
4
5
  declare module '@legendapp/state/react' {
5
6
  interface IReactive extends FCReactiveObject<JSX.IntrinsicElements> {
6
7
  }
7
8
  }
8
9
 
9
- export { enableReactComponents };
10
+ export { enableReactComponents_ };
@@ -1,9 +1,10 @@
1
1
  import { FCReactiveObject, configureReactive } from '@legendapp/state/react';
2
2
 
3
- declare function enableReactComponents(config: typeof configureReactive): void;
3
+ declare function enableReactComponents_(config: typeof configureReactive): void;
4
+
4
5
  declare module '@legendapp/state/react' {
5
6
  interface IReactive extends FCReactiveObject<JSX.IntrinsicElements> {
6
7
  }
7
8
  }
8
9
 
9
- export { enableReactComponents };
10
+ export { enableReactComponents_ };
@@ -1,8 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  // src/react-reactive/enableReactComponents.ts
4
- function enableReactComponents(config) {
5
- const bindInfo = { value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" } };
4
+ var isEnabled = false;
5
+ function enableReactComponents_(config) {
6
+ if (isEnabled) {
7
+ return;
8
+ }
9
+ isEnabled = true;
10
+ const bindInfo = {
11
+ value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" }
12
+ };
6
13
  const bindInfoInput = Object.assign(
7
14
  { checked: { handler: "onChange", getValue: (e) => e.target.checked } },
8
15
  bindInfo
@@ -16,4 +23,4 @@ function enableReactComponents(config) {
16
23
  });
17
24
  }
18
25
 
19
- exports.enableReactComponents = enableReactComponents;
26
+ exports.enableReactComponents_ = enableReactComponents_;
@@ -1,6 +1,13 @@
1
1
  // src/react-reactive/enableReactComponents.ts
2
- function enableReactComponents(config) {
3
- const bindInfo = { value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" } };
2
+ var isEnabled = false;
3
+ function enableReactComponents_(config) {
4
+ if (isEnabled) {
5
+ return;
6
+ }
7
+ isEnabled = true;
8
+ const bindInfo = {
9
+ value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" }
10
+ };
4
11
  const bindInfoInput = Object.assign(
5
12
  { checked: { handler: "onChange", getValue: (e) => e.target.checked } },
6
13
  bindInfo
@@ -14,4 +21,4 @@ function enableReactComponents(config) {
14
21
  });
15
22
  }
16
23
 
17
- export { enableReactComponents };
24
+ export { enableReactComponents_ };
@@ -1,22 +1,5 @@
1
- import { FCReactiveObject, FCReactive, configureReactive } from '@legendapp/state/react';
2
- import { ActivityIndicator, ActivityIndicatorProps, Button, ButtonProps, FlatList, FlatListProps, Image, ImageProps, Pressable, PressableProps, ScrollView, ScrollViewProps, SectionList, SectionListProps, Switch, SwitchProps, Text, TextProps, TextInput, TextInputProps, TouchableWithoutFeedback, TouchableWithoutFeedbackProps, View, ViewProps } from 'react-native';
1
+ import { configureReactive } from '@legendapp/state/react';
3
2
 
4
- declare function enableReactNativeComponents(configure: typeof configureReactive): void;
5
- declare module '@legendapp/state/react' {
6
- interface IReactive extends FCReactiveObject<JSX.IntrinsicElements> {
7
- ActivityIndicator: FCReactive<ActivityIndicator, ActivityIndicatorProps>;
8
- Button: FCReactive<Button, ButtonProps>;
9
- FlatList: FCReactive<FlatList, FlatListProps<any>>;
10
- Image: FCReactive<Image, ImageProps>;
11
- Pressable: FCReactive<typeof Pressable, PressableProps>;
12
- ScrollView: FCReactive<ScrollView, ScrollViewProps>;
13
- SectionList: FCReactive<SectionList, SectionListProps<any>>;
14
- Switch: FCReactive<Switch, SwitchProps>;
15
- Text: FCReactive<Text, TextProps>;
16
- TextInput: FCReactive<TextInput, TextInputProps>;
17
- TouchableWithoutFeedback: FCReactive<TouchableWithoutFeedback, TouchableWithoutFeedbackProps>;
18
- View: FCReactive<View, ViewProps>;
19
- }
20
- }
3
+ declare function enableReactNativeComponents_(configure: typeof configureReactive): void;
21
4
 
22
- export { enableReactNativeComponents };
5
+ export { enableReactNativeComponents_ };
@@ -1,22 +1,5 @@
1
- import { FCReactiveObject, FCReactive, configureReactive } from '@legendapp/state/react';
2
- import { ActivityIndicator, ActivityIndicatorProps, Button, ButtonProps, FlatList, FlatListProps, Image, ImageProps, Pressable, PressableProps, ScrollView, ScrollViewProps, SectionList, SectionListProps, Switch, SwitchProps, Text, TextProps, TextInput, TextInputProps, TouchableWithoutFeedback, TouchableWithoutFeedbackProps, View, ViewProps } from 'react-native';
1
+ import { configureReactive } from '@legendapp/state/react';
3
2
 
4
- declare function enableReactNativeComponents(configure: typeof configureReactive): void;
5
- declare module '@legendapp/state/react' {
6
- interface IReactive extends FCReactiveObject<JSX.IntrinsicElements> {
7
- ActivityIndicator: FCReactive<ActivityIndicator, ActivityIndicatorProps>;
8
- Button: FCReactive<Button, ButtonProps>;
9
- FlatList: FCReactive<FlatList, FlatListProps<any>>;
10
- Image: FCReactive<Image, ImageProps>;
11
- Pressable: FCReactive<typeof Pressable, PressableProps>;
12
- ScrollView: FCReactive<ScrollView, ScrollViewProps>;
13
- SectionList: FCReactive<SectionList, SectionListProps<any>>;
14
- Switch: FCReactive<Switch, SwitchProps>;
15
- Text: FCReactive<Text, TextProps>;
16
- TextInput: FCReactive<TextInput, TextInputProps>;
17
- TouchableWithoutFeedback: FCReactive<TouchableWithoutFeedback, TouchableWithoutFeedbackProps>;
18
- View: FCReactive<View, ViewProps>;
19
- }
20
- }
3
+ declare function enableReactNativeComponents_(configure: typeof configureReactive): void;
21
4
 
22
- export { enableReactNativeComponents };
5
+ export { enableReactNativeComponents_ };
@@ -1,11 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var react = require('react');
4
3
  var react$1 = require('@legendapp/state/react');
4
+ var react = require('react');
5
5
  var reactNative = require('react-native');
6
6
 
7
7
  // src/react-reactive/enableReactNativeComponents.ts
8
- function enableReactNativeComponents(configure) {
8
+ var isEnabled = false;
9
+ function enableReactNativeComponents_(configure) {
10
+ if (isEnabled) {
11
+ return;
12
+ }
13
+ isEnabled = true;
9
14
  configure({
10
15
  components: {
11
16
  ActivityIndicator: reactNative.ActivityIndicator,
@@ -50,4 +55,4 @@ function enableReactNativeComponents(configure) {
50
55
  });
51
56
  }
52
57
 
53
- exports.enableReactNativeComponents = enableReactNativeComponents;
58
+ exports.enableReactNativeComponents_ = enableReactNativeComponents_;
@@ -1,9 +1,14 @@
1
- import { useRef } from 'react';
2
1
  import { useSelector } from '@legendapp/state/react';
2
+ import { useRef } from 'react';
3
3
  import { ActivityIndicator, Button, FlatList, Image, Pressable, ScrollView, SectionList, Switch, Text, TextInput, TouchableWithoutFeedback, View } from 'react-native';
4
4
 
5
5
  // src/react-reactive/enableReactNativeComponents.ts
6
- function enableReactNativeComponents(configure) {
6
+ var isEnabled = false;
7
+ function enableReactNativeComponents_(configure) {
8
+ if (isEnabled) {
9
+ return;
10
+ }
11
+ isEnabled = true;
7
12
  configure({
8
13
  components: {
9
14
  ActivityIndicator,
@@ -48,4 +53,4 @@ function enableReactNativeComponents(configure) {
48
53
  });
49
54
  }
50
55
 
51
- export { enableReactNativeComponents };
56
+ export { enableReactNativeComponents_ };
@@ -1,8 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  // src/react-reactive/enableReactComponents.ts
4
- function enableReactComponents(config) {
5
- const bindInfo = { value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" } };
4
+ var isEnabled = false;
5
+ function enableReactComponents_(config) {
6
+ if (isEnabled) {
7
+ return;
8
+ }
9
+ isEnabled = true;
10
+ const bindInfo = {
11
+ value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" }
12
+ };
6
13
  const bindInfoInput = Object.assign(
7
14
  { checked: { handler: "onChange", getValue: (e) => e.target.checked } },
8
15
  bindInfo
@@ -18,7 +25,7 @@ function enableReactComponents(config) {
18
25
 
19
26
  // src/react-reactive/enableReactive.ts
20
27
  function enableReactive(config) {
21
- enableReactComponents(config);
28
+ enableReactComponents_(config);
22
29
  }
23
30
 
24
31
  exports.enableReactive = enableReactive;
@@ -1,6 +1,13 @@
1
1
  // src/react-reactive/enableReactComponents.ts
2
- function enableReactComponents(config) {
3
- const bindInfo = { value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" } };
2
+ var isEnabled = false;
3
+ function enableReactComponents_(config) {
4
+ if (isEnabled) {
5
+ return;
6
+ }
7
+ isEnabled = true;
8
+ const bindInfo = {
9
+ value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" }
10
+ };
4
11
  const bindInfoInput = Object.assign(
5
12
  { checked: { handler: "onChange", getValue: (e) => e.target.checked } },
6
13
  bindInfo
@@ -16,7 +23,7 @@ function enableReactComponents(config) {
16
23
 
17
24
  // src/react-reactive/enableReactive.ts
18
25
  function enableReactive(config) {
19
- enableReactComponents(config);
26
+ enableReactComponents_(config);
20
27
  }
21
28
 
22
29
  export { enableReactive };
@@ -1,11 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var react = require('react');
4
3
  var react$1 = require('@legendapp/state/react');
4
+ var react = require('react');
5
5
  var reactNative = require('react-native');
6
6
 
7
7
  // src/react-reactive/enableReactNativeComponents.ts
8
- function enableReactNativeComponents(configure) {
8
+ var isEnabled = false;
9
+ function enableReactNativeComponents_(configure) {
10
+ if (isEnabled) {
11
+ return;
12
+ }
13
+ isEnabled = true;
9
14
  configure({
10
15
  components: {
11
16
  ActivityIndicator: reactNative.ActivityIndicator,
@@ -52,7 +57,7 @@ function enableReactNativeComponents(configure) {
52
57
 
53
58
  // src/react-reactive/enableReactive.native.ts
54
59
  function enableReactive(configure) {
55
- enableReactNativeComponents(configure);
60
+ enableReactNativeComponents_(configure);
56
61
  }
57
62
 
58
63
  exports.enableReactive = enableReactive;
@@ -1,9 +1,14 @@
1
- import { useRef } from 'react';
2
1
  import { useSelector } from '@legendapp/state/react';
2
+ import { useRef } from 'react';
3
3
  import { ActivityIndicator, Button, FlatList, Image, Pressable, ScrollView, SectionList, Switch, Text, TextInput, TouchableWithoutFeedback, View } from 'react-native';
4
4
 
5
5
  // src/react-reactive/enableReactNativeComponents.ts
6
- function enableReactNativeComponents(configure) {
6
+ var isEnabled = false;
7
+ function enableReactNativeComponents_(configure) {
8
+ if (isEnabled) {
9
+ return;
10
+ }
11
+ isEnabled = true;
7
12
  configure({
8
13
  components: {
9
14
  ActivityIndicator,
@@ -50,7 +55,7 @@ function enableReactNativeComponents(configure) {
50
55
 
51
56
  // src/react-reactive/enableReactive.native.ts
52
57
  function enableReactive(configure) {
53
- enableReactNativeComponents(configure);
58
+ enableReactNativeComponents_(configure);
54
59
  }
55
60
 
56
61
  export { enableReactive };
@@ -1,11 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var react = require('react');
4
3
  var react$1 = require('@legendapp/state/react');
4
+ var react = require('react');
5
5
  var reactNative = require('react-native');
6
6
 
7
7
  // src/react-reactive/enableReactNativeComponents.ts
8
- function enableReactNativeComponents(configure) {
8
+ var isEnabled = false;
9
+ function enableReactNativeComponents_(configure) {
10
+ if (isEnabled) {
11
+ return;
12
+ }
13
+ isEnabled = true;
9
14
  configure({
10
15
  components: {
11
16
  ActivityIndicator: reactNative.ActivityIndicator,
@@ -52,7 +57,7 @@ function enableReactNativeComponents(configure) {
52
57
 
53
58
  // src/react-reactive/enableReactive.web.ts
54
59
  function enableReactive(configure) {
55
- enableReactNativeComponents(configure);
60
+ enableReactNativeComponents_(configure);
56
61
  }
57
62
 
58
63
  exports.enableReactive = enableReactive;
@@ -1,9 +1,14 @@
1
- import { useRef } from 'react';
2
1
  import { useSelector } from '@legendapp/state/react';
2
+ import { useRef } from 'react';
3
3
  import { ActivityIndicator, Button, FlatList, Image, Pressable, ScrollView, SectionList, Switch, Text, TextInput, TouchableWithoutFeedback, View } from 'react-native';
4
4
 
5
5
  // src/react-reactive/enableReactNativeComponents.ts
6
- function enableReactNativeComponents(configure) {
6
+ var isEnabled = false;
7
+ function enableReactNativeComponents_(configure) {
8
+ if (isEnabled) {
9
+ return;
10
+ }
11
+ isEnabled = true;
7
12
  configure({
8
13
  components: {
9
14
  ActivityIndicator,
@@ -50,7 +55,7 @@ function enableReactNativeComponents(configure) {
50
55
 
51
56
  // src/react-reactive/enableReactive.web.ts
52
57
  function enableReactive(configure) {
53
- enableReactNativeComponents(configure);
58
+ enableReactNativeComponents_(configure);
54
59
  }
55
60
 
56
61
  export { enableReactive };
@@ -0,0 +1,6 @@
1
+ import { FCReactiveObject } from '@legendapp/state/react';
2
+
3
+ type IReactive = FCReactiveObject<JSX.IntrinsicElements>;
4
+ declare const $React: IReactive;
5
+
6
+ export { $React };