react-store-input 0.1.4 → 0.1.5
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/index.js +1 -11
- package/dist/index.mjs +2 -12
- package/dist/use_form_store.js +1 -11
- package/dist/use_form_store.mjs +2 -12
- package/dist/use_store_component.js +1 -11
- package/dist/use_store_component.mjs +2 -12
- package/dist/use_store_controller.js +1 -11
- package/dist/use_store_controller.mjs +2 -12
- package/dist/use_store_input.js +1 -11
- package/dist/use_store_input.mjs +2 -12
- package/dist/use_store_input_with_name.js +1 -11
- package/dist/use_store_input_with_name.mjs +2 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -121,18 +121,8 @@ function useSelector(store, selector, compare = (a, b) => a === b) {
|
|
|
121
121
|
var import_react4 = require("react");
|
|
122
122
|
function useStoreController(store, props) {
|
|
123
123
|
const ref = (0, import_react4.useRef)(null);
|
|
124
|
+
(0, import_react4.useImperativeHandle)(props.ref, () => ref.current, []);
|
|
124
125
|
const dispatchKey = (0, import_react4.useId)();
|
|
125
|
-
(0, import_react4.useEffect)(() => {
|
|
126
|
-
const element = ref.current;
|
|
127
|
-
if (!element) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (typeof props.ref === "function") {
|
|
131
|
-
props.ref(element);
|
|
132
|
-
} else if (props.ref) {
|
|
133
|
-
props.ref.current = element;
|
|
134
|
-
}
|
|
135
|
-
}, []);
|
|
136
126
|
useSubscribe(store, (state, key) => {
|
|
137
127
|
if (key === dispatchKey) {
|
|
138
128
|
return;
|
package/dist/index.mjs
CHANGED
|
@@ -70,21 +70,11 @@ function useSelector(store, selector, compare = (a, b) => a === b) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// src/use_store_controller.tsx
|
|
73
|
-
import {
|
|
73
|
+
import { useId, useImperativeHandle, useRef as useRef2 } from "react";
|
|
74
74
|
function useStoreController(store, props) {
|
|
75
75
|
const ref = useRef2(null);
|
|
76
|
+
useImperativeHandle(props.ref, () => ref.current, []);
|
|
76
77
|
const dispatchKey = useId();
|
|
77
|
-
useEffect2(() => {
|
|
78
|
-
const element = ref.current;
|
|
79
|
-
if (!element) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
if (typeof props.ref === "function") {
|
|
83
|
-
props.ref(element);
|
|
84
|
-
} else if (props.ref) {
|
|
85
|
-
props.ref.current = element;
|
|
86
|
-
}
|
|
87
|
-
}, []);
|
|
88
78
|
useSubscribe(store, (state, key) => {
|
|
89
79
|
if (key === dispatchKey) {
|
|
90
80
|
return;
|
package/dist/use_form_store.js
CHANGED
|
@@ -130,18 +130,8 @@ var import_date_fns = require("date-fns");
|
|
|
130
130
|
var import_react5 = require("react");
|
|
131
131
|
function useStoreController(store, props) {
|
|
132
132
|
const ref = (0, import_react5.useRef)(null);
|
|
133
|
+
(0, import_react5.useImperativeHandle)(props.ref, () => ref.current, []);
|
|
133
134
|
const dispatchKey = (0, import_react5.useId)();
|
|
134
|
-
(0, import_react5.useEffect)(() => {
|
|
135
|
-
const element = ref.current;
|
|
136
|
-
if (!element) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
if (typeof props.ref === "function") {
|
|
140
|
-
props.ref(element);
|
|
141
|
-
} else if (props.ref) {
|
|
142
|
-
props.ref.current = element;
|
|
143
|
-
}
|
|
144
|
-
}, []);
|
|
145
135
|
useSubscribe(store, (state, key) => {
|
|
146
136
|
if (key === dispatchKey) {
|
|
147
137
|
return;
|
package/dist/use_form_store.mjs
CHANGED
|
@@ -93,21 +93,11 @@ import "react";
|
|
|
93
93
|
import { format } from "date-fns";
|
|
94
94
|
|
|
95
95
|
// src/use_store_controller.tsx
|
|
96
|
-
import {
|
|
96
|
+
import { useId, useImperativeHandle, useRef as useRef2 } from "react";
|
|
97
97
|
function useStoreController(store, props) {
|
|
98
98
|
const ref = useRef2(null);
|
|
99
|
+
useImperativeHandle(props.ref, () => ref.current, []);
|
|
99
100
|
const dispatchKey = useId();
|
|
100
|
-
useEffect2(() => {
|
|
101
|
-
const element = ref.current;
|
|
102
|
-
if (!element) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (typeof props.ref === "function") {
|
|
106
|
-
props.ref(element);
|
|
107
|
-
} else if (props.ref) {
|
|
108
|
-
props.ref.current = element;
|
|
109
|
-
}
|
|
110
|
-
}, []);
|
|
111
101
|
useSubscribe(store, (state, key) => {
|
|
112
102
|
if (key === dispatchKey) {
|
|
113
103
|
return;
|
|
@@ -60,18 +60,8 @@ function useSubscribe(store, subscriber) {
|
|
|
60
60
|
// src/use_store_controller.tsx
|
|
61
61
|
function useStoreController(store, props) {
|
|
62
62
|
const ref = (0, import_react2.useRef)(null);
|
|
63
|
+
(0, import_react2.useImperativeHandle)(props.ref, () => ref.current, []);
|
|
63
64
|
const dispatchKey = (0, import_react2.useId)();
|
|
64
|
-
(0, import_react2.useEffect)(() => {
|
|
65
|
-
const element = ref.current;
|
|
66
|
-
if (!element) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (typeof props.ref === "function") {
|
|
70
|
-
props.ref(element);
|
|
71
|
-
} else if (props.ref) {
|
|
72
|
-
props.ref.current = element;
|
|
73
|
-
}
|
|
74
|
-
}, []);
|
|
75
65
|
useSubscribe(store, (state, key) => {
|
|
76
66
|
if (key === dispatchKey) {
|
|
77
67
|
return;
|
|
@@ -9,7 +9,7 @@ import "react";
|
|
|
9
9
|
import { format } from "date-fns";
|
|
10
10
|
|
|
11
11
|
// src/use_store_controller.tsx
|
|
12
|
-
import {
|
|
12
|
+
import { useId, useImperativeHandle, useRef } from "react";
|
|
13
13
|
|
|
14
14
|
// src/use_subscribe.tsx
|
|
15
15
|
import { useEffect } from "react";
|
|
@@ -25,18 +25,8 @@ function useSubscribe(store, subscriber) {
|
|
|
25
25
|
// src/use_store_controller.tsx
|
|
26
26
|
function useStoreController(store, props) {
|
|
27
27
|
const ref = useRef(null);
|
|
28
|
+
useImperativeHandle(props.ref, () => ref.current, []);
|
|
28
29
|
const dispatchKey = useId();
|
|
29
|
-
useEffect2(() => {
|
|
30
|
-
const element = ref.current;
|
|
31
|
-
if (!element) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (typeof props.ref === "function") {
|
|
35
|
-
props.ref(element);
|
|
36
|
-
} else if (props.ref) {
|
|
37
|
-
props.ref.current = element;
|
|
38
|
-
}
|
|
39
|
-
}, []);
|
|
40
30
|
useSubscribe(store, (state, key) => {
|
|
41
31
|
if (key === dispatchKey) {
|
|
42
32
|
return;
|
|
@@ -39,18 +39,8 @@ function useSubscribe(store, subscriber) {
|
|
|
39
39
|
// src/use_store_controller.tsx
|
|
40
40
|
function useStoreController(store, props) {
|
|
41
41
|
const ref = (0, import_react2.useRef)(null);
|
|
42
|
+
(0, import_react2.useImperativeHandle)(props.ref, () => ref.current, []);
|
|
42
43
|
const dispatchKey = (0, import_react2.useId)();
|
|
43
|
-
(0, import_react2.useEffect)(() => {
|
|
44
|
-
const element = ref.current;
|
|
45
|
-
if (!element) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (typeof props.ref === "function") {
|
|
49
|
-
props.ref(element);
|
|
50
|
-
} else if (props.ref) {
|
|
51
|
-
props.ref.current = element;
|
|
52
|
-
}
|
|
53
|
-
}, []);
|
|
54
44
|
useSubscribe(store, (state, key) => {
|
|
55
45
|
if (key === dispatchKey) {
|
|
56
46
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/use_store_controller.tsx
|
|
2
|
-
import {
|
|
2
|
+
import { useId, useImperativeHandle, useRef } from "react";
|
|
3
3
|
|
|
4
4
|
// src/use_subscribe.tsx
|
|
5
5
|
import { useEffect } from "react";
|
|
@@ -15,18 +15,8 @@ function useSubscribe(store, subscriber) {
|
|
|
15
15
|
// src/use_store_controller.tsx
|
|
16
16
|
function useStoreController(store, props) {
|
|
17
17
|
const ref = useRef(null);
|
|
18
|
+
useImperativeHandle(props.ref, () => ref.current, []);
|
|
18
19
|
const dispatchKey = useId();
|
|
19
|
-
useEffect2(() => {
|
|
20
|
-
const element = ref.current;
|
|
21
|
-
if (!element) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (typeof props.ref === "function") {
|
|
25
|
-
props.ref(element);
|
|
26
|
-
} else if (props.ref) {
|
|
27
|
-
props.ref.current = element;
|
|
28
|
-
}
|
|
29
|
-
}, []);
|
|
30
20
|
useSubscribe(store, (state, key) => {
|
|
31
21
|
if (key === dispatchKey) {
|
|
32
22
|
return;
|
package/dist/use_store_input.js
CHANGED
|
@@ -43,18 +43,8 @@ function useSubscribe(store, subscriber) {
|
|
|
43
43
|
// src/use_store_controller.tsx
|
|
44
44
|
function useStoreController(store, props) {
|
|
45
45
|
const ref = (0, import_react2.useRef)(null);
|
|
46
|
+
(0, import_react2.useImperativeHandle)(props.ref, () => ref.current, []);
|
|
46
47
|
const dispatchKey = (0, import_react2.useId)();
|
|
47
|
-
(0, import_react2.useEffect)(() => {
|
|
48
|
-
const element = ref.current;
|
|
49
|
-
if (!element) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (typeof props.ref === "function") {
|
|
53
|
-
props.ref(element);
|
|
54
|
-
} else if (props.ref) {
|
|
55
|
-
props.ref.current = element;
|
|
56
|
-
}
|
|
57
|
-
}, []);
|
|
58
48
|
useSubscribe(store, (state, key) => {
|
|
59
49
|
if (key === dispatchKey) {
|
|
60
50
|
return;
|
package/dist/use_store_input.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import "react";
|
|
|
3
3
|
import { format } from "date-fns";
|
|
4
4
|
|
|
5
5
|
// src/use_store_controller.tsx
|
|
6
|
-
import {
|
|
6
|
+
import { useId, useImperativeHandle, useRef } from "react";
|
|
7
7
|
|
|
8
8
|
// src/use_subscribe.tsx
|
|
9
9
|
import { useEffect } from "react";
|
|
@@ -19,18 +19,8 @@ function useSubscribe(store, subscriber) {
|
|
|
19
19
|
// src/use_store_controller.tsx
|
|
20
20
|
function useStoreController(store, props) {
|
|
21
21
|
const ref = useRef(null);
|
|
22
|
+
useImperativeHandle(props.ref, () => ref.current, []);
|
|
22
23
|
const dispatchKey = useId();
|
|
23
|
-
useEffect2(() => {
|
|
24
|
-
const element = ref.current;
|
|
25
|
-
if (!element) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (typeof props.ref === "function") {
|
|
29
|
-
props.ref(element);
|
|
30
|
-
} else if (props.ref) {
|
|
31
|
-
props.ref.current = element;
|
|
32
|
-
}
|
|
33
|
-
}, []);
|
|
34
24
|
useSubscribe(store, (state, key) => {
|
|
35
25
|
if (key === dispatchKey) {
|
|
36
26
|
return;
|
|
@@ -45,18 +45,8 @@ function useSubscribe(store, subscriber) {
|
|
|
45
45
|
// src/use_store_controller.tsx
|
|
46
46
|
function useStoreController(store, props) {
|
|
47
47
|
const ref = (0, import_react2.useRef)(null);
|
|
48
|
+
(0, import_react2.useImperativeHandle)(props.ref, () => ref.current, []);
|
|
48
49
|
const dispatchKey = (0, import_react2.useId)();
|
|
49
|
-
(0, import_react2.useEffect)(() => {
|
|
50
|
-
const element = ref.current;
|
|
51
|
-
if (!element) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (typeof props.ref === "function") {
|
|
55
|
-
props.ref(element);
|
|
56
|
-
} else if (props.ref) {
|
|
57
|
-
props.ref.current = element;
|
|
58
|
-
}
|
|
59
|
-
}, []);
|
|
60
50
|
useSubscribe(store, (state, key) => {
|
|
61
51
|
if (key === dispatchKey) {
|
|
62
52
|
return;
|
|
@@ -3,7 +3,7 @@ import "react";
|
|
|
3
3
|
import { format } from "date-fns";
|
|
4
4
|
|
|
5
5
|
// src/use_store_controller.tsx
|
|
6
|
-
import {
|
|
6
|
+
import { useId, useImperativeHandle, useRef } from "react";
|
|
7
7
|
|
|
8
8
|
// src/use_subscribe.tsx
|
|
9
9
|
import { useEffect } from "react";
|
|
@@ -19,18 +19,8 @@ function useSubscribe(store, subscriber) {
|
|
|
19
19
|
// src/use_store_controller.tsx
|
|
20
20
|
function useStoreController(store, props) {
|
|
21
21
|
const ref = useRef(null);
|
|
22
|
+
useImperativeHandle(props.ref, () => ref.current, []);
|
|
22
23
|
const dispatchKey = useId();
|
|
23
|
-
useEffect2(() => {
|
|
24
|
-
const element = ref.current;
|
|
25
|
-
if (!element) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (typeof props.ref === "function") {
|
|
29
|
-
props.ref(element);
|
|
30
|
-
} else if (props.ref) {
|
|
31
|
-
props.ref.current = element;
|
|
32
|
-
}
|
|
33
|
-
}, []);
|
|
34
24
|
useSubscribe(store, (state, key) => {
|
|
35
25
|
if (key === dispatchKey) {
|
|
36
26
|
return;
|