@formity/system 0.1.0 → 0.2.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 (97) hide show
  1. package/dist/index.cjs.js +1 -1
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.esm.js +1 -1
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/types/callbacks/custom.d.ts +9 -3
  8. package/dist/types/callbacks/custom.d.ts.map +1 -1
  9. package/dist/types/callbacks/static.d.ts +6 -0
  10. package/dist/types/callbacks/static.d.ts.map +1 -1
  11. package/dist/types/callbacks.d.ts +12 -0
  12. package/dist/types/callbacks.d.ts.map +1 -1
  13. package/dist/types/flow/cursor.d.ts +6 -0
  14. package/dist/types/flow/cursor.d.ts.map +1 -1
  15. package/dist/types/flow/entries.d.ts +36 -1
  16. package/dist/types/flow/entries.d.ts.map +1 -1
  17. package/dist/types/flow/flow.d.ts +6 -0
  18. package/dist/types/flow/flow.d.ts.map +1 -1
  19. package/dist/types/flow/position.d.ts +21 -1
  20. package/dist/types/flow/position.d.ts.map +1 -1
  21. package/dist/types/schema/custom.d.ts +142 -4
  22. package/dist/types/schema/custom.d.ts.map +1 -1
  23. package/dist/types/schema/static.d.ts +40 -1
  24. package/dist/types/schema/static.d.ts.map +1 -1
  25. package/dist/types/utils.d.ts +31 -0
  26. package/dist/types/utils.d.ts.map +1 -1
  27. package/dist/types/values/return.d.ts +16 -8
  28. package/dist/types/values/return.d.ts.map +1 -1
  29. package/dist/types/values/yield.d.ts +16 -8
  30. package/dist/types/values/yield.d.ts.map +1 -1
  31. package/dist/types/values.d.ts +38 -1
  32. package/dist/types/values.d.ts.map +1 -1
  33. package/dist/utils/entries/flow.cond.d.ts +25 -0
  34. package/dist/utils/entries/flow.cond.d.ts.map +1 -1
  35. package/dist/utils/entries/flow.cond.test.d.ts +2 -0
  36. package/dist/utils/entries/flow.cond.test.d.ts.map +1 -0
  37. package/dist/utils/entries/flow.d.ts +56 -1
  38. package/dist/utils/entries/flow.d.ts.map +1 -1
  39. package/dist/utils/entries/flow.list.d.ts +25 -0
  40. package/dist/utils/entries/flow.list.d.ts.map +1 -1
  41. package/dist/utils/entries/flow.list.test.d.ts +2 -0
  42. package/dist/utils/entries/flow.list.test.d.ts.map +1 -0
  43. package/dist/utils/entries/flow.loop.d.ts +25 -0
  44. package/dist/utils/entries/flow.loop.d.ts.map +1 -1
  45. package/dist/utils/entries/flow.loop.test.d.ts +2 -0
  46. package/dist/utils/entries/flow.loop.test.d.ts.map +1 -0
  47. package/dist/utils/entries/flow.switch.d.ts +32 -0
  48. package/dist/utils/entries/flow.switch.d.ts.map +1 -0
  49. package/dist/utils/entries/flow.switch.test.d.ts +2 -0
  50. package/dist/utils/entries/flow.switch.test.d.ts.map +1 -0
  51. package/dist/utils/entries/flow.test.d.ts +2 -0
  52. package/dist/utils/entries/flow.test.d.ts.map +1 -0
  53. package/dist/utils/entries/form.d.ts +26 -0
  54. package/dist/utils/entries/form.d.ts.map +1 -1
  55. package/dist/utils/entries/form.test.d.ts +2 -0
  56. package/dist/utils/entries/form.test.d.ts.map +1 -0
  57. package/dist/utils/flow.d.ts +8 -0
  58. package/dist/utils/flow.d.ts.map +1 -1
  59. package/dist/utils/flow.test.d.ts +2 -0
  60. package/dist/utils/flow.test.d.ts.map +1 -0
  61. package/dist/utils/form.d.ts +12 -0
  62. package/dist/utils/form.d.ts.map +1 -1
  63. package/dist/utils/form.test.d.ts +2 -0
  64. package/dist/utils/form.test.d.ts.map +1 -0
  65. package/dist/utils/navigate.d.ts +41 -0
  66. package/dist/utils/navigate.d.ts.map +1 -1
  67. package/dist/utils/navigate.test.d.ts +2 -0
  68. package/dist/utils/navigate.test.d.ts.map +1 -0
  69. package/dist/utils/schema/flow.cond.d.ts +27 -0
  70. package/dist/utils/schema/flow.cond.d.ts.map +1 -1
  71. package/dist/utils/schema/flow.cond.test.d.ts +2 -0
  72. package/dist/utils/schema/flow.cond.test.d.ts.map +1 -0
  73. package/dist/utils/schema/flow.d.ts +35 -0
  74. package/dist/utils/schema/flow.d.ts.map +1 -1
  75. package/dist/utils/schema/flow.list.d.ts +26 -0
  76. package/dist/utils/schema/flow.list.d.ts.map +1 -1
  77. package/dist/utils/schema/flow.list.test.d.ts +2 -0
  78. package/dist/utils/schema/flow.list.test.d.ts.map +1 -0
  79. package/dist/utils/schema/flow.loop.d.ts +28 -0
  80. package/dist/utils/schema/flow.loop.d.ts.map +1 -1
  81. package/dist/utils/schema/flow.loop.test.d.ts +2 -0
  82. package/dist/utils/schema/flow.loop.test.d.ts.map +1 -0
  83. package/dist/utils/schema/flow.switch.d.ts +34 -0
  84. package/dist/utils/schema/flow.switch.d.ts.map +1 -0
  85. package/dist/utils/schema/flow.switch.test.d.ts +2 -0
  86. package/dist/utils/schema/flow.switch.test.d.ts.map +1 -0
  87. package/dist/utils/schema/flow.test.d.ts +2 -0
  88. package/dist/utils/schema/flow.test.d.ts.map +1 -0
  89. package/dist/utils/schema/form.d.ts +6 -0
  90. package/dist/utils/schema/form.d.ts.map +1 -1
  91. package/dist/utils/schema/return.d.ts +6 -0
  92. package/dist/utils/schema/return.d.ts.map +1 -1
  93. package/dist/utils/schema/variables.d.ts +6 -0
  94. package/dist/utils/schema/variables.d.ts.map +1 -1
  95. package/dist/utils/schema/yield.d.ts +6 -0
  96. package/dist/utils/schema/yield.d.ts.map +1 -1
  97. package/package.json +2 -2
@@ -1,11 +1,71 @@
1
- import type { ItemValues, FlowValues, ListValues, CondValues, LoopValues, FormValues, YieldValues, ReturnValues, VariablesValues } from "../values";
1
+ import type { ItemValues, FlowValues, ListValues, CondValues, LoopValues, SwitchValues, FormValues, YieldValues, ReturnValues, VariablesValues } from "../values";
2
2
  import type { OnNext, OnBack, GetFlow, SetFlow } from "../callbacks";
3
+ /**
4
+ * Defines the structure and behavior of any element in a multi-step form.
5
+ *
6
+ * @template Render The type of the rendered output for each form step. This can vary depending on
7
+ * the framework; for example, in React, it would typically be `ReactNode`.
8
+ *
9
+ * @template Values A type extending `ItemValues` that defines the structure of the multi-step form,
10
+ * including the values handled in each phase.
11
+ *
12
+ * @template Inputs An object type representing additional values available during form execution,
13
+ * beyond those generated by the multi-step form itself.
14
+ *
15
+ * @template Params An object type defining the values accessible when rendering each form step in
16
+ * the multi-step process.
17
+ */
3
18
  export type ItemSchema<Render, Values extends ItemValues, Inputs extends object, Params extends object> = Values extends FlowValues ? FlowSchema<Render, Values, Inputs, Params> : Values extends FormValues ? FormSchema<Render, Values, Inputs, Params> : Values extends YieldValues ? YieldSchema<Values, Inputs> : Values extends ReturnValues ? ReturnSchema<Values, Inputs> : Values extends VariablesValues ? VariablesSchema<Values, Inputs> : never;
4
- export type FlowSchema<Render, Values extends FlowValues, Inputs extends object, Params extends object> = Values extends ListValues ? ListSchema<Render, Values, Inputs, Params> : Values extends CondValues ? CondSchema<Render, Values, Inputs, Params> : Values extends LoopValues ? LoopSchema<Render, Values, Inputs, Params> : never;
19
+ /**
20
+ * Defines the structure and behavior of any flow element in a multi-step form.
21
+ *
22
+ * @template Render The type of the rendered output for each form step. This can vary depending on
23
+ * the framework; for example, in React, it would typically be `ReactNode`.
24
+ *
25
+ * @template Values A type extending `FlowValues` that defines the structure of the multi-step form,
26
+ * including the values handled in each phase.
27
+ *
28
+ * @template Inputs An object type representing additional values available during form execution,
29
+ * beyond those generated by the multi-step form itself.
30
+ *
31
+ * @template Params An object type defining the values accessible when rendering each form step in
32
+ * the multi-step process.
33
+ */
34
+ export type FlowSchema<Render, Values extends FlowValues, Inputs extends object, Params extends object> = Values extends ListValues ? ListSchema<Render, Values, Inputs, Params> : Values extends CondValues ? CondSchema<Render, Values, Inputs, Params> : Values extends LoopValues ? LoopSchema<Render, Values, Inputs, Params> : Values extends SwitchValues ? SwitchSchema<Render, Values, Inputs, Params> : never;
35
+ /**
36
+ * Defines the structure and behavior of a list element in a multi-step form.
37
+ *
38
+ * @template Render The type of the rendered output for each form step. This can vary depending on
39
+ * the framework; for example, in React, it would typically be `ReactNode`.
40
+ *
41
+ * @template Values A type extending `ListValues` that defines the structure of the multi-step form,
42
+ * including the values handled in each phase.
43
+ *
44
+ * @template Inputs An object type representing additional values available during form execution,
45
+ * beyond those generated by the multi-step form itself.
46
+ *
47
+ * @template Params An object type defining the values accessible when rendering each form step in
48
+ * the multi-step process.
49
+ */
5
50
  export type ListSchema<Render, Values extends ListValues, Inputs extends object, Params extends object> = Values extends [infer First, ...infer Other] ? First extends ItemValues ? Other extends ListValues ? [
6
51
  ItemSchema<Render, First, Inputs, Params>,
7
- ...ListSchema<Render, Other, Merge<Inputs, ItemOutput<First>>, Params>
52
+ ...ListSchema<Render, Other, Join<Inputs, ItemOutput<First>>, Params>
8
53
  ] : never : never : [];
54
+ /**
55
+ * Defines the structure and behavior of a condition element in a multi-step form.
56
+ *
57
+ * @template Render The type of the rendered output for each form step. This can vary depending on
58
+ * the framework; for example, in React, it would typically be `ReactNode`.
59
+ *
60
+ * @template Values A type extending `CondValues` that defines the structure of the multi-step form,
61
+ * including the values handled in each phase.
62
+ *
63
+ * @template Inputs An object type representing additional values available during form execution,
64
+ * beyond those generated by the multi-step form itself.
65
+ *
66
+ * @template Params An object type defining the values accessible when rendering each form step in
67
+ * the multi-step process.
68
+ */
9
69
  export type CondSchema<Render, Values extends CondValues, Inputs extends object, Params extends object> = {
10
70
  cond: {
11
71
  if: (inputs: Inputs) => boolean;
@@ -13,12 +73,69 @@ export type CondSchema<Render, Values extends CondValues, Inputs extends object,
13
73
  else: ListSchema<Render, Values["cond"]["else"], Inputs, Params>;
14
74
  };
15
75
  };
76
+ /**
77
+ * Defines the structure and behavior of a loop element in a multi-step form.
78
+ *
79
+ * @template Render The type of the rendered output for each form step. This can vary depending on
80
+ * the framework; for example, in React, it would typically be `ReactNode`.
81
+ *
82
+ * @template Values A type extending `LoopValues` that defines the structure of the multi-step form,
83
+ * including the values handled in each phase.
84
+ *
85
+ * @template Inputs An object type representing additional values available during form execution,
86
+ * beyond those generated by the multi-step form itself.
87
+ *
88
+ * @template Params An object type defining the values accessible when rendering each form step in
89
+ * the multi-step process.
90
+ */
16
91
  export type LoopSchema<Render, Values extends LoopValues, Inputs extends object, Params extends object> = {
17
92
  loop: {
18
93
  while: (inputs: Inputs) => boolean;
19
94
  do: ListSchema<Render, Values["loop"]["do"], Inputs, Params>;
20
95
  };
21
96
  };
97
+ /**
98
+ * Defines the structure and behavior of a switch element in a multi-step form.
99
+ *
100
+ * @template Render The type of the rendered output for each form step. This can vary depending on
101
+ * the framework; for example, in React, it would typically be `ReactNode`.
102
+ *
103
+ * @template Values A type extending `SwitchValues` that defines the structure of the multi-step
104
+ * form, including the values handled in each phase.
105
+ *
106
+ * @template Inputs An object type representing additional values available during form execution,
107
+ * beyond those generated by the multi-step form itself.
108
+ *
109
+ * @template Params An object type defining the values accessible when rendering each form step in
110
+ * the multi-step process.
111
+ */
112
+ export type SwitchSchema<Render, Values extends SwitchValues, Inputs extends object, Params extends object> = {
113
+ switch: {
114
+ branches: SwitchBranchesSchema<Render, Values["switch"]["branches"], Inputs, Params>;
115
+ default: ListSchema<Render, Values["switch"]["default"], Inputs, Params>;
116
+ };
117
+ };
118
+ type SwitchBranchesSchema<Render, Values extends ListValues[], Inputs extends object, Params extends object> = Values extends [infer First, ...infer Other] ? First extends ListValues ? Other extends ListValues[] ? [
119
+ {
120
+ case: (inputs: Inputs) => boolean;
121
+ then: ListSchema<Render, First, Inputs, Params>;
122
+ },
123
+ ...SwitchBranchesSchema<Render, Other, Inputs, Params>
124
+ ] : never : never : [];
125
+ /**
126
+ * Defines the structure and behavior of a form element in a multi-step form.
127
+ *
128
+ * @template Render The type of the rendered output for each form step. This can vary depending on
129
+ * the framework; for example, in React, it would typically be `ReactNode`.
130
+ *
131
+ * @template Values A type extending `FormValues` that defines the values of the form element.
132
+ *
133
+ * @template Inputs An object type representing additional values available during form execution,
134
+ * beyond those generated by the multi-step form itself.
135
+ *
136
+ * @template Params An object type defining the values accessible when rendering each form step in
137
+ * the multi-step process.
138
+ */
22
139
  export type FormSchema<Render, Values extends FormValues, Inputs extends object, Params extends object> = {
23
140
  form: {
24
141
  values: (inputs: Inputs) => {
@@ -35,16 +152,37 @@ export type FormSchema<Render, Values extends FormValues, Inputs extends object,
35
152
  }) => Render;
36
153
  };
37
154
  };
155
+ /**
156
+ * Defines the structure and behavior of a yield element in a multi-step form.
157
+ *
158
+ * @template Values A type extending `YieldValues` that defines the values of the yield element.
159
+ * @template Inputs An object type representing additional values available during form execution,
160
+ * beyond those generated by the multi-step form itself.
161
+ */
38
162
  export type YieldSchema<Values extends YieldValues, Inputs extends object> = {
39
163
  yield: (inputs: Inputs) => Values["yield"];
40
164
  };
165
+ /**
166
+ * Defines the structure and behavior of a return element in a multi-step form.
167
+ *
168
+ * @template Values A type extending `ReturnValues` that defines the values of the return element.
169
+ * @template Inputs An object type representing additional values available during form execution,
170
+ * beyond those generated by the multi-step form itself.
171
+ */
41
172
  export type ReturnSchema<Values extends ReturnValues, Inputs extends object> = {
42
173
  return: (inputs: Inputs) => Values["return"];
43
174
  };
175
+ /**
176
+ * Defines the structure and behavior of a variables element in a multi-step form.
177
+ *
178
+ * @template Values A type extending `VariablesValues` that defines the values of the variables element.
179
+ * @template Inputs An object type representing additional values available during form execution,
180
+ * beyond those generated by the multi-step form itself.
181
+ */
44
182
  export type VariablesSchema<Values extends VariablesValues, Inputs extends object> = {
45
183
  variables: (inputs: Inputs) => Values["variables"];
46
184
  };
47
- type Merge<T extends object, U extends object> = Omit<T, keyof U> & U;
185
+ type Join<T extends object, U extends object> = Omit<T, keyof U> & U;
48
186
  type ItemOutput<Values extends ItemValues> = Values extends FormValues ? FormOutput<Values> : Values extends VariablesValues ? VariablesOutput<Values> : object;
49
187
  type FormOutput<Values extends FormValues> = Values["form"];
50
188
  type VariablesOutput<Values extends VariablesValues> = Values["variables"];
@@ -1 +1 @@
1
- {"version":3,"file":"custom.d.ts","sourceRoot":"","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AAE,MAAM,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,CACzB,MAAM,SAAS,eAAe,EAC9B,MAAM,SAAS,MAAM,IACnB;IACF,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,WAAW,CAAC,CAAC;CACpD,CAAC;AAEF,KAAK,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;AAErE,KAAK,UAAU,CAAC,MAAM,SAAS,UAAU,IAAI,MAAM,SAAS,UAAU,GAClE,UAAU,CAAC,MAAM,CAAC,GAClB,MAAM,SAAS,eAAe,GAC9B,eAAe,CAAC,MAAM,CAAC,GACvB,MAAM,CAAC;AAEX,KAAK,UAAU,CAAC,MAAM,SAAS,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;AAC5D,KAAK,eAAe,CAAC,MAAM,SAAS,eAAe,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC"}
@@ -1,7 +1,19 @@
1
1
  import type { OnNext, OnBack, GetFlow, SetFlow } from "../callbacks";
2
+ /**
3
+ * Defines the structure and behavior of any element in a multi-step form.
4
+ */
2
5
  export type ItemSchema = FlowSchema | FormSchema | YieldSchema | ReturnSchema | VariablesSchema;
3
- export type FlowSchema = ListSchema | CondSchema | LoopSchema;
6
+ /**
7
+ * Defines the structure and behavior of any flow element in a multi-step form.
8
+ */
9
+ export type FlowSchema = ListSchema | CondSchema | LoopSchema | SwitchSchema;
10
+ /**
11
+ * Defines the structure and behavior of a list element in a multi-step form.
12
+ */
4
13
  export type ListSchema = ItemSchema[];
14
+ /**
15
+ * Defines the structure and behavior of a condition element in a multi-step form.
16
+ */
5
17
  export type CondSchema = {
6
18
  cond: {
7
19
  if: (inputs: object) => boolean;
@@ -9,12 +21,30 @@ export type CondSchema = {
9
21
  else: ListSchema;
10
22
  };
11
23
  };
24
+ /**
25
+ * Defines the structure and behavior of a loop element in a multi-step form.
26
+ */
12
27
  export type LoopSchema = {
13
28
  loop: {
14
29
  while: (inputs: object) => boolean;
15
30
  do: ListSchema;
16
31
  };
17
32
  };
33
+ /**
34
+ * Defines the structure and behavior of a switch element in a multi-step form.
35
+ */
36
+ export type SwitchSchema = {
37
+ switch: {
38
+ branches: {
39
+ case: (inputs: object) => boolean;
40
+ then: ListSchema;
41
+ }[];
42
+ default: ListSchema;
43
+ };
44
+ };
45
+ /**
46
+ * Defines the structure and behavior of a form element in a multi-step form.
47
+ */
18
48
  export type FormSchema = {
19
49
  form: {
20
50
  values: (inputs: object) => Record<string, [unknown, PropertyKey[]]>;
@@ -29,12 +59,21 @@ export type FormSchema = {
29
59
  }) => unknown;
30
60
  };
31
61
  };
62
+ /**
63
+ * Defines the structure and behavior of a yield element in a multi-step form.
64
+ */
32
65
  export type YieldSchema = {
33
66
  yield: (inputs: object) => object;
34
67
  };
68
+ /**
69
+ * Defines the structure and behavior of a return element in a multi-step form.
70
+ */
35
71
  export type ReturnSchema = {
36
72
  return: (inputs: object) => object;
37
73
  };
74
+ /**
75
+ * Defines the structure and behavior of a variables element in a multi-step form.
76
+ */
38
77
  export type VariablesSchema = {
39
78
  variables: (inputs: object) => object;
40
79
  };
@@ -1 +1 @@
1
- {"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../../src/types/schema/static.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,UAAU,GACV,WAAW,GACX,YAAY,GACZ,eAAe,CAAC;AAEpB,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;AAE9D,MAAM,MAAM,UAAU,GAAG,UAAU,EAAE,CAAC;AAEtC,MAAM,MAA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YACf,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,OAAO,CAAC;YACjB,OAAO,EAAE,OAAO,CAAC;SAClB,KAAK,OAAO,CAAC;KACf,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACvC,CAAC"}
@@ -1,4 +1,7 @@
1
1
  import { ListValues } from "./values";
2
+ /**
3
+ * Utility type that defines the structure and values of a condition element in a multi-step form.
4
+ */
2
5
  export type Cond<Values extends {
3
6
  then: ListValues;
4
7
  else: ListValues;
@@ -9,24 +12,52 @@ export type Cond<Values extends {
9
12
  else: Values["else"];
10
13
  };
11
14
  };
15
+ /**
16
+ * Utility type that defines the structure and values of a loop element in a multi-step form.
17
+ */
12
18
  export type Loop<Values extends ListValues> = {
13
19
  type: "loop";
14
20
  loop: {
15
21
  do: Values;
16
22
  };
17
23
  };
24
+ /**
25
+ * Utility type that defines the structure and values of a switch element in a multi-step form.
26
+ */
27
+ export type Switch<Values extends {
28
+ branches: ListValues[];
29
+ default: ListValues;
30
+ }> = {
31
+ type: "switch";
32
+ switch: {
33
+ branches: Values["branches"];
34
+ default: Values["default"];
35
+ };
36
+ };
37
+ /**
38
+ * Utility type that defines the values of a form element in a multi-step form.
39
+ */
18
40
  export type Form<Values extends object> = {
19
41
  type: "form";
20
42
  form: Values;
21
43
  };
44
+ /**
45
+ * Utility type that defines the values of a yield element in a multi-step form.
46
+ */
22
47
  export type Yield<Values extends object> = {
23
48
  type: "yield";
24
49
  yield: Values;
25
50
  };
51
+ /**
52
+ * Utility type that defines the values of a return element in a multi-step form.
53
+ */
26
54
  export type Return<Values extends object> = {
27
55
  type: "return";
28
56
  return: Values;
29
57
  };
58
+ /**
59
+ * Utility type that defines the values of a variables element in a multi-step form.
60
+ */
30
61
  export type Variables<Values extends object> = {
31
62
  type: "variables";
32
63
  variables: Values;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/types/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,MAAM,IAAI,CAAC,MAAM,SAAS;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,IAAI;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,IAAI,CAAC,MAAM,SAAS,UAAU,IAAI;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,IAAI,CAAC,MAAM,SAAS,MAAM,IAAI;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,KAAK,CAAC,MAAM,SAAS,MAAM,IAAI;IACzC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,MAAM,CAAC,MAAM,SAAS,MAAM,IAAI;IAC1C,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,MAAM,SAAS,MAAM,IAAI;IAC7C,IAAI,EAAE,WAAW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AAM,MAAM,CAAC,MAAM,SAAS,MAAM,IAAI;IAC1C,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,MAAM,SAAS,MAAM,IAAI;IAC7C,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -1,14 +1,22 @@
1
- import { ItemValues, ListValues, CondValues, LoopValues, ReturnValues } from "../values";
1
+ import { ItemValues, ListValues, CondValues, LoopValues, SwitchValues, ReturnValues } from "../values";
2
+ /**
3
+ * Returns the union of all possible values that can be returned by a multi-step form.
4
+ */
2
5
  export type Return<Values extends ListValues> = ListData<Values, never> extends [infer Next, unknown] ? Next : never;
3
- type ItemData<Values extends ItemValues, Data> = Values extends ListValues ? ListData<Values, Data> : Values extends CondValues ? CondData<Values, Data> : Values extends LoopValues ? LoopData<Values, Data> : Values extends ReturnValues ? [Data | Values["return"], "T"] : [Data, "F"];
6
+ type ItemData<Values extends ItemValues, Data> = Values extends ListValues ? ListData<Values, Data> : Values extends CondValues ? CondData<Values, Data> : Values extends LoopValues ? LoopData<Values, Data> : Values extends SwitchValues ? SwitchData<Values, Data> : Values extends ReturnValues ? [Data | Values["return"], true] : [Data, false];
4
7
  type ListData<Values extends ListValues, Data> = Values extends [
5
8
  infer First,
6
9
  ...infer Other
7
- ] ? First extends ItemValues ? Other extends ListValues ? ItemData<First, Data> extends [infer Next, infer Return] ? Return extends "T" ? [Next, "T"] : ListData<Other, Next> : never : never : never : [Data, "F"];
8
- type CondData<Values extends CondValues, Data> = ListData<Values["cond"]["then"], Data> extends [infer ThenNext, infer ThenReturn] ? ListData<Values["cond"]["else"], Data> extends [
9
- infer ElseNext,
10
- infer ElseReturn
11
- ] ? [ThenReturn, ElseReturn] extends ["T", "T"] ? [ThenNext | ElseNext, "T"] : [ThenNext | ElseNext, "F"] : never : never;
12
- type LoopData<Values extends LoopValues, Data> = ListData<Values["loop"]["do"], Data> extends [infer Next, unknown] ? [Next, "F"] : never;
10
+ ] ? First extends ItemValues ? Other extends ListValues ? ItemData<First, Data> extends [infer Next, infer Return] ? Return extends true ? [Next, true] : ListData<Other, Next> : never : never : never : [Data, false];
11
+ type CondData<Values extends CondValues, Data> = RoutesData<[
12
+ Values["cond"]["then"],
13
+ Values["cond"]["else"]
14
+ ], Data>;
15
+ type LoopData<Values extends LoopValues, Data> = ListData<Values["loop"]["do"], Data> extends [infer Next, unknown] ? [Next, false] : never;
16
+ type SwitchData<Values extends SwitchValues, Data> = RoutesData<[
17
+ ...Values["switch"]["branches"],
18
+ Values["switch"]["default"]
19
+ ], Data>;
20
+ type RoutesData<Values extends ListValues[], Data, RoutesReturn = true> = Values extends [infer First, ...infer Other] ? First extends ListValues ? Other extends ListValues[] ? ListData<First, Data> extends [infer Next, infer Return] ? RoutesReturn extends false ? RoutesData<Other, Next, false> : RoutesData<Other, Next, Return> : never : never : never : [Data, RoutesReturn];
13
21
  export {};
14
22
  //# sourceMappingURL=return.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"return.d.ts","sourceRoot":"","sources":["../../../src/types/values/return.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACb,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,MAAM,CAAC,MAAM,SAAS,UAAU,IAAI,QAAQ,CACtD,MAAM,EACN,KAAK,CACN,SAAS,CAAC,MAAM,IAAI,EAAE,OAAO,CAAC,GAC3B,IAAI,GACJ,KAAK,CAAC;AAEV,KAAK,QAAQ,CAAC,MAAM,SAAS,UAAU,EAAE,IAAI,IAAI,MAAM,SAAS,UAAU,GACtE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,GACtB,MAAM,SAAS,UAAU,GACzB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,GACtB,MAAM,SAAS,UAAU,GACzB,QAAQ,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K,GACP,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC"}
@@ -1,17 +1,25 @@
1
- import { ItemValues, ListValues, CondValues, LoopValues, YieldValues, ReturnValues } from "../values";
1
+ import { ItemValues, ListValues, CondValues, LoopValues, SwitchValues, YieldValues, ReturnValues } from "../values";
2
+ /**
3
+ * Returns the union of all possible values that can be yielded by a multi-step form.
4
+ */
2
5
  export type Yield<Values extends ListValues> = ListData<Values, never> extends [
3
6
  infer Next,
4
7
  unknown
5
8
  ] ? Next : never;
6
- type ItemData<Values extends ItemValues, Data> = Values extends ListValues ? ListData<Values, Data> : Values extends CondValues ? CondData<Values, Data> : Values extends LoopValues ? LoopData<Values, Data> : Values extends YieldValues ? [Data | Values["yield"], "F"] : Values extends ReturnValues ? [Data, "T"] : [Data, "F"];
9
+ type ItemData<Values extends ItemValues, Data> = Values extends ListValues ? ListData<Values, Data> : Values extends CondValues ? CondData<Values, Data> : Values extends LoopValues ? LoopData<Values, Data> : Values extends SwitchValues ? SwitchData<Values, Data> : Values extends YieldValues ? [Data | Values["yield"], false] : Values extends ReturnValues ? [Data, true] : [Data, false];
7
10
  type ListData<Values extends ListValues, Data> = Values extends [
8
11
  infer First,
9
12
  ...infer Other
10
- ] ? First extends ItemValues ? Other extends ListValues ? ItemData<First, Data> extends [infer Next, infer Return] ? Return extends "T" ? [Next, "T"] : ListData<Other, Next> : never : never : never : [Data, "F"];
11
- type CondData<Values extends CondValues, Data> = ListData<Values["cond"]["then"], Data> extends [infer ThenNext, infer ThenReturn] ? ListData<Values["cond"]["else"], Data> extends [
12
- infer ElseNext,
13
- infer ElseReturn
14
- ] ? [ThenReturn, ElseReturn] extends ["T", "T"] ? [ThenNext | ElseNext, "T"] : [ThenNext | ElseNext, "F"] : never : never;
15
- type LoopData<Values extends LoopValues, Data> = ListData<Values["loop"]["do"], Data> extends [infer Next, unknown] ? [Next, "F"] : never;
13
+ ] ? First extends ItemValues ? Other extends ListValues ? ItemData<First, Data> extends [infer Next, infer Return] ? Return extends true ? [Next, true] : ListData<Other, Next> : never : never : never : [Data, false];
14
+ type CondData<Values extends CondValues, Data> = RoutesData<[
15
+ Values["cond"]["then"],
16
+ Values["cond"]["else"]
17
+ ], Data>;
18
+ type LoopData<Values extends LoopValues, Data> = ListData<Values["loop"]["do"], Data> extends [infer Next, unknown] ? [Next, false] : never;
19
+ type SwitchData<Values extends SwitchValues, Data> = RoutesData<[
20
+ ...Values["switch"]["branches"],
21
+ Values["switch"]["default"]
22
+ ], Data>;
23
+ type RoutesData<Values extends ListValues[], Data, RoutesReturn = true> = Values extends [infer First, ...infer Other] ? First extends ListValues ? Other extends ListValues[] ? ListData<First, Data> extends [infer Next, infer Return] ? RoutesReturn extends false ? RoutesData<Other, Next, false> : RoutesData<Other, Next, Return> : never : never : never : [Data, RoutesReturn];
16
24
  export {};
17
25
  //# sourceMappingURL=yield.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"yield.d.ts","sourceRoot":"","sources":["../../../src/types/values/yield.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACb,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,KAAK,CAAC,MAAM,SAAS,UAAU,IAAI,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS;IAC7E,MAAM,IAAI;IACV,OAAO;CACR,GACG,IAAI,GACJ,KAAK,CAAC;AAEV,KAAK,QAAQ,CAAC,MAAM,SAAS,UAAU,EAAE,IAAI,IAAI,MAAM,SAAS,UAAU,GACtE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,GACtB,MAAM,SAAS,UAAU,GACzB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,GACtB,MAAM,SAAS,UAAU,GACzB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,GACtB,MAAM,SAAS,WAAW,GAC1B,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,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K,GACP,KAAK,GACP,KAAK,GACP,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC"}
@@ -1,6 +1,18 @@
1
+ /**
2
+ * This type is meant to be extended and is used to define the structure and values of any element in a multi-step form.
3
+ */
1
4
  export type ItemValues = FlowValues | FormValues | YieldValues | ReturnValues | VariablesValues;
2
- export type FlowValues = ListValues | CondValues | LoopValues;
5
+ /**
6
+ * This type is meant to be extended and is used to define the structure and values of any flow element in a multi-step form.
7
+ */
8
+ export type FlowValues = ListValues | CondValues | LoopValues | SwitchValues;
9
+ /**
10
+ * This type is meant to be extended and is used to define the structure and values of a list element in a multi-step form.
11
+ */
3
12
  export type ListValues = ItemValues[];
13
+ /**
14
+ * This type is meant to be extended and is used to define the structure and values of a condition element in a multi-step form.
15
+ */
4
16
  export type CondValues = {
5
17
  type: "cond";
6
18
  cond: {
@@ -8,24 +20,49 @@ export type CondValues = {
8
20
  else: ListValues;
9
21
  };
10
22
  };
23
+ /**
24
+ * This type is meant to be extended and is used to define the structure and values of a loop element in a multi-step form.
25
+ */
11
26
  export type LoopValues = {
12
27
  type: "loop";
13
28
  loop: {
14
29
  do: ListValues;
15
30
  };
16
31
  };
32
+ /**
33
+ * This type is meant to be extended and is used to define the structure and values of a switch element in a multi-step form.
34
+ */
35
+ export type SwitchValues = {
36
+ type: "switch";
37
+ switch: {
38
+ branches: ListValues[];
39
+ default: ListValues;
40
+ };
41
+ };
42
+ /**
43
+ * This type is meant to be extended and is used to define the values of a form element in a multi-step form.
44
+ */
17
45
  export type FormValues = {
18
46
  type: "form";
19
47
  form: object;
20
48
  };
49
+ /**
50
+ * This type is meant to be extended and is used to define the values of a yield element in a multi-step form.
51
+ */
21
52
  export type YieldValues = {
22
53
  type: "yield";
23
54
  yield: object;
24
55
  };
56
+ /**
57
+ * This type is meant to be extended and is used to define the values of a return element in a multi-step form.
58
+ */
25
59
  export type ReturnValues = {
26
60
  type: "return";
27
61
  return: object;
28
62
  };
63
+ /**
64
+ * This type is meant to be extended and is used to define the values of a variables element in a multi-step form.
65
+ */
29
66
  export type VariablesValues = {
30
67
  type: "variables";
31
68
  variables: object;
@@ -1 +1 @@
1
- {"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/types/values.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,UAAU,GACV,WAAW,GACX,YAAY,GACZ,eAAe,CAAC;AAEpB,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;AAE9D,MAAM,MAAM,UAAU,GAAG,UAAU,EAAE,CAAC;AAEtC,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU,CAAC;QACjB,IAAI,EAAE,UAAU,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,EAAE,EAAE,UAAU,CAAC;KAChB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/types/values.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,UAAU,GACV,WAAW,GACX,YAAY,GACZ,eAAe,CAAC;AAEpB;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,EAAE,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU,CAAC;QACjB,IAAI,EAAE,UAAU,CAAC;KAClB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,EAAE,EAAE,UAAU,CAAC;KAChB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE;QACN,QAAQ,EAAE,UAAU,EAAE,CAAC;QACvB,OAAO,EAAE,UAAU,CAAC;KACrB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -1,7 +1,32 @@
1
1
  import type { ItemEntries, FlowEntries, CondEntries } from "../../types/flow/entries";
2
2
  import type { Position } from "../../types/flow/position";
3
+ /**
4
+ * Creates a `CondEntries` object.
5
+ *
6
+ * @returns The created `CondEntries` object.
7
+ */
3
8
  export declare function create(): FlowEntries;
9
+ /**
10
+ * Clones a `CondEntries` object.
11
+ *
12
+ * @param flow A `CondEntries` object.
13
+ * @returns The cloned `CondEntries` object.
14
+ */
4
15
  export declare function clone(flow: CondEntries): FlowEntries;
16
+ /**
17
+ * Returns the `ItemEntries` object at the given position within the given `CondEntries` object, or `null` if there is no item at the given position.
18
+ *
19
+ * @param flow The `CondEntries` object.
20
+ * @param position The position within the `CondEntries` object.
21
+ * @returns The `ItemEntries` object at the given position within the `CondEntries` object, or `null` if there is no item at the given position.
22
+ */
5
23
  export declare function getItem(flow: CondEntries, position: Position): ItemEntries | null;
24
+ /**
25
+ * Sets the `ItemEntries` object at the given position within the given `CondEntries` object.
26
+ *
27
+ * @param flow The `CondEntries` object.
28
+ * @param position The position within the `CondEntries` object.
29
+ * @param item The `ItemEntries` object to set.
30
+ */
6
31
  export declare function setItem(flow: CondEntries, position: Position, item: ItemEntries): void;
7
32
  //# sourceMappingURL=flow.cond.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flow.cond.d.ts","sourceRoot":"","sources":["../../../src/utils/entries/flow.cond.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,2BAA2B,CAAC;AAExE,wBAAgB,MAAM,IAAI,WAAW,CAEpC;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAEpD;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,QAAQ,GACjB,WAAW,GAAG,IAAI,CAMpB;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,WAAW,GAChB,IAAI,CAIN"}
1
+ {"version":3,"file":"flow.cond.d.ts","sourceRoot":"","sources":["../../../src/utils/entries/flow.cond.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,2BAA2B,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,MAAM,IAAI,WAAW,CAEpC;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CACrB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,QAAQ,GACjB,WAAW,GAAG,IAAI,CAIpB;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CACrB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,WAAW,GAChB,IAAI,CAGN"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=flow.cond.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow.cond.test.d.ts","sourceRoot":"","sources":["../../../src/utils/entries/flow.cond.test.ts"],"names":[],"mappings":""}