react-store-input 0.2.4 → 0.2.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/create_render.d.mts +1 -1
- package/dist/create_render.d.ts +1 -1
- package/dist/create_render.js +3 -27
- package/dist/create_render.mjs +1 -23
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +115 -108
- package/dist/index.mjs +110 -99
- package/dist/text_editor.d.mts +13 -0
- package/dist/text_editor.d.ts +13 -0
- package/dist/text_editor.js +135 -0
- package/dist/text_editor.mjs +112 -0
- package/dist/use_form_store.d.mts +3 -1
- package/dist/use_form_store.d.ts +3 -1
- package/dist/use_form_store.js +111 -102
- package/dist/use_form_store.mjs +108 -97
- package/dist/use_store_component.d.mts +4 -1
- package/dist/use_store_component.d.ts +4 -1
- package/dist/use_store_component.js +97 -25
- package/dist/use_store_component.mjs +104 -30
- package/dist/use_store_controller.d.mts +1 -1
- package/dist/use_store_controller.d.ts +1 -1
- package/dist/use_store_controller.js +9 -17
- package/dist/use_store_controller.mjs +10 -18
- package/dist/use_store_input.d.mts +1 -1
- package/dist/use_store_input.d.ts +1 -1
- package/dist/use_store_input.js +9 -17
- package/dist/use_store_input.mjs +10 -18
- package/dist/use_store_input_with_name.d.mts +1 -1
- package/dist/use_store_input_with_name.d.ts +1 -1
- package/dist/use_store_input_with_name.js +9 -17
- package/dist/use_store_input_with_name.mjs +10 -18
- package/package.json +6 -4
- package/dist/use_selector.d.mts +0 -5
- package/dist/use_selector.d.ts +0 -5
- package/dist/use_selector.js +0 -50
- package/dist/use_selector.mjs +0 -25
- package/dist/use_store.d.mts +0 -12
- package/dist/use_store.d.ts +0 -12
- package/dist/use_store.js +0 -71
- package/dist/use_store.mjs +0 -46
- package/dist/use_subscribe.d.mts +0 -5
- package/dist/use_subscribe.d.ts +0 -5
- package/dist/use_subscribe.js +0 -38
- package/dist/use_subscribe.mjs +0 -13
package/dist/create_render.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Store } from 'gw-store';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
|
-
import { Store } from './use_store.mjs';
|
|
4
4
|
|
|
5
5
|
type CreateRender<TState> = (selector: (state: TState) => ReactNode, compare?: (a: TState, b: TState) => boolean) => ReactNode;
|
|
6
6
|
declare function createRender<TState>(store: Store<TState>, selector: (state: TState) => ReactNode, compare?: (a: TState, b: TState) => boolean): react_jsx_runtime.JSX.Element;
|
package/dist/create_render.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Store } from 'gw-store';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
|
-
import { Store } from './use_store.js';
|
|
4
4
|
|
|
5
5
|
type CreateRender<TState> = (selector: (state: TState) => ReactNode, compare?: (a: TState, b: TState) => boolean) => ReactNode;
|
|
6
6
|
declare function createRender<TState>(store: Store<TState>, selector: (state: TState) => ReactNode, compare?: (a: TState, b: TState) => boolean): react_jsx_runtime.JSX.Element;
|
package/dist/create_render.js
CHANGED
|
@@ -24,35 +24,11 @@ __export(create_render_exports, {
|
|
|
24
24
|
createRenderWithStore: () => createRenderWithStore
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(create_render_exports);
|
|
27
|
-
|
|
28
|
-
// src/use_selector.tsx
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
function useSelector(store, selector, compare = (a, b) => a === b) {
|
|
31
|
-
const [state, setState] = (0, import_react.useState)(selector(store.state));
|
|
32
|
-
const stateRef = (0, import_react.useRef)(state);
|
|
33
|
-
(0, import_react.useEffect)(() => {
|
|
34
|
-
stateRef.current = state;
|
|
35
|
-
}, [state]);
|
|
36
|
-
(0, import_react.useEffect)(() => {
|
|
37
|
-
const unsubscribe = store.subscribe((newState) => {
|
|
38
|
-
const result = selector(newState);
|
|
39
|
-
if (compare(stateRef.current, result)) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
setState(result);
|
|
43
|
-
});
|
|
44
|
-
return () => {
|
|
45
|
-
unsubscribe();
|
|
46
|
-
};
|
|
47
|
-
}, []);
|
|
48
|
-
return state;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// src/create_render.tsx
|
|
27
|
+
var import_gw_store = require("gw-store");
|
|
52
28
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
53
29
|
function createRender(store, selector, compare) {
|
|
54
30
|
function Component() {
|
|
55
|
-
const result = useSelector(store, (state) => state, compare);
|
|
31
|
+
const result = (0, import_gw_store.useSelector)(store, (state) => state, compare);
|
|
56
32
|
const content = selector(result);
|
|
57
33
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: content });
|
|
58
34
|
}
|
|
@@ -61,7 +37,7 @@ function createRender(store, selector, compare) {
|
|
|
61
37
|
function createRenderWithStore(store) {
|
|
62
38
|
return function createRender2(selector, compare) {
|
|
63
39
|
function Component() {
|
|
64
|
-
const result = useSelector(store, (state) => state, compare);
|
|
40
|
+
const result = (0, import_gw_store.useSelector)(store, (state) => state, compare);
|
|
65
41
|
const content = selector(result);
|
|
66
42
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: content });
|
|
67
43
|
}
|
package/dist/create_render.mjs
CHANGED
|
@@ -1,27 +1,5 @@
|
|
|
1
|
-
// src/use_selector.tsx
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
function useSelector(store, selector, compare = (a, b) => a === b) {
|
|
4
|
-
const [state, setState] = useState(selector(store.state));
|
|
5
|
-
const stateRef = useRef(state);
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
stateRef.current = state;
|
|
8
|
-
}, [state]);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const unsubscribe = store.subscribe((newState) => {
|
|
11
|
-
const result = selector(newState);
|
|
12
|
-
if (compare(stateRef.current, result)) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
setState(result);
|
|
16
|
-
});
|
|
17
|
-
return () => {
|
|
18
|
-
unsubscribe();
|
|
19
|
-
};
|
|
20
|
-
}, []);
|
|
21
|
-
return state;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
1
|
// src/create_render.tsx
|
|
2
|
+
import { useSelector } from "gw-store";
|
|
25
3
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
26
4
|
function createRender(store, selector, compare) {
|
|
27
5
|
function Component() {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { Store, StoreSubscriber, useStore } from './use_store.mjs';
|
|
2
|
-
export { useSelector } from './use_selector.mjs';
|
|
3
|
-
export { useSubscribe } from './use_subscribe.mjs';
|
|
4
1
|
export { StoreControllerProps, useStoreController } from './use_store_controller.mjs';
|
|
5
2
|
export { InferNameFromProps, StoreInputWithNameProps, useStoreInputWithName } from './use_store_input_with_name.mjs';
|
|
6
3
|
export { StoreInputProps, useStoreInput } from './use_store_input.mjs';
|
|
7
4
|
export { Input, Select, StoreComponentPropsWithStore, StoreInputWithNameComponentProps, Textarea, useStoreComponent } from './use_store_component.mjs';
|
|
8
5
|
export { FormStore, useFormStore } from './use_form_store.mjs';
|
|
6
|
+
export { TextEditor, TextEditorProps } from './text_editor.mjs';
|
|
7
|
+
import 'gw-store';
|
|
9
8
|
import 'react';
|
|
10
9
|
import 'react/jsx-runtime';
|
|
11
10
|
import './create_render.mjs';
|
|
11
|
+
import 'gw-react-text-editor';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { Store, StoreSubscriber, useStore } from './use_store.js';
|
|
2
|
-
export { useSelector } from './use_selector.js';
|
|
3
|
-
export { useSubscribe } from './use_subscribe.js';
|
|
4
1
|
export { StoreControllerProps, useStoreController } from './use_store_controller.js';
|
|
5
2
|
export { InferNameFromProps, StoreInputWithNameProps, useStoreInputWithName } from './use_store_input_with_name.js';
|
|
6
3
|
export { StoreInputProps, useStoreInput } from './use_store_input.js';
|
|
7
4
|
export { Input, Select, StoreComponentPropsWithStore, StoreInputWithNameComponentProps, Textarea, useStoreComponent } from './use_store_component.js';
|
|
8
5
|
export { FormStore, useFormStore } from './use_form_store.js';
|
|
6
|
+
export { TextEditor, TextEditorProps } from './text_editor.js';
|
|
7
|
+
import 'gw-store';
|
|
9
8
|
import 'react';
|
|
10
9
|
import 'react/jsx-runtime';
|
|
11
10
|
import './create_render.js';
|
|
11
|
+
import 'gw-react-text-editor';
|
package/dist/index.js
CHANGED
|
@@ -22,106 +22,31 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
Input: () => Input,
|
|
24
24
|
Select: () => Select,
|
|
25
|
+
TextEditor: () => TextEditor,
|
|
25
26
|
Textarea: () => Textarea,
|
|
26
27
|
useFormStore: () => useFormStore,
|
|
27
|
-
useSelector: () => useSelector,
|
|
28
|
-
useStore: () => useStore,
|
|
29
28
|
useStoreComponent: () => useStoreComponent,
|
|
30
29
|
useStoreController: () => useStoreController,
|
|
31
30
|
useStoreInput: () => useStoreInput,
|
|
32
|
-
useStoreInputWithName: () => useStoreInputWithName
|
|
33
|
-
useSubscribe: () => useSubscribe
|
|
31
|
+
useStoreInputWithName: () => useStoreInputWithName
|
|
34
32
|
});
|
|
35
33
|
module.exports = __toCommonJS(index_exports);
|
|
36
34
|
|
|
37
|
-
// src/
|
|
35
|
+
// src/use_store_controller.tsx
|
|
38
36
|
var import_react = require("react");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (typeof recipe === "function") {
|
|
45
|
-
stateRef.current = (0, import_immer.produce)(stateRef.current, recipe);
|
|
46
|
-
} else {
|
|
47
|
-
stateRef.current = (0, import_immer.produce)(
|
|
48
|
-
stateRef.current,
|
|
49
|
-
(draft) => {
|
|
50
|
-
for (const key in recipe) {
|
|
51
|
-
draft[key] = recipe[key];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
notify(options.key);
|
|
57
|
-
};
|
|
58
|
-
const subscribe = (subscriber) => {
|
|
59
|
-
subscribers.current.push(subscriber);
|
|
60
|
-
return () => {
|
|
61
|
-
const index = subscribers.current.indexOf(subscriber);
|
|
62
|
-
if (index !== -1) {
|
|
63
|
-
subscribers.current.splice(index, 1);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
const notify = (key) => {
|
|
68
|
-
for (const listener of subscribers.current) {
|
|
69
|
-
listener(stateRef.current, key);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
return {
|
|
73
|
-
get state() {
|
|
74
|
-
return stateRef.current;
|
|
75
|
-
},
|
|
76
|
-
dispatch,
|
|
77
|
-
subscribe
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// src/use_selector.tsx
|
|
82
|
-
var import_react2 = require("react");
|
|
83
|
-
function useSelector(store, selector, compare = (a, b) => a === b) {
|
|
84
|
-
const [state, setState] = (0, import_react2.useState)(selector(store.state));
|
|
85
|
-
const stateRef = (0, import_react2.useRef)(state);
|
|
86
|
-
(0, import_react2.useEffect)(() => {
|
|
87
|
-
stateRef.current = state;
|
|
88
|
-
}, [state]);
|
|
89
|
-
(0, import_react2.useEffect)(() => {
|
|
90
|
-
const unsubscribe = store.subscribe((newState) => {
|
|
91
|
-
const result = selector(newState);
|
|
92
|
-
if (compare(stateRef.current, result)) {
|
|
37
|
+
function useStoreController(store, props) {
|
|
38
|
+
const dispatchKey = (0, import_react.useId)();
|
|
39
|
+
(0, import_react.useEffect)(() => {
|
|
40
|
+
const unsub = store.subscribe((state, key) => {
|
|
41
|
+
if (key === dispatchKey) {
|
|
93
42
|
return;
|
|
94
43
|
}
|
|
95
|
-
|
|
44
|
+
props.onSubscribe(state);
|
|
96
45
|
});
|
|
97
46
|
return () => {
|
|
98
|
-
|
|
99
|
-
};
|
|
100
|
-
}, []);
|
|
101
|
-
return state;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// src/use_subscribe.tsx
|
|
105
|
-
var import_react3 = require("react");
|
|
106
|
-
function useSubscribe(store, subscriber) {
|
|
107
|
-
(0, import_react3.useEffect)(() => {
|
|
108
|
-
const unsubscribe = store.subscribe(subscriber);
|
|
109
|
-
return () => {
|
|
110
|
-
unsubscribe();
|
|
47
|
+
unsub();
|
|
111
48
|
};
|
|
112
49
|
}, []);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// src/use_store_controller.tsx
|
|
116
|
-
var import_react4 = require("react");
|
|
117
|
-
function useStoreController(store, props) {
|
|
118
|
-
const dispatchKey = (0, import_react4.useId)();
|
|
119
|
-
useSubscribe(store, (state, key) => {
|
|
120
|
-
if (key === dispatchKey) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
props.onSubscribe(state);
|
|
124
|
-
});
|
|
125
50
|
const dispatch = () => {
|
|
126
51
|
store.dispatch(
|
|
127
52
|
(state) => {
|
|
@@ -254,22 +179,104 @@ function useStoreInputWithName(ref, store, props) {
|
|
|
254
179
|
}
|
|
255
180
|
|
|
256
181
|
// src/use_store_component.tsx
|
|
257
|
-
var
|
|
182
|
+
var import_react3 = require("react");
|
|
183
|
+
|
|
184
|
+
// src/text_editor.tsx
|
|
185
|
+
var import_gw_react_text_editor = require("gw-react-text-editor");
|
|
186
|
+
var import_react2 = require("react");
|
|
258
187
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
188
|
+
function TextEditor({
|
|
189
|
+
store,
|
|
190
|
+
name,
|
|
191
|
+
getter,
|
|
192
|
+
setter,
|
|
193
|
+
defaultValue,
|
|
194
|
+
ref,
|
|
195
|
+
...props
|
|
196
|
+
}) {
|
|
197
|
+
const controllerRef = (0, import_react2.useRef)(null);
|
|
198
|
+
(0, import_react2.useImperativeHandle)(
|
|
199
|
+
ref,
|
|
200
|
+
() => controllerRef.current,
|
|
201
|
+
[]
|
|
202
|
+
);
|
|
203
|
+
const { dispatch } = useStoreController(store, {
|
|
204
|
+
onSubscribe: (state) => {
|
|
205
|
+
const controller = controllerRef.current;
|
|
206
|
+
if (!controller) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const getResult = () => {
|
|
210
|
+
if (getter) {
|
|
211
|
+
return getter(state) || "";
|
|
212
|
+
}
|
|
213
|
+
if (name) {
|
|
214
|
+
return state[name] || "";
|
|
215
|
+
}
|
|
216
|
+
return "";
|
|
217
|
+
};
|
|
218
|
+
const result = getResult();
|
|
219
|
+
if (controller.value !== result) {
|
|
220
|
+
controller.value = result;
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
onDispatch: (state) => {
|
|
224
|
+
const controller = controllerRef.current;
|
|
225
|
+
if (!controller) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (setter) {
|
|
229
|
+
setter(state, controller.value);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (name) {
|
|
233
|
+
state[name] = controller.value;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
const getDefaultValue = () => {
|
|
238
|
+
if (getter) {
|
|
239
|
+
return getter(store.state);
|
|
240
|
+
}
|
|
241
|
+
if (name) {
|
|
242
|
+
return store.state[name];
|
|
243
|
+
}
|
|
244
|
+
return void 0;
|
|
245
|
+
};
|
|
246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
247
|
+
import_gw_react_text_editor.TextEditor,
|
|
248
|
+
{
|
|
249
|
+
...props,
|
|
250
|
+
ref: controllerRef,
|
|
251
|
+
defaultValue: defaultValue ?? getDefaultValue(),
|
|
252
|
+
onChange: (e) => {
|
|
253
|
+
dispatch();
|
|
254
|
+
props.onChange?.(e);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// src/use_store_component.tsx
|
|
261
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
259
262
|
function useStoreComponent(store) {
|
|
260
|
-
const input = (0,
|
|
261
|
-
return /* @__PURE__ */ (0,
|
|
263
|
+
const input = (0, import_react3.useCallback)(function Component(props) {
|
|
264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { store, ...props });
|
|
262
265
|
}, []);
|
|
263
|
-
const select = (0,
|
|
264
|
-
return /* @__PURE__ */ (0,
|
|
266
|
+
const select = (0, import_react3.useCallback)(function Component(props) {
|
|
267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Select, { store, ...props });
|
|
265
268
|
}, []);
|
|
266
|
-
const textarea = (0,
|
|
267
|
-
return /* @__PURE__ */ (0,
|
|
269
|
+
const textarea = (0, import_react3.useCallback)(function Component(props) {
|
|
270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Textarea, { store, ...props });
|
|
271
|
+
}, []);
|
|
272
|
+
const textEditor = (0, import_react3.useCallback)(function Component(props) {
|
|
273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TextEditor, { store, ...props });
|
|
268
274
|
}, []);
|
|
269
275
|
return {
|
|
270
276
|
input,
|
|
271
277
|
select,
|
|
272
|
-
textarea
|
|
278
|
+
textarea,
|
|
279
|
+
textEditor
|
|
273
280
|
};
|
|
274
281
|
}
|
|
275
282
|
function Input({
|
|
@@ -280,7 +287,7 @@ function Input({
|
|
|
280
287
|
toStateValue,
|
|
281
288
|
...props
|
|
282
289
|
}) {
|
|
283
|
-
const ref = (0,
|
|
290
|
+
const ref = (0, import_react3.useRef)(null);
|
|
284
291
|
const storeProps = useStoreInputWithName(ref, store, {
|
|
285
292
|
...props,
|
|
286
293
|
getter,
|
|
@@ -288,7 +295,7 @@ function Input({
|
|
|
288
295
|
toInputValue,
|
|
289
296
|
toStateValue
|
|
290
297
|
});
|
|
291
|
-
return /* @__PURE__ */ (0,
|
|
298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { ref, ...props, ...storeProps });
|
|
292
299
|
}
|
|
293
300
|
function Select({
|
|
294
301
|
store,
|
|
@@ -298,7 +305,7 @@ function Select({
|
|
|
298
305
|
toStateValue,
|
|
299
306
|
...props
|
|
300
307
|
}) {
|
|
301
|
-
const ref = (0,
|
|
308
|
+
const ref = (0, import_react3.useRef)(null);
|
|
302
309
|
const storeProps = useStoreInputWithName(ref, store, {
|
|
303
310
|
...props,
|
|
304
311
|
getter,
|
|
@@ -306,7 +313,7 @@ function Select({
|
|
|
306
313
|
toInputValue,
|
|
307
314
|
toStateValue
|
|
308
315
|
});
|
|
309
|
-
return /* @__PURE__ */ (0,
|
|
316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("select", { ref, ...props, ...storeProps });
|
|
310
317
|
}
|
|
311
318
|
function Textarea({
|
|
312
319
|
store,
|
|
@@ -316,7 +323,7 @@ function Textarea({
|
|
|
316
323
|
toStateValue,
|
|
317
324
|
...props
|
|
318
325
|
}) {
|
|
319
|
-
const ref = (0,
|
|
326
|
+
const ref = (0, import_react3.useRef)(null);
|
|
320
327
|
const storeProps = useStoreInputWithName(ref, store, {
|
|
321
328
|
...props,
|
|
322
329
|
getter,
|
|
@@ -324,25 +331,27 @@ function Textarea({
|
|
|
324
331
|
toInputValue,
|
|
325
332
|
toStateValue
|
|
326
333
|
});
|
|
327
|
-
return /* @__PURE__ */ (0,
|
|
334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("textarea", { ref, ...props, ...storeProps });
|
|
328
335
|
}
|
|
329
336
|
|
|
330
337
|
// src/create_render.tsx
|
|
331
|
-
var
|
|
338
|
+
var import_gw_store = require("gw-store");
|
|
339
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
332
340
|
function createRenderWithStore(store) {
|
|
333
341
|
return function createRender(selector, compare) {
|
|
334
342
|
function Component() {
|
|
335
|
-
const result = useSelector(store, (state) => state, compare);
|
|
343
|
+
const result = (0, import_gw_store.useSelector)(store, (state) => state, compare);
|
|
336
344
|
const content = selector(result);
|
|
337
|
-
return /* @__PURE__ */ (0,
|
|
345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: content });
|
|
338
346
|
}
|
|
339
|
-
return /* @__PURE__ */ (0,
|
|
347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component, {});
|
|
340
348
|
};
|
|
341
349
|
}
|
|
342
350
|
|
|
343
351
|
// src/use_form_store.tsx
|
|
352
|
+
var import_gw_store2 = require("gw-store");
|
|
344
353
|
function useFormStore(initialState) {
|
|
345
|
-
const store = useStore(initialState);
|
|
354
|
+
const store = (0, import_gw_store2.useStore)(initialState);
|
|
346
355
|
const storeComponent = useStoreComponent(store);
|
|
347
356
|
return {
|
|
348
357
|
get state() {
|
|
@@ -358,13 +367,11 @@ function useFormStore(initialState) {
|
|
|
358
367
|
0 && (module.exports = {
|
|
359
368
|
Input,
|
|
360
369
|
Select,
|
|
370
|
+
TextEditor,
|
|
361
371
|
Textarea,
|
|
362
372
|
useFormStore,
|
|
363
|
-
useSelector,
|
|
364
|
-
useStore,
|
|
365
373
|
useStoreComponent,
|
|
366
374
|
useStoreController,
|
|
367
375
|
useStoreInput,
|
|
368
|
-
useStoreInputWithName
|
|
369
|
-
useSubscribe
|
|
376
|
+
useStoreInputWithName
|
|
370
377
|
});
|