Repository navigation
Release v4.30.0
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 anInvocationResultwithsucceeded,validationErrors,message,payload,dryRun),SliceInvokerProvideranduseSliceInvoker. Without a provider the command is announced ascratis.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).SliceDialogViewand thecore:sliceDialogcomponent: a modal card with the button title, the subtitleState Change · <Slice>, a labelled field per command property,Canceland 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.reactstays free of Arc and transport imports.core:toolbarItemresolves its slice against the navigation model, opens the dialogsliceDialogForpicked through the navigation host (sliceDialogDestination; an authoreddialogstemplate wins over the built-in dialog), carries itsemphasisasdata-scene-emphasisandscene-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.SceneNavigationHostcarries the dialog's parameters (currentDialogParameters) and names the dialog after its title.blueprint.defaultstyles 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" inblueprints/application-hierarchy.md.
Part of #104