@cavegiant/cave-world-r3f 1.0.0
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/CHANGELOG.md +25 -0
- package/LICENSE +21 -0
- package/README.md +189 -0
- package/dist/core/connector-label/readiness.d.ts +11 -0
- package/dist/core/connector-label/readiness.d.ts.map +1 -0
- package/dist/core/connector-label/readiness.js +31 -0
- package/dist/core/connector-label/readiness.js.map +1 -0
- package/dist/core/connector-label/types.d.ts +64 -0
- package/dist/core/connector-label/types.d.ts.map +1 -0
- package/dist/core/connector-label/types.js +47 -0
- package/dist/core/connector-label/types.js.map +1 -0
- package/dist/core/context/cave-world-context.d.ts +96 -0
- package/dist/core/context/cave-world-context.d.ts.map +1 -0
- package/dist/core/context/cave-world-context.js +100 -0
- package/dist/core/context/cave-world-context.js.map +1 -0
- package/dist/core/errors.d.ts +34 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +17 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/events/event-bus.d.ts +122 -0
- package/dist/core/events/event-bus.d.ts.map +1 -0
- package/dist/core/events/event-bus.js +62 -0
- package/dist/core/events/event-bus.js.map +1 -0
- package/dist/core/hooks/use-cave-event.d.ts +13 -0
- package/dist/core/hooks/use-cave-event.d.ts.map +1 -0
- package/dist/core/hooks/use-cave-event.js +12 -0
- package/dist/core/hooks/use-cave-event.js.map +1 -0
- package/dist/core/i18n/messages.d.ts +82 -0
- package/dist/core/i18n/messages.d.ts.map +1 -0
- package/dist/core/i18n/messages.js +131 -0
- package/dist/core/i18n/messages.js.map +1 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +47 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/logging/logger.d.ts +29 -0
- package/dist/core/logging/logger.d.ts.map +1 -0
- package/dist/core/logging/logger.js +47 -0
- package/dist/core/logging/logger.js.map +1 -0
- package/dist/core/registry/component-registry.d.ts +41 -0
- package/dist/core/registry/component-registry.d.ts.map +1 -0
- package/dist/core/registry/component-registry.js +34 -0
- package/dist/core/registry/component-registry.js.map +1 -0
- package/dist/core/registry/object-registry.d.ts +38 -0
- package/dist/core/registry/object-registry.d.ts.map +1 -0
- package/dist/core/registry/object-registry.js +32 -0
- package/dist/core/registry/object-registry.js.map +1 -0
- package/dist/explore/cave-explore.d.ts +85 -0
- package/dist/explore/cave-explore.d.ts.map +1 -0
- package/dist/explore/cave-explore.js +204 -0
- package/dist/explore/cave-explore.js.map +1 -0
- package/dist/explore/cave-orbit-viewer.d.ts +76 -0
- package/dist/explore/cave-orbit-viewer.d.ts.map +1 -0
- package/dist/explore/cave-orbit-viewer.js +123 -0
- package/dist/explore/cave-orbit-viewer.js.map +1 -0
- package/dist/explore/characters/character-configs.d.ts +38 -0
- package/dist/explore/characters/character-configs.d.ts.map +1 -0
- package/dist/explore/characters/character-configs.js +45 -0
- package/dist/explore/characters/character-configs.js.map +1 -0
- package/dist/explore/characters/character-controls.d.ts +44 -0
- package/dist/explore/characters/character-controls.d.ts.map +1 -0
- package/dist/explore/characters/character-pose.d.ts +19 -0
- package/dist/explore/characters/character-pose.d.ts.map +1 -0
- package/dist/explore/characters/character-pose.js +13 -0
- package/dist/explore/characters/character-pose.js.map +1 -0
- package/dist/explore/characters/local-character-model.d.ts +53 -0
- package/dist/explore/characters/local-character-model.d.ts.map +1 -0
- package/dist/explore/characters/local-character-model.js +36 -0
- package/dist/explore/characters/local-character-model.js.map +1 -0
- package/dist/explore/characters/mixamo-style-bone-map.d.ts +9 -0
- package/dist/explore/characters/mixamo-style-bone-map.d.ts.map +1 -0
- package/dist/explore/characters/mixamo-style-bone-map.js +28 -0
- package/dist/explore/characters/mixamo-style-bone-map.js.map +1 -0
- package/dist/explore/characters/remote-character-controller.d.ts +38 -0
- package/dist/explore/characters/remote-character-controller.d.ts.map +1 -0
- package/dist/explore/characters/remote-character-controller.js +135 -0
- package/dist/explore/characters/remote-character-controller.js.map +1 -0
- package/dist/explore/characters/remote-character.d.ts +19 -0
- package/dist/explore/characters/remote-character.d.ts.map +1 -0
- package/dist/explore/characters/remote-character.js +63 -0
- package/dist/explore/characters/remote-character.js.map +1 -0
- package/dist/explore/connected-spaces-renderer.d.ts +16 -0
- package/dist/explore/connected-spaces-renderer.d.ts.map +1 -0
- package/dist/explore/connected-spaces-renderer.js +103 -0
- package/dist/explore/connected-spaces-renderer.js.map +1 -0
- package/dist/explore/hooks/use-action-shortcuts.d.ts +16 -0
- package/dist/explore/hooks/use-action-shortcuts.d.ts.map +1 -0
- package/dist/explore/hooks/use-action-shortcuts.js +23 -0
- package/dist/explore/hooks/use-action-shortcuts.js.map +1 -0
- package/dist/explore/hooks/use-active-space-notify.d.ts +11 -0
- package/dist/explore/hooks/use-active-space-notify.d.ts.map +1 -0
- package/dist/explore/hooks/use-active-space-notify.js +17 -0
- package/dist/explore/hooks/use-active-space-notify.js.map +1 -0
- package/dist/explore/hooks/use-character-sync.d.ts +46 -0
- package/dist/explore/hooks/use-character-sync.d.ts.map +1 -0
- package/dist/explore/hooks/use-character-sync.js +72 -0
- package/dist/explore/hooks/use-character-sync.js.map +1 -0
- package/dist/explore/hooks/use-connector-preloader.d.ts +20 -0
- package/dist/explore/hooks/use-connector-preloader.d.ts.map +1 -0
- package/dist/explore/hooks/use-connector-preloader.js +78 -0
- package/dist/explore/hooks/use-connector-preloader.js.map +1 -0
- package/dist/explore/hooks/use-connector-transitions.d.ts +31 -0
- package/dist/explore/hooks/use-connector-transitions.d.ts.map +1 -0
- package/dist/explore/hooks/use-connector-transitions.js +63 -0
- package/dist/explore/hooks/use-connector-transitions.js.map +1 -0
- package/dist/explore/hooks/use-explore-actions.d.ts +17 -0
- package/dist/explore/hooks/use-explore-actions.d.ts.map +1 -0
- package/dist/explore/hooks/use-explore-actions.js +134 -0
- package/dist/explore/hooks/use-explore-actions.js.map +1 -0
- package/dist/explore/hooks/use-load-error-notify.d.ts +11 -0
- package/dist/explore/hooks/use-load-error-notify.d.ts.map +1 -0
- package/dist/explore/hooks/use-load-error-notify.js +18 -0
- package/dist/explore/hooks/use-load-error-notify.js.map +1 -0
- package/dist/explore/hooks/use-primary-space-loader.d.ts +24 -0
- package/dist/explore/hooks/use-primary-space-loader.d.ts.map +1 -0
- package/dist/explore/hooks/use-primary-space-loader.js +29 -0
- package/dist/explore/hooks/use-primary-space-loader.js.map +1 -0
- package/dist/explore/index.d.ts +37 -0
- package/dist/explore/index.d.ts.map +1 -0
- package/dist/explore/index.js +107 -0
- package/dist/explore/index.js.map +1 -0
- package/dist/explore/loaders/cave-loader.d.ts +58 -0
- package/dist/explore/loaders/cave-loader.d.ts.map +1 -0
- package/dist/explore/loaders/cave-loader.js +79 -0
- package/dist/explore/loaders/cave-loader.js.map +1 -0
- package/dist/explore/math/space-transforms.d.ts +49 -0
- package/dist/explore/math/space-transforms.d.ts.map +1 -0
- package/dist/explore/math/space-transforms.js +54 -0
- package/dist/explore/math/space-transforms.js.map +1 -0
- package/dist/explore/overlays/action-bubble.d.ts +8 -0
- package/dist/explore/overlays/action-bubble.d.ts.map +1 -0
- package/dist/explore/overlays/action-bubble.js +18 -0
- package/dist/explore/overlays/action-bubble.js.map +1 -0
- package/dist/explore/overlays/action-panel.d.ts +12 -0
- package/dist/explore/overlays/action-panel.d.ts.map +1 -0
- package/dist/explore/overlays/action-panel.js +69 -0
- package/dist/explore/overlays/action-panel.js.map +1 -0
- package/dist/explore/overlays/connector-label-beacon.d.ts +11 -0
- package/dist/explore/overlays/connector-label-beacon.d.ts.map +1 -0
- package/dist/explore/overlays/connector-label-beacon.js +38 -0
- package/dist/explore/overlays/connector-label-beacon.js.map +1 -0
- package/dist/explore/overlays/connector-label-tag-shell.d.ts +16 -0
- package/dist/explore/overlays/connector-label-tag-shell.d.ts.map +1 -0
- package/dist/explore/overlays/connector-label-tag-shell.js +18 -0
- package/dist/explore/overlays/connector-label-tag-shell.js.map +1 -0
- package/dist/explore/overlays/detail-window.d.ts +9 -0
- package/dist/explore/overlays/detail-window.d.ts.map +1 -0
- package/dist/explore/overlays/detail-window.js +92 -0
- package/dist/explore/overlays/detail-window.js.map +1 -0
- package/dist/explore/overlays/explore-helper.d.ts +44 -0
- package/dist/explore/overlays/explore-helper.d.ts.map +1 -0
- package/dist/explore/overlays/explore-helper.js +57 -0
- package/dist/explore/overlays/explore-helper.js.map +1 -0
- package/dist/explore/overlays/icons.d.ts +16 -0
- package/dist/explore/overlays/icons.d.ts.map +1 -0
- package/dist/explore/overlays/icons.js +34 -0
- package/dist/explore/overlays/icons.js.map +1 -0
- package/dist/explore/overlays/space-load-error-overlay.d.ts +27 -0
- package/dist/explore/overlays/space-load-error-overlay.d.ts.map +1 -0
- package/dist/explore/overlays/space-load-error-overlay.js +24 -0
- package/dist/explore/overlays/space-load-error-overlay.js.map +1 -0
- package/dist/explore/services/websocket.service.d.ts +180 -0
- package/dist/explore/services/websocket.service.d.ts.map +1 -0
- package/dist/explore/services/websocket.service.js +187 -0
- package/dist/explore/services/websocket.service.js.map +1 -0
- package/dist/explore/simple-character.d.ts +46 -0
- package/dist/explore/simple-character.d.ts.map +1 -0
- package/dist/explore/simple-character.js +119 -0
- package/dist/explore/simple-character.js.map +1 -0
- package/dist/explore/stores/action-prompt.store.d.ts +27 -0
- package/dist/explore/stores/action-prompt.store.d.ts.map +1 -0
- package/dist/explore/stores/action-prompt.store.js +14 -0
- package/dist/explore/stores/action-prompt.store.js.map +1 -0
- package/dist/explore/stores/cave-explore.store.d.ts +77 -0
- package/dist/explore/stores/cave-explore.store.d.ts.map +1 -0
- package/dist/explore/stores/cave-explore.store.js +66 -0
- package/dist/explore/stores/cave-explore.store.js.map +1 -0
- package/dist/explore/stores/explore-context.d.ts +35 -0
- package/dist/explore/stores/explore-context.d.ts.map +1 -0
- package/dist/explore/stores/explore-context.js +43 -0
- package/dist/explore/stores/explore-context.js.map +1 -0
- package/dist/explore/styles/cave-world-css.d.ts +10 -0
- package/dist/explore/styles/cave-world-css.d.ts.map +1 -0
- package/dist/explore/styles/cave-world-css.js +935 -0
- package/dist/explore/styles/cave-world-css.js.map +1 -0
- package/dist/explore/styles/inject.d.ts +32 -0
- package/dist/explore/styles/inject.d.ts.map +1 -0
- package/dist/explore/styles/inject.js +40 -0
- package/dist/explore/styles/inject.js.map +1 -0
- package/dist/explore/utils/schedule-idle.d.ts +12 -0
- package/dist/explore/utils/schedule-idle.d.ts.map +1 -0
- package/dist/explore/utils/schedule-idle.js +16 -0
- package/dist/explore/utils/schedule-idle.js.map +1 -0
- package/dist/explore/viewer-shared.d.ts +56 -0
- package/dist/explore/viewer-shared.d.ts.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/space/cave-base-layer.d.ts +42 -0
- package/dist/space/cave-base-layer.d.ts.map +1 -0
- package/dist/space/cave-base-layer.js +221 -0
- package/dist/space/cave-base-layer.js.map +1 -0
- package/dist/space/cave-custom-layer.d.ts +12 -0
- package/dist/space/cave-custom-layer.d.ts.map +1 -0
- package/dist/space/cave-custom-layer.js +17 -0
- package/dist/space/cave-custom-layer.js.map +1 -0
- package/dist/space/cave-env.d.ts +6 -0
- package/dist/space/cave-env.d.ts.map +1 -0
- package/dist/space/cave-env.js +23 -0
- package/dist/space/cave-env.js.map +1 -0
- package/dist/space/cave-space.d.ts +46 -0
- package/dist/space/cave-space.d.ts.map +1 -0
- package/dist/space/cave-space.js +37 -0
- package/dist/space/cave-space.js.map +1 -0
- package/dist/space/connector-label-host.d.ts +21 -0
- package/dist/space/connector-label-host.d.ts.map +1 -0
- package/dist/space/connector-label-host.js +65 -0
- package/dist/space/connector-label-host.js.map +1 -0
- package/dist/space/index.d.ts +18 -0
- package/dist/space/index.d.ts.map +1 -0
- package/dist/space/index.js +47 -0
- package/dist/space/index.js.map +1 -0
- package/dist/space/objects/builtin-registrar.d.ts +17 -0
- package/dist/space/objects/builtin-registrar.d.ts.map +1 -0
- package/dist/space/objects/builtin-registrar.js +19 -0
- package/dist/space/objects/builtin-registrar.js.map +1 -0
- package/dist/space/objects/custom-object.d.ts +9 -0
- package/dist/space/objects/custom-object.d.ts.map +1 -0
- package/dist/space/objects/custom-object.js +56 -0
- package/dist/space/objects/custom-object.js.map +1 -0
- package/dist/space/objects/image-object.d.ts +7 -0
- package/dist/space/objects/image-object.d.ts.map +1 -0
- package/dist/space/objects/image-object.js +14 -0
- package/dist/space/objects/image-object.js.map +1 -0
- package/dist/space/objects/model-object/fbx-object.d.ts +8 -0
- package/dist/space/objects/model-object/fbx-object.d.ts.map +1 -0
- package/dist/space/objects/model-object/fbx-object.js +26 -0
- package/dist/space/objects/model-object/fbx-object.js.map +1 -0
- package/dist/space/objects/model-object/gltf-object.d.ts +9 -0
- package/dist/space/objects/model-object/gltf-object.d.ts.map +1 -0
- package/dist/space/objects/model-object/gltf-object.js +66 -0
- package/dist/space/objects/model-object/gltf-object.js.map +1 -0
- package/dist/space/objects/model-object/index.d.ts +9 -0
- package/dist/space/objects/model-object/index.d.ts.map +1 -0
- package/dist/space/objects/model-object/index.js +12 -0
- package/dist/space/objects/model-object/index.js.map +1 -0
- package/dist/space/objects/model-object/splat-object.d.ts +9 -0
- package/dist/space/objects/model-object/splat-object.d.ts.map +1 -0
- package/dist/space/objects/model-object/splat-object.js +19 -0
- package/dist/space/objects/model-object/splat-object.js.map +1 -0
- package/dist/space/objects/object-components/windows/index.d.ts +5 -0
- package/dist/space/objects/object-components/windows/index.d.ts.map +1 -0
- package/dist/space/objects/object-components/windows/index.js +20 -0
- package/dist/space/objects/object-components/windows/index.js.map +1 -0
- package/dist/space/objects/placeholder-object.d.ts +7 -0
- package/dist/space/objects/placeholder-object.d.ts.map +1 -0
- package/dist/space/objects/placeholder-object.js +12 -0
- package/dist/space/objects/placeholder-object.js.map +1 -0
- package/dist/space/objects/poi-object.d.ts +7 -0
- package/dist/space/objects/poi-object.d.ts.map +1 -0
- package/dist/space/objects/poi-object.js +38 -0
- package/dist/space/objects/poi-object.js.map +1 -0
- package/dist/space/objects/portal-object.d.ts +7 -0
- package/dist/space/objects/portal-object.d.ts.map +1 -0
- package/dist/space/objects/portal-object.js +84 -0
- package/dist/space/objects/portal-object.js.map +1 -0
- package/dist/space/objects/video-object.d.ts +7 -0
- package/dist/space/objects/video-object.d.ts.map +1 -0
- package/dist/space/objects/video-object.js +32 -0
- package/dist/space/objects/video-object.js.map +1 -0
- package/dist/space/polygon-boundary.d.ts +10 -0
- package/dist/space/polygon-boundary.d.ts.map +1 -0
- package/dist/space/polygon-boundary.js +205 -0
- package/dist/space/polygon-boundary.js.map +1 -0
- package/dist/space/splats/spark/robust-splat-mesh.d.ts +59 -0
- package/dist/space/splats/spark/robust-splat-mesh.d.ts.map +1 -0
- package/dist/space/splats/spark/robust-splat-mesh.js +105 -0
- package/dist/space/splats/spark/robust-splat-mesh.js.map +1 -0
- package/dist/space/splats/spark/splat-mesh.d.ts +5 -0
- package/dist/space/splats/spark/splat-mesh.d.ts.map +1 -0
- package/dist/space/splats/spark/splat-mesh.js +7 -0
- package/dist/space/splats/spark/splat-mesh.js.map +1 -0
- package/dist/space/splats/spark/splat-spread-reveal.d.ts +14 -0
- package/dist/space/splats/spark/splat-spread-reveal.d.ts.map +1 -0
- package/dist/space/splats/spark/splat-spread-reveal.js +45 -0
- package/dist/space/splats/spark/splat-spread-reveal.js.map +1 -0
- package/dist/space/utils/cave-world-player.d.ts +3 -0
- package/dist/space/utils/cave-world-player.d.ts.map +1 -0
- package/dist/space/utils/cave-world-player.js +5 -0
- package/dist/space/utils/cave-world-player.js.map +1 -0
- package/dist/space/utils/configure-canvas.d.ts +20 -0
- package/dist/space/utils/configure-canvas.d.ts.map +1 -0
- package/dist/space/utils/configure-canvas.js +12 -0
- package/dist/space/utils/configure-canvas.js.map +1 -0
- package/dist/space/utils/polygon-boundary-geometry.d.ts +8 -0
- package/dist/space/utils/polygon-boundary-geometry.d.ts.map +1 -0
- package/dist/space/utils/polygon-boundary-geometry.js +20 -0
- package/dist/space/utils/polygon-boundary-geometry.js.map +1 -0
- package/dist/space/utils/polygon-boundary-segments.d.ts +50 -0
- package/dist/space/utils/polygon-boundary-segments.d.ts.map +1 -0
- package/dist/space/utils/polygon-boundary-segments.js +64 -0
- package/dist/space/utils/polygon-boundary-segments.js.map +1 -0
- package/dist/space/utils/rotation-compat.d.ts +4 -0
- package/dist/space/utils/rotation-compat.d.ts.map +1 -0
- package/dist/space/utils/rotation-compat.js +9 -0
- package/dist/space/utils/rotation-compat.js.map +1 -0
- package/dist/space/utils/select-splat-level.d.ts +52 -0
- package/dist/space/utils/select-splat-level.d.ts.map +1 -0
- package/dist/space/utils/select-splat-level.js +43 -0
- package/dist/space/utils/select-splat-level.js.map +1 -0
- package/dist/space/utils/spark-performance.d.ts +10 -0
- package/dist/space/utils/spark-performance.d.ts.map +1 -0
- package/dist/space/utils/spark-performance.js +10 -0
- package/dist/space/utils/spark-performance.js.map +1 -0
- package/dist/space/utils/splat-collider-helper.d.ts +5 -0
- package/dist/space/utils/splat-collider-helper.d.ts.map +1 -0
- package/dist/space/utils/splat-collider-helper.js +162 -0
- package/dist/space/utils/splat-collider-helper.js.map +1 -0
- package/dist/space/utils/touch-primary-device.d.ts +16 -0
- package/dist/space/utils/touch-primary-device.d.ts.map +1 -0
- package/dist/space/utils/touch-primary-device.js +52 -0
- package/dist/space/utils/touch-primary-device.js.map +1 -0
- package/dist/space/utils/use-visibility-frameloop.d.ts +20 -0
- package/dist/space/utils/use-visibility-frameloop.d.ts.map +1 -0
- package/dist/space/utils/use-visibility-frameloop.js +18 -0
- package/dist/space/utils/use-visibility-frameloop.js.map +1 -0
- package/dist/styles.css +930 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/space-types.d.ts +404 -0
- package/dist/types/space-types.d.ts.map +1 -0
- package/doc/API.md +617 -0
- package/doc/ARCHITECTURE.md +264 -0
- package/doc/multiplayer-protocol.md +757 -0
- package/doc/scene-json-structure.md +567 -0
- package/package.json +131 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CaveSpace } from '../../types/index.js';
|
|
2
|
+
import type { CaveSpaceLoader } from '../loaders/cave-loader.js';
|
|
3
|
+
export interface PrimarySpaceLoaderOptions {
|
|
4
|
+
spaceId: string | undefined;
|
|
5
|
+
loader: CaveSpaceLoader;
|
|
6
|
+
/** Runs on success, before the config is published to the world store. */
|
|
7
|
+
onLoaded?: (spaceId: string, space: CaveSpace) => void;
|
|
8
|
+
/** Runs when the space id changes or a retry starts, before the fetch. */
|
|
9
|
+
onReset?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface PrimarySpaceLoaderResult {
|
|
12
|
+
/** The loaded scene config, or `undefined` while loading / after a failure. */
|
|
13
|
+
space: CaveSpace | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Fetch the primary scene JSON and publish it to the world store.
|
|
17
|
+
*
|
|
18
|
+
* Re-runs when `spaceId` changes or the user triggers a retry
|
|
19
|
+
* (`retrySpaceLoad()` bumps `retryToken`). In-flight results are discarded on
|
|
20
|
+
* unmount / id change, so a slow response for a previous scene can never
|
|
21
|
+
* overwrite the current one.
|
|
22
|
+
*/
|
|
23
|
+
export declare function usePrimarySpaceLoader({ spaceId, loader, onLoaded, onReset }: PrimarySpaceLoaderOptions): PrimarySpaceLoaderResult;
|
|
24
|
+
//# sourceMappingURL=use-primary-space-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-primary-space-loader.d.ts","sourceRoot":"","sources":["../../../explore/hooks/use-primary-space-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAI7D,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,MAAM,EAAE,eAAe,CAAA;IACvB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IACtD,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,+EAA+E;IAC/E,KAAK,EAAE,SAAS,GAAG,SAAS,CAAA;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACR,EAAE,yBAAyB,GAAG,wBAAwB,CAgDtD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useState as v, useRef as S, useEffect as g } from "react";
|
|
2
|
+
import { useCaveWorldStoreApi as y, useCaveEventBus as C, useCaveWorldStore as k } from "../../core/context/cave-world-context.js";
|
|
3
|
+
import { createLogger as E } from "../../core/logging/logger.js";
|
|
4
|
+
const L = E("explore:load");
|
|
5
|
+
function w({
|
|
6
|
+
spaceId: e,
|
|
7
|
+
loader: s,
|
|
8
|
+
onLoaded: n,
|
|
9
|
+
onReset: a
|
|
10
|
+
}) {
|
|
11
|
+
const r = y(), i = C(), p = k((o) => o.retryToken), c = `${e ?? ""}\0${p}`, [u, d] = v(), m = u?.key === c ? u.space : void 0, f = S(n), l = S(a);
|
|
12
|
+
return g(() => {
|
|
13
|
+
f.current = n, l.current = a;
|
|
14
|
+
}, [n, a]), g(() => {
|
|
15
|
+
if (l.current?.(), !e) return;
|
|
16
|
+
let o = !1;
|
|
17
|
+
return r.getState().setSpaceLoadError(void 0), s(e).then((t) => {
|
|
18
|
+
o || (d({ key: c, space: t }), f.current?.(e, t), r.getState().setSpaceConfig(t));
|
|
19
|
+
}).catch((t) => {
|
|
20
|
+
o || (L.error(`Failed to load space ${e}:`, t), r.getState().setSpaceConfig(void 0), i.emit("space:error", { error: t, spaceId: e, willRetry: !1 }), r.getState().setSpaceLoadError({ stage: "config", spaceId: e, error: t }));
|
|
21
|
+
}), () => {
|
|
22
|
+
o = !0;
|
|
23
|
+
};
|
|
24
|
+
}, [e, s, c, r, i]), { space: m };
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
w as usePrimarySpaceLoader
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=use-primary-space-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-primary-space-loader.js","sources":["../../../explore/hooks/use-primary-space-loader.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { createLogger, useCaveEventBus, useCaveWorldStore, useCaveWorldStoreApi } from '../../core'\nimport type { CaveSpace } from '../../types'\nimport type { CaveSpaceLoader } from '../loaders/cave-loader'\n\nconst logger = createLogger('explore:load')\n\nexport interface PrimarySpaceLoaderOptions {\n spaceId: string | undefined\n loader: CaveSpaceLoader\n /** Runs on success, before the config is published to the world store. */\n onLoaded?: (spaceId: string, space: CaveSpace) => void\n /** Runs when the space id changes or a retry starts, before the fetch. */\n onReset?: () => void\n}\n\nexport interface PrimarySpaceLoaderResult {\n /** The loaded scene config, or `undefined` while loading / after a failure. */\n space: CaveSpace | undefined\n}\n\n/**\n * Fetch the primary scene JSON and publish it to the world store.\n *\n * Re-runs when `spaceId` changes or the user triggers a retry\n * (`retrySpaceLoad()` bumps `retryToken`). In-flight results are discarded on\n * unmount / id change, so a slow response for a previous scene can never\n * overwrite the current one.\n */\nexport function usePrimarySpaceLoader({\n spaceId,\n loader,\n onLoaded,\n onReset\n}: PrimarySpaceLoaderOptions): PrimarySpaceLoaderResult {\n const worldStore = useCaveWorldStoreApi()\n const eventBus = useCaveEventBus()\n const retryToken = useCaveWorldStore((s) => s.retryToken)\n\n // Tag the result with the request it belongs to. Reading it back through that\n // tag means a new space id (or retry) reports \"not loaded\" immediately, with\n // no reset effect and therefore no frame where the old scene is still shown.\n const loadKey = `${spaceId ?? ''}\\u0000${retryToken}`\n const [loaded, setLoaded] = useState<{ key: string; space: CaveSpace }>()\n const space = loaded?.key === loadKey ? loaded.space : undefined\n\n const onLoadedRef = useRef(onLoaded)\n const onResetRef = useRef(onReset)\n useEffect(() => {\n onLoadedRef.current = onLoaded\n onResetRef.current = onReset\n }, [onLoaded, onReset])\n\n useEffect(() => {\n onResetRef.current?.()\n if (!spaceId) return\n\n let cancelled = false\n worldStore.getState().setSpaceLoadError(undefined)\n\n loader(spaceId)\n .then((result) => {\n if (cancelled) return\n setLoaded({ key: loadKey, space: result })\n onLoadedRef.current?.(spaceId, result)\n worldStore.getState().setSpaceConfig(result)\n })\n .catch((error: unknown) => {\n if (cancelled) return\n logger.error(`Failed to load space ${spaceId}:`, error)\n worldStore.getState().setSpaceConfig(undefined)\n eventBus.emit('space:error', { error, spaceId, willRetry: false })\n worldStore.getState().setSpaceLoadError({ stage: 'config', spaceId, error })\n })\n\n return () => {\n cancelled = true\n }\n // `loadKey` folds in `retryToken`: a user-triggered retry re-runs the fetch.\n }, [spaceId, loader, loadKey, worldStore, eventBus])\n\n return { space }\n}\n"],"names":["logger","createLogger","usePrimarySpaceLoader","spaceId","loader","onLoaded","onReset","worldStore","useCaveWorldStoreApi","eventBus","useCaveEventBus","retryToken","useCaveWorldStore","s","loadKey","loaded","setLoaded","useState","space","onLoadedRef","useRef","onResetRef","useEffect","cancelled","result","error"],"mappings":";;;AAKA,MAAMA,IAASC,EAAa,cAAc;AAwBnC,SAASC,EAAsB;AAAA,EACpC,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AACF,GAAwD;AACtD,QAAMC,IAAaC,EAAA,GACbC,IAAWC,EAAA,GACXC,IAAaC,EAAkB,CAACC,MAAMA,EAAE,UAAU,GAKlDC,IAAU,GAAGX,KAAW,EAAE,KAASQ,CAAU,IAC7C,CAACI,GAAQC,CAAS,IAAIC,EAAA,GACtBC,IAAQH,GAAQ,QAAQD,IAAUC,EAAO,QAAQ,QAEjDI,IAAcC,EAAOf,CAAQ,GAC7BgB,IAAaD,EAAOd,CAAO;AACjC,SAAAgB,EAAU,MAAM;AACd,IAAAH,EAAY,UAAUd,GACtBgB,EAAW,UAAUf;AAAA,EACvB,GAAG,CAACD,GAAUC,CAAO,CAAC,GAEtBgB,EAAU,MAAM;AAEd,QADAD,EAAW,UAAA,GACP,CAAClB,EAAS;AAEd,QAAIoB,IAAY;AAChB,WAAAhB,EAAW,SAAA,EAAW,kBAAkB,MAAS,GAEjDH,EAAOD,CAAO,EACX,KAAK,CAACqB,MAAW;AAChB,MAAID,MACJP,EAAU,EAAE,KAAKF,GAAS,OAAOU,GAAQ,GACzCL,EAAY,UAAUhB,GAASqB,CAAM,GACrCjB,EAAW,SAAA,EAAW,eAAeiB,CAAM;AAAA,IAC7C,CAAC,EACA,MAAM,CAACC,MAAmB;AACzB,MAAIF,MACJvB,EAAO,MAAM,wBAAwBG,CAAO,KAAKsB,CAAK,GACtDlB,EAAW,SAAA,EAAW,eAAe,MAAS,GAC9CE,EAAS,KAAK,eAAe,EAAE,OAAAgB,GAAO,SAAAtB,GAAS,WAAW,IAAO,GACjEI,EAAW,SAAA,EAAW,kBAAkB,EAAE,OAAO,UAAU,SAAAJ,GAAS,OAAAsB,GAAO;AAAA,IAC7E,CAAC,GAEI,MAAM;AACX,MAAAF,IAAY;AAAA,IACd;AAAA,EAEF,GAAG,CAACpB,GAASC,GAAQU,GAASP,GAAYE,CAAQ,CAAC,GAE5C,EAAE,OAAAS,EAAA;AACX;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export { default as CaveExplore, type CaveExploreProps, type CaveExploreHandle, type MultiplayerProp } from './cave-explore.js';
|
|
2
|
+
export { default as CaveOrbitViewer, type CaveOrbitViewerProps, type OrbitCameraConfig, type OrbitControlsConfig, type OrbitViewerReadyApi } from './cave-orbit-viewer.js';
|
|
3
|
+
export type { CaveViewerBaseProps, ActiveSpaceChangeHandler } from './viewer-shared.js';
|
|
4
|
+
export { DefaultCaveSpaceLoader, createHttpCaveSpaceLoader, assertCaveSpace, DEFAULT_CAVE_SPACE_API_BASE_URL, DEFAULT_CAVE_SPACE_TIMEOUT_MS, type CaveSpaceLoader, type HttpCaveSpaceLoaderOptions } from './loaders/cave-loader.js';
|
|
5
|
+
export { default as DetailWindow } from './overlays/detail-window.js';
|
|
6
|
+
export { default as ActionPanel } from './overlays/action-panel.js';
|
|
7
|
+
export { default as ActionBubble } from './overlays/action-bubble.js';
|
|
8
|
+
export { default as SpaceLoadErrorOverlay, type LoadErrorRenderer, type LoadErrorRenderProps, type SpaceLoadErrorOverlayProps } from './overlays/space-load-error-overlay.js';
|
|
9
|
+
export { default as ExploreHelper, DEFAULT_EXPLORE_HELPER_STORAGE_KEY, type ExploreHelperConfig, type ExploreHelperHint, type ExploreHelperProps, type ExploreHelperRenderer, type ExploreHelperRenderProps } from './overlays/explore-helper.js';
|
|
10
|
+
export { default as ConnectorLabelBeacon } from './overlays/connector-label-beacon.js';
|
|
11
|
+
export { default as ConnectorLabelTagShell } from './overlays/connector-label-tag-shell.js';
|
|
12
|
+
export { ensureCaveWorldStyles, useCaveWorldStyles } from './styles/inject.js';
|
|
13
|
+
export { CAVE_WORLD_CSS } from './styles/cave-world-css.js';
|
|
14
|
+
export { CaveExploreProvider, useCaveExplore, useCaveExploreStore, useActionPrompt, useActionPromptStore, type CaveExploreProviderProps, type CaveExploreStores } from './stores/explore-context.js';
|
|
15
|
+
export { createCaveExploreStore, isConnectorInActiveSpace, type CaveExploreState, type CaveExploreStoreApi, type RoomInfo, type ViewMode } from './stores/cave-explore.store.js';
|
|
16
|
+
export { createActionPromptStore, type ActionDef, type ActionPromptState, type ActionPromptStoreApi, type ActionPromptStyle } from './stores/action-prompt.store.js';
|
|
17
|
+
export { default as ExploreSimpleCharacter, type ExploreSimpleCharacterProps, type ExploreSimpleCharacterRoot, type MultiplayerRuntimeConfig } from './simple-character.js';
|
|
18
|
+
export { applyCharacterPose } from './characters/character-pose.js';
|
|
19
|
+
export { createLocalCharacterModelConfig, resolveLocalCharacterPhysics, resolveLocalCharacterScale, resolveSimpleCharacterModel, resolveUseViverseAvatar, DEFAULT_LOCAL_CHARACTER_SCALE, LOCAL_CHARACTER_SIZE_SCALE, VIVERSE_DEFAULT_CAPSULE_HEIGHT, VIVERSE_DEFAULT_CAPSULE_RADIUS, type LocalCharacterModelConfig, type LocalCharacterModelProp, type VRMHumanBoneName } from './characters/local-character-model.js';
|
|
20
|
+
export { MIXAMO_STYLE_BONE_MAP } from './characters/mixamo-style-bone-map.js';
|
|
21
|
+
export type { CharacterActionBindingClass, CharacterActionBindingOptions, CharacterControlsConfig, CharacterMovementOptions } from './characters/character-controls.js';
|
|
22
|
+
export { default as RemoteCharacterController, type RemoteCharacterControllerProps, type RemoteCharacterData } from './characters/remote-character-controller.js';
|
|
23
|
+
export { default as RemoteCharacter, type RemoteCharacterProps } from './characters/remote-character.js';
|
|
24
|
+
export { BUILTIN_AVATARS, DEFAULT_AVATAR, DEFAULT_AVATAR_ID, SUPPORTED_ANIMATION_NAMES, getAvailableAvatarIds, getAvatarConfig, type AnimationName, type AvatarAssetRef, type AvatarConfig } from './characters/character-configs.js';
|
|
25
|
+
export { DEFAULT_WEBSOCKET_URL, WebSocketService, WebSocketStatusEnum, MessageActionEnum, type PlayerData, type WebSocketStatus, type WebSocketMessage, type WebSocketConfig } from './services/websocket.service.js';
|
|
26
|
+
export { useCharacterSync, type CharacterSyncConfig, type CharacterSyncResult } from './hooks/use-character-sync.js';
|
|
27
|
+
export { useExploreActions, type PortalNavigateHandler } from './hooks/use-explore-actions.js';
|
|
28
|
+
export { useActionShortcuts } from './hooks/use-action-shortcuts.js';
|
|
29
|
+
export { useActiveSpaceNotify } from './hooks/use-active-space-notify.js';
|
|
30
|
+
export { useConnectorPreloader, preloadSpaceAssets } from './hooks/use-connector-preloader.js';
|
|
31
|
+
export { useConnectorTransitions, SEAMLESS_GHOST_ENTER_WINDOW_MS } from './hooks/use-connector-transitions.js';
|
|
32
|
+
export { useLoadErrorNotify } from './hooks/use-load-error-notify.js';
|
|
33
|
+
export { usePrimarySpaceLoader, type PrimarySpaceLoaderOptions, type PrimarySpaceLoaderResult } from './hooks/use-primary-space-loader.js';
|
|
34
|
+
export { computePortalSpawnPose, computeSeamlessGroupMatrix, computeSpawnPose, findConnectorById, getConnectorTargetIds, matrixFromM16, transformToMatrix4, PORTAL_SPAWN_FORWARD_OFFSET_M, type SpawnPose } from './math/space-transforms.js';
|
|
35
|
+
export { scheduleIdle } from './utils/schedule-idle.js';
|
|
36
|
+
export { default as ConnectedSpacesRenderer, type ConnectedSpacesRendererProps } from './connected-spaces-renderer.js';
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../explore/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAGpF,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,EACf,+BAA+B,EAC/B,6BAA6B,EAC7B,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAChC,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM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vB,8BAA8B,EAC/B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,EACL,qBAAqB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAA;AAGzC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,6BAA6B,EAC7B,KAAK,SAAS,EACf,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAGpD,OAAO,EACL,OAAO,IAAI,uBAAuB,EAClC,KAAK,4BAA4B,EAClC,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { default as o } from "./cave-explore.js";
|
|
2
|
+
import { default as a } from "./cave-orbit-viewer.js";
|
|
3
|
+
import { DEFAULT_CAVE_SPACE_API_BASE_URL as A, DEFAULT_CAVE_SPACE_TIMEOUT_MS as s, DefaultCaveSpaceLoader as l, assertCaveSpace as E, createHttpCaveSpaceLoader as c } from "./loaders/cave-loader.js";
|
|
4
|
+
import { default as f } from "./overlays/detail-window.js";
|
|
5
|
+
import { default as C } from "./overlays/action-panel.js";
|
|
6
|
+
import { default as x } from "./overlays/action-bubble.js";
|
|
7
|
+
import { default as u } from "./overlays/space-load-error-overlay.js";
|
|
8
|
+
import { DEFAULT_EXPLORE_HELPER_STORAGE_KEY as d, default as i } from "./overlays/explore-helper.js";
|
|
9
|
+
import { default as v } from "./overlays/connector-label-beacon.js";
|
|
10
|
+
import { default as R } from "./overlays/connector-label-tag-shell.js";
|
|
11
|
+
import { ensureCaveWorldStyles as O, useCaveWorldStyles as U } from "./styles/inject.js";
|
|
12
|
+
import { CAVE_WORLD_CSS as M } from "./styles/cave-world-css.js";
|
|
13
|
+
import { CaveExploreProvider as F, useActionPrompt as V, useActionPromptStore as W, useCaveExplore as y, useCaveExploreStore as N } from "./stores/explore-context.js";
|
|
14
|
+
import { createCaveExploreStore as g, isConnectorInActiveSpace as H } from "./stores/cave-explore.store.js";
|
|
15
|
+
import { createActionPromptStore as w } from "./stores/action-prompt.store.js";
|
|
16
|
+
import { default as k } from "./simple-character.js";
|
|
17
|
+
import { applyCharacterPose as X } from "./characters/character-pose.js";
|
|
18
|
+
import { DEFAULT_LOCAL_CHARACTER_SCALE as Z, LOCAL_CHARACTER_SIZE_SCALE as j, VIVERSE_DEFAULT_CAPSULE_HEIGHT as q, VIVERSE_DEFAULT_CAPSULE_RADIUS as z, createLocalCharacterModelConfig as J, resolveLocalCharacterPhysics as Q, resolveLocalCharacterScale as $, resolveSimpleCharacterModel as ee, resolveUseViverseAvatar as re } from "./characters/local-character-model.js";
|
|
19
|
+
import { MIXAMO_STYLE_BONE_MAP as te } from "./characters/mixamo-style-bone-map.js";
|
|
20
|
+
import { default as pe } from "./characters/remote-character-controller.js";
|
|
21
|
+
import { default as se } from "./characters/remote-character.js";
|
|
22
|
+
import { BUILTIN_AVATARS as Ee, DEFAULT_AVATAR as ce, DEFAULT_AVATAR_ID as Se, SUPPORTED_ANIMATION_NAMES as fe, getAvailableAvatarIds as me, getAvatarConfig as Ce } from "./characters/character-configs.js";
|
|
23
|
+
import { DEFAULT_WEBSOCKET_URL as xe, MessageActionEnum as ne, WebSocketService as ue, WebSocketStatusEnum as Le } from "./services/websocket.service.js";
|
|
24
|
+
import { useCharacterSync as ie } from "./hooks/use-character-sync.js";
|
|
25
|
+
import { useExploreActions as ve } from "./hooks/use-explore-actions.js";
|
|
26
|
+
import { useActionShortcuts as Re } from "./hooks/use-action-shortcuts.js";
|
|
27
|
+
import { useActiveSpaceNotify as Oe } from "./hooks/use-active-space-notify.js";
|
|
28
|
+
import { preloadSpaceAssets as De, useConnectorPreloader as Me } from "./hooks/use-connector-preloader.js";
|
|
29
|
+
import { SEAMLESS_GHOST_ENTER_WINDOW_MS as Fe, useConnectorTransitions as Ve } from "./hooks/use-connector-transitions.js";
|
|
30
|
+
import { useLoadErrorNotify as ye } from "./hooks/use-load-error-notify.js";
|
|
31
|
+
import { usePrimarySpaceLoader as be } from "./hooks/use-primary-space-loader.js";
|
|
32
|
+
import { PORTAL_SPAWN_FORWARD_OFFSET_M as He, computePortalSpawnPose as Be, computeSeamlessGroupMatrix as we, computeSpawnPose as Ge, findConnectorById as ke, getConnectorTargetIds as Ke, matrixFromM16 as Xe, transformToMatrix4 as Ye } from "./math/space-transforms.js";
|
|
33
|
+
import { scheduleIdle as je } from "./utils/schedule-idle.js";
|
|
34
|
+
import { default as ze } from "./connected-spaces-renderer.js";
|
|
35
|
+
export {
|
|
36
|
+
x as ActionBubble,
|
|
37
|
+
C as ActionPanel,
|
|
38
|
+
Ee as BUILTIN_AVATARS,
|
|
39
|
+
M as CAVE_WORLD_CSS,
|
|
40
|
+
o as CaveExplore,
|
|
41
|
+
F as CaveExploreProvider,
|
|
42
|
+
a as CaveOrbitViewer,
|
|
43
|
+
ze as ConnectedSpacesRenderer,
|
|
44
|
+
v as ConnectorLabelBeacon,
|
|
45
|
+
R as ConnectorLabelTagShell,
|
|
46
|
+
ce as DEFAULT_AVATAR,
|
|
47
|
+
Se as DEFAULT_AVATAR_ID,
|
|
48
|
+
A as DEFAULT_CAVE_SPACE_API_BASE_URL,
|
|
49
|
+
s as DEFAULT_CAVE_SPACE_TIMEOUT_MS,
|
|
50
|
+
d as DEFAULT_EXPLORE_HELPER_STORAGE_KEY,
|
|
51
|
+
Z as DEFAULT_LOCAL_CHARACTER_SCALE,
|
|
52
|
+
xe as DEFAULT_WEBSOCKET_URL,
|
|
53
|
+
l as DefaultCaveSpaceLoader,
|
|
54
|
+
f as DetailWindow,
|
|
55
|
+
i as ExploreHelper,
|
|
56
|
+
k as ExploreSimpleCharacter,
|
|
57
|
+
j as LOCAL_CHARACTER_SIZE_SCALE,
|
|
58
|
+
te as MIXAMO_STYLE_BONE_MAP,
|
|
59
|
+
ne as MessageActionEnum,
|
|
60
|
+
He as PORTAL_SPAWN_FORWARD_OFFSET_M,
|
|
61
|
+
se as RemoteCharacter,
|
|
62
|
+
pe as RemoteCharacterController,
|
|
63
|
+
Fe as SEAMLESS_GHOST_ENTER_WINDOW_MS,
|
|
64
|
+
fe as SUPPORTED_ANIMATION_NAMES,
|
|
65
|
+
u as SpaceLoadErrorOverlay,
|
|
66
|
+
q as VIVERSE_DEFAULT_CAPSULE_HEIGHT,
|
|
67
|
+
z as VIVERSE_DEFAULT_CAPSULE_RADIUS,
|
|
68
|
+
ue as WebSocketService,
|
|
69
|
+
Le as WebSocketStatusEnum,
|
|
70
|
+
X as applyCharacterPose,
|
|
71
|
+
E as assertCaveSpace,
|
|
72
|
+
Be as computePortalSpawnPose,
|
|
73
|
+
we as computeSeamlessGroupMatrix,
|
|
74
|
+
Ge as computeSpawnPose,
|
|
75
|
+
w as createActionPromptStore,
|
|
76
|
+
g as createCaveExploreStore,
|
|
77
|
+
c as createHttpCaveSpaceLoader,
|
|
78
|
+
J as createLocalCharacterModelConfig,
|
|
79
|
+
O as ensureCaveWorldStyles,
|
|
80
|
+
ke as findConnectorById,
|
|
81
|
+
me as getAvailableAvatarIds,
|
|
82
|
+
Ce as getAvatarConfig,
|
|
83
|
+
Ke as getConnectorTargetIds,
|
|
84
|
+
H as isConnectorInActiveSpace,
|
|
85
|
+
Xe as matrixFromM16,
|
|
86
|
+
De as preloadSpaceAssets,
|
|
87
|
+
Q as resolveLocalCharacterPhysics,
|
|
88
|
+
$ as resolveLocalCharacterScale,
|
|
89
|
+
ee as resolveSimpleCharacterModel,
|
|
90
|
+
re as resolveUseViverseAvatar,
|
|
91
|
+
je as scheduleIdle,
|
|
92
|
+
Ye as transformToMatrix4,
|
|
93
|
+
V as useActionPrompt,
|
|
94
|
+
W as useActionPromptStore,
|
|
95
|
+
Re as useActionShortcuts,
|
|
96
|
+
Oe as useActiveSpaceNotify,
|
|
97
|
+
y as useCaveExplore,
|
|
98
|
+
N as useCaveExploreStore,
|
|
99
|
+
U as useCaveWorldStyles,
|
|
100
|
+
ie as useCharacterSync,
|
|
101
|
+
Me as useConnectorPreloader,
|
|
102
|
+
Ve as useConnectorTransitions,
|
|
103
|
+
ve as useExploreActions,
|
|
104
|
+
ye as useLoadErrorNotify,
|
|
105
|
+
be as usePrimarySpaceLoader
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CaveSpace } from '../../types/index.js';
|
|
2
|
+
/** Resolves a space id to its scene JSON. Supply your own to use a private API. */
|
|
3
|
+
export type CaveSpaceLoader = (spaceId: string) => Promise<CaveSpace>;
|
|
4
|
+
/** Default CaveGiant content endpoint used by {@link DefaultCaveSpaceLoader}. */
|
|
5
|
+
export declare const DEFAULT_CAVE_SPACE_API_BASE_URL = "https://api-meta.cavegiant.com/v1/cave-meta";
|
|
6
|
+
/** Default per-request timeout for the built-in HTTP loader. */
|
|
7
|
+
export declare const DEFAULT_CAVE_SPACE_TIMEOUT_MS = 20000;
|
|
8
|
+
export interface HttpCaveSpaceLoaderOptions {
|
|
9
|
+
/** API origin + prefix. Ignored when `buildUrl` is supplied. */
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
/** Full control over the request URL, e.g. for a non-CaveGiant backend. */
|
|
12
|
+
buildUrl?: (spaceId: string) => string;
|
|
13
|
+
/** Extra headers, e.g. `Authorization`. */
|
|
14
|
+
headers?: HeadersInit;
|
|
15
|
+
/** Abort and reject after this many ms. Pass `0` to disable. */
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
/** Injectable `fetch` (proxying, retries, tests). Defaults to global `fetch`. */
|
|
18
|
+
fetch?: typeof globalThis.fetch;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build a space loader that fetches scene JSON over HTTP.
|
|
22
|
+
*
|
|
23
|
+
* Adds what a bare `fetch` does not: a request timeout (a hung request would
|
|
24
|
+
* otherwise leave the viewer on its loading screen forever), non-2xx and
|
|
25
|
+
* malformed-payload detection, and {@link CaveWorldError} codes so hosts can
|
|
26
|
+
* branch on the failure kind.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const loader = createHttpCaveSpaceLoader({
|
|
31
|
+
* buildUrl: (id) => `/api/spaces/${id}`,
|
|
32
|
+
* headers: { Authorization: `Bearer ${token}` }
|
|
33
|
+
* })
|
|
34
|
+
* <CaveExplore spaceId={id} caveSpaceLoader={loader} />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function createHttpCaveSpaceLoader(options?: HttpCaveSpaceLoaderOptions): CaveSpaceLoader;
|
|
38
|
+
/**
|
|
39
|
+
* Narrow an unknown payload to {@link CaveSpace}, throwing a
|
|
40
|
+
* `CaveWorldError('INVALID_SPACE')` when required fields are missing.
|
|
41
|
+
*
|
|
42
|
+
* This is a shape check, not full schema validation: it catches the failures
|
|
43
|
+
* that would otherwise surface as an opaque `undefined` crash deep inside the
|
|
44
|
+
* renderer (HTML error pages, envelope-wrapped responses, empty bodies).
|
|
45
|
+
*/
|
|
46
|
+
export declare function assertCaveSpace(payload: unknown, context?: {
|
|
47
|
+
spaceId?: string;
|
|
48
|
+
url?: string;
|
|
49
|
+
}): CaveSpace;
|
|
50
|
+
/**
|
|
51
|
+
* Default loader against the public CaveGiant content API.
|
|
52
|
+
*
|
|
53
|
+
* Convenient for demos and CaveGiant-hosted apps. Third-party hosts should
|
|
54
|
+
* pass `createHttpCaveSpaceLoader({ buildUrl })` (or any async function) via
|
|
55
|
+
* `caveSpaceLoader` instead of relying on this endpoint.
|
|
56
|
+
*/
|
|
57
|
+
export declare const DefaultCaveSpaceLoader: CaveSpaceLoader;
|
|
58
|
+
//# sourceMappingURL=cave-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cave-loader.d.ts","sourceRoot":"","sources":["../../../explore/loaders/cave-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;AAErE,iFAAiF;AACjF,eAAO,MAAM,+BAA+B,gDAAgD,CAAA;AAE5F,gEAAgE;AAChE,eAAO,MAAM,6BAA6B,QAAS,CAAA;AAEnD,MAAM,WAAW,0BAA0B;IACzC,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;IACtC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iFAAiF;IACjF,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;CAChC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,0BAA+B,GACvC,eAAe,CA0DjB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/C,SAAS,CAUX;AAwBD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,eAA6C,CAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { CaveWorldError as s } from "../../core/errors.js";
|
|
2
|
+
const E = "https://api-meta.cavegiant.com/v1/cave-meta", y = 2e4;
|
|
3
|
+
function b(t = {}) {
|
|
4
|
+
const {
|
|
5
|
+
baseUrl: o = E,
|
|
6
|
+
buildUrl: e = (u) => `${o.replace(/\/$/, "")}/cave-worlds/${encodeURIComponent(u)}/space/content`,
|
|
7
|
+
headers: A,
|
|
8
|
+
timeoutMs: i = y,
|
|
9
|
+
fetch: p
|
|
10
|
+
} = t;
|
|
11
|
+
return async function(r) {
|
|
12
|
+
const n = e(r), C = p ?? globalThis.fetch, c = i > 0 ? new AbortController() : void 0, f = c && i > 0 ? setTimeout(() => c.abort(), i) : void 0;
|
|
13
|
+
let a;
|
|
14
|
+
try {
|
|
15
|
+
a = await C(n, { headers: A, signal: c?.signal });
|
|
16
|
+
} catch (l) {
|
|
17
|
+
throw c?.signal.aborted ? new s(
|
|
18
|
+
"SPACE_FETCH_TIMEOUT",
|
|
19
|
+
`Timed out after ${i}ms loading space ${r}.`,
|
|
20
|
+
{ cause: l, spaceId: r, url: n }
|
|
21
|
+
) : new s("SPACE_FETCH_FAILED", `Failed to load space ${r}.`, {
|
|
22
|
+
cause: l,
|
|
23
|
+
spaceId: r,
|
|
24
|
+
url: n
|
|
25
|
+
});
|
|
26
|
+
} finally {
|
|
27
|
+
f !== void 0 && clearTimeout(f);
|
|
28
|
+
}
|
|
29
|
+
if (!a.ok)
|
|
30
|
+
throw new s(
|
|
31
|
+
"SPACE_FETCH_FAILED",
|
|
32
|
+
`Failed to load space ${r}: HTTP ${a.status}.`,
|
|
33
|
+
{ spaceId: r, url: n, status: a.status }
|
|
34
|
+
);
|
|
35
|
+
let m;
|
|
36
|
+
try {
|
|
37
|
+
m = await a.json();
|
|
38
|
+
} catch (l) {
|
|
39
|
+
throw new s("INVALID_SPACE", `Space ${r} did not return valid JSON.`, {
|
|
40
|
+
cause: l,
|
|
41
|
+
spaceId: r,
|
|
42
|
+
url: n
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return d(m, { spaceId: r, url: n });
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function d(t, o = {}) {
|
|
49
|
+
const e = v(t);
|
|
50
|
+
if (e)
|
|
51
|
+
throw new s(
|
|
52
|
+
"INVALID_SPACE",
|
|
53
|
+
`Invalid CaveSpace payload${o.spaceId ? ` for ${o.spaceId}` : ""}: ${e}.`,
|
|
54
|
+
o
|
|
55
|
+
);
|
|
56
|
+
return t;
|
|
57
|
+
}
|
|
58
|
+
function v(t) {
|
|
59
|
+
if (t == null || typeof t != "object")
|
|
60
|
+
return `expected an object, received ${t === null ? "null" : typeof t}`;
|
|
61
|
+
const o = t, e = o.baseLayer;
|
|
62
|
+
if (e == null || typeof e != "object")
|
|
63
|
+
return "missing `baseLayer`";
|
|
64
|
+
if (e.transform == null || !Array.isArray(e.transform.position))
|
|
65
|
+
return "missing `baseLayer.transform.position`";
|
|
66
|
+
if (e.scene == null || typeof e.scene.url != "string")
|
|
67
|
+
return "missing `baseLayer.scene.url`";
|
|
68
|
+
if (o.customLayers != null && !Array.isArray(o.customLayers))
|
|
69
|
+
return "`customLayers` must be an array when present";
|
|
70
|
+
}
|
|
71
|
+
const S = b();
|
|
72
|
+
export {
|
|
73
|
+
E as DEFAULT_CAVE_SPACE_API_BASE_URL,
|
|
74
|
+
y as DEFAULT_CAVE_SPACE_TIMEOUT_MS,
|
|
75
|
+
S as DefaultCaveSpaceLoader,
|
|
76
|
+
d as assertCaveSpace,
|
|
77
|
+
b as createHttpCaveSpaceLoader
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=cave-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cave-loader.js","sources":["../../../explore/loaders/cave-loader.ts"],"sourcesContent":["import { CaveWorldError } from '../../core'\nimport type { CaveSpace } from '../../types'\n\n/** Resolves a space id to its scene JSON. Supply your own to use a private API. */\nexport type CaveSpaceLoader = (spaceId: string) => Promise<CaveSpace>\n\n/** Default CaveGiant content endpoint used by {@link DefaultCaveSpaceLoader}. */\nexport const DEFAULT_CAVE_SPACE_API_BASE_URL = 'https://api-meta.cavegiant.com/v1/cave-meta'\n\n/** Default per-request timeout for the built-in HTTP loader. */\nexport const DEFAULT_CAVE_SPACE_TIMEOUT_MS = 20_000\n\nexport interface HttpCaveSpaceLoaderOptions {\n /** API origin + prefix. Ignored when `buildUrl` is supplied. */\n baseUrl?: string\n /** Full control over the request URL, e.g. for a non-CaveGiant backend. */\n buildUrl?: (spaceId: string) => string\n /** Extra headers, e.g. `Authorization`. */\n headers?: HeadersInit\n /** Abort and reject after this many ms. Pass `0` to disable. */\n timeoutMs?: number\n /** Injectable `fetch` (proxying, retries, tests). Defaults to global `fetch`. */\n fetch?: typeof globalThis.fetch\n}\n\n/**\n * Build a space loader that fetches scene JSON over HTTP.\n *\n * Adds what a bare `fetch` does not: a request timeout (a hung request would\n * otherwise leave the viewer on its loading screen forever), non-2xx and\n * malformed-payload detection, and {@link CaveWorldError} codes so hosts can\n * branch on the failure kind.\n *\n * @example\n * ```ts\n * const loader = createHttpCaveSpaceLoader({\n * buildUrl: (id) => `/api/spaces/${id}`,\n * headers: { Authorization: `Bearer ${token}` }\n * })\n * <CaveExplore spaceId={id} caveSpaceLoader={loader} />\n * ```\n */\nexport function createHttpCaveSpaceLoader(\n options: HttpCaveSpaceLoaderOptions = {}\n): CaveSpaceLoader {\n const {\n baseUrl = DEFAULT_CAVE_SPACE_API_BASE_URL,\n buildUrl = (spaceId: string) =>\n `${baseUrl.replace(/\\/$/, '')}/cave-worlds/${encodeURIComponent(spaceId)}/space/content`,\n headers,\n timeoutMs = DEFAULT_CAVE_SPACE_TIMEOUT_MS,\n fetch: fetchImpl\n } = options\n\n return async function loadCaveSpace(spaceId: string): Promise<CaveSpace> {\n const url = buildUrl(spaceId)\n const doFetch = fetchImpl ?? globalThis.fetch\n const controller = timeoutMs > 0 ? new AbortController() : undefined\n const timer =\n controller && timeoutMs > 0 ? setTimeout(() => controller.abort(), timeoutMs) : undefined\n\n let response: Response\n try {\n response = await doFetch(url, { headers, signal: controller?.signal })\n } catch (error) {\n if (controller?.signal.aborted) {\n throw new CaveWorldError(\n 'SPACE_FETCH_TIMEOUT',\n `Timed out after ${timeoutMs}ms loading space ${spaceId}.`,\n { cause: error, spaceId, url }\n )\n }\n throw new CaveWorldError('SPACE_FETCH_FAILED', `Failed to load space ${spaceId}.`, {\n cause: error,\n spaceId,\n url\n })\n } finally {\n if (timer !== undefined) clearTimeout(timer)\n }\n\n if (!response.ok) {\n throw new CaveWorldError(\n 'SPACE_FETCH_FAILED',\n `Failed to load space ${spaceId}: HTTP ${response.status}.`,\n { spaceId, url, status: response.status }\n )\n }\n\n let payload: unknown\n try {\n payload = await response.json()\n } catch (error) {\n throw new CaveWorldError('INVALID_SPACE', `Space ${spaceId} did not return valid JSON.`, {\n cause: error,\n spaceId,\n url\n })\n }\n\n return assertCaveSpace(payload, { spaceId, url })\n }\n}\n\n/**\n * Narrow an unknown payload to {@link CaveSpace}, throwing a\n * `CaveWorldError('INVALID_SPACE')` when required fields are missing.\n *\n * This is a shape check, not full schema validation: it catches the failures\n * that would otherwise surface as an opaque `undefined` crash deep inside the\n * renderer (HTML error pages, envelope-wrapped responses, empty bodies).\n */\nexport function assertCaveSpace(\n payload: unknown,\n context: { spaceId?: string; url?: string } = {}\n): CaveSpace {\n const problem = findSpaceProblem(payload)\n if (problem) {\n throw new CaveWorldError(\n 'INVALID_SPACE',\n `Invalid CaveSpace payload${context.spaceId ? ` for ${context.spaceId}` : ''}: ${problem}.`,\n context\n )\n }\n return payload as CaveSpace\n}\n\nfunction findSpaceProblem(payload: unknown): string | undefined {\n if (payload == null || typeof payload !== 'object') {\n return `expected an object, received ${payload === null ? 'null' : typeof payload}`\n }\n\n const space = payload as Partial<CaveSpace>\n const baseLayer = space.baseLayer\n if (baseLayer == null || typeof baseLayer !== 'object') {\n return 'missing `baseLayer`'\n }\n if (baseLayer.transform == null || !Array.isArray(baseLayer.transform.position)) {\n return 'missing `baseLayer.transform.position`'\n }\n if (baseLayer.scene == null || typeof baseLayer.scene.url !== 'string') {\n return 'missing `baseLayer.scene.url`'\n }\n if (space.customLayers != null && !Array.isArray(space.customLayers)) {\n return '`customLayers` must be an array when present'\n }\n return undefined\n}\n\n/**\n * Default loader against the public CaveGiant content API.\n *\n * Convenient for demos and CaveGiant-hosted apps. Third-party hosts should\n * pass `createHttpCaveSpaceLoader({ buildUrl })` (or any async function) via\n * `caveSpaceLoader` instead of relying on this endpoint.\n */\nexport const DefaultCaveSpaceLoader: CaveSpaceLoader = createHttpCaveSpaceLoader()\n"],"names":["DEFAULT_CAVE_SPACE_API_BASE_URL","DEFAULT_CAVE_SPACE_TIMEOUT_MS","createHttpCaveSpaceLoader","options","baseUrl","buildUrl","spaceId","headers","timeoutMs","fetchImpl","url","doFetch","controller","timer","response","error","CaveWorldError","payload","assertCaveSpace","context","problem","findSpaceProblem","space","baseLayer","DefaultCaveSpaceLoader"],"mappings":";AAOO,MAAMA,IAAkC,+CAGlCC,IAAgC;AAgCtC,SAASC,EACdC,IAAsC,IACrB;AACjB,QAAM;AAAA,IACJ,SAAAC,IAAUJ;AAAA,IACV,UAAAK,IAAW,CAACC,MACV,GAAGF,EAAQ,QAAQ,OAAO,EAAE,CAAC,gBAAgB,mBAAmBE,CAAO,CAAC;AAAA,IAC1E,SAAAC;AAAA,IACA,WAAAC,IAAYP;AAAA,IACZ,OAAOQ;AAAA,EAAA,IACLN;AAEJ,SAAO,eAA6BG,GAAqC;AACvE,UAAMI,IAAML,EAASC,CAAO,GACtBK,IAAUF,KAAa,WAAW,OAClCG,IAAaJ,IAAY,IAAI,IAAI,oBAAoB,QACrDK,IACJD,KAAcJ,IAAY,IAAI,WAAW,MAAMI,EAAW,MAAA,GAASJ,CAAS,IAAI;AAElF,QAAIM;AACJ,QAAI;AACF,MAAAA,IAAW,MAAMH,EAAQD,GAAK,EAAE,SAAAH,GAAS,QAAQK,GAAY,QAAQ;AAAA,IACvE,SAASG,GAAO;AACd,YAAIH,GAAY,OAAO,UACf,IAAII;AAAA,QACR;AAAA,QACA,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,MAAIA,EAAU,aAAa,QAAQ,CAAC,MAAM,QAAQA,EAAU,UAAU,QAAQ;AAC5E,WAAO;AAET,MAAIA,EAAU,SAAS,QAAQ,OAAOA,EAAU,MAAM,OAAQ;AAC5D,WAAO;AAET,MAAID,EAAM,gBAAgB,QAAQ,CAAC,MAAM,QAAQA,EAAM,YAAY;AACjE,WAAO;AAGX;AASO,MAAME,IAA0CtB,EAAA;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Matrix4, Quaternion, Vector3 } from 'three';
|
|
2
|
+
import type { CaveSpace, ConnectorDef, Matrix16, SpawnPoint, Transform } from '../../types/index.js';
|
|
3
|
+
/** How far past a portal connector's +Z face the arriving character lands. */
|
|
4
|
+
export declare const PORTAL_SPAWN_FORWARD_OFFSET_M = 0.5;
|
|
5
|
+
export interface SpawnPose {
|
|
6
|
+
position: Vector3;
|
|
7
|
+
quaternion: Quaternion;
|
|
8
|
+
}
|
|
9
|
+
/** Compose a `Matrix4` from a scene-JSON `Transform` (position + quaternion + scale). */
|
|
10
|
+
export declare function transformToMatrix4(transform: Transform): Matrix4;
|
|
11
|
+
/**
|
|
12
|
+
* World-space group matrix for a seamless-connected space.
|
|
13
|
+
*
|
|
14
|
+
* The raw alignment matrix `M_raw` from the scene JSON maps a point in the
|
|
15
|
+
* SOURCE model's local coordinates (before `baseLayer.transform` is applied) to
|
|
16
|
+
* the same physical point in the TARGET model's local coordinates:
|
|
17
|
+
*
|
|
18
|
+
* p_target_local = M_raw × p_source_local
|
|
19
|
+
*
|
|
20
|
+
* Combined with the source/target base-layer transforms (`T_source`,
|
|
21
|
+
* `T_target`) and the source's own group matrix (`G_source`):
|
|
22
|
+
*
|
|
23
|
+
* G_target = G_source × T_source × inverse(M_raw) × inverse(T_target)
|
|
24
|
+
*/
|
|
25
|
+
export declare function computeSeamlessGroupMatrix(sourceGroupMatrix: Matrix4, sourceBaseLayerTransform: Transform, rawAlignment: Matrix16, targetBaseLayerTransform: Transform): Matrix4;
|
|
26
|
+
/**
|
|
27
|
+
* Spawn pose for a character arriving at a portal-target connector.
|
|
28
|
+
*
|
|
29
|
+
* The connector defines a box (position, Euler rotation, scale) in the target
|
|
30
|
+
* space's base-layer-local coordinates. The character lands on the centre of
|
|
31
|
+
* that box's +Z face plus {@link PORTAL_SPAWN_FORWARD_OFFSET_M} — i.e. one step
|
|
32
|
+
* *outside* the box, so the arrival does not immediately re-trigger the sensor —
|
|
33
|
+
* facing the same +Z direction.
|
|
34
|
+
*
|
|
35
|
+
* The result is world-space, accounting for both the target's group matrix
|
|
36
|
+
* (`G_target`) and its base-layer transform (`T_target`).
|
|
37
|
+
*/
|
|
38
|
+
export declare function computePortalSpawnPose(connector: ConnectorDef, targetBaseLayerTransform: Transform, targetGroupMatrix: Matrix4 | undefined): SpawnPose;
|
|
39
|
+
/**
|
|
40
|
+
* Spawn pose for a character entering a scene via `baseLayer.spawnPoint`
|
|
41
|
+
* (base-layer-local position + yaw around Y), expressed in world space.
|
|
42
|
+
*/
|
|
43
|
+
export declare function computeSpawnPose(spawn: SpawnPoint, targetBaseLayerTransform: Transform, targetGroupMatrix: Matrix4 | undefined): SpawnPose;
|
|
44
|
+
/** Every distinct `caveWorldId` referenced by a space's connectors. */
|
|
45
|
+
export declare function getConnectorTargetIds(space: CaveSpace | undefined): string[];
|
|
46
|
+
export declare function findConnectorById(space: CaveSpace | undefined, connectorId: string): ConnectorDef | undefined;
|
|
47
|
+
/** Read a stored `Matrix16` back into a `Matrix4`, or `undefined` when unset. */
|
|
48
|
+
export declare function matrixFromM16(m16: Matrix16 | undefined): Matrix4 | undefined;
|
|
49
|
+
//# sourceMappingURL=space-transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space-transforms.d.ts","sourceRoot":"","sources":["../../../explore/math/space-transforms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC3D,OAA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();
|
|
3
|
+
function p(n) {
|
|
4
|
+
return new s().compose(
|
|
5
|
+
new r(...n.position),
|
|
6
|
+
new u(...n.rotation),
|
|
7
|
+
new r(...n.scale)
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
function T(n, t, o, e) {
|
|
11
|
+
const i = p(t), c = new s().fromArray(o).invert(), a = p(e).invert();
|
|
12
|
+
return new s().copy(n).multiply(i).multiply(c).multiply(a);
|
|
13
|
+
}
|
|
14
|
+
function x(n, t, o) {
|
|
15
|
+
const [e, i, c] = n.transform.rotation, a = new u().setFromEuler(new f(e, i, c)), m = n.transform.scale[2] / 2 + d, y = new r(0, 0, m).applyQuaternion(a).add(new r(...n.transform.position));
|
|
16
|
+
return w(y, a, t, o);
|
|
17
|
+
}
|
|
18
|
+
function A(n, t, o) {
|
|
19
|
+
const e = new u().setFromEuler(new f(0, n.yaw, 0));
|
|
20
|
+
return w(
|
|
21
|
+
new r(...n.position),
|
|
22
|
+
e,
|
|
23
|
+
t,
|
|
24
|
+
o
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function w(n, t, o, e) {
|
|
28
|
+
const i = p(o), c = new s().multiplyMatrices(e ?? I, i), a = n.clone().applyMatrix4(c), l = new u();
|
|
29
|
+
return c.decompose(new r(), l, new r()), { position: a, quaternion: l.multiply(t) };
|
|
30
|
+
}
|
|
31
|
+
function P(n) {
|
|
32
|
+
const t = /* @__PURE__ */ new Set();
|
|
33
|
+
for (const o of n?.baseLayer?.connectors ?? [])
|
|
34
|
+
for (const e of o.connectorInfo.to)
|
|
35
|
+
t.add(e.caveWorldId);
|
|
36
|
+
return Array.from(t);
|
|
37
|
+
}
|
|
38
|
+
function S(n, t) {
|
|
39
|
+
return n?.baseLayer?.connectors?.find((o) => o.id === t);
|
|
40
|
+
}
|
|
41
|
+
function v(n) {
|
|
42
|
+
return n ? new s().fromArray(n) : void 0;
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
d as PORTAL_SPAWN_FORWARD_OFFSET_M,
|
|
46
|
+
x as computePortalSpawnPose,
|
|
47
|
+
T as computeSeamlessGroupMatrix,
|
|
48
|
+
A as computeSpawnPose,
|
|
49
|
+
S as findConnectorById,
|
|
50
|
+
P as getConnectorTargetIds,
|
|
51
|
+
v as matrixFromM16,
|
|
52
|
+
p as transformToMatrix4
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=space-transforms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space-transforms.js","sources":["../../../explore/math/space-transforms.ts"],"sourcesContent":["import { Euler, Matrix4, Quaternion, Vector3 } from 'three'\nimport type { CaveSpace, ConnectorDef, Matrix16, SpawnPoint, Transform } from '../../types'\n\n/** How far past a portal connector's +Z face the arriving character lands. */\nexport const PORTAL_SPAWN_FORWARD_OFFSET_M = 0.5\n\nconst IDENTITY_MATRIX4 = /* @__PURE__ */ new Matrix4()\n\nexport interface SpawnPose {\n position: Vector3\n quaternion: Quaternion\n}\n\n/** Compose a `Matrix4` from a scene-JSON `Transform` (position + quaternion + scale). */\nexport function transformToMatrix4(transform: Transform): Matrix4 {\n return new Matrix4().compose(\n new Vector3(...transform.position),\n new Quaternion(...transform.rotation),\n new Vector3(...transform.scale)\n )\n}\n\n/**\n * World-space group matrix for a seamless-connected space.\n *\n * The raw alignment matrix `M_raw` from the scene JSON maps a point in the\n * SOURCE model's local coordinates (before `baseLayer.transform` is applied) to\n * the same physical point in the TARGET model's local coordinates:\n *\n * p_target_local = M_raw × p_source_local\n *\n * Combined with the source/target base-layer transforms (`T_source`,\n * `T_target`) and the source's own group matrix (`G_source`):\n *\n * G_target = G_source × T_source × inverse(M_raw) × inverse(T_target)\n */\nexport function computeSeamlessGroupMatrix(\n sourceGroupMatrix: Matrix4,\n sourceBaseLayerTransform: Transform,\n rawAlignment: Matrix16,\n targetBaseLayerTransform: Transform\n): Matrix4 {\n const tSource = transformToMatrix4(sourceBaseLayerTransform)\n const mRawInv = new Matrix4().fromArray(rawAlignment).invert()\n const tTargetInv = transformToMatrix4(targetBaseLayerTransform).invert()\n\n return new Matrix4()\n .copy(sourceGroupMatrix)\n .multiply(tSource)\n .multiply(mRawInv)\n .multiply(tTargetInv)\n}\n\n/**\n * Spawn pose for a character arriving at a portal-target connector.\n *\n * The connector defines a box (position, Euler rotation, scale) in the target\n * space's base-layer-local coordinates. The character lands on the centre of\n * that box's +Z face plus {@link PORTAL_SPAWN_FORWARD_OFFSET_M} — i.e. one step\n * *outside* the box, so the arrival does not immediately re-trigger the sensor —\n * facing the same +Z direction.\n *\n * The result is world-space, accounting for both the target's group matrix\n * (`G_target`) and its base-layer transform (`T_target`).\n */\nexport function computePortalSpawnPose(\n connector: ConnectorDef,\n targetBaseLayerTransform: Transform,\n targetGroupMatrix: Matrix4 | undefined\n): SpawnPose {\n const [rx, ry, rz] = connector.transform.rotation\n const connectorQuat = new Quaternion().setFromEuler(new Euler(rx, ry, rz))\n\n const halfDepth = connector.transform.scale[2] / 2\n const offsetDistance = halfDepth + PORTAL_SPAWN_FORWARD_OFFSET_M\n const baseLayerLocalPos = new Vector3(0, 0, offsetDistance)\n .applyQuaternion(connectorQuat)\n .add(new Vector3(...connector.transform.position))\n\n return toWorldPose(baseLayerLocalPos, connectorQuat, targetBaseLayerTransform, targetGroupMatrix)\n}\n\n/**\n * Spawn pose for a character entering a scene via `baseLayer.spawnPoint`\n * (base-layer-local position + yaw around Y), expressed in world space.\n */\nexport function computeSpawnPose(\n spawn: SpawnPoint,\n targetBaseLayerTransform: Transform,\n targetGroupMatrix: Matrix4 | undefined\n): SpawnPose {\n const localQuat = new Quaternion().setFromEuler(new Euler(0, spawn.yaw, 0))\n return toWorldPose(\n new Vector3(...spawn.position),\n localQuat,\n targetBaseLayerTransform,\n targetGroupMatrix\n )\n}\n\n/** Lift a base-layer-local pose into world space through `G_target × T_target`. */\nfunction toWorldPose(\n localPosition: Vector3,\n localQuaternion: Quaternion,\n targetBaseLayerTransform: Transform,\n targetGroupMatrix: Matrix4 | undefined\n): SpawnPose {\n const tTarget = transformToMatrix4(targetBaseLayerTransform)\n const worldMat = new Matrix4().multiplyMatrices(targetGroupMatrix ?? IDENTITY_MATRIX4, tTarget)\n\n const position = localPosition.clone().applyMatrix4(worldMat)\n\n // Decompose rather than reading the rotation directly so any scale baked into\n // G_target / T_target does not leak into the orientation.\n const parentQuat = new Quaternion()\n worldMat.decompose(new Vector3(), parentQuat, new Vector3())\n\n return { position, quaternion: parentQuat.multiply(localQuaternion) }\n}\n\n/** Every distinct `caveWorldId` referenced by a space's connectors. */\nexport function getConnectorTargetIds(space: CaveSpace | undefined): string[] {\n const ids = new Set<string>()\n for (const connector of space?.baseLayer?.connectors ?? []) {\n for (const target of connector.connectorInfo.to) {\n ids.add(target.caveWorldId)\n }\n }\n return Array.from(ids)\n}\n\nexport function findConnectorById(\n space: CaveSpace | undefined,\n connectorId: string\n): ConnectorDef | undefined {\n return space?.baseLayer?.connectors?.find((connector) => connector.id === connectorId)\n}\n\n/** Read a stored `Matrix16` back into a `Matrix4`, or `undefined` when unset. */\nexport function matrixFromM16(m16: Matrix16 | undefined): Matrix4 | undefined {\n return m16 ? new Matrix4().fromArray(m16) : undefined\n}\n"],"names":["PORTAL_SPAWN_FORWARD_OFFSET_M","IDENTITY_MATRIX4","Matrix4","transformToMatrix4","transform","Vector3","Quaternion","computeSeamlessGroupMatrix","sourceGroupMatrix","sourceBaseLayerTransform","rawAlignment","targetBaseLayerTransform","tSource","mRawInv","tTargetInv","computePortalSpawnPose","connector","targetGroupMatrix","rx","ry","rz","connectorQuat","Euler","offsetDistance","baseLayerLocalPos","toWorldPose","computeSpawnPose","spawn","localQuat","localPosition","localQuaternion","tTarget","worldMat","position","parentQuat","getConnectorTargetIds","space","ids","target","findConnectorById","connectorId","matrixFromM16","m16"],"mappings":";AAIO,MAAMA,IAAgC,KAEvCC,wBAAuCC,EAAA;AAQtC,SAASC,EAAmBC,GAA+B;AAChE,SAAO,IAAIF,IAAU;AAAA,IACnB,IA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AkB8B,CAAO,GAExFE,IAAWJ,EAAc,MAAA,EAAQ,aAAaG,CAAQ,GAItDE,IAAa,IAAI5B,EAAA;AACvB,SAAA0B,EAAS,UAAU,IAAI3B,EAAA,GAAW6B,GAAY,IAAI7B,GAAS,GAEpD,EAAE,UAAA4B,GAAU,YAAYC,EAAW,SAASJ,CAAe,EAAA;AACpE;AAGO,SAASK,EAAsBC,GAAwC;AAC5E,QAAMC,wBAAU,IAAA;AAChB,aAAWrB,KAAaoB,GAAO,WAAW,cAAc,CAAA;AACtD,eAAWE,KAAUtB,EAAU,cAAc;AAC3C,MAAAqB,EAAI,IAAIC,EAAO,WAAW;AAG9B,SAAO,MAAM,KAAKD,CAAG;AACvB;AAEO,SAASE,EACdH,GACAI,GAC0B;AAC1B,SAAOJ,GAAO,WAAW,YAAY,KAAK,CAACpB,MAAcA,EAAU,OAAOwB,CAAW;AACvF;AAGO,SAASC,EAAcC,GAAgD;AAC5E,SAAOA,IAAM,IAAIxC,EAAA,EAAU,UAAUwC,CAAG,IAAI;AAC9C;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-scene hint anchored at a world position, e.g. "F View details".
|
|
3
|
+
*
|
|
4
|
+
* Renders inside the R3F canvas (drei `Html`), so it must be mounted in the 3D
|
|
5
|
+
* tree — unlike the screen-space `ActionPanel`.
|
|
6
|
+
*/
|
|
7
|
+
export default function ActionBubble(): import("react").JSX.Element | null;
|
|
8
|
+
//# sourceMappingURL=action-bubble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-bubble.d.ts","sourceRoot":"","sources":["../../../explore/overlays/action-bubble.tsx"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,uCAqBnC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as l, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { Html as o } from "@react-three/drei";
|
|
3
|
+
import { useActionPrompt as t } from "../stores/explore-context.js";
|
|
4
|
+
function u() {
|
|
5
|
+
const r = t((e) => e.actions), s = t((e) => e.anchor);
|
|
6
|
+
return t((e) => e.style) !== "bubble" || !s || r.length === 0 ? null : (
|
|
7
|
+
// Only `cw-overlay-root` here: drei positions this wrapper with inline
|
|
8
|
+
// styles, so any class that sets a size on it would break the anchoring.
|
|
9
|
+
/* @__PURE__ */ l(o, { position: s, center: !0, className: "cw-overlay-root", children: /* @__PURE__ */ l("div", { className: "cw-bubble-layer", children: r.map((e) => /* @__PURE__ */ c("div", { className: "cw-bubble", children: [
|
|
10
|
+
e.shortcut ? /* @__PURE__ */ l("span", { className: "cw-bubble__key", children: e.shortcut }) : null,
|
|
11
|
+
e.label
|
|
12
|
+
] }, e.id)) }) })
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
u as default
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=action-bubble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-bubble.js","sources":["../../../explore/overlays/action-bubble.tsx"],"sourcesContent":["import { Html } from '@react-three/drei'\nimport { useActionPrompt } from '../stores/explore-context'\n\n/**\n * In-scene hint anchored at a world position, e.g. \"F View details\".\n *\n * Renders inside the R3F canvas (drei `Html`), so it must be mounted in the 3D\n * tree — unlike the screen-space `ActionPanel`.\n */\nexport default function ActionBubble() {\n const actions = useActionPrompt((s) => s.actions)\n const anchor = useActionPrompt((s) => s.anchor)\n const style = useActionPrompt((s) => s.style)\n\n if (style !== 'bubble' || !anchor || actions.length === 0) return null\n\n return (\n // Only `cw-overlay-root` here: drei positions this wrapper with inline\n // styles, so any class that sets a size on it would break the anchoring.\n <Html position={anchor} center className=\"cw-overlay-root\">\n <div className=\"cw-bubble-layer\">\n {actions.map((action) => (\n <div key={action.id} className=\"cw-bubble\">\n {action.shortcut ? <span className=\"cw-bubble__key\">{action.shortcut}</span> : null}\n {action.label}\n </div>\n ))}\n </div>\n </Html>\n )\n}\n"],"names":["ActionBubble","actions","useActionPrompt","s","anchor","Html","jsx","action","jsxs"],"mappings":";;;AASA,SAAwBA,IAAe;AACrC,QAAMC,IAAUC,EAAgB,CAACC,MAAMA,EAAE,OAAO,GAC1CC,IAASF,EAAgB,CAACC,MAAMA,EAAE,MAAM;AAG9C,SAFcD,EAAgB,CAACC,MAAMA,EAAE,KAAK,MAE9B,YAAY,CAACC,KAAUH,EAAQ,WAAW,IAAU;AAAA;AAAA;AAAA,sBAK/DI,GAAA,EAAK,UAAUD,GAAQ,QAAM,IAAC,WAAU,mBACvC,UAAA,gBAAAE,EAAC,SAAI,WAAU,mBACZ,YAAQ,IAAI,CAACC,MACZ,gBAAAC,EAAC,OAAA,EAAoB,WAAU,aAC5B,UAAA;AAAA,MAAAD,EAAO,WAAW,gBAAAD,EAAC,QAAA,EAAK,WAAU,kBAAkB,UAAAC,EAAO,UAAS,IAAU;AAAA,MAC9EA,EAAO;AAAA,IAAA,EAAA,GAFAA,EAAO,EAGjB,CACD,EAAA,CACH,EAAA,CACF;AAAA;AAEJ;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Screen-space list of the currently available actions — used for multi-choice
|
|
3
|
+
* interactions such as picking a portal destination.
|
|
4
|
+
*
|
|
5
|
+
* Intentionally low-intrusion: a compact chamfered card with no full-screen
|
|
6
|
+
* scrim, so the scene stays visible when the player just brushes past a
|
|
7
|
+
* connector. The decorative nodes (rim, grain, hairline, corner marks) are
|
|
8
|
+
* `aria-hidden` siblings rather than pseudo-elements because several of them
|
|
9
|
+
* need their own stacking and blend context.
|
|
10
|
+
*/
|
|
11
|
+
export default function ActionPanel(): import("react").JSX.Element | null;
|
|
12
|
+
//# sourceMappingURL=action-panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-panel.d.ts","sourceRoot":"","sources":["../../../explore/overlays/action-panel.tsx"],"names":[],"mappings":"AAwBA;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,uCA0FlC"}
|