Skip to content

Add the @plone/controlpanels package with the content types driver - #271

Open
sneridagh wants to merge 5 commits into
feat/missing-widgetsfrom
feat/controlpanels-scaffold
Open

sneridagh wants to merge 5 commits into
feat/missing-widgetsfrom
feat/controlpanels-scaffold

Conversation

@sneridagh

@sneridagh sneridagh commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Phase 0 of #269 (content types control panel). Stacked on #263.

What

A new package, @plone/controlpanels, for control panel screens that run unchanged in Plone Aurora and in Volto. This PR adds no screens yet, only what they will be built on:

  • Data model (src/content-types/types.ts): what the screens show and edit, including type settings, schema, behaviors, workflows, workflow change previews and jobs, and site defaults. It's independent of any backend payload.
  • ContentTypesDriver (src/content-types/driver.tsx): the interface every app implements to read and write that data. In Aurora that's resource routes and @plone/client; in Volto it will be redux; stories and tests use the mock. The driver's capabilities say what its backend supports, so the screens can ship against today's plone.restapi and turn features on as [DRAFT] Endpoints for per-type content settings, behavior order and workflow assignment plone.restapi#2061 lands. Optional methods exist only when their capability is on.
  • createMockDriver(): an in-memory driver seeded with fixtures captured from the acceptance backend (Plone 6.2 + plone.volto), completed by hand where plone.restapi has no data yet (per-type settings, behavior order, workflows, state counts). Each behavior's fields come from its own schema (captured from scratch types with every behavior enabled), and an add-on behavior (collective.sponsors) stands for behaviors the frontend knows nothing about. Folder is left out, since plone.volto replaces folders with folderish pages. It covers every method, including workflow changes run as jobs, plus options for latency and turning capabilities off.
  • suggestStateMapping(): the workflow change suggestion from the design. It keeps who can see an item and never makes content more visible. Unlike the classic panel, it maps Published to Externally visible instead of Internal draft.
  • stateColor(): the color the UI shows a workflow state with, one of the six Quanta color families (gray, blue, teal, green, yellow, red). The first that applies wins: app overrides by state id, the color the backend sets on the state, defaults for Plone's core states (DEFAULT_STATE_COLORS), then a color derived from who can see items in the state, so custom workflows get a meaningful color too.
  • ControlPanelsProvider: connects the screens to the app's router (through the react-aria-components RouterProvider), translations (translate, in react-intl's message shape so both Aurora and Volto can plug in) and notifications (notify).

Keeping it usable in Volto

  • Allowed dependencies: react, react-aria-components, @plone/quanta, @plone/helpers, @plone/registry, jotai. React peers stay at 16.8–19.
  • src/dependencies.test.ts fails when package.json or a source file uses anything else. ESLint's no-restricted-imports reports the usual offenders (react-router, i18n libraries, @plone/client, @plone/cmsui, @plone/components…) in the editor.
  • Rules are written down in the package's AGENTS.md.

Also

  • Like the other add-on packages, it ships its TypeScript source with no build step: Aurora (Vite) and Volto (Babel, automatic JSX runtime) compile it. The release groups and the package lists in the docs include it.
  • Storybook is set up (pnpm --filter @plone/controlpanels storybook, port 6007), with an introduction page for now.

Not in this PR

  • CSS for Volto: a precompiled controlpanels.css comes with the Volto port. quanta.css only ships tokens, not Tailwind utilities, so Volto needs the utilities compiled for it. Aurora compiles the package's classes from its source.

Checks

  • pnpm --filter @plone/controlpanels test --run: 31 tests pass. I confirmed the dependency guard fails when react-router is imported.
  • pnpm --filter @plone/controlpanels check:ts and build-storybook pass.

Phase 0 of #269: the data model of the content types control panel, the
ContentTypesDriver interface with its capabilities, a mock driver seeded with
fixtures from a real site, the ControlPanelsProvider (router, translations,
notifications) and a guard that keeps the package's dependencies usable in
Volto.
@sneridagh sneridagh mentioned this pull request Oct 11, 2026
10 tasks
The mock inferred them from the fixture type schemas, so behaviors no fixture
type enables (Lead image, Rich text, add-on behaviors) looked like they added
no fields. Also drop the Folder fixture: plone.volto doesn't use folders, so
Document carries the sample items instead. Add an add-on behavior to the
fixtures.
States can carry a color from the backend. stateColor() picks the color to
show: app overrides, then the backend's color, then defaults for Plone's core
states, then a color derived from who can see items in the state, so custom
workflows get one too.
The app that uses it compiles it, so it has no tsup build and is not part of
build:deps.

This branch has not been deployed

No deployments
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.

1 participant