The CWA is in heavy development
The CWA is still in alpha and not ready for production - some code and implementations are likely to change. If you would like to try out the CWA, please enjoy what we have provided and feel free to provide feedback, or get involved on GitHub.
DraftCwa Api

cwa.admin

Admin edit mode, the component selection stack, the internal event bus, and the navigation guard.

Controls admin edit mode and the component selection stack. Mostly used internally, but exposed for custom admin UIs.

cwa.admin.isEditing.value        // boolean — whether the admin panel is open in edit mode
cwa.admin.toggleEdit(true)       // open edit mode
cwa.admin.toggleEdit(false)      // close edit mode
cwa.admin.toggleEdit()           // toggle
cwa.admin.emptyStack()           // clear the selected component stack
cwa.admin.emitRedraw()           // force re-render of the component overlay

Event Bus

cwa.admin.eventBus is a global mitt emitter that the admin uses to coordinate between the resource manager, the focus overlay, and the components on the page.

These are internal events and may change without notice. They exist to wire the admin UI together, not as a public integration point — event names, payload shapes, and firing conditions can be added, renamed, or removed in any release, including patch releases, with no deprecation period. Nothing here follows the module's public API contract. If you depend on one, pin your module version and re-test on every upgrade.
const cwa = useCwa()

const onSelect = (iri: string) => console.log('selected', iri)

onMounted(() => cwa.admin.eventBus.on('selectResource', onSelect))
onBeforeUnmount(() => cwa.admin.eventBus.off('selectResource', onSelect))

The full surface is mitt's — on, off, emit, the '*' wildcard, and the raw all handler Map. There is no once, and on() returns nothing rather than an unsubscribe function, so keep a reference to your handler and pass the same function to off(). Calling off(type) with no handler removes every listener for that event, including the module's own.

Events

EventPayloadFired when
manageableComponentMountedstring — resource IRIA component using the resource manager mounts.
componentMountedstring — resource IRIA component mounts with the manager disabled, a placeholder or hotspot mounts, or a parent re-emits as the mount cascades up the tree.
selectResourcestring — resource IRIA resource should become the admin's selection — a newly added component, or an admin jumping to the component behind a page-data position.
reorderReorderEventAn admin changes a component's order, via the up/down buttons or by typing an order number.
redrawFocusundefinedThe focus overlay needs redrawing — after mounts, on window resize, and when the manager opens or closes. Emit with no second argument.

ReorderEvent is the one payload type the module exports:

import type { ReorderEvent } from '#cwa/admin/admin'

type ReorderEvent = {
  positionIri: string
  location: 'previous' | 'next' | number
}

A location of 'previous' or 'next' moves the position one step; a number sets an absolute position and is 1-based. Groups that aren't reordering ignore the event, so it is safe to broadcast.

Caveats

Beyond the "may change without notice" warning above, a few behaviours are easy to trip over:

  • Mount events are admin-only. manageableComponentMounted and componentMounted only fire for signed-in admins. Don't build front-end behaviour on them — visitors will never see them.
  • componentMounted payloads aren't always resource IRIs. Placeholders and hotspots emit <iri>_placeholder, so don't feed the payload straight into getResource() without checking.
  • redrawFocus is throttled to 40ms. Emitting it in a tight loop won't produce a redraw per call.
  • The events map isn't exported. Handlers passed inline to on() are still type-checked and narrowed correctly, and an unknown event name is a compile error — but to type a standalone handler you'll need to hand-write the signature ((iri: string) => void) or import ReorderEvent.

The admin tracks unsaved changes and shows a confirmation dialog on navigate:

cwa.navigationDisabled.value                    // boolean
cwa.adminNavigationGuardFn                      // pass to router.beforeEach