@xemahq/ui-kernel 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/biome-host/biome-builders.d.ts.map +1 -1
- package/dist/lib/biome-host/biome-builders.js +3 -1
- package/dist/lib/biome-host/biome-builders.js.map +1 -1
- package/dist/lib/biome-host/biome-registry.d.ts.map +1 -1
- package/dist/lib/biome-host/biome-registry.js +14 -9
- package/dist/lib/biome-host/biome-registry.js.map +1 -1
- package/dist/lib/biome-host/biome-scope-hooks.d.ts +11 -0
- package/dist/lib/biome-host/biome-scope-hooks.d.ts.map +1 -0
- package/dist/lib/biome-host/biome-scope-hooks.js +25 -0
- package/dist/lib/biome-host/biome-scope-hooks.js.map +1 -0
- package/dist/lib/biome-host/biome-scope.d.ts +1 -10
- package/dist/lib/biome-host/biome-scope.d.ts.map +1 -1
- package/dist/lib/biome-host/biome-scope.js +1 -24
- package/dist/lib/biome-host/biome-scope.js.map +1 -1
- package/dist/lib/biome-host/biome-scoped-query.d.ts +1 -1
- package/dist/lib/biome-host/biome-scoped-query.d.ts.map +1 -1
- package/dist/lib/biome-host/biome-scoped-query.js +1 -1
- package/dist/lib/biome-host/biome-scoped-query.js.map +1 -1
- package/dist/lib/biome-host/create-biome-orval-config.js +2 -2
- package/dist/lib/biome-host/create-biome-orval-config.js.map +1 -1
- package/dist/lib/biome-host/errors.js.map +1 -1
- package/dist/lib/biome-host/index.d.ts +1 -1
- package/dist/lib/biome-host/index.d.ts.map +1 -1
- package/dist/lib/biome-host/index.js +1 -1
- package/dist/lib/biome-host/index.js.map +1 -1
- package/dist/lib/biome-host/session-profiles.d.ts.map +1 -1
- package/dist/lib/biome-host/session-profiles.js +4 -1
- package/dist/lib/biome-host/session-profiles.js.map +1 -1
- package/dist/lib/capabilities/capability-context.d.ts +9 -0
- package/dist/lib/capabilities/capability-context.d.ts.map +1 -0
- package/dist/lib/capabilities/capability-context.js +13 -0
- package/dist/lib/capabilities/capability-context.js.map +1 -0
- package/dist/lib/capabilities/capability-provider.d.ts +2 -8
- package/dist/lib/capabilities/capability-provider.d.ts.map +1 -1
- package/dist/lib/capabilities/capability-provider.js +1 -12
- package/dist/lib/capabilities/capability-provider.js.map +1 -1
- package/dist/lib/capabilities/index.d.ts +1 -0
- package/dist/lib/capabilities/index.d.ts.map +1 -1
- package/dist/lib/capabilities/index.js +1 -0
- package/dist/lib/capabilities/index.js.map +1 -1
- package/dist/lib/capabilities/use-capability.d.ts.map +1 -1
- package/dist/lib/capabilities/use-capability.js +1 -1
- package/dist/lib/capabilities/use-capability.js.map +1 -1
- package/dist/lib/contribution-registry/contribution-registry.d.ts +24 -0
- package/dist/lib/contribution-registry/contribution-registry.d.ts.map +1 -0
- package/dist/lib/contribution-registry/contribution-registry.js +67 -0
- package/dist/lib/contribution-registry/contribution-registry.js.map +1 -0
- package/dist/lib/contribution-registry/index.d.ts +3 -0
- package/dist/lib/contribution-registry/index.d.ts.map +1 -0
- package/dist/lib/contribution-registry/index.js +3 -0
- package/dist/lib/contribution-registry/index.js.map +1 -0
- package/dist/lib/contribution-registry/renderable-registry.d.ts +33 -0
- package/dist/lib/contribution-registry/renderable-registry.d.ts.map +1 -0
- package/dist/lib/contribution-registry/renderable-registry.js +51 -0
- package/dist/lib/contribution-registry/renderable-registry.js.map +1 -0
- package/dist/lib/system-bus/deeplink.js.map +1 -1
- package/dist/lib/system-bus/host-ports.d.ts +2 -1
- package/dist/lib/system-bus/host-ports.d.ts.map +1 -1
- package/dist/lib/system-bus/intent-registry.d.ts.map +1 -1
- package/dist/lib/system-bus/intent-registry.js.map +1 -1
- package/dist/offline/index.d.ts +2 -1
- package/dist/offline/index.d.ts.map +1 -1
- package/dist/offline/index.js +2 -1
- package/dist/offline/index.js.map +1 -1
- package/dist/offline/offline-status-badge.js +1 -1
- package/dist/offline/offline-status-badge.js.map +1 -1
- package/dist/offline/outbox.js.map +1 -1
- package/dist/offline/react-hooks.d.ts +7 -0
- package/dist/offline/react-hooks.d.ts.map +1 -0
- package/dist/offline/react-hooks.js +25 -0
- package/dist/offline/react-hooks.js.map +1 -0
- package/dist/offline/react.d.ts +0 -4
- package/dist/offline/react.d.ts.map +1 -1
- package/dist/offline/react.js +2 -24
- package/dist/offline/react.js.map +1 -1
- package/dist/offline/storage.d.ts.map +1 -1
- package/dist/offline/storage.js +8 -5
- package/dist/offline/storage.js.map +1 -1
- package/dist/registry/index.d.ts +1 -0
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -0
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/lib/primitives/SessionEventCard.d.ts.map +1 -1
- package/dist/registry/lib/primitives/SessionEventCard.js +1 -1
- package/dist/registry/lib/primitives/SessionEventCard.js.map +1 -1
- package/dist/registry/lib/session-context-provider.d.ts +1 -3
- package/dist/registry/lib/session-context-provider.d.ts.map +1 -1
- package/dist/registry/lib/session-context-provider.js +2 -15
- package/dist/registry/lib/session-context-provider.js.map +1 -1
- package/dist/registry/lib/session-context.d.ts +5 -0
- package/dist/registry/lib/session-context.d.ts.map +1 -0
- package/dist/registry/lib/session-context.js +15 -0
- package/dist/registry/lib/session-context.js.map +1 -0
- package/dist/registry/lib/session-selectors.d.ts.map +1 -1
- package/dist/registry/lib/session-selectors.js +3 -1
- package/dist/registry/lib/session-selectors.js.map +1 -1
- package/dist/ui/branding/app-branding-context.d.ts +9 -0
- package/dist/ui/branding/app-branding-context.d.ts.map +1 -0
- package/dist/ui/branding/app-branding-context.js +10 -0
- package/dist/ui/branding/app-branding-context.js.map +1 -0
- package/dist/ui/branding/app-branding-provider.d.ts +0 -6
- package/dist/ui/branding/app-branding-provider.d.ts.map +1 -1
- package/dist/ui/branding/app-branding-provider.js +1 -8
- package/dist/ui/branding/app-branding-provider.js.map +1 -1
- package/dist/ui/capture/field-spec-to-zod.d.ts +1 -0
- package/dist/ui/capture/field-spec-to-zod.d.ts.map +1 -1
- package/dist/ui/capture/field-spec-to-zod.js +19 -0
- package/dist/ui/capture/field-spec-to-zod.js.map +1 -1
- package/dist/ui/capture/field-spec-validate.d.ts +4 -0
- package/dist/ui/capture/field-spec-validate.d.ts.map +1 -0
- package/dist/ui/capture/field-spec-validate.js +129 -0
- package/dist/ui/capture/field-spec-validate.js.map +1 -0
- package/dist/ui/capture/field-spec.d.ts +13 -1
- package/dist/ui/capture/field-spec.d.ts.map +1 -1
- package/dist/ui/capture/field-spec.js +25 -0
- package/dist/ui/capture/field-spec.js.map +1 -1
- package/dist/ui/capture/index.d.ts +4 -2
- package/dist/ui/capture/index.d.ts.map +1 -1
- package/dist/ui/capture/index.js +4 -2
- package/dist/ui/capture/index.js.map +1 -1
- package/dist/ui/capture/schema-field-input.d.ts.map +1 -1
- package/dist/ui/capture/schema-field-input.js +40 -13
- package/dist/ui/capture/schema-field-input.js.map +1 -1
- package/dist/ui/capture/submit-values.d.ts +6 -0
- package/dist/ui/capture/submit-values.d.ts.map +1 -0
- package/dist/ui/capture/submit-values.js +28 -0
- package/dist/ui/capture/submit-values.js.map +1 -0
- package/dist/ui/capture/use-prefill.d.ts.map +1 -1
- package/dist/ui/capture/use-prefill.js +3 -1
- package/dist/ui/capture/use-prefill.js.map +1 -1
- package/dist/ui/capture/use-wizard.d.ts +1 -1
- package/dist/ui/capture/use-wizard.d.ts.map +1 -1
- package/dist/ui/capture/use-wizard.js +1 -1
- package/dist/ui/capture/use-wizard.js.map +1 -1
- package/dist/ui/capture/wizard.d.ts.map +1 -1
- package/dist/ui/capture/wizard.js.map +1 -1
- package/dist/ui/index.d.ts +6 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +6 -1
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/primitives/alert-dialog.js +1 -1
- package/dist/ui/primitives/alert-dialog.js.map +1 -1
- package/dist/ui/primitives/badge-variants.d.ts +4 -0
- package/dist/ui/primitives/badge-variants.d.ts.map +1 -0
- package/dist/ui/primitives/badge-variants.js +15 -0
- package/dist/ui/primitives/badge-variants.js.map +1 -0
- package/dist/ui/primitives/badge.d.ts +3 -5
- package/dist/ui/primitives/badge.d.ts.map +1 -1
- package/dist/ui/primitives/badge.js +2 -15
- package/dist/ui/primitives/badge.js.map +1 -1
- package/dist/ui/primitives/button-variants.d.ts +5 -0
- package/dist/ui/primitives/button-variants.d.ts.map +1 -0
- package/dist/ui/primitives/button-variants.js +24 -0
- package/dist/ui/primitives/button-variants.js.map +1 -0
- package/dist/ui/primitives/button.d.ts +3 -6
- package/dist/ui/primitives/button.d.ts.map +1 -1
- package/dist/ui/primitives/button.js +2 -24
- package/dist/ui/primitives/button.js.map +1 -1
- package/dist/ui/primitives/form-stepper.d.ts +1 -13
- package/dist/ui/primitives/form-stepper.d.ts.map +1 -1
- package/dist/ui/primitives/form-stepper.js +1 -6
- package/dist/ui/primitives/form-stepper.js.map +1 -1
- package/dist/ui/primitives/form-stepper.types.d.ts +14 -0
- package/dist/ui/primitives/form-stepper.types.d.ts.map +1 -0
- package/dist/ui/primitives/form-stepper.types.js +7 -0
- package/dist/ui/primitives/form-stepper.types.js.map +1 -0
- package/dist/ui/primitives/overflow-tabs.d.ts +5 -0
- package/dist/ui/primitives/overflow-tabs.d.ts.map +1 -1
- package/dist/ui/primitives/overflow-tabs.js +4 -4
- package/dist/ui/primitives/overflow-tabs.js.map +1 -1
- package/dist/ui/primitives/preview-device-frame.js +1 -1
- package/dist/ui/primitives/preview-device-frame.js.map +1 -1
- package/dist/ui/primitives/tag-multi-select.d.ts.map +1 -1
- package/dist/ui/primitives/tag-multi-select.js +1 -1
- package/dist/ui/primitives/tag-multi-select.js.map +1 -1
- package/dist/ui/primitives/url-preview-chrome.d.ts +8 -0
- package/dist/ui/primitives/url-preview-chrome.d.ts.map +1 -0
- package/dist/ui/primitives/url-preview-chrome.js +40 -0
- package/dist/ui/primitives/url-preview-chrome.js.map +1 -0
- package/dist/vista/GenericCatalogueSurface.d.ts +10 -0
- package/dist/vista/GenericCatalogueSurface.d.ts.map +1 -0
- package/dist/vista/GenericCatalogueSurface.js +80 -0
- package/dist/vista/GenericCatalogueSurface.js.map +1 -0
- package/dist/vista/SurfaceFallbackCard.d.ts +9 -0
- package/dist/vista/SurfaceFallbackCard.d.ts.map +1 -0
- package/dist/vista/SurfaceFallbackCard.js +44 -0
- package/dist/vista/SurfaceFallbackCard.js.map +1 -0
- package/dist/vista/VistaPanel.d.ts +21 -0
- package/dist/vista/VistaPanel.d.ts.map +1 -0
- package/dist/vista/VistaPanel.js +31 -0
- package/dist/vista/VistaPanel.js.map +1 -0
- package/dist/vista/html/CustomUiFrame.d.ts +20 -0
- package/dist/vista/html/CustomUiFrame.d.ts.map +1 -0
- package/dist/vista/html/CustomUiFrame.js +69 -0
- package/dist/vista/html/CustomUiFrame.js.map +1 -0
- package/dist/vista/html/custom-ui-frame-bridge.d.ts +13 -0
- package/dist/vista/html/custom-ui-frame-bridge.d.ts.map +1 -0
- package/dist/vista/html/custom-ui-frame-bridge.js +30 -0
- package/dist/vista/html/custom-ui-frame-bridge.js.map +1 -0
- package/dist/vista/html/custom-ui-frame-contract.d.ts +29 -0
- package/dist/vista/html/custom-ui-frame-contract.d.ts.map +1 -0
- package/dist/vista/html/custom-ui-frame-contract.js +16 -0
- package/dist/vista/html/custom-ui-frame-contract.js.map +1 -0
- package/dist/vista/html/custom-ui-intents.d.ts +20 -0
- package/dist/vista/html/custom-ui-intents.d.ts.map +1 -0
- package/dist/vista/html/custom-ui-intents.js +57 -0
- package/dist/vista/html/custom-ui-intents.js.map +1 -0
- package/dist/vista/html/custom-ui-srcdoc.d.ts +17 -0
- package/dist/vista/html/custom-ui-srcdoc.d.ts.map +1 -0
- package/dist/vista/html/custom-ui-srcdoc.js +70 -0
- package/dist/vista/html/custom-ui-srcdoc.js.map +1 -0
- package/dist/vista/html/index.d.ts +6 -0
- package/dist/vista/html/index.d.ts.map +1 -0
- package/dist/vista/html/index.js +6 -0
- package/dist/vista/html/index.js.map +1 -0
- package/dist/vista/index.d.ts +22 -0
- package/dist/vista/index.d.ts.map +1 -0
- package/dist/vista/index.js +22 -0
- package/dist/vista/index.js.map +1 -0
- package/dist/vista/surface-catalogue.d.ts +5 -0
- package/dist/vista/surface-catalogue.d.ts.map +1 -0
- package/dist/vista/surface-catalogue.js +30 -0
- package/dist/vista/surface-catalogue.js.map +1 -0
- package/dist/vista/surface-icons.d.ts +7 -0
- package/dist/vista/surface-icons.d.ts.map +1 -0
- package/dist/vista/surface-icons.js +26 -0
- package/dist/vista/surface-icons.js.map +1 -0
- package/dist/vista/surface-registry.d.ts +7 -0
- package/dist/vista/surface-registry.d.ts.map +1 -0
- package/dist/vista/surface-registry.js +7 -0
- package/dist/vista/surface-registry.js.map +1 -0
- package/dist/vista/surfaces/ChartSurface.d.ts +4 -0
- package/dist/vista/surfaces/ChartSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/ChartSurface.js +17 -0
- package/dist/vista/surfaces/ChartSurface.js.map +1 -0
- package/dist/vista/surfaces/FilesSurface.d.ts +4 -0
- package/dist/vista/surfaces/FilesSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/FilesSurface.js +77 -0
- package/dist/vista/surfaces/FilesSurface.js.map +1 -0
- package/dist/vista/surfaces/FormSurface.d.ts +4 -0
- package/dist/vista/surfaces/FormSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/FormSurface.js +124 -0
- package/dist/vista/surfaces/FormSurface.js.map +1 -0
- package/dist/vista/surfaces/HtmlSurface.d.ts +4 -0
- package/dist/vista/surfaces/HtmlSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/HtmlSurface.js +11 -0
- package/dist/vista/surfaces/HtmlSurface.js.map +1 -0
- package/dist/vista/surfaces/TableSurface.d.ts +4 -0
- package/dist/vista/surfaces/TableSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/TableSurface.js +42 -0
- package/dist/vista/surfaces/TableSurface.js.map +1 -0
- package/dist/vista/surfaces/UrlSurface.d.ts +4 -0
- package/dist/vista/surfaces/UrlSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/UrlSurface.js +7 -0
- package/dist/vista/surfaces/UrlSurface.js.map +1 -0
- package/dist/vista/surfaces/blob-surfaces.d.ts +6 -0
- package/dist/vista/surfaces/blob-surfaces.d.ts.map +1 -0
- package/dist/vista/surfaces/blob-surfaces.js +38 -0
- package/dist/vista/surfaces/blob-surfaces.js.map +1 -0
- package/dist/vista/surfaces/elicitation-transport.d.ts +27 -0
- package/dist/vista/surfaces/elicitation-transport.d.ts.map +1 -0
- package/dist/vista/surfaces/elicitation-transport.js +193 -0
- package/dist/vista/surfaces/elicitation-transport.js.map +1 -0
- package/dist/vista/surfaces/file-surface-utils.d.ts +13 -0
- package/dist/vista/surfaces/file-surface-utils.d.ts.map +1 -0
- package/dist/vista/surfaces/file-surface-utils.js +46 -0
- package/dist/vista/surfaces/file-surface-utils.js.map +1 -0
- package/dist/vista/surfaces/index.d.ts +12 -0
- package/dist/vista/surfaces/index.d.ts.map +1 -0
- package/dist/vista/surfaces/index.js +12 -0
- package/dist/vista/surfaces/index.js.map +1 -0
- package/dist/vista/surfaces/register-surfaces.d.ts +2 -0
- package/dist/vista/surfaces/register-surfaces.d.ts.map +1 -0
- package/dist/vista/surfaces/register-surfaces.js +80 -0
- package/dist/vista/surfaces/register-surfaces.js.map +1 -0
- package/dist/vista/surfaces/text-surfaces.d.ts +8 -0
- package/dist/vista/surfaces/text-surfaces.d.ts.map +1 -0
- package/dist/vista/surfaces/text-surfaces.js +54 -0
- package/dist/vista/surfaces/text-surfaces.js.map +1 -0
- package/dist/vista/use-vista-tabs.d.ts +30 -0
- package/dist/vista/use-vista-tabs.d.ts.map +1 -0
- package/dist/vista/use-vista-tabs.js +77 -0
- package/dist/vista/use-vista-tabs.js.map +1 -0
- package/dist/vista/vista-code-renderer-context.d.ts +9 -0
- package/dist/vista/vista-code-renderer-context.d.ts.map +1 -0
- package/dist/vista/vista-code-renderer-context.js +6 -0
- package/dist/vista/vista-code-renderer-context.js.map +1 -0
- package/dist/vista/vista-code-renderer.d.ts +7 -0
- package/dist/vista/vista-code-renderer.d.ts.map +1 -0
- package/dist/vista/vista-code-renderer.js +6 -0
- package/dist/vista/vista-code-renderer.js.map +1 -0
- package/dist/vista/vista-file-context.d.ts +8 -0
- package/dist/vista/vista-file-context.d.ts.map +1 -0
- package/dist/vista/vista-file-context.js +6 -0
- package/dist/vista/vista-file-context.js.map +1 -0
- package/dist/vista/vista-file-source.d.ts +15 -0
- package/dist/vista/vista-file-source.d.ts.map +1 -0
- package/dist/vista/vista-file-source.js +66 -0
- package/dist/vista/vista-file-source.js.map +1 -0
- package/dist/vista/vista-form-context.d.ts +13 -0
- package/dist/vista/vista-form-context.d.ts.map +1 -0
- package/dist/vista/vista-form-context.js +6 -0
- package/dist/vista/vista-form-context.js.map +1 -0
- package/dist/vista/vista-form-host.d.ts +7 -0
- package/dist/vista/vista-form-host.d.ts.map +1 -0
- package/dist/vista/vista-form-host.js +6 -0
- package/dist/vista/vista-form-host.js.map +1 -0
- package/dist/vista/vista-model.d.ts +12 -0
- package/dist/vista/vista-model.d.ts.map +1 -0
- package/dist/vista/vista-model.js +72 -0
- package/dist/vista/vista-model.js.map +1 -0
- package/dist/vista/vista-open-context.d.ts +7 -0
- package/dist/vista/vista-open-context.d.ts.map +1 -0
- package/dist/vista/vista-open-context.js +6 -0
- package/dist/vista/vista-open-context.js.map +1 -0
- package/dist/vista/vista-open-state.d.ts +5 -0
- package/dist/vista/vista-open-state.d.ts.map +1 -0
- package/dist/vista/vista-open-state.js +6 -0
- package/dist/vista/vista-open-state.js.map +1 -0
- package/dist/vista/vista-payloads.d.ts +106 -0
- package/dist/vista/vista-payloads.d.ts.map +1 -0
- package/dist/vista/vista-payloads.js +302 -0
- package/dist/vista/vista-payloads.js.map +1 -0
- package/dist/vista/vista-tabs-manifest.d.ts +17 -0
- package/dist/vista/vista-tabs-manifest.d.ts.map +1 -0
- package/dist/vista/vista-tabs-manifest.js +60 -0
- package/dist/vista/vista-tabs-manifest.js.map +1 -0
- package/dist/vista/vista-tools.d.ts +41 -0
- package/dist/vista/vista-tools.d.ts.map +1 -0
- package/dist/vista/vista-tools.js +113 -0
- package/dist/vista/vista-tools.js.map +1 -0
- package/package.json +4 -4
- package/src/index.ts +5 -0
- package/src/lib/biome-host/biome-builders.ts +4 -1
- package/src/lib/biome-host/biome-registry.ts +31 -12
- package/src/lib/biome-host/biome-scope-hooks.ts +39 -0
- package/src/lib/biome-host/biome-scope.tsx +1 -68
- package/src/lib/biome-host/biome-scoped-query.ts +4 -1
- package/src/lib/biome-host/create-biome-orval-config.ts +2 -2
- package/src/lib/biome-host/errors.ts +1 -1
- package/src/lib/biome-host/index.ts +1 -1
- package/src/lib/biome-host/session-profiles.ts +7 -1
- package/src/lib/capabilities/capability-context.ts +25 -0
- package/src/lib/capabilities/capability-provider.tsx +5 -34
- package/src/lib/capabilities/index.ts +1 -0
- package/src/lib/capabilities/use-capability.ts +4 -1
- package/src/lib/contribution-registry/contribution-registry.spec.ts +141 -0
- package/src/lib/contribution-registry/contribution-registry.ts +202 -0
- package/src/lib/contribution-registry/index.ts +9 -0
- package/src/lib/contribution-registry/renderable-registry.ts +142 -0
- package/src/lib/system-bus/deeplink.ts +1 -1
- package/src/lib/system-bus/host-ports.ts +2 -1
- package/src/lib/system-bus/intent-registry.ts +1 -2
- package/src/offline/index.ts +4 -2
- package/src/offline/offline-status-badge.tsx +1 -1
- package/src/offline/outbox.test.ts +23 -16
- package/src/offline/outbox.ts +1 -1
- package/src/offline/react-hooks.ts +37 -0
- package/src/offline/react.tsx +1 -40
- package/src/offline/storage.ts +11 -6
- package/src/registry/index.ts +1 -0
- package/src/registry/lib/primitives/SessionEventCard.tsx +4 -2
- package/src/registry/lib/session-context-provider.tsx +8 -25
- package/src/registry/lib/session-context.ts +21 -0
- package/src/registry/lib/session-selectors.ts +3 -1
- package/src/ui/branding/app-branding-context.ts +20 -0
- package/src/ui/branding/app-branding-provider.tsx +5 -27
- package/src/ui/capture/field-spec-to-zod.ts +22 -0
- package/src/ui/capture/field-spec-validate.ts +147 -0
- package/src/ui/capture/field-spec.ts +62 -0
- package/src/ui/capture/index.ts +9 -1
- package/src/ui/capture/schema-field-input.tsx +141 -15
- package/src/ui/capture/submit-values.test.ts +70 -0
- package/src/ui/capture/submit-values.ts +63 -0
- package/src/ui/capture/use-prefill.ts +4 -1
- package/src/ui/capture/use-wizard.ts +2 -2
- package/src/ui/capture/wizard.tsx +2 -1
- package/src/ui/index.ts +11 -2
- package/src/ui/primitives/alert-dialog.tsx +1 -1
- package/src/ui/primitives/badge-variants.ts +21 -0
- package/src/ui/primitives/badge.tsx +3 -19
- package/src/ui/primitives/button-variants.ts +31 -0
- package/src/ui/primitives/button.tsx +3 -28
- package/src/ui/primitives/form-stepper.tsx +1 -16
- package/src/ui/primitives/form-stepper.types.ts +15 -0
- package/src/ui/primitives/overflow-tabs.tsx +24 -4
- package/src/ui/primitives/preview-device-frame.tsx +1 -1
- package/src/ui/primitives/tag-multi-select.tsx +3 -4
- package/src/ui/primitives/url-preview-chrome.tsx +102 -0
- package/src/vista/GenericCatalogueSurface.tsx +177 -0
- package/src/vista/SurfaceFallbackCard.tsx +109 -0
- package/src/vista/VistaPanel.tsx +155 -0
- package/src/vista/form-payload.spec.ts +139 -0
- package/src/vista/html/CustomUiFrame.spec.tsx +125 -0
- package/src/vista/html/CustomUiFrame.tsx +204 -0
- package/src/vista/html/custom-ui-frame-bridge.spec.ts +191 -0
- package/src/vista/html/custom-ui-frame-bridge.ts +92 -0
- package/src/vista/html/custom-ui-frame-contract.ts +88 -0
- package/src/vista/html/custom-ui-intents.spec.ts +133 -0
- package/src/vista/html/custom-ui-intents.ts +151 -0
- package/src/vista/html/custom-ui-srcdoc.spec.ts +151 -0
- package/src/vista/html/custom-ui-srcdoc.ts +193 -0
- package/src/vista/html/index.ts +13 -0
- package/src/vista/index.ts +52 -0
- package/src/vista/surface-catalogue.spec.ts +140 -0
- package/src/vista/surface-catalogue.ts +84 -0
- package/src/vista/surface-icons.ts +57 -0
- package/src/vista/surface-registry.ts +56 -0
- package/src/vista/surfaces/ChartSurface.tsx +34 -0
- package/src/vista/surfaces/FilesSurface.tsx +202 -0
- package/src/vista/surfaces/FormSurface.tsx +363 -0
- package/src/vista/surfaces/HtmlSurface.tsx +43 -0
- package/src/vista/surfaces/TableSurface.tsx +99 -0
- package/src/vista/surfaces/UrlSurface.tsx +40 -0
- package/src/vista/surfaces/blob-surfaces.tsx +129 -0
- package/src/vista/surfaces/elicitation-transport.spec.ts +369 -0
- package/src/vista/surfaces/elicitation-transport.ts +353 -0
- package/src/vista/surfaces/file-surface-utils.ts +62 -0
- package/src/vista/surfaces/index.ts +24 -0
- package/src/vista/surfaces/register-surfaces.tsx +137 -0
- package/src/vista/surfaces/text-surfaces.tsx +119 -0
- package/src/vista/use-vista-tabs.ts +188 -0
- package/src/vista/vista-code-renderer-context.ts +16 -0
- package/src/vista/vista-code-renderer.tsx +34 -0
- package/src/vista/vista-file-context.ts +14 -0
- package/src/vista/vista-file-source.tsx +140 -0
- package/src/vista/vista-form-context.ts +20 -0
- package/src/vista/vista-form-host.tsx +53 -0
- package/src/vista/vista-model.ts +130 -0
- package/src/vista/vista-open-context.tsx +32 -0
- package/src/vista/vista-open-state.ts +11 -0
- package/src/vista/vista-payloads.ts +512 -0
- package/src/vista/vista-tabs-manifest.ts +123 -0
- package/src/vista/vista-tools.ts +220 -0
- package/dist/lib/biome-host/response-envelope.d.ts +0 -3
- package/dist/lib/biome-host/response-envelope.d.ts.map +0 -1
- package/dist/lib/biome-host/response-envelope.js +0 -21
- package/dist/lib/biome-host/response-envelope.js.map +0 -1
- package/src/lib/biome-host/response-envelope.ts +0 -69
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `useVistaTabs` — the ONE tab-state machine behind every Vista panel.
|
|
3
|
+
*
|
|
4
|
+
* Lifted from `SessionWorkspaceThin`'s (already host-agnostic) chrome and
|
|
5
|
+
* generalised to {@link VistaSurface} envelopes, so the thin session workspace,
|
|
6
|
+
* the Design-System-Builder preview, and the agent-driven `vista_*` tools all
|
|
7
|
+
* drive the SAME state. Behaviours carried over verbatim:
|
|
8
|
+
*
|
|
9
|
+
* • PINNED FIRST TAB. A surface with `pinned: true` sorts first and can never
|
|
10
|
+
* be closed (`close()` returns `false`).
|
|
11
|
+
* • HOST TABS vs. OPENED TABS. `hostTabs` are host-driven (a live workspace
|
|
12
|
+
* scan, an artifact list) and reconcile every render; `open()` tabs are
|
|
13
|
+
* user/agent-driven and persist until closed.
|
|
14
|
+
* • CLOSED-HOST-TAB MEMORY. Closing a host tab records its id so the next
|
|
15
|
+
* scan does NOT resurrect a tab the user dismissed. The record is pruned
|
|
16
|
+
* when the host stops offering that id, so a genuinely new occurrence shows
|
|
17
|
+
* again — no stale suppression.
|
|
18
|
+
* • ACTIVE RECONCILIATION. If the active tab disappears, the first remaining
|
|
19
|
+
* tab becomes active (never a dangling id, never a blank pane).
|
|
20
|
+
*/
|
|
21
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
22
|
+
|
|
23
|
+
import type { VistaTab } from './vista-model';
|
|
24
|
+
|
|
25
|
+
/** A partial update applied to an open tab (`vista_update`). */
|
|
26
|
+
export interface VistaSurfacePatch {
|
|
27
|
+
readonly kind?: string;
|
|
28
|
+
readonly version?: number;
|
|
29
|
+
readonly title?: string;
|
|
30
|
+
readonly payload?: unknown;
|
|
31
|
+
readonly pinned?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** A tab summary — what `vista_list()` returns to the agent. */
|
|
35
|
+
export interface VistaTabSummary {
|
|
36
|
+
readonly tabId: string;
|
|
37
|
+
readonly kind: string;
|
|
38
|
+
readonly title: string;
|
|
39
|
+
readonly pinned: boolean;
|
|
40
|
+
readonly active: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The tab-state surface a panel (and the `vista_*` dispatcher) drives. */
|
|
44
|
+
export interface VistaTabsController {
|
|
45
|
+
/** Host tabs (reconciled) followed by opened tabs, pinned ones first. */
|
|
46
|
+
readonly tabs: readonly VistaTab[];
|
|
47
|
+
readonly activeTabId: string | null;
|
|
48
|
+
/** Activate a tab. No-op for an id that is not open. */
|
|
49
|
+
activate(tabId: string): void;
|
|
50
|
+
/** Open (or REPLACE, when `tabId` is already open) a surface, and focus it. */
|
|
51
|
+
open(surface: VistaTab): string;
|
|
52
|
+
/** Patch an open tab. `false` when the tab is not open. */
|
|
53
|
+
update(tabId: string, patch: VistaSurfacePatch): boolean;
|
|
54
|
+
/** Close a tab. `false` when it is not open or is pinned. */
|
|
55
|
+
close(tabId: string): boolean;
|
|
56
|
+
/** Snapshot of every open tab. */
|
|
57
|
+
list(): readonly VistaTabSummary[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface UseVistaTabsOptions {
|
|
61
|
+
/**
|
|
62
|
+
* Host-driven tabs, reconciled live (a workspace scan, an artifact set). A
|
|
63
|
+
* pinned entry here is the panel's permanent first tab.
|
|
64
|
+
*/
|
|
65
|
+
readonly hostTabs?: readonly VistaTab[];
|
|
66
|
+
/** Tab active on first render. Falls back to the first tab. */
|
|
67
|
+
readonly initialActiveTabId?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const NO_HOST_TABS: readonly VistaTab[] = [];
|
|
71
|
+
|
|
72
|
+
/** Pinned tabs first, otherwise insertion order (stable). */
|
|
73
|
+
function sortPinnedFirst(tabs: readonly VistaTab[]): VistaTab[] {
|
|
74
|
+
const pinned = tabs.filter((t) => t.pinned === true);
|
|
75
|
+
const rest = tabs.filter((t) => t.pinned !== true);
|
|
76
|
+
return [...pinned, ...rest];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function useVistaTabs({
|
|
80
|
+
hostTabs = NO_HOST_TABS,
|
|
81
|
+
initialActiveTabId,
|
|
82
|
+
}: UseVistaTabsOptions = {}): VistaTabsController {
|
|
83
|
+
const [openedTabs, setOpenedTabs] = useState<readonly VistaTab[]>([]);
|
|
84
|
+
const [closedHostTabIds, setClosedHostTabIds] = useState<readonly string[]>(
|
|
85
|
+
[],
|
|
86
|
+
);
|
|
87
|
+
const [activeTabId, setActiveTabId] = useState<string | null>(
|
|
88
|
+
initialActiveTabId ?? null,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const tabs = useMemo(
|
|
92
|
+
() =>
|
|
93
|
+
sortPinnedFirst([
|
|
94
|
+
...hostTabs.filter((t) => !closedHostTabIds.includes(t.tabId)),
|
|
95
|
+
...openedTabs,
|
|
96
|
+
]),
|
|
97
|
+
[hostTabs, closedHostTabIds, openedTabs],
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
// Prune `closedHostTabIds` entries the host no longer offers, so if the same
|
|
101
|
+
// id reappears later it shows again (no stale suppression).
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
setClosedHostTabIds((prev) => {
|
|
104
|
+
const next = prev.filter((id) => hostTabs.some((t) => t.tabId === id));
|
|
105
|
+
return next.length === prev.length ? prev : next;
|
|
106
|
+
});
|
|
107
|
+
}, [hostTabs]);
|
|
108
|
+
|
|
109
|
+
// Keep the active tab valid as host/opened tabs change. If it disappears (or
|
|
110
|
+
// was never set), fall back to the first available tab.
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
setActiveTabId((current) => {
|
|
113
|
+
if (current !== null && tabs.some((t) => t.tabId === current)) {
|
|
114
|
+
return current;
|
|
115
|
+
}
|
|
116
|
+
return tabs[0]?.tabId ?? null;
|
|
117
|
+
});
|
|
118
|
+
}, [tabs]);
|
|
119
|
+
|
|
120
|
+
// A stable snapshot for `list()` — the controller identity must not change on
|
|
121
|
+
// every render, so the callbacks read through a ref instead of closing over
|
|
122
|
+
// `tabs`.
|
|
123
|
+
const tabsRef = useRef(tabs);
|
|
124
|
+
tabsRef.current = tabs;
|
|
125
|
+
const openedTabsRef = useRef(openedTabs);
|
|
126
|
+
openedTabsRef.current = openedTabs;
|
|
127
|
+
const activeRef = useRef(activeTabId);
|
|
128
|
+
activeRef.current = activeTabId;
|
|
129
|
+
|
|
130
|
+
const activate = useCallback((tabId: string): void => {
|
|
131
|
+
if (!tabsRef.current.some((t) => t.tabId === tabId)) return;
|
|
132
|
+
setActiveTabId(tabId);
|
|
133
|
+
}, []);
|
|
134
|
+
|
|
135
|
+
const open = useCallback((surface: VistaTab): string => {
|
|
136
|
+
setOpenedTabs((prev) => {
|
|
137
|
+
const index = prev.findIndex((t) => t.tabId === surface.tabId);
|
|
138
|
+
if (index === -1) return [...prev, surface];
|
|
139
|
+
// Re-opening the same tabId REPLACES it (the `VistaSurface` contract).
|
|
140
|
+
const next = [...prev];
|
|
141
|
+
next[index] = surface;
|
|
142
|
+
return next;
|
|
143
|
+
});
|
|
144
|
+
// Re-opening a host tab the user had dismissed un-dismisses it.
|
|
145
|
+
setClosedHostTabIds((prev) => prev.filter((id) => id !== surface.tabId));
|
|
146
|
+
setActiveTabId(surface.tabId);
|
|
147
|
+
return surface.tabId;
|
|
148
|
+
}, []);
|
|
149
|
+
|
|
150
|
+
const update = useCallback(
|
|
151
|
+
(tabId: string, patch: VistaSurfacePatch): boolean => {
|
|
152
|
+
// A HOST tab is owned by the host's data flow — a patch here would be
|
|
153
|
+
// overwritten on the next reconcile, so it is REFUSED rather than
|
|
154
|
+
// silently lost. Ownership is decided synchronously from the ref, not
|
|
155
|
+
// inside the state updater (which React may invoke twice).
|
|
156
|
+
if (!openedTabsRef.current.some((t) => t.tabId === tabId)) return false;
|
|
157
|
+
setOpenedTabs((prev) =>
|
|
158
|
+
prev.map((tab) => (tab.tabId === tabId ? { ...tab, ...patch } : tab)),
|
|
159
|
+
);
|
|
160
|
+
return true;
|
|
161
|
+
},
|
|
162
|
+
[],
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const close = useCallback((tabId: string): boolean => {
|
|
166
|
+
const tab = tabsRef.current.find((t) => t.tabId === tabId);
|
|
167
|
+
if (tab === undefined || tab.pinned === true) return false;
|
|
168
|
+
setOpenedTabs((prev) => prev.filter((t) => t.tabId !== tabId));
|
|
169
|
+
setClosedHostTabIds((prev) =>
|
|
170
|
+
prev.includes(tabId) ? prev : [...prev, tabId],
|
|
171
|
+
);
|
|
172
|
+
return true;
|
|
173
|
+
}, []);
|
|
174
|
+
|
|
175
|
+
const list = useCallback(
|
|
176
|
+
(): readonly VistaTabSummary[] =>
|
|
177
|
+
tabsRef.current.map((tab) => ({
|
|
178
|
+
tabId: tab.tabId,
|
|
179
|
+
kind: tab.kind,
|
|
180
|
+
title: tab.title,
|
|
181
|
+
pinned: tab.pinned === true,
|
|
182
|
+
active: tab.tabId === activeRef.current,
|
|
183
|
+
})),
|
|
184
|
+
[],
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
return { tabs, activeTabId, activate, open, update, close, list };
|
|
188
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
export type VistaCodeRenderer = (args: {
|
|
6
|
+
readonly content: string;
|
|
7
|
+
readonly path?: string;
|
|
8
|
+
readonly language?: string;
|
|
9
|
+
}) => ReactNode;
|
|
10
|
+
|
|
11
|
+
export const VistaCodeRendererContext =
|
|
12
|
+
createContext<VistaCodeRenderer | null>(null);
|
|
13
|
+
|
|
14
|
+
export function useVistaCodeRenderer(): VistaCodeRenderer | null {
|
|
15
|
+
return useContext(VistaCodeRendererContext);
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `VistaCodeRenderer` — the seam through which a host swaps in a real code
|
|
3
|
+
* editor for the `code` surface.
|
|
4
|
+
*
|
|
5
|
+
* The kernel ships NO syntax-highlighting engine (a Monaco/Prism dependency in
|
|
6
|
+
* a host-framework-agnostic package would be imposed on every consumer), so
|
|
7
|
+
* {@link CodeSurface}'s built-in body is a mono `<pre>`. That is a COMPLETE
|
|
8
|
+
* rendering of a file's bytes, not a degraded one — but a host that already
|
|
9
|
+
* ships an editor (host-web ships Monaco) provides it here and every `code`
|
|
10
|
+
* tab picks it up.
|
|
11
|
+
*
|
|
12
|
+
* This is an extension point, not a fallback chain: with no provider the mono
|
|
13
|
+
* pane is the intended rendering, and with a provider the host's renderer is
|
|
14
|
+
* the intended rendering. Neither is an error path.
|
|
15
|
+
*/
|
|
16
|
+
import {
|
|
17
|
+
type ReactElement,
|
|
18
|
+
type ReactNode,
|
|
19
|
+
} from 'react';
|
|
20
|
+
import {
|
|
21
|
+
VistaCodeRendererContext,
|
|
22
|
+
type VistaCodeRenderer,
|
|
23
|
+
} from './vista-code-renderer-context';
|
|
24
|
+
|
|
25
|
+
export function VistaCodeRendererProvider({
|
|
26
|
+
renderer,
|
|
27
|
+
children,
|
|
28
|
+
}: Readonly<{ renderer: VistaCodeRenderer; children: ReactNode }>): ReactElement {
|
|
29
|
+
return (
|
|
30
|
+
<VistaCodeRendererContext.Provider value={renderer}>
|
|
31
|
+
{children}
|
|
32
|
+
</VistaCodeRendererContext.Provider>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface VistaFileSource {
|
|
4
|
+
readText(path: string): Promise<string>;
|
|
5
|
+
resolveUrl(path: string): Promise<string>;
|
|
6
|
+
readonly revision?: string | number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const VistaFileSourceContext =
|
|
10
|
+
createContext<VistaFileSource | null>(null);
|
|
11
|
+
|
|
12
|
+
export function useVistaFileSource(): VistaFileSource | null {
|
|
13
|
+
return useContext(VistaFileSourceContext);
|
|
14
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `VistaFileSource` — the ONE seam through which a file-backed surface reads
|
|
3
|
+
* bytes.
|
|
4
|
+
*
|
|
5
|
+
* `@xemahq/ui-kernel` is host-framework-agnostic and carries no API client, so
|
|
6
|
+
* a `code`/`markdown`/`pdf`/`image` surface addressed by a workspace `path`
|
|
7
|
+
* cannot fetch on its own. The host provides a source (bound to its own
|
|
8
|
+
* session-file / artifact endpoints) exactly once, at the panel boundary; every
|
|
9
|
+
* first-party renderer reads through it.
|
|
10
|
+
*
|
|
11
|
+
* There is deliberately NO default: a path-backed surface mounted without a
|
|
12
|
+
* provider renders a visible error, never a blank pane and never a silent
|
|
13
|
+
* "content unavailable".
|
|
14
|
+
*/
|
|
15
|
+
import {
|
|
16
|
+
useEffect,
|
|
17
|
+
useState,
|
|
18
|
+
type ReactElement,
|
|
19
|
+
type ReactNode,
|
|
20
|
+
} from 'react';
|
|
21
|
+
import {
|
|
22
|
+
VistaFileSourceContext,
|
|
23
|
+
useVistaFileSource,
|
|
24
|
+
type VistaFileSource,
|
|
25
|
+
} from './vista-file-context';
|
|
26
|
+
|
|
27
|
+
export function VistaFileSourceProvider({
|
|
28
|
+
source,
|
|
29
|
+
children,
|
|
30
|
+
}: Readonly<{ source: VistaFileSource; children: ReactNode }>): ReactElement {
|
|
31
|
+
return (
|
|
32
|
+
<VistaFileSourceContext.Provider value={source}>
|
|
33
|
+
{children}
|
|
34
|
+
</VistaFileSourceContext.Provider>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Async load state for a path-backed surface. */
|
|
39
|
+
type LoadState =
|
|
40
|
+
| { readonly status: 'loading' }
|
|
41
|
+
| { readonly status: 'ready'; readonly value: string }
|
|
42
|
+
| { readonly status: 'error'; readonly message: string };
|
|
43
|
+
|
|
44
|
+
const LOADING: LoadState = { status: 'loading' };
|
|
45
|
+
|
|
46
|
+
function useResolvedFile(
|
|
47
|
+
path: string,
|
|
48
|
+
mode: 'text' | 'url',
|
|
49
|
+
): LoadState {
|
|
50
|
+
const source = useVistaFileSource();
|
|
51
|
+
const revision = source?.revision;
|
|
52
|
+
const [state, setState] = useState<LoadState>(LOADING);
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (source === null) {
|
|
56
|
+
setState({
|
|
57
|
+
status: 'error',
|
|
58
|
+
message:
|
|
59
|
+
'No file source is mounted for this panel, so path-backed content cannot be read.',
|
|
60
|
+
});
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
let cancelled = false;
|
|
64
|
+
setState(LOADING);
|
|
65
|
+
const promise =
|
|
66
|
+
mode === 'text' ? source.readText(path) : source.resolveUrl(path);
|
|
67
|
+
promise.then(
|
|
68
|
+
(value) => {
|
|
69
|
+
if (!cancelled) setState({ status: 'ready', value });
|
|
70
|
+
},
|
|
71
|
+
(error: unknown) => {
|
|
72
|
+
if (cancelled) return;
|
|
73
|
+
setState({
|
|
74
|
+
status: 'error',
|
|
75
|
+
message: error instanceof Error ? error.message : String(error),
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
);
|
|
79
|
+
return () => {
|
|
80
|
+
cancelled = true;
|
|
81
|
+
};
|
|
82
|
+
}, [source, path, mode, revision]);
|
|
83
|
+
|
|
84
|
+
return state;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function LoadNotice({
|
|
88
|
+
state,
|
|
89
|
+
}: Readonly<{ state: Exclude<LoadState, { status: 'ready' }> }>): ReactElement {
|
|
90
|
+
return (
|
|
91
|
+
<div
|
|
92
|
+
role={state.status === 'error' ? 'alert' : undefined}
|
|
93
|
+
style={{
|
|
94
|
+
display: 'flex',
|
|
95
|
+
height: '100%',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
justifyContent: 'center',
|
|
98
|
+
padding: 24,
|
|
99
|
+
fontSize: 12.5,
|
|
100
|
+
textAlign: 'center',
|
|
101
|
+
color:
|
|
102
|
+
state.status === 'error'
|
|
103
|
+
? 'hsl(var(--destructive))'
|
|
104
|
+
: 'hsl(var(--ink-4))',
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
{state.status === 'loading' ? 'Loading…' : state.message}
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Render a path-backed surface body from its TEXT content. The load/error
|
|
114
|
+
* states are explicit and visible — a failed read never renders as empty
|
|
115
|
+
* content.
|
|
116
|
+
*/
|
|
117
|
+
export function VistaFileText({
|
|
118
|
+
path,
|
|
119
|
+
render,
|
|
120
|
+
}: Readonly<{
|
|
121
|
+
path: string;
|
|
122
|
+
render: (content: string) => ReactNode;
|
|
123
|
+
}>): ReactElement {
|
|
124
|
+
const state = useResolvedFile(path, 'text');
|
|
125
|
+
if (state.status !== 'ready') return <LoadNotice state={state} />;
|
|
126
|
+
return <>{render(state.value)}</>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Render a path-backed surface body from a resolved fetchable URL. */
|
|
130
|
+
export function VistaFileUrl({
|
|
131
|
+
path,
|
|
132
|
+
render,
|
|
133
|
+
}: Readonly<{
|
|
134
|
+
path: string;
|
|
135
|
+
render: (url: string) => ReactNode;
|
|
136
|
+
}>): ReactElement {
|
|
137
|
+
const state = useResolvedFile(path, 'url');
|
|
138
|
+
if (state.status !== 'ready') return <LoadNotice state={state} />;
|
|
139
|
+
return <>{render(state.value)}</>;
|
|
140
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface VistaFormOutcome {
|
|
4
|
+
readonly submitted: true;
|
|
5
|
+
readonly ref: string;
|
|
6
|
+
readonly connectionId: string | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface VistaFormHost {
|
|
10
|
+
readonly elicitationApiBaseUrl: string;
|
|
11
|
+
getAccessToken(): Promise<string>;
|
|
12
|
+
onOutcome(outcome: VistaFormOutcome): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const VistaFormHostContext =
|
|
16
|
+
createContext<VistaFormHost | null>(null);
|
|
17
|
+
|
|
18
|
+
export function useVistaFormHost(): VistaFormHost | null {
|
|
19
|
+
return useContext(VistaFormHostContext);
|
|
20
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `VistaFormHost` — the ONE seam through which a `SurfaceKind.Form` surface
|
|
3
|
+
* gets the SUBJECT's bearer token and reports completion.
|
|
4
|
+
*
|
|
5
|
+
* ── Why this exists, and why the shapes are what they are ───────────────────
|
|
6
|
+
* The `form` surface is the secure-elicitation surface: an agent asks for a
|
|
7
|
+
* credential it must never see. The value therefore travels
|
|
8
|
+
* BROWSER → OWNING SERVICE, signed with the user's own JWT, and the agent
|
|
9
|
+
* learns only that the elicitation settled.
|
|
10
|
+
*
|
|
11
|
+
* That is enforced STRUCTURALLY, not by convention:
|
|
12
|
+
*
|
|
13
|
+
* 1. {@link VistaFormOutcome} is the ONLY thing the surface can report. It is
|
|
14
|
+
* a closed interface with three scalar members and NO `unknown`, no index
|
|
15
|
+
* signature, and no payload/values member. There is no shape a field value
|
|
16
|
+
* could be assigned to. Widening it is the one change that would break the
|
|
17
|
+
* guarantee — do not add a member that can hold arbitrary data.
|
|
18
|
+
* 2. `getAccessToken` returns the SUBJECT's token. The host binds it to the
|
|
19
|
+
* logged-in user's session; it is never a service token and never the
|
|
20
|
+
* agent's token, so the service authorizes the human, not the model.
|
|
21
|
+
* 3. `elicitationApiBaseUrl` is supplied by trusted host configuration, never
|
|
22
|
+
* by the agent-controlled payload. The kernel validates its scheme and
|
|
23
|
+
* canonical authority/path before deriving the status/submit endpoints.
|
|
24
|
+
*
|
|
25
|
+
* There is deliberately NO default host: a `form` surface mounted without a
|
|
26
|
+
* provider renders a visible refusal and cannot submit. Fail-closed — a form
|
|
27
|
+
* that silently posts nowhere would be worse than one that says it cannot.
|
|
28
|
+
*/
|
|
29
|
+
import {
|
|
30
|
+
type ReactElement,
|
|
31
|
+
type ReactNode,
|
|
32
|
+
} from 'react';
|
|
33
|
+
import {
|
|
34
|
+
VistaFormHostContext,
|
|
35
|
+
type VistaFormHost,
|
|
36
|
+
} from './vista-form-context';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Everything a settled elicitation reports. Closed, scalar-only, and
|
|
40
|
+
* value-identical to the service's `{ submitted, ref, connectionId }` — the
|
|
41
|
+
* persistence layer behind it has no column able to hold a field value, and
|
|
42
|
+
* neither does this type.
|
|
43
|
+
*/
|
|
44
|
+
export function VistaFormHostProvider({
|
|
45
|
+
host,
|
|
46
|
+
children,
|
|
47
|
+
}: Readonly<{ host: VistaFormHost; children: ReactNode }>): ReactElement {
|
|
48
|
+
return (
|
|
49
|
+
<VistaFormHostContext.Provider value={host}>
|
|
50
|
+
{children}
|
|
51
|
+
</VistaFormHostContext.Provider>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Vista tab model — ONE tab vocabulary for every preview plane.
|
|
3
|
+
*
|
|
4
|
+
* Before this module the frontend carried THREE overlapping tab models with no
|
|
5
|
+
* shared code:
|
|
6
|
+
* • `WorkspaceTabKind` (`files|code|md|diff|tests|url`) in the thin session
|
|
7
|
+
* workspace;
|
|
8
|
+
* • `PreviewTabKind` (`files|html|markdown|pdf|image|plain`) buried inside the
|
|
9
|
+
* Design-System-Builder page;
|
|
10
|
+
* • the App-Forge preview.
|
|
11
|
+
* All three collapse onto the kernel {@link SurfaceKind} (Canopy §8.5). A tab is
|
|
12
|
+
* just a {@link VistaSurface} envelope; the Vista registry resolves its `kind`
|
|
13
|
+
* to a renderer.
|
|
14
|
+
*
|
|
15
|
+
* Collapse notes (deliberate, documented decisions):
|
|
16
|
+
* • `md` → {@link SurfaceKind.Markdown}.
|
|
17
|
+
* • `plain` → {@link SurfaceKind.Code}. `Code` is "a source file", and the
|
|
18
|
+
* code renderer is a mono pane; a separate "plain text" kind would be the
|
|
19
|
+
* same renderer under a second name.
|
|
20
|
+
* • `tests` had no kernel equivalent and was never a *render* kind — a test
|
|
21
|
+
* report is a biome-owned surface, so it becomes a biome-contributed
|
|
22
|
+
* `<biomeId>:tests` kind rather than a first-party one. Nothing in the tree
|
|
23
|
+
* rendered it (the thin workspace's `renderTests` slot was never supplied).
|
|
24
|
+
*/
|
|
25
|
+
import { SurfaceKind, type VistaSurface } from '@xemahq/kernel-contracts/surface';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Id of the pinned, UI-owned file-browser tab. It is owned by the panel, never
|
|
29
|
+
* declared by an agent, and never closeable.
|
|
30
|
+
*/
|
|
31
|
+
export const VISTA_FILES_TAB_ID = 'files';
|
|
32
|
+
|
|
33
|
+
/** Current payload schema version of every first-party surface kind. */
|
|
34
|
+
export const VISTA_SURFACE_VERSION = 1;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A Vista tab. Structurally a {@link VistaSurface} — the tab model and the
|
|
38
|
+
* agent-facing envelope are the SAME shape on purpose, so `vista_open` needs no
|
|
39
|
+
* translation layer.
|
|
40
|
+
*/
|
|
41
|
+
export type VistaTab = VistaSurface;
|
|
42
|
+
|
|
43
|
+
/** Extension → first-party surface kind. Closed, deterministic mapping. */
|
|
44
|
+
const EXTENSION_KIND: Readonly<Record<string, SurfaceKind>> = {
|
|
45
|
+
html: SurfaceKind.Html,
|
|
46
|
+
htm: SurfaceKind.Html,
|
|
47
|
+
md: SurfaceKind.Markdown,
|
|
48
|
+
mdx: SurfaceKind.Markdown,
|
|
49
|
+
markdown: SurfaceKind.Markdown,
|
|
50
|
+
pdf: SurfaceKind.Pdf,
|
|
51
|
+
png: SurfaceKind.Image,
|
|
52
|
+
jpg: SurfaceKind.Image,
|
|
53
|
+
jpeg: SurfaceKind.Image,
|
|
54
|
+
gif: SurfaceKind.Image,
|
|
55
|
+
webp: SurfaceKind.Image,
|
|
56
|
+
svg: SurfaceKind.Image,
|
|
57
|
+
avif: SurfaceKind.Image,
|
|
58
|
+
mp4: SurfaceKind.Media,
|
|
59
|
+
webm: SurfaceKind.Media,
|
|
60
|
+
mov: SurfaceKind.Media,
|
|
61
|
+
mp3: SurfaceKind.Media,
|
|
62
|
+
wav: SurfaceKind.Media,
|
|
63
|
+
ogg: SurfaceKind.Media,
|
|
64
|
+
m4a: SurfaceKind.Media,
|
|
65
|
+
json: SurfaceKind.Json,
|
|
66
|
+
diff: SurfaceKind.Diff,
|
|
67
|
+
patch: SurfaceKind.Diff,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Resolve the surface kind a file path renders as. Deterministic and total:
|
|
72
|
+
* anything unrecognised is {@link SurfaceKind.Code} (a mono text pane), which is
|
|
73
|
+
* always a correct — if plain — rendering of a file's bytes.
|
|
74
|
+
*/
|
|
75
|
+
export function surfaceKindForPath(path: string): SurfaceKind {
|
|
76
|
+
const dot = path.lastIndexOf('.');
|
|
77
|
+
if (dot === -1) return SurfaceKind.Code;
|
|
78
|
+
const ext = path.slice(dot + 1).toLowerCase();
|
|
79
|
+
return EXTENSION_KIND[ext] ?? SurfaceKind.Code;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** The `content-type` a media/blob surface reports for a path, when derivable. */
|
|
83
|
+
const EXTENSION_CONTENT_TYPE: Readonly<Record<string, string>> = {
|
|
84
|
+
png: 'image/png',
|
|
85
|
+
jpg: 'image/jpeg',
|
|
86
|
+
jpeg: 'image/jpeg',
|
|
87
|
+
gif: 'image/gif',
|
|
88
|
+
webp: 'image/webp',
|
|
89
|
+
svg: 'image/svg+xml',
|
|
90
|
+
avif: 'image/avif',
|
|
91
|
+
pdf: 'application/pdf',
|
|
92
|
+
mp4: 'video/mp4',
|
|
93
|
+
webm: 'video/webm',
|
|
94
|
+
mov: 'video/quicktime',
|
|
95
|
+
mp3: 'audio/mpeg',
|
|
96
|
+
wav: 'audio/wav',
|
|
97
|
+
ogg: 'audio/ogg',
|
|
98
|
+
m4a: 'audio/mp4',
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/** Content type for a path, or `null` when the extension is unknown. */
|
|
102
|
+
export function contentTypeForPath(path: string): string | null {
|
|
103
|
+
const dot = path.lastIndexOf('.');
|
|
104
|
+
if (dot === -1) return null;
|
|
105
|
+
return EXTENSION_CONTENT_TYPE[path.slice(dot + 1).toLowerCase()] ?? null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** The last path segment — the default tab label for a file-backed surface. */
|
|
109
|
+
export function labelForPath(path: string): string {
|
|
110
|
+
const segments = path.split('/');
|
|
111
|
+
return segments[segments.length - 1] || path;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Build a file-backed surface envelope for a path. One seam so every caller
|
|
116
|
+
* (the `.tabs.json` parser, the file browser, `vista_open`) derives kind + label
|
|
117
|
+
* + tab id identically.
|
|
118
|
+
*/
|
|
119
|
+
export function fileSurface(
|
|
120
|
+
path: string,
|
|
121
|
+
overrides?: Readonly<{ title?: string; kind?: SurfaceKind }>,
|
|
122
|
+
): VistaTab {
|
|
123
|
+
return {
|
|
124
|
+
tabId: `file:${path}`,
|
|
125
|
+
kind: overrides?.kind ?? surfaceKindForPath(path),
|
|
126
|
+
version: VISTA_SURFACE_VERSION,
|
|
127
|
+
title: overrides?.title ?? labelForPath(path),
|
|
128
|
+
payload: { path },
|
|
129
|
+
};
|
|
130
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `VistaOpenContext` — how a surface asks the panel to open ANOTHER surface.
|
|
3
|
+
*
|
|
4
|
+
* The registry's `render(payload)` is a pure function, so a renderer cannot
|
|
5
|
+
* receive an `onOpen` prop. The panel publishes its `open` through this context
|
|
6
|
+
* instead: the file browser opens a file tab, an object view opens a related
|
|
7
|
+
* object, and so on — all through the SAME `vista_open` semantics the agent
|
|
8
|
+
* uses, never a second code path.
|
|
9
|
+
*
|
|
10
|
+
* A surface mounted without a provider simply renders non-interactive rows
|
|
11
|
+
* (`useVistaOpen()` returns `null`) — an inert list, never a dead click that
|
|
12
|
+
* silently does nothing.
|
|
13
|
+
*/
|
|
14
|
+
import {
|
|
15
|
+
type ReactElement,
|
|
16
|
+
type ReactNode,
|
|
17
|
+
} from 'react';
|
|
18
|
+
import {
|
|
19
|
+
VistaOpenContext,
|
|
20
|
+
type VistaOpenFn,
|
|
21
|
+
} from './vista-open-state';
|
|
22
|
+
|
|
23
|
+
export function VistaOpenProvider({
|
|
24
|
+
open,
|
|
25
|
+
children,
|
|
26
|
+
}: Readonly<{ open: VistaOpenFn; children: ReactNode }>): ReactElement {
|
|
27
|
+
return (
|
|
28
|
+
<VistaOpenContext.Provider value={open}>
|
|
29
|
+
{children}
|
|
30
|
+
</VistaOpenContext.Provider>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { VistaTab } from './vista-model';
|
|
4
|
+
|
|
5
|
+
export type VistaOpenFn = (surface: VistaTab) => string;
|
|
6
|
+
|
|
7
|
+
export const VistaOpenContext = createContext<VistaOpenFn | null>(null);
|
|
8
|
+
|
|
9
|
+
export function useVistaOpen(): VistaOpenFn | null {
|
|
10
|
+
return useContext(VistaOpenContext);
|
|
11
|
+
}
|