@ehfuse/forma 1.4.3 → 1.4.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/contexts/{GlobalFormContext.d.ts → GlobalFormaContext.d.ts} +12 -12
- package/dist/contexts/GlobalFormaContext.d.ts.map +1 -0
- package/dist/contexts/{GlobalFormContext.js → GlobalFormaContext.js} +42 -16
- package/dist/contexts/GlobalFormaContext.js.map +1 -0
- package/dist/esm/contexts/{GlobalFormContext.d.ts → GlobalFormaContext.d.ts} +12 -12
- package/dist/esm/contexts/GlobalFormaContext.d.ts.map +1 -0
- package/dist/esm/contexts/{GlobalFormContext.js → GlobalFormaContext.js} +40 -14
- package/dist/esm/contexts/GlobalFormaContext.js.map +1 -0
- package/dist/esm/hooks/useForm.js +3 -1
- package/dist/esm/hooks/useForm.js.map +1 -1
- package/dist/esm/hooks/useGlobalForm.js +2 -2
- package/dist/esm/hooks/useGlobalForm.js.map +1 -1
- package/dist/esm/hooks/useGlobalFormaState.js +2 -2
- package/dist/esm/hooks/useGlobalFormaState.js.map +1 -1
- package/dist/esm/hooks/useRegisterGlobalForm.js +2 -2
- package/dist/esm/hooks/useRegisterGlobalForm.js.map +1 -1
- package/dist/esm/hooks/useRegisterGlobalFormaState.d.ts +55 -0
- package/dist/esm/hooks/useRegisterGlobalFormaState.d.ts.map +1 -0
- package/dist/esm/hooks/useRegisterGlobalFormaState.js +64 -0
- package/dist/esm/hooks/useRegisterGlobalFormaState.js.map +1 -0
- package/dist/esm/hooks/useUnregisterGlobalForm.d.ts +68 -0
- package/dist/esm/hooks/useUnregisterGlobalForm.d.ts.map +1 -0
- package/dist/esm/hooks/useUnregisterGlobalForm.js +88 -0
- package/dist/esm/hooks/useUnregisterGlobalForm.js.map +1 -0
- package/dist/esm/hooks/useUnregisterGlobalFormaState.d.ts +69 -0
- package/dist/esm/hooks/useUnregisterGlobalFormaState.d.ts.map +1 -0
- package/dist/esm/hooks/useUnregisterGlobalFormaState.js +89 -0
- package/dist/esm/hooks/useUnregisterGlobalFormaState.js.map +1 -0
- package/dist/esm/index.d.ts +5 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/globalForm.d.ts +56 -7
- package/dist/esm/types/globalForm.d.ts.map +1 -1
- package/dist/esm/types/globalForm.js.map +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/hooks/useForm.js +3 -1
- package/dist/hooks/useForm.js.map +1 -1
- package/dist/hooks/useGlobalForm.js +2 -2
- package/dist/hooks/useGlobalForm.js.map +1 -1
- package/dist/hooks/useGlobalFormaState.js +2 -2
- package/dist/hooks/useGlobalFormaState.js.map +1 -1
- package/dist/hooks/useRegisterGlobalForm.js +2 -2
- package/dist/hooks/useRegisterGlobalForm.js.map +1 -1
- package/dist/hooks/useRegisterGlobalFormaState.d.ts +55 -0
- package/dist/hooks/useRegisterGlobalFormaState.d.ts.map +1 -0
- package/dist/hooks/useRegisterGlobalFormaState.js +67 -0
- package/dist/hooks/useRegisterGlobalFormaState.js.map +1 -0
- package/dist/hooks/useUnregisterGlobalForm.d.ts +68 -0
- package/dist/hooks/useUnregisterGlobalForm.d.ts.map +1 -0
- package/dist/hooks/useUnregisterGlobalForm.js +91 -0
- package/dist/hooks/useUnregisterGlobalForm.js.map +1 -0
- package/dist/hooks/useUnregisterGlobalFormaState.d.ts +69 -0
- package/dist/hooks/useUnregisterGlobalFormaState.d.ts.map +1 -0
- package/dist/hooks/useUnregisterGlobalFormaState.js +92 -0
- package/dist/hooks/useUnregisterGlobalFormaState.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/types/globalForm.d.ts +56 -7
- package/dist/types/globalForm.d.ts.map +1 -1
- package/dist/types/globalForm.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/contexts/GlobalFormContext.d.ts.map +0 -1
- package/dist/contexts/GlobalFormContext.js.map +0 -1
- package/dist/esm/contexts/GlobalFormContext.d.ts.map +0 -1
- package/dist/esm/contexts/GlobalFormContext.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* GlobalFormaContext.tsx
|
|
3
3
|
*
|
|
4
|
-
* Forma - 글로벌
|
|
4
|
+
* Forma - 글로벌 Forma 상태 관리 컨텍스트 | Global Forma state management context
|
|
5
5
|
* 여러 컴포넌트 간 폼 상태 공유를 위한 React Context | React Context for sharing form state across multiple components
|
|
6
6
|
*
|
|
7
7
|
* @license MIT License
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
* SOFTWARE.
|
|
28
28
|
*/
|
|
29
29
|
import { ReactNode } from "react";
|
|
30
|
-
import {
|
|
30
|
+
import { GlobalFormaContextType } from "../types/globalForm";
|
|
31
31
|
/**
|
|
32
32
|
* 글로벌 폼 상태 관리를 위한 React Context | React Context for global form state management
|
|
33
33
|
*/
|
|
34
|
-
export declare const
|
|
34
|
+
export declare const GlobalFormaContext: import("react").Context<GlobalFormaContextType>;
|
|
35
35
|
/**
|
|
36
|
-
* 글로벌
|
|
36
|
+
* 글로벌 Forma 상태 관리 Provider | Global Forma state management provider
|
|
37
37
|
*
|
|
38
|
-
* 애플리케이션 최상단에 배치하여 전역
|
|
39
|
-
* 각 formId별로 독립적인 FieldStore 인스턴스를 관리합니다. | Manages independent FieldStore instances for each formId.
|
|
38
|
+
* 애플리케이션 최상단에 배치하여 전역 Forma 상태 관리를 활성화합니다. | Place at the top of your application to enable global Forma state management.
|
|
39
|
+
* 각 stateId/formId별로 독립적인 FieldStore 인스턴스를 관리합니다. | Manages independent FieldStore instances for each stateId/formId.
|
|
40
40
|
*
|
|
41
41
|
* @param props Provider props
|
|
42
42
|
* @returns 글로벌 폼 컨텍스트 Provider
|
|
@@ -44,23 +44,23 @@ export declare const GlobalFormContext: import("react").Context<GlobalFormContex
|
|
|
44
44
|
* @example
|
|
45
45
|
* ```typescript
|
|
46
46
|
* // App.tsx
|
|
47
|
-
* import {
|
|
47
|
+
* import { GlobalFormaProvider } from '@/forma';
|
|
48
48
|
*
|
|
49
49
|
* function App() {
|
|
50
50
|
* return (
|
|
51
|
-
* <
|
|
51
|
+
* <GlobalFormaProvider>
|
|
52
52
|
* <Router>
|
|
53
53
|
* <Routes>
|
|
54
54
|
* <Route path="/" element={<HomePage />} />
|
|
55
55
|
* <Route path="/customer" element={<CustomerPage />} />
|
|
56
56
|
* </Routes>
|
|
57
57
|
* </Router>
|
|
58
|
-
* </
|
|
58
|
+
* </GlobalFormaProvider>
|
|
59
59
|
* );
|
|
60
60
|
* }
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
export declare function
|
|
63
|
+
export declare function GlobalFormaProvider({ children }: {
|
|
64
64
|
children: ReactNode;
|
|
65
65
|
}): import("react/jsx-runtime").JSX.Element;
|
|
66
|
-
//# sourceMappingURL=
|
|
66
|
+
//# sourceMappingURL=GlobalFormaContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlobalFormaContext.d.ts","sourceRoot":"","sources":["../../contexts/GlobalFormaContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAyB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,kBAAkB,iDAqB7B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAuExE"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.GlobalFormaContext = void 0;
|
|
4
|
+
exports.GlobalFormaProvider = GlobalFormaProvider;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* GlobalFormaContext.tsx
|
|
8
8
|
*
|
|
9
|
-
* Forma - 글로벌
|
|
9
|
+
* Forma - 글로벌 Forma 상태 관리 컨텍스트 | Global Forma state management context
|
|
10
10
|
* 여러 컴포넌트 간 폼 상태 공유를 위한 React Context | React Context for sharing form state across multiple components
|
|
11
11
|
*
|
|
12
12
|
* @license MIT License
|
|
@@ -36,19 +36,25 @@ const FieldStore_1 = require("../core/FieldStore");
|
|
|
36
36
|
/**
|
|
37
37
|
* 글로벌 폼 상태 관리를 위한 React Context | React Context for global form state management
|
|
38
38
|
*/
|
|
39
|
-
exports.
|
|
39
|
+
exports.GlobalFormaContext = (0, react_1.createContext)({
|
|
40
40
|
getOrCreateStore: () => {
|
|
41
|
-
throw new Error("
|
|
41
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
42
42
|
},
|
|
43
43
|
registerStore: () => {
|
|
44
|
-
throw new Error("
|
|
44
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
45
|
+
},
|
|
46
|
+
unregisterStore: () => {
|
|
47
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
48
|
+
},
|
|
49
|
+
clearStores: () => {
|
|
50
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
45
51
|
},
|
|
46
52
|
});
|
|
47
53
|
/**
|
|
48
|
-
* 글로벌
|
|
54
|
+
* 글로벌 Forma 상태 관리 Provider | Global Forma state management provider
|
|
49
55
|
*
|
|
50
|
-
* 애플리케이션 최상단에 배치하여 전역
|
|
51
|
-
* 각 formId별로 독립적인 FieldStore 인스턴스를 관리합니다. | Manages independent FieldStore instances for each formId.
|
|
56
|
+
* 애플리케이션 최상단에 배치하여 전역 Forma 상태 관리를 활성화합니다. | Place at the top of your application to enable global Forma state management.
|
|
57
|
+
* 각 stateId/formId별로 독립적인 FieldStore 인스턴스를 관리합니다. | Manages independent FieldStore instances for each stateId/formId.
|
|
52
58
|
*
|
|
53
59
|
* @param props Provider props
|
|
54
60
|
* @returns 글로벌 폼 컨텍스트 Provider
|
|
@@ -56,23 +62,23 @@ exports.GlobalFormContext = (0, react_1.createContext)({
|
|
|
56
62
|
* @example
|
|
57
63
|
* ```typescript
|
|
58
64
|
* // App.tsx
|
|
59
|
-
* import {
|
|
65
|
+
* import { GlobalFormaProvider } from '@/forma';
|
|
60
66
|
*
|
|
61
67
|
* function App() {
|
|
62
68
|
* return (
|
|
63
|
-
* <
|
|
69
|
+
* <GlobalFormaProvider>
|
|
64
70
|
* <Router>
|
|
65
71
|
* <Routes>
|
|
66
72
|
* <Route path="/" element={<HomePage />} />
|
|
67
73
|
* <Route path="/customer" element={<CustomerPage />} />
|
|
68
74
|
* </Routes>
|
|
69
75
|
* </Router>
|
|
70
|
-
* </
|
|
76
|
+
* </GlobalFormaProvider>
|
|
71
77
|
* );
|
|
72
78
|
* }
|
|
73
79
|
* ```
|
|
74
80
|
*/
|
|
75
|
-
function
|
|
81
|
+
function GlobalFormaProvider({ children }) {
|
|
76
82
|
// formId별 FieldStore 인스턴스들을 관리하는 Map | Map managing FieldStore instances by formId
|
|
77
83
|
const storesRef = (0, react_1.useRef)(new Map());
|
|
78
84
|
/**
|
|
@@ -101,10 +107,30 @@ function GlobalFormProvider({ children }) {
|
|
|
101
107
|
const stores = storesRef.current;
|
|
102
108
|
stores.set(formId, store);
|
|
103
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* 글로벌 스토어에서 특정 formId의 FieldStore를 제거합니다. | Remove specific FieldStore from global store.
|
|
112
|
+
*
|
|
113
|
+
* @param formId 제거할 폼 식별자 | Form identifier to remove
|
|
114
|
+
* @returns 제거 성공 여부 | Whether removal was successful
|
|
115
|
+
*/
|
|
116
|
+
const unregisterStore = (formId) => {
|
|
117
|
+
const stores = storesRef.current;
|
|
118
|
+
return stores.delete(formId);
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* 모든 글로벌 스토어를 제거합니다. | Clear all global stores.
|
|
122
|
+
* 메모리 정리나 애플리케이션 리셋 시 사용합니다. | Use for memory cleanup or application reset.
|
|
123
|
+
*/
|
|
124
|
+
const clearStores = () => {
|
|
125
|
+
const stores = storesRef.current;
|
|
126
|
+
stores.clear();
|
|
127
|
+
};
|
|
104
128
|
const contextValue = {
|
|
105
129
|
getOrCreateStore,
|
|
106
130
|
registerStore,
|
|
131
|
+
unregisterStore,
|
|
132
|
+
clearStores,
|
|
107
133
|
};
|
|
108
|
-
return ((0, jsx_runtime_1.jsx)(exports.
|
|
134
|
+
return ((0, jsx_runtime_1.jsx)(exports.GlobalFormaContext.Provider, { value: contextValue, children: children }));
|
|
109
135
|
}
|
|
110
|
-
//# sourceMappingURL=
|
|
136
|
+
//# sourceMappingURL=GlobalFormaContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlobalFormaContext.js","sourceRoot":"","sources":["../../contexts/GlobalFormaContext.tsx"],"names":[],"mappings":";;;AAuFA,kDAuEC;;AA9JD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,iCAAyD;AACzD,mDAAgD;AAGhD;;GAEG;AACU,QAAA,kBAAkB,GAAG,IAAA,qBAAa,EAAyB;IACpE,gBAAgB,EAAE,GAAG,EAAE;QACnB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,C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AG,GAAS,EAAE;QAC3B,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;QACjC,MAAM,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,YAAY,GAA2B;QACzC,gBAAgB;QAChB,aAAa;QACb,eAAe;QACf,WAAW;KACd,CAAC;IAEF,OAAO,CACH,uBAAC,0BAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC3C,QAAQ,GACiB,CACjC,CAAC;AACN,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* GlobalFormaContext.tsx
|
|
3
3
|
*
|
|
4
|
-
* Forma - 글로벌
|
|
4
|
+
* Forma - 글로벌 Forma 상태 관리 컨텍스트 | Global Forma state management context
|
|
5
5
|
* 여러 컴포넌트 간 폼 상태 공유를 위한 React Context | React Context for sharing form state across multiple components
|
|
6
6
|
*
|
|
7
7
|
* @license MIT License
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
* SOFTWARE.
|
|
28
28
|
*/
|
|
29
29
|
import { ReactNode } from "react";
|
|
30
|
-
import {
|
|
30
|
+
import { GlobalFormaContextType } from "../types/globalForm";
|
|
31
31
|
/**
|
|
32
32
|
* 글로벌 폼 상태 관리를 위한 React Context | React Context for global form state management
|
|
33
33
|
*/
|
|
34
|
-
export declare const
|
|
34
|
+
export declare const GlobalFormaContext: import("react").Context<GlobalFormaContextType>;
|
|
35
35
|
/**
|
|
36
|
-
* 글로벌
|
|
36
|
+
* 글로벌 Forma 상태 관리 Provider | Global Forma state management provider
|
|
37
37
|
*
|
|
38
|
-
* 애플리케이션 최상단에 배치하여 전역
|
|
39
|
-
* 각 formId별로 독립적인 FieldStore 인스턴스를 관리합니다. | Manages independent FieldStore instances for each formId.
|
|
38
|
+
* 애플리케이션 최상단에 배치하여 전역 Forma 상태 관리를 활성화합니다. | Place at the top of your application to enable global Forma state management.
|
|
39
|
+
* 각 stateId/formId별로 독립적인 FieldStore 인스턴스를 관리합니다. | Manages independent FieldStore instances for each stateId/formId.
|
|
40
40
|
*
|
|
41
41
|
* @param props Provider props
|
|
42
42
|
* @returns 글로벌 폼 컨텍스트 Provider
|
|
@@ -44,23 +44,23 @@ export declare const GlobalFormContext: import("react").Context<GlobalFormContex
|
|
|
44
44
|
* @example
|
|
45
45
|
* ```typescript
|
|
46
46
|
* // App.tsx
|
|
47
|
-
* import {
|
|
47
|
+
* import { GlobalFormaProvider } from '@/forma';
|
|
48
48
|
*
|
|
49
49
|
* function App() {
|
|
50
50
|
* return (
|
|
51
|
-
* <
|
|
51
|
+
* <GlobalFormaProvider>
|
|
52
52
|
* <Router>
|
|
53
53
|
* <Routes>
|
|
54
54
|
* <Route path="/" element={<HomePage />} />
|
|
55
55
|
* <Route path="/customer" element={<CustomerPage />} />
|
|
56
56
|
* </Routes>
|
|
57
57
|
* </Router>
|
|
58
|
-
* </
|
|
58
|
+
* </GlobalFormaProvider>
|
|
59
59
|
* );
|
|
60
60
|
* }
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
export declare function
|
|
63
|
+
export declare function GlobalFormaProvider({ children }: {
|
|
64
64
|
children: ReactNode;
|
|
65
65
|
}): import("react/jsx-runtime").JSX.Element;
|
|
66
|
-
//# sourceMappingURL=
|
|
66
|
+
//# sourceMappingURL=GlobalFormaContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlobalFormaContext.d.ts","sourceRoot":"","sources":["../../../contexts/GlobalFormaContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAyB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,kBAAkB,iDAqB7B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAuExE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* GlobalFormaContext.tsx
|
|
4
4
|
*
|
|
5
|
-
* Forma - 글로벌
|
|
5
|
+
* Forma - 글로벌 Forma 상태 관리 컨텍스트 | Global Forma state management context
|
|
6
6
|
* 여러 컴포넌트 간 폼 상태 공유를 위한 React Context | React Context for sharing form state across multiple components
|
|
7
7
|
*
|
|
8
8
|
* @license MIT License
|
|
@@ -32,19 +32,25 @@ import { FieldStore } from "../core/FieldStore";
|
|
|
32
32
|
/**
|
|
33
33
|
* 글로벌 폼 상태 관리를 위한 React Context | React Context for global form state management
|
|
34
34
|
*/
|
|
35
|
-
export const
|
|
35
|
+
export const GlobalFormaContext = createContext({
|
|
36
36
|
getOrCreateStore: () => {
|
|
37
|
-
throw new Error("
|
|
37
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
38
38
|
},
|
|
39
39
|
registerStore: () => {
|
|
40
|
-
throw new Error("
|
|
40
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
41
|
+
},
|
|
42
|
+
unregisterStore: () => {
|
|
43
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
44
|
+
},
|
|
45
|
+
clearStores: () => {
|
|
46
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
41
47
|
},
|
|
42
48
|
});
|
|
43
49
|
/**
|
|
44
|
-
* 글로벌
|
|
50
|
+
* 글로벌 Forma 상태 관리 Provider | Global Forma state management provider
|
|
45
51
|
*
|
|
46
|
-
* 애플리케이션 최상단에 배치하여 전역
|
|
47
|
-
* 각 formId별로 독립적인 FieldStore 인스턴스를 관리합니다. | Manages independent FieldStore instances for each formId.
|
|
52
|
+
* 애플리케이션 최상단에 배치하여 전역 Forma 상태 관리를 활성화합니다. | Place at the top of your application to enable global Forma state management.
|
|
53
|
+
* 각 stateId/formId별로 독립적인 FieldStore 인스턴스를 관리합니다. | Manages independent FieldStore instances for each stateId/formId.
|
|
48
54
|
*
|
|
49
55
|
* @param props Provider props
|
|
50
56
|
* @returns 글로벌 폼 컨텍스트 Provider
|
|
@@ -52,23 +58,23 @@ export const GlobalFormContext = createContext({
|
|
|
52
58
|
* @example
|
|
53
59
|
* ```typescript
|
|
54
60
|
* // App.tsx
|
|
55
|
-
* import {
|
|
61
|
+
* import { GlobalFormaProvider } from '@/forma';
|
|
56
62
|
*
|
|
57
63
|
* function App() {
|
|
58
64
|
* return (
|
|
59
|
-
* <
|
|
65
|
+
* <GlobalFormaProvider>
|
|
60
66
|
* <Router>
|
|
61
67
|
* <Routes>
|
|
62
68
|
* <Route path="/" element={<HomePage />} />
|
|
63
69
|
* <Route path="/customer" element={<CustomerPage />} />
|
|
64
70
|
* </Routes>
|
|
65
71
|
* </Router>
|
|
66
|
-
* </
|
|
72
|
+
* </GlobalFormaProvider>
|
|
67
73
|
* );
|
|
68
74
|
* }
|
|
69
75
|
* ```
|
|
70
76
|
*/
|
|
71
|
-
export function
|
|
77
|
+
export function GlobalFormaProvider({ children }) {
|
|
72
78
|
// formId별 FieldStore 인스턴스들을 관리하는 Map | Map managing FieldStore instances by formId
|
|
73
79
|
const storesRef = useRef(new Map());
|
|
74
80
|
/**
|
|
@@ -97,10 +103,30 @@ export function GlobalFormProvider({ children }) {
|
|
|
97
103
|
const stores = storesRef.current;
|
|
98
104
|
stores.set(formId, store);
|
|
99
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* 글로벌 스토어에서 특정 formId의 FieldStore를 제거합니다. | Remove specific FieldStore from global store.
|
|
108
|
+
*
|
|
109
|
+
* @param formId 제거할 폼 식별자 | Form identifier to remove
|
|
110
|
+
* @returns 제거 성공 여부 | Whether removal was successful
|
|
111
|
+
*/
|
|
112
|
+
const unregisterStore = (formId) => {
|
|
113
|
+
const stores = storesRef.current;
|
|
114
|
+
return stores.delete(formId);
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* 모든 글로벌 스토어를 제거합니다. | Clear all global stores.
|
|
118
|
+
* 메모리 정리나 애플리케이션 리셋 시 사용합니다. | Use for memory cleanup or application reset.
|
|
119
|
+
*/
|
|
120
|
+
const clearStores = () => {
|
|
121
|
+
const stores = storesRef.current;
|
|
122
|
+
stores.clear();
|
|
123
|
+
};
|
|
100
124
|
const contextValue = {
|
|
101
125
|
getOrCreateStore,
|
|
102
126
|
registerStore,
|
|
127
|
+
unregisterStore,
|
|
128
|
+
clearStores,
|
|
103
129
|
};
|
|
104
|
-
return (_jsx(
|
|
130
|
+
return (_jsx(GlobalFormaContext.Provider, { value: contextValue, children: children }));
|
|
105
131
|
}
|
|
106
|
-
//# sourceMappingURL=
|
|
132
|
+
//# sourceMappingURL=GlobalFormaContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlobalFormaContext.js","sourceRoot":"","sources":["../../../contexts/GlobalFormaContext.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAa,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAyB;IACpE,gBAAgB,EAAE,GAAG,EAAE;QACnB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,eAAe,EAAE,GAAG,EAAE;QAClB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,W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nB,CAAC,CAAC;IAEF,MAAM,YAAY,GAA2B;QACzC,gBAAgB;QAChB,aAAa;QACb,eAAe;QACf,WAAW;KACd,CAAC;IAEF,OAAO,CACH,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC3C,QAAQ,GACiB,CACjC,CAAC;AACN,CAAC"}
|
|
@@ -39,7 +39,9 @@ export function useForm(props = {}) {
|
|
|
39
39
|
stableInitialValues.current = initialValues;
|
|
40
40
|
}
|
|
41
41
|
// useFormaState를 기반으로 사용 / Use useFormaState as foundation
|
|
42
|
-
const fieldState = useFormaState(stableInitialValues.current, {
|
|
42
|
+
const fieldState = useFormaState(stableInitialValues.current, {
|
|
43
|
+
_externalStore,
|
|
44
|
+
});
|
|
43
45
|
// 폼 특정 상태 관리 / Form-specific state management
|
|
44
46
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
45
47
|
const [isValidating, setIsValidating] = useState(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.js","sourceRoot":"","sources":["../../../hooks/useForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AASH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAc,EACV,SAAS,EACT,QAAQ,EACR,WAAW,EACX,MAAM,EACN,OAAO,GACV,MAAM,OAAO,CAAC;AAoCf,MAAM,UAAU,OAAO,CACnB,QAEgC,EAA6B;IAE7D,MAAM,EACF,aAAa,GAAG,EAAO,EACvB,QAAQ,EACR,UAAU,EACV,UAAU,EACV,cAAc,GACjB,GAAG,KAAK,CAAC;IAEV,+BAA+B;IAC/B,oEAAoE;IACpE,MAAM,mBAAmB,GAAG,MAAM,CAAW,IAAI,CAAC,CAAC;IACnD,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;QAC/B,mBAAmB,CAAC,O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IACL,CAAC,EACD,CAAC,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,SAAS,CAAC,CAC7D,CAAC;IAEF,OAAO,OAAO,CACV,GAAG,EAAE,CAAC,CAAC;QACH,aAAa;QACb,YAAY;QACZ,YAAY;QACZ,UAAU;QAEV,sBAAsB;QACtB,YAAY,EAAE,oEAAoE;QAClF,YAAY,EAAE,uEAAuE;QACrF,aAAa,EAAE,oCAAoC;QAEnD,oBAAoB;QACpB,YAAY,EAAE,kCAAkC;QAChD,aAAa,EAAE,2BAA2B;QAC1C,oBAAoB,EAAE,iCAAiC;QAEvD,2BAA2B;QAC3B,gBAAgB,EAAE,2EAA2E;QAC7F,sBAAsB,EAAE,wDAAwD;QAEhF,sBAAsB;QACtB,MAAM,EAAE,qBAAqB;QAC7B,SAAS,EAAE,qBAAqB;QAChC,YAAY,EAAE,uBAAuB;QAErC,sBAAsB;QACtB,MAAM,EAAE,UAAU,CAAC,SAAS,EAAE,EAAE,8EAA8E;QAE9G,yBAAyB;QACzB,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,qCAAqC;KACnE,CAAC,EACF;QACI,YAAY;QACZ,YAAY;QACZ,UAAU;QACV,YAAY;QACZ,YAAY;QACZ,aAAa;QACb,YAAY;QACZ,aAAa;QACb,oBAAoB;QACpB,gBAAgB;QAChB,sBAAsB;QACtB,MAAM;QACN,SAAS;QACT,YAAY;QACZ,UAAU,CAAC,MAAM,EAAE,iBAAiB;KACvC,CACJ,CAAC;AACN,CAAC"}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
*/
|
|
30
30
|
import { useContext } from "react";
|
|
31
31
|
import { useForm } from "./useForm";
|
|
32
|
-
import {
|
|
32
|
+
import { GlobalFormaContext } from "../contexts/GlobalFormaContext";
|
|
33
33
|
/**
|
|
34
34
|
* 글로벌 폼 상태 관리 훅 / Global form state management hook
|
|
35
35
|
*
|
|
@@ -44,7 +44,7 @@ import { GlobalFormContext } from "../contexts/GlobalFormContext";
|
|
|
44
44
|
* @returns 글로벌 폼 관리 API 객체 / Global form management API object
|
|
45
45
|
*/
|
|
46
46
|
export function useGlobalForm({ formId, }) {
|
|
47
|
-
const { getOrCreateStore } = useContext(
|
|
47
|
+
const { getOrCreateStore } = useContext(GlobalFormaContext);
|
|
48
48
|
// 글로벌 스토어 가져오기 또는 생성 / Get or create global store
|
|
49
49
|
const store = getOrCreateStore(formId);
|
|
50
50
|
// useForm에 외부 스토어 전달 (빈 초기값으로) / Pass external store to useForm (with empty initial values)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGlobalForm.js","sourceRoot":"","sources":["../../../hooks/useGlobalForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useGlobalForm.js","sourceRoot":"","sources":["../../../hooks/useGlobalForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAgC,EACzD,MAAM,GACc;IACpB,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAE5D,kDAAkD;IAClD,MAAM,KAAK,GAAG,gBAAgB,CAAI,MAAM,CAAC,CAAC;IAE1C,4FAA4F;IAC5F,MAAM,IAAI,GAAG,OAAO,CAAI;QACpB,aAAa,EAAE,EAAO;QACtB,cAAc,EAAE,KAAK;KACxB,CAAC,CAAC;IAEH,OAAO;QACH,GAAG,IAAI;QACP,MAAM,EAAE,qDAAqD;QAC7D,MAAM,EAAE,KAAK,EAAE,iDAAiD;KACzC,CAAC;AAChC,CAAC"}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
*/
|
|
30
30
|
import { useContext } from "react";
|
|
31
31
|
import { useFormaState } from "./useFormaState";
|
|
32
|
-
import {
|
|
32
|
+
import { GlobalFormaContext } from "../contexts/GlobalFormaContext";
|
|
33
33
|
/**
|
|
34
34
|
* 글로벌 FormaState 관리 훅 / Global FormaState management hook
|
|
35
35
|
*
|
|
@@ -104,7 +104,7 @@ import { GlobalFormContext } from "../contexts/GlobalFormContext";
|
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
106
106
|
export function useGlobalFormaState({ stateId, autoCleanup = true, }) {
|
|
107
|
-
const { getOrCreateStore } = useContext(
|
|
107
|
+
const { getOrCreateStore } = useContext(GlobalFormaContext);
|
|
108
108
|
// 글로벌 스토어 가져오기 또는 생성 / Get or create global store
|
|
109
109
|
const store = getOrCreateStore(stateId);
|
|
110
110
|
// useFormaState에 외부 스토어 전달 (빈 초기값으로) / Pass external store to useFormaState (with empty initial values)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGlobalFormaState.js","sourceRoot":"","sources":["../../../hooks/useGlobalFormaState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useGlobalFormaState.js","sourceRoot":"","sources":["../../../hooks/useGlobalFormaState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,MAAM,UAAU,mBAAmB,CAAgC,EAC/D,OAAO,EACP,WAAW,GAAG,IAAI,GACQ;IAC1B,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAE5D,kDAAkD;IAClD,MAAM,KAAK,GAAG,gBAAgB,CAAI,OAAO,CAAC,CAAC;IAE3C,wGAAwG;IACxG,MAAM,UAAU,GAAG,aAAa,CAAI,EAAO,EAAE;QACzC,cAAc,EAAE,KAAK;KACxB,CAAC,CAAC;IAEH,OAAO;QACH,GAAG,UAAU;QACb,OAAO,EAAE,oEAAoE;QAC7E,MAAM,EAAE,KAAK,EAAE,gFAAgF;KAClE,CAAC;AACtC,CAAC"}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* SOFTWARE.
|
|
29
29
|
*/
|
|
30
30
|
import { useContext, useEffect } from "react";
|
|
31
|
-
import {
|
|
31
|
+
import { GlobalFormaContext } from "../contexts/GlobalFormaContext";
|
|
32
32
|
/**
|
|
33
33
|
* 기존 useForm을 글로벌 폼으로 등록하는 훅 | Hook to register existing useForm as global form
|
|
34
34
|
*
|
|
@@ -53,7 +53,7 @@ import { GlobalFormContext } from "../contexts/GlobalFormContext";
|
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
55
|
export function useRegisterGlobalForm(formId, form) {
|
|
56
|
-
const { registerStore } = useContext(
|
|
56
|
+
const { registerStore } = useContext(GlobalFormaContext);
|
|
57
57
|
useEffect(() => {
|
|
58
58
|
// useForm의 내부 store를 글로벌에 등록 | Register useForm's internal store globally
|
|
59
59
|
if (form._store) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRegisterGlobalForm.js","sourceRoot":"","sources":["../../../hooks/useRegisterGlobalForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useRegisterGlobalForm.js","sourceRoot":"","sources":["../../../hooks/useRegisterGlobalForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,qBAAqB,CACjC,MAAc,EACd,IAAsB;IAEtB,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAEzD,SAAS,CAAC,GAAG,EAAE;QACX,0EAA0E;QAC1E,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC;IACL,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useRegisterGlobalFormaState.ts
|
|
3
|
+
*
|
|
4
|
+
* Forma - 기존 useFormaState를 글로벌 상태로 등록하는 훅 | Hook to register existing useFormaState as global state
|
|
5
|
+
* 기존에 만든 로컬 FormaState를 글로벌 상태로 공유할 수 있게 해주는 유틸리티
|
|
6
|
+
* Utility to enable sharing existing local FormaState as global state
|
|
7
|
+
*
|
|
8
|
+
* @license MIT License
|
|
9
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
10
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
import { UseFormaStateReturn } from "./useFormaState";
|
|
31
|
+
/**
|
|
32
|
+
* 기존 useFormaState를 글로벌 상태로 등록하는 훅 | Hook to register existing useFormaState as global state
|
|
33
|
+
*
|
|
34
|
+
* 이미 만들어진 로컬 FormaState를 글로벌 상태로 공유하고 싶을 때 사용합니다.
|
|
35
|
+
* Use this when you want to share an already created local FormaState as global state.
|
|
36
|
+
*
|
|
37
|
+
* @template T FormaState 데이터의 타입 | FormaState data type
|
|
38
|
+
* @param stateId 글로벌 상태 식별자 | Global state identifier
|
|
39
|
+
* @param formaState 등록할 useFormaState 인스턴스 | useFormaState instance to register
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* function MyComponent() {
|
|
44
|
+
* const formaState = useFormaState({ name: '', email: '', settings: { theme: 'light' } });
|
|
45
|
+
*
|
|
46
|
+
* // 로컬 FormaState를 글로벌로 등록
|
|
47
|
+
* useRegisterGlobalFormaState('my-state-id', formaState);
|
|
48
|
+
*
|
|
49
|
+
* // 이제 다른 컴포넌트에서 useGlobalFormaState({ stateId: 'my-state-id' })로 접근 가능
|
|
50
|
+
* return <div>...</div>;
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function useRegisterGlobalFormaState<T extends Record<string, any>>(stateId: string, formaState: UseFormaStateReturn<T>): void;
|
|
55
|
+
//# sourceMappingURL=useRegisterGlobalFormaState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRegisterGlobalFormaState.d.ts","sourceRoot":"","sources":["../../../hooks/useRegisterGlobalFormaState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrE,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC,GACnC,IAAI,CASN"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useRegisterGlobalFormaState.ts
|
|
3
|
+
*
|
|
4
|
+
* Forma - 기존 useFormaState를 글로벌 상태로 등록하는 훅 | Hook to register existing useFormaState as global state
|
|
5
|
+
* 기존에 만든 로컬 FormaState를 글로벌 상태로 공유할 수 있게 해주는 유틸리티
|
|
6
|
+
* Utility to enable sharing existing local FormaState as global state
|
|
7
|
+
*
|
|
8
|
+
* @license MIT License
|
|
9
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
10
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
import { useContext, useEffect } from "react";
|
|
31
|
+
import { GlobalFormaContext } from "../contexts/GlobalFormaContext";
|
|
32
|
+
/**
|
|
33
|
+
* 기존 useFormaState를 글로벌 상태로 등록하는 훅 | Hook to register existing useFormaState as global state
|
|
34
|
+
*
|
|
35
|
+
* 이미 만들어진 로컬 FormaState를 글로벌 상태로 공유하고 싶을 때 사용합니다.
|
|
36
|
+
* Use this when you want to share an already created local FormaState as global state.
|
|
37
|
+
*
|
|
38
|
+
* @template T FormaState 데이터의 타입 | FormaState data type
|
|
39
|
+
* @param stateId 글로벌 상태 식별자 | Global state identifier
|
|
40
|
+
* @param formaState 등록할 useFormaState 인스턴스 | useFormaState instance to register
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* function MyComponent() {
|
|
45
|
+
* const formaState = useFormaState({ name: '', email: '', settings: { theme: 'light' } });
|
|
46
|
+
*
|
|
47
|
+
* // 로컬 FormaState를 글로벌로 등록
|
|
48
|
+
* useRegisterGlobalFormaState('my-state-id', formaState);
|
|
49
|
+
*
|
|
50
|
+
* // 이제 다른 컴포넌트에서 useGlobalFormaState({ stateId: 'my-state-id' })로 접근 가능
|
|
51
|
+
* return <div>...</div>;
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export function useRegisterGlobalFormaState(stateId, formaState) {
|
|
56
|
+
const { registerStore } = useContext(GlobalFormaContext);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
// useFormaState의 내부 store를 글로벌에 등록 | Register useFormaState's internal store globally
|
|
59
|
+
if (formaState._store) {
|
|
60
|
+
registerStore(stateId, formaState._store);
|
|
61
|
+
}
|
|
62
|
+
}, [stateId, formaState._store, registerStore]);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=useRegisterGlobalFormaState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRegisterGlobalFormaState.js","sourceRoot":"","sources":["../../../hooks/useRegisterGlobalFormaState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,2BAA2B,CACvC,OAAe,EACf,UAAkC;IAElC,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAEzD,SAAS,CAAC,GAAG,EAAE;QACX,sFAAsF;QACtF,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;YACpB,aAAa,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AACpD,CAAC"}
|