Skip to content

Add headless text surface primitives#187

Merged
developer-1px merged 2 commits into
mainfrom
issue-186-text-surface
Jun 24, 2026
Merged

Add headless text surface primitives#187
developer-1px merged 2 commits into
mainfrom
issue-186-text-surface

Conversation

@developer-1px

Copy link
Copy Markdown
Owner

Summary

Closes #186.

Adds DOM-free text surface primitives to the root @interactive-os/json-document public surface:

  • textSurfaceFragment extracts selected text plus atom/range sidecars.
  • replaceTextSurfaceSelection builds a text replacement patch with atom/range offset mapping and selectionAfter.
  • syncTextSurfaceMutation maps native-input style text mutations into a replace patch plus sidecar updates.

This keeps contenteditable-specific concerns out of json-document: no DOM selection, browser events, IME lease, React timing, or editor block semantics are introduced.

Verification

  • npm run typecheck -w @interactive-os/json-document
  • npm test -w @interactive-os/json-document -- text-surface
  • npm test -w @interactive-os/json-document -- package-exports semantic-contract
  • npm test -w @interactive-os/json-document
  • npm run build -w @interactive-os/json-document
  • npm run smoke:package -w @interactive-os/json-document
  • pre-push npm run build

@developer-1px developer-1px merged commit fcc873a into main Jun 24, 2026
3 checks passed
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.

Add headless text surface primitives

1 participant