Repository navigation
Release v4.31.0
A new package, @cratis/scene.preview, holds the one host a design tool mounts to let an author click around the application as an end user would - and the one composition Stage shares. ScenePreviewHost renders the effective application from an in-memory document with sample data and a dry-run invoker.
Added
ScenePreviewHost({ document, structure, navigation, target, sampleData, registry, invoker, ... }): a module target renders the application shell with the module's effective navigation and its first feature, a feature target that feature in the shell, a State Change slice target its task dialog over a minimal host page (the feature's own page when it has one), a State View slice target its data fragment. Navigation keeps to an in-memory history, so a preview never touches the hosting page's address, and going to another module swaps the effective navigation (effectiveNavigation, not re-implemented). It reportsonBreadcrumbChange(Sales › Orders) and callsonExiton Escape when no dialog is open - the strip itself is the embedding application's.- Read-only and never blank (PRV8):
diagnosePreviewjudges the model with the engine's own validators and returnsPreviewProblementries (code,severity,message,nodeId). Errors (targetNotFound,moduleWithoutFeatures,sliceNotPreviewable,screenMissing,layoutMissing,templateMissing,templateUnplaced) replace the render with a problem list; warnings (structureInvalid,navigationInvalid,toolbarInvalid,sampleDataInvalid,sliceFragmentMissing) are reported and the preview renders.onProblemsandonSelectProblemare the host's hooks. - Dry run (PRV5): a submitted dialog validates and sends nothing; a toast says "Command would be sent" with the payload in an expandable detail. A real
invokercan be passed instead. - Sample data (PRV6):
createPreviewSampleDataasksresolveSampleData- bound pack, the application profile's active pack, the blueprint's default pack, generated data - for the queries the document binds and the commands its slices accept;sessionActivePackis the strip's session-only override of the profile's choice. The same seed gives the same rows. - One composition for preview and Stage (PRV9, REN2):
composeApplicationScreen(shell, chrome, the screen inside its template chain with every arrangement applied, name resolution, effective configuration),composeOutletScreen,composeDialog,collectDestinations,previewProfile, andApplicationHost, which runs it - shell, nested outlets, navigation regions, routes and dialogs. A host decides only what is its own throughCompositionOptionsandrenderScreen. The template wrapper (Scene:template) and the flow arrangement view Stage kept to itself now live here, so Stage can delete its copies. SliceCommandField.initialValue: a task dialog's field can start with a value - a preview fills it from the active sample data pack.- Docs:
Documentation/blueprints/preview-host.md.
Part of #106