Skip to content

feat(registry): design-system registry infrastructure#46

Merged
shokurov merged 1 commit into
lovasoa:mainfrom
shokurov:feat/upstream-registry
Jun 19, 2026
Merged

feat(registry): design-system registry infrastructure#46
shokurov merged 1 commit into
lovasoa:mainfrom
shokurov:feat/upstream-registry

Conversation

@shokurov

Copy link
Copy Markdown
Collaborator

Summary

  • Introduces a pluggable component + slot registry that lets consumers render the entire editor tree with any design system (MUI, Chakra, custom) without forking the library
  • SchemaBuilderRegistryProvider nests — inner registries merge over outer, so you override only what you need
  • Layout ownership enforced: DefaultFieldFrame and DefaultFieldHeader own their own visual classes; callers pass only semantic state (depth, expanded, hasErrors)
  • Ships a full Material UI demo (demo/pages/MuiRegistry.tsx) that overrides every component adapter and slot adapter — demonstrates the API and justifies @mui/material as a dev dep

Public API additions

Export Purpose
SchemaBuilderRegistryProvider Context provider wrapping the editor tree
mergeRegistry(base, override) Explicit registry merge helper
SchemaBuilderRegistry / SchemaBuilderComponents / SchemaBuilderSlots Types
useComponent / useSlot / useSlotProps Internal hooks (re-exported for advanced use)

Component adapters

Button, Input (with integrated label prop), Switch, Label, Badge, ButtonToggle (exposes aria-pressed for toggle state)

Slot adapters

FieldFrame (depth, expanded, hasErrors), FieldHeader, FieldMain, FieldActions, FieldBody, Root, MobileModeSwitch, FullscreenToggle

Test plan

  • npm test — 4 new registry test files covering component overrides, slot overrides, mergeRegistry, and provider nesting
  • npm run typecheck — no errors
  • npm run check — no lint/format errors
  • Open npm run demo → navigate to MUI Registry tab and verify all 6 schema fields render with MUI components

Introduces a pluggable component + slot registry so the editor tree can
be rendered entirely with any design system (MUI, Chakra, etc.) without
forking the library.

Public API
- `SchemaBuilderRegistryProvider` — context provider; registries nest
  (inner merges over outer, so consumers override only what they need)
- `mergeRegistry(base, override)` — explicit merge helper
- `useComponent` / `useSlot` / `useSlotProps` — internal hooks consumed
  by every editor component

Component adapters (Button, Input, Switch, Label, Badge, ButtonToggle)
Slot adapters (Root, FieldFrame, FieldHeader, FieldMain, FieldActions,
  FieldBody, MobileModeSwitch, FullscreenToggle)

Layout ownership
DefaultFieldFrame and DefaultFieldHeader own their own layout classes;
callers pass only semantic state (depth, expanded, hasErrors).

Demo
demo/pages/MuiRegistry.tsx — full working example of overriding every
component and slot adapter with @mui/material primitives.
demo/App.tsx — two-tab nav (Default | MUI Registry).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lovasoa

lovasoa commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Hello and thank you! I find this a little hard to review. The pr is huge. Did you review it yourself?

@lovasoa

lovasoa commented Jun 17, 2026

Copy link
Copy Markdown
Owner

The entire project has roughly 7k lines today, and this PR has almost 8k new lines and 2k deleted lines.

I think it's not fair to ask me to review all that, especially if you haven't reviewed it yourself.

image
jsonjoy-builder on  main [$] is 📦 v1.0.3 via  v26.3.0
❯ cloc src
      50 text files.
      50 unique files.
       0 files ignored.

github.com/AlDanial/cloc v 2.08  T=0.02 s (2034.1 files/s, 390180.1 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
TypeScript                      47            766           1023           7288
CSS                              1             62              7            269
JSON                             2              0              0            176
-------------------------------------------------------------------------------
SUM:                            50            828           1030           7733
-------------------------------------------------------------------------------

@lovasoa

lovasoa commented Jun 17, 2026

Copy link
Copy Markdown
Owner

If you want to move forward, I think you should split this, and start with one small PR, that clearly brings value on its own, with a human written description of what you did to ensure the LLMs output is correct and why you think the changes are valuable, and don't introduce code duplication, unreachable hidden undocumented features, test cheats, illogical user experience, and other common issues introduced by unmonitored AI agents

@shokurov

Copy link
Copy Markdown
Collaborator Author

Hello, @lovasoa !

Of course I did review this PR. In fact this is 4th or 5th generation of internal reviews.
I've removed all the stuff that was non-essential, such as design docs, storybook and my internal CI/CD harness.

I think you are being unfair judging the size of the PR by sheer LOC.

In fact the only large pieces are:

  1. the new demo page
  2. test baseline snapshots (autogenerated)

Otherwise all the changes are atomic, clean extract refactorings of ui components. Even if I reduce the amount of these incremental changes (meaning less components migrate), that won't much affect total LOC, the demo will still be needed and the snapshots have to be updated.

I will be happy to assist with an overview doc, if you wish, to guide you through the changes, would that help?

Egor

@lovasoa

lovasoa commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Hi Egor!
I know you are motivated, and want this project to move forward. On the other side, I don't really have the resources right now to review large changes. What do you think about helping with maintenance yourself ? If you can promise you'll maintain this code in the long term, I can add you as an admin to this repo, and you'll be able to merge the PR yourself. You just have to commit to answer to potential future issues other users may have with it. Does that sound ok ?

@lovasoa

lovasoa commented Jun 18, 2026

Copy link
Copy Markdown
Owner

And if you are in the mood of reviewing large changes, there is this other PR that sounds like a nice feature, but is also too large for me to review at the moment: #47 . Feel free to merge it if it's good.

@shokurov

Copy link
Copy Markdown
Collaborator Author

@lovasoa Yes, I can commit fair share of my time to project maintenance. Can't promise always day-to-day answers, though. What are your expectations? Are you up to continue doing maintenance?

@lovasoa

lovasoa commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Yes, I'm staying here as a maintainer. This is unpaid labor, so I won't require anything from you, but if you could at least review PRs and issues touching the code you added, it'd be nice. If you have more time and want to take more ownership, that's even better. I sent you an invite.

@lovasoa

lovasoa commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Publishing to npm is automated, so you should be able to publish new versions just by pushing a new tag: https://github.com/lovasoa/jsonjoy-builder/blob/main/.github/workflows/publish.yml

@shokurov

Copy link
Copy Markdown
Collaborator Author

Thank you, @lovasoa, I will have a look into #47 later this week

@shokurov shokurov merged commit de8bc19 into lovasoa:main Jun 19, 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.

2 participants