@jfdevelops/multi-step-form-core 1.0.0-alpha.16 → 1.0.0-alpha.17

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 (147) hide show
  1. package/package.json +1 -1
  2. package/dist/_internals.cjs +0 -14
  3. package/dist/_internals.d.cts +0 -4
  4. package/dist/_internals.d.mts +0 -4
  5. package/dist/_internals.mjs +0 -5
  6. package/dist/index.cjs +0 -49
  7. package/dist/index.d.cts +0 -14
  8. package/dist/index.d.mts +0 -14
  9. package/dist/index.mjs +0 -16
  10. package/dist/internals/step-schema.cjs +0 -389
  11. package/dist/internals/step-schema.cjs.map +0 -1
  12. package/dist/internals/step-schema.d.cts +0 -41
  13. package/dist/internals/step-schema.d.cts.map +0 -1
  14. package/dist/internals/step-schema.d.mts +0 -41
  15. package/dist/internals/step-schema.d.mts.map +0 -1
  16. package/dist/internals/step-schema.mjs +0 -389
  17. package/dist/internals/step-schema.mjs.map +0 -1
  18. package/dist/internals/utils.cjs +0 -94
  19. package/dist/internals/utils.cjs.map +0 -1
  20. package/dist/internals/utils.d.cts +0 -27
  21. package/dist/internals/utils.d.cts.map +0 -1
  22. package/dist/internals/utils.d.mts +0 -27
  23. package/dist/internals/utils.d.mts.map +0 -1
  24. package/dist/internals/utils.mjs +0 -91
  25. package/dist/internals/utils.mjs.map +0 -1
  26. package/dist/observable.cjs +0 -44
  27. package/dist/observable.cjs.map +0 -1
  28. package/dist/observable.d.cts +0 -26
  29. package/dist/observable.d.cts.map +0 -1
  30. package/dist/observable.d.mts +0 -26
  31. package/dist/observable.d.mts.map +0 -1
  32. package/dist/observable.mjs +0 -44
  33. package/dist/observable.mjs.map +0 -1
  34. package/dist/schema.cjs +0 -68
  35. package/dist/schema.cjs.map +0 -1
  36. package/dist/schema.d.cts +0 -28
  37. package/dist/schema.d.cts.map +0 -1
  38. package/dist/schema.d.mts +0 -28
  39. package/dist/schema.d.mts.map +0 -1
  40. package/dist/schema.mjs +0 -67
  41. package/dist/schema.mjs.map +0 -1
  42. package/dist/steps/fields.cjs +0 -23
  43. package/dist/steps/fields.cjs.map +0 -1
  44. package/dist/steps/fields.d.cts +0 -18
  45. package/dist/steps/fields.d.cts.map +0 -1
  46. package/dist/steps/fields.d.mts +0 -18
  47. package/dist/steps/fields.d.mts.map +0 -1
  48. package/dist/steps/fields.mjs +0 -18
  49. package/dist/steps/fields.mjs.map +0 -1
  50. package/dist/steps/index.cjs +0 -4
  51. package/dist/steps/index.mjs +0 -6
  52. package/dist/steps/schema.cjs +0 -194
  53. package/dist/steps/schema.cjs.map +0 -1
  54. package/dist/steps/schema.d.cts +0 -124
  55. package/dist/steps/schema.d.cts.map +0 -1
  56. package/dist/steps/schema.d.mts +0 -124
  57. package/dist/steps/schema.d.mts.map +0 -1
  58. package/dist/steps/schema.mjs +0 -194
  59. package/dist/steps/schema.mjs.map +0 -1
  60. package/dist/steps/types.cjs +0 -33
  61. package/dist/steps/types.cjs.map +0 -1
  62. package/dist/steps/types.d.cts +0 -329
  63. package/dist/steps/types.d.cts.map +0 -1
  64. package/dist/steps/types.d.mts +0 -329
  65. package/dist/steps/types.d.mts.map +0 -1
  66. package/dist/steps/types.mjs +0 -27
  67. package/dist/steps/types.mjs.map +0 -1
  68. package/dist/steps/utils.cjs +0 -96
  69. package/dist/steps/utils.cjs.map +0 -1
  70. package/dist/steps/utils.d.cts +0 -10
  71. package/dist/steps/utils.d.cts.map +0 -1
  72. package/dist/steps/utils.d.mts +0 -10
  73. package/dist/steps/utils.d.mts.map +0 -1
  74. package/dist/steps/utils.mjs +0 -94
  75. package/dist/steps/utils.mjs.map +0 -1
  76. package/dist/storage.cjs +0 -72
  77. package/dist/storage.cjs.map +0 -1
  78. package/dist/storage.d.cts +0 -33
  79. package/dist/storage.d.cts.map +0 -1
  80. package/dist/storage.d.mts +0 -33
  81. package/dist/storage.d.mts.map +0 -1
  82. package/dist/storage.mjs +0 -71
  83. package/dist/storage.mjs.map +0 -1
  84. package/dist/subscribable.cjs +0 -25
  85. package/dist/subscribable.cjs.map +0 -1
  86. package/dist/subscribable.d.cts +0 -14
  87. package/dist/subscribable.d.cts.map +0 -1
  88. package/dist/subscribable.d.mts +0 -14
  89. package/dist/subscribable.d.mts.map +0 -1
  90. package/dist/subscribable.mjs +0 -24
  91. package/dist/subscribable.mjs.map +0 -1
  92. package/dist/utils/casing.cjs +0 -63
  93. package/dist/utils/casing.cjs.map +0 -1
  94. package/dist/utils/casing.d.cts +0 -40
  95. package/dist/utils/casing.d.cts.map +0 -1
  96. package/dist/utils/casing.d.mts +0 -40
  97. package/dist/utils/casing.d.mts.map +0 -1
  98. package/dist/utils/casing.mjs +0 -57
  99. package/dist/utils/casing.mjs.map +0 -1
  100. package/dist/utils/field-types.cjs +0 -23
  101. package/dist/utils/field-types.cjs.map +0 -1
  102. package/dist/utils/field-types.d.cts +0 -11
  103. package/dist/utils/field-types.d.cts.map +0 -1
  104. package/dist/utils/field-types.d.mts +0 -11
  105. package/dist/utils/field-types.d.mts.map +0 -1
  106. package/dist/utils/field-types.mjs +0 -20
  107. package/dist/utils/field-types.mjs.map +0 -1
  108. package/dist/utils/helpers.cjs +0 -30
  109. package/dist/utils/helpers.cjs.map +0 -1
  110. package/dist/utils/helpers.mjs +0 -27
  111. package/dist/utils/helpers.mjs.map +0 -1
  112. package/dist/utils/invariant.cjs +0 -18
  113. package/dist/utils/invariant.cjs.map +0 -1
  114. package/dist/utils/invariant.d.cts +0 -5
  115. package/dist/utils/invariant.d.cts.map +0 -1
  116. package/dist/utils/invariant.d.mts +0 -5
  117. package/dist/utils/invariant.d.mts.map +0 -1
  118. package/dist/utils/invariant.mjs +0 -17
  119. package/dist/utils/invariant.mjs.map +0 -1
  120. package/dist/utils/logger.cjs +0 -58
  121. package/dist/utils/logger.cjs.map +0 -1
  122. package/dist/utils/logger.d.cts +0 -53
  123. package/dist/utils/logger.d.cts.map +0 -1
  124. package/dist/utils/logger.d.mts +0 -53
  125. package/dist/utils/logger.d.mts.map +0 -1
  126. package/dist/utils/logger.mjs +0 -56
  127. package/dist/utils/logger.mjs.map +0 -1
  128. package/dist/utils/path.cjs +0 -331
  129. package/dist/utils/path.cjs.map +0 -1
  130. package/dist/utils/path.d.cts +0 -139
  131. package/dist/utils/path.d.cts.map +0 -1
  132. package/dist/utils/path.d.mts +0 -139
  133. package/dist/utils/path.d.mts.map +0 -1
  134. package/dist/utils/path.mjs +0 -325
  135. package/dist/utils/path.mjs.map +0 -1
  136. package/dist/utils/types.d.cts +0 -25
  137. package/dist/utils/types.d.cts.map +0 -1
  138. package/dist/utils/types.d.mts +0 -25
  139. package/dist/utils/types.d.mts.map +0 -1
  140. package/dist/utils/validator.cjs +0 -12
  141. package/dist/utils/validator.cjs.map +0 -1
  142. package/dist/utils/validator.d.cts +0 -77
  143. package/dist/utils/validator.d.cts.map +0 -1
  144. package/dist/utils/validator.d.mts +0 -77
  145. package/dist/utils/validator.d.mts.map +0 -1
  146. package/dist/utils/validator.mjs +0 -11
  147. package/dist/utils/validator.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.mts","names":[],"sources":["../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAoBiB,yCACD,KAAK,0BACH,gDAER,8BAA8B,OAAO,SAAS;KAC5C,0CACI,KAAK,0BACH,iDAEP,2BAA2B,OAAO,SAAS;cAEzC,iCACE,KAAK,wBACH,aAAa,oCACP,aAAa,MAAM,UAAU,aAAa,MAAM,6BACjD,YAAY,gBAAgB,YAAY,2CAChC,2BACpB,aAAa,4BAA4B,MAAM,QAAQ;EAjBhD,SAAA,+BAA0B,EAkBC,MAlBD;EACtB,SAAA,UAAA,EAkBE,uBAlBF,CAmBjB,IAnBiB,EAoBjB,MApBiB,EAqBjB,YArBiB,EAsBjB,WAtBiB,EAuBjB,UAvBiB,CAAA;EAAL,OAAA,EAyBL,oBAzBK,CAyBgB,YAzBhB,EAyB8B,UAzB9B,CAAA;EACE,QAAA,UAAA;EAEsB,WAAA,CAAA,OAAA,EA0B3B,0BA1B2B,CA2BlC,IA3BkC,EA6BlC,SA7BkC,CA6BxB,MA7BwB,EA6BhB,UA7BgB,CAAA,EA8BlC,UA9BkC,CAAA;EAAO,WAAA,CAAA,CAAA,EAAA,IAAA;EAAS,KAAA,CAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EAA9C,OAAA,CAAA,CAAA,EAAA,IAAA;EAA6B,SAAA,CAAA,CAAA,EAAA,OAAA;EAC3B,UAAA,OAAA,CAAA,CAAA,EAAA,IAAA;EACS,UAAA,SAAA,CAAA,CAAA,EAAA,IAAA;EAAL,UAAA,MAAA,CAAA,CAAA,EAAA,IAAA;;AAGsB,iBAiGtB,yBAjGsB,CAAA,aAkGvB,IAlGuB,CAkGlB,MAlGkB,CAAA,EAAA,eAmGrB,UAnGqB,GAmGR,aAnGQ,EAAA,qBAoGf,YApGe,CAoGF,IApGE,EAoGI,MApGJ,CAAA,GAoGc,YApGd,CAoG2B,IApG3B,EAoGiC,MApGjC,CAAA,EAAA,oBAqGhB,WArGgB,CAqGJ,YArGI,CAAA,GAqGY,WArGZ,CAqGwB,YArGxB,CAAA,EAAA,mBAAA,MAAA,GAsGR,iBAtGQ,CAAA,CAAA,OAAA,EAwG3B,0BAxG2B,CAyGlC,IAzGkC,EA2GlC,SA3GkC,CA2GxB,MA3GwB,EA2GhB,UA3GgB,CAAA,EA4GlC,UA5GkC,CAAA,CAAA,EA6GnC,mBA7GmC,CA6GnC,IA7GmC,EA6GnC,MA7GmC,EA6GnC,YA7GmC,EA6GnC,WA7GmC,EA6GnC,UA7GmC,CAAA"}
package/dist/schema.mjs DELETED
@@ -1,67 +0,0 @@
1
- import { setCasingType } from "./utils/casing.mjs";
2
- import { DEFAULT_STORAGE_KEY, MultiStepFormStorage } from "./storage.mjs";
3
- import { Subscribable } from "./subscribable.mjs";
4
- import { MultiStepFormStepSchema } from "./steps/schema.mjs";
5
- import "./steps/index.mjs";
6
-
7
- //#region src/schema.ts
8
- var MultiStepFormSchema = class extends Subscribable {
9
- defaultNameTransformationCasing;
10
- stepSchema;
11
- storage;
12
- mountCount = 0;
13
- constructor(options) {
14
- super();
15
- const { steps, nameTransformCasing, storage } = options;
16
- this.defaultNameTransformationCasing = setCasingType(nameTransformCasing);
17
- this.stepSchema = new MultiStepFormStepSchema({
18
- steps,
19
- nameTransformCasing: this.defaultNameTransformationCasing
20
- });
21
- this.storage = new MultiStepFormStorage({
22
- key: storage?.key ?? DEFAULT_STORAGE_KEY,
23
- data: this.stepSchema.value,
24
- store: storage?.store,
25
- throwWhenUndefined: storage?.throwWhenUndefined ?? false
26
- });
27
- this.stepSchema.subscribe(() => {
28
- this.notify();
29
- });
30
- }
31
- getSnapshot() {
32
- return this;
33
- }
34
- mount() {
35
- this.mountCount++;
36
- if (this.mountCount === 1) this.onMount();
37
- return () => {
38
- this.unmount();
39
- };
40
- }
41
- unmount() {
42
- this.mountCount = Math.max(0, this.mountCount - 1);
43
- if (this.mountCount === 0) this.onUnmount();
44
- }
45
- isMounted() {
46
- return this.mountCount > 0;
47
- }
48
- onMount() {}
49
- onUnmount() {}
50
- notify() {
51
- for (const listener of this.listeners) listener({
52
- nameTransformCasing: this.defaultNameTransformationCasing,
53
- storage: {
54
- key: this.storage.key,
55
- store: this.storage.store
56
- },
57
- steps: this.stepSchema.original
58
- });
59
- }
60
- };
61
- function createMultiStepFormSchema(options) {
62
- return new MultiStepFormSchema(options);
63
- }
64
-
65
- //#endregion
66
- export { MultiStepFormSchema, createMultiStepFormSchema };
67
- //# sourceMappingURL=schema.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.mjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import {\n MultiStepFormStepSchema,\n type MultiStepFormSchemaStepConfig,\n type ResolvedStep,\n type Step,\n type StepNumbers,\n} from '@/steps';\nimport {\n setCasingType,\n type CasingType,\n type Constrain,\n type DefaultCasing,\n} from '@/utils';\nimport {\n DEFAULT_STORAGE_KEY,\n MultiStepFormStorage,\n type DefaultStorageKey,\n} from './storage.js';\nimport { Subscribable } from './subscribable.js';\n\nexport interface MultiStepFormSchemaOptions<\n TStep extends Step<TCasing>,\n TCasing extends CasingType,\n TStorageKey extends string\n> extends MultiStepFormSchemaStepConfig<TStep, TCasing, TStorageKey> {}\nexport type MultiStepFormSchemaListener<\n TStep extends Step<TCasing>,\n TCasing extends CasingType,\n TStorageKey extends string\n> = (data: MultiStepFormSchemaOptions<TStep, TCasing, TStorageKey>) => void;\n\nexport class MultiStepFormSchema<\n step extends Step<casing>,\n casing extends CasingType = DefaultCasing,\n resolvedStep extends ResolvedStep<step, casing> = ResolvedStep<step, casing>,\n stepNumbers extends StepNumbers<resolvedStep> = StepNumbers<resolvedStep>,\n storageKey extends string = DefaultStorageKey\n> extends Subscribable<MultiStepFormSchemaListener<step, casing, storageKey>> {\n readonly defaultNameTransformationCasing: casing;\n readonly stepSchema: MultiStepFormStepSchema<\n step,\n casing,\n resolvedStep,\n stepNumbers,\n storageKey\n >;\n storage: MultiStepFormStorage<resolvedStep, storageKey>;\n private mountCount = 0;\n\n constructor(\n options: MultiStepFormSchemaOptions<\n step,\n // Allows full autocomplete\n Constrain<casing, CasingType>,\n storageKey\n >\n ) {\n super();\n\n const { steps, nameTransformCasing, storage } = options;\n\n this.defaultNameTransformationCasing = setCasingType(\n nameTransformCasing\n ) as casing;\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n this.stepSchema = new MultiStepFormStepSchema({\n steps,\n nameTransformCasing: this.defaultNameTransformationCasing,\n });\n this.storage = new MultiStepFormStorage<resolvedStep, storageKey>({\n key: (storage?.key ?? DEFAULT_STORAGE_KEY) as storageKey,\n data: this.stepSchema.value as never,\n store: storage?.store,\n throwWhenUndefined: storage?.throwWhenUndefined ?? false,\n });\n\n this.stepSchema.subscribe(() => {\n this.notify();\n });\n }\n\n getSnapshot() {\n return this;\n }\n\n mount() {\n this.mountCount++;\n\n if (this.mountCount === 1) {\n this.onMount();\n }\n\n return () => {\n this.unmount();\n };\n }\n\n unmount() {\n this.mountCount = Math.max(0, this.mountCount - 1);\n\n if (this.mountCount === 0) {\n this.onUnmount();\n }\n }\n\n isMounted() {\n return this.mountCount > 0;\n }\n\n protected onMount() {}\n protected onUnmount() {}\n\n protected notify() {\n for (const listener of this.listeners) {\n listener({\n nameTransformCasing: this.defaultNameTransformationCasing,\n storage: {\n key: this.storage.key,\n store: this.storage.store,\n },\n steps: this.stepSchema.original,\n });\n }\n }\n}\n\nexport function createMultiStepFormSchema<\n step extends Step<casing>,\n casing extends CasingType = DefaultCasing,\n resolvedStep extends ResolvedStep<step, casing> = ResolvedStep<step, casing>,\n stepNumbers extends StepNumbers<resolvedStep> = StepNumbers<resolvedStep>,\n storageKey extends string = DefaultStorageKey\n>(\n options: MultiStepFormSchemaOptions<\n step,\n // Allows full autocomplete\n Constrain<casing, CasingType>,\n storageKey\n >\n) {\n return new MultiStepFormSchema<\n step,\n casing,\n resolvedStep,\n stepNumbers,\n storageKey\n >(options);\n}\n"],"mappings":";;;;;;;AA+BA,IAAa,sBAAb,cAMU,aAAoE;CAC5E,AAAS;CACT,AAAS;CAOT;CACA,AAAQ,aAAa;CAErB,YACE,SAMA;AACA,SAAO;EAEP,MAAM,EAAE,OAAO,qBAAqB,YAAY;AAEhD,OAAK,kCAAkC,cACrC,oBACD;AAED,OAAK,aAAa,IAAI,wBAAwB;GAC5C;GACA,qBAAqB,KAAK;GAC3B,CAAC;AACF,OAAK,UAAU,IAAI,qBAA+C;GAChE,KAAM,SAAS,OAAO;GACtB,MAAM,KAAK,WAAW;GACtB,OAAO,SAAS;GAChB,oBAAoB,SAAS,sBAAsB;GACpD,CAAC;AAEF,OAAK,WAAW,gBAAgB;AAC9B,QAAK,QAAQ;IACb;;CAGJ,cAAc;AACZ,SAAO;;CAGT,QAAQ;AACN,OAAK;AAEL,MAAI,KAAK,eAAe,EACtB,MAAK,SAAS;AAGhB,eAAa;AACX,QAAK,SAAS;;;CAIlB,UAAU;AACR,OAAK,aAAa,KAAK,IAAI,GAAG,KAAK,aAAa,EAAE;AAElD,MAAI,KAAK,eAAe,EACtB,MAAK,WAAW;;CAIpB,YAAY;AACV,SAAO,KAAK,aAAa;;CAG3B,AAAU,UAAU;CACpB,AAAU,YAAY;CAEtB,AAAU,SAAS;AACjB,OAAK,MAAM,YAAY,KAAK,UAC1B,UAAS;GACP,qBAAqB,KAAK;GAC1B,SAAS;IACP,KAAK,KAAK,QAAQ;IAClB,OAAO,KAAK,QAAQ;IACrB;GACD,OAAO,KAAK,WAAW;GACxB,CAAC;;;AAKR,SAAgB,0BAOd,SAMA;AACA,QAAO,IAAI,oBAMT,QAAQ"}
@@ -1,23 +0,0 @@
1
- const require_path = require('../utils/path.cjs');
2
- require('../_internals.cjs');
3
-
4
- //#region src/steps/fields.ts
5
- let fields;
6
- (function(_fields) {
7
- function resolvedDeepPath(fieldPath, fields$1, filler = "defaultValue") {
8
- const [parent, ...children] = fieldPath.split(".");
9
- const shared = `${parent}.${filler}`;
10
- const fullPath = children.length === 0 ? shared : `${shared}.${children.join(".")}`;
11
- return require_path.path.pickBy(fields$1, fullPath);
12
- }
13
- _fields.resolvedDeepPath = resolvedDeepPath;
14
- })(fields || (fields = {}));
15
-
16
- //#endregion
17
- Object.defineProperty(exports, 'fields', {
18
- enumerable: true,
19
- get: function () {
20
- return fields;
21
- }
22
- });
23
- //# sourceMappingURL=fields.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fields.cjs","names":["path","fields"],"sources":["../../src/steps/fields.ts"],"sourcesContent":["import { path } from '@/internals';\nimport type { DeepKeys, Join, Split } from '@/utils';\nimport type { AnyResolvedStep, GetFieldsForStep } from './types';\n\nexport namespace fields {\n type GetDeepFields<TFields> = [keyof TFields] extends [never]\n ? never\n : {\n [_ in keyof TFields]: TFields[_] extends Record<\n 'defaultValue',\n infer value\n >\n ? keyof value extends never\n ? TFields\n : DeepKeys<{ [field in _]: TFields[_]['defaultValue'] }>\n : never;\n }[keyof TFields];\n export type get<\n TResolvedStep extends AnyResolvedStep,\n TStep extends keyof TResolvedStep,\n TFields extends GetFieldsForStep<TResolvedStep, TStep> = GetFieldsForStep<\n TResolvedStep,\n TStep\n >\n > = TFields;\n export type removeParentPath<T extends string> = Split<T, '.'> extends [\n infer _,\n ...infer rest\n ]\n ? rest extends string[]\n ? Join<rest, '.'>\n : never\n : never;\n export type getDeep<\n TResolvedStep extends AnyResolvedStep,\n TStep extends keyof TResolvedStep\n > = GetDeepFields<\n get<TResolvedStep, TStep>\n > extends infer value extends string\n ? value\n : never;\n export type parentOf<T extends string> = Split<T, '.'>[0];\n export type resolveDeepPath<\n TResolvedStep extends AnyResolvedStep,\n TTargetStep extends keyof TResolvedStep,\n TField extends getDeep<TResolvedStep, TTargetStep>,\n TParent extends parentOf<TField> = parentOf<TField>,\n TDefaultValue = get<TResolvedStep, TTargetStep>[TParent]['defaultValue']\n > = removeParentPath<TField> extends never\n ? TDefaultValue\n : path.pickBy<TDefaultValue, removeParentPath<TField>>;\n\n // TODO add field validation\n export function resolvedDeepPath<\n resolvedStep extends AnyResolvedStep,\n targetStep extends keyof resolvedStep,\n fields extends get<resolvedStep, targetStep>,\n fieldPath extends getDeep<resolvedStep, targetStep>\n >(fieldPath: fieldPath, fields: fields, filler = 'defaultValue') {\n const [parent, ...children] = fieldPath.split('.');\n const shared = `${parent}.${filler}`;\n const fullPath = (\n children.length === 0 ? shared : `${shared}.${children.join('.')}`\n ) as DeepKeys<fields>;\n\n const resolvedValue = path.pickBy(fields, fullPath) as resolveDeepPath<\n resolvedStep,\n targetStep,\n fieldPath\n >;\n\n return resolvedValue;\n }\n}\n"],"mappings":";;;;;;CAqDS,SAAS,iBAKd,WAAsB,UAAgB,SAAS,gBAAgB;EAC/D,MAAM,CAAC,QAAQ,GAAG,YAAY,UAAU,MAAM,IAAI;EAClD,MAAM,SAAS,GAAG,OAAO,GAAG;EAC5B,MAAM,WACJ,SAAS,WAAW,IAAI,SAAS,GAAG,OAAO,GAAG,SAAS,KAAK,IAAI;AASlE,SANsBA,kBAAK,OAAOC,UAAQ,SAAS"}
@@ -1,18 +0,0 @@
1
- import { DeepKeys, Join, Split } from "../utils/types.cjs";
2
- import { path } from "../utils/path.cjs";
3
- import { AnyResolvedStep, GetFieldsForStep } from "./types.cjs";
4
-
5
- //#region src/steps/fields.d.ts
6
- declare namespace fields {
7
- type GetDeepFields<TFields> = [keyof TFields] extends [never] ? never : { [_ in keyof TFields]: TFields[_] extends Record<'defaultValue', infer value> ? keyof value extends never ? TFields : DeepKeys<{ [field in _]: TFields[_]['defaultValue'] }> : never }[keyof TFields];
8
- export type get<TResolvedStep extends AnyResolvedStep, TStep extends keyof TResolvedStep, TFields extends GetFieldsForStep<TResolvedStep, TStep> = GetFieldsForStep<TResolvedStep, TStep>> = TFields;
9
- export type removeParentPath<T extends string> = Split<T, '.'> extends [infer _, ...infer rest] ? rest extends string[] ? Join<rest, '.'> : never : never;
10
- export type getDeep<TResolvedStep extends AnyResolvedStep, TStep extends keyof TResolvedStep> = GetDeepFields<get<TResolvedStep, TStep>> extends infer value extends string ? value : never;
11
- export type parentOf<T extends string> = Split<T, '.'>[0];
12
- export type resolveDeepPath<TResolvedStep extends AnyResolvedStep, TTargetStep extends keyof TResolvedStep, TField extends getDeep<TResolvedStep, TTargetStep>, TParent extends parentOf<TField> = parentOf<TField>, TDefaultValue = get<TResolvedStep, TTargetStep>[TParent]['defaultValue']> = removeParentPath<TField> extends never ? TDefaultValue : path.pickBy<TDefaultValue, removeParentPath<TField>>;
13
- export function resolvedDeepPath<resolvedStep extends AnyResolvedStep, targetStep extends keyof resolvedStep, fields$1 extends get<resolvedStep, targetStep>, fieldPath extends getDeep<resolvedStep, targetStep>>(fieldPath: fieldPath, fields: fields$1, filler?: string): resolveDeepPath<resolvedStep, targetStep, fieldPath, parentOf<fieldPath>, GetFieldsForStep<resolvedStep, targetStep>[parentOf<fieldPath>]["defaultValue"]>;
14
- export {};
15
- }
16
- //#endregion
17
- export { f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BZ,EAAA,oBAAA,MA8BgB,aA9BhB,EAAA,eA+BK,OA/BL,CA+Ba,aA/Bb,EA+B4B,WA/B5B,CAAA,EAAA,gBAgCM,QAhCN,CAgCe,MAhCf,CAAA,GAgCyB,QAhCzB,CAgCkC,MAhClC,CAAA,EAAA,gBAiCM,GAjCN,CAiCU,aAjCV,EAiCyB,WAjCzB,CAAA,CAiCsC,OAjCtC,CAAA,CAAA,cAAA,CAAA,CAAA,GAkCR,gBAlCQ,CAkCS,MAlCT,CAAA,SAAA,KAAA,GAmCR,aAnCQ,GAoCR,IAAA,CAAK,MApCG,CAoCI,aApCJ,EAoCmB,gBApCnB,CAoCoC,MApCpC,CAAA,CAAA;EAEA,OAAA,SAAA,gBAAA,CAAA,qBAsCW,eAtCX,EAAA,mBAAA,MAuCe,YAvCf,EAAA,iBAwCK,GAxCL,CAwCS,YAxCT,EAwCuB,UAxCvB,CAAA,EAAA,kBAyCQ,OAzCR,CAyCgB,YAzChB,EAyC8B,UAzC9B,CAAA,CAAA,CAAA,SAAA,EA0CC,SA1CD,EAAA,MAAA,EA0CoB,QA1CpB,EAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EA0CmD,eA1CnD,CA0CmD,YA1CnD,EA0CmD,UA1CnD,EA0CmD,SA1CnD,EA0CmD,QA1CnD,CA0CmD,SA1CnD,CAAA,EA0CmD,gBA1CnD,CA0CmD,YA1CnD,EA0CmD,UA1CnD,CAAA,CA0CmD,QA1CnD,CA0CmD,SA1CnD,CAAA,CAAA,CAAA,cAAA,CAAA,CAAA;EAEY"}
@@ -1,18 +0,0 @@
1
- import { DeepKeys, Join, Split } from "../utils/types.mjs";
2
- import { path } from "../utils/path.mjs";
3
- import { AnyResolvedStep, GetFieldsForStep } from "./types.mjs";
4
-
5
- //#region src/steps/fields.d.ts
6
- declare namespace fields {
7
- type GetDeepFields<TFields> = [keyof TFields] extends [never] ? never : { [_ in keyof TFields]: TFields[_] extends Record<'defaultValue', infer value> ? keyof value extends never ? TFields : DeepKeys<{ [field in _]: TFields[_]['defaultValue'] }> : never }[keyof TFields];
8
- export type get<TResolvedStep extends AnyResolvedStep, TStep extends keyof TResolvedStep, TFields extends GetFieldsForStep<TResolvedStep, TStep> = GetFieldsForStep<TResolvedStep, TStep>> = TFields;
9
- export type removeParentPath<T extends string> = Split<T, '.'> extends [infer _, ...infer rest] ? rest extends string[] ? Join<rest, '.'> : never : never;
10
- export type getDeep<TResolvedStep extends AnyResolvedStep, TStep extends keyof TResolvedStep> = GetDeepFields<get<TResolvedStep, TStep>> extends infer value extends string ? value : never;
11
- export type parentOf<T extends string> = Split<T, '.'>[0];
12
- export type resolveDeepPath<TResolvedStep extends AnyResolvedStep, TTargetStep extends keyof TResolvedStep, TField extends getDeep<TResolvedStep, TTargetStep>, TParent extends parentOf<TField> = parentOf<TField>, TDefaultValue = get<TResolvedStep, TTargetStep>[TParent]['defaultValue']> = removeParentPath<TField> extends never ? TDefaultValue : path.pickBy<TDefaultValue, removeParentPath<TField>>;
13
- export function resolvedDeepPath<resolvedStep extends AnyResolvedStep, targetStep extends keyof resolvedStep, fields$1 extends get<resolvedStep, targetStep>, fieldPath extends getDeep<resolvedStep, targetStep>>(fieldPath: fieldPath, fields: fields$1, filler?: string): resolveDeepPath<resolvedStep, targetStep, fieldPath, parentOf<fieldPath>, GetFieldsForStep<resolvedStep, targetStep>[parentOf<fieldPath>]["defaultValue"]>;
14
- export {};
15
- }
16
- //#endregion
17
- export { fields };
18
- //# sourceMappingURL=fields.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fields.d.mts","names":[],"sources":["../../src/steps/fields.ts"],"sourcesContent":[],"mappings":";;;;;kBAIiB,MAAA;uCACsB,2CADhB,MAIH,OAJG,GAIO,OAJP,CAIe,CAJf,CAAA,SAI0B,MAJ1B,CAAA,cAAA,EAAA,KAAA,MAAA,CAAA,GAAA,MAQL,KARK,SAAA,KAAA,GAST,OATS,GAUT,QAVS,CAAA,YAUY,CATI,GASA,OATA,CASQ,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AmCR,aAnCQ,GAoCR,IAAA,CAAK,MApCG,CAoCI,aApCJ,EAoCmB,gBApCnB,CAoCoC,MApCpC,CAAA,CAAA;EAEA,OAAA,SAAA,gBAAA,CAAA,qBAsCW,eAtCX,EAAA,mBAAA,MAuCe,YAvCf,EAAA,iBAwCK,GAxCL,CAwCS,YAxCT,EAwCuB,UAxCvB,CAAA,EAAA,kBAyCQ,OAzCR,CAyCgB,YAzChB,EAyC8B,UAzC9B,CAAA,CAAA,CAAA,SAAA,EA0CC,SA1CD,EAAA,MAAA,EA0CoB,QA1CpB,EAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EA0CmD,eA1CnD,CA0CmD,YA1CnD,EA0CmD,UA1CnD,EA0CmD,SA1CnD,EA0CmD,QA1CnD,CA0CmD,SA1CnD,CAAA,EA0CmD,gBA1CnD,CA0CmD,YA1CnD,EA0CmD,UA1CnD,CAAA,CA0CmD,QA1CnD,CA0CmD,SA1CnD,CAAA,CAAA,CAAA,cAAA,CAAA,CAAA;EAEY"}
@@ -1,18 +0,0 @@
1
- import { path } from "../utils/path.mjs";
2
- import "../_internals.mjs";
3
-
4
- //#region src/steps/fields.ts
5
- let fields;
6
- (function(_fields) {
7
- function resolvedDeepPath(fieldPath, fields$1, filler = "defaultValue") {
8
- const [parent, ...children] = fieldPath.split(".");
9
- const shared = `${parent}.${filler}`;
10
- const fullPath = children.length === 0 ? shared : `${shared}.${children.join(".")}`;
11
- return path.pickBy(fields$1, fullPath);
12
- }
13
- _fields.resolvedDeepPath = resolvedDeepPath;
14
- })(fields || (fields = {}));
15
-
16
- //#endregion
17
- export { fields };
18
- //# sourceMappingURL=fields.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fields.mjs","names":["fields"],"sources":["../../src/steps/fields.ts"],"sourcesContent":["import { path } from '@/internals';\nimport type { DeepKeys, Join, Split } from '@/utils';\nimport type { AnyResolvedStep, GetFieldsForStep } from './types';\n\nexport namespace fields {\n type GetDeepFields<TFields> = [keyof TFields] extends [never]\n ? never\n : {\n [_ in keyof TFields]: TFields[_] extends Record<\n 'defaultValue',\n infer value\n >\n ? keyof value extends never\n ? TFields\n : DeepKeys<{ [field in _]: TFields[_]['defaultValue'] }>\n : never;\n }[keyof TFields];\n export type get<\n TResolvedStep extends AnyResolvedStep,\n TStep extends keyof TResolvedStep,\n TFields extends GetFieldsForStep<TResolvedStep, TStep> = GetFieldsForStep<\n TResolvedStep,\n TStep\n >\n > = TFields;\n export type removeParentPath<T extends string> = Split<T, '.'> extends [\n infer _,\n ...infer rest\n ]\n ? rest extends string[]\n ? Join<rest, '.'>\n : never\n : never;\n export type getDeep<\n TResolvedStep extends AnyResolvedStep,\n TStep extends keyof TResolvedStep\n > = GetDeepFields<\n get<TResolvedStep, TStep>\n > extends infer value extends string\n ? value\n : never;\n export type parentOf<T extends string> = Split<T, '.'>[0];\n export type resolveDeepPath<\n TResolvedStep extends AnyResolvedStep,\n TTargetStep extends keyof TResolvedStep,\n TField extends getDeep<TResolvedStep, TTargetStep>,\n TParent extends parentOf<TField> = parentOf<TField>,\n TDefaultValue = get<TResolvedStep, TTargetStep>[TParent]['defaultValue']\n > = removeParentPath<TField> extends never\n ? TDefaultValue\n : path.pickBy<TDefaultValue, removeParentPath<TField>>;\n\n // TODO add field validation\n export function resolvedDeepPath<\n resolvedStep extends AnyResolvedStep,\n targetStep extends keyof resolvedStep,\n fields extends get<resolvedStep, targetStep>,\n fieldPath extends getDeep<resolvedStep, targetStep>\n >(fieldPath: fieldPath, fields: fields, filler = 'defaultValue') {\n const [parent, ...children] = fieldPath.split('.');\n const shared = `${parent}.${filler}`;\n const fullPath = (\n children.length === 0 ? shared : `${shared}.${children.join('.')}`\n ) as DeepKeys<fields>;\n\n const resolvedValue = path.pickBy(fields, fullPath) as resolveDeepPath<\n resolvedStep,\n targetStep,\n fieldPath\n >;\n\n return resolvedValue;\n }\n}\n"],"mappings":";;;;;;CAqDS,SAAS,iBAKd,WAAsB,UAAgB,SAAS,gBAAgB;EAC/D,MAAM,CAAC,QAAQ,GAAG,YAAY,UAAU,MAAM,IAAI;EAClD,MAAM,SAAS,GAAG,OAAO,GAAG;EAC5B,MAAM,WACJ,SAAS,WAAW,IAAI,SAAS,GAAG,OAAO,GAAG,SAAS,KAAK,IAAI;AASlE,SANsB,KAAK,OAAOA,UAAQ,SAAS"}
@@ -1,4 +0,0 @@
1
- const require_utils = require('./utils.cjs');
2
- const require_fields = require('./fields.cjs');
3
- const require_schema = require('./schema.cjs');
4
- const require_types = require('./types.cjs');
@@ -1,6 +0,0 @@
1
- import { createCtx } from "./utils.mjs";
2
- import { fields } from "./fields.mjs";
3
- import { MultiStepFormStepSchema } from "./schema.mjs";
4
- import { HelperFnChosenSteps } from "./types.mjs";
5
-
6
- export { };
@@ -1,194 +0,0 @@
1
- const require_invariant = require('../utils/invariant.cjs');
2
- const require_utils = require('./utils.cjs');
3
- const require_casing = require('../utils/casing.cjs');
4
- const require_field_types = require('../utils/field-types.cjs');
5
- const require_utils$1 = require('../internals/utils.cjs');
6
- const require_step_schema = require('../internals/step-schema.cjs');
7
- const require_storage = require('../storage.cjs');
8
- const require_subscribable = require('../subscribable.cjs');
9
- const require_fields = require('./fields.cjs');
10
-
11
- //#region src/steps/schema.ts
12
- /**
13
- * Available transformation types for the step numbers.
14
- */
15
- const AS_TYPES = [
16
- "string",
17
- "number",
18
- "array.string",
19
- "array.string.untyped"
20
- ];
21
- function assertObjectFields(obj, checks) {
22
- if (typeof obj !== "object" || obj === null) return false;
23
- for (const key of Object.keys(checks)) {
24
- if (!(key in obj)) return false;
25
- const checkFn = checks[key];
26
- const value = obj[key];
27
- if (!checkFn(value)) return false;
28
- }
29
- return true;
30
- }
31
- var MultiStepFormStepSchema = class extends require_subscribable.Subscribable {
32
- /**
33
- * The original config before any validation or transformations have been applied.
34
- */
35
- original;
36
- /**
37
- * The resolved step values.
38
- */
39
- value;
40
- steps;
41
- defaultNameTransformationCasing;
42
- firstStep;
43
- lastStep;
44
- stepNumbers;
45
- storage;
46
- #internal;
47
- constructor(config) {
48
- super();
49
- const { steps, nameTransformCasing, storage } = config;
50
- this.defaultNameTransformationCasing = require_casing.setCasingType(nameTransformCasing);
51
- this.original = steps;
52
- this.value = require_utils$1.createStep(this.original);
53
- this.storage = new require_storage.MultiStepFormStorage({
54
- data: this.value,
55
- key: storage?.key ?? require_storage.DEFAULT_STORAGE_KEY,
56
- store: storage?.store,
57
- throwWhenUndefined: storage?.throwWhenUndefined ?? false
58
- });
59
- this.#internal = new require_step_schema.MultiStepFormStepSchemaInternal({
60
- originalValue: this.original,
61
- getValue: () => this.value,
62
- setValue: (next) => this.handlePostUpdate(next)
63
- });
64
- this.value = this.#internal.enrichValues(this.value);
65
- this.stepNumbers = Object.keys(this.value).map((key) => Number.parseInt(key.replace("step", "")));
66
- this.firstStep = this.first();
67
- this.lastStep = this.last();
68
- this.steps = {
69
- first: this.firstStep.step,
70
- last: this.lastStep.step,
71
- value: this.stepNumbers,
72
- as: (asType) => {
73
- require_invariant.invariant(typeof asType === "string", `The type of the target transformation type must be a string, was ${typeof asType}`);
74
- if (asType === "string") return this.stepNumbers.map((value) => `'${value}'`).join(" | ");
75
- if (asType === "number") return this.stepNumbers.join(" | ");
76
- if (asType.includes("array.string")) return this.stepNumbers.map((value) => `${value}`);
77
- throw new Error(`Transformation type "${asType}" is not supported. Available transformations include: ${AS_TYPES.map((value) => `"${value}"`).join(", ")}`);
78
- },
79
- isValidStepNumber: (stepNumber) => this.stepNumbers.includes(stepNumber),
80
- isValidStepKey: (value) => require_utils$1.isValidStepKey(this.value, value)
81
- };
82
- this.sync();
83
- }
84
- /**
85
- * @internal
86
- */
87
- __getStorage() {
88
- return this.storage;
89
- }
90
- getSnapshot() {
91
- return this;
92
- }
93
- /**
94
- * Syncs the values from storage to {@linkcode value}.
95
- */
96
- sync() {
97
- const storageValues = this.__getStorage().get();
98
- if (storageValues) this.value = { ...this.#internal.enrichValues(storageValues) };
99
- }
100
- notify() {
101
- for (const listener of this.listeners) listener({
102
- defaultNameTransformationCasing: this.defaultNameTransformationCasing,
103
- original: this.original,
104
- steps: this.steps,
105
- value: this.value
106
- });
107
- }
108
- /**
109
- * Gets the data for a specific step.
110
- * @param options The options for getting the step data.
111
- * @returns The step data for the target step.
112
- */
113
- get(options) {
114
- return require_utils.getStep(this.value)(options);
115
- }
116
- /**
117
- * Gets the data for the first step.
118
- * @returns The data for the first step.
119
- */
120
- first() {
121
- const firstStep = Math.min(...this.stepNumbers);
122
- return this.get({ step: firstStep });
123
- }
124
- /**
125
- * Gets the data for the last step.
126
- * @returns The data for the last step.
127
- */
128
- last() {
129
- const lastStep = Math.max(...this.stepNumbers);
130
- return this.get({ step: lastStep });
131
- }
132
- handlePostUpdate(next) {
133
- this.value = { ...next };
134
- this.__getStorage().add(this.value);
135
- this.sync();
136
- this.notify();
137
- }
138
- update(options) {
139
- this.#internal.update(options);
140
- }
141
- reset(options) {
142
- this.#internal.reset(options);
143
- }
144
- createHelperFn(options, fn) {
145
- const { stepData, ...rest } = options;
146
- return this.#internal.createStepHelperFn(stepData)(rest, fn);
147
- }
148
- /**
149
- * Validates that a given object is the proper shape for step data.
150
- * @param value
151
- */
152
- static hasData(value, options) {
153
- if (value === null || typeof value !== "object") return false;
154
- return assertObjectFields(value, {
155
- title: (v) => typeof v === "string",
156
- fields: (v) => {
157
- if (v === null || typeof v !== "object") return false;
158
- for (const key of Object.keys(v)) {
159
- if (typeof key !== "string" || !(key in v)) return false;
160
- const current = v[key];
161
- if (current === null || typeof current !== "object") return false;
162
- if (!assertObjectFields(current, {
163
- defaultValue: (v$1) => v$1 !== "undefined" && v$1 !== null,
164
- label: (v$1) => typeof v$1 === "string" || typeof v$1 === "boolean" && !v$1,
165
- nameTransformCasing: require_casing.isCasingValid,
166
- type: require_field_types.isFieldType
167
- })) return false;
168
- }
169
- return true;
170
- },
171
- createHelperFn: (v) => typeof v === "function",
172
- nameTransformCasing: require_casing.isCasingValid,
173
- ...options?.optionalKeysToCheck
174
- });
175
- }
176
- /**
177
- * Gets the value of a given field for a given step.
178
- * @param step The step to get the value from.
179
- * @param field The field to get the value from.
180
- * @returns The value of the {@linkcode field}.
181
- */
182
- getValue(step, field) {
183
- const stepData = this.value[step];
184
- const baseErrorMessage = `Unable to get the value for "${String(step)}.fields.${String(field)}"`;
185
- require_invariant.invariant("fields" in stepData, baseErrorMessage);
186
- require_invariant.invariant(typeof stepData.fields === "object", `${baseErrorMessage} because "fields" is not an object. This shouldn't be the case, so please open an issue`);
187
- const fields$1 = stepData.fields;
188
- return require_fields.fields.resolvedDeepPath(field, fields$1);
189
- }
190
- };
191
-
192
- //#endregion
193
- exports.MultiStepFormStepSchema = MultiStepFormStepSchema;
194
- //# sourceMappingURL=schema.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.cjs","names":["Subscribable","#internal","setCasingType","createStep","MultiStepFormStorage","DEFAULT_STORAGE_KEY","MultiStepFormStepSchemaInternal","isValidStepKey","getStep","v","isCasingValid","isFieldType","fields","fieldsUtils"],"sources":["../../src/steps/schema.ts"],"sourcesContent":["import { MultiStepFormStepSchemaInternal } from '@/internals/step-schema';\nimport {\n DEFAULT_STORAGE_KEY,\n DefaultStorageKey,\n MultiStepFormStorage,\n} from '@/storage';\nimport {\n isCasingValid,\n isFieldType,\n setCasingType,\n type CasingType,\n type Constrain,\n type DefaultCasing,\n type Expand,\n type Join,\n} from '@/utils';\nimport { invariant } from '@/utils/invariant';\nimport { Subscribable } from '../subscribable';\nimport { fields as fieldsUtils } from './fields';\nimport {\n AnyResolvedStep,\n AnyStepField,\n AnyStepFieldOption,\n CreateHelperFunctionOptionsWithCustomCtxOptions,\n CreateHelperFunctionOptionsWithValidator,\n CreateHelperFunctionOptionsWithoutValidator,\n CreateStepHelperFn,\n CreatedHelperFnWithInput,\n CreatedHelperFnWithoutInput,\n ExtractStepFromKey,\n FirstStep,\n GetCurrentStep,\n HelperFnChosenSteps,\n HelperFnWithValidator,\n HelperFnWithoutValidator,\n InferStepOptions,\n LastStep,\n MultiStepFormSchemaStepConfig,\n ResolvedFields,\n ResolvedStep,\n Step,\n StepData,\n StepNumbers,\n StepOptions,\n UnionToTuple,\n UpdateFn,\n ValidStepKey,\n type ResetFn,\n} from './types';\nimport { getStep, type GetStepOptions } from './utils';\nimport { createStep, isValidStepKey } from '@/internals/utils';\n\nexport interface MultiStepFormStepSchemaFunctions<\n TResolvedStep extends AnyResolvedStep,\n TStepNumbers extends StepNumbers<TResolvedStep>\n> {\n update: UpdateFn.general<TResolvedStep, TStepNumbers>;\n createHelperFn: CreateStepHelperFn<TResolvedStep, TStepNumbers>;\n}\nexport type AsType = (typeof AS_TYPES)[number];\ntype Quote<T extends string[]> = {\n [K in keyof T]: T[K] extends string ? `'${T[K]}'` : never;\n};\nexport type AsTypeMap<\n resolvedStep extends AnyResolvedStep,\n stepNumbers extends ExtractStepFromKey<Constrain<keyof resolvedStep, string>>\n> = {\n // Exclude is needed due to all the Constrains\n string: Exclude<\n Join<\n Constrain<\n Quote<Constrain<UnionToTuple<`${stepNumbers}`>, string[]>>,\n string[]\n >,\n ' | '\n >,\n ''\n >;\n number: Exclude<\n Join<Constrain<UnionToTuple<`${stepNumbers}`>, string[]>, ' | '>,\n ''\n >;\n 'array.string': UnionToTuple<`${stepNumbers}`>;\n 'array.string.untyped': string[];\n};\nexport type AsFunctionReturn<\n resolvedStep extends AnyResolvedStep,\n stepNumbers extends ExtractStepFromKey<Constrain<keyof resolvedStep, string>>,\n asType extends AsType\n> = AsTypeMap<resolvedStep, stepNumbers>[asType];\nexport type AsFunction<\n resolvedStep extends AnyResolvedStep,\n stepNumbers extends ExtractStepFromKey<Constrain<keyof resolvedStep, string>>\n> = <asType extends AsType>(\n asType: asType\n) => AsFunctionReturn<resolvedStep, stepNumbers, asType>;\nexport type MultiStepFormStepStepsConfig<\n TStep extends Step<TCasing>,\n TCasing extends CasingType,\n TResolvedStep extends ResolvedStep<TStep, TCasing> = ResolvedStep<\n TStep,\n TCasing\n >,\n TStepNumbers extends StepNumbers<TResolvedStep> = StepNumbers<TResolvedStep>\n> = {\n first: FirstStep<TResolvedStep>;\n last: LastStep<TResolvedStep>;\n value: ReadonlyArray<TStepNumbers>;\n as: AsFunction<TResolvedStep, TStepNumbers>;\n isValidStepNumber: (stepNumber: number) => stepNumber is TStepNumbers;\n isValidStepKey: (\n value: string\n ) => value is Constrain<keyof TResolvedStep, string>;\n};\nexport type MultiStepFormStepSchemaListener<\n TStep extends Step<TCasing>,\n TCasing extends CasingType\n> = (data: {\n original: InferStepOptions<TStep>;\n value: ResolvedStep<TStep, TCasing>;\n steps: MultiStepFormStepStepsConfig<TStep, TCasing>;\n defaultNameTransformationCasing: TCasing;\n}) => void;\n\n/**\n * Available transformation types for the step numbers.\n */\nconst AS_TYPES = [\n 'string',\n 'number',\n 'array.string',\n 'array.string.untyped',\n] as const;\n\ntype ValueCheck<T> = (v: unknown) => v is T;\n\ntype FieldChecks<T extends object> = {\n [K in keyof T]: ValueCheck<T[K]>;\n};\n\nfunction assertObjectFields<T extends object>(\n obj: unknown,\n checks: FieldChecks<T>\n): obj is T {\n if (typeof obj !== 'object' || obj === null) return false;\n\n for (const key of Object.keys(checks) as (keyof T)[]) {\n // Check that the property exists\n if (!(key in obj)) return false;\n\n // Now check the type\n const checkFn = checks[key];\n const value = (obj as any)[key];\n if (!checkFn(value)) return false;\n }\n\n return true;\n}\n\nexport class MultiStepFormStepSchema<\n step extends Step<casing>,\n casing extends CasingType = DefaultCasing,\n resolvedStep extends ResolvedStep<step, casing> = ResolvedStep<\n step,\n casing\n >,\n stepNumbers extends StepNumbers<resolvedStep> = StepNumbers<resolvedStep>,\n storageKey extends string = DefaultStorageKey\n >\n extends Subscribable<MultiStepFormStepSchemaListener<step, casing>>\n implements MultiStepFormStepSchemaFunctions<resolvedStep, stepNumbers>\n{\n /**\n * The original config before any validation or transformations have been applied.\n */\n readonly original: InferStepOptions<step>;\n /**\n * The resolved step values.\n */\n value: resolvedStep;\n readonly steps: MultiStepFormStepStepsConfig<step, casing>;\n readonly defaultNameTransformationCasing: casing;\n //@ts-ignore\n private readonly firstStep: StepData<resolvedStep, FirstStep<resolvedStep>>;\n private readonly lastStep: StepData<resolvedStep, LastStep<resolvedStep>>;\n private readonly stepNumbers: Array<number>;\n private readonly storage: MultiStepFormStorage<resolvedStep, storageKey>;\n readonly #internal: MultiStepFormStepSchemaInternal<\n step,\n casing,\n resolvedStep,\n stepNumbers\n >;\n\n constructor(\n config: MultiStepFormSchemaStepConfig<\n step,\n Constrain<casing, CasingType>,\n storageKey\n >\n ) {\n super();\n\n const { steps, nameTransformCasing, storage } = config;\n\n this.defaultNameTransformationCasing = setCasingType(\n nameTransformCasing\n ) as casing;\n\n this.original = steps;\n\n this.value = createStep<step, casing>(this.original) as resolvedStep;\n this.storage = new MultiStepFormStorage<resolvedStep, storageKey>({\n data: this.value,\n key: (storage?.key ?? DEFAULT_STORAGE_KEY) as storageKey,\n store: storage?.store,\n throwWhenUndefined: storage?.throwWhenUndefined ?? false,\n });\n this.#internal = new MultiStepFormStepSchemaInternal<\n step,\n casing,\n resolvedStep,\n stepNumbers\n >({\n originalValue: this.original,\n getValue: () => this.value,\n setValue: (next) => this.handlePostUpdate(next),\n });\n\n this.value = this.#internal.enrichValues(this.value);\n this.stepNumbers = Object.keys(this.value).map((key) =>\n Number.parseInt(key.replace('step', ''))\n );\n\n this.firstStep = this.first();\n this.lastStep = this.last();\n this.steps = {\n first: this.firstStep.step,\n last: this.lastStep.step,\n value: this.stepNumbers as unknown as ReadonlyArray<stepNumbers>,\n as: (asType): any => {\n invariant(\n typeof asType === 'string',\n `The type of the target transformation type must be a string, was ${typeof asType}`\n );\n\n if (asType === 'string') {\n return this.stepNumbers.map((value) => `'${value}'`).join(' | ');\n }\n\n if (asType === 'number') {\n return this.stepNumbers.join(' | ');\n }\n\n if (asType.includes('array.string')) {\n return this.stepNumbers.map((value) => `${value}`);\n }\n\n throw new Error(\n `Transformation type \"${asType}\" is not supported. Available transformations include: ${AS_TYPES.map(\n (value) => `\"${value}\"`\n ).join(', ')}`\n );\n },\n isValidStepNumber: (stepNumber): stepNumber is stepNumbers =>\n this.stepNumbers.includes(stepNumber),\n isValidStepKey: (value) =>\n isValidStepKey<resolvedStep>(this.value, value),\n };\n\n this.sync();\n }\n\n /**\n * @internal\n */\n __getStorage() {\n return this.storage;\n }\n\n getSnapshot() {\n return this;\n }\n\n /**\n * Syncs the values from storage to {@linkcode value}.\n */\n sync() {\n // TODO add \"syncOptions\" so caller can chose where to sync from ('storage' | 'instance')\n const storageValues = this.__getStorage().get();\n\n if (storageValues) {\n const enrichedValues = this.#internal.enrichValues(storageValues);\n\n this.value = { ...enrichedValues };\n }\n }\n\n protected notify() {\n for (const listener of this.listeners) {\n listener({\n defaultNameTransformationCasing: this.defaultNameTransformationCasing,\n original: this.original,\n steps: this.steps,\n value: this.value,\n });\n }\n }\n\n /**\n * Gets the data for a specific step.\n * @param options The options for getting the step data.\n * @returns The step data for the target step.\n */\n get<stepNumber extends stepNumbers>(\n options: GetStepOptions<resolvedStep, stepNumbers, stepNumber>\n ) {\n return getStep(this.value)(options);\n }\n\n /**\n * Gets the data for the first step.\n * @returns The data for the first step.\n */\n first() {\n const firstStep = Math.min(...this.stepNumbers) as FirstStep<resolvedStep>;\n\n return this.get({ step: firstStep });\n }\n\n /**\n * Gets the data for the last step.\n * @returns The data for the last step.\n */\n last() {\n const lastStep = Math.max(...this.stepNumbers);\n\n return this.get<LastStep<resolvedStep>>({ step: lastStep as never });\n }\n\n protected handlePostUpdate(next: resolvedStep) {\n this.value = { ...next };\n\n this.__getStorage().add(this.value);\n this.sync();\n this.notify();\n }\n\n update<\n targetStep extends ValidStepKey<stepNumbers>,\n field extends UpdateFn.chosenFields<\n UpdateFn.resolvedStep<resolvedStep, stepNumbers, targetStep>\n > = 'all',\n strict extends boolean = true,\n partial extends boolean = false,\n additionalCtx extends Record<string, unknown> = {},\n additionalUpdaterData extends UpdateFn.additionalUpdaterData = never\n >(\n options: UpdateFn.options<\n resolvedStep,\n stepNumbers,\n targetStep,\n field,\n strict,\n partial,\n additionalCtx,\n additionalUpdaterData\n >\n ) {\n this.#internal.update(options);\n }\n\n reset<\n targetStep extends ValidStepKey<stepNumbers>,\n fields extends UpdateFn.chosenFields<currentStep>,\n currentStep extends UpdateFn.resolvedStep<\n resolvedStep,\n stepNumbers,\n targetStep\n >\n >(\n options: ResetFn.Options<\n resolvedStep,\n stepNumbers,\n targetStep,\n fields,\n currentStep\n >\n ) {\n this.#internal.reset(options);\n }\n\n /**\n * Create a helper function with validated input.\n */\n createHelperFn<\n const chosenSteps extends HelperFnChosenSteps<resolvedStep, stepNumbers>,\n validator,\n additionalCtx extends Record<string, unknown>,\n response\n >(\n options: CreateHelperFunctionOptionsWithValidator<\n resolvedStep,\n stepNumbers,\n chosenSteps,\n validator,\n additionalCtx\n >,\n fn: HelperFnWithValidator<\n resolvedStep,\n stepNumbers,\n chosenSteps,\n validator,\n additionalCtx,\n response\n >\n ): CreatedHelperFnWithInput<validator, response>;\n /**\n * Create a helper function without input.\n */\n createHelperFn<\n const chosenSteps extends HelperFnChosenSteps<resolvedStep, stepNumbers>,\n additionalCtx extends Record<string, unknown>,\n response\n >(\n options: CreateHelperFunctionOptionsWithoutValidator<\n resolvedStep,\n stepNumbers,\n chosenSteps\n > &\n CreateHelperFunctionOptionsWithCustomCtxOptions<\n resolvedStep,\n stepNumbers,\n chosenSteps,\n additionalCtx\n >,\n fn: HelperFnWithoutValidator<\n resolvedStep,\n stepNumbers,\n chosenSteps,\n additionalCtx,\n response\n >\n ): CreatedHelperFnWithoutInput<response>;\n // Implementation\n createHelperFn<\n const chosenSteps extends HelperFnChosenSteps<resolvedStep, stepNumbers>,\n response,\n additionalCtx extends Record<string, unknown>,\n validator = never\n >(\n options:\n | CreateHelperFunctionOptionsWithValidator<\n resolvedStep,\n stepNumbers,\n chosenSteps,\n validator,\n additionalCtx\n >\n | CreateHelperFunctionOptionsWithoutValidator<\n resolvedStep,\n stepNumbers,\n chosenSteps\n >,\n fn:\n | HelperFnWithValidator<\n resolvedStep,\n stepNumbers,\n chosenSteps,\n validator,\n additionalCtx,\n response\n >\n | HelperFnWithoutValidator<\n resolvedStep,\n stepNumbers,\n chosenSteps,\n additionalCtx,\n response\n >\n ) {\n const { stepData, ...rest } = options;\n\n return this.#internal.createStepHelperFn(stepData)(rest, fn);\n }\n\n /**\n * Validates that a given object is the proper shape for step data.\n * @param value\n */\n static hasData<\n step extends Step<casing>,\n resolvedStep extends ResolvedStep<step, casing>,\n stepNumbers extends StepNumbers<resolvedStep>,\n casing extends CasingType = DefaultCasing\n >(\n value: unknown,\n options?: {\n optionalKeysToCheck?: FieldChecks<\n Pick<StepOptions, 'description' | 'validateFields'>\n >;\n }\n ): value is GetCurrentStep<resolvedStep, stepNumbers> {\n if (value === null || typeof value !== 'object') {\n return false;\n }\n\n return assertObjectFields<\n | GetCurrentStep<resolvedStep, stepNumbers>\n | (Omit<StepOptions, 'fields'> & {\n fields: Expand<\n ResolvedFields<InferStepOptions<step>, keyof InferStepOptions<step>>\n >;\n })\n >(value, {\n title: (v) => typeof v === 'string',\n fields: (\n v\n ): v is Expand<\n ResolvedFields<InferStepOptions<step>, keyof InferStepOptions<step>>\n > => {\n if (v === null || typeof v !== 'object') {\n return false;\n }\n\n for (const key of Object.keys(v)) {\n if (typeof key !== 'string' || !(key in v)) {\n return false;\n }\n\n const current = (v as Record<string, unknown>)[key];\n\n if (current === null || typeof current !== 'object') {\n return false;\n }\n\n const hasField = assertObjectFields<AnyStepFieldOption>(current, {\n defaultValue: (v): v is {} => v !== 'undefined' && v !== null,\n label: (v) =>\n typeof v === 'string' || (typeof v === 'boolean' && !v),\n nameTransformCasing: isCasingValid,\n type: isFieldType,\n });\n\n if (!hasField) {\n return false;\n }\n }\n\n return true;\n },\n createHelperFn: (\n v\n ): v is GetCurrentStep<resolvedStep, stepNumbers>['createHelperFn'] =>\n typeof v === 'function',\n // update: (v): v is GetCurrentStep<resolvedStep, stepNumbers>['update'] =>\n // typeof v === 'function',\n nameTransformCasing: isCasingValid,\n ...options?.optionalKeysToCheck,\n });\n }\n\n /**\n * Gets the value of a given field for a given step.\n * @param step The step to get the value from.\n * @param field The field to get the value from.\n * @returns The value of the {@linkcode field}.\n */\n getValue<\n step extends keyof resolvedStep,\n field extends fieldsUtils.getDeep<resolvedStep, step>\n >(step: step, field: field) {\n const stepData = this.value[step];\n const baseErrorMessage = `Unable to get the value for \"${String(\n step\n )}.fields.${String(field)}\"`;\n\n invariant('fields' in stepData, baseErrorMessage);\n invariant(\n typeof stepData.fields === 'object',\n `${baseErrorMessage} because \"fields\" is not an object. This shouldn't be the case, so please open an issue`\n );\n\n const fields = stepData.fields as AnyStepField;\n\n const defaultValue = fieldsUtils.resolvedDeepPath<\n resolvedStep,\n step,\n fieldsUtils.get<resolvedStep, step>,\n field\n >(field, fields as fieldsUtils.get<resolvedStep, step>);\n\n return defaultValue;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA+HA,MAAM,WAAW;CACf;CACA;CACA;CACA;CACD;AAQD,SAAS,mBACP,KACA,QACU;AACV,KAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AAEpD,MAAK,MAAM,OAAO,OAAO,KAAK,OAAO,EAAiB;AAEpD,MAAI,EAAE,OAAO,KAAM,QAAO;EAG1B,MAAM,UAAU,OAAO;EACvB,MAAM,QAAS,IAAY;AAC3B,MAAI,CAAC,QAAQ,MAAM,CAAE,QAAO;;AAG9B,QAAO;;AAGT,IAAa,0BAAb,cAUUA,kCAEV;;;;CAIE,AAAS;;;;CAIT;CACA,AAAS;CACT,AAAS;CAET,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,CAASC;CAOT,YACE,QAKA;AACA,SAAO;EAEP,MAAM,EAAE,OAAO,qBAAqB,YAAY;AAEhD,OAAK,kCAAkCC,6BACrC,oBACD;AAED,OAAK,WAAW;AAEhB,OAAK,QAAQC,2BAAyB,KAAK,SAAS;AAC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YAAY,SACzC,QAAO;AAWT,SAAI,CARa,mBAAuC,SAAS;MAC/D,eAAe,QAAeQ,QAAM,eAAeA,QAAM;MACzD,QAAQ,QACN,OAAOA,QAAM,YAAa,OAAOA,QAAM,aAAa,CAACA;MACvD,qBAAqBC;MACrB,MAAMC;MACP,CAAC,CAGA,QAAO;;AAIX,WAAO;;GAET,iBACE,MAEA,OAAO,MAAM;GAGf,qBAAqBD;GACrB,GAAG,SAAS;GACb,CAAC;;;;;;;;CASJ,SAGE,MAAY,OAAc;EAC1B,MAAM,WAAW,KAAK,MAAM;EAC5B,MAAM,mBAAmB,gCAAgC,OACvD,KACD,CAAC,UAAU,OAAO,MAAM,CAAC;AAE1B,8BAAU,YAAY,UAAU,iBAAiB;AACjD,8BACE,OAAO,SAAS,WAAW,UAC3B,GAAG,iBAAiB,yFACrB;EAED,MAAME,WAAS,SAAS;AASxB,SAPqBC,sBAAY,iBAK/B,OAAOD,SAA8C"}
@@ -1,124 +0,0 @@
1
- import { DefaultStorageKey, MultiStepFormStorage } from "../storage.cjs";
2
- import { Constrain, Join } from "../utils/types.cjs";
3
- import { CasingType, DefaultCasing } from "../utils/casing.cjs";
4
- import { AnyResolvedStep, CreateHelperFunctionOptionsWithCustomCtxOptions, CreateHelperFunctionOptionsWithValidator, CreateHelperFunctionOptionsWithoutValidator, CreateStepHelperFn, CreatedHelperFnWithInput, CreatedHelperFnWithoutInput, ExtractStepFromKey, FirstStep, GetCurrentStep, GetFieldsForStep, HelperFnChosenSteps, HelperFnWithValidator, HelperFnWithoutValidator, InferStepOptions, LastStep, MultiStepFormSchemaStepConfig, ResetFn, ResolvedStep, Step, StepNumbers, StepOptions, UnionToTuple, UpdateFn, ValidStepKey } from "./types.cjs";
5
- import { Subscribable } from "../subscribable.cjs";
6
- import { fields } from "./fields.cjs";
7
- import { GetStepOptions } from "./utils.cjs";
8
-
9
- //#region src/steps/schema.d.ts
10
- interface MultiStepFormStepSchemaFunctions<TResolvedStep extends AnyResolvedStep, TStepNumbers extends StepNumbers<TResolvedStep>> {
11
- update: UpdateFn.general<TResolvedStep, TStepNumbers>;
12
- createHelperFn: CreateStepHelperFn<TResolvedStep, TStepNumbers>;
13
- }
14
- type AsType = (typeof AS_TYPES)[number];
15
- type Quote<T extends string[]> = { [K in keyof T]: T[K] extends string ? `'${T[K]}'` : never };
16
- type AsTypeMap<resolvedStep extends AnyResolvedStep, stepNumbers extends ExtractStepFromKey<Constrain<keyof resolvedStep, string>>> = {
17
- string: Exclude<Join<Constrain<Quote<Constrain<UnionToTuple<`${stepNumbers}`>, string[]>>, string[]>, ' | '>, ''>;
18
- number: Exclude<Join<Constrain<UnionToTuple<`${stepNumbers}`>, string[]>, ' | '>, ''>;
19
- 'array.string': UnionToTuple<`${stepNumbers}`>;
20
- 'array.string.untyped': string[];
21
- };
22
- type AsFunctionReturn<resolvedStep extends AnyResolvedStep, stepNumbers extends ExtractStepFromKey<Constrain<keyof resolvedStep, string>>, asType extends AsType> = AsTypeMap<resolvedStep, stepNumbers>[asType];
23
- type AsFunction<resolvedStep extends AnyResolvedStep, stepNumbers extends ExtractStepFromKey<Constrain<keyof resolvedStep, string>>> = <asType extends AsType>(asType: asType) => AsFunctionReturn<resolvedStep, stepNumbers, asType>;
24
- type MultiStepFormStepStepsConfig<TStep extends Step<TCasing>, TCasing extends CasingType, TResolvedStep extends ResolvedStep<TStep, TCasing> = ResolvedStep<TStep, TCasing>, TStepNumbers extends StepNumbers<TResolvedStep> = StepNumbers<TResolvedStep>> = {
25
- first: FirstStep<TResolvedStep>;
26
- last: LastStep<TResolvedStep>;
27
- value: ReadonlyArray<TStepNumbers>;
28
- as: AsFunction<TResolvedStep, TStepNumbers>;
29
- isValidStepNumber: (stepNumber: number) => stepNumber is TStepNumbers;
30
- isValidStepKey: (value: string) => value is Constrain<keyof TResolvedStep, string>;
31
- };
32
- type MultiStepFormStepSchemaListener<TStep extends Step<TCasing>, TCasing extends CasingType> = (data: {
33
- original: InferStepOptions<TStep>;
34
- value: ResolvedStep<TStep, TCasing>;
35
- steps: MultiStepFormStepStepsConfig<TStep, TCasing>;
36
- defaultNameTransformationCasing: TCasing;
37
- }) => void;
38
- /**
39
- * Available transformation types for the step numbers.
40
- */
41
- declare const AS_TYPES: readonly ["string", "number", "array.string", "array.string.untyped"];
42
- type ValueCheck<T> = (v: unknown) => v is T;
43
- type FieldChecks<T extends object> = { [K in keyof T]: ValueCheck<T[K]> };
44
- declare class MultiStepFormStepSchema<step extends Step<casing>, casing extends CasingType = DefaultCasing, resolvedStep extends ResolvedStep<step, casing> = ResolvedStep<step, casing>, stepNumbers extends StepNumbers<resolvedStep> = StepNumbers<resolvedStep>, storageKey extends string = DefaultStorageKey> extends Subscribable<MultiStepFormStepSchemaListener<step, casing>> implements MultiStepFormStepSchemaFunctions<resolvedStep, stepNumbers> {
45
- #private;
46
- /**
47
- * The original config before any validation or transformations have been applied.
48
- */
49
- readonly original: InferStepOptions<step>;
50
- /**
51
- * The resolved step values.
52
- */
53
- value: resolvedStep;
54
- readonly steps: MultiStepFormStepStepsConfig<step, casing>;
55
- readonly defaultNameTransformationCasing: casing;
56
- private readonly firstStep;
57
- private readonly lastStep;
58
- private readonly stepNumbers;
59
- private readonly storage;
60
- constructor(config: MultiStepFormSchemaStepConfig<step, Constrain<casing, CasingType>, storageKey>);
61
- /**
62
- * @internal
63
- */
64
- __getStorage(): MultiStepFormStorage<resolvedStep, storageKey>;
65
- getSnapshot(): this;
66
- /**
67
- * Syncs the values from storage to {@linkcode value}.
68
- */
69
- sync(): void;
70
- protected notify(): void;
71
- /**
72
- * Gets the data for a specific step.
73
- * @param options The options for getting the step data.
74
- * @returns The step data for the target step.
75
- */
76
- get<stepNumber extends stepNumbers>(options: GetStepOptions<resolvedStep, stepNumbers, stepNumber>): {
77
- step: stepNumber;
78
- data: GetCurrentStep<resolvedStep, stepNumber>;
79
- };
80
- /**
81
- * Gets the data for the first step.
82
- * @returns The data for the first step.
83
- */
84
- first(): {
85
- step: FirstStep<resolvedStep>;
86
- data: GetCurrentStep<resolvedStep, FirstStep<resolvedStep>>;
87
- };
88
- /**
89
- * Gets the data for the last step.
90
- * @returns The data for the last step.
91
- */
92
- last(): {
93
- step: LastStep<resolvedStep>;
94
- data: GetCurrentStep<resolvedStep, LastStep<resolvedStep>>;
95
- };
96
- protected handlePostUpdate(next: resolvedStep): void;
97
- update<targetStep extends ValidStepKey<stepNumbers>, field extends UpdateFn.chosenFields<UpdateFn.resolvedStep<resolvedStep, stepNumbers, targetStep>> = 'all', strict extends boolean = true, partial extends boolean = false, additionalCtx extends Record<string, unknown> = {}, additionalUpdaterData extends UpdateFn.additionalUpdaterData = never>(options: UpdateFn.options<resolvedStep, stepNumbers, targetStep, field, strict, partial, additionalCtx, additionalUpdaterData>): void;
98
- reset<targetStep extends ValidStepKey<stepNumbers>, fields$1 extends UpdateFn.chosenFields<currentStep>, currentStep extends UpdateFn.resolvedStep<resolvedStep, stepNumbers, targetStep>>(options: ResetFn.Options<resolvedStep, stepNumbers, targetStep, fields$1, currentStep>): void;
99
- /**
100
- * Create a helper function with validated input.
101
- */
102
- createHelperFn<const chosenSteps extends HelperFnChosenSteps<resolvedStep, stepNumbers>, validator, additionalCtx extends Record<string, unknown>, response>(options: CreateHelperFunctionOptionsWithValidator<resolvedStep, stepNumbers, chosenSteps, validator, additionalCtx>, fn: HelperFnWithValidator<resolvedStep, stepNumbers, chosenSteps, validator, additionalCtx, response>): CreatedHelperFnWithInput<validator, response>;
103
- /**
104
- * Create a helper function without input.
105
- */
106
- createHelperFn<const chosenSteps extends HelperFnChosenSteps<resolvedStep, stepNumbers>, additionalCtx extends Record<string, unknown>, response>(options: CreateHelperFunctionOptionsWithoutValidator<resolvedStep, stepNumbers, chosenSteps> & CreateHelperFunctionOptionsWithCustomCtxOptions<resolvedStep, stepNumbers, chosenSteps, additionalCtx>, fn: HelperFnWithoutValidator<resolvedStep, stepNumbers, chosenSteps, additionalCtx, response>): CreatedHelperFnWithoutInput<response>;
107
- /**
108
- * Validates that a given object is the proper shape for step data.
109
- * @param value
110
- */
111
- static hasData<step extends Step<casing>, resolvedStep extends ResolvedStep<step, casing>, stepNumbers extends StepNumbers<resolvedStep>, casing extends CasingType = DefaultCasing>(value: unknown, options?: {
112
- optionalKeysToCheck?: FieldChecks<Pick<StepOptions, 'description' | 'validateFields'>>;
113
- }): value is GetCurrentStep<resolvedStep, stepNumbers>;
114
- /**
115
- * Gets the value of a given field for a given step.
116
- * @param step The step to get the value from.
117
- * @param field The field to get the value from.
118
- * @returns The value of the {@linkcode field}.
119
- */
120
- getValue<step extends keyof resolvedStep, field extends fields.getDeep<resolvedStep, step>>(step: step, field: field): fields.resolveDeepPath<resolvedStep, step, field, fields.parentOf<field>, GetFieldsForStep<resolvedStep, step>[fields.parentOf<field>]["defaultValue"]>;
121
- }
122
- //#endregion
123
- export { AsFunction, AsFunctionReturn, AsType, AsTypeMap, MultiStepFormStepSchema, MultiStepFormStepSchemaFunctions, MultiStepFormStepSchemaListener, MultiStepFormStepStepsConfig };
124
- //# sourceMappingURL=schema.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.cts","names":[],"sources":["../../src/steps/schema.ts"],"sourcesContent":[],"mappings":";;;;;;;;;UAoDiB,uDACO,sCACD,YAAY;UAEzB,QAAA,CAAS,QAAQ,eAAe;kBACxB,mBAAmB,eAAe;AALpD;AACwB,KAMZ,MAAA,GANY,CAAA,OAMK,QANL,CAAA,CAAA,MAAA,CAAA;KAOnB,KAN8B,CAAA,UAAA,MAAA,EAAA,CAAA,GAAA,QAAZ,MAOT,CAPS,GAOL,CAPK,CAOH,CAPG,CAAA,SAAA,MAAA,GAAA,IAOqB,CAPrB,CAOuB,CAPvB,CAAA,GAAA,GAAA,KAAA,EAEI;AAAe,KAO9B,SAP8B,CAAA,qBAQnB,eARmB,EAAA,oBASpB,kBAToB,CASD,SATC,CAAA,MASe,YATf,EAAA,MAAA,CAAA,CAAA,CAAA,GAAA;EAAhC,MAAS,EAYT,OAZS,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