@salsita-ai/sdk 0.50.0-develop.9241bcf09e → 0.50.0-develop.927e2414eb
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 +3 -3
- package/dist/admin/common/admin-interface.d.ts +11 -1
- package/dist/admin/common/admin-interface.js +1 -1
- package/dist/admin/ui/layout/UserProfile.d.ts +1 -1
- package/dist/admin/ui/layout/UserProfile.js +1 -1
- package/dist/admin/ui/maintenance/ImportPresets.js +1 -1
- package/dist/application/mount-application.js +1 -1
- package/dist/application/mount-configurator.js +1 -1
- package/dist/application/studio-embedding.d.ts +6 -0
- package/dist/application/studio-embedding.js +1 -0
- package/dist/application-spec/core/enhanced-json-schema.d.ts +5 -6
- package/dist/application-spec/core/enhanced-json-schema.js +1 -1
- package/dist/application-spec/core/markers/index.d.ts +1 -0
- package/dist/application-spec/core/markers/index.js +1 -1
- package/dist/application-spec/core/markers/set-in-studio-marker.d.ts +15 -0
- package/dist/application-spec/core/markers/set-in-studio-marker.js +1 -0
- package/dist/application-spec/errors/diagnostic-codes.d.ts +16 -0
- package/dist/application-spec/errors/diagnostic-codes.js +1 -1
- package/dist/application-spec/errors/diagnostic-messages.d.ts +16 -0
- package/dist/application-spec/errors/diagnostic-messages.js +1 -1
- package/dist/application-spec/generate-application/code/domain-runtime-files.d.ts +3 -3
- package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
- package/dist/application-spec/generate-application/code/standalone-app-files.d.ts +0 -12
- package/dist/application-spec/generate-application/code/standalone-app-files.js +1 -1
- package/dist/application-spec/generate-application/code/templates/admin-config.d.ts +5 -1
- package/dist/application-spec/generate-application/code/templates/admin-config.js +4 -4
- package/dist/application-spec/generate-application/code/templates/application-types.js +5 -5
- package/dist/application-spec/generate-application/code/templates/configurator-config.js +6 -6
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.js +19 -0
- package/dist/application-spec/generate-application/code/templates/domain-spec.js +12 -12
- package/dist/application-spec/generate-application/code/templates/frontend-config.js +7 -3
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-action-types.d.ts +3 -3
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-action-types.js +3 -3
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-assistant-form-element-types.d.ts +10 -6
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-assistant-form-element-types.js +7 -7
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.js +12 -12
- package/dist/application-spec/generate-application/code/templates/globals.js +21 -12
- package/dist/application-spec/generate-application/code/templates/index.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/sign-in-page-options.d.ts +5 -0
- package/dist/application-spec/generate-application/code/templates/sign-in-page-options.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/core/cli.d.ts +2 -1
- package/dist/application-spec/generate-application/code/templates/skills/core/cli.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/core/sdk.js +2 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/application-states/presets.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/application-states/views-and-tools.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/index.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/index.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/{custom-layout/assistant.d.ts → assistant/panel.d.ts} +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/panel.js +42 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/reading-and-changing.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/reading-and-changing.js +55 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/{webhooks/assistant-setup.d.ts → assistant/session-setup.d.ts} +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/session-setup.js +16 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/custom-layout.js +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/sign-in.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/sign-in.js +19 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/domain-model/actions.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/embedding.d.ts +2 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/embedding.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/features.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/authentication.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/authentication.js +32 -26
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/entry-and-environment.js +1 -3
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/publishing.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/session-fields.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/session-fields.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/webhooks.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/guide.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill-bundle.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill-bundle.js +3 -3
- package/dist/application-spec/generate-application/code/templates/skills/processes/asset-conversion.js +3 -3
- package/dist/application-spec/generate-application/code/templates/skills/processes/assistant-configuration.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/processes/assistant-configuration.js +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/processes/feedback/report.js +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/processes/first-draft/handoff.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/index.d.ts +2 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/model-migration.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/review/appearance.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/review/code.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/scene-realism.d.ts +2 -0
- package/dist/application-spec/generate-application/code/templates/skills/processes/scene-realism.js +29 -0
- package/dist/application-spec/generate-application/code/templates/skills/sdk-channel.d.ts +17 -0
- package/dist/application-spec/generate-application/code/templates/skills/sdk-channel.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/sdk-subpath-imports.js +1 -1
- package/dist/application-spec/generate-application/code/templates/webhook-builders.js +3 -2
- package/dist/application-spec/generate-application/code/templates/webhook-index.d.ts +1 -2
- package/dist/application-spec/generate-application/code/templates/webhook-index.js +3 -7
- package/dist/application-spec/generate-application/code/webhook-safe-files.d.ts +3 -1
- package/dist/application-spec/generate-application/code/webhook-safe-files.js +1 -1
- package/dist/application-spec/parse-application-files/access/access-handler-kinds.d.ts +18 -0
- package/dist/application-spec/parse-application-files/access/access-handler-kinds.js +1 -0
- package/dist/application-spec/parse-application-files/access/analyzed-file.d.ts +7 -0
- package/dist/application-spec/parse-application-files/access/analyzed-file.js +1 -0
- package/dist/application-spec/parse-application-files/access/check-access-handler-files.d.ts +20 -0
- package/dist/application-spec/parse-application-files/access/check-access-handler-files.js +1 -0
- package/dist/application-spec/parse-application-files/access/check-auth-hook-files.d.ts +17 -0
- package/dist/application-spec/parse-application-files/access/check-auth-hook-files.js +1 -0
- package/dist/application-spec/parse-application-files/access/index.d.ts +5 -0
- package/dist/application-spec/parse-application-files/access/index.js +1 -0
- package/dist/application-spec/parse-application-files/access/sign-in-control.d.ts +7 -0
- package/dist/application-spec/parse-application-files/access/sign-in-control.js +1 -0
- package/dist/application-spec/parse-application-files/categorize/categorize-files.d.ts +2 -1
- package/dist/application-spec/parse-application-files/categorize/categorize-files.js +1 -1
- package/dist/application-spec/parse-application-files/categorize/module-analysis.d.ts +30 -4
- package/dist/application-spec/parse-application-files/categorize/module-analysis.js +1 -1
- package/dist/application-spec/parse-application-files/categorize/webhook-safety.js +1 -1
- package/dist/application-spec/parse-application-files/merge/merged-app-metadata.d.ts +16 -1
- package/dist/application-spec/parse-application-files/merge/merged-app-metadata.js +1 -1
- package/dist/application-spec/parse-application-files/merge/merged-assistant.js +1 -1
- package/dist/application-spec/parse-application-files/merge/merged-spec.d.ts +7 -1
- package/dist/application-spec/parse-application-files/merge/merged-spec.js +1 -1
- package/dist/application-spec/parse-application-files/parse-application-files.js +1 -1
- package/dist/application-spec/parse-application-files/parse-common-admin-spec.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-actions.d.ts +3 -2
- package/dist/application-spec/parse-application-files/raw-spec/raw-actions.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +29 -6
- package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-components.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.d.ts +11 -3
- package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.js +1 -1
- package/dist/application-spec/parse-application-files/resolve/resolve-import-modules.js +1 -1
- package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.d.ts +6 -0
- package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/index.d.ts +2 -1
- package/dist/application-spec/parse-application-files/spec/model/index.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/session-data-schema.d.ts +5 -2
- package/dist/application-spec/parse-application-files/spec/model/session-data-schema.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/session-fields/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/spec/model/session-fields/index.js +1 -0
- package/dist/application-spec/parse-application-files/spec/model/session-fields/session-fields.d.ts +15 -0
- package/dist/application-spec/parse-application-files/spec/model/session-fields/session-fields.js +1 -0
- package/dist/application-spec/parse-application-files/spec/relations/relations.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/actions.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/app-metadata.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-form-elements.d.ts +14 -2
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-form-elements.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.d.ts +6 -9
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/index.d.ts +0 -1
- package/dist/client/authenticated-client.d.ts +5 -1
- package/dist/client/authenticated-client.js +1 -1
- package/dist/client/authorized-client.d.ts +3 -1
- package/dist/client/authorized-client.js +1 -1
- package/dist/client/base-client.d.ts +15 -1
- package/dist/client/base-client.js +1 -1
- package/dist/client/cli-client/cli-api-client.d.ts +17 -0
- package/dist/client/cli-client/cli-api-client.js +1 -0
- package/dist/client/cli-client/index.d.ts +2 -0
- package/dist/client/cli-client/index.js +1 -0
- package/dist/client/cli-client/unsupported-api-version-error.d.ts +11 -0
- package/dist/client/cli-client/unsupported-api-version-error.js +1 -0
- package/dist/client/contract.d.ts +39 -4
- package/dist/client/contract.js +1 -1
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.js +1 -1
- package/dist/client/phoenix-api.d.ts +7834 -2378
- package/dist/client/unauthenticated-client.d.ts +2 -1
- package/dist/client/unauthenticated-client.js +1 -1
- package/dist/client/version.d.ts +11 -0
- package/dist/client/version.js +1 -1
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/action-system/action.d.ts +16 -4
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +25 -10
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +15 -5
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/index.d.ts +1 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/index.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/register-webmcp-tools.d.ts +7 -3
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/register-webmcp-tools.js +6 -2
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/share-link.d.ts +14 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/share-link.js +2 -0
- package/dist/configurator/application-runtime/extensions/systems/camera-control-system/camera-control-system.d.ts +41 -35
- package/dist/configurator/application-runtime/extensions/systems/camera-control-system/camera-control-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/export-system/export-system.d.ts +4 -2
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +9 -3
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/read-offered-navigation.d.ts +6 -3
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/read-offered-navigation.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/export-image-capture.d.ts +15 -4
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/export-image-capture.js +3 -3
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/image-rendering-system.d.ts +15 -7
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/image-rendering-system.js +1 -1
- package/dist/configurator/common/configurator-interface.d.ts +13 -1
- package/dist/configurator/common/configurator-interface.js +1 -1
- package/dist/configurator/scene/animations/Animations.js +1 -1
- package/dist/configurator/scene/cameras/CameraPadding.d.ts +5 -0
- package/dist/configurator/scene/cameras/CameraPadding.js +1 -1
- package/dist/configurator/scene/resources/use-phx-gltf.js +1 -1
- package/dist/configurator/scene/scene-entity/materials/LocalCreatedMaterial.js +1 -1
- package/dist/configurator/scene/scene-entity/materials/RemoteReplacedMaterial.d.ts +5 -0
- package/dist/configurator/scene/scene-entity/materials/RemoteReplacedMaterial.js +1 -1
- package/dist/configurator/scene/scene-entity/materials/use-dispose-replaced.d.ts +27 -0
- package/dist/configurator/scene/scene-entity/materials/use-dispose-replaced.js +1 -0
- package/dist/configurator/toolbar-actions/use-toolbar-actions.js +1 -1
- package/dist/configurator/ui/assistant/AssistantComposer.js +1 -1
- package/dist/configurator/ui/assistant/AssistantPanel.js +1 -1
- package/dist/configurator/ui/assistant/annotation/editor/AnnotationComment.d.ts +6 -5
- package/dist/configurator/ui/assistant/annotation/editor/AnnotationComment.js +1 -1
- package/dist/configurator/ui/assistant/annotation/editor/AnnotationEditor.d.ts +4 -3
- package/dist/configurator/ui/assistant/annotation/editor/AnnotationEditor.js +1 -1
- package/dist/configurator/ui/assistant/annotation/editor/annotation-pins.d.ts +5 -0
- package/dist/configurator/ui/assistant/annotation/editor/annotation-pins.js +1 -1
- package/dist/configurator/ui/assistant/disclaimer/AssistantDisclaimerDialog.d.ts +10 -0
- package/dist/configurator/ui/assistant/disclaimer/AssistantDisclaimerDialog.js +1 -0
- package/dist/configurator/ui/assistant/disclaimer/AssistantDisclaimerLine.d.ts +10 -0
- package/dist/configurator/ui/assistant/disclaimer/AssistantDisclaimerLine.js +1 -0
- package/dist/configurator/ui/assistant/disclaimer/index.d.ts +2 -0
- package/dist/configurator/ui/assistant/disclaimer/index.js +1 -0
- package/dist/configurator/ui/assistant/drawing/AssistantDrawing.d.ts +2 -3
- package/dist/configurator/ui/assistant/drawing/AssistantDrawing.js +1 -1
- package/dist/configurator/ui/assistant/drawing/index.d.ts +1 -1
- package/dist/configurator/ui/assistant/drawing/index.js +1 -1
- package/dist/configurator/ui/assistant/drawing/use-drawing-url.d.ts +6 -12
- package/dist/configurator/ui/assistant/drawing/use-drawing-url.js +1 -1
- package/dist/configurator/ui/assistant/form/registry/create-assistant-form-element.d.ts +11 -7
- package/dist/configurator/ui/assistant/form-elements/FormTile.js +1 -1
- package/dist/configurator/ui/assistant/image-view/ImageView.js +1 -1
- package/dist/configurator/ui/assistant/panel/AssistantPanelHeader.js +1 -1
- package/dist/configurator/ui/assistant/use-assistant-composer.d.ts +5 -0
- package/dist/configurator/ui/assistant/use-assistant-composer.js +2 -2
- package/dist/configurator/ui/configurator-layout/index.d.ts +1 -1
- package/dist/configurator/ui/configurator-layout/index.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/desktop-sidebar/DesktopSidebar.js +4 -4
- package/dist/configurator/ui/configurator-layout/slots/index.d.ts +2 -0
- package/dist/configurator/ui/configurator-layout/slots/index.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/view-controls/DesktopViewControls.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/view-controls/MobileViewControls.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/view-controls/NestedViewControls.d.ts +7 -0
- package/dist/configurator/ui/configurator-layout/slots/view-controls/NestedViewControls.js +1 -0
- package/dist/configurator/ui/configurator-layout/slots/view-controls/use-view-control-items.d.ts +6 -0
- package/dist/configurator/ui/configurator-layout/slots/view-controls/use-view-control-items.js +1 -0
- package/dist/configurator/ui/configurator-layout/universal/DesktopPreview.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/MobileLayout.js +3 -3
- package/dist/configurator/ui/configurator-layout/universal/MobilePreview.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-preview-description.d.ts +1 -0
- package/dist/configurator/ui/configurator-layout/universal/use-preview-description.js +1 -0
- package/dist/configurator/ui/index.d.ts +1 -1
- package/dist/configurator/ui/legacy/layout/common/ViewControls.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/AssistantToolbarButton.js +1 -1
- package/dist/docs/index.json +117 -2
- package/dist/docs/layouts/nested-view-controls.mdx +223 -0
- package/dist/docs/layouts/preview/always.mdx +22 -0
- package/dist/docs/layouts/view-controls.mdx +2 -0
- package/dist/docs/other-features/domain-actions.mdx +53 -56
- package/dist/docs/phoenix/admin.mdx +5 -40
- package/dist/docs/phoenix/application-states.mdx +1 -1
- package/dist/docs/phoenix/assistant/actions.mdx +183 -0
- package/dist/docs/phoenix/assistant/changing-the-configuration.mdx +333 -0
- package/dist/docs/phoenix/assistant/instructions-and-ai-settings.mdx +221 -0
- package/dist/docs/phoenix/assistant/overview.mdx +137 -0
- package/dist/docs/phoenix/assistant/per-session-setup.mdx +166 -0
- package/dist/docs/phoenix/assistant/reading-the-configuration.mdx +349 -0
- package/dist/docs/phoenix/assistant/screenshots.mdx +135 -0
- package/dist/docs/phoenix/assistant/security-and-limits.mdx +151 -0
- package/dist/docs/phoenix/assistant/the-panel.mdx +298 -0
- package/dist/docs/phoenix/clerk-sign-in.mdx +9 -5
- package/dist/docs/phoenix/configurator-interface.mdx +18 -33
- package/dist/docs/phoenix/csp.mdx +3 -1
- package/dist/docs/phoenix/data-sources.mdx +26 -30
- package/dist/docs/phoenix/deployments.mdx +3 -3
- package/dist/docs/phoenix/finalization.mdx +0 -1
- package/dist/docs/phoenix/integration/authentication-external.mdx +17 -15
- package/dist/docs/phoenix/integration/authentication-internal.mdx +1 -1
- package/dist/docs/phoenix/integration/finalization-internal.mdx +1 -4
- package/dist/docs/phoenix/integration/integration-modes-external.mdx +2 -2
- package/dist/docs/phoenix/integration/integration-modes-internal.mdx +9 -0
- package/dist/docs/phoenix/layout-slots.mdx +1 -1
- package/dist/docs/phoenix/migrations.mdx +1 -1
- package/dist/docs/phoenix/phoenix-cli.mdx +90 -57
- package/dist/docs/phoenix/project-structure.mdx +30 -15
- package/dist/docs/phoenix/publishing.mdx +21 -28
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +51 -34
- package/dist/docs/phoenix/sessions-and-access.mdx +171 -164
- package/dist/docs/phoenix/webhook-membership.mdx +4 -1
- package/dist/docs/phoenix/webhooks.mdx +93 -116
- package/dist/docs/ux-guidelines/interaction-modes.mdx +2 -2
- package/dist/domain/application/access/access-handlers.d.ts +19 -0
- package/dist/domain/application/access/access-handlers.js +1 -0
- package/dist/domain/application/access/anonymous-handler.d.ts +16 -0
- package/dist/domain/application/access/anonymous-handler.js +1 -0
- package/dist/domain/application/access/chunk-scopes-handler.d.ts +27 -0
- package/dist/domain/application/access/chunk-scopes-handler.js +1 -0
- package/dist/domain/application/access/code-handler.d.ts +16 -0
- package/dist/domain/application/access/code-handler.js +1 -0
- package/dist/domain/application/access/index.d.ts +7 -0
- package/dist/domain/application/access/index.js +1 -0
- package/dist/domain/application/access/refresh-handler.d.ts +16 -0
- package/dist/domain/application/access/refresh-handler.js +1 -0
- package/dist/domain/application/access/signed-in-handler.d.ts +44 -0
- package/dist/domain/application/access/signed-in-handler.js +1 -0
- package/dist/domain/application/access/visitor-handler.d.ts +23 -0
- package/dist/domain/application/access/visitor-handler.js +1 -0
- package/dist/domain/application/application-config.d.ts +36 -1
- package/dist/domain/application/assistant/assistant-exposure.d.ts +22 -0
- package/dist/domain/application/assistant/assistant-exposure.js +1 -0
- package/dist/domain/application/assistant/build-assistant-lenses.js +3 -3
- package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
- package/dist/domain/application/assistant/generate-assistant-prompt.d.ts +6 -2
- package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
- package/dist/domain/application/assistant/index.d.ts +1 -0
- package/dist/domain/application/assistant/index.js +1 -1
- package/dist/domain/application/assistant/session-setup/apply-assistant-setup.js +1 -1
- package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.d.ts +14 -2
- package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.js +1 -1
- package/dist/domain/application/assistant/session-setup/assistant-takes-images.d.ts +7 -0
- package/dist/domain/application/assistant/session-setup/assistant-takes-images.js +1 -0
- package/dist/domain/application/assistant/session-setup/index.d.ts +1 -0
- package/dist/domain/application/assistant/session-setup/index.js +1 -1
- package/dist/domain/application/assistant-mutations.js +1 -1
- package/dist/domain/application/assistant-recipe-groups.d.ts +4 -3
- package/dist/domain/application/assistant-recipe-groups.js +1 -1
- package/dist/domain/application/configurator-builder.d.ts +2 -0
- package/dist/domain/application/configurator-builder.js +1 -1
- package/dist/domain/application/index.d.ts +2 -1
- package/dist/domain/application/index.js +1 -1
- package/dist/domain/application/standard-properties.d.ts +1 -1
- package/dist/domain/application/standard-properties.js +1 -1
- package/dist/domain/available-system-components/available-system-components.js +1 -1
- package/dist/domain/core/component/system-component-filter.d.ts +1 -0
- package/dist/domain/core/component/system-component-filter.js +1 -1
- package/dist/domain/core/component/view-state-component.d.ts +4 -3
- package/dist/domain/core/component/view-state-component.js +1 -1
- package/dist/domain/core/domain-factory.d.ts +6 -0
- package/dist/domain/core/domain-factory.js +1 -1
- package/dist/domain/core/fit-session-data.d.ts +16 -0
- package/dist/domain/core/fit-session-data.js +1 -0
- package/dist/domain/domain-context/navigation-system/navigation-system.d.ts +2 -2
- package/dist/domain/domain-context/navigation-system/navigation-system.js +1 -1
- package/dist/domain/domain-context/transformers/when-builder.js +1 -1
- package/dist/domain/domain-runtime/domain-context/actions.d.ts +4 -0
- package/dist/domain/domain-runtime/domain-context/actions.js +1 -1
- package/dist/domain/domain-runtime/domain-context/domain-context.d.ts +8 -0
- package/dist/domain/domain-runtime/domain-context/domain-context.js +1 -1
- package/dist/domain/domain-runtime/domain-context/selectors.d.ts +1 -0
- package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
- package/dist/domain/domain-runtime/domain-context/types.d.ts +8 -4
- package/dist/domain/domain-runtime/domain-runtime.d.ts +8 -0
- package/dist/domain/extensions/export-images/agent-screenshot.d.ts +5 -4
- package/dist/domain/extensions/export-images/agent-screenshot.js +1 -1
- package/dist/domain/extensions/index.d.ts +0 -1
- package/dist/domain/extensions/index.js +1 -1
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +4 -0
- package/dist/domain/spec/sections/actions.d.ts +3 -2
- package/dist/domain/spec/sections/app-metadata.d.ts +12 -0
- package/dist/domain/spec/sections/assistant/assistant-features.d.ts +13 -0
- package/dist/domain/spec/sections/assistant/assistant-features.js +1 -0
- package/dist/domain/spec/sections/assistant/assistant-manifest.d.ts +17 -6
- package/dist/domain/spec/sections/assistant/assistant-resolved-manifest.d.ts +28 -5
- package/dist/domain/spec/sections/assistant/index.d.ts +1 -0
- package/dist/domain/system-components/index.d.ts +1 -0
- package/dist/domain/system-components/index.js +1 -1
- package/dist/domain/system-components/navigation/index.d.ts +1 -0
- package/dist/domain/system-components/navigation/index.js +1 -0
- package/dist/domain/system-components/navigation/view-controls.d.ts +24 -0
- package/dist/domain/system-components/navigation/view-controls.js +1 -0
- package/dist/editor/domain-editors/use-implementation-files.js +1 -1
- package/dist/extras/clerk/index.d.ts +6 -0
- package/dist/extras/cognito/AccountAvatar.d.ts +7 -0
- package/dist/extras/cognito/AccountAvatar.js +1 -0
- package/dist/extras/cognito/AccountControl.d.ts +14 -0
- package/dist/extras/cognito/AccountControl.js +1 -0
- package/dist/extras/cognito/AdminSignInPage.d.ts +26 -0
- package/dist/extras/cognito/AdminSignInPage.js +1 -0
- package/dist/extras/cognito/CognitoSignInPage.d.ts +8 -2
- package/dist/extras/cognito/CognitoSignInPage.js +1 -1
- package/dist/extras/cognito/ConfiguratorSignInPage.d.ts +19 -0
- package/dist/extras/cognito/ConfiguratorSignInPage.js +1 -0
- package/dist/extras/cognito/SignInFailurePage.d.ts +11 -0
- package/dist/extras/cognito/SignInFailurePage.js +1 -0
- package/dist/extras/cognito/SignInGateLayout.d.ts +25 -0
- package/dist/extras/cognito/SignInGateLayout.js +1 -0
- package/dist/extras/cognito/SignInNotice.d.ts +9 -0
- package/dist/extras/cognito/SignInNotice.js +1 -0
- package/dist/extras/cognito/index.d.ts +4 -0
- package/dist/extras/cognito/index.js +1 -1
- package/dist/globals/index.d.ts +5 -0
- package/dist/i18n/locales/cs/messages.js +1 -1
- package/dist/i18n/locales/da/messages.js +1 -1
- package/dist/i18n/locales/de/messages.js +1 -1
- package/dist/i18n/locales/de-AT/messages.js +1 -1
- package/dist/i18n/locales/en/messages.js +1 -1
- package/dist/i18n/locales/en-AU/messages.js +1 -1
- package/dist/i18n/locales/en-GB/messages.js +1 -1
- package/dist/i18n/locales/es/messages.js +1 -1
- package/dist/i18n/locales/fr/messages.js +1 -1
- package/dist/i18n/locales/hu/messages.js +1 -1
- package/dist/i18n/locales/it/messages.js +1 -1
- package/dist/i18n/locales/nl/messages.js +1 -1
- package/dist/i18n/locales/pl/messages.js +1 -1
- package/dist/i18n/locales/pt/messages.js +1 -1
- package/dist/i18n/locales/ro/messages.js +1 -1
- package/dist/i18n/locales/sk/messages.js +1 -1
- package/dist/i18n/locales/tr/messages.js +1 -1
- package/dist/legacy/deployment-cli/commands/create-environment.js +1 -1
- package/dist/legacy/deployment-cli/commands/list-environments.js +1 -1
- package/dist/legacy/deployment-cli/commands/register-deployment.js +1 -1
- package/dist/legacy/domain-spec/__generated/domain-schema.d.ts +12 -3
- package/dist/legacy/phoenix-cli/commands/prepare-deployment-command.js +1 -1
- package/dist/legacy/phoenix-cli/commands/prepare-local-environment-command.js +1 -1
- package/dist/legacy/phoenix-cli/services/prepare-development-environment.js +1 -1
- package/dist/legacy/phoenix-cli/services/webhook-service/transport.js +1 -1
- package/dist/phoenix/application-spec/index.d.ts +1 -1
- package/dist/phoenix/application-spec/index.js +1 -1
- package/dist/phoenix/application-spec/resolve-deployment-data.d.ts +10 -3
- package/dist/phoenix/application-spec/resolve-deployment-data.js +2 -2
- package/dist/phoenix/cli.js +1 -1
- package/dist/phoenix/commands/account/whoami.d.ts +8 -2
- package/dist/phoenix/commands/account/whoami.js +4 -3
- package/dist/phoenix/commands/cleanup-environment.js +1 -1
- package/dist/phoenix/commands/deploy.d.ts +7 -2
- package/dist/phoenix/commands/deploy.js +9 -3
- package/dist/phoenix/commands/deployment-build-envs-command.js +1 -1
- package/dist/phoenix/commands/deps/deps.js +2 -2
- package/dist/phoenix/commands/feedback.d.ts +2 -2
- package/dist/phoenix/commands/feedback.js +1 -1
- package/dist/phoenix/commands/finish-deployment-command.js +1 -1
- package/dist/phoenix/commands/init-starter-spec.js +3 -4
- package/dist/phoenix/commands/init.d.ts +2 -2
- package/dist/phoenix/commands/init.js +1 -1
- package/dist/phoenix/commands/login.d.ts +1 -1
- package/dist/phoenix/commands/login.js +2 -2
- package/dist/phoenix/commands/logout.js +1 -1
- package/dist/phoenix/commands/prepare-deployment-command.js +2 -2
- package/dist/phoenix/commands/prepare-local-environment-command.js +1 -1
- package/dist/phoenix/services/cli-credentials.d.ts +13 -2
- package/dist/phoenix/services/cli-credentials.js +2 -2
- package/dist/phoenix/services/cli-server/describe-saved-logins.d.ts +5 -0
- package/dist/phoenix/services/cli-server/describe-saved-logins.js +1 -0
- package/dist/phoenix/services/cli-server/index.d.ts +2 -0
- package/dist/phoenix/services/cli-server/index.js +1 -0
- package/dist/phoenix/services/cli-server/resolve-cli-server-url.d.ts +25 -0
- package/dist/phoenix/services/cli-server/resolve-cli-server-url.js +1 -0
- package/dist/phoenix/services/development-credential.js +1 -1
- package/dist/phoenix/services/frontend-config.d.ts +2 -0
- package/dist/phoenix/services/index.d.ts +4 -2
- package/dist/phoenix/services/index.js +1 -1
- package/dist/phoenix/services/phoenix-regions.d.ts +15 -5
- package/dist/phoenix/services/phoenix-regions.js +1 -1
- package/dist/phoenix/services/prepare-development-environment.js +2 -2
- package/dist/phoenix/services/session/phoenix-application.js +1 -1
- package/dist/phoenix/services/signed-in-development-environment.d.ts +15 -4
- package/dist/phoenix/services/signed-in-development-environment.js +1 -1
- package/dist/phoenix/services/spec-project/describe-workspace-projects.d.ts +11 -0
- package/dist/phoenix/services/spec-project/describe-workspace-projects.js +1 -0
- package/dist/phoenix/services/spec-project/index.d.ts +3 -0
- package/dist/phoenix/services/spec-project/index.js +1 -0
- package/dist/phoenix/services/spec-project/resolve-deploy-target.d.ts +47 -0
- package/dist/phoenix/services/spec-project/resolve-deploy-target.js +1 -0
- package/dist/phoenix/services/spec-project/resolve-target-project.d.ts +34 -0
- package/dist/phoenix/services/spec-project/resolve-target-project.js +2 -0
- package/dist/phoenix/services/spec-project/write-spec-project.d.ts +7 -0
- package/dist/phoenix/services/spec-project/write-spec-project.js +1 -0
- package/dist/phoenix/services/variant-file-session.js +1 -1
- package/dist/phoenix/services/vite-config.js +1 -1
- package/dist/phoenix/services/webhook-service/transport.js +1 -1
- package/dist/react-sdk/application-runtime/common-services/selectors.js +1 -1
- package/dist/react-sdk/application-runtime/domain-application-context/configuration-persist-system.d.ts +6 -0
- package/dist/react-sdk/application-runtime/domain-application-context/configuration-persist-system.js +1 -1
- package/dist/react-sdk/application-runtime/host-properties/selectors.d.ts +2 -2
- package/dist/react-sdk/application-runtime/integration/integration-mode.d.ts +30 -0
- package/dist/react-sdk/application-runtime/integration/integration-mode.js +1 -1
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +20 -6
- package/dist/react-sdk/application-runtime/session/actions.d.ts +2 -1
- package/dist/react-sdk/application-runtime/session/actions.js +1 -1
- package/dist/react-sdk/application-runtime/session/initialize.js +1 -1
- package/dist/react-sdk/application-runtime/session/selectors.d.ts +2 -0
- package/dist/react-sdk/application-runtime/session/selectors.js +1 -1
- package/dist/react-sdk/application-runtime/session/session-service.d.ts +64 -2
- package/dist/react-sdk/application-runtime/session/session-service.js +1 -1
- package/dist/react-sdk/application-runtime/session/session-token.d.ts +8 -0
- package/dist/react-sdk/application-runtime/session/session-token.js +1 -1
- package/dist/react-sdk/application-runtime/session/types.d.ts +6 -1
- package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +1 -0
- package/dist/react-sdk/domain-context/index.d.ts +3 -2
- package/dist/react-sdk/domain-context/index.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link-hooks.d.ts +1 -5
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link.d.ts +25 -0
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link.js +1 -0
- package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.d.ts +5 -3
- package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
- package/dist/react-sdk/preset-selection/PresetSelectionProvider.js +1 -1
- package/dist/react-sdk/session/AccessDeniedAdminPage.d.ts +13 -0
- package/dist/react-sdk/session/AccessDeniedAdminPage.js +1 -0
- package/dist/react-sdk/session/AccessDeniedPage.d.ts +20 -0
- package/dist/react-sdk/session/AccessDeniedPage.js +1 -0
- package/dist/react-sdk/session/ConfiguratorUnavailablePage.d.ts +5 -0
- package/dist/react-sdk/session/ConfiguratorUnavailablePage.js +1 -0
- package/dist/react-sdk/session/SessionServiceProvider.d.ts +5 -0
- package/dist/react-sdk/session/SessionServiceProvider.js +1 -1
- package/dist/react-sdk/session/index.d.ts +3 -0
- package/dist/react-sdk/session/index.js +1 -1
- package/dist/react-sdk/session/server-sign-in-support.d.ts +16 -0
- package/dist/react-sdk/session/server-sign-in-support.js +1 -0
- package/dist/react-sdk/session/sign-in-address.d.ts +18 -0
- package/dist/react-sdk/session/sign-in-address.js +1 -0
- package/dist/react-sdk/session/studio-frame.d.ts +14 -0
- package/dist/react-sdk/session/studio-frame.js +1 -0
- package/dist/react-sdk/session/use-sign-in.d.ts +51 -0
- package/dist/react-sdk/session/use-sign-in.js +1 -0
- package/dist/ui-sdk/components/preview/Preview.d.ts +12 -4
- package/dist/ui-sdk/components/preview/Preview.js +2 -2
- package/dist/ui-sdk/components/snackbar/Snackbar.d.ts +3 -2
- package/dist/ui-sdk/components/snackbar/Snackbar.js +1 -1
- package/dist/ui-sdk/components/toolbar/desktop-toolbar/ToolbarPopper.d.ts +2 -0
- package/dist/ui-sdk/components/toolbar/desktop-toolbar/ToolbarPopper.js +1 -1
- package/dist/ui-sdk/components/view-controls/ViewControlsContext.d.ts +3 -1
- package/dist/ui-sdk/components/view-controls/ViewControlsItem.js +1 -1
- package/dist/ui-sdk/components/view-controls/ViewControlsRoot.d.ts +6 -1
- package/dist/ui-sdk/components/view-controls/ViewControlsRoot.js +1 -1
- package/dist/webhook/builders/auth-handler-builder.d.ts +21 -1
- package/dist/webhook/builders/auth-handler-builder.js +1 -1
- package/dist/webhook/builders/common.d.ts +9 -0
- package/dist/webhook/builders/webhook-builder.d.ts +18 -0
- package/dist/webhook/builders/webhook-builder.js +1 -1
- package/package.json +5 -4
- package/schema/domain-spec.json +224 -65
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/assistant.js +0 -43
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/assistant-setup.js +0 -32
- package/dist/application-spec/generate-application/code/templates/skills/processes/beta.d.ts +0 -14
- package/dist/application-spec/generate-application/code/templates/skills/processes/beta.js +0 -4
- package/dist/domain/extensions/view-controls.d.ts +0 -25
- package/dist/domain/extensions/view-controls.js +0 -1
package/dist/configurator/application-runtime/extensions/systems/export-system/export-system.d.ts
CHANGED
|
@@ -54,9 +54,11 @@ export declare class ExportSystem<ENTITIES extends DomainEntity<string>, ALLOWED
|
|
|
54
54
|
readonly exporting$: ObservableWithLastValue<boolean>;
|
|
55
55
|
private readonly _frameloopPaused;
|
|
56
56
|
/**
|
|
57
|
-
* True while `pauseFrameloop` is held. The canvas passes `frameloop: 'never'` to R3F meanwhile: R3F
|
|
57
|
+
* True while `pauseFrameloop` is held. The built-in canvas passes `frameloop: 'never'` to R3F meanwhile: R3F
|
|
58
58
|
* applies its `frameloop` prop again on every render of the canvas, such as on a resize, which would
|
|
59
|
-
* otherwise resume the loop under the pause.
|
|
59
|
+
* otherwise resume the loop under the pause. Only the built-in canvas follows it: a project layout that
|
|
60
|
+
* renders its own `<Canvas>` keeps rendering through the pause unless it passes `frameloop: 'never'` while this
|
|
61
|
+
* is true.
|
|
60
62
|
*/
|
|
61
63
|
readonly frameloopPaused$: ObservableWithLastValue<boolean>;
|
|
62
64
|
constructor(_context: ExportSystemContext);
|
package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"lodash-es/isEqual.js";import{findAssistantFieldOptions as t,findAssistantRecipeGroups as i,isAssistantSelectable as r,
|
|
1
|
+
import e from"lodash-es/isEqual.js";import{findAssistantFieldOptions as t,findAssistantRecipeGroups as i,isAssistantSelectable as r,isAssistantVisible as n,modifyEntityUpdateTag as a,prepareAssistantRecipeUpdates as o,readAssistantFieldOptions as s,readAssistantRecipeGroup as d,systemUpdateFactory as l}from"#package/domain";import{readSideEffects as c}from"./side-effects.js";import{readEntityWarnings as u,readStateWarnings as p,readViolationEntries as m}from"./violations.js";let y=e=>({ok:!1,root:null,changedEntities:[],deletedEntityIds:[],sideEffects:[],warnings:[],errors:e}),f=(e,{state:t},{manifest:i,recipes:r,prepareStateEmission:a,find$Entity:o,validateState:s,i18n:d})=>{let l=a(e,t,"committed"),{validity:u,state:f,updates:h}=l;if(u.valid){let a=new Map(t.entities.map(e=>[e.id,e])),d=new Set(f.entities.map(e=>e.id)),l=new Set(e.flatMap(e=>{switch(e.kind){case"replaceDomainEntity":return[e.entityId,e.replacementEntity.id];case"createDomainEntity":case"modifyDomainEntity":case"deleteEntity":return[e.entityId];default:return[]}})),m=e=>l.has(e.id)||n(e,i);return{ok:!0,root:o(f.rootEntityId,f),changedEntities:f.entities.filter(e=>a.get(e.id)!==e&&m(e)).flatMap(e=>o(e.id,f)??[]),deletedEntityIds:t.entities.filter(e=>!d.has(e.id)&&m(e)).map(e=>e.id),sideEffects:c(h,r.resolveLocalizable),warnings:()=>p(u,s(t),r.resolveLocalizable),errors:[]}}return y(m({validity:u,stateEmission:l},{i18n:d,resolveLocalizable:r.resolveLocalizable}))};export const createEntityMeta=(n,c)=>{let p=e=>()=>Object.fromEntries(i(c.manifest,e,n.entity.type).map(t=>[t.groupId,()=>{let i=d(e,t,n.entity.id,n.state,c.recipes);return i?((e,t,i)=>{let{group:r,label:n,description:a,recipes:s}=e,{resolveLocalizable:d}=i.recipes;return{groupId:r.groupId,name:void 0===n?r.instanceName:d(n),description:void 0===a?null:d(a),recipes:({keys:r})=>s.filter(e=>!r||r.includes(e.key)).map(r=>((e,t,i,r)=>{let{key:n,item:a}=e,{resolveLocalizable:s}=r.recipes;return{key:n,name:s(a.title),description:void 0===a.description?null:s(a.description),imageUrl:void 0===a.thumbnailUrl?null:s(a.thumbnailUrl),dryRun:()=>t.group.dryRuns?((e,t,i,r)=>{let{updates:n,error:a}=((e,t,{entity:i,state:r},{recipes:n})=>{try{return{updates:o(e,t,i.id,r,n),error:void 0}}catch(e){if("child"===t.target.kind)throw e;return{updates:void 0,error:e instanceof Error?e.message:String(e)}}})(e,t,i,r);return void 0===n?y([{type:"uncaught",entityId:null,message:a}]):f(n,i,r)})(e,t,i,r):null}})(r,e,t,i))}})(i,n,c):null}]));return{...Object.fromEntries(t(c.manifest,n.entity.type).map(t=>[t.edgeName,({values:i})=>s(t,n.entity.id,n.state,c.recipes)?.filter(t=>!i||i.some(i=>e(i,t.value))).map(e=>({...e,dryRun:()=>t.dryRuns?(({field:e},{value:t},i,r)=>{let{entity:n}=i,o=Object.entries(Object.entries(r.manifest.writableFields??{}).find(([e])=>e===n.type)?.[1]??{}).find(([t])=>t===e)?.[1];if(void 0===o)throw Error(`The options of "${e}" on "${n.id}" cannot be dry-run: the schema lists them, but the configurator has no writable field "${e}" on ${n.type}. This is a fault in the configurator, not in your request. Tell the user this is not available.`);let s=i.state.entities.find(e=>e.id===n.id);if(!s)throw Error(`The options of "${e}" on "${n.id}" cannot be dry-run: entity "${n.id}" does not exist. It may have been deleted by an earlier operation or field. Query the current entities and use an id they return.`);let d={[o]:t},c=r.validateEntity({...s,...d});return c.success?f([l.DomainEntityModification({entityId:n.id,stateDelta:d,updateTag:a})],i,r):y([{type:"uncaught",entityId:n.id,message:`Writing ${JSON.stringify(t)} to "${e}" would make "${n.id}" an invalid ${n.type}: ${c.errors.join("; ")}. The option comes from the configurator and cannot be corrected from here, so do not write it.`}])})(t,e,n,c):null}))??null])),childRecipes:p("child"),replaceRecipes:p("replace"),screenshot:({view:e})=>c.takeScreenshot(n,e),selectable:()=>r(n.entity,n.state,c,c.manifest.select??[]),warnings:()=>u(n.entity.id,c.validateState(n.state),c.recipes.resolveLocalizable)}};
|
package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts
CHANGED
|
@@ -39,13 +39,18 @@ export interface GraphQLExecutionOptions {
|
|
|
39
39
|
readonly navigationOnly?: {
|
|
40
40
|
readonly message: string;
|
|
41
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Who reads the result: `webmcp` is an outside agent in the user's browser, which sees no `[changes]` blocks, so a
|
|
44
|
+
* held commit tells it to query instead; `panel` when omitted.
|
|
45
|
+
*/
|
|
46
|
+
readonly surface?: 'panel' | 'webmcp';
|
|
42
47
|
}
|
|
43
48
|
export interface GraphQLSystemContext {
|
|
44
49
|
/** The assistant the initialized session runs: the operations are validated and executed against its schema. */
|
|
45
50
|
readonly getAssistantSetup: () => SessionAssistantSetup;
|
|
46
51
|
/**
|
|
47
52
|
* Renders the picture an `agentScreenshot` component of a state declares, behind every export
|
|
48
|
-
* already queued, as a JPEG
|
|
53
|
+
* already queued, as a JPEG blob; `null` from an executor that renders no pictures. One of
|
|
49
54
|
* the two async steps of an execution, and the only one that needs a canvas.
|
|
50
55
|
*/
|
|
51
56
|
readonly renderScreenshot: (component: ComponentSnapshot<AgentScreenshotComponent>, state: AnyDomainState) => Promise<Blob | null>;
|
|
@@ -143,11 +148,12 @@ export declare class GraphQLSystem {
|
|
|
143
148
|
private readonly _recipeContext;
|
|
144
149
|
/** Root field resolvers, called by the executor with the field arguments and the operation context. */
|
|
145
150
|
private readonly _rootValue;
|
|
151
|
+
/** An entity resolves to its own object type, or to `OtherEntity` when the active manifest does not expose its type. */
|
|
146
152
|
private readonly _resolveType;
|
|
147
153
|
private _generation;
|
|
148
154
|
/**
|
|
149
|
-
* The picture of an entity of a state from one `agentScreenshot` view, as a blob
|
|
150
|
-
*
|
|
155
|
+
* The picture of an entity of a state from one `agentScreenshot` view, as a JPEG blob; `null`
|
|
156
|
+
* when the view is not attached to the entity there or nothing renders it.
|
|
151
157
|
*/
|
|
152
158
|
private readonly _renderScreenshot;
|
|
153
159
|
/**
|
package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GraphQLError as e,NoSchemaIntrospectionCustomRule as t,defaultFieldResolver as i,execute as n,getNamedType as o,parse as r,specifiedRules as s,validate as a,validateSchema as l}from"graphql";import{assertExistence as c,createSelector as h,isMessageDescriptor as d,isMultilingualString as f}from"@salsita-ai/common/utils";import{AGENT_SCREENSHOT_MAX_SIDE as m,DomainEntityIdSchema as u,agentScreenshotComponent as p,createAssistantExecutionSchema as g,findAssistantMutation as v,readAssistantNavigation as y}from"#package/domain";import{ExportBusyError as S}from"../export-system/export-busy-error.js";import{closeUnclosedBraces as _}from"./close-unclosed-braces.js";import{createEntityMeta as w}from"./entity-meta.js";import{injectAssistantLenses as x}from"./inject-assistant-lenses.js";import{isOfferedForSelection as E}from"./is-offered-for-selection.js";import{readOfferedNavigation as T}from"./read-offered-navigation.js";import{readSideEffects as b}from"./side-effects.js";import{ViolationsError as $,readStateWarnings as C,readViolationEntries as N}from"./violations.js";let O={errors:[new e("The configurator does not provide this request. This is a fault in the configurator, not in your request. Tell the user this is not available.")]},R={errors:[new e("The configuration is not loaded yet, so there is no state to query. Run the query again once the configurator has finished loading.")]},j="Not taken: another configuration was loaded while this request ran. Query the current configuration before asking for screenshots again.",M=class ScreenshotTooLargeError extends Error{constructor(e,t){super(`The view is configured at ${e} \xd7 ${t} px, more than the ${m} \xd7 ${m} px a screenshot may have.`),this.name="ScreenshotTooLargeError"}},k=new RegExp(u.pattern),A=[...s,t],L=e=>"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"id"in e&&"string"==typeof e.id,z=(e,t)=>"object"==typeof e&&null!==e?Reflect.get(e,t):void 0,F=e=>e instanceof Error?e.message:String(e),q=e=>/[.!?]$/.test(e)?e:`${e}.`,I=e=>"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype,V=(e,t)=>{let i=I(e)?e._raw:void 0;if(L(i))return i;if(!Array.isArray(e)&&!I(e))return e;if(t.has(e))throw Error("The value contains itself.");let n=new Set([...t,e]);return Array.isArray(e)?e.map(e=>V(e,n)):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,V(t,n)]))};export const localize=(e,t)=>Array.isArray(e)?e.map(e=>localize(e,t)):"string"==typeof e||d(e)||f(e)?t(e):e;let P=t=>new e(`The configurator cannot handle this request: ${q(t)} This is a fault in the configurator, not in your request. Tell the user this is not available.`);export const SCREENSHOT_NOT_TAKEN="SCREENSHOT_NOT_TAKEN";let D=(t,i)=>new e(t,{originalError:i,extensions:{code:SCREENSHOT_NOT_TAKEN}}),H=e=>(e.errors??[]).some(e=>e.extensions.code!==SCREENSHOT_NOT_TAKEN),K=t=>({errors:[new e(`Not run: operation ${t+1} failed, so the operations after it were skipped and no change of the list takes effect. Fix the failing operation and send the whole list again.`)]}),Q=e=>Array.isArray(e)?e.map(Q):"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Q(t)])):e;export class GraphQLSystem{_context;_selectSchema=h([h.leaf(e=>e)],e=>{try{let t=g(e),i=l(t);return i.length>0?P(i.map(e=>e.message).join(" ")):t}catch(e){return P(F(e))}});_selectLenses=h([h.leaf(e=>e)],e=>r(e));_selectFieldResolver=h([h.leaf(e=>e)],t=>(n,r,s,a)=>{if(a.parentType===a.schema.getQueryType())return i(n,r,s,a);if(a.parentType===a.schema.getMutationType())return this._resolveMutation(a.fieldName,String(a.path.key),r,s);if(!L(n))return i(n,r,s,a);if("meta"===a.fieldName){let e;return w({entity:n,state:("object"==typeof(e=z(n,"_state"))&&null!==e&&"entities"in e&&"rootEntityId"in e?e:void 0)??s.state},{manifest:s.manifest,recipes:this._recipeContext(),prepareStateEmission:(e,t,i)=>{let n=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(e,t,i);return s.validities.set(n.state,n.validity),n},find$Entity:(e,t)=>this._find$Entity(e,t),validateEntity:e=>this._context.domainContextSelectors.getDomain().validateEntity(e),takeScreenshot:(e,t)=>this._takeScreenshot(e,t,s),isOfferedForSelection:this._isOfferedForSelection,i18n:this._context.domainServicesSelectors.getI18n(),validateState:e=>this._validateCached(e,s)})}let{source:l,localized:c}=t[a.parentType.name]?.[a.fieldName]??{source:a.fieldName},h=((t,i)=>{try{return z(t,i)}catch(n){throw new e(`Expression "${i}" failed on ${L(t)?t.id:"an entity"}: ${q(F(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l);return c?localize(h,this._context.domainServicesSelectors.getResolveLocalizable()):l.startsWith("$")&&"JSON"===o(a.returnType).name?((t,i,n)=>{try{return V(n,new Set)}catch(n){throw new e(`Expression "${i}" returned a value that is not plain serializable data on ${L(t)?t.id:"an entity"}: ${q(F(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l,h):h});constructor(e){this._context=e}_get$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().get$Entity(e,t);_find$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().getEntity(e,t)?this._get$Entity(e,t):null;_validateState=e=>this._context.domainContextSelectors.getValidationProjections().validateState(e);_validateCached=(e,{validities:t})=>{let i=t.get(e);if(i)return i;let n=this._validateState(e);return t.set(e,n),n};_readOfferedNavigation=e=>T(e,{componentReader:this._context.domainContextSelectors.getComponentReader(),navigationSystem:this._context.domainContextSelectors.getNavigationSystem()});_isOfferedForSelection=(e,t)=>E(e,t,{componentReader:this._context.domainContextSelectors.getComponentReader()});_recipeContext=()=>({componentReader:this._context.domainContextSelectors.getComponentReader(),recipeCooker:this._context.domainContextSelectors.getRecipeCookerSystem(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});_rootValue={warnings:(e,t)=>C(this._validateCached(t.state,t),void 0,this._context.domainServicesSelectors.getResolveLocalizable()),root:(e,{state:t})=>this._get$Entity(t.rootEntityId,t),entities:({ids:t},{state:i})=>{if(null==t)return i.entities.map(e=>this._get$Entity(e.id,i));var n=i.rootEntityId;let o=t.filter(e=>!k.test(e));if(o.length>0)throw new e(`${o.map(e=>`"${e}"`).join(", ")} ${1===o.length?"is not an entity id":"are not entity ids"}. Entity ids have the form "<Type>-<number>", e.g. "${n}". Use ids as returned by the "id" field.`);return t.map(e=>k.test(e)?this._find$Entity(e,i):null)},selectedEntity:(e,{state:t})=>this._find$Entity(this._context.domainContextSelectors.getNavigationSystem().getActiveSelectionState(t),t),navigation:(e,{state:t,manifest:i})=>y(t,{navigationSystem:this._context.domainContextSelectors.getNavigationSystem(),readOfferedNavigation:this._readOfferedNavigation},i.navigation??{navigationStates:[],viewStates:[],toolStates:[]})};_resolveType=e=>L(e)?e.type:void 0;_generation={active:!0};_renderScreenshot=async(e,t,i)=>{let n=this._context.domainContextSelectors.getComponentReader().readOneComponent({entityId:e,componentType:p,instanceName:t},i);if(!n)return null;let{width:o,height:r}=n.state;if(o>m||r>m)throw new M(o,r);let s=await this._context.renderScreenshot(n,i);return null===s?null:new Blob([s],{type:"JPEG"===n.state.fileFormat?"image/jpeg":"image/png"})};initialize=()=>{this._generation.active=!1,this._generation={active:!0}};_resolveMutation=(t,i,n,o)=>{if(void 0!==o.failedMutationField)throw new e(`Not run: the earlier field "${o.failedMutationField}" of this operation failed, so "${i}" was skipped and no change of the operation takes effect. Fix the failing field and send the operation again.`);try{return this._runMutation(t,n,o)}catch(e){throw o.failedMutationField=i,e}};_runMutation=(t,i,n)=>{let o=v(t,n.manifest),r=Object.entries(n.manifest.actions??{}).find(([e])=>e===t)?.[1];if(!o&&void 0===r)throw new e(`The schema declares the mutation "${t}", but the configurator has no implementation for it. This is a fault in the configurator, not in your request. Tell the user this is not available.`);if(n.navigationOnly&&!o?.navigation)throw new e(n.navigationOnly.message);let s=n.state,a=o?o.implementation(i,s,{manifest:n.manifest,systems:this._context.domainContextSelectors.getDomainSystems(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable(),readOfferedNavigation:this._readOfferedNavigation,isOfferedForSelection:this._isOfferedForSelection}):this._context.configuratorExtensionSelectors.getActionSystem().prepareAction(r,Q(i),s);if(a.updates.length>0){let i=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(a.updates,s,"committed"),{validity:o}=i;if("uncaught"===o.severity)throw new e(`The changes of "${t}" were not applied, because the resulting configuration is invalid: validating it threw: ${q(F(o.error))} Change the request so the configuration stays valid.`,{originalError:o.error});if(!o.valid)throw new $(`The changes of "${t}" were not applied, because the resulting configuration has ${o.severity} violations.`,N({validity:o,stateEmission:i},{i18n:this._context.domainServicesSelectors.getI18n(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()}));n.emissions.push(i),n.validities.set(i.state,o),n.state=i.state}return a.readResult({previousState:s,state:n.state})};_takeScreenshot=({entity:t,state:i},n,o)=>{let r=o.manifest.screenshots?.[t.type]?.find(e=>e.view===n);if(!r)return Promise.reject(new e(`The schema declares the screenshot view "${n}" on ${t.type}, but the configurator has no view of that name. This is a fault in the configurator, not in your request. Tell the user this is not available.`));let s=o.lastScreenshot.then(async()=>{if(!o.generation.active)throw D(j);let e=await this._renderScreenshot(t.id,r.instanceName,i).catch(e=>{throw D(e instanceof S?"User made concurrent actions that prevented the screenshot from being taken, try again":e instanceof M?`The screenshot of ${t.id} from "${n}" cannot be taken: ${e.message} Tell the user the screenshot is not available.`:`The screenshot of ${t.id} from "${n}" could not be taken: ${q(F(e))} Try again; if it fails again, tell the user the screenshot is not available.`,e instanceof Error?e:void 0)});if(!o.generation.active)throw D(j);if(null===e)return null;let s="inline"===o.screenshotStorage?{image:e}:await this._context.uploadScreenshot(e).catch(e=>{throw D(`The screenshot of ${t.id} from "${n}" was taken but could not be stored: ${q(F(e))} Try again; if it fails again, tell the user the screenshot is not available.`,e instanceof Error?e:void 0)}),a=`${t.id}/${n}`,l=[...o.screenshots.values()].filter(e=>e.entityId===t.id&&e.view===n).length,c=0===l?a:`${a}#${l+1}`;return o.screenshots.set(c,{entityId:t.id,view:n,...s}),{image:c}});return o.lastScreenshot=s.catch(()=>void 0),s};_setup=()=>{let{manifest:t,error:i}=this._context.getAssistantSetup();if(i)return{ready:!1,result:{errors:[new e(i.message,{originalError:i})]}};if(!t)return{ready:!1,result:O};let n=this._selectSchema(t.sdl);return n instanceof e?{ready:!1,result:{errors:[n]}}:{ready:!0,assistant:t,schema:n,lenses:t.lenses?.definitions?this._selectLenses(t.lenses.definitions):void 0,fieldResolver:this._selectFieldResolver(t.fields)}};_run=async(t,i,o,s)=>{var l;let c;try{c=r(t)}catch(t){return{errors:[t instanceof e?t:new e(F(t))]}}let h=a(o.schema,c,A);return h.length>0?{errors:h}:(l=await n({schema:o.schema,document:c,rootValue:this._rootValue,contextValue:s,variableValues:i.variables,operationName:i.operationName,fieldResolver:o.fieldResolver,typeResolver:this._resolveType}),l.errors?.some(e=>e.originalError instanceof $)?{...l,errors:l.errors.flatMap(t=>t.originalError instanceof $?t.originalError.entries.map(({type:i,entityId:n,message:o,details:r})=>new e(o,{nodes:t.nodes,source:t.source,positions:t.positions,path:t.path,extensions:{code:"VIOLATION",type:i,entityId:n,...void 0===r?{}:{details:r}}})):[t])}:l)};prepare=async(t,i,{screenshots:n="upload",navigationOnly:o}={})=>{let r,s=this._generation,a=this._setup();if(!a.ready)return i.map(()=>({result:a.result,emissions:[],screenshots:new Map}));let l={manifest:a.assistant,state:t,emissions:[],failedMutationField:void 0,screenshots:new Map,lastScreenshot:Promise.resolve(),generation:s,screenshotStorage:n,navigationOnly:o,validities:new WeakMap},c=[];for(let[t,n]of i.entries())if(void 0===r){let i=l.emissions.length,o=l.screenshots.size;l.failedMutationField=void 0;let s=_(n.document),h=a.lenses?x(s,a.lenses):s,d=h instanceof e?{errors:[h]}:await this._run(h,n,a,l);await l.lastScreenshot,c.push({result:d,emissions:l.emissions.slice(i),screenshots:new Map([...l.screenshots].slice(o))}),H(d)&&(r=t)}else c.push({result:K(r),emissions:[],screenshots:new Map});return c};readSideEffects=e=>{let t=this._context.domainServicesSelectors.getResolveLocalizable();return e.flatMap(({emissions:e})=>e.flatMap(e=>b(e.updates,t)))};readScreenshots=e=>new Map(e.flatMap(({screenshots:e})=>[...e]));readWarnings=(e,t)=>{let i=t.flatMap(({emissions:e})=>e).at(-1);return void 0===i||t.some(({result:e})=>H(e))?[]:C(i.validity,this._validateState(e),this._context.domainServicesSelectors.getResolveLocalizable())};_prepareAndCommit=async(e,t,i)=>{let n,o,r,s=this._context.domainContextSelectors.getStoreSystem(),a=s.stateSlices.committed.value.state,l=await this.prepare(a,e,i),h=l.map(({result:e})=>e),d=this.readSideEffects(l),f=this.readScreenshots(l),m=l.flatMap(e=>e.emissions);if(!t.active)return{results:h,sideEffects:d,screenshots:f,warnings:[],outcome:"conflict"};if(h.some(H)||0===m.length)return{results:h,sideEffects:d,screenshots:f,warnings:[],outcome:"none"};let u=(n=c(m[0]),o=c(m[m.length-1]),r=m.some(e=>void 0!==e.transformationLog),{kind:"committed",previousState:n.previousState,state:o.state,updates:m.flatMap(e=>e.updates),validity:o.validity,transformationLog:r?m.flatMap(e=>e.transformationLog??[]):void 0});return{results:h,sideEffects:d,screenshots:f,warnings:this.readWarnings(a,l),outcome:s.commitPrepared(u),preparedState:u.state}};execute=async(e,t={})=>{let i=this._generation;if(!this._context.domainContextSelectors.getStoreSystem().isInitialized)return{results:e.map(()=>R),committed:!1,sideEffects:[],warnings:[],screenshots:new Map};let n=await this._prepareAndCommit(e,i,t),{results:o,sideEffects:r,warnings:s,screenshots:a,outcome:l,preparedState:c}="conflict"===n.outcome&&i.active?await this._prepareAndCommit(e,i,t):n;return"committed"===l?{results:o,committed:!0,sideEffects:r,warnings:s,screenshots:a,preparedState:c}:"held"===l?{results:o,committed:!1,message:"The changes wait for the user's approval and are not applied yet. Do not send them again; the next `[changes]` block lists them once approved.",sideEffects:r,warnings:s,screenshots:a,preparedState:c}:"conflict"===l?{results:o,committed:!1,message:"The changes were not committed, because the configuration changed while they were being applied. The results describe a state that was discarded. Query the current configuration and send the operations again if they still make sense.",sideEffects:r,warnings:s,screenshots:a}:{results:o,committed:!1,sideEffects:r,warnings:s,screenshots:a}}}
|
|
1
|
+
import{GraphQLError as e,NoSchemaIntrospectionCustomRule as t,defaultFieldResolver as i,execute as n,getNamedType as o,getNullableType as r,isScalarType as s,parse as a,specifiedRules as l,validate as c,validateSchema as h}from"graphql";import{assertExistence as d,createSelector as f,isMessageDescriptor as m,isMultilingualString as u}from"@salsita-ai/common/utils";import{AGENT_SCREENSHOT_MAX_SIDE as p,ASSISTANT_OTHER_ENTITY as g,DomainEntityIdSchema as v,agentScreenshotComponent as y,createAssistantExecutionSchema as S,findAssistantMutation as _,isAssistantVisible as w,readAssistantNavigation as x}from"#package/domain";import{ExportBusyError as E}from"../export-system/export-busy-error.js";import{closeUnclosedBraces as T}from"./close-unclosed-braces.js";import{createEntityMeta as b}from"./entity-meta.js";import{injectAssistantLenses as $}from"./inject-assistant-lenses.js";import{isOfferedForSelection as C}from"./is-offered-for-selection.js";import{readOfferedNavigation as N}from"./read-offered-navigation.js";import{readSideEffects as O}from"./side-effects.js";import{ViolationsError as R,readStateWarnings as j,readViolationEntries as M}from"./violations.js";let k={errors:[new e("The configurator does not provide this request. This is a fault in the configurator, not in your request. Tell the user this is not available.")]},A={errors:[new e("The configuration is not loaded yet, so there is no state to query. Run the query again once the configurator has finished loading.")]},L="Not taken: another configuration was loaded while this request ran. Query the current configuration before asking for screenshots again.",z=class ScreenshotTooLargeError extends Error{constructor(e,t){super(`The view is configured at ${e} \xd7 ${t} px, more than the ${p} \xd7 ${p} px a screenshot may have.`),this.name="ScreenshotTooLargeError"}},q=new RegExp(v.pattern),F=[...l,t],I=e=>"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"id"in e&&"string"==typeof e.id,V=(e,t)=>"object"==typeof e&&null!==e?Reflect.get(e,t):void 0,D=e=>e instanceof Error?e.message:String(e),P=e=>/[.!?]$/.test(e)?e:`${e}.`,H=e=>"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype,K=(e,t)=>{let i=H(e)?e._raw:void 0;if(I(i))return i;if(!Array.isArray(e)&&!H(e))return e;if(t.has(e))throw Error("The value contains itself.");let n=new Set([...t,e]);return Array.isArray(e)?e.map(e=>K(e,n)):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,K(t,n)]))};export const localize=(e,t)=>Array.isArray(e)?e.map(e=>localize(e,t)):"string"==typeof e||m(e)||u(e)?t(e):e;let Q=t=>new e(`The configurator cannot handle this request: ${P(t)} This is a fault in the configurator, not in your request. Tell the user this is not available.`);export const SCREENSHOT_NOT_TAKEN="SCREENSHOT_NOT_TAKEN";let W=(t,i)=>new e(t,{originalError:i,extensions:{code:SCREENSHOT_NOT_TAKEN}}),B=e=>(e.errors??[]).some(e=>e.extensions.code!==SCREENSHOT_NOT_TAKEN),U=t=>({errors:[new e(`Not run: operation ${t+1} failed, so the operations after it were skipped and no change of the list takes effect. Fix the failing operation and send the whole list again.`)]}),G=e=>Array.isArray(e)?e.map(G):"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,G(t)])):e;export class GraphQLSystem{_context;_selectSchema=f([f.leaf(e=>e)],e=>{try{let t=S(e),i=h(t);return i.length>0?Q(i.map(e=>e.message).join(" ")):t}catch(e){return Q(D(e))}});_selectLenses=f([f.leaf(e=>e)],e=>a(e));_selectFieldResolver=f([f.leaf(e=>e)],t=>(n,r,s,a)=>{if(a.parentType===a.schema.getQueryType())return i(n,r,s,a);if(a.parentType===a.schema.getMutationType())return this._resolveMutation(a.fieldName,String(a.path.key),a.returnType,r,s);if(!I(n))return i(n,r,s,a);if("meta"===a.fieldName){let e;return b({entity:n,state:("object"==typeof(e=V(n,"_state"))&&null!==e&&"entities"in e&&"rootEntityId"in e?e:void 0)??s.state},{manifest:s.manifest,recipes:this._recipeContext(),prepareStateEmission:(e,t,i)=>{let n=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(e,t,i);return s.validities.set(n.state,n.validity),n},find$Entity:(e,t)=>this._find$Entity(e,t),validateEntity:e=>this._context.domainContextSelectors.getDomain().validateEntity(e),takeScreenshot:(e,t)=>this._takeScreenshot(e,t,s),isOfferedForSelection:this._isOfferedForSelection,i18n:this._context.domainServicesSelectors.getI18n(),validateState:e=>this._validateCached(e,s)})}let{source:l,localized:c}=t[a.parentType.name]?.[a.fieldName]??{source:a.fieldName},h=((t,i)=>{try{return V(t,i)}catch(n){throw new e(`Expression "${i}" failed on ${I(t)?t.id:"an entity"}: ${P(D(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l);return c?localize(h,this._context.domainServicesSelectors.getResolveLocalizable()):l.startsWith("$")&&"JSON"===o(a.returnType).name?((t,i,n)=>{try{return K(n,new Set)}catch(n){throw new e(`Expression "${i}" returned a value that is not plain serializable data on ${I(t)?t.id:"an entity"}: ${P(D(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l,h):h});constructor(e){this._context=e}_get$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().get$Entity(e,t);_find$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().getEntity(e,t)?this._get$Entity(e,t):null;_validateState=e=>this._context.domainContextSelectors.getValidationProjections().validateState(e);_validateCached=(e,{validities:t})=>{let i=t.get(e);if(i)return i;let n=this._validateState(e);return t.set(e,n),n};_readOfferedNavigation=e=>N(e,{componentReader:this._context.domainContextSelectors.getComponentReader(),navigationSystem:this._context.domainContextSelectors.getNavigationSystem()});_isOfferedForSelection=(e,t)=>C(e,t,{componentReader:this._context.domainContextSelectors.getComponentReader()});_recipeContext=()=>({componentReader:this._context.domainContextSelectors.getComponentReader(),recipeCooker:this._context.domainContextSelectors.getRecipeCookerSystem(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});_rootValue={warnings:(e,t)=>j(this._validateCached(t.state,t),void 0,this._context.domainServicesSelectors.getResolveLocalizable()),root:(e,{state:t})=>this._get$Entity(t.rootEntityId,t),entities:({ids:t},{state:i})=>{if(null==t)return i.entities.map(e=>this._get$Entity(e.id,i));var n=i.rootEntityId;let o=t.filter(e=>!q.test(e));if(o.length>0)throw new e(`${o.map(e=>`"${e}"`).join(", ")} ${1===o.length?"is not an entity id":"are not entity ids"}. Entity ids have the form "<Type>-<number>", e.g. "${n}". Use ids as returned by the "id" field.`);return t.map(e=>q.test(e)?this._find$Entity(e,i):null)},selectedEntity:(e,{state:t})=>this._find$Entity(this._context.domainContextSelectors.getNavigationSystem().getActiveSelectionState(t),t),navigation:(e,{state:t,manifest:i})=>x(t,{navigationSystem:this._context.domainContextSelectors.getNavigationSystem(),readOfferedNavigation:this._readOfferedNavigation},i.navigation??{navigationStates:[],viewStates:[],toolStates:[]})};_resolveType=(e,{manifest:t})=>{if(I(e))return w(e,t)?e.type:g};_generation={active:!0};_renderScreenshot=async(e,t,i)=>{let n=this._context.domainContextSelectors.getComponentReader().readOneComponent({entityId:e,componentType:y,instanceName:t},i);if(!n)return null;let{width:o,height:r}=n.state;if(o>p||r>p)throw new z(o,r);let s=await this._context.renderScreenshot(n,i);return null===s?null:new Blob([s],{type:"image/jpeg"})};initialize=()=>{this._generation.active=!1,this._generation={active:!0}};_resolveMutation=(t,i,n,o,r)=>{if(void 0!==r.failedMutationField)throw new e(`Not run: the earlier field "${r.failedMutationField}" of this operation failed, so "${i}" was skipped and no change of the operation takes effect. Fix the failing field and send the operation again.`);try{return this._runMutation(t,n,o,r)}catch(e){throw r.failedMutationField=i,e}};_runMutation=(t,i,n,o)=>{let a,l=_(t,o.manifest),c=Object.entries(o.manifest.actions??{}).find(([e])=>e===t)?.[1];if(!l&&void 0===c)throw new e(`The schema declares the mutation "${t}", but the configurator has no implementation for it. This is a fault in the configurator, not in your request. Tell the user this is not available.`);if(o.navigationOnly&&!l?.navigation)throw new e(o.navigationOnly.message);let h=o.state,d=l?l.implementation(n,h,{manifest:o.manifest,systems:this._context.domainContextSelectors.getDomainSystems(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable(),readOfferedNavigation:this._readOfferedNavigation,isOfferedForSelection:this._isOfferedForSelection}):this._context.configuratorExtensionSelectors.getActionSystem().prepareAction(c,G(n),h);if(d.updates.length>0){let i=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(d.updates,h,"committed"),{validity:n}=i;if("uncaught"===n.severity)throw new e(`The changes of "${t}" were not applied, because the resulting configuration is invalid: validating it threw: ${P(D(n.error))} Change the request so the configuration stays valid.`,{originalError:n.error});if(!n.valid)throw new R(`The changes of "${t}" were not applied, because the resulting configuration has ${n.severity} violations.`,M({validity:n,stateEmission:i},{i18n:this._context.domainServicesSelectors.getI18n(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()}));o.emissions.push(i),o.validities.set(i.state,n),o.state=i.state}return!!(!l&&s(a=r(i))&&"Boolean"===a.name)||d.readResult({previousState:h,state:o.state})};_takeScreenshot=({entity:t,state:i},n,o)=>{let r=o.manifest.screenshots?.[t.type]?.find(e=>e.view===n);if(!r)return Promise.reject(new e(`The schema declares the screenshot view "${n}" on ${t.type}, but the configurator has no view of that name. This is a fault in the configurator, not in your request. Tell the user this is not available.`));let s=o.lastScreenshot.then(async()=>{if(!o.generation.active)throw W(L);let e=await this._renderScreenshot(t.id,r.instanceName,i).catch(e=>{throw W(e instanceof E?"User made concurrent actions that prevented the screenshot from being taken, try again":e instanceof z?`The screenshot of ${t.id} from "${n}" cannot be taken: ${e.message} Tell the user the screenshot is not available.`:`The screenshot of ${t.id} from "${n}" could not be taken: ${P(D(e))} Try again; if it fails again, tell the user the screenshot is not available.`,e instanceof Error?e:void 0)});if(!o.generation.active)throw W(L);if(null===e)return null;let s="inline"===o.screenshotStorage?{image:e}:await this._context.uploadScreenshot(e).catch(e=>{throw W(`The screenshot of ${t.id} from "${n}" was taken but could not be stored: ${P(D(e))} Try again; if it fails again, tell the user the screenshot is not available.`,e instanceof Error?e:void 0)}),a=`${t.id}/${n}`,l=[...o.screenshots.values()].filter(e=>e.entityId===t.id&&e.view===n).length,c=0===l?a:`${a}#${l+1}`;return o.screenshots.set(c,{entityId:t.id,view:n,...s}),{image:c}});return o.lastScreenshot=s.catch(()=>void 0),s};_setup=()=>{let{manifest:t,error:i}=this._context.getAssistantSetup();if(i)return{ready:!1,result:{errors:[new e(i.message,{originalError:i})]}};if(!t)return{ready:!1,result:k};let n=this._selectSchema(t.sdl);return n instanceof e?{ready:!1,result:{errors:[n]}}:{ready:!0,assistant:t,schema:n,lenses:t.lenses?.definitions?this._selectLenses(t.lenses.definitions):void 0,fieldResolver:this._selectFieldResolver(t.fields)}};_run=async(t,i,o,r)=>{var s;let l;try{l=a(t)}catch(t){return{errors:[t instanceof e?t:new e(D(t))]}}let h=c(o.schema,l,F);return h.length>0?{errors:h}:(s=await n({schema:o.schema,document:l,rootValue:this._rootValue,contextValue:r,variableValues:i.variables,operationName:i.operationName,fieldResolver:o.fieldResolver,typeResolver:this._resolveType}),s.errors?.some(e=>e.originalError instanceof R)?{...s,errors:s.errors.flatMap(t=>t.originalError instanceof R?t.originalError.entries.map(({type:i,entityId:n,message:o,details:r})=>new e(o,{nodes:t.nodes,source:t.source,positions:t.positions,path:t.path,extensions:{code:"VIOLATION",type:i,entityId:n,...void 0===r?{}:{details:r}}})):[t])}:s)};prepare=async(t,i,{screenshots:n="upload",navigationOnly:o}={})=>{let r,s=this._generation,a=this._setup();if(!a.ready)return i.map(()=>({result:a.result,emissions:[],screenshots:new Map}));let l={manifest:a.assistant,state:t,emissions:[],failedMutationField:void 0,screenshots:new Map,lastScreenshot:Promise.resolve(),generation:s,screenshotStorage:n,navigationOnly:o,validities:new WeakMap},c=[];for(let[t,n]of i.entries())if(void 0===r){let i=l.emissions.length,o=l.screenshots.size;l.failedMutationField=void 0;let s=T(n.document),h=a.lenses?$(s,a.lenses):s,d=h instanceof e?{errors:[h]}:await this._run(h,n,a,l);await l.lastScreenshot,c.push({result:d,emissions:l.emissions.slice(i),screenshots:new Map([...l.screenshots].slice(o))}),B(d)&&(r=t)}else c.push({result:U(r),emissions:[],screenshots:new Map});return c};readSideEffects=e=>{let t=this._context.domainServicesSelectors.getResolveLocalizable();return e.flatMap(({emissions:e})=>e.flatMap(e=>O(e.updates,t)))};readScreenshots=e=>new Map(e.flatMap(({screenshots:e})=>[...e]));readWarnings=(e,t)=>{let i=t.flatMap(({emissions:e})=>e).at(-1);return void 0===i||t.some(({result:e})=>B(e))?[]:j(i.validity,this._validateState(e),this._context.domainServicesSelectors.getResolveLocalizable())};_prepareAndCommit=async(e,t,i)=>{let n,o,r,s=this._context.domainContextSelectors.getStoreSystem(),a=s.stateSlices.committed.value.state,l=await this.prepare(a,e,i),c=l.map(({result:e})=>e),h=this.readSideEffects(l),f=this.readScreenshots(l),m=l.flatMap(e=>e.emissions);if(!t.active)return{results:c,sideEffects:h,screenshots:f,warnings:[],outcome:"conflict"};if(c.some(B)||0===m.length)return{results:c,sideEffects:h,screenshots:f,warnings:[],outcome:"none"};let u=(n=d(m[0]),o=d(m[m.length-1]),r=m.some(e=>void 0!==e.transformationLog),{kind:"committed",previousState:n.previousState,state:o.state,updates:m.flatMap(e=>e.updates),validity:o.validity,transformationLog:r?m.flatMap(e=>e.transformationLog??[]):void 0});return{results:c,sideEffects:h,screenshots:f,warnings:this.readWarnings(a,l),outcome:s.commitPrepared(u),preparedState:u.state}};execute=async(e,t={})=>{let i=this._generation;if(!this._context.domainContextSelectors.getStoreSystem().isInitialized)return{results:e.map(()=>A),committed:!1,sideEffects:[],warnings:[],screenshots:new Map};let n=await this._prepareAndCommit(e,i,t),{results:o,sideEffects:r,warnings:s,screenshots:a,outcome:l,preparedState:c}="conflict"===n.outcome&&i.active?await this._prepareAndCommit(e,i,t):n;return"committed"===l?{results:o,committed:!0,sideEffects:r,warnings:s,screenshots:a,preparedState:c}:"held"===l?{results:o,committed:!1,message:"webmcp"===t.surface?"The changes wait for the user's approval and are not applied yet. Do not send them again; query the configuration later to see whether they were applied.":"The changes wait for the user's approval and are not applied yet. Do not send them again; the next `[changes]` block lists them once approved.",sideEffects:r,warnings:s,screenshots:a,preparedState:c}:"conflict"===l?{results:o,committed:!1,message:"The changes were not committed, because the configuration changed while they were being applied. The results describe a state that was discarded. Query the current configuration and send the operations again if they still make sense.",sideEffects:r,warnings:s,screenshots:a}:{results:o,committed:!1,sideEffects:r,warnings:s,screenshots:a}}}
|
|
@@ -9,10 +9,13 @@ export interface OfferedNavigationContext {
|
|
|
9
9
|
* one by one:
|
|
10
10
|
* - the first `navigationSteps` on the root: every step before the active one and the one after it
|
|
11
11
|
* (the first step while none is active), entered by its first navigation state;
|
|
12
|
-
* - the tabs of every `sidebarTabs` of the selected entity and of the first `horizontalTabs`,
|
|
13
|
-
*
|
|
12
|
+
* - the tabs of every `sidebarTabs` of the selected entity and of the first `horizontalTabs`, each
|
|
13
|
+
* entered by its first navigation state. Both kinds are read wherever they are declared, although
|
|
14
|
+
* of the desktop headers only the fixed one shows horizontal tabs; the floating and hidden headers show the
|
|
15
|
+
* sidebar tabs alone, and the mobile tabs show the one kind declared and fail when both are;
|
|
14
16
|
* - every `sceneEntityNavigationHotspot`; a state only a hotspot that pushes offers is entered by
|
|
15
|
-
* pushing it, as that hotspot does
|
|
17
|
+
* pushing it, as that hotspot does. When two pushing hotspots offer the same state, the last one's
|
|
18
|
+
* `canStackOnto` is used;
|
|
16
19
|
* - the items of the first `viewControls` on the root;
|
|
17
20
|
* - the items of the first `toolControls` on the root, the options of every `toolMenuFab` and the
|
|
18
21
|
* exit of every `exitToolModeFab`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{exitToolModeFabComponent as t,horizontalTabsComponent as e,navigationStepsComponent as o,sceneEntityNavigationHotspotComponent as a,sidebarTabsComponent as n,toolControlsComponent as s,toolMenuFabComponent as i,viewControlsComponent as f}from"#package/domain";export const readOfferedNavigation=(
|
|
1
|
+
import{exitToolModeFabComponent as t,horizontalTabsComponent as e,navigationStepsComponent as o,sceneEntityNavigationHotspotComponent as a,sidebarTabsComponent as n,toolControlsComponent as s,toolMenuFabComponent as i,viewControlsComponent as f}from"#package/domain";export const readOfferedNavigation=(d,{componentReader:r,navigationSystem:l})=>{let p=new Set,m=new Map,c=new Set,S=new Set,v=l.getActiveNavigationState(d),g=(r.readFirstRootComponent({componentTypes:[o]},d)?.state.steps??[]).filter(t=>t.navigationStates.length>0),y=g.findIndex(t=>t.navigationStates.includes(v));for(let[t,e]of g.entries())if(t<y||t===y+1)for(let t of e.navigationStates.slice(0,1))p.add(t);for(let t of r.readManyComponents({componentTypes:[n],entityIds:[l.getActiveSelectionState(d)]},d).flatMap(t=>t.state.tabs))for(let e of t.navigationStates.slice(0,1))p.add(e);let T=r.readFirstComponent({componentTypes:[e]},d);for(let t of T?.state.tabs??[])for(let e of t.navigationStates.slice(0,1))p.add(e);let u=r.readManyComponents({componentTypes:[a]},d);for(let{state:t}of u)t.pushToStack||p.add(t.navigationState);for(let{state:t}of u)t.pushToStack&&!p.has(t.navigationState)&&m.set(t.navigationState,t.canStackOnto);for(let t of m.keys())p.add(t);let C=r.readFirstRootComponent({componentTypes:[f]},d);for(let t of C?.state.items??[])if(void 0!==t.value)c.add(t.value);else for(let e of t.items)c.add(e.value);let M=r.readFirstRootComponent({componentTypes:[s]},d);for(let t of M?.state.items??[])S.add(t.value);for(let t of r.readManyComponents({componentTypes:[i]},d))for(let e of t.state.options)S.add(e.toolState);for(let e of r.readManyComponents({componentTypes:[t]},d))S.add(e.state.exitTo);return{navigationStates:p,pushedNavigationStates:m,viewStates:c,toolStates:S}};
|
|
@@ -38,8 +38,19 @@ export declare const resolveExportBackground: (config: {
|
|
|
38
38
|
readonly fileFormat: 'PNG' | 'JPEG';
|
|
39
39
|
readonly outputColorSpace: ColorSpace;
|
|
40
40
|
}) => string | null;
|
|
41
|
-
/**
|
|
42
|
-
export declare const flipPixelRows: (pixels: Uint8Array, width: number, height: number) =>
|
|
43
|
-
/**
|
|
44
|
-
|
|
41
|
+
/** Writes WebGL's bottom-up pixel rows into `target` in the top-down order 2D canvases use. */
|
|
42
|
+
export declare const flipPixelRows: (pixels: Uint8Array, width: number, height: number, target: Uint8ClampedArray) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Readback memory that the captures of one batch share instead of each allocating its own, which
|
|
45
|
+
* Safari may not collect between two captures.
|
|
46
|
+
*/
|
|
47
|
+
export interface CaptureBuffers {
|
|
48
|
+
pixels?: Uint8Array;
|
|
49
|
+
imageData?: ImageData;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Reads an 8-bit render target back and encodes it over the given background colour. `afterRead`
|
|
53
|
+
* runs once the pixels are in memory, so the caller can release its GPU resources before encoding.
|
|
54
|
+
*/
|
|
55
|
+
export declare const readTargetToBlob: (renderer: WebGLRenderer, target: WebGLRenderTarget, background: string | null, mimeType: 'image/png' | 'image/jpeg', afterRead?: () => void, buffers?: CaptureBuffers) => Promise<Blob>;
|
|
45
56
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Pass as e}from"postprocessing";import{ACESFilmicToneMapping as r,AgXToneMapping as t,CineonToneMapping as o,Color as a,ColorManagement as
|
|
1
|
+
import{Pass as e}from"postprocessing";import{ACESFilmicToneMapping as r,AgXToneMapping as t,CineonToneMapping as o,Color as a,ColorManagement as i,CustomToneMapping as n,LinearToneMapping as l,NoBlending as s,RawShaderMaterial as p,ReinhardToneMapping as c,SRGBTransfer as g,WebGLRenderTarget as f}from"three";let u=new Map([[l,"LINEAR_TONE_MAPPING"],[c,"REINHARD_TONE_MAPPING"],[o,"CINEON_TONE_MAPPING"],[r,"ACES_FILMIC_TONE_MAPPING"],[t,"AGX_TONE_MAPPING"],[n,"CUSTOM_TONE_MAPPING"]]),d=`
|
|
2
2
|
precision highp float;
|
|
3
3
|
|
|
4
4
|
attribute vec3 position;
|
|
@@ -10,7 +10,7 @@ import{Pass as e}from"postprocessing";import{ACESFilmicToneMapping as r,AgXToneM
|
|
|
10
10
|
vUv = uv;
|
|
11
11
|
gl_Position = vec4(position.xy, 1.0, 1.0);
|
|
12
12
|
}
|
|
13
|
-
`,
|
|
13
|
+
`,m=`
|
|
14
14
|
precision highp float;
|
|
15
15
|
|
|
16
16
|
uniform sampler2D tDiffuse;
|
|
@@ -47,4 +47,4 @@ import{Pass as e}from"postprocessing";import{ACESFilmicToneMapping as r,AgXToneM
|
|
|
47
47
|
|
|
48
48
|
gl_FragColor = color;
|
|
49
49
|
}
|
|
50
|
-
`;export const createExportOutputMaterial=(e,r)=>{let t=
|
|
50
|
+
`;export const createExportOutputMaterial=(e,r)=>{let t=u.get(e),o={...void 0!==t?{[t]:""}:{},...i.getTransfer(r)===g?{SRGB_TRANSFER:""}:{}},a={tDiffuse:{value:null},toneMappingExposure:{value:1}};return Object.assign(new p({name:"ExportOutputMaterial",uniforms:a,defines:o,vertexShader:d,fragmentShader:m,blending:s,depthTest:!1,depthWrite:!1}),{uniforms:a})};export class ExportCapturePass extends e{renderTarget;_material;constructor(e,r,t,o){super("ExportCapturePass"),this.needsSwap=!1,this.renderTarget=new f(e,r),this._material=createExportOutputMaterial(t,o),this.fullscreenMaterial=this._material}render(e,r){this._material.uniforms.tDiffuse.value=r?.texture??null,this._material.uniforms.toneMappingExposure.value=e.toneMappingExposure,e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera)}}export const resolveExportBackground=e=>{let r=e.sceneBackground instanceof a?e.sceneBackground:e.backgroundColor??("JPEG"===e.fileFormat?new a(0xffffff):null);return null===r?null:`#${r.getHexString(e.outputColorSpace)}`};export const flipPixelRows=(e,r,t,o)=>{let a=4*r;for(let r=0;r<t;r++)o.set(e.subarray(r*a,(r+1)*a),(t-r-1)*a)};export const readTargetToBlob=async(e,r,t,o,a=()=>{},i={})=>{let{width:n,height:l}=r,s=n*l*4;(void 0===i.pixels||i.pixels.length<s)&&(i.pixels=new Uint8Array(s));let p=i.pixels.subarray(0,s);e.readRenderTargetPixels(r,0,0,n,l,p),a();let c=document.createElement("canvas");c.width=n,c.height=l;try{let e=c.getContext("2d");if(null===e)throw Error("Failed to get a 2D context for encoding the exported image! The browser refused to create one, possibly because too many canvases are alive. Retry the export.");return(i.imageData?.width!==n||i.imageData.height!==l)&&(i.imageData=e.createImageData(n,l)),flipPixelRows(p,n,l,i.imageData.data),e.putImageData(i.imageData,0,0),null!==t&&(e.globalCompositeOperation="destination-over",e.fillStyle=t,e.fillRect(0,0,n,l)),await new Promise((e,r)=>{c.toBlob(t=>{t?e(t):r(Error("Failed to create blob from canvas"))},o)})}finally{c.width=0,c.height=0}};
|
|
@@ -23,6 +23,15 @@ export interface ClientSideImageRenderingOptions {
|
|
|
23
23
|
}
|
|
24
24
|
/** A component that declares an image the export renders: its state says how, its entity what. */
|
|
25
25
|
type ImageComponentSnapshot = ComponentSnapshot<ClientSideImageComponent> | ComponentSnapshot<SaveTemplateThumbnailComponent> | ComponentSnapshot<AgentScreenshotComponent>;
|
|
26
|
+
/** Guards async image work and its external effects against a retained-context generation change. */
|
|
27
|
+
/** One image `renderImage` captures from the configurator canvas. */
|
|
28
|
+
export interface ImageCaptureConfig {
|
|
29
|
+
readonly width: number;
|
|
30
|
+
readonly height: number;
|
|
31
|
+
readonly fileFormat: 'PNG' | 'JPEG';
|
|
32
|
+
readonly backgroundColor?: Color;
|
|
33
|
+
readonly camera: PerspectiveCamera | OrthographicCamera;
|
|
34
|
+
}
|
|
26
35
|
/** ImageRenderingSystem with its entity types erased — how the runtime selectors expose the instance. */
|
|
27
36
|
export type AnyImageRenderingSystem = ImageRenderingSystem<any>;
|
|
28
37
|
export declare class ImageRenderingSystem<ENTITIES extends DomainEntity<string>> {
|
|
@@ -32,6 +41,9 @@ export declare class ImageRenderingSystem<ENTITIES extends DomainEntity<string>>
|
|
|
32
41
|
private _generation;
|
|
33
42
|
private readonly _debugObjectUrls;
|
|
34
43
|
private _canvasFreeze;
|
|
44
|
+
private _captureQueue;
|
|
45
|
+
private _captureBuffers;
|
|
46
|
+
private _runningBatches;
|
|
35
47
|
constructor(_context: ImageRenderingSystemContext);
|
|
36
48
|
private readonly _captureGenerationAssertion;
|
|
37
49
|
private readonly _captureGenerationGuard;
|
|
@@ -92,13 +104,9 @@ export declare class ImageRenderingSystem<ENTITIES extends DomainEntity<string>>
|
|
|
92
104
|
* screenshot) and an export batch overlap in any order.
|
|
93
105
|
*/
|
|
94
106
|
private readonly _freezeCanvas;
|
|
95
|
-
renderImage(config:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
fileFormat: 'PNG' | 'JPEG';
|
|
99
|
-
backgroundColor?: Color;
|
|
100
|
-
camera: PerspectiveCamera | OrthographicCamera;
|
|
101
|
-
}): Promise<Blob>;
|
|
107
|
+
renderImage(config: ImageCaptureConfig): Promise<Blob>;
|
|
108
|
+
/** Swaps the canvas to the export size and camera, renders the image offscreen and restores the canvas. */
|
|
109
|
+
private _captureOnCanvas;
|
|
102
110
|
/**
|
|
103
111
|
* Generates client side images from declarative clientSideImage components and uploads them to s3.
|
|
104
112
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{filter as e,firstValueFrom as t}from"rxjs";import{Color as r,HalfFloatType as a,NoToneMapping as n,OrthographicCamera as o,PerspectiveCamera as i,WebGLRenderTarget as s}from"three";import{preloadFont as l}from"troika-three-text";import{match as c}from"ts-pattern";import{clientSideImageComponent as m,dimensionIndicatorComponent as g,domainEntityTypeFromId as d,editableDistanceDimensionIndicatorComponent as h,isDomainEntityId as u,isVirtualEntityId as f,sketchingEditComponent as p}from"#package/domain";import{createCameraControls as w}from"../camera-control-system/create-camera-controls.js";import{createCanvasFreezeFrame as C}from"./canvas-freeze-frame.js";import{captureNextFrame as _}from"./capture-next-frame.js";import{ExportCapturePass as y,readTargetToBlob as x,resolveExportBackground as b}from"./export-image-capture.js";export class ImageRenderingSystem{_context;_renderer=null;_effectComposer=null;_generation=null;_debugObjectUrls=new Set;_canvasFreeze=null;constructor(e){this._context=e}_captureGenerationAssertion=()=>{let e=this._generation,t=()=>{if(!e?.active)throw Error("Image rendering generation ended while images were being rendered! The configurator context was reinitialized before the renderer finished, so the results belong to a configuration that is no longer active. Await the render before leaving the configuration, or discard the rejection.")};return t(),t};_captureGenerationGuard=()=>{let e=this._captureGenerationAssertion();return{assertActive:e,waitFor:async t=>{let r=await t;return e(),r},runEffect:t=>(e(),t())}};register(e){return this._renderer=e,()=>{this._renderer===e&&(this._renderer=null)}}registerEffectComposer(e){return this._effectComposer=e,()=>{this._effectComposer===e&&(this._effectComposer=null)}}_openDebugImage=e=>{let t=URL.createObjectURL(e);this._debugObjectUrls.add(t),window.open(t,"_blank")};_getRenderer=async()=>{let e=this._generation,t=Date.now(),r=()=>{if(!e?.active)throw Error("Image rendering generation ended while waiting for the renderer! The configurator context was reinitialized before the renderer arrived, so the render would target a scene that is gone. Await the render before leaving the configuration, or discard the rejection.")};r();let a=this._renderer;for(;null===a;){if(await new Promise(e=>setTimeout(e,50)),r(),Date.now()-t>1e4)throw Error("Renderer could not be retrieved! Reached timeout.");a=this._renderer}return a};captureView=async()=>{let{getCanvasSystem:r,getCameraControlSystem:a,getExportSystem:n}=this._context.configuratorExtensionSelectors,{perspectiveCamera:o,orthographicCamera:i}=a();return await t(n().exporting$.pipe(e(e=>!e))),_(await r().waitForCanvas(),({camera:e,frameloop:t})=>"never"!==t&&(e===o||e===i))};generateImageUsingOriginalCanvas=async(e,t,r=!1)=>{let a=this._captureGenerationGuard(),n=await a.waitFor(this._getRenderer());if(r){let{blob:e}=await a.waitFor(a.runEffect(()=>n.renderUsingOriginalCanvas(t)));a.runEffect(()=>this._openDebugImage(e));return}let o=await Promise.all([t].map(async e=>{let{blob:t}=await a.waitFor(a.runEffect(()=>n.renderUsingOriginalCanvas(e)));return{blob:t,name:e.name}})),i=await a.waitFor(a.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,[t.name])));await Promise.all(i.map(async e=>{let t=o.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(i.map(async e=>{await a.waitFor(a.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))};async generateImagesUsingOriginalCanvas(e,t,r=!1){let a=this._captureGenerationGuard(),n=await a.waitFor(this._getRenderer()),o=Array.isArray(t)?t:[t],i=await o.reduce(async(e,t)=>[...await e,await a.waitFor(a.runEffect(()=>n.renderUsingOriginalCanvas(t)))],Promise.resolve([]));if(r){for(let e of i)a.runEffect(()=>this._openDebugImage(e.blob)),await a.waitFor(new Promise(e=>setTimeout(e,100)));return}let s=o.map(e=>e.name),l=await a.waitFor(a.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,s)));await Promise.all(l.map(async e=>{let t=i.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(l.map(async e=>{await a.waitFor(a.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))}async generateImages(e,t,r=!1){let a=this._captureGenerationGuard(),n=await a.waitFor(this._getRenderer()),o=t.map(e=>e.name);if(r)return void await Promise.all(t.map(async e=>{let t=await a.waitFor(a.runEffect(()=>n.renderImage(e)));a.runEffect(()=>this._openDebugImage(t))}));let i=await Promise.all(t.map(async e=>({blob:await a.waitFor(a.runEffect(()=>n.renderImage(e))),name:e.name}))),s=await a.waitFor(a.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,o)));await Promise.all(s.map(async e=>{let t=i.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(s.map(async e=>{await a.waitFor(a.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))}async getGeneratedImages(e,t=!1){let r=this._captureGenerationAssertion(),a=await this._getRenderer();return(r(),t)?(await Promise.all(e.map(async e=>{let t=await a.renderImage(e);r(),this._openDebugImage(t)})),[]):Promise.all(e.map(async e=>{let t=await a.renderImage(e);return r(),{blob:t,name:e.name}}))}_renderCurrentView=e=>{let{gl:t,scene:r,camera:a}=e.get();null!==this._effectComposer?this._effectComposer.render():t.render(r,a)};_freezeCanvas=e=>{this._canvasFreeze?.handle===e?this._canvasFreeze.holders+=1:(this._canvasFreeze?.remove(),this._canvasFreeze={handle:e,remove:C(e.get().gl.domElement,()=>this._renderCurrentView(e)),resumeFrameloop:this._context.configuratorExtensionSelectors.getExportSystem().pauseFrameloop(e),holders:1});let t=this._canvasFreeze,r=!1;return async()=>{if(!r&&(r=!0,t.holders-=1,!(t.holders>0)))try{let r=this._context.configuratorExtensionSelectors.getCanvasSystem();r.r3fHandle$.value===e&&await r.waitForFlush(),r.r3fHandle$.value===e&&0===t.holders&&this._renderCurrentView(e)}catch{}finally{0===t.holders&&(t.remove(),t.resumeFrameloop(),this._canvasFreeze===t&&(this._canvasFreeze=null))}}};async renderImage(e){let t=this._context.configuratorExtensionSelectors.getCanvasSystem(),o=t.r3fHandle$.value??await t.waitForCanvas(),{gl:i,scene:l,camera:c,size:m,advance:g}=o.get(),d=i.getRenderTarget(),h=i.getClearColor(new r),u=i.getClearAlpha(),f=i.autoClearColor,p=t=>new y(e.width,e.height,t,i.outputColorSpace),w={composer:null,pass:null},C=null,_=null,v=e=>{let t=w.pass??p(n);return w.pass=t,w.composer===e&&e.passes.at(-1)===t||(w.composer?.removePass(t),e.addPass(t),w.composer=e),t},E=async()=>{if(await this._context.configuratorExtensionSelectors.getCanvasSystem().waitForFlush(),this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value!==o)throw Error("Canvas was remounted while an image was being rendered! The export borrowed a canvas that is gone, so it cannot capture the image. Retry the export once the configurator has settled.")},S=this._freezeCanvas(o);try{o.set({size:{height:e.height,width:e.width,top:0,left:0,updateStyle:!1}}),o.set({camera:e.camera}),await E(),null!==this._effectComposer&&v(this._effectComposer),g(void 0),await E();let t="JPEG"===e.fileFormat?"image/jpeg":"image/png",n=b({sceneBackground:l.background,backgroundColor:e.backgroundColor,fileFormat:e.fileFormat,outputColorSpace:i.outputColorSpace});if(null!==this._effectComposer){i.setRenderTarget(null),"JPEG"===e.fileFormat?i.setClearColor(e.backgroundColor??0xffffff):e.backgroundColor?i.setClearColor(e.backgroundColor):i.setClearAlpha(0),i.autoClearColor=!0;let r=v(this._effectComposer);return this._effectComposer.render(),await x(i,r.renderTarget,n,t)}C=p(i.toneMapping),_=new s(e.width,e.height,{samples:4,type:a,stencilBuffer:i.getContextAttributes().stencil??!1});let c=l.background;c instanceof r&&(l.background=null);try{i.setClearColor(0,0),i.setRenderTarget(_),i.clear(),i.render(l,e.camera)}finally{l.background=c}return C.render(i,_),await x(i,C.renderTarget,n,t)}finally{null!==w.pass&&(w.composer?.removePass(w.pass),w.pass.dispose()),C?.dispose(),_?.dispose(),this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value===o&&(i.setClearColor(h,u),i.autoClearColor=f,i.setRenderTarget(d),o.set({camera:c,size:{...m,updateStyle:!1}})),await S()}}async generateAndUploadDeclaredClientSideImages(e,t,r={}){let a=this._captureGenerationGuard(),n=await a.waitFor(this.generateDeclaredClientSideImages(e,r));if(r.debug)return n;let o=new Map((await a.waitFor(a.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),t,n.map(e=>e.name))))).map(e=>[e.name,e.url]));return await Promise.all(n.map(async e=>{let t=o.get(e.name);if(!t)throw Error(`Presigned link for image ${e.name} not found!`);await a.waitFor(a.runEffect(()=>fetch(t,{method:"PUT",body:e.blob})))})),n}generateDeclaredClientSideImages(e,t={}){let r=this._context.domainContextSelectors.getComponentReader().readManyComponents({componentTypes:[m]},e);return this.generateImagesFromComponents(r,e,t)}generateImagesFromComponents(e,t,r={},a={}){return this._generateImagesFromComponents(e,t,r,a)}async _generateImagesFromComponents(e,t,a,n){let s=this._captureGenerationGuard(),m=!1,C=this._context.domainContextSelectors.getExportStates(),_=e.map(e=>{if(!C.includes(e.state.exportState)){let t=u(e.componentInstance.entityId)?d(e.componentInstance.entityId):"unknown entity",r=e.componentInstance.componentType.name,a=e.componentInstance.instanceName;throw Error(`Export state ${e.state.exportState} declared in component ${r}/${a} on ${t} is not a valid export state. Expected one of: ${C.join(", ")}`)}let n=e.componentInstance.entityId;if(f(n))throw Error("Virtual entities cannot be used for export");return this._context.configuratorExtensionSelectors.getExportSystem().createExportJob(t,{exportState:e.state.exportState,exportedEntityId:n,toolState:e.state.toolState,viewState:e.state.viewState,navigationState:e.state.navigationState,selectedEntityId:t.rootEntityId},async t=>{let d=this._context.domainContextSelectors.getComponentReader().readManyComponents({componentTypes:[g,h,p]},t.state);!m&&d.length>0&&(await new Promise(e=>{l({font:void 0,characters:void 0},e)}),m=!0,await this._context.configuratorExtensionSelectors.getCanvasSystem().waitForFlush());let u=this._context.configuratorExtensionSelectors.getCameraSystem().getActiveCameraConfig(t.state);if(null==u)throw Error(`No camera config is attached for export state ${e.state.exportState} and exported entity ${n}. Whenever using a client-side image component, you need to attach a camera configuration to the export state defined on that componentin the domain spec. This camera will be used to render the image.`);let f=c(u.typeSpecificConfig.cameraType).with("perspective",()=>new i(45,e.state.width/e.state.height,1,1e4)).with("orthographic",()=>new o(0,0,1e4,0,1,1e4)).exhaustive(),C=w(f);await this._context.configuratorExtensionSelectors.getCameraSystem().applyConfig(u,C,!1,{width:e.state.width,height:e.state.height,padding:{top:0,right:0,bottom:0,left:0}}),C.update(1e6),await new Promise(e=>setTimeout(e,100));let _=await s.waitFor(s.runEffect(()=>this.renderImage({width:e.state.width,height:e.state.height,fileFormat:e.state.fileFormat,backgroundColor:e.state.backgroundColor?new r(e.state.backgroundColor):void 0,camera:f})));return a.debug&&s.runEffect(()=>this._openDebugImage(_)),{blob:_,imageComponent:e,name:`${e.componentInstance.componentType.name}-${e.componentInstance.entityId}-${e.componentInstance.instanceName}`}})});if(0===_.length)return this._context.configuratorExtensionSelectors.getExportSystem().runExportJobs(_,n);let y=this._context.configuratorExtensionSelectors.getCanvasSystem(),x=y.r3fHandle$.value??await s.waitFor(y.waitForCanvas().catch(e=>{throw s.assertActive(),e})),b=this._freezeCanvas(x);try{return await this._context.configuratorExtensionSelectors.getExportSystem().runExportJobs(_,n)}finally{await b()}}initialize=()=>{for(let e of(null!==this._generation&&(this._generation.active=!1),this._debugObjectUrls))URL.revokeObjectURL(e);this._debugObjectUrls.clear(),this._generation={active:!0}}}
|
|
1
|
+
import{filter as e,firstValueFrom as t}from"rxjs";import{Color as a,HalfFloatType as r,NoToneMapping as n,OrthographicCamera as o,PerspectiveCamera as i,WebGLRenderTarget as s}from"three";import{preloadFont as l}from"troika-three-text";import{match as c}from"ts-pattern";import{clientSideImageComponent as u,dimensionIndicatorComponent as m,domainEntityTypeFromId as g,editableDistanceDimensionIndicatorComponent as h,isDomainEntityId as d,isVirtualEntityId as f,sketchingEditComponent as p}from"#package/domain";import{createCameraControls as w}from"../camera-control-system/create-camera-controls.js";import{createCanvasFreezeFrame as _}from"./canvas-freeze-frame.js";import{captureNextFrame as C}from"./capture-next-frame.js";import{ExportCapturePass as y,readTargetToBlob as x,resolveExportBackground as b}from"./export-image-capture.js";export class ImageRenderingSystem{_context;_renderer=null;_effectComposer=null;_generation=null;_debugObjectUrls=new Set;_canvasFreeze=null;_captureQueue=Promise.resolve();_captureBuffers=null;_runningBatches=0;constructor(e){this._context=e}_captureGenerationAssertion=()=>{let e=this._generation,t=()=>{if(!e?.active)throw Error("Image rendering generation ended while images were being rendered! The configurator context was reinitialized before the renderer finished, so the results belong to a configuration that is no longer active. Await the render before leaving the configuration, or discard the rejection.")};return t(),t};_captureGenerationGuard=()=>{let e=this._captureGenerationAssertion();return{assertActive:e,waitFor:async t=>{let a=await t;return e(),a},runEffect:t=>(e(),t())}};register(e){return this._renderer=e,()=>{this._renderer===e&&(this._renderer=null)}}registerEffectComposer(e){return this._effectComposer=e,()=>{this._effectComposer===e&&(this._effectComposer=null)}}_openDebugImage=e=>{let t=URL.createObjectURL(e);this._debugObjectUrls.add(t),window.open(t,"_blank")};_getRenderer=async()=>{let e=this._generation,t=Date.now(),a=()=>{if(!e?.active)throw Error("Image rendering generation ended while waiting for the renderer! The configurator context was reinitialized before the renderer arrived, so the render would target a scene that is gone. Await the render before leaving the configuration, or discard the rejection.")};a();let r=this._renderer;for(;null===r;){if(await new Promise(e=>setTimeout(e,50)),a(),Date.now()-t>1e4)throw Error("Renderer could not be retrieved! Reached timeout.");r=this._renderer}return r};captureView=async()=>{let{getCanvasSystem:a,getCameraControlSystem:r,getExportSystem:n}=this._context.configuratorExtensionSelectors,{perspectiveCamera:o,orthographicCamera:i}=r();return await t(n().exporting$.pipe(e(e=>!e))),C(await a().waitForCanvas(),({camera:e,frameloop:t})=>"never"!==t&&(e===o||e===i))};generateImageUsingOriginalCanvas=async(e,t,a=!1)=>{let r=this._captureGenerationGuard(),n=await r.waitFor(this._getRenderer());if(a){let{blob:e}=await r.waitFor(r.runEffect(()=>n.renderUsingOriginalCanvas(t)));r.runEffect(()=>this._openDebugImage(e));return}let o=await Promise.all([t].map(async e=>{let{blob:t}=await r.waitFor(r.runEffect(()=>n.renderUsingOriginalCanvas(e)));return{blob:t,name:e.name}})),i=await r.waitFor(r.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,[t.name])));await Promise.all(i.map(async e=>{let t=o.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(i.map(async e=>{await r.waitFor(r.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))};async generateImagesUsingOriginalCanvas(e,t,a=!1){let r=this._captureGenerationGuard(),n=await r.waitFor(this._getRenderer()),o=Array.isArray(t)?t:[t],i=await o.reduce(async(e,t)=>[...await e,await r.waitFor(r.runEffect(()=>n.renderUsingOriginalCanvas(t)))],Promise.resolve([]));if(a){for(let e of i)r.runEffect(()=>this._openDebugImage(e.blob)),await r.waitFor(new Promise(e=>setTimeout(e,100)));return}let s=o.map(e=>e.name),l=await r.waitFor(r.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,s)));await Promise.all(l.map(async e=>{let t=i.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(l.map(async e=>{await r.waitFor(r.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))}async generateImages(e,t,a=!1){let r=this._captureGenerationGuard(),n=await r.waitFor(this._getRenderer()),o=t.map(e=>e.name);if(a)return void await Promise.all(t.map(async e=>{let t=await r.waitFor(r.runEffect(()=>n.renderImage(e)));r.runEffect(()=>this._openDebugImage(t))}));let i=await Promise.all(t.map(async e=>({blob:await r.waitFor(r.runEffect(()=>n.renderImage(e))),name:e.name}))),s=await r.waitFor(r.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,o)));await Promise.all(s.map(async e=>{let t=i.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(s.map(async e=>{await r.waitFor(r.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))}async getGeneratedImages(e,t=!1){let a=this._captureGenerationAssertion(),r=await this._getRenderer();return(a(),t)?(await Promise.all(e.map(async e=>{let t=await r.renderImage(e);a(),this._openDebugImage(t)})),[]):Promise.all(e.map(async e=>{let t=await r.renderImage(e);return a(),{blob:t,name:e.name}}))}_renderCurrentView=e=>{let{gl:t,scene:a,camera:r}=e.get();null!==this._effectComposer?this._effectComposer.render():t.render(a,r)};_freezeCanvas=e=>{this._canvasFreeze?.handle===e?this._canvasFreeze.holders+=1:(this._canvasFreeze?.remove(),this._canvasFreeze={handle:e,remove:_(e.get().gl.domElement,()=>this._renderCurrentView(e)),resumeFrameloop:this._context.configuratorExtensionSelectors.getExportSystem().pauseFrameloop(e),holders:1});let t=this._canvasFreeze,a=!1;return async()=>{if(!a&&(a=!0,t.holders-=1,!(t.holders>0)))try{let a=this._context.configuratorExtensionSelectors.getCanvasSystem();a.r3fHandle$.value===e&&await a.waitForFlush(),a.r3fHandle$.value===e&&0===t.holders&&this._renderCurrentView(e)}catch{}finally{0===t.holders&&(t.remove(),t.resumeFrameloop(),this._canvasFreeze===t&&(this._canvasFreeze=null))}}};async renderImage(e){let t=this._generation?this._captureGenerationAssertion():()=>{},a=this._context.configuratorExtensionSelectors.getCanvasSystem(),r=a.r3fHandle$.value??await a.waitForCanvas(),n=this._freezeCanvas(r),o=this._captureQueue,i=()=>{};this._captureQueue=new Promise(e=>{i=e});try{return await o,t(),await this._captureOnCanvas(r,e,t)}finally{i(),await n()}}async _captureOnCanvas(e,t,o){let{gl:i,scene:l,camera:c,size:u,viewport:{dpr:m},setDpr:g,advance:h}=e.get(),d=globalThis.PHX_EXPORT_PIXEL_RATIO??null,f=t.camera,p=f.manual,w=i.getRenderTarget(),_=i.getClearColor(new a),C=i.getClearAlpha(),v=i.autoClearColor,E=e=>new y(t.width,t.height,e,i.outputColorSpace),S={composer:null,pass:null},F=null,I=null,P=e=>{let t=S.pass??E(n);return S.pass=t,S.composer===e&&e.passes.at(-1)===t||(S.composer?.removePass(t),e.addPass(t),S.composer=e),t},T=()=>{null!==S.pass&&(S.composer?.removePass(S.pass),S.pass.dispose(),S.pass=null),F?.dispose(),F=null,I?.dispose(),I=null},z=(e,t,a)=>x(i,e,t,a,()=>{i.setRenderTarget(w),T()},this._captureBuffers??void 0),k=async()=>{if(await this._context.configuratorExtensionSelectors.getCanvasSystem().waitForFlush(),o(),this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value!==e)throw Error("Canvas was remounted while an image was being rendered! The export borrowed a canvas that is gone, so it cannot capture the image. Retry the export once the configurator has settled.")};try{null!==d&&g(d),f.manual=!0,e.set({size:{height:t.height,width:t.width,top:0,left:0,updateStyle:!1}}),e.set({camera:t.camera}),await k(),null!==this._effectComposer&&P(this._effectComposer),h(void 0),await k();let n="JPEG"===t.fileFormat?"image/jpeg":"image/png",o=b({sceneBackground:l.background,backgroundColor:t.backgroundColor,fileFormat:t.fileFormat,outputColorSpace:i.outputColorSpace});if(null!==this._effectComposer){i.setRenderTarget(null),"JPEG"===t.fileFormat?i.setClearColor(t.backgroundColor??0xffffff):t.backgroundColor?i.setClearColor(t.backgroundColor):i.setClearAlpha(0),i.autoClearColor=!0;let e=P(this._effectComposer);return this._effectComposer.render(),await z(e.renderTarget,o,n)}F=E(i.toneMapping),I=new s(t.width,t.height,{samples:4,type:r,stencilBuffer:i.getContextAttributes().stencil??!1});let c=l.background;c instanceof a&&(l.background=null);try{i.setClearColor(0,0),i.setRenderTarget(I),i.clear(),i.render(l,t.camera)}finally{l.background=c}return F.render(i,I),await z(F.renderTarget,o,n)}finally{T(),this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value===e&&(i.setClearColor(_,C),i.autoClearColor=v,i.setRenderTarget(w),e.set({camera:c,size:{...u,updateStyle:!1}}),null!==d&&e.get().setDpr(m)),void 0===p?delete f.manual:f.manual=p}}async generateAndUploadDeclaredClientSideImages(e,t,a={}){let r=this._captureGenerationGuard(),n=await r.waitFor(this.generateDeclaredClientSideImages(e,a));if(a.debug)return n;let o=new Map((await r.waitFor(r.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),t,n.map(e=>e.name))))).map(e=>[e.name,e.url]));return await Promise.all(n.map(async e=>{let t=o.get(e.name);if(!t)throw Error(`Presigned link for image ${e.name} not found!`);await r.waitFor(r.runEffect(()=>fetch(t,{method:"PUT",body:e.blob})))})),n}generateDeclaredClientSideImages(e,t={}){let a=this._context.domainContextSelectors.getComponentReader().readManyComponents({componentTypes:[u]},e);return this.generateImagesFromComponents(a,e,t)}async generateImagesFromComponents(e,t,a={},r={}){this._captureBuffers??={},this._runningBatches+=1;try{return await this._generateImagesFromComponents(e,t,a,r)}finally{this._runningBatches-=1,0===this._runningBatches&&(this._captureBuffers=null)}}async _generateImagesFromComponents(e,t,r,n){let s=this._captureGenerationGuard(),u=!1,_=this._context.domainContextSelectors.getExportStates(),C=e.map(e=>{if(!_.includes(e.state.exportState)){let t=d(e.componentInstance.entityId)?g(e.componentInstance.entityId):"unknown entity",a=e.componentInstance.componentType.name,r=e.componentInstance.instanceName;throw Error(`Export state ${e.state.exportState} declared in component ${a}/${r} on ${t} is not a valid export state. Expected one of: ${_.join(", ")}`)}let n=e.componentInstance.entityId;if(f(n))throw Error("Virtual entities cannot be used for export");return this._context.configuratorExtensionSelectors.getExportSystem().createExportJob(t,{exportState:e.state.exportState,exportedEntityId:n,toolState:e.state.toolState,viewState:e.state.viewState,navigationState:e.state.navigationState,selectedEntityId:t.rootEntityId},async t=>{let g=this._context.domainContextSelectors.getComponentReader().readManyComponents({componentTypes:[m,h,p]},t.state);!u&&g.length>0&&(await new Promise(e=>{l({font:void 0,characters:void 0},e)}),u=!0,await this._context.configuratorExtensionSelectors.getCanvasSystem().waitForFlush());let d=this._context.configuratorExtensionSelectors.getCameraSystem().getActiveCameraConfig(t.state);if(null==d)throw Error(`No camera config is attached for export state ${e.state.exportState} and exported entity ${n}. Whenever using a client-side image component, you need to attach a camera configuration to the export state defined on that componentin the domain spec. This camera will be used to render the image.`);let f=c(d.typeSpecificConfig.cameraType).with("perspective",()=>new i(45,e.state.width/e.state.height,1,1e4)).with("orthographic",()=>new o(0,0,1e4,0,1,1e4)).exhaustive(),_=w(f);await this._context.configuratorExtensionSelectors.getCameraSystem().applyConfig(d,_,!1,{width:e.state.width,height:e.state.height,padding:{top:0,right:0,bottom:0,left:0}}),_.update(1e6),await new Promise(e=>setTimeout(e,100));let C=await s.waitFor(s.runEffect(()=>this.renderImage({width:e.state.width,height:e.state.height,fileFormat:e.state.fileFormat??"JPEG",backgroundColor:e.state.backgroundColor?new a(e.state.backgroundColor):void 0,camera:f})));return r.debug&&s.runEffect(()=>this._openDebugImage(C)),{blob:C,imageComponent:e,name:`${e.componentInstance.componentType.name}-${e.componentInstance.entityId}-${e.componentInstance.instanceName}`}})});if(0===C.length)return this._context.configuratorExtensionSelectors.getExportSystem().runExportJobs(C,n);let y=this._context.configuratorExtensionSelectors.getCanvasSystem(),x=y.r3fHandle$.value??await s.waitFor(y.waitForCanvas().catch(e=>{throw s.assertActive(),e})),b=this._freezeCanvas(x);try{return await this._context.configuratorExtensionSelectors.getExportSystem().runExportJobs(C,n)}finally{await b()}}initialize=()=>{for(let e of(null!==this._generation&&(this._generation.active=!1),this._debugObjectUrls))URL.revokeObjectURL(e);this._debugObjectUrls.clear(),this._generation={active:!0}}}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type $DomainEntity, type ActionTypes, type ConfiguratorBuilder, type CreateCustomPhoenixEntityElement, type CreateCustomPhoenixLayoutElement, type CreateGetThemeHandler, type CreateGetWebComponentOptionsHandler, type CreatePhoenixHandler, type DomainEntity, type IsCreateRecipeUpdate, type IsReplaceRecipeUpdate, type TransformerBuilder, type TransformerFactory, type UpdateFactory, getIdSequence } from '#package/domain';
|
|
2
|
-
import { type CreateAddEntityFab, type CreateAppLoader, type CreateCollectFrontendDataHandler, type CreateConfigurationNotFoundPage, type CreateConfiguratorErrorPage, type CreateDeleteEntityFab, type CreateFilterPublishedChunksHandler, type CreateNavigationHotspot, type CreateNotAuthenticatedPage, type CreateOnApplicationStartProvider, type CreateOnBackendDataReadyProvider, type CreateOnConfiguratorReadyProvider, type CreateOnFrontendDataReadyProvider, type CreateOnGoToIndexHandler, type CreateOnPresetLoadedHandler, type CreateOnPublishedDataReadyProvider, type CreateOnRoutingReadyProvider, type CreateOnSessionReadyProvider, type CreatePresetUi, type CreateSelectionHotspot, type CreateToolMenuFab, type IsAngleDimensionUpdate, type IsAttributeSelectionUpdate, type IsAttributeSwitchUpdate, type IsDeleteEntityUpdate, type IsDistanceDimensionUpdate, type IsGenericDimensionUpdate, type IsSwatchSelectionUpdate, type IsTextValueUpdate, type UseAccessService, type UseActiveNavigationState, type UseActiveToolState, type UseActiveViewState, type UseActiveViewports, type UseAnalyticsService, type UseAngleDimension, type UseAttributeSelection, type UseAttributeSwitch, type UseAuthenticatedClient, type UseAuthorizedClient, type UseBackendData, type UseChildEntitySelection, type UseComponent, type UseComponents, type UseComposition, type UseConfigurationId, type UseConfigurationSaveState, type UseConfiguratorMessages, type UseConfiguratorRouting, type UseControlViolations, type UseCookRecipes, type UseCookReplaceRecipes, type UseCookedRecipes, type UseCookedReplaceRecipes, type UseCreateAuthorizedClient, type UseDeleteEntity, type UseDeletedEntity, type UseDeselect, type UseDistanceDimension, type UseDistanceDimensionSelection, type UseDomainApplicationContext, type UseDomainApplicationProps, type UseDomainContext, type UseDomainEntityState, type UseEntityPrice, type UseEntitySelector, type UseFinalizeAction, type UseFinalizeActions, type UseFinalizeViolations, type UseFirstComponent, type UseFirstRootComponent, type UseFrontendData, type UseGenericDimension, type UseGroupedRecipeOptions, type UseHoveredDomainEntityId, type UseHoveredEntity, type UseHoveredEntityId, type UseIntegrationService, type UseIntegrationState, type UseIsFullscreenActive, type UseLoadedData, type UseLoadingState, type UseLocaleSwitch, type UseMapViolationHints, type UseNavigate, type UsePopNavigate, type UsePresetEmbeddedState, type UsePresetSelection, type UsePublishedData, type UsePushNavigate, type UseRecipeEmbeddedState, type UseReplaceEntityRecipeOptions, type UseRootComponents, type UseRootEntityId, type UseRootEntityPrice, type UseRootEntitySelector, type UseRootEntityState, type UseSelectEntity, type UseSelectParent, type UseSelectedDomainEntityId, type UseSelectedEntity, type UseSelectedEntityId, type UseSession, type UseSessionRole, type UseSessionService, type UseSetFullscreen, type UseSetViewState, type UseShareLinks, type UseSlice, type UseState, type UseStateValidity, type UseStepNavigation, type UseSwatchSelection, type UseSynchronizedSelector, type UseSynchronizedSelector$, type UseTabNavigation, type UseTextValue, type UseUndoRedo, type UseUpdateControl, type UseUpdatedControl, useGenerateShareLink, useLoadingStateValue, useLocalizable, useResolveLocalizable } from '#package/react-sdk';
|
|
2
|
+
import { type CreateAccessDeniedPage, type CreateAddEntityFab, type CreateAppLoader, type CreateCollectFrontendDataHandler, type CreateConfigurationNotFoundPage, type CreateConfiguratorErrorPage, type CreateDeleteEntityFab, type CreateFilterPublishedChunksHandler, type CreateNavigationHotspot, type CreateNotAuthenticatedPage, type CreateOnApplicationStartProvider, type CreateOnBackendDataReadyProvider, type CreateOnConfiguratorReadyProvider, type CreateOnFrontendDataReadyProvider, type CreateOnGoToIndexHandler, type CreateOnPresetLoadedHandler, type CreateOnPublishedDataReadyProvider, type CreateOnRoutingReadyProvider, type CreateOnSessionReadyProvider, type CreatePresetUi, type CreateSelectionHotspot, type CreateToolMenuFab, type IsAngleDimensionUpdate, type IsAttributeSelectionUpdate, type IsAttributeSwitchUpdate, type IsDeleteEntityUpdate, type IsDistanceDimensionUpdate, type IsGenericDimensionUpdate, type IsSwatchSelectionUpdate, type IsTextValueUpdate, type UseAccessService, type UseActiveNavigationState, type UseActiveToolState, type UseActiveViewState, type UseActiveViewports, type UseAnalyticsService, type UseAngleDimension, type UseAttributeSelection, type UseAttributeSwitch, type UseAuthenticatedClient, type UseAuthorizedClient, type UseBackendData, type UseChildEntitySelection, type UseComponent, type UseComponents, type UseComposition, type UseConfigurationId, type UseConfigurationSaveState, type UseConfiguratorMessages, type UseConfiguratorRouting, type UseControlViolations, type UseCookRecipes, type UseCookReplaceRecipes, type UseCookedRecipes, type UseCookedReplaceRecipes, type UseCreateAuthorizedClient, type UseDeleteEntity, type UseDeletedEntity, type UseDeselect, type UseDistanceDimension, type UseDistanceDimensionSelection, type UseDomainApplicationContext, type UseDomainApplicationProps, type UseDomainContext, type UseDomainEntityState, type UseEntityPrice, type UseEntitySelector, type UseFinalizeAction, type UseFinalizeActions, type UseFinalizeViolations, type UseFirstComponent, type UseFirstRootComponent, type UseFrontendData, type UseGenericDimension, type UseGroupedRecipeOptions, type UseHoveredDomainEntityId, type UseHoveredEntity, type UseHoveredEntityId, type UseIntegrationService, type UseIntegrationState, type UseIsFullscreenActive, type UseLoadedData, type UseLoadingState, type UseLocaleSwitch, type UseMapViolationHints, type UseNavigate, type UsePopNavigate, type UsePresetEmbeddedState, type UsePresetSelection, type UsePublishedData, type UsePushNavigate, type UseRecipeEmbeddedState, type UseReplaceEntityRecipeOptions, type UseRootComponents, type UseRootEntityId, type UseRootEntityPrice, type UseRootEntitySelector, type UseRootEntityState, type UseSelectEntity, type UseSelectParent, type UseSelectedDomainEntityId, type UseSelectedEntity, type UseSelectedEntityId, type UseSession, type UseSessionRole, type UseSessionService, type UseSetFullscreen, type UseSetViewState, type UseShareLinks, type UseSignIn, type UseSlice, type UseState, type UseStateValidity, type UseStepNavigation, type UseSwatchSelection, type UseSynchronizedSelector, type UseSynchronizedSelector$, type UseTabNavigation, type UseTextValue, type UseUndoRedo, type UseUpdateControl, type UseUpdatedControl, useActiveViewChildState, useGenerateShareLink, useLoadingStateValue, useLocalizable, useResolveLocalizable } from '#package/react-sdk';
|
|
3
3
|
import { type CreatePhoenixIconSet } from '#package/ui-sdk';
|
|
4
4
|
import { type UseConfiguratorExtensions, createActionFactory } from '../application-runtime/index.js';
|
|
5
5
|
import { usePreview, usePropertyPageStack, usePropertyPageState } from '../configurator-context/index.js';
|
|
@@ -181,6 +181,11 @@ export interface ConfiguratorInterface<ENTITIES extends DomainEntity<string>, AL
|
|
|
181
181
|
* Creates a custom page shown when session authentication fails.
|
|
182
182
|
*/
|
|
183
183
|
createNotAuthenticatedPage: CreateNotAuthenticatedPage;
|
|
184
|
+
/**
|
|
185
|
+
* Creates the page shown when a Studio-account sign-in is refused: the account is not invited, or the project's
|
|
186
|
+
* signed-in handler refused it. Replaces the built-in access-denied page of the Studio-account sign-in page.
|
|
187
|
+
*/
|
|
188
|
+
createAccessDeniedPage: CreateAccessDeniedPage;
|
|
184
189
|
/**
|
|
185
190
|
* Creates the page shown when a configuration cannot be loaded or opened, replacing the built-in
|
|
186
191
|
* `ConfigurationNotFoundPage`.
|
|
@@ -261,6 +266,11 @@ export interface ConfiguratorInterface<ENTITIES extends DomainEntity<string>, AL
|
|
|
261
266
|
* Internal hook to access the session service in the initialization code.
|
|
262
267
|
*/
|
|
263
268
|
useSessionService: UseSessionService;
|
|
269
|
+
/**
|
|
270
|
+
* The Studio-account sign-in: its state (signing in, refused, failed), the person signed in, and `signIn` and
|
|
271
|
+
* `signOut`, for a project's own sign-in page or account control.
|
|
272
|
+
*/
|
|
273
|
+
useSignIn: UseSignIn;
|
|
264
274
|
/**
|
|
265
275
|
* Domain context with all typesd domain systems
|
|
266
276
|
*/
|
|
@@ -517,6 +527,8 @@ export interface ConfiguratorInterface<ENTITIES extends DomainEntity<string>, AL
|
|
|
517
527
|
* Get the currently active view state
|
|
518
528
|
*/
|
|
519
529
|
useActiveViewState: UseActiveViewState<VIEW_STATES>;
|
|
530
|
+
/** Current runtime choice within the declared view. */
|
|
531
|
+
useActiveViewChildState: typeof useActiveViewChildState;
|
|
520
532
|
/**
|
|
521
533
|
* Make the given view state the active one
|
|
522
534
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createCustomPhoenixEntityElement as e,createCustomPhoenixLayoutElement as t,createGetThemeHandler as o,createGetWebComponentOptionsHandler as r,createPhoenixHandler as i,createTransformer as n,createTransformerBuilder as s,createUpdateFactory as m,getIdSequence as a,isCreateEntityUpdate as p,isReplaceEntityUpdate as d}from"#package/domain";import{
|
|
1
|
+
import{createCustomPhoenixEntityElement as e,createCustomPhoenixLayoutElement as t,createGetThemeHandler as o,createGetWebComponentOptionsHandler as r,createPhoenixHandler as i,createTransformer as n,createTransformerBuilder as s,createUpdateFactory as m,getIdSequence as a,isCreateEntityUpdate as p,isReplaceEntityUpdate as d}from"#package/domain";import{createAccessDeniedPage as c,createAddEntityFab as u,createAppLoader as f,createCollectFrontendDataHandler as l,createConfigurationNotFoundPage as g,createConfiguratorErrorPage as j,createDeleteEntityFab as x,createFilterPublishedChunksHandler as k,createNavigationHotspot as y,createNotAuthenticatedPage as A,createOnApplicationStartProvider as I,createOnBackendDataReadyProvider as C,createOnConfiguratorReadyProvider as S,createOnFrontendDataReadyProvider as w,createOnGoToIndexHandler as E,createOnPresetLoadedHandler as b,createOnPublishedDataReadyProvider as q,createOnRoutingReadyProvider as B,createOnSessionReadyProvider as P,createPresetUi as R,createSelectionHotspot as U,createToolMenuFab as h,isAngleDimensionUpdate as v,isAttributeSelectionUpdate as z,isAttributeSwitchUpdate as D,isDeleteEntityUpdate as F,isDistanceDimensionUpdate as G,isGenericDimensionUpdate as H,isSwatchSelectionUpdate as J,isTextValueUpdate as K,useAccessService as L,useActiveNavigationState as M,useActiveToolState as N,useActiveViewChildState as O,useActiveViewState as Q,useActiveViewports as T,useAnalyticsService as V,useAngleDimension as W,useAttributeSelection as X,useAttributeSwitch as Y,useAuthenticatedClient as Z,useAuthorizedClient as $,useBackendData as _,useChildEntitySelection as ee,useCommittedSlice as et,useCommittedState as eo,useComponent as er,useComponents as ei,useComposition as en,useConfigurationId as es,useConfigurationSaveState as em,useConfiguratorMessages as ea,useConfiguratorRouting as ep,useControlViolations as ed,useCookRecipes as ec,useCookReplaceRecipes as eu,useCookedRecipes as ef,useCookedReplaceRecipes as el,useCreateAuthorizedClient as eg,useDeleteEntity as ej,useDeletedEntity as ex,useDeselect as ek,useDistanceDimension as ey,useDistanceDimensionSelection as eA,useDomain as eI,useDomainApplication as eC,useDomainApplicationProps as eS,useDomainEntityRenderedState as ew,useDomainEntityState as eE,useEntityPrice as eb,useEntitySelector as eq,useFinalizeAction as eB,useFinalizeActions as eP,useFinalizeViolations as eR,useFirstComponent as eU,useFirstRenderedComponent as eh,useFirstRootComponent as ev,useFirstRootRenderedComponent as ez,useFrontendData as eD,useGenerateShareLink as eF,useGenericDimension as eG,useGroupedRecipeOptions as eH,useHoveredDomainEntityId as eJ,useHoveredEntity as eK,useHoveredEntityId as eL,useIntegrationService as eM,useIntegrationState as eN,useIsFullscreenActive as eO,useLoadedData as eQ,useLoadingState as eT,useLoadingStateValue as eV,useLocaleSwitch as eW,useLocalizable as eX,useMapViolationHints as eY,useNavigate as eZ,usePopNavigate as e$,usePresetEmbeddedState as e_,usePresetSelection as e0,usePublishedData as e1,usePushNavigate as e2,useRecipeEmbeddedState as e3,useRenderedComponent as e4,useRenderedComponents as e5,useRenderedEntitySelector as e6,useRenderedRootEntitySelector as e7,useRenderedSelector as e8,useRenderedSelector$ as e9,useRenderedSlice as te,useRenderedState as tt,useReplaceEntityRecipeOptions as to,useResolveLocalizable as tr,useRootComponents as ti,useRootEntityId as tn,useRootEntityPrice as ts,useRootEntityRenderedId as tm,useRootEntityRenderedState as ta,useRootEntitySelector as tp,useRootEntityState as td,useRootRenderedComponents as tc,useSelectEntity as tu,useSelectParent as tf,useSelectedDomainEntityId as tl,useSelectedEntity as tg,useSelectedEntityId as tj,useSession as tx,useSessionRole as tk,useSessionService as ty,useSetFullscreen as tA,useSetViewState as tI,useShareLinks as tC,useSignIn as tS,useStateValidity as tw,useStepNavigation as tE,useStoreSelector as tb,useStoreSelector$ as tq,useSwatchSelection as tB,useTabNavigation as tP,useTextValue as tR,useUndoRedo as tU,useUpdateControl as th,useUpdatedControl as tv}from"#package/react-sdk";import{createPhoenixIconSet as tz}from"#package/ui-sdk";import{createActionFactory as tD,useConfigurator as tF}from"../application-runtime/index.js";import{usePreview as tG,usePropertyPageStack as tH,usePropertyPageState as tJ}from"../configurator-context/index.js";import{useCloseAction as tK}from"../integration/index.js";import{createGetTextureProcessingMapHandler as tL}from"../scene/index.js";import{useUpdateEntityObjectSelection as tM}from"../scene/scene-entity/drag-and-drop/use-updated-selection.js";import{useAssistantPanel as tN,useMeasurements as tO,useToolbarActions as tQ}from"../toolbar-actions/index.js";import{LayoutSlots as tT,createCanvasLoader as tV,createLayoutAdminUi as tW,createLayoutCustomOwnerUi as tX,createLayoutCustomReadUi as tY,createLayoutDialog as tZ,createLayoutFooter as t$,createLayoutToolbarDesktop as t_,createLayoutToolbarDesktopFullScreen as t0,createLayoutToolbarReadDesktop as t1,createLayoutToolbarReadDesktopFullScreen as t2,createLayoutUserUi as t3,createToolbarHelp as t4,useAssistantComposer as t5,useAssistantThread as t6,useSceneSafeArea as t7}from"../ui/index.js";import{createPresetDeviceNotSupported as t8,createPresetPageAction as t9}from"../ui/preset-layout/PresetUi.js";import{useResetCamera as oe}from"./use-reset-camera.js";export const createConfiguratorInterface=ot=>({updates:m(),getIdSequence:a,createGetWebComponentOptionsHandler:r,createGetThemeHandler:o,createPhoenixHandler:i,createCustomPhoenixEntityElement:e,createCustomPhoenixLayoutElement:t,createPhoenixIconSet:tz,createGetTextureProcessingMapHandler:tL,createCollectFrontendDataHandler:l,createFilterPublishedChunksHandler:k,createOnGoToIndexHandler:E,createOnApplicationStartProvider:I,createOnSessionReadyProvider:P,createOnPublishedDataReadyProvider:q,createOnFrontendDataReadyProvider:w,createOnBackendDataReadyProvider:C,createOnRoutingReadyProvider:B,createOnConfiguratorReadyProvider:S,createOnPresetLoadedHandler:b,createPresetUi:R,createPresetPageAction:t9,createPresetDeviceNotSupported:t8,createLayoutFooter:t$,createAppLoader:f,createCanvasLoader:tV,createLayoutDialog:tZ,createLayoutToolbarDesktop:t_,createLayoutToolbarDesktopFullScreen:t0,createLayoutToolbarReadDesktop:t1,createLayoutToolbarReadDesktopFullScreen:t2,createLayoutCustomOwnerUi:tX,createLayoutCustomReadUi:tY,createLayoutAdminUi:tW,createLayoutUserUi:t3,createToolbarHelp:t4,createNotAuthenticatedPage:A,createAccessDeniedPage:c,createConfigurationNotFoundPage:g,createConfiguratorErrorPage:j,createAddEntityFab:u,createDeleteEntityFab:x,createSelectionHotspot:U,createNavigationHotspot:y,createToolMenuFab:h,createTransformer:n,transformerBuilder:s(),useAnalytics:V,useAuthenticatedClient:Z,useAuthorizedClient:$,useCreateAuthorizedClient:eg,useAccessService:L,useConfigurationId:es,useSession:tx,useSessionRole:tk,useSessionService:ty,useSignIn:tS,useDomain:eI,useDomainApplication:eC,useConfigurator:tF,implementActions:tD(),useConfiguratorRouting:ep,usePresetSelection:e0,usePublishedData:e1,useFrontendData:eD,useBackendData:_,useDomainApplicationProps:eS,useLoadedData:eQ,useIntegrationService:eM,useIntegrationState:eN,usePresetEmbeddedState:e_,useRecipeEmbeddedState:e3,useCommittedSlice:et,useRenderedSlice:te,useCommittedState:eo,useRenderedState:tt,useStoreSelector:tb,useRenderedSelector:e8,useStoreSelector$:tq,useRenderedSelector$:e9,useEntitySelector:eq,useRenderedEntitySelector:e6,useRootEntitySelector:tp,useRenderedRootEntitySelector:e7,useStateValidity:tw,useMapViolationHints:eY,useNavigate:eZ,usePopNavigate:e$,usePushNavigate:e2,useControlViolations:ed,useFinalizeViolations:eR,useConfiguratorMessages:ea,useConfigurationSaveState:em,useFinalizeAction:eB,useFinalizeActions:eP,useComponent:er,useRenderedComponent:e4,useComponents:ei,useRenderedComponents:e5,useFirstComponent:eU,useFirstRenderedComponent:eh,useRootComponents:ti,useRootRenderedComponents:tc,useFirstRootComponent:ev,useFirstRootRenderedComponent:ez,useEntityState:eE,useEntityRenderedState:ew,useRootEntityState:td,useRootEntityRenderedState:ta,useRootEntityId:tn,useRootEntityRenderedId:tm,useEntityPrice:eb,useRootEntityPrice:ts,useSelectedEntity:tg,useSelectedEntityId:tj,useSelectedDomainEntityId:tl,useSelectEntity:tu,useDeselect:ek,useSelectParent:tf,useHoveredEntity:eK,useHoveredEntityId:eL,useHoveredDomainEntityId:eJ,useActiveNavigationState:M,useActiveViewState:Q,useActiveViewChildState:O,useSetViewState:tI,useActiveToolState:N,useIsFullscreenActive:eO,useSetFullscreen:tA,useResetCamera:oe,useUndoRedo:tU,useTabNavigation:tP,useStepNavigation:tE,useSceneSafeArea:t7,useActiveViewports:T,usePreview:tG,useCloseAction:tK,useIsCloningAllowed:tT.useIsCloningAllowed,useResolveLocalizable:tr,useLocalizable:eX,useToolbarActions:tQ,useMeasurements:tO,useLocaleSwitch:eW,useShareLinks:tC,useAssistantPanel:tN,useAssistantThread:t6,useAssistantComposer:t5,useComposition:en,useUpdateControl:th,useUpdatedControl:tv,useCookRecipes:ec,useCookedRecipes:ef,useCookReplaceRecipes:eu,useCookedReplaceRecipes:el,useDeleteEntity:ej,useDeletedEntity:ex,useSwatchSelection:tB,useTextValue:tR,useAttributeSelection:X,useAttributeSwitch:Y,useDistanceDimension:ey,useDistanceDimensionSelection:eA,useGenericDimension:eG,useAngleDimension:W,useChildEntitySelection:ee,useGroupedRecipeOptions:eH,useReplaceEntityRecipeOptions:to,useUpdateEntityObjectSelection:tM,useGenerateShareLink:eF,useLoadingState:eT,useLoadingStateValue:eV,usePropertyPageStack:tH,usePropertyPageState:tJ,isCreateEntityUpdate:p,isReplaceEntityUpdate:d,isDeleteEntityUpdate:F,isAngleDimensionUpdate:v,isDistanceDimensionUpdate:G,isGenericDimensionUpdate:H,isAttributeSelectionUpdate:z,isAttributeSwitchUpdate:D,isTextValueUpdate:K,isSwatchSelectionUpdate:J});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,Fragment as e}from"react/jsx-runtime";import{useFrame as n}from"@react-three/fiber";import{memo as r,useEffect as o}from"react";import{sceneEntityAnimationComponent as a}from"#package/domain";import{useComponents as m}from"#package/react-sdk";import{useConfigurator as
|
|
1
|
+
import{jsx as t,Fragment as e}from"react/jsx-runtime";import{useFrame as n}from"@react-three/fiber";import{memo as r,useEffect as o}from"react";import{sceneEntityAnimationComponent as a}from"#package/domain";import{useComponents as m,useResourceUrl as i}from"#package/react-sdk";import{useConfigurator as p}from"../../application-runtime/index.js";import{usePhxGltf as s}from"../resources/use-phx-gltf.js";export const Animation=r(t=>{let{animationComponent:e}=t,{animationSystem:n}=p(),{getResourceUrl:r}=i(),{animations:a}=s(r(e.state.fileUrl));return o(()=>{let t=n.registerAnimation({name:e.state.name,animations:a,type:e.state.type,timeScale:e.state.timeScale});return()=>{t()}},[e,a,n]),null});export const Animations=()=>{let{animationSystem:r}=p(),o=m({componentTypes:[a]});return n((t,e)=>{r.update(e)}),t(e,{children:o.map(e=>t(Animation,{animationComponent:e},e.componentInstance.instanceName+e.componentInstance.entityId.toString()))})};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pushes the layout's canvas padding into `CameraControlSystem`, which fits the camera against it and
|
|
3
|
+
* eases the view offset toward it, so the scene glides into a new framing (preview/layout transition,
|
|
4
|
+
* resize, sidebar toggle) instead of snapping.
|
|
5
|
+
*/
|
|
1
6
|
export declare const CameraPadding: () => null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useEffect as r}from"react";import{useResponsive as a}from"#package/ui-sdk";import{useConfigurator as t}from"../../application-runtime/index.js";export const CameraPadding=()=>{let{cameraControlSystem:i}=t(),{canvasPadding:e}=a();return r(()=>{i.setCanvasPadding(e)},[i,e]),null};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLoader as e}from"@react-three/fiber";import{DRACOLoader as t,GLTFLoader as r,MeshoptDecoder as
|
|
1
|
+
import{useLoader as e}from"@react-three/fiber";import{DRACOLoader as t,GLTFLoader as r,MeshoptDecoder as o}from"three-stdlib";let s={wasm:null,js:null},l=e=>{let r="js"===globalThis.PHX_GLTF_DECODER?"js":"wasm";e.setDRACOLoader((e=>{let r=s[e];if(!r){let o,l,i,c,a;(l=new t).setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.7/"),void 0!==globalThis.PHX_GLTF_DECODER_WORKER_LIMIT&&l.setWorkerLimit(globalThis.PHX_GLTF_DECODER_WORKER_LIMIT),"js"===e&&l.setDecoderConfig({type:"js"}),i=l.decodeGeometry.bind(l),c=0,a=()=>{0==(c-=1)&&(o=setTimeout(()=>l.dispose(),1e3))},l.decodeGeometry=(e,t)=>{let r;clearTimeout(o),c+=1;try{r=i(e,t)}catch(e){throw a(),e}return r.then(a,a),r},r=l,s[e]=r}return r})(r)),"wasm"===r&&e.setMeshoptDecoder("function"==typeof o?o():o)};export const usePhxGltf=Object.assign(function(t){return e(r,t,l)},{preload(t){e.preload(r,t,l)},clear(t){e.clear(r,t)}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as a,Fragment as r}from"react/jsx-runtime";import{memo as t,useEffect as m,useMemo as o}from"react";import{MeshPhysicalMaterial as
|
|
1
|
+
import{jsx as e,jsxs as a,Fragment as r}from"react/jsx-runtime";import{memo as t,useEffect as m,useMemo as o}from"react";import{MeshPhysicalMaterial as i,MeshStandardMaterial as n}from"three";import{useCombinedQueries as s,useResourceQueryFactories as c}from"../../resources/index.js";import{applyRemoteMaterialOverride as l,cloneReplacementTexture as p,getMaterialOverrideTextureNames as f}from"./RemoteReplacedMaterial.js";import{ReplacedMaterialTransformations as d}from"./ReplacedMaterialTransformer.js";import{ReplacedMaterialTransitions as j}from"./ReplacedMaterialTransition.js";import{MATERIAL_KEEP_MS as x,useDisposeReplaced as M}from"./use-dispose-replaced.js";export const createLocalMaterial=(e,a,r)=>{let t="physical"===e.state.materialType?new i:new n;return l(e,t,a,r),t};export const LocalCreatedMaterial=t(t=>{let{overrideComponent:i,original:n,object:l}=t,u=o(()=>f(i),[i]),{createTextureQuery:N}=c(),R=s(u.map(N)),h=o(()=>R.map(p),[R]),L=o(()=>createLocalMaterial(i,u,h),[i,u,h]);return m(()=>(l.material=L,l.material.name=n.name,()=>{l.material=n}),[l,n,L]),M(L,x),M(h),a(r,{children:[e(d,{material:L,instanceName:i.componentInstance.instanceName}),e(j,{material:L,instanceName:i.componentInstance.instanceName})]})});
|
|
@@ -5,6 +5,11 @@ export type DeclarativeMaterialOverrideComponent = SceneEntityRemoteMaterialOver
|
|
|
5
5
|
export type DeclarativeMaterialOverrideSnapshot = ComponentSnapshot<DeclarativeMaterialOverrideComponent>;
|
|
6
6
|
export declare const applyRemoteMaterialOverride: (override: DeclarativeMaterialOverrideSnapshot, material: Material, textureNames: readonly string[], textures: readonly Texture[]) => void;
|
|
7
7
|
export declare const getMaterialOverrideTextureNames: (override: DeclarativeMaterialOverrideSnapshot) => string[];
|
|
8
|
+
/**
|
|
9
|
+
* Clones a cached texture for one replaced material. `Texture.clone()` marks the shared image source
|
|
10
|
+
* as changed, which makes three.js upload the cached image again; keep its version so it is not.
|
|
11
|
+
*/
|
|
12
|
+
export declare const cloneReplacementTexture: (texture: Texture) => Texture;
|
|
8
13
|
export interface RemoteReplacedMaterialProps {
|
|
9
14
|
overrideComponent: ComponentSnapshot<SceneEntityRemoteMaterialOverrideComponent | SceneEntityObjectRemoteMaterialOverrideComponent>;
|
|
10
15
|
original: Material;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import s from"lodash-es/isNumber.js";import{memo as r,useEffect as n,useMemo as o}from"react";import{Color as i,RepeatWrapping as l}from"three";import{isRemoteMaterialOverrideComponent as c}from"#package/domain";import{useResourceUrl as p}from"#package/react-sdk";import{useCombinedQueries as M,usePhxGltf as m,useResourceQueryFactories as d}from"../../resources/index.js";import{isPhysicalMaterial as h,isStandardMaterial as u,isWithColor as v}from"../../three/with-material.js";import{ReplacedMaterialTransformations as U}from"./ReplacedMaterialTransformer.js";import{ReplacedMaterialTransitions as y}from"./ReplacedMaterialTransition.js";export const applyRemoteMaterialOverride=(e,t,a,r)=>{let n=t=>{let{offsetX:a,offsetY:r,rotation:n,rotationCenterX:o,rotationCenterY:i,repeatX:c,repeatY:p}=e.state,M=s(a)||s(r),m=s(n),d=s(c)||s(p);return M&&t.offset.set(a??0,r??0),m&&(t.rotation=n,t.center.set(o??0,i??0)),d&&(t.repeat.set(c??1,p??1),t.wrapS=l,t.wrapT=l),t},o=(e,t)=>{if(null===e)t(null);else if(e){let s=r[a.findIndex(t=>t===e)];s&&t(n(s))}};if((u(t)||h(t))&&(o(e.state.textureUrl,e=>{t.map=e}),e.state.color&&t.color.set(new i(e.state.color)),o(e.state.roughnessMapUrl,e=>{t.roughnessMap=e}),s(e.state.roughness)&&(t.roughness=e.state.roughness),o(e.state.bumpMapUrl,e=>{t.bumpMap=e}),s(e.state.bumpScale)&&(t.bumpScale=e.state.bumpScale),o(e.state.metalnessMapUrl,e=>{t.metalnessMap=e}),s(e.state.metalness)&&(t.metalness=e.state.metalness),s(e.state.envMapIntensity)&&(t.envMapIntensity=e.state.envMapIntensity),void 0!==e.state.toneMapped&&(t.toneMapped=e.state.toneMapped),void 0!==e.state.emissive&&t.emissive.set(new i(e.state.emissive)),void 0!==e.state.emissiveIntensity&&(t.emissiveIntensity=e.state.emissiveIntensity),o(e.state.alphaMapUrl,e=>{t.alphaMap=e}),void 0!==e.state.transparent&&(t.transparent=e.state.transparent),s(e.state.opacity)&&(t.opacity=e.state.opacity),o(e.state.aoMapUrl,e=>{t.aoMap=e}),s(e.state.aoMapIntensity)&&(t.aoMapIntensity=e.state.aoMapIntensity),o(e.state.displacementMapUrl,e=>{t.displacementMap=e}),s(e.state.displacementScale)&&(t.displacementScale=e.state.displacementScale),o(e.state.lightMapUrl,e=>{t.lightMap=e}),s(e.state.lightMapIntensity)&&(t.lightMapIntensity=e.state.lightMapIntensity),o(e.state.envMapUrl,e=>{t.envMap=e}),s(e.state.envMapIntensity)&&(t.envMapIntensity=e.state.envMapIntensity),s(e.state.blendingMode)&&(t.blending=e.state.blendingMode),o(e.state.normalMapUrl,e=>{t.normalMap=e}),s(e.state.normalScale)&&t.normalScale.set(e.state.normalScale,e.state.normalScale),void 0!==e.state.wireframe&&(t.wireframe=e.state.wireframe)),h(t)){void 0!==e.state.clearcoat&&(t.clearcoat=e.state.clearcoat),void 0!==e.state.clearcoatRoughness&&(t.clearcoatRoughness=e.state.clearcoatRoughness),void 0!==e.state.iridescence&&(t.iridescence=e.state.iridescence),void 0!==e.state.iridescenceIor&&(t.iridescenceIOR=e.state.iridescenceIor),s(e.state.sheen)&&(t.sheen=e.state.sheen),void 0!==e.state.sheenColor&&v(t)&&t.sheenColor.set(new i(e.state.sheenColor)),s(e.state.sheenRoughness)&&(t.sheenRoughness=e.state.sheenRoughness),o(e.state.anisotropyMapUrl,e=>{t.anisotropyMap=e}),s(e.state.anisotropyStrength)&&(t.anisotropy=e.state.anisotropyStrength),s(e.state.anisotropyRotation)&&(t.anisotropyRotation=e.state.anisotropyRotation),s(e.state.ior)&&(t.ior=e.state.ior),s(e.state.reflectivity)&&(t.reflectivity=e.state.reflectivity),s(e.state.transmission)&&(t.transmission=e.state.transmission),s(e.state.thickness)&&(t.thickness=e.state.thickness),s(e.state.attenuationDistance)&&(t.attenuationDistance=e.state.attenuationDistance),void 0!==e.state.attenuationColor&&t.attenuationColor.set(new i(e.state.attenuationColor)),s(e.state.specularIntensity)&&(t.specularIntensity=e.state.specularIntensity),void 0!==e.state.specularColor&&t.specularColor.set(new i(e.state.specularColor)),o(e.state.specularIntensityMapUrl,e=>{t.specularIntensityMap=e}),o(e.state.specularColorMapUrl,e=>{t.specularColorMap=e}),o(e.state.clearcoatNormalMapUrl,e=>{t.clearcoatNormalMap=e}),s(e.state.clearcoatNormalScale)&&t.clearcoatNormalScale.set(e.state.clearcoatNormalScale,e.state.clearcoatNormalScale),o(e.state.clearcoatMapUrl,e=>{t.clearcoatMap=e}),o(e.state.clearcoatRoughnessMapUrl,e=>{t.clearcoatRoughnessMap=e}),o(e.state.iridescenceMapUrl,e=>{t.iridescenceMap=e});let[a,r]=e.state.iridescenceThicknessRange??[];void 0!==a&&void 0!==r&&(t.iridescenceThicknessRange=[a,r]),o(e.state.iridescenceThicknessMapUrl,e=>{t.iridescenceThicknessMap=e}),o(e.state.sheenColorMapUrl,e=>{t.sheenColorMap=e}),o(e.state.sheenRoughnessMapUrl,e=>{t.sheenRoughnessMap=e}),o(e.state.transmissionMapUrl,e=>{t.transmissionMap=e}),o(e.state.thicknessMapUrl,e=>{t.thicknessMap=e})}if(u(t)&&!h(t)){let a=[void 0!==e.state.clearcoat?"clearcoat":"",void 0!==e.state.clearcoatRoughness?"clearcoatRoughness":"",void 0!==e.state.iridescence?"iridescence":"",void 0!==e.state.iridescenceIor?"iridescenceIor":"",void 0!==e.state.sheen?"sheen":"",void 0!==e.state.sheenColor?"sheenColor":"",void 0!==e.state.sheenRoughness?"sheenRoughness":"",void 0!==e.state.anisotropyMapUrl?"anisotropyMapUrl":"",void 0!==e.state.anisotropyStrength?"anisotropyStrength":"",void 0!==e.state.anisotropyRotation?"anisotropyRotation":"",void 0!==e.state.ior?"ior":"",void 0!==e.state.reflectivity?"reflectivity":"",void 0!==e.state.transmission?"transmission":"",void 0!==e.state.thickness?"thickness":"",void 0!==e.state.attenuationDistance?"attenuationDistance":"",void 0!==e.state.attenuationColor?"attenuationColor":"",void 0!==e.state.specularIntensity?"specularIntensity":"",void 0!==e.state.specularColor?"specularColor":"",void 0!==e.state.specularIntensityMapUrl?"specularIntensityMapUrl":"",void 0!==e.state.specularColorMapUrl?"specularColorMapUrl":"",void 0!==e.state.clearcoatNormalMapUrl?"clearcoatNormalMapUrl":"",void 0!==e.state.clearcoatNormalScale?"clearcoatNormalScale":"",void 0!==e.state.clearcoatMapUrl?"clearcoatMapUrl":"",void 0!==e.state.clearcoatRoughnessMapUrl?"clearcoatRoughnessMapUrl":"",void 0!==e.state.iridescenceMapUrl?"iridescenceMapUrl":"",void 0!==e.state.iridescenceThicknessRange?"iridescenceThicknessRange":"",void 0!==e.state.iridescenceThicknessMapUrl?"iridescenceThicknessMapUrl":"",void 0!==e.state.sheenColorMapUrl?"sheenColorMapUrl":"",void 0!==e.state.sheenRoughnessMapUrl?"sheenRoughnessMapUrl":"",void 0!==e.state.transmissionMapUrl?"transmissionMapUrl":"",void 0!==e.state.thicknessMapUrl?"thicknessMapUrl":""].filter(Boolean);a.length>0&&console.warn(`[Phoenix] Material override properties [${a.join(", ")}] were ignored because the target material "${t.name}" is a MeshStandardMaterial, not a MeshPhysicalMaterial. These properties require MeshPhysicalMaterial. Ensure the source material in the override file uses a physical property (e.g. clearcoat) to trigger MeshPhysicalMaterial.`)}};let
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import s from"lodash-es/isNumber.js";import{memo as r,useEffect as n,useMemo as o}from"react";import{Color as i,RepeatWrapping as l}from"three";import{isRemoteMaterialOverrideComponent as c}from"#package/domain";import{useResourceUrl as p}from"#package/react-sdk";import{useCombinedQueries as M,usePhxGltf as m,useResourceQueryFactories as d}from"../../resources/index.js";import{isPhysicalMaterial as h,isStandardMaterial as u,isWithColor as v}from"../../three/with-material.js";import{ReplacedMaterialTransformations as U}from"./ReplacedMaterialTransformer.js";import{ReplacedMaterialTransitions as y}from"./ReplacedMaterialTransition.js";import{MATERIAL_KEEP_MS as g,useDisposeReplaced as R}from"./use-dispose-replaced.js";export const applyRemoteMaterialOverride=(e,t,a,r)=>{let n=t=>{let{offsetX:a,offsetY:r,rotation:n,rotationCenterX:o,rotationCenterY:i,repeatX:c,repeatY:p}=e.state,M=s(a)||s(r),m=s(n),d=s(c)||s(p);return M&&t.offset.set(a??0,r??0),m&&(t.rotation=n,t.center.set(o??0,i??0)),d&&(t.repeat.set(c??1,p??1),t.wrapS=l,t.wrapT=l),t},o=(e,t)=>{if(null===e)t(null);else if(e){let s=r[a.findIndex(t=>t===e)];s&&t(n(s))}};if((u(t)||h(t))&&(o(e.state.textureUrl,e=>{t.map=e}),e.state.color&&t.color.set(new i(e.state.color)),o(e.state.roughnessMapUrl,e=>{t.roughnessMap=e}),s(e.state.roughness)&&(t.roughness=e.state.roughness),o(e.state.bumpMapUrl,e=>{t.bumpMap=e}),s(e.state.bumpScale)&&(t.bumpScale=e.state.bumpScale),o(e.state.metalnessMapUrl,e=>{t.metalnessMap=e}),s(e.state.metalness)&&(t.metalness=e.state.metalness),s(e.state.envMapIntensity)&&(t.envMapIntensity=e.state.envMapIntensity),void 0!==e.state.toneMapped&&(t.toneMapped=e.state.toneMapped),void 0!==e.state.emissive&&t.emissive.set(new i(e.state.emissive)),void 0!==e.state.emissiveIntensity&&(t.emissiveIntensity=e.state.emissiveIntensity),o(e.state.alphaMapUrl,e=>{t.alphaMap=e}),void 0!==e.state.transparent&&(t.transparent=e.state.transparent),s(e.state.opacity)&&(t.opacity=e.state.opacity),o(e.state.aoMapUrl,e=>{t.aoMap=e}),s(e.state.aoMapIntensity)&&(t.aoMapIntensity=e.state.aoMapIntensity),o(e.state.displacementMapUrl,e=>{t.displacementMap=e}),s(e.state.displacementScale)&&(t.displacementScale=e.state.displacementScale),o(e.state.lightMapUrl,e=>{t.lightMap=e}),s(e.state.lightMapIntensity)&&(t.lightMapIntensity=e.state.lightMapIntensity),o(e.state.envMapUrl,e=>{t.envMap=e}),s(e.state.envMapIntensity)&&(t.envMapIntensity=e.state.envMapIntensity),s(e.state.blendingMode)&&(t.blending=e.state.blendingMode),o(e.state.normalMapUrl,e=>{t.normalMap=e}),s(e.state.normalScale)&&t.normalScale.set(e.state.normalScale,e.state.normalScale),void 0!==e.state.wireframe&&(t.wireframe=e.state.wireframe)),h(t)){void 0!==e.state.clearcoat&&(t.clearcoat=e.state.clearcoat),void 0!==e.state.clearcoatRoughness&&(t.clearcoatRoughness=e.state.clearcoatRoughness),void 0!==e.state.iridescence&&(t.iridescence=e.state.iridescence),void 0!==e.state.iridescenceIor&&(t.iridescenceIOR=e.state.iridescenceIor),s(e.state.sheen)&&(t.sheen=e.state.sheen),void 0!==e.state.sheenColor&&v(t)&&t.sheenColor.set(new i(e.state.sheenColor)),s(e.state.sheenRoughness)&&(t.sheenRoughness=e.state.sheenRoughness),o(e.state.anisotropyMapUrl,e=>{t.anisotropyMap=e}),s(e.state.anisotropyStrength)&&(t.anisotropy=e.state.anisotropyStrength),s(e.state.anisotropyRotation)&&(t.anisotropyRotation=e.state.anisotropyRotation),s(e.state.ior)&&(t.ior=e.state.ior),s(e.state.reflectivity)&&(t.reflectivity=e.state.reflectivity),s(e.state.transmission)&&(t.transmission=e.state.transmission),s(e.state.thickness)&&(t.thickness=e.state.thickness),s(e.state.attenuationDistance)&&(t.attenuationDistance=e.state.attenuationDistance),void 0!==e.state.attenuationColor&&t.attenuationColor.set(new i(e.state.attenuationColor)),s(e.state.specularIntensity)&&(t.specularIntensity=e.state.specularIntensity),void 0!==e.state.specularColor&&t.specularColor.set(new i(e.state.specularColor)),o(e.state.specularIntensityMapUrl,e=>{t.specularIntensityMap=e}),o(e.state.specularColorMapUrl,e=>{t.specularColorMap=e}),o(e.state.clearcoatNormalMapUrl,e=>{t.clearcoatNormalMap=e}),s(e.state.clearcoatNormalScale)&&t.clearcoatNormalScale.set(e.state.clearcoatNormalScale,e.state.clearcoatNormalScale),o(e.state.clearcoatMapUrl,e=>{t.clearcoatMap=e}),o(e.state.clearcoatRoughnessMapUrl,e=>{t.clearcoatRoughnessMap=e}),o(e.state.iridescenceMapUrl,e=>{t.iridescenceMap=e});let[a,r]=e.state.iridescenceThicknessRange??[];void 0!==a&&void 0!==r&&(t.iridescenceThicknessRange=[a,r]),o(e.state.iridescenceThicknessMapUrl,e=>{t.iridescenceThicknessMap=e}),o(e.state.sheenColorMapUrl,e=>{t.sheenColorMap=e}),o(e.state.sheenRoughnessMapUrl,e=>{t.sheenRoughnessMap=e}),o(e.state.transmissionMapUrl,e=>{t.transmissionMap=e}),o(e.state.thicknessMapUrl,e=>{t.thicknessMap=e})}if(u(t)&&!h(t)){let a=[void 0!==e.state.clearcoat?"clearcoat":"",void 0!==e.state.clearcoatRoughness?"clearcoatRoughness":"",void 0!==e.state.iridescence?"iridescence":"",void 0!==e.state.iridescenceIor?"iridescenceIor":"",void 0!==e.state.sheen?"sheen":"",void 0!==e.state.sheenColor?"sheenColor":"",void 0!==e.state.sheenRoughness?"sheenRoughness":"",void 0!==e.state.anisotropyMapUrl?"anisotropyMapUrl":"",void 0!==e.state.anisotropyStrength?"anisotropyStrength":"",void 0!==e.state.anisotropyRotation?"anisotropyRotation":"",void 0!==e.state.ior?"ior":"",void 0!==e.state.reflectivity?"reflectivity":"",void 0!==e.state.transmission?"transmission":"",void 0!==e.state.thickness?"thickness":"",void 0!==e.state.attenuationDistance?"attenuationDistance":"",void 0!==e.state.attenuationColor?"attenuationColor":"",void 0!==e.state.specularIntensity?"specularIntensity":"",void 0!==e.state.specularColor?"specularColor":"",void 0!==e.state.specularIntensityMapUrl?"specularIntensityMapUrl":"",void 0!==e.state.specularColorMapUrl?"specularColorMapUrl":"",void 0!==e.state.clearcoatNormalMapUrl?"clearcoatNormalMapUrl":"",void 0!==e.state.clearcoatNormalScale?"clearcoatNormalScale":"",void 0!==e.state.clearcoatMapUrl?"clearcoatMapUrl":"",void 0!==e.state.clearcoatRoughnessMapUrl?"clearcoatRoughnessMapUrl":"",void 0!==e.state.iridescenceMapUrl?"iridescenceMapUrl":"",void 0!==e.state.iridescenceThicknessRange?"iridescenceThicknessRange":"",void 0!==e.state.iridescenceThicknessMapUrl?"iridescenceThicknessMapUrl":"",void 0!==e.state.sheenColorMapUrl?"sheenColorMapUrl":"",void 0!==e.state.sheenRoughnessMapUrl?"sheenRoughnessMapUrl":"",void 0!==e.state.transmissionMapUrl?"transmissionMapUrl":"",void 0!==e.state.thicknessMapUrl?"thicknessMapUrl":""].filter(Boolean);a.length>0&&console.warn(`[Phoenix] Material override properties [${a.join(", ")}] were ignored because the target material "${t.name}" is a MeshStandardMaterial, not a MeshPhysicalMaterial. These properties require MeshPhysicalMaterial. Ensure the source material in the override file uses a physical property (e.g. clearcoat) to trigger MeshPhysicalMaterial.`)}};let f=["textureUrl","roughnessMapUrl","bumpMapUrl","metalnessMapUrl","anisotropyMapUrl","normalMapUrl","alphaMapUrl","aoMapUrl","displacementMapUrl","lightMapUrl","envMapUrl","specularIntensityMapUrl","specularColorMapUrl","clearcoatNormalMapUrl","clearcoatMapUrl","clearcoatRoughnessMapUrl","iridescenceMapUrl","iridescenceThicknessMapUrl","sheenColorMapUrl","sheenRoughnessMapUrl","transmissionMapUrl","thicknessMapUrl"];export const getMaterialOverrideTextureNames=e=>f.flatMap(t=>{let a=e.state[t];return"string"==typeof a&&""!==a?[a]:[]});export const cloneReplacementTexture=e=>{let t=e.source.version,a=e.clone();return e.source.version=t,a};export const RemoteReplacedMaterial=r(s=>{let{overrideComponent:r,original:i,object:l}=s,{getResourceUrl:h}=p(),u=o(()=>[r].reduce((e,t)=>(c(t)&&e.push(t.state.fileUrl),e),[]),[r]),v=o(()=>getMaterialOverrideTextureNames(r),[r]),f=m(u.map(h)),{createTextureQuery:I}=d(),C=M(v.map(I)),k=o(()=>C.map(cloneReplacementTexture),[C]),S=o(()=>{let e=f[u.findIndex(e=>e===r.state.fileUrl)],t=e?.materials[r.state.materialName];if(null==t)throw Error(`Material with name '${r.state.materialName}' not found in '${r.state.fileUrl}'`);let a=t.clone();return applyRemoteMaterialOverride(r,a,v,k),a},[r,u,f,v,k]);return n(()=>(l.material=S,l.material.name=i.name,()=>{l.material=i}),[l,i,S]),R(S,g),R(k),t(a,{children:[e(U,{material:S,instanceName:r.componentInstance.instanceName}),e(y,{material:S,instanceName:r.componentInstance.instanceName})]})});
|