Skip to content

Refactor: extract the editor into its own package (@jsvision/editor) #101

Description

@blendsdk

Summary

Extract the multi-line editor family (currently packages/ui/src/editor/) out of @jsvision/ui
into a dedicated @jsvision/editor package. This isolates a heavy, optional subsystem, gives
the forthcoming code-grade editor work (RD-08, #18) a clean home, and lets ui-only consumers avoid
carrying an editor they don't use.

Decision made 2026-07-18 (discussion under #18).

Motivation

Current coupling (measured)

The editor imports from nine ui subsystems — view (11×), reactive (6×), dialog, status,
layout, controls, window, scroll, dropdown — plus two internal-file reaches:
controls/measure.js (stringWidth/glyphWidth) and dialog/message-box.js
(runDialog/messageBox/ModalDialogHost). And @jsvision/files depends on the editor
(FileEditor). So extraction is a real refactor, not a lift-out.

Work

  • Create packages/editor/ (@jsvision/editor); move packages/ui/src/editor/** into it.
  • Widen @jsvision/ui's public API to export everything the editor consumes — notably
    stringWidth/glyphWidth (measure) and runDialog/messageBox/ModalDialogHost
    (message-box) if not already public.
  • Re-point @jsvision/files from ui's editor exports to @jsvision/editor.
  • Add @jsvision/editor to the lockstep-version set (sync-package-versions).
  • Move the editor's kitchen-sink stories/tests as needed; keep the smoke tests green.
  • yarn verify + yarn gate green.

Related decision (feeds RD-08 #18)

  • The Tokenizer/FoldProvider seam interfaces will live in @jsvision/core (pure zero-dep type
    declarations), so the future @jsvision/lang (Lezer) depends only on core + @lezer/*, not on
    ui/editor.
  • core/ui keep {} runtime deps; the Lezer dependency is isolated in the opt-in @jsvision/lang
    package (mirrors the @jsvision/formszod peer-dep precedent).

Sequencing

Recommended to land before the RD-08 build so the new highlighting/folding/gutter code is authored
in @jsvision/editor from the start. Not a hard blocker — RD-08 could be built in ui and
extracted later, at higher cost.

Acceptance criteria

  • @jsvision/editor exports the full editor family; @jsvision/ui no longer contains editor source.
  • @jsvision/files builds against @jsvision/editor.
  • No behavior change; all existing editor tests + kitchen-sink smoke pass.
  • yarn verify green; lockstep versions synced.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: frameworkLarger framework infrastructureeffort: MMedium — one focused planenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions