Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
bd8fe14
feat(lit-form): preliminary object models support
platosha Jul 31, 2025
19e9069
Merge branch 'main' into feat/model-object-binder
platosha Aug 4, 2025
cbe7a03
feat(models): constraints support
platosha Aug 29, 2025
3e9b929
refactor(models): simplify constraint definitions
platosha Sep 1, 2025
aef40b0
fix(models): constraint test fixes
platosha Sep 2, 2025
5ff5c36
feat(form): support object model constraints
platosha Sep 2, 2025
82a1db2
fix(models): allow any key
platosha Sep 10, 2025
11cb276
fix(models): TypeScript usage issues of optional, array and constrain…
platosha Sep 10, 2025
00c466c
refactor(models): move constraints to separate directory
platosha Sep 10, 2025
969d8e3
refactor(models): move constraints back to src directory, dirs are to…
platosha Sep 11, 2025
2bf1f19
feat(models): missing features and fixes for binder
platosha Sep 15, 2025
da244d6
text(lit-form): use object models in tests
platosha Sep 15, 2025
6fadcde
feat(models): make optional key have undefined default value
platosha Sep 15, 2025
4565100
fix(lit-form): make basic value init work with object model
platosha Sep 15, 2025
f7f3fb9
fix(lit-form): basic array and object operations with object models
platosha Sep 15, 2025
a101edd
test(lit-form): forgotten constraint in test fixture
platosha Sep 16, 2025
e919ca0
fix(lit-form): correct binder node name
platosha Sep 16, 2025
28d9eb4
test(lit-form): correct model name
platosha Sep 16, 2025
2935b33
fix(models): improve constrant definitions for binder
platosha Sep 17, 2025
6c5f757
fix(lit-form): support object models in field directive
platosha Sep 19, 2025
88e34d4
fix(lit-form): field support for string object model
platosha Sep 19, 2025
6b54ca7
fix(lit-form): combo box field support with array object models
platosha Sep 19, 2025
e6401f3
feat(models): enable optional self-referencing arrays
platosha Sep 29, 2025
cef1fdc
feat(models): optional array models
platosha Sep 30, 2025
29a6e58
feat(models): nested self-referencing models
platosha Oct 1, 2025
9bc6f8c
fix(models): keep original default value in optional models
platosha Oct 2, 2025
d3e519a
fix(models): make default value simple objects
platosha Oct 2, 2025
88e803c
test(lit-form): correct fixture expectations
platosha Oct 2, 2025
663c4a8
perf(models): cleanup & replace aliases with mapped types to avoid tr…
platosha Oct 2, 2025
1d71b2b
fix(models): make number model carry NaN (empty value) by default
platosha Oct 2, 2025
4fddfab
feat(react-form): support object models
platosha Oct 2, 2025
ebe0b45
feat(lit-form): expose stringConverter utility for react-form
platosha Oct 2, 2025
e18ea66
fix!(models): simplify object models more
platosha Oct 2, 2025
b6244f7
fix(models): deep self-referencing models
platosha Oct 3, 2025
ccf055d
fix(models): test fixes
platosha Oct 3, 2025
66f2fb7
test(react-form): handle unhandled rejection in tests
platosha Oct 6, 2025
21f3ee3
test(react-form): bring old tests back for now
platosha Oct 6, 2025
acf078f
Merge branch 'main' into feat/model-object-binder
platosha Oct 6, 2025
bcdcf85
fix(models): circular dependency
platosha Oct 6, 2025
e18ab24
chore: update package-lock.json
platosha Oct 6, 2025
4ca417f
fix(models): simplify self references implementation
platosha Oct 6, 2025
89732d2
fix(models): make output prettier for simple types
platosha Oct 6, 2025
77531df
Merge branch 'main' into feat/model-object-binder
platosha Oct 7, 2025
ba89908
chore: update package-lock.json
platosha Oct 7, 2025
54dadb4
fix: TypeScript errors
platosha Oct 7, 2025
d500bf6
Merge branch 'main' into feat/model-object-binder
Lodin Oct 7, 2025
37ff6dd
refactor(models): type naming and comments
platosha Nov 6, 2025
7baf464
Merge branch 'main' into feat/model-object-binder
platosha Nov 19, 2025
a7467e0
chore: update package[-lock].json
platosha Nov 20, 2025
dca7849
refactor(lit-form): apply review suggestions
platosha Nov 20, 2025
e9882ee
Merge branch 'main' into feat/model-object-binder
platosha Nov 20, 2025
32df655
Update packages/ts/lit-form/src/StringConverter.ts
platosha Nov 20, 2025
702d26b
refactor(lit-form): apply review suggestions
platosha Nov 20, 2025
fc2de33
refactor(models): clarify TSdoc comment
platosha Nov 20, 2025
b43fdff
refactor(models): review suggestions
platosha Nov 20, 2025
8b880b9
Merge branch 'main' into feat/model-object-binder
platosha Nov 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/ts/lit-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
},
"dependencies": {
"@vaadin/hilla-frontend": "25.0.0-beta5",
"@vaadin/hilla-models": "25.0.0-beta5",
"validator": "13.12.0"
},
"peerDependencies": {
Expand Down
11 changes: 6 additions & 5 deletions packages/ts/lit-form/src/Binder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { LitElement } from 'lit';
import { type BinderConfiguration, BinderRoot } from './BinderRoot.js';
import type { AbstractModel, DetachedModelConstructor, Value } from './Models.js';
import type { Value } from './Models.js';
import type { ProvisionalModel, ProvisionalModelConstructor } from './ProvisionalModel.js';

/**
* A Binder controls all aspects of a single form.
Expand All @@ -10,15 +11,15 @@ import type { AbstractModel, DetachedModelConstructor, Value } from './Models.js
* @typeParam T - Type of the value that binds to a form
* @typeParam M - Type of the model that describes the structure of the value
*/
export class Binder<M extends AbstractModel> extends BinderRoot<M> {
export class Binder<M extends ProvisionalModel> extends BinderRoot<M> {
declare readonly ['constructor']: Omit<typeof Binder<M>, 'constructor'>;

context: Element;

/**
*
* @param context - The form view component instance to update.
* @param Model - The constructor (the class reference) of the form model. The Binder instantiates the top-level model
* @param modelClass - The constructor (the class reference) of the form model. The Binder instantiates the top-level model
* @param config - The options object, which can be used to config the onChange and onSubmit callbacks.
*
* ```
Expand All @@ -27,14 +28,14 @@ export class Binder<M extends AbstractModel> extends BinderRoot<M> {
* binder = new Binder(orderView, OrderModel, {onSubmit: async (order) => {endpoint.save(order)}});
* ```
*/
constructor(context: Element, Model: DetachedModelConstructor<M>, config?: BinderConfiguration<Value<M>>) {
constructor(context: Element, modelClass: ProvisionalModelConstructor<M>, config?: BinderConfiguration<Value<M>>) {
const changeCallback =
config?.onChange ??
(typeof (context as LitElement).requestUpdate === 'function'
? () => (context as LitElement).requestUpdate()
: undefined);

super(Model, {
super(modelClass, {
...(config ?? {}),
onChange: changeCallback,
context,
Expand Down
Loading
Loading