@ehfuse/forma 1.0.4 → 1.1.0
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/README.md +107 -59
- package/dist/esm/hooks/useFieldState.d.ts +79 -0
- package/dist/esm/hooks/useFieldState.d.ts.map +1 -0
- package/dist/esm/hooks/useFieldState.js +154 -0
- package/dist/esm/hooks/useFieldState.js.map +1 -0
- package/dist/esm/hooks/useForm.d.ts +1 -1
- package/dist/esm/hooks/useForm.d.ts.map +1 -1
- package/dist/esm/hooks/useForm.js +33 -71
- package/dist/esm/hooks/useForm.js.map +1 -1
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/hooks/useFieldState.d.ts +79 -0
- package/dist/hooks/useFieldState.d.ts.map +1 -0
- package/dist/hooks/useFieldState.js +157 -0
- package/dist/hooks/useFieldState.js.map +1 -0
- package/dist/hooks/useForm.d.ts +1 -1
- package/dist/hooks/useForm.d.ts.map +1 -1
- package/dist/hooks/useForm.js +32 -70
- package/dist/hooks/useForm.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/hooks/useForm.js
CHANGED
|
@@ -30,25 +30,8 @@
|
|
|
30
30
|
*/
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.useForm = useForm;
|
|
33
|
-
const
|
|
33
|
+
const useFieldState_1 = require("./useFieldState");
|
|
34
34
|
const react_1 = require("react");
|
|
35
|
-
/**
|
|
36
|
-
* 개별 필드 구독 / Individual field subscription
|
|
37
|
-
* 특정 필드만 구독하여 해당 필드가 변경될 때만 리렌더링
|
|
38
|
-
* Subscribe to specific field only, re-render only when that field changes
|
|
39
|
-
*/
|
|
40
|
-
function useFieldValue(store, fieldName) {
|
|
41
|
-
const [value, setValue] = (0, react_1.useState)(() => store.getValue(fieldName));
|
|
42
|
-
(0, react_1.useEffect)(() => {
|
|
43
|
-
// 구독 설정 / Setup subscription
|
|
44
|
-
const unsubscribe = store.subscribe(fieldName, () => {
|
|
45
|
-
const newValue = store.getValue(fieldName);
|
|
46
|
-
setValue(newValue);
|
|
47
|
-
});
|
|
48
|
-
return unsubscribe;
|
|
49
|
-
}, [fieldName]); // store 의존성 제거로 불필요한 재구독 방지 / Remove store dependency to prevent unnecessary re-subscriptions
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
35
|
/**
|
|
53
36
|
* Forma 핵심 폼 관리 훅 / Forma core form management hook
|
|
54
37
|
*
|
|
@@ -66,38 +49,17 @@ function useFieldValue(store, fieldName) {
|
|
|
66
49
|
* @returns 폼 관리 API 객체 / Form management API object
|
|
67
50
|
*/
|
|
68
51
|
function useForm({ initialValues, onSubmit, onValidate, onComplete, _externalStore, }) {
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (_externalStore) {
|
|
73
|
-
storeRef.current = _externalStore;
|
|
74
|
-
}
|
|
75
|
-
else if (!storeRef.current) {
|
|
76
|
-
storeRef.current = new FieldStore_1.FieldStore(initialValues);
|
|
77
|
-
}
|
|
78
|
-
const store = storeRef.current;
|
|
52
|
+
// useFieldState를 기반으로 사용 / Use useFieldState as foundation
|
|
53
|
+
const fieldState = (0, useFieldState_1.useFieldState)(initialValues, { _externalStore });
|
|
54
|
+
// 폼 특정 상태 관리 / Form-specific state management
|
|
79
55
|
const [isSubmitting, setIsSubmitting] = (0, react_1.useState)(false);
|
|
80
56
|
const [isValidating, setIsValidating] = (0, react_1.useState)(false);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const modified = store.isModified();
|
|
86
|
-
setIsModified(modified);
|
|
87
|
-
};
|
|
88
|
-
checkModified();
|
|
89
|
-
const unsubscribe = store.subscribeGlobal(checkModified);
|
|
90
|
-
return unsubscribe;
|
|
91
|
-
}, [store]);
|
|
57
|
+
// 폼이 수정되었는지 확인 / Check if form is modified
|
|
58
|
+
const isModified = (0, react_1.useMemo)(() => {
|
|
59
|
+
return fieldState._store.isModified();
|
|
60
|
+
}, [fieldState.values]); // Use values as dependency for reactivity
|
|
92
61
|
// 호환성을 위한 values 객체 (비권장) / Values object for compatibility (not recommended)
|
|
93
|
-
const
|
|
94
|
-
(0, react_1.useEffect)(() => {
|
|
95
|
-
const unsubscribe = store.subscribeGlobal(() => {
|
|
96
|
-
setValuesSnapshot(store.getValues());
|
|
97
|
-
});
|
|
98
|
-
return unsubscribe;
|
|
99
|
-
}, [store]);
|
|
100
|
-
const values = valuesSnapshot;
|
|
62
|
+
const values = fieldState.values;
|
|
101
63
|
/**
|
|
102
64
|
* 통합 폼 변경 핸들러 / Unified form change handler
|
|
103
65
|
* MUI Select, TextField, DatePicker 등 모든 컴포넌트 지원
|
|
@@ -125,8 +87,8 @@ function useForm({ initialValues, onSubmit, onValidate, onComplete, _externalSto
|
|
|
125
87
|
else if (value === null) {
|
|
126
88
|
newValue = undefined;
|
|
127
89
|
}
|
|
128
|
-
|
|
129
|
-
}, [
|
|
90
|
+
fieldState.setValue(name, newValue);
|
|
91
|
+
}, [fieldState.setValue]);
|
|
130
92
|
/**
|
|
131
93
|
* DatePicker 전용 변경 핸들러 / DatePicker-specific change handler
|
|
132
94
|
* 간편한 사용을 위한 커링 함수 / Curried function for convenient usage
|
|
@@ -141,9 +103,9 @@ function useForm({ initialValues, onSubmit, onValidate, onComplete, _externalSto
|
|
|
141
103
|
else if (value === null) {
|
|
142
104
|
newValue = undefined;
|
|
143
105
|
}
|
|
144
|
-
|
|
106
|
+
fieldState.setValue(fieldName, newValue);
|
|
145
107
|
};
|
|
146
|
-
}, [
|
|
108
|
+
}, [fieldState.setValue]);
|
|
147
109
|
/**
|
|
148
110
|
* 개별 필드 값 설정 / Set individual field value
|
|
149
111
|
*/
|
|
@@ -156,40 +118,40 @@ function useForm({ initialValues, onSubmit, onValidate, onComplete, _externalSto
|
|
|
156
118
|
else if (value === null) {
|
|
157
119
|
processedValue = undefined;
|
|
158
120
|
}
|
|
159
|
-
|
|
160
|
-
}, [
|
|
121
|
+
fieldState.setValue(name, processedValue);
|
|
122
|
+
}, [fieldState.setValue]);
|
|
161
123
|
/**
|
|
162
124
|
* 전체 폼 값 설정 / Set all form values
|
|
163
125
|
*/
|
|
164
126
|
const setFormValues = (0, react_1.useCallback)((newValues) => {
|
|
165
|
-
|
|
166
|
-
}, [
|
|
127
|
+
fieldState.setValues(newValues);
|
|
128
|
+
}, [fieldState.setValues]);
|
|
167
129
|
/**
|
|
168
130
|
* 초기값 재설정 / Reset initial values
|
|
169
131
|
*/
|
|
170
132
|
const setInitialFormValues = (0, react_1.useCallback)((newInitialValues) => {
|
|
171
|
-
|
|
172
|
-
}, [
|
|
133
|
+
fieldState._store.setInitialValues(newInitialValues);
|
|
134
|
+
}, [fieldState._store]);
|
|
173
135
|
/**
|
|
174
136
|
* 구독 없이 현재 값만 가져오기 / Get current value without subscription
|
|
175
137
|
*/
|
|
176
138
|
const getFormValue = (0, react_1.useCallback)((fieldName) => {
|
|
177
|
-
return
|
|
178
|
-
}, [
|
|
139
|
+
return fieldState._store.getValue(fieldName);
|
|
140
|
+
}, [fieldState._store]);
|
|
179
141
|
/**
|
|
180
142
|
* 모든 폼 값 가져오기 / Get all form values
|
|
181
143
|
*/
|
|
182
144
|
const getFormValues = (0, react_1.useCallback)(() => {
|
|
183
|
-
return
|
|
184
|
-
}, [
|
|
145
|
+
return fieldState.getValues();
|
|
146
|
+
}, [fieldState.getValues]);
|
|
185
147
|
/**
|
|
186
148
|
* 개별 필드 구독 Hook / Individual field subscription hook
|
|
187
149
|
* 해당 필드가 변경될 때만 컴포넌트가 리렌더링됩니다
|
|
188
150
|
* Component re-renders only when the specific field changes
|
|
189
151
|
*/
|
|
190
152
|
const useFormValue = (0, react_1.useCallback)((fieldName) => {
|
|
191
|
-
return
|
|
192
|
-
}, [
|
|
153
|
+
return fieldState.useValue(fieldName);
|
|
154
|
+
}, [fieldState.useValue]);
|
|
193
155
|
/**
|
|
194
156
|
* 폼 검증 / Form validation
|
|
195
157
|
*/
|
|
@@ -197,7 +159,7 @@ function useForm({ initialValues, onSubmit, onValidate, onComplete, _externalSto
|
|
|
197
159
|
if (!onValidate)
|
|
198
160
|
return true;
|
|
199
161
|
setIsValidating(true);
|
|
200
|
-
const currentValues = valuesToValidate ||
|
|
162
|
+
const currentValues = valuesToValidate || fieldState.getValues();
|
|
201
163
|
try {
|
|
202
164
|
return await onValidate(currentValues);
|
|
203
165
|
}
|
|
@@ -208,22 +170,22 @@ function useForm({ initialValues, onSubmit, onValidate, onComplete, _externalSto
|
|
|
208
170
|
finally {
|
|
209
171
|
setIsValidating(false);
|
|
210
172
|
}
|
|
211
|
-
}, [onValidate,
|
|
173
|
+
}, [onValidate, fieldState.getValues]);
|
|
212
174
|
/**
|
|
213
175
|
* 폼 초기화 / Reset form
|
|
214
176
|
*/
|
|
215
177
|
const resetForm = (0, react_1.useCallback)(() => {
|
|
216
|
-
|
|
178
|
+
fieldState.reset();
|
|
217
179
|
setIsSubmitting(false);
|
|
218
180
|
setIsValidating(false);
|
|
219
|
-
}, [
|
|
181
|
+
}, [fieldState.reset]);
|
|
220
182
|
/**
|
|
221
183
|
* 폼 제출 / Submit form
|
|
222
184
|
*/
|
|
223
185
|
const submit = (0, react_1.useCallback)(async (e) => {
|
|
224
186
|
if (e)
|
|
225
187
|
e.preventDefault();
|
|
226
|
-
const currentValues =
|
|
188
|
+
const currentValues = fieldState.getValues();
|
|
227
189
|
if (!(await validateForm(currentValues))) {
|
|
228
190
|
return false;
|
|
229
191
|
}
|
|
@@ -244,7 +206,7 @@ function useForm({ initialValues, onSubmit, onValidate, onComplete, _externalSto
|
|
|
244
206
|
finally {
|
|
245
207
|
setIsSubmitting(false);
|
|
246
208
|
}
|
|
247
|
-
}, [onSubmit, onComplete, validateForm,
|
|
209
|
+
}, [onSubmit, onComplete, validateForm, fieldState.getValues]);
|
|
248
210
|
return (0, react_1.useMemo)(() => ({
|
|
249
211
|
// 상태 / State
|
|
250
212
|
isSubmitting,
|
|
@@ -268,7 +230,7 @@ function useForm({ initialValues, onSubmit, onValidate, onComplete, _externalSto
|
|
|
268
230
|
// 호환성 / Compatibility
|
|
269
231
|
values, // 비권장: 전체 리렌더링 발생 / not recommended: causes full re-renders
|
|
270
232
|
// 고급 사용 / Advanced usage
|
|
271
|
-
_store:
|
|
233
|
+
_store: fieldState._store, // 직접 store 접근용 / direct store access
|
|
272
234
|
}), [
|
|
273
235
|
isSubmitting,
|
|
274
236
|
isValidating,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.js","sourceRoot":"","sources":["../../hooks/useForm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;
|
|
1
|
+
{"version":3,"file":"useForm.js","sourceRoot":"","sources":["../../hooks/useForm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AAqCH,0BAqQC;AAlSD,mDAAgD;AAEhD,iCAMe;AAKf;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,OAAO,CAAgC,EACnD,aAAa,EACb,QAAQ,EACR,UAAU,EACV,UAAU,EACV,cAAc,GACA;IACd,2DAA2D;IAC3D,MAAM,UAAU,GAAG,IAAA,6BAAa,EAAI,aAAa,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;IAEvE,8CAA8C;IAC9C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAExD,2CAA2C;IAC3C,MAAM,UAAU,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC5B,OAAO,UAAU,C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,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,4DAA4D;QAEpE,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,MAAM;KACT,CACJ,CAAC;AACN,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -29,10 +29,12 @@
|
|
|
29
29
|
export { useForm } from "./hooks/useForm";
|
|
30
30
|
export { useGlobalForm } from "./hooks/useGlobalForm";
|
|
31
31
|
export { useRegisterGlobalForm } from "./hooks/useRegisterGlobalForm";
|
|
32
|
+
export { useFieldState } from "./hooks/useFieldState";
|
|
32
33
|
export { GlobalFormContext, GlobalFormProvider, } from "./contexts/GlobalFormContext";
|
|
33
34
|
export { FieldStore } from "./core/FieldStore";
|
|
34
35
|
export { getNestedValue, setNestedValue } from "./utils/dotNotation";
|
|
35
|
-
export type { UseFormProps, UseFormReturn,
|
|
36
|
+
export type { UseFormProps, UseFormReturn, FormValidationResult, FormChangeEvent, } from "./types/form";
|
|
37
|
+
export type { UseFieldStateOptions, UseFieldStateReturn, } from "./hooks/useFieldState";
|
|
36
38
|
export type { UseGlobalFormProps, UseGlobalFormReturn, GlobalFormProviderProps, GlobalFormContextType, GlobalFormStoreMap, GlobalFormMetadata, GlobalFormEvent, GlobalFormEventListener, GlobalFormConfig, GlobalFormMiddleware, ExtendedGlobalFormProviderProps, } from "./types/globalForm";
|
|
37
39
|
/**
|
|
38
40
|
* Forma library version
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EACH,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrE,YAAY,EACR,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,eAAe,GAClB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACR,oBAAoB,EACpB,mBAAmB,GACtB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EACR,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,+BAA+B,GAClC,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,aAAa,UAAU,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;CAejB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* SOFTWARE.
|
|
29
29
|
*/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.FORMA_METADATA = exports.FORMA_VERSION = exports.setNestedValue = exports.getNestedValue = exports.FieldStore = exports.GlobalFormProvider = exports.GlobalFormContext = exports.useRegisterGlobalForm = exports.useGlobalForm = exports.useForm = void 0;
|
|
31
|
+
exports.FORMA_METADATA = exports.FORMA_VERSION = exports.setNestedValue = exports.getNestedValue = exports.FieldStore = exports.GlobalFormProvider = exports.GlobalFormContext = exports.useFieldState = exports.useRegisterGlobalForm = exports.useGlobalForm = exports.useForm = void 0;
|
|
32
32
|
// ===== Core Hooks =====
|
|
33
33
|
var useForm_1 = require("./hooks/useForm");
|
|
34
34
|
Object.defineProperty(exports, "useForm", { enumerable: true, get: function () { return useForm_1.useForm; } });
|
|
@@ -36,6 +36,8 @@ var useGlobalForm_1 = require("./hooks/useGlobalForm");
|
|
|
36
36
|
Object.defineProperty(exports, "useGlobalForm", { enumerable: true, get: function () { return useGlobalForm_1.useGlobalForm; } });
|
|
37
37
|
var useRegisterGlobalForm_1 = require("./hooks/useRegisterGlobalForm");
|
|
38
38
|
Object.defineProperty(exports, "useRegisterGlobalForm", { enumerable: true, get: function () { return useRegisterGlobalForm_1.useRegisterGlobalForm; } });
|
|
39
|
+
var useFieldState_1 = require("./hooks/useFieldState");
|
|
40
|
+
Object.defineProperty(exports, "useFieldState", { enumerable: true, get: function () { return useFieldState_1.useFieldState; } });
|
|
39
41
|
// ===== Context & Providers =====
|
|
40
42
|
var GlobalFormContext_1 = require("./contexts/GlobalFormContext");
|
|
41
43
|
Object.defineProperty(exports, "GlobalFormContext", { enumerable: true, get: function () { return GlobalFormContext_1.GlobalFormContext; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;AAEH,yBAAyB;AACzB,2CAA0C;AAAjC,kGAAA,OAAO,OAAA;AAChB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AACtB,uEAAsE;AAA7D,8HAAA,qBAAqB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;AAEH,yBAAyB;AACzB,2CAA0C;AAAjC,kGAAA,OAAO,OAAA;AAChB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AACtB,uEAAsE;AAA7D,8HAAA,qBAAqB,OAAA;AAC9B,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAEtB,kCAAkC;AAClC,kEAGsC;AAFlC,sHAAA,iBAAiB,OAAA;AACjB,uHAAA,kBAAkB,OAAA;AAGtB,2BAA2B;AAC3B,gDAA+C;AAAtC,wGAAA,UAAU,OAAA;AAEnB,gCAAgC;AAChC,mDAAqE;AAA5D,6GAAA,cAAc,OAAA;AAAE,6GAAA,cAAc,OAAA;AAgCvC;;GAEG;AACU,QAAA,aAAa,GAAG,OAAO,CAAC;AAErC;;GAEG;AACU,QAAA,cAAc,GAAG;IAC1B,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,qBAAa;IACtB,WAAW,EAAE,8CAA8C;IAC3D,MAAM,EAAE,+BAA+B;IACvC,KAAK,EAAE,kBAAkB;IACzB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE;QACN,4DAA4D;QAC5D,kDAAkD;QAClD,wCAAwC;QACxC,8BAA8B;QAC9B,6BAA6B;QAC7B,qCAAqC;KACxC;CACK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ehfuse/forma",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Advanced React
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Advanced React state management library with individual field subscriptions - supports both forms and general state management",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|