Skip to content

Split Anvil into reusable editor packages - #7

Draft
PSchmiedmayer wants to merge 14 commits into
anvil-npm-workspacesfrom
anvil-editor-packages
Draft

PSchmiedmayer wants to merge 14 commits into
anvil-npm-workspacesfrom
anvil-editor-packages

Conversation

@PSchmiedmayer

Copy link
Copy Markdown
Member

♻️ Current situation & Problem

The reusable editor combines Questionnaire logic and React UI in one private workspace.
Hosts need to own storage and editor state, and some consumers need only the editing logic.

Tracked in #5.

⚙️ Release Notes

  • Provide @schmiedmayerlab/anvil-core for the questionnaire model, FHIR validation, store and plugins.
  • Provide @schmiedmayerlab/anvil-react for the React editor, including host actions, external findings and the stylesheet export.
  • Configure the libraries for coordinated public npm releases from signed tags and keep the standalone application as a private workspace.
  • Support maintainer staging for first package creation and use Trusted Publishing for later npm releases.

📚 Documentation

The package READMEs show the standalone core APIs, React embedding and stylesheet imports.
The development guide covers release validation, staged package creation, Trusted Publishing and the separate Pages workflow.

✅ Testing

Verify a clean npm ci, npm run validate, and a Pages build.
Validate the coordinated release plan and install the exact tarballs in a clean consumer to check exported declarations, React peers and CSS.
Check that manual package validation cannot publish and that a release requires an existing verified tag on the matching default-branch commit.

Code of Conduct & Contributing Guidelines

@schmiedmayerlab/anvil-core holds the questionnaire model, import and
export, validation, the plugin registry, the data and validators of the
common FHIR and SDC extensions, and the undo store, with no UI. Its FHIR
types come from the grove-fhir schemas. @schmiedmayerlab/anvil-react holds
the editor UI and the React plugin types. Both build with tsdown to ESM
JavaScript and type declarations and are prepared for npm publication.
The anvil app owns browser storage, import and export.

The plugin types are generic over the component types of a UI layer. The
store gains a content revision that undo restores, a load session,
selection by index path, and the edited language. The editor takes the
host's store, reports changes through onChange, shows external findings
for the current revision only, renders host side panels and toolbar
content, and never writes to browser storage.
@PSchmiedmayer
PSchmiedmayer added this pull request to stack #9 December 3, 2026 21:24
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

needs:
- validate-tag
- build-and-test
uses: SchmiedmayerLab/.github/.github/workflows/npm-publish.yml@v0.5
The editor tests move with the React UI into anvil-react and use its toolbar and plugin props. Persistence and file action tests move to the standalone app, and headless cases that reached Core only through the UI become direct Core tests, since React tests run against the built Core package.
The file action tests that moved to the standalone app restore the clipboard and object URL stubs after each test, like the editor tests.
The paste dialog test requires the error element again, the Core limit validation checks the wrong-type message like the React case it replaced, and the test helpers are used consistently.
The limit message now lives in Core and the item control label in React, so each gets the corrected wording where it moved. The Core and React package manifests use the canonical SchmiedmayerLab/Anvil URLs like the root manifest.
The label test moves with the React standard plugin, and Core checks the "a decimal item" limit message, since the limit and the label now live in separate packages.
…packages

The Core limit message uses the shared Core helper. React keeps its own copy for the control label, since an English article helper is not part of Core's public API.
Apply the lucide-react update to the React and standalone packages,
which now own that dependency, and refresh the npm lockfile with the
same versions as the npm workspaces change.
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