this repo has no description
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

update documentation

+20 -12
+2 -1
formz/README.md
··· 16 16 manage, and would like to keep the form markup and parsing logic in sync. It 17 17 takes some amount of effort to make an actual form generator with markup and 18 18 styles, and that might not be worth it for a one-off form. That said, a simple 19 - form generator is provided if you aren't opinionated about your markup. 19 + form generator is provided if you aren't opinionated about your markup, and this 20 + author would use this for one off forms himself... 20 21 21 22 ```sh 22 23 gleam add formz@0.1
+2 -1
formz/gleam.toml
··· 4 4 version = "2.0.1" 5 5 description = "Accessible, type safe form parsing and generating for Gleam" 6 6 licences = ["Unlicense"] 7 - repository = { type = "github", user = "bentomas", repo = "formz", path = "formz" } 7 + # repository = { type = "tangled", user = "@bthom.tngl.sh", repo = "formz", path = "formz" } 8 + repository = { type = "custom", url = "https://tangled.org/@bthom.tngl.sh/formz" } 8 9 gleam = ">= 1.6.0" 9 10 10 11 [dependencies]
+16 -10
formz/src/formz.gleam
··· 57 57 //// </td> 58 58 //// </tr> 59 59 //// <tr> 60 - //// <td>Accessing and manipulating config for a form item</td> 60 + //// <td>Creating, accessing and manipulating config for a form item</td> 61 61 //// <td> 62 + //// <a href="#named">named</a><br> 62 63 //// <a href="#update_config">update_config</a><br> 63 64 //// <a href="#set_name">set_name</a><br> 64 65 //// <a href="#set_label">set_label</a><br> ··· 202 203 /// and underscores. 203 204 name: String, 204 205 /// This library thinks of a label as required, but will make one for you from 205 - /// the name if you don't provide one via the `field` function. For 206 + /// the name if you don't provide one via the `set_label` function. For 206 207 /// accessibility reasons, a field should always provide a label and all 207 208 /// the maintained form generators will output one. 208 209 label: String, ··· 463 464 case max - num_nonempty { 464 465 x if x < 0 -> Error(-x) 465 466 _ -> { 466 - int.max(1 - num_nonempty, int.min(extra, max - num_nonempty)) 467 467 list.fold([1, extra, min], 0, int.max) 468 468 469 469 // if they've specified a minimum required, then start there ··· 1069 1069 }) 1070 1070 } 1071 1071 1072 - /// Convenience function for setting the `InputState`s of a list field. This 1073 - /// takes a list of Results, where the Ok means the input is `Valid` and 1074 - /// `Error` means the input is `Invalid` with the given error message. 1072 + /// Convenience function for setting the `InputState`s of a list field to an 1073 + /// error. This takes a list of Results, where the Ok means the input *should 1074 + /// not be changed* and `Error` means the input's state should be `Invalid` 1075 + /// with the given error message. 1075 1076 /// 1076 - /// This does not clear any existing errors, it will just set the errors marked 1077 - /// in the input list. If you want to clear errors you'll have to use the 1078 - /// `update` function and do it manually. 1077 + /// To be clear, this does not clear any existing errors, it will just set the 1078 + /// errors marked in the input list. If you want to clear errors you'll have 1079 + /// to use the `update` function and do it manually. 1079 1080 /// 1080 1081 /// ### Example 1081 1082 /// ··· 1163 1164 /// additional constraints. Like say, requiring a `String` to be at least 1164 1165 /// a certain length, or that an Int must be positive. 1165 1166 /// 1167 + /// If you want to chain additional validation and change the return type, 1168 + /// you'll have to create a new definition. There is (currently) no function 1169 + /// for wrapping an existing definition in additional verify logic that changes 1170 + /// either the required or optional type. 1171 + /// 1166 1172 /// ### Example 1167 1173 /// ```gleam 1168 1174 /// field 1169 - /// |> validate(fn(i) { 1175 + /// |> verify(fn(i) { 1170 1176 /// case i > 0 { 1171 1177 /// True -> Ok(i) 1172 1178 /// False -> Error("must be positive")