You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [TypeScript (no framework)](#typescript-no-framework)
141
-
- [Astro (SSR)](#astro-ssr)
142
-
- [Lit](#lit)
143
-
- [Solid](#solid)
144
-
- [Vue](#vue)
145
-
- [Svelte](#svelte)
146
-
- [React](#react)
147
-
- [CSS](#css)
148
-
- [TypeScript](#typescript)
149
-
- [Support for each implementation](#support-for-each-implementation)
136
+
-[Installation](#installation)
137
+
-[UI Libraries](#ui-libraries)
138
+
-[Implementations](#implementations)
139
+
-[All examples](#all-examples)
140
+
-[Pure HTML with CDN](#pure-html-with-cdn)
141
+
-[TypeScript (no framework)](#typescript-no-framework)
142
+
-[Astro (SSR)](#astro-ssr)
143
+
-[Lit](#lit)
144
+
-[Solid](#solid)
145
+
-[Vue](#vue)
146
+
-[Svelte](#svelte)
147
+
-[React](#react)
148
+
-[CSS](#css)
149
+
-[TypeScript](#typescript)
150
+
-[Support for each implementation](#support-for-each-implementation)
150
151
-[Component libraries](#component-libraries)
151
-
- [Shoelace](#shoelace)
152
-
- [Custom widgets](#custom-widgets)
153
-
- [Design choices](#design-choices)
152
+
-[Shoelace](#shoelace)
153
+
-[Custom widgets](#custom-widgets)
154
+
-[Design choices](#design-choices)
154
155
-[Validation](#validation)
155
156
-[Schema massaging](#schema-massaging)
156
157
-[Custom Elements Manifests](#custom-elements-manifests)
157
158
-[Packages informations](#packages-informations)
158
-
- [_Next_ versions](#next-versions)
159
+
-[_Next_ versions](#next-versions)
159
160
-[Experimental features](#experimental-features)
160
161
-[Improvements](#improvements)
161
162
-[Acknowledgements](#acknowledgements)
163
+
-[Widgets](#widgets)
164
+
-[Typings](#typings)
165
+
-[Lit SSR](#lit-ssr)
162
166
163
167
</details>
164
168
@@ -1088,3 +1092,117 @@ the ideas RSJF creators brought.
1088
1092
-[remark-lint-frontmatter-schema](https://github.com/JulianCataldo/remark-lint-frontmatter-schema): Validate your Markdown **frontmatter** data against a **JSON schema**.
-[astro-openapi](https://github.com/JulianCataldo/astro-openapi): An Astro toolset for building full-stack operations easily, with type-safety and documentation as first-class citizens.
1095
+
1096
+
---
1097
+
1098
+
# 🚧 New documentation 🚧
1099
+
1100
+
<!---->
1101
+
1102
+
As the API is evolving, for now, examples are mostly Lit focused, but the library works perfectly with almost any kind of UI libraries (or none).
1103
+
1104
+
-`engine` is UI agnostic. Unit tested.
1105
+
-`generics` provide a toolbox of helpers, style-less widgets, and a base form element that can easily be customized.
1106
+
-`webawesome` provides a Custom Element pre-loaded with the Webawesome UI library, with a few extras widgets (not native in browsers). It's an extension of the Generic element above.
1107
+
1108
+
The Custom Elements are not the only way to build with JSFE. They are implementation reference, and with minor modification, they can be ported to any JSX based component.
1109
+
1110
+
---
1111
+
1112
+
Quick peek of the new API, we're using Vite here, for the sake of brievety, but special care will follow for React 19, Vue and Solid.
1113
+
1114
+
```ts
1115
+
import { unsafeCSS } from'lit';
1116
+
importstylesfrom'@jsfe/webawesome/css?inline';
1117
+
1118
+
(classextendsJsonSchemaFormWebawesome {
1119
+
staticoverride styles = [unsafeCSS(styles)];
1120
+
}).define();
1121
+
```
1122
+
1123
+
As you can see, CSS loading is left to the user to handle.
1124
+
After many trial and errors, I think it's the most robust way to handle scoped styles presets with total override capabilities for the end user.
1125
+
1126
+
---
1127
+
1128
+
You can get pretty far with pure, native HTML inputs, and the `<jsf-genetic>`, too.
1129
+
1130
+
Trick is to leverage form semantics, and a smart CSS library, like PicoCSS:
Under the hood, it will override the `LitElement` super-class' static styles, combined with your own mean of CSS optimizations (meaning, your bundler).
1153
+
Also, the _JSFE_ API provides class mapping via JS props. for all widgets elements, if you need finer selectors targeting.
1154
+
1155
+
The _JSFE_ provided Custom Elements always have their `styles` empty.
1156
+
Expect some visual breakage for the Webawesome CE if you forget them.
1157
+
For the `<jsf-generic>`, it's "broken" visually by default ;) Goal is to let you "paint" it, from scratch, or via Bootstrap, PicoCSS, Flowbite, DaisyUI… leveraging class mapping.
1158
+
1159
+
## Widgets
1160
+
1161
+
TODO:
1162
+
1163
+
<!---->
1164
+
1165
+
## Typings
1166
+
1167
+
TODO: Typings generation for the Custom Elements is not yet implemented.
1168
+
It will be like https://github.com/JulianCataldo/node-flow-elements.
1169
+
Pretty cool to get Custom Elements type aware for their props, in many UI frameworks.
1170
+
1171
+
## Lit SSR
1172
+
1173
+
_JSFE_ fully supports **server side rendering** via any Lit SSR adapted host (Next.js, Gracile, DIY…).
1174
+
1175
+
It can render **fully static HTML markup** without any client side JS and the whole form will work just fine, via classic `application/x-www-form-urlencoded` submission.
1176
+
1177
+
Adding JS hydration for Custom Elements will "augment" your form for more advanced stuff that cannot be made with native widgets, like array manipulation. Finally, for a more progressive user experience, when JS is loaded, _JSFE_ can take over the classic form submission and provide you a window for rolling your own JSON `GET`s or `POST`s.
1178
+
1179
+
When you want to server render a template, in the light DOM, via **Lit SSR**, **without full page hydration**, and **with or without** Custom Elements hydration, just stringify your seed configurations:
1180
+
1181
+
```ts
1182
+
const Template =html`
1183
+
<!-- -->
1184
+
1185
+
<jsf-webawesome
1186
+
schema=${JSON.stringify(schema)}
1187
+
ui=${JSON.stringify(ui)}
1188
+
data=${JSON.stringify(data)}
1189
+
></jsf-webawesome>
1190
+
1191
+
<!-- -->
1192
+
`;
1193
+
```
1194
+
1195
+
If you don't care about serialization, like when you are hydrating the whole page -with the root, light DOM included-, or if you just use _JSFE_ in a client only LitElement:
Properties binding is not obligatory, you can just use plain props. But keep in mind it's not recommended if those bindings are going through high frequency changes.
1208
+
Also, the big JSON blobs are bloating the DOM, for no real use for reflection.
0 commit comments