@legendapp/state 3.0.0-beta.8 → 3.0.0-beta.9
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/package.json +7 -1
- package/react-reactive/enableReactComponents.d.mts +3 -2
- package/react-reactive/enableReactComponents.d.ts +3 -2
- package/react-reactive/enableReactComponents.js +7 -2
- package/react-reactive/enableReactComponents.mjs +7 -2
- package/react-reactive/enableReactNativeComponents.d.mts +3 -20
- package/react-reactive/enableReactNativeComponents.d.ts +3 -20
- package/react-reactive/enableReactNativeComponents.js +8 -3
- package/react-reactive/enableReactNativeComponents.mjs +8 -3
- package/react-reactive/enableReactive.js +7 -2
- package/react-reactive/enableReactive.mjs +7 -2
- package/react-reactive/enableReactive.native.js +8 -3
- package/react-reactive/enableReactive.native.mjs +8 -3
- package/react-reactive/enableReactive.web.js +8 -3
- package/react-reactive/enableReactive.web.mjs +8 -3
- package/react.d.mts +4 -4
- package/react.d.ts +4 -4
- package/trace.js +5 -6
- package/trace.mjs +5 -6
- package/types/reactive-native.d.ts +19 -0
- package/types/reactive-web.d.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/state",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.9",
|
|
4
4
|
"description": "legend-state",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"private": false,
|
|
@@ -48,6 +48,12 @@
|
|
|
48
48
|
"./types/babel": {
|
|
49
49
|
"types": "./types/babel.d.ts"
|
|
50
50
|
},
|
|
51
|
+
"./types/reactive-web": {
|
|
52
|
+
"types": "./types/reactive-web.d.ts"
|
|
53
|
+
},
|
|
54
|
+
"./types/reactive-native": {
|
|
55
|
+
"types": "./types/reactive-native.d.ts"
|
|
56
|
+
},
|
|
51
57
|
".": {
|
|
52
58
|
"import": "./index.mjs",
|
|
53
59
|
"require": "./index.js",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FCReactiveObject, configureReactive } from '@legendapp/state/react';
|
|
2
2
|
|
|
3
|
-
declare function
|
|
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 {
|
|
10
|
+
export { enableReactComponents_ };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FCReactiveObject, configureReactive } from '@legendapp/state/react';
|
|
2
2
|
|
|
3
|
-
declare function
|
|
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 {
|
|
10
|
+
export { enableReactComponents_ };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/react-reactive/enableReactComponents.ts
|
|
4
|
-
|
|
4
|
+
var isEnabled = false;
|
|
5
|
+
function enableReactComponents_(config) {
|
|
6
|
+
if (isEnabled) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
isEnabled = true;
|
|
5
10
|
const bindInfo = { value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" } };
|
|
6
11
|
const bindInfoInput = Object.assign(
|
|
7
12
|
{ checked: { handler: "onChange", getValue: (e) => e.target.checked } },
|
|
@@ -16,4 +21,4 @@ function enableReactComponents(config) {
|
|
|
16
21
|
});
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
exports.
|
|
24
|
+
exports.enableReactComponents_ = enableReactComponents_;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// src/react-reactive/enableReactComponents.ts
|
|
2
|
-
|
|
2
|
+
var isEnabled = false;
|
|
3
|
+
function enableReactComponents_(config) {
|
|
4
|
+
if (isEnabled) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
isEnabled = true;
|
|
3
8
|
const bindInfo = { value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" } };
|
|
4
9
|
const bindInfoInput = Object.assign(
|
|
5
10
|
{ checked: { handler: "onChange", getValue: (e) => e.target.checked } },
|
|
@@ -14,4 +19,4 @@ function enableReactComponents(config) {
|
|
|
14
19
|
});
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
export {
|
|
22
|
+
export { enableReactComponents_ };
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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 {
|
|
5
|
+
export { enableReactNativeComponents_ };
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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 {
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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 {
|
|
56
|
+
export { enableReactNativeComponents_ };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/react-reactive/enableReactComponents.ts
|
|
4
|
-
|
|
4
|
+
var isEnabled = false;
|
|
5
|
+
function enableReactComponents_(config) {
|
|
6
|
+
if (isEnabled) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
isEnabled = true;
|
|
5
10
|
const bindInfo = { value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" } };
|
|
6
11
|
const bindInfoInput = Object.assign(
|
|
7
12
|
{ checked: { handler: "onChange", getValue: (e) => e.target.checked } },
|
|
@@ -18,7 +23,7 @@ function enableReactComponents(config) {
|
|
|
18
23
|
|
|
19
24
|
// src/react-reactive/enableReactive.ts
|
|
20
25
|
function enableReactive(config) {
|
|
21
|
-
|
|
26
|
+
enableReactComponents_(config);
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
exports.enableReactive = enableReactive;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// src/react-reactive/enableReactComponents.ts
|
|
2
|
-
|
|
2
|
+
var isEnabled = false;
|
|
3
|
+
function enableReactComponents_(config) {
|
|
4
|
+
if (isEnabled) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
isEnabled = true;
|
|
3
8
|
const bindInfo = { value: { handler: "onChange", getValue: (e) => e.target.value, defaultValue: "" } };
|
|
4
9
|
const bindInfoInput = Object.assign(
|
|
5
10
|
{ checked: { handler: "onChange", getValue: (e) => e.target.checked } },
|
|
@@ -16,7 +21,7 @@ function enableReactComponents(config) {
|
|
|
16
21
|
|
|
17
22
|
// src/react-reactive/enableReactive.ts
|
|
18
23
|
function enableReactive(config) {
|
|
19
|
-
|
|
24
|
+
enableReactComponents_(config);
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
58
|
+
enableReactNativeComponents_(configure);
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
export { enableReactive };
|
package/react.d.mts
CHANGED
|
@@ -101,10 +101,10 @@ type ObjectShapeWith$<T> = {
|
|
|
101
101
|
type ExtractFCPropsType<T> = T extends FC<infer P> ? P : never;
|
|
102
102
|
declare const hasSymbol: false | ((key: string) => symbol);
|
|
103
103
|
declare function observer<P extends FC<any>>(component: P): P;
|
|
104
|
-
declare function reactive<T extends FC<any>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T
|
|
105
|
-
declare function reactive<T extends FC<any>, T2 extends keyof ExtractFCPropsType<T>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T
|
|
106
|
-
declare function reactiveObserver<T extends FC<any>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T
|
|
107
|
-
declare function reactiveObserver<T extends FC<any>, T2 extends keyof ExtractFCPropsType<T>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T
|
|
104
|
+
declare function reactive<T extends FC<any>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T & FC<ShapeWith$<ExtractFCPropsType<T>>>;
|
|
105
|
+
declare function reactive<T extends FC<any>, T2 extends keyof ExtractFCPropsType<T>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T & FC<ShapeWithPick$<ExtractFCPropsType<T>, T2>>;
|
|
106
|
+
declare function reactiveObserver<T extends FC<any>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T & FC<ShapeWith$<ExtractFCPropsType<T>>>;
|
|
107
|
+
declare function reactiveObserver<T extends FC<any>, T2 extends keyof ExtractFCPropsType<T>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T & FC<ShapeWithPick$<ExtractFCPropsType<T>, T2>>;
|
|
108
108
|
declare function reactiveComponents<P extends Record<string, FC>>(components: P): ObjectShapeWith$<P>;
|
|
109
109
|
|
|
110
110
|
declare function useComputed<T>(get: () => T | Promise<T>): Observable<T>;
|
package/react.d.ts
CHANGED
|
@@ -101,10 +101,10 @@ type ObjectShapeWith$<T> = {
|
|
|
101
101
|
type ExtractFCPropsType<T> = T extends FC<infer P> ? P : never;
|
|
102
102
|
declare const hasSymbol: false | ((key: string) => symbol);
|
|
103
103
|
declare function observer<P extends FC<any>>(component: P): P;
|
|
104
|
-
declare function reactive<T extends FC<any>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T
|
|
105
|
-
declare function reactive<T extends FC<any>, T2 extends keyof ExtractFCPropsType<T>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T
|
|
106
|
-
declare function reactiveObserver<T extends FC<any>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T
|
|
107
|
-
declare function reactiveObserver<T extends FC<any>, T2 extends keyof ExtractFCPropsType<T>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T
|
|
104
|
+
declare function reactive<T extends FC<any>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T & FC<ShapeWith$<ExtractFCPropsType<T>>>;
|
|
105
|
+
declare function reactive<T extends FC<any>, T2 extends keyof ExtractFCPropsType<T>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T & FC<ShapeWithPick$<ExtractFCPropsType<T>, T2>>;
|
|
106
|
+
declare function reactiveObserver<T extends FC<any>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T & FC<ShapeWith$<ExtractFCPropsType<T>>>;
|
|
107
|
+
declare function reactiveObserver<T extends FC<any>, T2 extends keyof ExtractFCPropsType<T>>(component: T, bindKeys?: BindKeys<ExtractFCPropsType<T>>): T & FC<ShapeWithPick$<ExtractFCPropsType<T>, T2>>;
|
|
108
108
|
declare function reactiveComponents<P extends Record<string, FC>>(components: P): ObjectShapeWith$<P>;
|
|
109
109
|
|
|
110
110
|
declare function useComputed<T>(get: () => T | Promise<T>): Observable<T>;
|
package/trace.js
CHANGED
|
@@ -19,13 +19,12 @@ function getNodePath(node) {
|
|
|
19
19
|
// src/trace/useTraceListeners.ts
|
|
20
20
|
var { optimized, tracking } = state.internal;
|
|
21
21
|
function useTraceListeners(name) {
|
|
22
|
-
if (process.env.NODE_ENV === "development" && tracking.current) {
|
|
22
|
+
if ((process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test") && tracking.current) {
|
|
23
23
|
tracking.current.traceListeners = traceNodes.bind(this, name);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
function traceNodes(name, nodes) {
|
|
27
|
-
if (process.env.NODE_ENV === "development" &&
|
|
28
|
-
tracking.current.traceListeners = void 0;
|
|
27
|
+
if ((process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test") && nodes.size) {
|
|
29
28
|
const arr = [];
|
|
30
29
|
if (nodes) {
|
|
31
30
|
for (const tracked of nodes.values()) {
|
|
@@ -45,7 +44,7 @@ ${arr.join("\n")}`
|
|
|
45
44
|
}
|
|
46
45
|
var { tracking: tracking2 } = state.internal;
|
|
47
46
|
function useTraceUpdates(name) {
|
|
48
|
-
if (process.env.NODE_ENV === "development" && tracking2.current) {
|
|
47
|
+
if ((process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test") && tracking2.current) {
|
|
49
48
|
tracking2.current.traceUpdates = replaceUpdateFn.bind(void 0, name);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
@@ -54,13 +53,13 @@ function replaceUpdateFn(name, updateFn) {
|
|
|
54
53
|
}
|
|
55
54
|
function onChange(name, updateFn, params) {
|
|
56
55
|
const { changes } = params;
|
|
57
|
-
if (process.env.NODE_ENV === "development") {
|
|
56
|
+
if (process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test") {
|
|
58
57
|
changes.forEach(({ path, valueAtPath, prevAtPath }) => {
|
|
59
58
|
console.log(`[legend-state] Rendering ${name ? name + " " : ""}because "${path}" changed:
|
|
60
59
|
from: ${JSON.stringify(prevAtPath)}
|
|
61
60
|
to: ${JSON.stringify(valueAtPath)}`);
|
|
62
61
|
});
|
|
63
|
-
return updateFn();
|
|
62
|
+
return updateFn(params);
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
var { optimized: optimized2, tracking: tracking3 } = state.internal;
|
package/trace.mjs
CHANGED
|
@@ -17,13 +17,12 @@ function getNodePath(node) {
|
|
|
17
17
|
// src/trace/useTraceListeners.ts
|
|
18
18
|
var { optimized, tracking } = internal;
|
|
19
19
|
function useTraceListeners(name) {
|
|
20
|
-
if (process.env.NODE_ENV === "development" && tracking.current) {
|
|
20
|
+
if ((process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test") && tracking.current) {
|
|
21
21
|
tracking.current.traceListeners = traceNodes.bind(this, name);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
function traceNodes(name, nodes) {
|
|
25
|
-
if (process.env.NODE_ENV === "development" &&
|
|
26
|
-
tracking.current.traceListeners = void 0;
|
|
25
|
+
if ((process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test") && nodes.size) {
|
|
27
26
|
const arr = [];
|
|
28
27
|
if (nodes) {
|
|
29
28
|
for (const tracked of nodes.values()) {
|
|
@@ -43,7 +42,7 @@ ${arr.join("\n")}`
|
|
|
43
42
|
}
|
|
44
43
|
var { tracking: tracking2 } = internal;
|
|
45
44
|
function useTraceUpdates(name) {
|
|
46
|
-
if (process.env.NODE_ENV === "development" && tracking2.current) {
|
|
45
|
+
if ((process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test") && tracking2.current) {
|
|
47
46
|
tracking2.current.traceUpdates = replaceUpdateFn.bind(void 0, name);
|
|
48
47
|
}
|
|
49
48
|
}
|
|
@@ -52,13 +51,13 @@ function replaceUpdateFn(name, updateFn) {
|
|
|
52
51
|
}
|
|
53
52
|
function onChange(name, updateFn, params) {
|
|
54
53
|
const { changes } = params;
|
|
55
|
-
if (process.env.NODE_ENV === "development") {
|
|
54
|
+
if (process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test") {
|
|
56
55
|
changes.forEach(({ path, valueAtPath, prevAtPath }) => {
|
|
57
56
|
console.log(`[legend-state] Rendering ${name ? name + " " : ""}because "${path}" changed:
|
|
58
57
|
from: ${JSON.stringify(prevAtPath)}
|
|
59
58
|
to: ${JSON.stringify(valueAtPath)}`);
|
|
60
59
|
});
|
|
61
|
-
return updateFn();
|
|
60
|
+
return updateFn(params);
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
63
|
var { optimized: optimized2, tracking: tracking3 } = internal;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import type { IReactive } from '@legendapp/state/react';
|
|
3
|
+
|
|
4
|
+
declare module '@legendapp/state/react' {
|
|
5
|
+
interface IReactive {
|
|
6
|
+
ActivityIndicator: FCReactive<ActivityIndicator, ActivityIndicatorProps>;
|
|
7
|
+
Button: FCReactive<Button, ButtonProps>;
|
|
8
|
+
FlatList: FCReactive<FlatList, FlatListProps<any>>;
|
|
9
|
+
Image: FCReactive<Image, ImageProps>;
|
|
10
|
+
Pressable: FCReactive<typeof Pressable, PressableProps>;
|
|
11
|
+
ScrollView: FCReactive<ScrollView, ScrollViewProps>;
|
|
12
|
+
SectionList: FCReactive<SectionList, SectionListProps<any>>;
|
|
13
|
+
Switch: FCReactive<Switch, SwitchProps>;
|
|
14
|
+
Text: FCReactive<Text, TextProps>;
|
|
15
|
+
TextInput: FCReactive<TextInput, TextInputProps>;
|
|
16
|
+
TouchableWithoutFeedback: FCReactive<TouchableWithoutFeedback, TouchableWithoutFeedbackProps>;
|
|
17
|
+
View: FCReactive<View, ViewProps>;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import type { IReactive, FCReactiveObject } from '@legendapp/state/react';
|
|
3
|
+
|
|
4
|
+
declare module '@legendapp/state/react' {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
6
|
+
interface IReactive extends FCReactiveObject<JSX.IntrinsicElements> {}
|
|
7
|
+
}
|