Skip to content

Initial RDF forms component#798

Draft
timea-solid wants to merge 27 commits into
stagingfrom
rdfComponets
Draft

Initial RDF forms component#798
timea-solid wants to merge 27 commits into
stagingfrom
rdfComponets

Conversation

@timea-solid

@timea-solid timea-solid commented Jun 16, 2026

Copy link
Copy Markdown
Member

This is for now:

  • adding an overall RDF forms component to storybook
  • testing its behaviour in Storybook by implementing a first RDF input Web Component
@timea-solid timea-solid marked this pull request as draft June 16, 2026 12:17
Prompt: reading the RDFinput file, pls make suggestions of how to impprve the code to make it easier to follow and read. I beliebe it is difficult to follow the fact that one has a rdf forms subject and a data subject as well and how it is all itertwinded.
Co-Authored-By: GitHub Copilot (raptor-mini) <copilot@github.com>
@timea-solid timea-solid moved this to In progress in SolidOS NLNet UI Jun 22, 2026
@timea-solid timea-solid changed the title RDF forms component Jun 23, 2026
@timea-solid timea-solid self-assigned this Jun 23, 2026
@timea-solid timea-solid requested a review from NoelDeMartin June 23, 2026 08:32

@NoelDeMartin NoelDeMartin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few initial comments, mostly regarding a11y and component architecture.

Comment thread src/types/custom-elements.d.ts
Comment on lines +102 to +108
rdfTurtleFormatSource=${rdfTurtleFormatSource}
rdfURI=${rdfURI}
whichForm=${whichForm}
rdfName=${rdfName}
subjectTurtleFormatSource=${subjectTurtleFormatSource}
subjectName=${subjectName}
subjectURI=${subjectURI}>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need all these attributes? This is a bit confusing, I'm not sure what each property does and why we need so many.

Could it work with something like this?

<solid-ui-rdf-form
    form="https://solidos.solidcommunity.net/public/2021/solidUiFormTestData/dummyFormTestFile.ttl#form"
    subject="https://solidos.solidcommunity.net/public/2021/alice.ttl#me"
>
</solid-ui-rdf-form>

Internally, it could resolve the form and subject from the store associated to the authenticated user.

Comment on lines +27 to +28
@property({ type: String })
set rdfURI (value: string) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these two propertie (rdfURI and subjectURI) can probably be simplified a lot, I'm not sure we need the _parsedUrl variables or duplicating the URL parsing code. Check out Lit converters.

Comment thread src/components/rdf-form/RDFForm.ts Outdated
})
const me = Namespace(this.subjectURI + '#')(this.whichSubject)

return html`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the inputs, shouldn't this output a native <form> as well? Ideally, whatever is generated from this component ends up being a "real" form. That is important in order to integrate with accessibility tooling and user expectations (implicit form submission, etc.).

Comment thread src/components/rdf-form/RDFForm.ts Outdated
return html` <solid-ui-rdf-input
.store=${store}
.formSubject=${sym(part.value)}
.dataSubject=${me}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all inputs should also have a name attribute. Otherwise, they'll be ignored by the form (again, important for a11y, etc.).

Comment thread src/components/rdf-input/RDFInput.ts Outdated
Comment on lines +21 to +22
@property({ attribute: false })
accessor store!: LiveStore

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing the store as a property, I think we should use Lit context instead. See my other comments talking about this.

Comment thread src/components/rdf-input/RDFInput.ts Outdated
Comment on lines +29 to +38
export type FieldParamsObject = {
size?: number, // input element size attribute
type?: InputType, // input element type attribute. Default: 'text' (not for Comment and Heading)
element?: string, // element type to use (Comment and Heading only)
style?: string, // style to use
dt?: string, // xsd data type for the RDF Literal corresponding to the field value. Default: xsd:string
defaultInputValue?: string, // e.g. 'mailto:'. Default value in input field, will be removed when displaying actual value to user.
namedNode?: boolean, // if true, field value corresponds to the URI of an RDF NamedNode. Overrides dt and defaultInputValue.
pattern?: RegExp // for client-side input validation; field will go red if violated, green if ok
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of these are currently unused, right? I see that this is a WIP, so it's fine. But before merging, I would remove everything that isn't used (you know, YAGNI, removing dead code, etc.).

Also, I'm not sure I like the style config... that goes a bit against the idea of RDF forms, given that different UI libraries may render forms differently, and inline styles are probably not going to work correctly in all of them. But if that was a design decision when creating the RDF forms, ok.

timea-solid and others added 2 commits June 24, 2026 10:03
Prompt: can this #sym:HTMLElementTagNameMap be generated automatically from vite-config/ components.ts for all RDF suffixed components?

Co-Authored-By: GitHub Copilot (raptor-mini) <copilot@github.com>
@timea-solid

Copy link
Copy Markdown
Member Author

RDFInput will make use of the new Input components when it is merged: #815

@timea-solid

Copy link
Copy Markdown
Member Author

We need to improve the name property of the generated form and make sure they are unique.

@NoelDeMartin NoelDeMartin self-requested a review June 30, 2026 07:57
Comment thread src/components/input/Input.styles.css Outdated
Comment thread src/lib/forms/store/RDFFormsStore.ts Outdated
@consume({ context: storeContext, subscribe: true })
private accessor storeContext: StoreContext = DEFAULT_STORE

@property({ attribute: false })

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the attribute: false necessary? I guess we do want to observe is this property changes, although it'll be very uncommon (wouldn't even worry about testing it for now).

Comment thread src/components/rdf-form/RDFForm.ts Outdated
private accessor entireDataIsReadonly: boolean = true

@state()
private accessor _parsedUrl: URL | null = null

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned this in my previous review, but as reminder I don't think we need these two attributes, see Lit converters.

Comment thread src/components/rdf-form/RDForm.stories.ts Outdated
Comment thread src/components/rdf-input/RDFInput.ts
Comment thread src/types/custom-elements.d.ts
Comment thread vite.config.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants