Open chris-czopp opened 2 years ago
Very nice use of directives there, loving it. I don't get where this is composable in the meaning where you only have to load what you actually use. It looks more fully integrated to me (not that this is necessarily bad, just reading through your claims and trying to make sense of them). Great job and I really think this will make a nice addition.
Thanks. Directives is actually @davedbase idea and it seems to fit very well here. Re composable, I refer to the way of using the actual inputs. In the past, I worked with JSON Forms (great for prototyping), and the lib uses JSON for laying out inputs: https://jsonforms.io/docs/uischema/layouts. It was a real pain to make any serious customisations. I want to relay on composition and use JSX as DSL for constructing UI. Forms are tricky because it's hard to find the balance between how chunky the component should be. Too small isn't that helpful for a developer, too chunky and it isn't easily customisable. Anyway, I agree the claim "composable" is probably too generic.
Thanks for the clarification. I'd really appreciate a PR. Though on the topic of composability, have a look at the fetch component. Maybe a future version could similarly encapsulate the different separate abilities (bound inputs, validation, etc) in separate exports and have a main entry point to bind everything together. That is, if those abilities make sense in separation.
just looked at fetch's with*
modifiers, really awesome concept!
createForm()
proposal.Requirements
Proposed design
Simple
It uses directives.
MyFormAdapter.ts
:Advanced
Very explicit, giving loads of control. It uses JSON schema under the hood which is translated to signals. It's assumed the initial values come from the schema
default
values.MyFormAdapter.ts
:Here is the playground I'll try to keep up-to-date as much as possible: https://stackblitz.com/edit/solidjs-templates-grmrsw?file=src%2FactualCode%2FmyForm.tsx