Skip to content

Form editor 10f-5: datatype or language after the text of a literal - #250

Merged
faubulous merged 1 commit into
feature/form-editor-v3from
form-editor-v3/literal-field
Nov 19, 2026
Merged

faubulous merged 1 commit into
feature/form-editor-v3from
form-editor-v3/literal-field

Conversation

@faubulous

Copy link
Copy Markdown
Owner

First of four stacked PRs implementing the "Datatype & language" spec (10f-5 to 10f-8), on top of 10f-4. Retarget to feature/form-editor-v3 once 10f-4 merges.

A literal is now edited in a native text area laid over a hidden copy of its text. The copy sets the height and places the tag after the last character, so the tag follows the text and wraps with it.

Changes

  • Tag text:
    • XSD datatypes by their local name (date, integer).
    • Other datatypes by their prefixed name (geo:wktLiteral), or their local name without a prefix.
    • Language tags in standard form (de-DE, zh-Hant-TW), via LanguageTags.normalize.
    • Tooltip: the datatype IRI, or "Language: German (Germany)".
    • Accessible name: "Datatype date, change" / "Language de-DE, change".
  • Plain strings show no tag at rest, and string while being edited.
  • Long values keep the line count of their card at rest. The text fades out before the tag on the last line shown (useOverflowing). With the focus, the whole text shows.
  • Validation:
    • Uses the XSD lexical rules of rdf-validation, the library shacl-engine checks sh:datatype with, so the field and SHACL validation agree. It is now a direct dependency; it was already installed through shacl-engine.
    • On top of that, dates must name a day that exists in their month, and anyURI must contain no white space.
    • An invalid text shows "Not a valid integer — expected 42" under the value, with the tag and the field's underline in the error colour. Empty text is never shown as an error.
  • Keys in a value:
    • Enter writes the row and moves to the field of a new value; Shift+Enter breaks the line.
    • Escape moves to the field of a new value. A second Escape there reverts the row, as before.
    • Backspace in an empty value removes it.
  • Emptied values: a literal emptied while being edited is removed when the row is left, instead of being written as an empty string.
  • Clean-up: useWrappedLines is removed. The tests share one typeInto helper that works for native and VS Code fields.

The tag still opens the existing tag picker; 10f-6 replaces it with the Datatype | Language pop-up.

Verification

  • npm run check
  • vitest: 333 files / 4092 tests
  • browser tests: 7 files / 58 tests
  • node ./build.js

…ts text

A literal is edited in a text area laid over a hidden copy of its text,
so its tag follows the last character and wraps with the text:

- XSD datatypes are named by their local name (date), others by their
  prefixed name (geo:wktLiteral); language tags in standard form
  (LanguageTags.normalize). The tooltip gives the IRI or the language
  name; the accessible name says what the tag changes.
- A plain string has no tag at rest and shows `string` while edited.
- At rest a long text keeps the lines of its card, fading out before the
  tag on its last line (useOverflowing).
- Texts are checked by the XSD lexical rules of rdf-validation, the
  library shacl-engine checks sh:datatype with, plus a day that exists
  in its month; an invalid text shows "Not a valid integer — expected 42"
  under the value, with the tag and underline in the error colour.
- Enter writes and moves to the field of a new value, Shift+Enter breaks
  the line, Escape moves to that field, Backspace removes an empty value;
  literals emptied while edited are removed when the row is left.

The tests share one typeInto helper for native and VS Code fields.
Base automatically changed from form-editor-v3/tag-suggestions to feature/form-editor-v3 November 19, 2026 07:31
@faubulous
faubulous merged commit a1d8472 into feature/form-editor-v3 Nov 19, 2026
6 checks passed
@faubulous
faubulous deleted the form-editor-v3/literal-field branch November 19, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants