Skip to content

Release v4.30.0

Choose a tag to compare

@github-actions github-actions released this 15 Oct 06:22
41b12a1

A toolbar button that invokes a State Change slice now opens the slice as a task dialog, and submits through a pluggable sliceInvoker: the real one in Stage, a dry-run one in the Studio preview, an announcing default elsewhere.

Added

  • SliceInvoker (invoke(sliceId, payload, command) returning an InvocationResult with succeeded, validationErrors, message, payload, dryRun), SliceInvokerProvider and useSliceInvoker. Without a provider the command is announced as cratis.scene.command, as a toolbar action always was (createAnnouncingInvoker).
  • createDryRunInvoker({ onInvoked, validate }): validates, sends nothing and returns a result carrying the would-be payload, for the Studio preview's toast (PRV5).
  • SliceDialogView and the core:sliceDialog component: a modal card with the button title, the subtitle State Change · <Slice>, a labelled field per command property, Cancel and a submit button labelled with the title. The first field takes focus, Tab stays inside, Escape cancels and focus returns to the button. Required fields are checked before invoking, and the validation errors an invoker reports are shown against their fields (aria-invalid, aria-describedby) or for the whole form. Success closes the dialog and signals the result.
  • SliceCommandFieldsProvider: the host tells the dialog a command's fields, so @cratis/scene.react stays free of Arc and transport imports.
  • core:toolbarItem resolves its slice against the navigation model, opens the dialog sliceDialogFor picked through the navigation host (sliceDialogDestination; an authored dialogs template wins over the built-in dialog), carries its emphasis as data-scene-emphasis and scene-toolbar-button-<emphasis>, and shows a warning badge for a button without a slice only when the host asks (SliceInvokerProvider warnEmptySlices, implied by a dry-run invoker). Without a navigation model it announces the command as before.
  • SceneNavigationHost carries the dialog's parameters (currentDialogParameters) and names the dialog after its title.
  • blueprint.default styles the primary, secondary and quiet buttons, the warning badge and the dialog over its scrim, and has a Storybook story.
  • Docs: "Running a slice button: the task dialog and the sliceInvoker" in blueprints/application-hierarchy.md.

Part of #104