@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
package/src/registry/index.ts
CHANGED
|
@@ -4,5 +4,6 @@ export * from './lib/biome-slot';
|
|
|
4
4
|
export * from './lib/biomes-enabled-context';
|
|
5
5
|
export * from './lib/session-selectors';
|
|
6
6
|
export * from './lib/session-context-builder';
|
|
7
|
+
export * from './lib/session-context';
|
|
7
8
|
export * from './lib/session-context-provider';
|
|
8
9
|
export * from './lib/primitives';
|
|
@@ -125,13 +125,15 @@ export function SessionEventCard({
|
|
|
125
125
|
<span style={{ color: 'hsl(var(--ink, 228 14% 11%))', wordBreak: 'break-word' }}>
|
|
126
126
|
{title}
|
|
127
127
|
</span>
|
|
128
|
-
{detail
|
|
128
|
+
{detail !== null && detail !== undefined && (
|
|
129
129
|
<span style={{ color: 'hsl(var(--ink-3, 228 6% 40%))', wordBreak: 'break-word' }}>
|
|
130
130
|
{detail}
|
|
131
131
|
</span>
|
|
132
132
|
)}
|
|
133
133
|
</div>
|
|
134
|
-
{children
|
|
134
|
+
{children !== null && children !== undefined && (
|
|
135
|
+
<div style={{ marginTop: 4 }}>{children}</div>
|
|
136
|
+
)}
|
|
135
137
|
</div>
|
|
136
138
|
</div>
|
|
137
139
|
);
|
|
@@ -10,12 +10,11 @@
|
|
|
10
10
|
* stable, importable hook — `import { useCurrentSessionContext } from
|
|
11
11
|
* '@xemahq/ui-kernel/registry'`.
|
|
12
12
|
*/
|
|
13
|
-
import
|
|
13
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import { SessionContextValue } from './session-context';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
Ctx.displayName = 'SessionContext';
|
|
17
|
+
import type { SessionContext } from '../../index';
|
|
19
18
|
|
|
20
19
|
export interface SessionContextProviderProps {
|
|
21
20
|
readonly value: SessionContext;
|
|
@@ -26,25 +25,9 @@ export function SessionContextProvider({
|
|
|
26
25
|
value,
|
|
27
26
|
children,
|
|
28
27
|
}: SessionContextProviderProps): ReactElement {
|
|
29
|
-
return
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (!ctx) {
|
|
35
|
-
throw new Error(
|
|
36
|
-
'[biome-registry-web] useCurrentSessionContext() called outside <SessionContextProvider>. ' +
|
|
37
|
-
'The host shell must wrap session UI with the provider before any biome reads it.',
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
return ctx;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Non-throwing variant for components that may render outside a session
|
|
45
|
-
* context (e.g. shared primitives reused on the design-system-builder page).
|
|
46
|
-
* Returns `null` instead of throwing.
|
|
47
|
-
*/
|
|
48
|
-
export function useOptionalSessionContext(): SessionContext | null {
|
|
49
|
-
return useContext(Ctx);
|
|
28
|
+
return (
|
|
29
|
+
<SessionContextValue.Provider value={value}>
|
|
30
|
+
{children}
|
|
31
|
+
</SessionContextValue.Provider>
|
|
32
|
+
);
|
|
50
33
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { SessionContext } from '../../index';
|
|
4
|
+
|
|
5
|
+
export const SessionContextValue = createContext<SessionContext | null>(null);
|
|
6
|
+
SessionContextValue.displayName = 'SessionContext';
|
|
7
|
+
|
|
8
|
+
export function useCurrentSessionContext(): SessionContext {
|
|
9
|
+
const ctx = useContext(SessionContextValue);
|
|
10
|
+
if (!ctx) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
'[biome-registry-web] useCurrentSessionContext() called outside <SessionContextProvider>. ' +
|
|
13
|
+
'The host shell must wrap session UI with the provider before any biome reads it.',
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
return ctx;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function useOptionalSessionContext(): SessionContext | null {
|
|
20
|
+
return useContext(SessionContextValue);
|
|
21
|
+
}
|
|
@@ -52,7 +52,9 @@ function applies<T extends { readonly appliesTo?: (...args: never[]) => boolean
|
|
|
52
52
|
args: Parameters<PredicateOf<T>>,
|
|
53
53
|
): boolean {
|
|
54
54
|
const predicate = item.appliesTo as PredicateOf<T> | undefined;
|
|
55
|
-
return predicate
|
|
55
|
+
return predicate === null || predicate === undefined
|
|
56
|
+
? true
|
|
57
|
+
: predicate(...args);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
// ── Slash commands ────────────────────────────────────────────────────
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface AppBrandingContextValue {
|
|
4
|
+
readonly displayName: string;
|
|
5
|
+
readonly logoUrl?: string;
|
|
6
|
+
readonly primaryColor?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const AppBrandingContext =
|
|
10
|
+
React.createContext<AppBrandingContextValue | null>(null);
|
|
11
|
+
|
|
12
|
+
export function useAppBranding(): AppBrandingContextValue {
|
|
13
|
+
const ctx = React.useContext(AppBrandingContext);
|
|
14
|
+
if (ctx === null) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
'useAppBranding must be used within an <AppBrandingProvider>.',
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return ctx;
|
|
20
|
+
}
|
|
@@ -23,6 +23,10 @@ import * as React from 'react';
|
|
|
23
23
|
import type { BrandingConfig } from '@xemahq/kernel-contracts/app-platform';
|
|
24
24
|
|
|
25
25
|
import { cn } from '../cn';
|
|
26
|
+
import {
|
|
27
|
+
AppBrandingContext,
|
|
28
|
+
type AppBrandingContextValue,
|
|
29
|
+
} from './app-branding-context';
|
|
26
30
|
|
|
27
31
|
import {
|
|
28
32
|
sanitizeCssCustomPropertyName,
|
|
@@ -33,32 +37,6 @@ import {
|
|
|
33
37
|
/** CSS custom property carrying the app's resolved primary brand color. */
|
|
34
38
|
export const APP_PRIMARY_COLOR_VAR = '--app-primary-color';
|
|
35
39
|
|
|
36
|
-
/** Values a branded header needs — sanitized, safe to render. */
|
|
37
|
-
export interface AppBrandingContextValue {
|
|
38
|
-
readonly displayName: string;
|
|
39
|
-
readonly logoUrl?: string;
|
|
40
|
-
readonly primaryColor?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const AppBrandingContext = React.createContext<AppBrandingContextValue | null>(
|
|
44
|
-
null,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Resolved branding for the nearest enclosing {@link AppBrandingProvider}.
|
|
49
|
-
* Throws when used outside one — a header that assumes branding must not
|
|
50
|
-
* silently render an unbranded surface.
|
|
51
|
-
*/
|
|
52
|
-
export function useAppBranding(): AppBrandingContextValue {
|
|
53
|
-
const ctx = React.useContext(AppBrandingContext);
|
|
54
|
-
if (ctx === null) {
|
|
55
|
-
throw new Error(
|
|
56
|
-
'useAppBranding must be used within an <AppBrandingProvider>.',
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
return ctx;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
40
|
export interface AppBrandingProviderProps {
|
|
63
41
|
/** The app's base branding (from the App definition / release). */
|
|
64
42
|
readonly branding: BrandingConfig;
|
|
@@ -137,7 +115,7 @@ export function AppBrandingProvider({
|
|
|
137
115
|
className={cn(className)}
|
|
138
116
|
// Custom properties are not part of `React.CSSProperties`; the cast is
|
|
139
117
|
// the standard way to set `--*` vars inline.
|
|
140
|
-
style={cssVars
|
|
118
|
+
style={cssVars}
|
|
141
119
|
>
|
|
142
120
|
{children}
|
|
143
121
|
</div>
|
|
@@ -43,10 +43,30 @@ function scalarSchema(field: CaptureFieldSpec): z.ZodTypeAny {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/** True when `value` parses as JSON. Total — never throws. */
|
|
47
|
+
export function isParsableJson(value: string): boolean {
|
|
48
|
+
try {
|
|
49
|
+
JSON.parse(value);
|
|
50
|
+
return true;
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
46
56
|
function fieldSchema(field: CaptureFieldSpec): z.ZodTypeAny {
|
|
47
57
|
let base: z.ZodTypeAny;
|
|
48
58
|
if (field.type === CaptureFieldType.Object) {
|
|
49
59
|
base = objectSchema(field.fields ?? []);
|
|
60
|
+
} else if (field.type === CaptureFieldType.Json) {
|
|
61
|
+
// A JSON blob is carried as TEXT and validated as parseable. `''` passes
|
|
62
|
+
// the shape check so an optional blank field stays valid; requiredness is
|
|
63
|
+
// enforced by the `.min(1)` below, not by the parse rule.
|
|
64
|
+
const text = field.required
|
|
65
|
+
? z.string().min(1, { message: `${field.label} is required` })
|
|
66
|
+
: z.string();
|
|
67
|
+
base = text.refine((v) => v === '' || isParsableJson(v), {
|
|
68
|
+
message: `${field.label} must be valid JSON`,
|
|
69
|
+
});
|
|
50
70
|
} else if (field.type === CaptureFieldType.List) {
|
|
51
71
|
let arr = z.array(objectSchema(field.fields ?? []));
|
|
52
72
|
if (typeof field.min === 'number') arr = arr.min(field.min, { message: `${field.label} needs at least ${field.min} item(s)` });
|
|
@@ -58,6 +78,8 @@ function fieldSchema(field: CaptureFieldSpec): z.ZodTypeAny {
|
|
|
58
78
|
field.required &&
|
|
59
79
|
(field.type === CaptureFieldType.String ||
|
|
60
80
|
field.type === CaptureFieldType.Text ||
|
|
81
|
+
field.type === CaptureFieldType.Email ||
|
|
82
|
+
field.type === CaptureFieldType.Url ||
|
|
61
83
|
field.type === CaptureFieldType.User ||
|
|
62
84
|
field.type === CaptureFieldType.Reference ||
|
|
63
85
|
field.type === CaptureFieldType.Datetime ||
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// Total runtime validator for a `CaptureFieldSpec[]` arriving from the wire
|
|
3
|
+
//
|
|
4
|
+
// `fieldSpecToZod` validates the VALUES a form produces. This validates the
|
|
5
|
+
// SCHEMA itself, for the case where the field list is not authored in TypeScript
|
|
6
|
+
// but carried in an envelope (a Vista `form` surface payload, a biome
|
|
7
|
+
// contribution, an agent-authored capture step).
|
|
8
|
+
//
|
|
9
|
+
// Contract: TOTAL and NEVER throws — it returns the narrowed specs or `null`,
|
|
10
|
+
// exactly like the Vista payload validators, so a malformed schema degrades to
|
|
11
|
+
// a visible typed fallback instead of a half-rendered form.
|
|
12
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
13
|
+
import { CaptureFieldTransform, CaptureFieldType, type CaptureFieldSpec } from './field-spec';
|
|
14
|
+
|
|
15
|
+
const FIELD_TYPES: ReadonlySet<string> = new Set(Object.values(CaptureFieldType));
|
|
16
|
+
const TRANSFORMS: ReadonlySet<string> = new Set(Object.values(CaptureFieldTransform));
|
|
17
|
+
|
|
18
|
+
type UnknownRecord = Readonly<Record<string, unknown>>;
|
|
19
|
+
|
|
20
|
+
function asRecord(value: unknown): UnknownRecord | null {
|
|
21
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
22
|
+
? (value as UnknownRecord)
|
|
23
|
+
: null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** `undefined` passes through; a present non-string is a rejection (`null`). */
|
|
27
|
+
function optionalString(value: unknown): string | undefined | null {
|
|
28
|
+
if (value === undefined) return undefined;
|
|
29
|
+
return typeof value === 'string' ? value : null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** `undefined` passes through; a present non-boolean is a rejection (`null`). */
|
|
33
|
+
function optionalBoolean(value: unknown): boolean | undefined | null {
|
|
34
|
+
if (value === undefined) return undefined;
|
|
35
|
+
return typeof value === 'boolean' ? value : null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** `undefined` passes through; a present non-number is a rejection (`null`). */
|
|
39
|
+
function optionalNumber(value: unknown): number | undefined | null {
|
|
40
|
+
if (value === undefined) return undefined;
|
|
41
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Narrow ONE field spec. Returns `null` for anything malformed. */
|
|
45
|
+
export function validateCaptureField(raw: unknown): CaptureFieldSpec | null {
|
|
46
|
+
const record = asRecord(raw);
|
|
47
|
+
if (record === null) return null;
|
|
48
|
+
if (typeof record.key !== 'string' || record.key.length === 0) return null;
|
|
49
|
+
if (typeof record.label !== 'string' || record.label.length === 0) return null;
|
|
50
|
+
if (typeof record.type !== 'string' || !FIELD_TYPES.has(record.type)) return null;
|
|
51
|
+
|
|
52
|
+
const required = optionalBoolean(record.required);
|
|
53
|
+
if (required === null) return null;
|
|
54
|
+
const isSecret = optionalBoolean(record.isSecret);
|
|
55
|
+
if (isSecret === null) return null;
|
|
56
|
+
const description = optionalString(record.description);
|
|
57
|
+
if (description === null) return null;
|
|
58
|
+
const placeholder = optionalString(record.placeholder);
|
|
59
|
+
if (placeholder === null) return null;
|
|
60
|
+
const section = optionalString(record.section);
|
|
61
|
+
if (section === null) return null;
|
|
62
|
+
const referenceEntity = optionalString(record.referenceEntity);
|
|
63
|
+
if (referenceEntity === null) return null;
|
|
64
|
+
const accept = optionalString(record.accept);
|
|
65
|
+
if (accept === null) return null;
|
|
66
|
+
const min = optionalNumber(record.min);
|
|
67
|
+
if (min === null) return null;
|
|
68
|
+
const max = optionalNumber(record.max);
|
|
69
|
+
if (max === null) return null;
|
|
70
|
+
|
|
71
|
+
let transform: CaptureFieldTransform | undefined;
|
|
72
|
+
if (record.transform !== undefined) {
|
|
73
|
+
if (typeof record.transform !== 'string' || !TRANSFORMS.has(record.transform)) return null;
|
|
74
|
+
transform = record.transform as CaptureFieldTransform;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let enumValues: readonly string[] | undefined;
|
|
78
|
+
if (record.enumValues !== undefined) {
|
|
79
|
+
if (!Array.isArray(record.enumValues)) return null;
|
|
80
|
+
if (!record.enumValues.every((v) => typeof v === 'string')) return null;
|
|
81
|
+
enumValues = record.enumValues;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
let capture: 'user' | 'environment' | undefined;
|
|
85
|
+
if (record.capture !== undefined) {
|
|
86
|
+
if (record.capture !== 'user' && record.capture !== 'environment') return null;
|
|
87
|
+
capture = record.capture;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
let fields: readonly CaptureFieldSpec[] | undefined;
|
|
91
|
+
if (record.fields !== undefined) {
|
|
92
|
+
const nested = validateCaptureFields(record.fields);
|
|
93
|
+
if (nested === null) return null;
|
|
94
|
+
fields = nested;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const spec: {
|
|
98
|
+
key: string;
|
|
99
|
+
label: string;
|
|
100
|
+
type: CaptureFieldType;
|
|
101
|
+
required?: boolean;
|
|
102
|
+
isSecret?: boolean;
|
|
103
|
+
transform?: CaptureFieldTransform;
|
|
104
|
+
description?: string;
|
|
105
|
+
placeholder?: string;
|
|
106
|
+
section?: string;
|
|
107
|
+
referenceEntity?: string;
|
|
108
|
+
accept?: string;
|
|
109
|
+
capture?: 'user' | 'environment';
|
|
110
|
+
enumValues?: readonly string[];
|
|
111
|
+
fields?: readonly CaptureFieldSpec[];
|
|
112
|
+
min?: number;
|
|
113
|
+
max?: number;
|
|
114
|
+
} = { key: record.key, label: record.label, type: record.type as CaptureFieldType };
|
|
115
|
+
|
|
116
|
+
if (required !== undefined) spec.required = required;
|
|
117
|
+
if (isSecret !== undefined) spec.isSecret = isSecret;
|
|
118
|
+
if (transform !== undefined) spec.transform = transform;
|
|
119
|
+
if (description !== undefined) spec.description = description;
|
|
120
|
+
if (placeholder !== undefined) spec.placeholder = placeholder;
|
|
121
|
+
if (section !== undefined) spec.section = section;
|
|
122
|
+
if (referenceEntity !== undefined) spec.referenceEntity = referenceEntity;
|
|
123
|
+
if (accept !== undefined) spec.accept = accept;
|
|
124
|
+
if (capture !== undefined) spec.capture = capture;
|
|
125
|
+
if (enumValues !== undefined) spec.enumValues = enumValues;
|
|
126
|
+
if (fields !== undefined) spec.fields = fields;
|
|
127
|
+
if (min !== undefined) spec.min = min;
|
|
128
|
+
if (max !== undefined) spec.max = max;
|
|
129
|
+
|
|
130
|
+
return spec;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Narrow a whole field list. An EMPTY array is valid and narrows to `[]` — an
|
|
135
|
+
* empty schema is a real, meaningful state (the server is the authority on
|
|
136
|
+
* whether a form with no fields may be submitted), not a validation failure.
|
|
137
|
+
*/
|
|
138
|
+
export function validateCaptureFields(raw: unknown): readonly CaptureFieldSpec[] | null {
|
|
139
|
+
if (!Array.isArray(raw)) return null;
|
|
140
|
+
const out: CaptureFieldSpec[] = [];
|
|
141
|
+
for (const entry of raw) {
|
|
142
|
+
const spec = validateCaptureField(entry);
|
|
143
|
+
if (spec === null) return null;
|
|
144
|
+
out.push(spec);
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
@@ -50,6 +50,53 @@ export enum CaptureFieldType {
|
|
|
50
50
|
Image = 'image',
|
|
51
51
|
File = 'file',
|
|
52
52
|
Audio = 'audio',
|
|
53
|
+
// ── Scalar text refinements (absorbed from the connector credential form) ──
|
|
54
|
+
// These change only the NATIVE INPUT TYPE (keyboard + browser affordances);
|
|
55
|
+
// the value is a plain string. `Json` additionally renders as a mono textarea
|
|
56
|
+
// and is validated as parseable JSON.
|
|
57
|
+
Email = 'email',
|
|
58
|
+
Url = 'url',
|
|
59
|
+
Json = 'json',
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Normalization applied to a captured STRING value at the input boundary.
|
|
64
|
+
*
|
|
65
|
+
* Value-identical in meaning to the connector `CredentialFieldTransform`
|
|
66
|
+
* (`NONE`/`UPPERCASE`/`LOWERCASE`/`TRIM`) but named in this kit's lowercase
|
|
67
|
+
* vocabulary, because the capture kit is domain-agnostic and must not import a
|
|
68
|
+
* connector contract. The connector→capture adapter lives at the consuming
|
|
69
|
+
* seam, not here.
|
|
70
|
+
*
|
|
71
|
+
* This is the ONLY normalization the kit performs. There is deliberately no
|
|
72
|
+
* blanket trim on submit: an undeclared transform would silently override a
|
|
73
|
+
* field that declared {@link CaptureFieldTransform.None}.
|
|
74
|
+
*/
|
|
75
|
+
export enum CaptureFieldTransform {
|
|
76
|
+
None = 'none',
|
|
77
|
+
Uppercase = 'uppercase',
|
|
78
|
+
Lowercase = 'lowercase',
|
|
79
|
+
Trim = 'trim',
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Apply a declared transform to a string value. Total; absent = unchanged. */
|
|
83
|
+
export function applyCaptureTransform(
|
|
84
|
+
value: string,
|
|
85
|
+
transform: CaptureFieldTransform | `${CaptureFieldTransform}` | undefined,
|
|
86
|
+
): string {
|
|
87
|
+
switch (transform) {
|
|
88
|
+
case CaptureFieldTransform.Uppercase:
|
|
89
|
+
return value.toUpperCase();
|
|
90
|
+
case CaptureFieldTransform.Lowercase:
|
|
91
|
+
return value.toLowerCase();
|
|
92
|
+
case CaptureFieldTransform.Trim:
|
|
93
|
+
return value.trim();
|
|
94
|
+
case CaptureFieldTransform.None:
|
|
95
|
+
case undefined:
|
|
96
|
+
return value;
|
|
97
|
+
default:
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
53
100
|
}
|
|
54
101
|
|
|
55
102
|
/**
|
|
@@ -96,6 +143,21 @@ export interface CaptureFieldSpec {
|
|
|
96
143
|
* explicit). See {@link groupFieldsBySection}.
|
|
97
144
|
*/
|
|
98
145
|
readonly section?: string;
|
|
146
|
+
/**
|
|
147
|
+
* DECLARED write-only secrecy. When true the input is masked, never
|
|
148
|
+
* pre-filled from a read, and never echoed back by any read path.
|
|
149
|
+
*
|
|
150
|
+
* Secrecy is DECLARED, never inferred from {@link type}: a plain-`string`
|
|
151
|
+
* field can be a secret and a `password`-shaped field can be public. The
|
|
152
|
+
* renderer reads this flag and nothing else — do not re-introduce a
|
|
153
|
+
* `type === password` inference.
|
|
154
|
+
*/
|
|
155
|
+
readonly isSecret?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Declared normalization applied to the string value at the input boundary.
|
|
158
|
+
* Absent = {@link CaptureFieldTransform.None}.
|
|
159
|
+
*/
|
|
160
|
+
readonly transform?: CaptureFieldTransform | `${CaptureFieldTransform}`;
|
|
99
161
|
}
|
|
100
162
|
|
|
101
163
|
/** A titled group of fields — the explicit sectioned schema shape. */
|
package/src/ui/capture/index.ts
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
// ── field-spec model (aligned superset of app-forge's AppFieldType) ──
|
|
12
12
|
export {
|
|
13
13
|
CaptureFieldType,
|
|
14
|
+
CaptureFieldTransform,
|
|
15
|
+
applyCaptureTransform,
|
|
14
16
|
isSectioned,
|
|
15
17
|
toFieldList,
|
|
16
18
|
toSections,
|
|
@@ -21,8 +23,14 @@ export {
|
|
|
21
23
|
type CaptureValues,
|
|
22
24
|
} from './field-spec';
|
|
23
25
|
|
|
26
|
+
// ── total runtime validator for a wire-carried schema ──
|
|
27
|
+
export { validateCaptureField, validateCaptureFields } from './field-spec-validate';
|
|
28
|
+
|
|
24
29
|
// ── schema → zod adapter ──
|
|
25
|
-
export { fieldSpecToZod, isEmptyValue } from './field-spec-to-zod';
|
|
30
|
+
export { fieldSpecToZod, isEmptyValue, isParsableJson } from './field-spec-to-zod';
|
|
31
|
+
|
|
32
|
+
// ── values → wire payload ──
|
|
33
|
+
export { captureValuesToStringMap, captureValuesToSubmitPayload } from './submit-values';
|
|
26
34
|
|
|
27
35
|
// ── validation + "missing info" ──
|
|
28
36
|
export { useSchemaValidation, type SchemaValidationResult } from './use-schema-validation';
|