@ehfuse/forma 1.0.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.
Files changed (99) hide show
  1. package/LICENSE +42 -0
  2. package/README.md +180 -0
  3. package/dist/contexts/GlobalFormContext.d.ts +66 -0
  4. package/dist/contexts/GlobalFormContext.d.ts.map +1 -0
  5. package/dist/contexts/GlobalFormContext.js +110 -0
  6. package/dist/contexts/GlobalFormContext.js.map +1 -0
  7. package/dist/core/FieldStore.d.ts +100 -0
  8. package/dist/core/FieldStore.d.ts.map +1 -0
  9. package/dist/core/FieldStore.js +264 -0
  10. package/dist/core/FieldStore.js.map +1 -0
  11. package/dist/core/index.d.ts +29 -0
  12. package/dist/core/index.d.ts.map +1 -0
  13. package/dist/core/index.js +36 -0
  14. package/dist/core/index.js.map +1 -0
  15. package/dist/esm/contexts/GlobalFormContext.d.ts +66 -0
  16. package/dist/esm/contexts/GlobalFormContext.d.ts.map +1 -0
  17. package/dist/esm/contexts/GlobalFormContext.js +106 -0
  18. package/dist/esm/contexts/GlobalFormContext.js.map +1 -0
  19. package/dist/esm/core/FieldStore.d.ts +100 -0
  20. package/dist/esm/core/FieldStore.d.ts.map +1 -0
  21. package/dist/esm/core/FieldStore.js +260 -0
  22. package/dist/esm/core/FieldStore.js.map +1 -0
  23. package/dist/esm/core/index.d.ts +29 -0
  24. package/dist/esm/core/index.d.ts.map +1 -0
  25. package/dist/esm/core/index.js +32 -0
  26. package/dist/esm/core/index.js.map +1 -0
  27. package/dist/esm/hooks/useForm.d.ts +67 -0
  28. package/dist/esm/hooks/useForm.d.ts.map +1 -0
  29. package/dist/esm/hooks/useForm.js +287 -0
  30. package/dist/esm/hooks/useForm.js.map +1 -0
  31. package/dist/esm/hooks/useGlobalForm.d.ts +45 -0
  32. package/dist/esm/hooks/useGlobalForm.d.ts.map +1 -0
  33. package/dist/esm/hooks/useGlobalForm.js +61 -0
  34. package/dist/esm/hooks/useGlobalForm.js.map +1 -0
  35. package/dist/esm/hooks/useRegisterGlobalForm.d.ts +55 -0
  36. package/dist/esm/hooks/useRegisterGlobalForm.d.ts.map +1 -0
  37. package/dist/esm/hooks/useRegisterGlobalForm.js +64 -0
  38. package/dist/esm/hooks/useRegisterGlobalForm.js.map +1 -0
  39. package/dist/esm/index.d.ts +53 -0
  40. package/dist/esm/index.d.ts.map +1 -0
  41. package/dist/esm/index.js +62 -0
  42. package/dist/esm/index.js.map +1 -0
  43. package/dist/esm/types/form.d.ts +120 -0
  44. package/dist/esm/types/form.d.ts.map +1 -0
  45. package/dist/esm/types/form.js +29 -0
  46. package/dist/esm/types/form.js.map +1 -0
  47. package/dist/esm/types/globalForm.d.ts +265 -0
  48. package/dist/esm/types/globalForm.d.ts.map +1 -0
  49. package/dist/esm/types/globalForm.js +39 -0
  50. package/dist/esm/types/globalForm.js.map +1 -0
  51. package/dist/esm/types/index.d.ts +31 -0
  52. package/dist/esm/types/index.d.ts.map +1 -0
  53. package/dist/esm/types/index.js +30 -0
  54. package/dist/esm/types/index.js.map +1 -0
  55. package/dist/esm/utils/dotNotation.d.ts +58 -0
  56. package/dist/esm/utils/dotNotation.d.ts.map +1 -0
  57. package/dist/esm/utils/dotNotation.js +100 -0
  58. package/dist/esm/utils/dotNotation.js.map +1 -0
  59. package/dist/esm/utils/index.d.ts +27 -0
  60. package/dist/esm/utils/index.d.ts.map +1 -0
  61. package/dist/esm/utils/index.js +27 -0
  62. package/dist/esm/utils/index.js.map +1 -0
  63. package/dist/hooks/useForm.d.ts +67 -0
  64. package/dist/hooks/useForm.d.ts.map +1 -0
  65. package/dist/hooks/useForm.js +290 -0
  66. package/dist/hooks/useForm.js.map +1 -0
  67. package/dist/hooks/useGlobalForm.d.ts +45 -0
  68. package/dist/hooks/useGlobalForm.d.ts.map +1 -0
  69. package/dist/hooks/useGlobalForm.js +64 -0
  70. package/dist/hooks/useGlobalForm.js.map +1 -0
  71. package/dist/hooks/useRegisterGlobalForm.d.ts +55 -0
  72. package/dist/hooks/useRegisterGlobalForm.d.ts.map +1 -0
  73. package/dist/hooks/useRegisterGlobalForm.js +67 -0
  74. package/dist/hooks/useRegisterGlobalForm.js.map +1 -0
  75. package/dist/index.d.ts +53 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +73 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/types/form.d.ts +120 -0
  80. package/dist/types/form.d.ts.map +1 -0
  81. package/dist/types/form.js +30 -0
  82. package/dist/types/form.js.map +1 -0
  83. package/dist/types/globalForm.d.ts +265 -0
  84. package/dist/types/globalForm.d.ts.map +1 -0
  85. package/dist/types/globalForm.js +43 -0
  86. package/dist/types/globalForm.js.map +1 -0
  87. package/dist/types/index.d.ts +31 -0
  88. package/dist/types/index.d.ts.map +1 -0
  89. package/dist/types/index.js +34 -0
  90. package/dist/types/index.js.map +1 -0
  91. package/dist/utils/dotNotation.d.ts +58 -0
  92. package/dist/utils/dotNotation.d.ts.map +1 -0
  93. package/dist/utils/dotNotation.js +104 -0
  94. package/dist/utils/dotNotation.js.map +1 -0
  95. package/dist/utils/index.d.ts +27 -0
  96. package/dist/utils/index.d.ts.map +1 -0
  97. package/dist/utils/index.js +32 -0
  98. package/dist/utils/index.js.map +1 -0
  99. package/package.json +71 -0
@@ -0,0 +1,55 @@
1
+ /**
2
+ * useRegisterGlobalForm.ts
3
+ *
4
+ * Forma - 기존 useForm을 글로벌 폼으로 등록하는 훅 | Hook to register existing useForm as global form
5
+ * 기존에 만든 로컬 폼을 글로벌 상태로 공유할 수 있게 해주는 유틸리티
6
+ * Utility to enable sharing existing local forms 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 { UseFormReturn } from "../types/form";
31
+ /**
32
+ * 기존 useForm을 글로벌 폼으로 등록하는 훅 | Hook to register existing useForm as global form
33
+ *
34
+ * 이미 만들어진 로컬 폼을 글로벌 상태로 공유하고 싶을 때 사용합니다.
35
+ * Use this when you want to share an already created local form as global state.
36
+ *
37
+ * @template T 폼 데이터의 타입 | Form data type
38
+ * @param formId 글로벌 폼 식별자 | Global form identifier
39
+ * @param form 등록할 useForm 인스턴스 | useForm instance to register
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * function MyComponent() {
44
+ * const form = useForm({ initialValues: { name: '', email: '' } });
45
+ *
46
+ * // 로컬 폼을 글로벌로 등록
47
+ * useRegisterGlobalForm('my-form-id', form);
48
+ *
49
+ * // 이제 다른 컴포넌트에서 useGlobalForm({ formId: 'my-form-id' })로 접근 가능
50
+ * return <div>...</div>;
51
+ * }
52
+ * ```
53
+ */
54
+ export declare function useRegisterGlobalForm<T extends Record<string, any>>(formId: string, form: UseFormReturn<T>): void;
55
+ //# sourceMappingURL=useRegisterGlobalForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRegisterGlobalForm.d.ts","sourceRoot":"","sources":["../../hooks/useRegisterGlobalForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/D,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GACvB,IAAI,CASN"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ /**
3
+ * useRegisterGlobalForm.ts
4
+ *
5
+ * Forma - 기존 useForm을 글로벌 폼으로 등록하는 훅 | Hook to register existing useForm as global form
6
+ * 기존에 만든 로컬 폼을 글로벌 상태로 공유할 수 있게 해주는 유틸리티
7
+ * Utility to enable sharing existing local forms as global state
8
+ *
9
+ * @license MIT License
10
+ * @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
11
+ * @author KIM YOUNG JIN (ehfuse@gmail.com)
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in all
21
+ * copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.useRegisterGlobalForm = useRegisterGlobalForm;
33
+ const react_1 = require("react");
34
+ const GlobalFormContext_1 = require("../contexts/GlobalFormContext");
35
+ /**
36
+ * 기존 useForm을 글로벌 폼으로 등록하는 훅 | Hook to register existing useForm as global form
37
+ *
38
+ * 이미 만들어진 로컬 폼을 글로벌 상태로 공유하고 싶을 때 사용합니다.
39
+ * Use this when you want to share an already created local form as global state.
40
+ *
41
+ * @template T 폼 데이터의 타입 | Form data type
42
+ * @param formId 글로벌 폼 식별자 | Global form identifier
43
+ * @param form 등록할 useForm 인스턴스 | useForm instance to register
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * function MyComponent() {
48
+ * const form = useForm({ initialValues: { name: '', email: '' } });
49
+ *
50
+ * // 로컬 폼을 글로벌로 등록
51
+ * useRegisterGlobalForm('my-form-id', form);
52
+ *
53
+ * // 이제 다른 컴포넌트에서 useGlobalForm({ formId: 'my-form-id' })로 접근 가능
54
+ * return <div>...</div>;
55
+ * }
56
+ * ```
57
+ */
58
+ function useRegisterGlobalForm(formId, form) {
59
+ const { registerStore } = (0, react_1.useContext)(GlobalFormContext_1.GlobalFormContext);
60
+ (0, react_1.useEffect)(() => {
61
+ // useForm의 내부 store를 글로벌에 등록 | Register useForm's internal store globally
62
+ if (form._store) {
63
+ registerStore(formId, form._store);
64
+ }
65
+ }, [formId, form._store, registerStore]);
66
+ }
67
+ //# sourceMappingURL=useRegisterGlobalForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRegisterGlobalForm.js","sourceRoot":"","sources":["../../hooks/useRegisterGlobalForm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AA6BH,sDAYC;AAvCD,iCAA8C;AAE9C,qEAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,qBAAqB,CACjC,MAAc,EACd,IAAsB;IAEtB,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,kBAAU,EAAC,qCAAiB,CAAC,CAAC;IAExD,IAAA,iBAAS,EAAC,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,53 @@
1
+ /**
2
+ * index.ts
3
+ *
4
+ * Forma - Advanced React form state management library
5
+ * Main entry point and API exports
6
+ *
7
+ * @license MIT License
8
+ * @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
9
+ * @author KIM YOUNG JIN (ehfuse@gmail.com)
10
+ *
11
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ * of this software and associated documentation files (the "Software"), to deal
13
+ * in the Software without restriction, including without limitation the rights
14
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ * copies of the Software, and to permit persons to whom the Software is
16
+ * furnished to do so, subject to the following conditions:
17
+ *
18
+ * The above copyright notice and this permission notice shall be included in all
19
+ * copies or substantial portions of the Software.
20
+ *
21
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ * SOFTWARE.
28
+ */
29
+ export { useForm } from "./hooks/useForm";
30
+ export { useGlobalForm } from "./hooks/useGlobalForm";
31
+ export { useRegisterGlobalForm } from "./hooks/useRegisterGlobalForm";
32
+ export { GlobalFormContext, GlobalFormProvider, } from "./contexts/GlobalFormContext";
33
+ export { FieldStore } from "./core/FieldStore";
34
+ export { getNestedValue, setNestedValue } from "./utils/dotNotation";
35
+ export type { UseFormProps, UseFormReturn, FormChangeEvent, DatePickerChangeHandler, } from "./types/form";
36
+ export type { UseGlobalFormProps, UseGlobalFormReturn, GlobalFormProviderProps, GlobalFormContextType, GlobalFormStoreMap, GlobalFormMetadata, GlobalFormEvent, GlobalFormEventListener, GlobalFormConfig, GlobalFormMiddleware, ExtendedGlobalFormProviderProps, } from "./types/globalForm";
37
+ /**
38
+ * Forma library version
39
+ */
40
+ export declare const FORMA_VERSION = "1.0.0";
41
+ /**
42
+ * Forma library metadata
43
+ */
44
+ export declare const FORMA_METADATA: {
45
+ readonly name: "Forma";
46
+ readonly version: "1.0.0";
47
+ readonly description: "Advanced React form state management library";
48
+ readonly author: "KIM YOUNG JIN (Kim Young Jin)";
49
+ readonly email: "ehfuse@gmail.com";
50
+ readonly license: "MIT";
51
+ readonly features: readonly ["Optimized re-rendering with individual field subscriptions", "Nested object handling with dot notation support", "Full compatibility with MUI components", "Global form state management", "Complete TypeScript support", "Leveraging latest React 19 features"];
52
+ };
53
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AAGtE,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,eAAe,EACf,uBAAuB,GAC1B,MAAM,cAAc,CAAC;AAGtB,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 ADDED
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ /**
3
+ * index.ts
4
+ *
5
+ * Forma - Advanced React form state management library
6
+ * Main entry point and API exports
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
+ 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;
32
+ // ===== Core Hooks =====
33
+ var useForm_1 = require("./hooks/useForm");
34
+ Object.defineProperty(exports, "useForm", { enumerable: true, get: function () { return useForm_1.useForm; } });
35
+ var useGlobalForm_1 = require("./hooks/useGlobalForm");
36
+ Object.defineProperty(exports, "useGlobalForm", { enumerable: true, get: function () { return useGlobalForm_1.useGlobalForm; } });
37
+ var useRegisterGlobalForm_1 = require("./hooks/useRegisterGlobalForm");
38
+ Object.defineProperty(exports, "useRegisterGlobalForm", { enumerable: true, get: function () { return useRegisterGlobalForm_1.useRegisterGlobalForm; } });
39
+ // ===== Context & Providers =====
40
+ var GlobalFormContext_1 = require("./contexts/GlobalFormContext");
41
+ Object.defineProperty(exports, "GlobalFormContext", { enumerable: true, get: function () { return GlobalFormContext_1.GlobalFormContext; } });
42
+ Object.defineProperty(exports, "GlobalFormProvider", { enumerable: true, get: function () { return GlobalFormContext_1.GlobalFormProvider; } });
43
+ // ===== Core Classes =====
44
+ var FieldStore_1 = require("./core/FieldStore");
45
+ Object.defineProperty(exports, "FieldStore", { enumerable: true, get: function () { return FieldStore_1.FieldStore; } });
46
+ // ===== Utility Functions =====
47
+ var dotNotation_1 = require("./utils/dotNotation");
48
+ Object.defineProperty(exports, "getNestedValue", { enumerable: true, get: function () { return dotNotation_1.getNestedValue; } });
49
+ Object.defineProperty(exports, "setNestedValue", { enumerable: true, get: function () { return dotNotation_1.setNestedValue; } });
50
+ /**
51
+ * Forma library version
52
+ */
53
+ exports.FORMA_VERSION = "1.0.0";
54
+ /**
55
+ * Forma library metadata
56
+ */
57
+ exports.FORMA_METADATA = {
58
+ name: "Forma",
59
+ version: exports.FORMA_VERSION,
60
+ description: "Advanced React form state management library",
61
+ author: "KIM YOUNG JIN (Kim Young Jin)",
62
+ email: "ehfuse@gmail.com",
63
+ license: "MIT",
64
+ features: [
65
+ "Optimized re-rendering with individual field subscriptions",
66
+ "Nested object handling with dot notation support",
67
+ "Full compatibility with MUI components",
68
+ "Global form state management",
69
+ "Complete TypeScript support",
70
+ "Leveraging latest React 19 features",
71
+ ],
72
+ };
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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;AAE9B,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;AA0BvC;;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"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * form.ts
3
+ *
4
+ * Forma - 기본 폼 관련 타입 정의 | Basic form-related type definitions
5
+ *
6
+ * @license MIT License
7
+ * @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
8
+ * @author KIM YOUNG JIN (ehfuse@gmail.com)
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all
18
+ * copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+ import { FieldStore } from "../core/FieldStore";
29
+ type SelectChangeEvent<T = string> = {
30
+ target: {
31
+ name?: string;
32
+ value: T;
33
+ };
34
+ };
35
+ type PickerChangeHandlerContext<T> = any;
36
+ /**
37
+ * 폼 이벤트 타입 정의 | Form event type definitions
38
+ * MUI 컴포넌트들의 다양한 이벤트 타입을 통합 | Unified event types for various MUI components
39
+ */
40
+ export type FormChangeEvent = React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement> | SelectChangeEvent | SelectChangeEvent<string | number> | {
41
+ target: {
42
+ name: string;
43
+ value: any;
44
+ };
45
+ onChange?: (value: any, context: PickerChangeHandlerContext<any>) => void;
46
+ };
47
+ /**
48
+ * DatePicker 전용 핸들러 타입
49
+ * MUI DatePicker 컴포넌트와의 통합을 위한 타입
50
+ */
51
+ export type DatePickerChangeHandler = (fieldName: string) => (value: any, context?: PickerChangeHandlerContext<any>) => void;
52
+ /**
53
+ * useForm 훅의 Props 타입 | useForm hook Props type
54
+ */
55
+ export interface UseFormProps<T extends Record<string, any>> {
56
+ /** 폼의 초기값 | Initial form values */
57
+ initialValues: T;
58
+ /** 폼 제출 핸들러 | Form submission handler */
59
+ onSubmit?: (values: T) => Promise<void> | void;
60
+ /** 폼 검증 핸들러 | Form validation handler */
61
+ onValidate?: (values: T) => Promise<boolean> | boolean;
62
+ /** 폼 제출 완료 후 콜백 | Callback after form submission completion */
63
+ onComplete?: (values: T) => void;
64
+ /** 내부 API - 전역 상태용 외부 스토어 | Internal API - external store for global state */
65
+ _externalStore?: FieldStore<T>;
66
+ }
67
+ /**
68
+ * useForm 훅의 반환 타입 | useForm hook return type
69
+ */
70
+ export interface UseFormReturn<T extends Record<string, any>> {
71
+ /** 개별 필드 값 구독 함수 | Individual field value subscription function */
72
+ useFormValue: (fieldName: keyof T | string) => any;
73
+ /** 폼 변경 핸들러 (MUI 컴포넌트용) | Form change handler (for MUI components) */
74
+ handleFormChange: (event: FormChangeEvent) => void;
75
+ /** DatePicker 변경 핸들러 | DatePicker change handler */
76
+ handleDatePickerChange: DatePickerChangeHandler;
77
+ /** 모든 폼 값 가져오기 | Get all form values */
78
+ getFormValues: () => T;
79
+ /** 특정 필드 값 가져오기 | Get specific field value */
80
+ getFormValue: (fieldName: keyof T | string) => any;
81
+ /** 특정 필드 값 설정 | Set specific field value */
82
+ setFormValue: (fieldName: keyof T | string, value: any) => void;
83
+ /** 모든 폼 값 설정 | Set all form values */
84
+ setFormValues: (values: Partial<T>) => void;
85
+ /** 초기값 재설정 | Reset initial values */
86
+ setInitialFormValues: (newInitialValues: T) => void;
87
+ /** 폼 리셋 | Reset form */
88
+ resetForm: () => void;
89
+ /** 폼 제출 | Submit form */
90
+ submit: () => Promise<boolean>;
91
+ /** 폼 검증 | Validate form */
92
+ validateForm: () => Promise<boolean>;
93
+ /** 수정 여부 | Modified status */
94
+ isModified: boolean;
95
+ /** 제출 중 여부 | Submitting status */
96
+ isSubmitting: boolean;
97
+ /** 검증 중 여부 | Validating status */
98
+ isValidating: boolean;
99
+ /** 호환성을 위한 values 객체 (비권장) | Values object for compatibility (not recommended) */
100
+ values: T;
101
+ /** 내부 스토어 직접 접근 | Direct access to internal store */
102
+ _store: FieldStore<T>;
103
+ }
104
+ /**
105
+ * 폼 상태 타입 | Form state type
106
+ */
107
+ export type FormState = "idle" | "submitting" | "validating" | "error" | "success";
108
+ /**
109
+ * 폼 검증 결과 타입 | Form validation result type
110
+ */
111
+ export interface FormValidationResult {
112
+ /** 검증 성공 여부 | Validation success status */
113
+ isValid: boolean;
114
+ /** 에러 메시지 (필드별) | Error messages (by field) */
115
+ errors?: Record<string, string>;
116
+ /** 전체 에러 메시지 | Overall error message */
117
+ message?: string;
118
+ }
119
+ export {};
120
+ //# sourceMappingURL=form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../types/form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,KAAK,iBAAiB,CAAC,CAAC,GAAG,MAAM,IAAI;IACjC,M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AY,GACZ,OAAO,GACP,SAAS,CAAC;AAEhB;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * form.ts
4
+ *
5
+ * Forma - 기본 폼 관련 타입 정의 | Basic form-related type definitions
6
+ *
7
+ * @license MIT License
8
+ * @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
9
+ * @author KIM YOUNG JIN (ehfuse@gmail.com)
10
+ *
11
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ * of this software and associated documentation files (the "Software"), to deal
13
+ * in the Software without restriction, including without limitation the rights
14
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ * copies of the Software, and to permit persons to whom the Software is
16
+ * furnished to do so, subject to the following conditions:
17
+ *
18
+ * The above copyright notice and this permission notice shall be included in all
19
+ * copies or substantial portions of the Software.
20
+ *
21
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ * SOFTWARE.
28
+ */
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ //# sourceMappingURL=form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.js","sourceRoot":"","sources":["../../types/form.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG"}