@f1studio/form-spec 5.0.0-alpha.101

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 (225) hide show
  1. package/Designer.d.ts +89 -0
  2. package/FormSpec.TS/Components/HelloComponent.js +68 -0
  3. package/FormSpec.TS/Components/HelloComponent.js.map +1 -0
  4. package/FormSpec.TS/Components/HelloComponent.ts.map +1 -0
  5. package/FormSpec.TS/Designer.js +526 -0
  6. package/FormSpec.TS/Designer.js.map +1 -0
  7. package/FormSpec.TS/Designer.ts.map +1 -0
  8. package/FormSpec.TS/FormSpec.js +5400 -0
  9. package/FormSpec.TS/FormSpec.js.map +1 -0
  10. package/FormSpec.TS/FormSpec.ts.map +1 -0
  11. package/FormSpec.TS/FormSpecHelpers.js +382 -0
  12. package/FormSpec.TS/FormSpecHelpers.js.map +1 -0
  13. package/FormSpec.TS/FormSpecHelpers.ts.map +1 -0
  14. package/FormSpec.TS/Helpers.js +732 -0
  15. package/FormSpec.TS/Helpers.js.map +1 -0
  16. package/FormSpec.TS/Helpers.ts.map +1 -0
  17. package/FormSpec.TS/Interfaces.js +257 -0
  18. package/FormSpec.TS/Interfaces.js.map +1 -0
  19. package/FormSpec.TS/Interfaces.ts.map +1 -0
  20. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +854 -0
  21. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -0
  22. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -0
  23. package/FormSpec.TS/Interop/FormSpec.Api.Option.js +1961 -0
  24. package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -0
  25. package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -0
  26. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +1367 -0
  27. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -0
  28. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -0
  29. package/FormSpec.TS/Logging/LogTypes.js +347 -0
  30. package/FormSpec.TS/Logging/LogTypes.js.map +1 -0
  31. package/FormSpec.TS/Logging/LogTypes.ts.map +1 -0
  32. package/FormSpec.TS/Migrator.js +230 -0
  33. package/FormSpec.TS/Migrator.js.map +1 -0
  34. package/FormSpec.TS/Migrator.ts.map +1 -0
  35. package/FormSpec.TS/PathwayDataExtractor.js +361 -0
  36. package/FormSpec.TS/PathwayDataExtractor.js.map +1 -0
  37. package/FormSpec.TS/PathwayDataExtractor.ts.map +1 -0
  38. package/FormSpec.TS/PathwayExecutor.js +1321 -0
  39. package/FormSpec.TS/PathwayExecutor.js.map +1 -0
  40. package/FormSpec.TS/PathwayExecutor.ts.map +1 -0
  41. package/FormSpec.TS/PathwayValidator.js +346 -0
  42. package/FormSpec.TS/PathwayValidator.js.map +1 -0
  43. package/FormSpec.TS/PathwayValidator.ts.map +1 -0
  44. package/FormSpec.TS/PluginInterface.js +171 -0
  45. package/FormSpec.TS/PluginInterface.js.map +1 -0
  46. package/FormSpec.TS/PluginInterface.ts.map +1 -0
  47. package/FormSpec.TS/Prelude.js +59 -0
  48. package/FormSpec.TS/Prelude.js.map +1 -0
  49. package/FormSpec.TS/Prelude.ts.map +1 -0
  50. package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.js +958 -0
  51. package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.js.map +1 -0
  52. package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -0
  53. package/FormSpec.TS/Renderers/MermaidRenderer.js +228 -0
  54. package/FormSpec.TS/Renderers/MermaidRenderer.js.map +1 -0
  55. package/FormSpec.TS/Renderers/MermaidRenderer.ts.map +1 -0
  56. package/FormSpec.TS/Renderers/PathwayRenderers.js +190 -0
  57. package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -0
  58. package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -0
  59. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs +511 -0
  60. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.js +437 -0
  61. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.js.map +1 -0
  62. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.ts.map +1 -0
  63. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs +16 -0
  64. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.js +73 -0
  65. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.js.map +1 -0
  66. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.ts.map +1 -0
  67. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs +50 -0
  68. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.js +72 -0
  69. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.js.map +1 -0
  70. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.ts.map +1 -0
  71. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Fable.Form.fableproj +28 -0
  72. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs +24 -0
  73. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.js +56 -0
  74. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.js.map +1 -0
  75. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.ts.map +1 -0
  76. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Fable.Form.Simple.fableproj +31 -0
  77. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs +178 -0
  78. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.js +464 -0
  79. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.js.map +1 -0
  80. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.ts.map +1 -0
  81. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Extensions.fs +17 -0
  82. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs +152 -0
  83. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.js +25 -0
  84. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.js.map +1 -0
  85. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.ts.map +1 -0
  86. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Types.fableproj +28 -0
  87. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs +218 -0
  88. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js +37 -0
  89. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js.map +1 -0
  90. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.ts.map +1 -0
  91. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.Types.fableproj +27 -0
  92. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs +82 -0
  93. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.js +7 -0
  94. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.js.map +1 -0
  95. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.ts.map +1 -0
  96. package/FormSpec.TS/fable_modules/Feliz.2.7.0/BorderStyle.fs +59 -0
  97. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs +154 -0
  98. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.js +32 -0
  99. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.js.map +1 -0
  100. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.ts.map +1 -0
  101. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Feliz.fableproj +42 -0
  102. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Fonts.fs +240 -0
  103. package/FormSpec.TS/fable_modules/Feliz.2.7.0/GridTypes.fs +24 -0
  104. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Html.fs +826 -0
  105. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs +83 -0
  106. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.js +292 -0
  107. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.js.map +1 -0
  108. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.ts.map +1 -0
  109. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs +65 -0
  110. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.js +229 -0
  111. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.js.map +1 -0
  112. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.ts.map +1 -0
  113. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Length.fs +91 -0
  114. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Locale.fs +876 -0
  115. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs +4080 -0
  116. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.js +133 -0
  117. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.js.map +1 -0
  118. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.ts.map +1 -0
  119. package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs +656 -0
  120. package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.js +561 -0
  121. package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.js.map +1 -0
  122. package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.ts.map +1 -0
  123. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs +25 -0
  124. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.js +46 -0
  125. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.js.map +1 -0
  126. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.ts.map +1 -0
  127. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js +63 -0
  128. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js.map +1 -0
  129. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs +41 -0
  130. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.js +7 -0
  131. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.js.map +1 -0
  132. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.ts.map +1 -0
  133. package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs +53 -0
  134. package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.js +7 -0
  135. package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.js.map +1 -0
  136. package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.ts.map +1 -0
  137. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Styles.fs +5740 -0
  138. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs +1455 -0
  139. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.js +39 -0
  140. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.js.map +1 -0
  141. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.ts.map +1 -0
  142. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationLine.fs +13 -0
  143. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationStyle.fs +33 -0
  144. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Transform.fs +181 -0
  145. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransformOrigin.fs +17 -0
  146. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransitionProperty.fs +162 -0
  147. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs +13 -0
  148. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.js +7 -0
  149. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.js.map +1 -0
  150. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.ts.map +1 -0
  151. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs +1768 -0
  152. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.js +2337 -0
  153. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.js.map +1 -0
  154. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.ts.map +1 -0
  155. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs +811 -0
  156. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js +465 -0
  157. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -0
  158. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -0
  159. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs +47 -0
  160. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.js +18 -0
  161. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.js.map +1 -0
  162. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.ts.map +1 -0
  163. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Thoth.Json.fableproj +34 -0
  164. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs +68 -0
  165. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.js +355 -0
  166. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.js.map +1 -0
  167. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.ts.map +1 -0
  168. package/FormSpec.TS/fable_modules/project_cracked.json +1 -0
  169. package/FormSpec.d.ts +1257 -0
  170. package/FormSpecHelpers.d.ts +50 -0
  171. package/Helpers.d.ts +147 -0
  172. package/Interfaces.d.ts +70 -0
  173. package/Interop/FormSpec.Api.Helpers.d.ts +247 -0
  174. package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -0
  175. package/Interop/FormSpec.Api.Option.d.ts +384 -0
  176. package/Interop/FormSpec.Api.Option.d.ts.map +1 -0
  177. package/Interop/FormSpec.Values.Api.Option.d.ts +324 -0
  178. package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -0
  179. package/Migrator.d.ts +59 -0
  180. package/PathwayDataExtractor.d.ts +19 -0
  181. package/PathwayExecutor.d.ts +210 -0
  182. package/PathwayValidator.d.ts +52 -0
  183. package/PluginInterface.d.ts +36 -0
  184. package/Prelude.d.ts +11 -0
  185. package/README.TS.md +622 -0
  186. package/README.md +85 -0
  187. package/package.json +39 -0
  188. package/src/Components/HelloComponent.ts +48 -0
  189. package/src/Components/HelloComponent.ts.map +1 -0
  190. package/src/Designer.ts +389 -0
  191. package/src/Designer.ts.map +1 -0
  192. package/src/FormSpec.ts +3114 -0
  193. package/src/FormSpec.ts.map +1 -0
  194. package/src/FormSpecHelpers.ts +374 -0
  195. package/src/FormSpecHelpers.ts.map +1 -0
  196. package/src/Helpers.ts +765 -0
  197. package/src/Helpers.ts.map +1 -0
  198. package/src/Interfaces.ts +166 -0
  199. package/src/Interfaces.ts.map +1 -0
  200. package/src/Interop/FormSpec.Api.Helpers.ts +872 -0
  201. package/src/Interop/FormSpec.Api.Helpers.ts.map +1 -0
  202. package/src/Interop/FormSpec.Api.Option.ts +1618 -0
  203. package/src/Interop/FormSpec.Api.Option.ts.map +1 -0
  204. package/src/Interop/FormSpec.Values.Api.Option.ts +1214 -0
  205. package/src/Interop/FormSpec.Values.Api.Option.ts.map +1 -0
  206. package/src/Logging/LogTypes.ts +212 -0
  207. package/src/Logging/LogTypes.ts.map +1 -0
  208. package/src/Migrator.ts +156 -0
  209. package/src/Migrator.ts.map +1 -0
  210. package/src/PathwayDataExtractor.ts +290 -0
  211. package/src/PathwayDataExtractor.ts.map +1 -0
  212. package/src/PathwayExecutor.ts +1102 -0
  213. package/src/PathwayExecutor.ts.map +1 -0
  214. package/src/PathwayValidator.ts +244 -0
  215. package/src/PathwayValidator.ts.map +1 -0
  216. package/src/PluginInterface.ts +79 -0
  217. package/src/PluginInterface.ts.map +1 -0
  218. package/src/Prelude.ts +21 -0
  219. package/src/Prelude.ts.map +1 -0
  220. package/src/Renderers/FormSpecMarkdownRenderer.ts +874 -0
  221. package/src/Renderers/FormSpecMarkdownRenderer.ts.map +1 -0
  222. package/src/Renderers/MermaidRenderer.ts +218 -0
  223. package/src/Renderers/MermaidRenderer.ts.map +1 -0
  224. package/src/Renderers/PathwayRenderers.ts +200 -0
  225. package/src/Renderers/PathwayRenderers.ts.map +1 -0
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project Sdk="Microsoft.NET.Sdk">
3
+ <PropertyGroup>
4
+ <TargetFramework>netstandard2.1</TargetFramework>
5
+ <Description>
6
+ Extensible core library used to build forms
7
+ </Description>
8
+ <FablePackageType>library</FablePackageType>
9
+ <PackageTags>fable-javascript</PackageTags>
10
+ </PropertyGroup>
11
+ <ItemGroup>
12
+ <Compile Include="Extensions.fs" />
13
+ <Compile Include="Error.fs" />
14
+ <Compile Include="Field.fs" />
15
+ <Compile Include="Base.fs" />
16
+ </ItemGroup>
17
+ <ItemGroup>
18
+ <PackageReference Include="EasyBuild.PackageReleaseNotes.Tasks">
19
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20
+ <PrivateAssets>all</PrivateAssets>
21
+ </PackageReference>
22
+ <PackageReference Include="Fable.Package.SDK">
23
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
24
+ <PrivateAssets>all</PrivateAssets>
25
+ </PackageReference>
26
+ <PackageReference Include="FSharp.Core" />
27
+ </ItemGroup>
28
+ </Project>
@@ -0,0 +1,24 @@
1
+ module Fable.Form.Field
2
+
3
+ type IAttributes =
4
+ abstract GetFieldId: unit -> string
5
+
6
+ [<NoComparison; NoEquality>]
7
+ type Field<'Attributes, 'Value, 'Values when 'Attributes :> IAttributes> =
8
+ {
9
+ Value: 'Value
10
+ Update: 'Value -> 'Values
11
+ Attributes: 'Attributes
12
+ }
13
+
14
+ let mapValues
15
+ (fn: 'A -> 'B)
16
+ (field: Field<'Attributes, 'Value, 'A>)
17
+ : Field<'Attributes, 'Value, 'B>
18
+ =
19
+
20
+ {
21
+ Value = field.Value
22
+ Update = field.Update >> fn
23
+ Attributes = field.Attributes
24
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get Field$3 () {
13
+ return Field$3;
14
+ },
15
+ get Field$3_$reflection () {
16
+ return Field$3_$reflection;
17
+ },
18
+ get mapValues () {
19
+ return mapValues;
20
+ }
21
+ });
22
+ const _Types = require("@fable-org/fable-library-js/Types.js");
23
+ const _Reflection = require("@fable-org/fable-library-js/Reflection.js");
24
+ class Field$3 extends _Types.Record {
25
+ constructor(Value, Update, Attributes){
26
+ super();
27
+ this.Value = Value;
28
+ this.Update = Update;
29
+ this.Attributes = Attributes;
30
+ }
31
+ }
32
+ function Field$3_$reflection(gen0, gen1, gen2) {
33
+ return (0, _Reflection.record_type)("Fable.Form.Field.Field`3", [
34
+ gen0,
35
+ gen1,
36
+ gen2
37
+ ], Field$3, ()=>[
38
+ [
39
+ "Value",
40
+ gen1
41
+ ],
42
+ [
43
+ "Update",
44
+ (0, _Reflection.lambda_type)(gen1, gen2)
45
+ ],
46
+ [
47
+ "Attributes",
48
+ gen0
49
+ ]
50
+ ]);
51
+ }
52
+ function mapValues(fn, field) {
53
+ return new Field$3(field.Value, (arg)=>fn(field.Update(arg)), field.Attributes);
54
+ } //# sourceMappingURL=Field.fs.ts.map
55
+
56
+ //# sourceMappingURL=Field.fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.ts"],"names":["field","fn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAmBI,IAAA,QACYA,MAAAA,KAAAA,EAAAA,CAAAA,MACiBC,GAAhBD,MAAAA,MAAAA,CAAAA,OACIA,MAAAA,UAAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["./Field.fs"],"names":["field","fn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;WAmBI,YACY,AAAAA,gCACC,AAAgBC,GAAhB,AAAAD,oBACI,AAAAA","file":null,"sourcesContent":null,"sourceRoot":null}
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project Sdk="Microsoft.NET.Sdk">
3
+ <PropertyGroup>
4
+ <TargetFramework>netstandard2.1</TargetFramework>
5
+ <Description>
6
+ Contains the global logic of how a form should behave.
7
+
8
+ It can be used has a standalone library if you want to build your own fields or
9
+ you can use Fable.Form.Simple.Bulma to have a ready to use fields made for Bulma CSS framework.
10
+ </Description>
11
+ <FablePackageType>library</FablePackageType>
12
+ <PackageTags>fable-javascript</PackageTags>
13
+ </PropertyGroup>
14
+ <ItemGroup>
15
+ <Compile Include="Form.fs" />
16
+ </ItemGroup>
17
+ <ItemGroup>
18
+ <ProjectReference Include="..\Fable.Form\Fable.Form.fsproj" />
19
+ </ItemGroup>
20
+ <ItemGroup>
21
+ <PackageReference Include="EasyBuild.PackageReleaseNotes.Tasks">
22
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
23
+ <PrivateAssets>all</PrivateAssets>
24
+ </PackageReference>
25
+ <PackageReference Include="Fable.Package.SDK">
26
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
27
+ <PrivateAssets>all</PrivateAssets>
28
+ </PackageReference>
29
+ <PackageReference Include="FSharp.Core" />
30
+ </ItemGroup>
31
+ </Project>
@@ -0,0 +1,178 @@
1
+ namespace Fable.Form.Simple
2
+
3
+ open Fable.Form
4
+
5
+ [<RequireQualifiedAccess>]
6
+ module Form =
7
+
8
+ module View =
9
+
10
+ [<NoEquality; NoComparison>]
11
+ type OnSubmit = OnSubmit of (unit -> unit)
12
+
13
+ type State =
14
+ | Idle
15
+ | Loading
16
+ | ReadOnly
17
+ | Error of string
18
+ | Success of string
19
+
20
+ type ErrorTracking =
21
+ | ErrorTracking of
22
+ {|
23
+ ShowAllErrors: bool
24
+ ShowFieldError: Set<string>
25
+ |}
26
+
27
+ type Model<'Values> =
28
+ {
29
+ Values: 'Values
30
+ State: State
31
+ ErrorTracking: ErrorTracking
32
+ }
33
+
34
+ type Validation =
35
+ | ValidateOnBlur
36
+ | ValidateOnSubmit
37
+
38
+ [<RequireQualifiedAccess; NoComparison; NoEquality>]
39
+ type Action<'ViewNode> =
40
+ | SubmitOnly of string
41
+ | Custom of (State -> 'ViewNode)
42
+
43
+ [<NoComparison; NoEquality>]
44
+ type ViewConfig<'Values, 'Output, 'ViewNode> =
45
+ {
46
+ OnChange: Model<'Values> -> unit
47
+ OnSubmit: 'Output -> unit
48
+ Action: Action<'ViewNode>
49
+ Validation: Validation
50
+ }
51
+
52
+ [<NoComparison; NoEquality>]
53
+ type FormConfig<'Output, 'ViewNode> =
54
+ {
55
+ OnSubmit: OnSubmit option
56
+ State: State
57
+ Action: Action<'ViewNode>
58
+ Fields: 'ViewNode list
59
+ }
60
+
61
+ let idle (values: 'Values) =
62
+ {
63
+ Values = values
64
+ State = Idle
65
+ ErrorTracking =
66
+ ErrorTracking
67
+ {|
68
+ ShowAllErrors = false
69
+ ShowFieldError = Set.empty
70
+ |}
71
+ }
72
+
73
+ let setLoading (formModel: Model<'Values>) =
74
+ { formModel with
75
+ State = Loading
76
+ }
77
+
78
+ [<NoComparison; NoEquality>]
79
+ type FieldConfig<'Values, 'Value> =
80
+ {
81
+ OnChange: 'Values -> unit
82
+ OnBlur: (string -> unit) option
83
+ Disabled: bool
84
+ IsReadOnly: bool
85
+ ShowError: string -> bool
86
+ }
87
+
88
+ let errorToString (error: Error.Error) =
89
+ match error with
90
+ | Error.RequiredFieldIsEmpty -> "This field is required"
91
+
92
+ | Error.ValidationFailed validationError -> validationError
93
+
94
+ | Error.External externalError -> externalError
95
+
96
+ let custom
97
+ (viewConfig: ViewConfig<'Values, 'Output, 'ViewNode>)
98
+ (renderForm: FormConfig<'Output, 'ViewNode> -> 'ViewNode)
99
+ (renderField: FieldConfig<'Values, 'Output> -> Base.FilledField<'Field> -> 'ViewNode)
100
+ (form: Base.Form<'Values, 'Output, 'Field>)
101
+ (model: Model<'Values>)
102
+ =
103
+
104
+ let (fields, result) =
105
+ let res = Base.fill form model.Values
106
+
107
+ res.Fields, res.Result
108
+
109
+ let (ErrorTracking errorTracking) = model.ErrorTracking
110
+
111
+ let onSubmit =
112
+ match result with
113
+ | Ok msg ->
114
+ if model.State = Loading then
115
+ None
116
+
117
+ else
118
+ (fun () -> viewConfig.OnSubmit msg) |> OnSubmit |> Some
119
+
120
+ | Result.Error _ ->
121
+ if errorTracking.ShowAllErrors then
122
+ None
123
+
124
+ else
125
+ fun () ->
126
+ viewConfig.OnChange
127
+ { model with
128
+ ErrorTracking =
129
+ ErrorTracking
130
+ {| errorTracking with
131
+ ShowAllErrors = true
132
+ |}
133
+ }
134
+ |> OnSubmit
135
+ |> Some
136
+
137
+ let onBlur =
138
+ match viewConfig.Validation with
139
+ | ValidateOnSubmit -> None
140
+
141
+ | ValidateOnBlur ->
142
+ Some(fun label ->
143
+ viewConfig.OnChange
144
+ { model with
145
+ ErrorTracking =
146
+ ErrorTracking
147
+ {| errorTracking with
148
+ ShowFieldError =
149
+ Set.add label errorTracking.ShowFieldError
150
+ |}
151
+ }
152
+ )
153
+
154
+ let showError (label: string) =
155
+ errorTracking.ShowAllErrors || Set.contains label errorTracking.ShowFieldError
156
+
157
+ let fieldToElement =
158
+ renderField
159
+ {
160
+ OnChange =
161
+ fun values ->
162
+ viewConfig.OnChange
163
+ { model with
164
+ Values = values
165
+ }
166
+ OnBlur = onBlur
167
+ Disabled = model.State = Loading
168
+ IsReadOnly = model.State = ReadOnly
169
+ ShowError = showError
170
+ }
171
+
172
+ renderForm
173
+ {
174
+ OnSubmit = onSubmit
175
+ Action = viewConfig.Action
176
+ State = model.State
177
+ Fields = List.map fieldToElement fields
178
+ }