@iwsdk/core 0.4.2 → 0.5.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/README.md +4 -7
- package/dist/asset/asset-manager.d.ts +136 -8
- package/dist/asset/asset-manager.d.ts.map +1 -1
- package/dist/asset/asset-manager.js +491 -47
- package/dist/asset/asset-manager.js.map +1 -1
- package/dist/asset/cache-manager.d.ts +4 -2
- package/dist/asset/cache-manager.d.ts.map +1 -1
- package/dist/asset/cache-manager.js +10 -3
- package/dist/asset/cache-manager.js.map +1 -1
- package/dist/asset/loaders/audio-loader.d.ts +1 -1
- package/dist/asset/loaders/audio-loader.d.ts.map +1 -1
- package/dist/asset/loaders/audio-loader.js +8 -26
- package/dist/asset/loaders/audio-loader.js.map +1 -1
- package/dist/asset/loaders/cached-asset-load.d.ts +35 -0
- package/dist/asset/loaders/cached-asset-load.d.ts.map +1 -0
- package/dist/asset/loaders/cached-asset-load.js +100 -0
- package/dist/asset/loaders/cached-asset-load.js.map +1 -0
- package/dist/asset/loaders/gltf-loader.d.ts +28 -1
- package/dist/asset/loaders/gltf-loader.d.ts.map +1 -1
- package/dist/asset/loaders/gltf-loader.js +254 -33
- package/dist/asset/loaders/gltf-loader.js.map +1 -1
- package/dist/asset/loaders/hdr-texture-loader.d.ts +1 -1
- package/dist/asset/loaders/hdr-texture-loader.d.ts.map +1 -1
- package/dist/asset/loaders/hdr-texture-loader.js +19 -29
- package/dist/asset/loaders/hdr-texture-loader.js.map +1 -1
- package/dist/asset/loaders/texture-loader.d.ts +1 -1
- package/dist/asset/loaders/texture-loader.d.ts.map +1 -1
- package/dist/asset/loaders/texture-loader.js +9 -26
- package/dist/asset/loaders/texture-loader.js.map +1 -1
- package/dist/asset/loaders/uikitml-loader.d.ts +12 -0
- package/dist/asset/loaders/uikitml-loader.d.ts.map +1 -0
- package/dist/asset/loaders/uikitml-loader.js +44 -0
- package/dist/asset/loaders/uikitml-loader.js.map +1 -0
- package/dist/audio/audio-pool.d.ts +7 -0
- package/dist/audio/audio-pool.d.ts.map +1 -1
- package/dist/audio/audio-pool.js.map +1 -1
- package/dist/audio/audio-system.d.ts +1 -0
- package/dist/audio/audio-system.d.ts.map +1 -1
- package/dist/audio/audio-system.js +16 -2
- package/dist/audio/audio-system.js.map +1 -1
- package/dist/camera/camera-system.d.ts.map +1 -1
- package/dist/camera/camera-system.js +5 -3
- package/dist/camera/camera-system.js.map +1 -1
- package/dist/depth/depth-sensing-system.d.ts.map +1 -1
- package/dist/depth/depth-sensing-system.js +31 -10
- package/dist/depth/depth-sensing-system.js.map +1 -1
- package/dist/ecs/builtin-components.d.ts +1239 -0
- package/dist/ecs/builtin-components.d.ts.map +1 -0
- package/dist/ecs/builtin-components.js +87 -0
- package/dist/ecs/builtin-components.js.map +1 -0
- package/dist/ecs/component-editor-metadata.d.ts +19 -0
- package/dist/ecs/component-editor-metadata.d.ts.map +1 -0
- package/dist/ecs/component-editor-metadata.js +19 -0
- package/dist/ecs/component-editor-metadata.js.map +1 -0
- package/dist/ecs/component-manifest.d.ts +24 -0
- package/dist/ecs/component-manifest.d.ts.map +1 -0
- package/dist/ecs/component-manifest.js +121 -0
- package/dist/ecs/component-manifest.js.map +1 -0
- package/dist/ecs/component.d.ts +1 -0
- package/dist/ecs/component.d.ts.map +1 -1
- package/dist/ecs/entity.d.ts +20 -2
- package/dist/ecs/entity.d.ts.map +1 -1
- package/dist/ecs/entity.js +59 -3
- package/dist/ecs/entity.js.map +1 -1
- package/dist/ecs/index.d.ts +3 -1
- package/dist/ecs/index.d.ts.map +1 -1
- package/dist/ecs/system.d.ts +9 -0
- package/dist/ecs/system.d.ts.map +1 -1
- package/dist/ecs/system.js.map +1 -1
- package/dist/ecs/world.d.ts +158 -4
- package/dist/ecs/world.d.ts.map +1 -1
- package/dist/ecs/world.js +304 -5
- package/dist/ecs/world.js.map +1 -1
- package/dist/environment/dome-gradient.d.ts +2 -1
- package/dist/environment/dome-gradient.d.ts.map +1 -1
- package/dist/environment/dome-gradient.js +2 -1
- package/dist/environment/dome-gradient.js.map +1 -1
- package/dist/environment/environment-system.d.ts +19 -3
- package/dist/environment/environment-system.d.ts.map +1 -1
- package/dist/environment/environment-system.js +78 -48
- package/dist/environment/environment-system.js.map +1 -1
- package/dist/environment/gradient-environment.d.ts.map +1 -1
- package/dist/environment/gradient-environment.js +13 -7
- package/dist/environment/gradient-environment.js.map +1 -1
- package/dist/environment/scene-ar-environment.d.ts +39 -0
- package/dist/environment/scene-ar-environment.d.ts.map +1 -0
- package/dist/environment/scene-ar-environment.js +93 -0
- package/dist/environment/scene-ar-environment.js.map +1 -0
- package/dist/grab/grab-helpers.d.ts +39 -0
- package/dist/grab/grab-helpers.d.ts.map +1 -0
- package/dist/grab/grab-helpers.js +59 -0
- package/dist/grab/grab-helpers.js.map +1 -0
- package/dist/grab/grab-system.d.ts +45 -0
- package/dist/grab/grab-system.d.ts.map +1 -1
- package/dist/grab/grab-system.js +67 -5
- package/dist/grab/grab-system.js.map +1 -1
- package/dist/grab/grab-warnings.d.ts +14 -0
- package/dist/grab/grab-warnings.d.ts.map +1 -0
- package/dist/grab/grab-warnings.js +53 -0
- package/dist/grab/grab-warnings.js.map +1 -0
- package/dist/grab/handles.d.ts.map +1 -1
- package/dist/grab/handles.js +8 -3
- package/dist/grab/handles.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -16
- package/dist/index.js.map +1 -1
- package/dist/init/world-initializer.d.ts +11 -7
- package/dist/init/world-initializer.d.ts.map +1 -1
- package/dist/init/world-initializer.js +118 -57
- package/dist/init/world-initializer.js.map +1 -1
- package/dist/init/xr.d.ts +0 -1
- package/dist/init/xr.d.ts.map +1 -1
- package/dist/init/xr.js +12 -3
- package/dist/init/xr.js.map +1 -1
- package/dist/input/input-system.d.ts.map +1 -1
- package/dist/input/input-system.js +26 -11
- package/dist/input/input-system.js.map +1 -1
- package/dist/layers/xr-layer-state.d.ts +47 -0
- package/dist/layers/xr-layer-state.d.ts.map +1 -0
- package/dist/layers/xr-layer-state.js +23 -0
- package/dist/layers/xr-layer-state.js.map +1 -0
- package/dist/layers/xr-layer-system.d.ts +45 -93
- package/dist/layers/xr-layer-system.d.ts.map +1 -1
- package/dist/layers/xr-layer-system.js +4 -25
- package/dist/layers/xr-layer-system.js.map +1 -1
- package/dist/level/index.d.ts +6 -2
- package/dist/level/index.d.ts.map +1 -1
- package/dist/level/level-component-applier.d.ts +24 -0
- package/dist/level/level-component-applier.d.ts.map +1 -0
- package/dist/level/level-component-applier.js +199 -0
- package/dist/level/level-component-applier.js.map +1 -0
- package/dist/level/level-player-rig.d.ts +17 -0
- package/dist/level/level-player-rig.d.ts.map +1 -0
- package/dist/level/level-player-rig.js +113 -0
- package/dist/level/level-player-rig.js.map +1 -0
- package/dist/level/level-scene-environment.d.ts +28 -0
- package/dist/level/level-scene-environment.d.ts.map +1 -0
- package/dist/level/level-scene-environment.js +121 -0
- package/dist/level/level-scene-environment.js.map +1 -0
- package/dist/level/level-scene-json-importer.d.ts +53 -0
- package/dist/level/level-scene-json-importer.d.ts.map +1 -0
- package/dist/level/level-scene-json-importer.js +256 -0
- package/dist/level/level-scene-json-importer.js.map +1 -0
- package/dist/level/level-scene-material.d.ts +22 -0
- package/dist/level/level-scene-material.d.ts.map +1 -0
- package/dist/level/level-scene-material.js +231 -0
- package/dist/level/level-scene-material.js.map +1 -0
- package/dist/level/level-scene-object.d.ts +49 -0
- package/dist/level/level-scene-object.d.ts.map +1 -0
- package/dist/level/level-scene-object.js +396 -0
- package/dist/level/level-scene-object.js.map +1 -0
- package/dist/level/level-scene-primitive.d.ts +21 -0
- package/dist/level/level-scene-primitive.d.ts.map +1 -0
- package/dist/level/level-scene-primitive.js +159 -0
- package/dist/level/level-scene-primitive.js.map +1 -0
- package/dist/level/level-system.d.ts +14 -20
- package/dist/level/level-system.d.ts.map +1 -1
- package/dist/level/level-system.js +114 -49
- package/dist/level/level-system.js.map +1 -1
- package/dist/lighting/index.d.ts +10 -0
- package/dist/lighting/index.d.ts.map +1 -0
- package/dist/lighting/index.js +4 -0
- package/dist/lighting/index.js.map +1 -0
- package/dist/lighting/light-binding.d.ts +76 -0
- package/dist/lighting/light-binding.d.ts.map +1 -0
- package/dist/lighting/light-binding.js +229 -0
- package/dist/lighting/light-binding.js.map +1 -0
- package/dist/lighting/light-components.d.ts +885 -0
- package/dist/lighting/light-components.d.ts.map +1 -0
- package/dist/lighting/light-components.js +146 -0
- package/dist/lighting/light-components.js.map +1 -0
- package/dist/lighting/light-system.d.ts +919 -0
- package/dist/lighting/light-system.d.ts.map +1 -0
- package/dist/lighting/light-system.js +244 -0
- package/dist/lighting/light-system.js.map +1 -0
- package/dist/locomotion/locomotion-environment.d.ts +27 -0
- package/dist/locomotion/locomotion-environment.d.ts.map +1 -0
- package/dist/locomotion/locomotion-environment.js +22 -0
- package/dist/locomotion/locomotion-environment.js.map +1 -0
- package/dist/locomotion/locomotion.d.ts +5 -34
- package/dist/locomotion/locomotion.d.ts.map +1 -1
- package/dist/locomotion/locomotion.js +33 -31
- package/dist/locomotion/locomotion.js.map +1 -1
- package/dist/locomotion/materials/line.js +1 -1
- package/dist/locomotion/slide.d.ts.map +1 -1
- package/dist/locomotion/slide.js +2 -2
- package/dist/locomotion/slide.js.map +1 -1
- package/dist/mcp/ecs-debug-tools.d.ts.map +1 -1
- package/dist/mcp/ecs-debug-tools.js +10 -2
- package/dist/mcp/ecs-debug-tools.js.map +1 -1
- package/dist/mcp/mcp-runtime.d.ts.map +1 -1
- package/dist/mcp/mcp-runtime.js +4 -1
- package/dist/mcp/mcp-runtime.js.map +1 -1
- package/dist/mcp/scene-tools.d.ts +152 -1
- package/dist/mcp/scene-tools.d.ts.map +1 -1
- package/dist/mcp/scene-tools.js +538 -8
- package/dist/mcp/scene-tools.js.map +1 -1
- package/dist/physics/index.js +11 -4
- package/dist/physics/index.js.map +1 -1
- package/dist/physics/physics-system.d.ts +704 -11
- package/dist/physics/physics-system.d.ts.map +1 -1
- package/dist/physics/physics-system.js +307 -25
- package/dist/physics/physics-system.js.map +1 -1
- package/dist/physics/physicsBody.d.ts +40 -1
- package/dist/physics/physicsBody.d.ts.map +1 -1
- package/dist/physics/physicsBody.js +39 -0
- package/dist/physics/physicsBody.js.map +1 -1
- package/dist/physics/physicsManipulation.d.ts +1 -1
- package/dist/physics/physicsManipulation.d.ts.map +1 -1
- package/dist/physics/physicsShape.d.ts +5 -3
- package/dist/physics/physicsShape.d.ts.map +1 -1
- package/dist/physics/physicsShape.js +2 -1
- package/dist/physics/physicsShape.js.map +1 -1
- package/dist/physics/utils.d.ts +10 -0
- package/dist/physics/utils.d.ts.map +1 -1
- package/dist/physics/utils.js +82 -48
- package/dist/physics/utils.js.map +1 -1
- package/dist/project/index.d.ts +11 -0
- package/dist/project/index.d.ts.map +1 -0
- package/dist/project/index.js +5 -0
- package/dist/project/index.js.map +1 -0
- package/dist/project/normalize.d.ts +19 -0
- package/dist/project/normalize.d.ts.map +1 -0
- package/dist/project/normalize.js +206 -0
- package/dist/project/normalize.js.map +1 -0
- package/dist/project/paths.d.ts +21 -0
- package/dist/project/paths.d.ts.map +1 -0
- package/dist/project/paths.js +75 -0
- package/dist/project/paths.js.map +1 -0
- package/dist/project/types.d.ts +159 -0
- package/dist/project/types.d.ts.map +1 -0
- package/dist/project/types.js +11 -0
- package/dist/project/types.js.map +1 -0
- package/dist/project/validation.d.ts +17 -0
- package/dist/project/validation.d.ts.map +1 -0
- package/dist/project/validation.js +501 -0
- package/dist/project/validation.js.map +1 -0
- package/dist/scene-understanding/scene-understanding-system.d.ts +23 -2
- package/dist/scene-understanding/scene-understanding-system.d.ts.map +1 -1
- package/dist/scene-understanding/scene-understanding-system.js +76 -54
- package/dist/scene-understanding/scene-understanding-system.js.map +1 -1
- package/dist/schemas/iwsdk-project.v1.schema.json +305 -0
- package/dist/transform/transform-component.d.ts +32 -0
- package/dist/transform/transform-component.d.ts.map +1 -0
- package/dist/transform/transform-component.js +24 -0
- package/dist/transform/transform-component.js.map +1 -0
- package/dist/transform/transform.d.ts +9 -42
- package/dist/transform/transform.d.ts.map +1 -1
- package/dist/transform/transform.js +8 -25
- package/dist/transform/transform.js.map +1 -1
- package/dist/ui/document.d.ts +9 -2
- package/dist/ui/document.d.ts.map +1 -1
- package/dist/ui/document.js +30 -5
- package/dist/ui/document.js.map +1 -1
- package/dist/ui/follow-component.d.ts +57 -0
- package/dist/ui/follow-component.d.ts.map +1 -0
- package/dist/ui/follow-component.js +38 -0
- package/dist/ui/follow-component.js.map +1 -0
- package/dist/ui/follow.d.ts +28 -102
- package/dist/ui/follow.d.ts.map +1 -1
- package/dist/ui/follow.js +10 -48
- package/dist/ui/follow.js.map +1 -1
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/panel-components.d.ts +29 -0
- package/dist/ui/panel-components.d.ts.map +1 -0
- package/dist/ui/panel-components.js +22 -0
- package/dist/ui/panel-components.js.map +1 -0
- package/dist/ui/screenspace-component.d.ts +39 -0
- package/dist/ui/screenspace-component.d.ts.map +1 -0
- package/dist/ui/screenspace-component.js +21 -0
- package/dist/ui/screenspace-component.js.map +1 -0
- package/dist/ui/screenspace.d.ts +47 -135
- package/dist/ui/screenspace.d.ts.map +1 -1
- package/dist/ui/screenspace.js +127 -65
- package/dist/ui/screenspace.js.map +1 -1
- package/dist/ui/ui.d.ts +20 -122
- package/dist/ui/ui.d.ts.map +1 -1
- package/dist/ui/ui.js +44 -107
- package/dist/ui/ui.js.map +1 -1
- package/dist/ui/uikitml-asset.d.ts +25 -0
- package/dist/ui/uikitml-asset.d.ts.map +1 -0
- package/dist/ui/uikitml-asset.js +56 -0
- package/dist/ui/uikitml-asset.js.map +1 -0
- package/dist/ui/uikitml.d.ts +41 -0
- package/dist/ui/uikitml.d.ts.map +1 -0
- package/dist/ui/uikitml.js +119 -0
- package/dist/ui/uikitml.js.map +1 -0
- package/dist/vendor/draco/gltf/draco_encoder.js +0 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/visibility/visibility-component.d.ts +14 -0
- package/dist/visibility/visibility-component.d.ts.map +1 -0
- package/dist/visibility/visibility-component.js +15 -0
- package/dist/visibility/visibility-component.js.map +1 -0
- package/dist/visibility/visibility.d.ts +3 -10
- package/dist/visibility/visibility.d.ts.map +1 -1
- package/dist/visibility/visibility.js +9 -12
- package/dist/visibility/visibility.js.map +1 -1
- package/package.json +48 -19
- package/LICENSE +0 -21
- package/dist/ecs/component-registry.d.ts +0 -54
- package/dist/ecs/component-registry.d.ts.map +0 -1
- package/dist/ecs/component-registry.js +0 -86
- package/dist/ecs/component-registry.js.map +0 -1
- package/dist/level/level-entity-creator.d.ts +0 -27
- package/dist/level/level-entity-creator.d.ts.map +0 -1
- package/dist/level/level-entity-creator.js +0 -108
- package/dist/level/level-entity-creator.js.map +0 -1
- package/dist/level/level-glxf-importer.d.ts +0 -23
- package/dist/level/level-glxf-importer.d.ts.map +0 -1
- package/dist/level/level-glxf-importer.js +0 -40
- package/dist/level/level-glxf-importer.js.map +0 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { instantiate, resolveKitComponentSets, parse } from '@drawcall/uikitml';
|
|
2
|
+
import { reversePainterSortStable, StyleSheet } from '@pmndrs/uikit';
|
|
3
|
+
import { AssetManager } from '../asset/asset-manager.js';
|
|
4
|
+
import { CacheManager } from '../asset/cache-manager.js';
|
|
5
|
+
import { UIKitDocument } from './document.js';
|
|
6
|
+
import { UIKitMLAsset } from './uikitml-asset.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the MIT license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/
|
|
14
|
+
/** Default component collection for IWSDK panels. */
|
|
15
|
+
const DEFAULT_UIKITML_KIT = 'horizon';
|
|
16
|
+
/** Configure a renderer for UIKit clipping and transparent painter order. */
|
|
17
|
+
function configureUIKitRenderer(renderer) {
|
|
18
|
+
renderer.setTransparentSort(reversePainterSortStable);
|
|
19
|
+
renderer.localClippingEnabled = true;
|
|
20
|
+
}
|
|
21
|
+
function formatParseError(error) {
|
|
22
|
+
var _a;
|
|
23
|
+
const position = (_a = error.range) === null || _a === void 0 ? void 0 : _a.start;
|
|
24
|
+
const location = position ? ` at ${position.line}:${position.column}` : '';
|
|
25
|
+
return `${error.message}${location}`;
|
|
26
|
+
}
|
|
27
|
+
function resolveFontFaceURLs(ast, sourceURL) {
|
|
28
|
+
if (!sourceURL || !ast.fontFaces) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
for (const fontFace of ast.fontFaces) {
|
|
32
|
+
try {
|
|
33
|
+
fontFace.src = new URL(fontFace.src, sourceURL).href;
|
|
34
|
+
}
|
|
35
|
+
catch (_a) {
|
|
36
|
+
// Preserve values such as application-owned URL schemes that the
|
|
37
|
+
// platform loader may still understand.
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function getComponentSets(options) {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return [
|
|
44
|
+
...resolveKitComponentSets((_a = options.kit) !== null && _a !== void 0 ? _a : DEFAULT_UIKITML_KIT),
|
|
45
|
+
...((_b = options.componentSets) !== null && _b !== void 0 ? _b : []),
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
async function preloadTTFFonts(root, ast) {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
// UIKit does not expose its resolved font loaders until the component is
|
|
51
|
+
// attached, but UIKitML installs them on the root's constructor input.
|
|
52
|
+
const fontFamilies = (_a = root.inputProperties) === null || _a === void 0 ? void 0 : _a.fontFamilies;
|
|
53
|
+
if (!fontFamilies ||
|
|
54
|
+
typeof fontFamilies !== 'object' ||
|
|
55
|
+
Array.isArray(fontFamilies)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
// UIKitML's font loaders share their generated atlas cache. Resolve the
|
|
59
|
+
// declared faces serially before the first render so text cannot disappear
|
|
60
|
+
// from an initial runtime frame or editor preview capture.
|
|
61
|
+
for (const fontFace of (_b = ast.fontFaces) !== null && _b !== void 0 ? _b : []) {
|
|
62
|
+
const family = fontFamilies[fontFace.fontFamily];
|
|
63
|
+
if (!family || typeof family !== 'object' || Array.isArray(family)) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const load = family[fontFace.fontWeight];
|
|
67
|
+
if (typeof load === 'function') {
|
|
68
|
+
await load();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Parse UIKitML source and resolve its relative TTF declarations.
|
|
74
|
+
*
|
|
75
|
+
* @param source UIKitML markup.
|
|
76
|
+
* @param sourceURL URL of the UIKitML document, used as the base for font URLs.
|
|
77
|
+
* @param options Parser and component-set options.
|
|
78
|
+
*/
|
|
79
|
+
function parseUIKitMLSource(source, sourceURL, options = {}) {
|
|
80
|
+
const componentSets = getComponentSets(options);
|
|
81
|
+
const result = parse(source, { componentSets });
|
|
82
|
+
if (!result.success) {
|
|
83
|
+
throw new Error(result.errors.map(formatParseError).join('\n'));
|
|
84
|
+
}
|
|
85
|
+
resolveFontFaceURLs(result.ast, sourceURL);
|
|
86
|
+
return result.ast;
|
|
87
|
+
}
|
|
88
|
+
/** Fetch, parse, and instantiate a UIKitML document. */
|
|
89
|
+
async function loadUIKitMLComponent(configURL, options = {}) {
|
|
90
|
+
const source = await AssetManager.loadUIKitML(configURL, undefined, options.forceReload);
|
|
91
|
+
const resolvedURL = CacheManager.resolveUrl(configURL);
|
|
92
|
+
const sourceURL = typeof document === 'undefined'
|
|
93
|
+
? resolvedURL
|
|
94
|
+
: new URL(resolvedURL, document.baseURI).href;
|
|
95
|
+
const componentSets = getComponentSets(options);
|
|
96
|
+
let ast;
|
|
97
|
+
try {
|
|
98
|
+
ast = parseUIKitMLSource(source, sourceURL, options);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
throw new Error(`Failed to parse UIKitML ${configURL}:\n${error instanceof Error ? error.message : String(error)}`);
|
|
102
|
+
}
|
|
103
|
+
// UIKit resolves class names through its shared stylesheet registry.
|
|
104
|
+
Object.assign(StyleSheet, ast.stylesheet);
|
|
105
|
+
const root = instantiate(ast, {
|
|
106
|
+
componentSets,
|
|
107
|
+
preferredColorScheme: options.preferredColorScheme,
|
|
108
|
+
});
|
|
109
|
+
await preloadTTFFonts(root, ast);
|
|
110
|
+
return root;
|
|
111
|
+
}
|
|
112
|
+
/** Fetch, parse, and instantiate a UIKitML file as a placeable scene asset. */
|
|
113
|
+
async function loadUIKitMLAsset(assetIdOrURL, options = {}) {
|
|
114
|
+
const root = await loadUIKitMLComponent(assetIdOrURL, options);
|
|
115
|
+
return new UIKitMLAsset(assetIdOrURL, new UIKitDocument(root));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { DEFAULT_UIKITML_KIT, configureUIKitRenderer, loadUIKitMLAsset, loadUIKitMLComponent, parseUIKitMLSource };
|
|
119
|
+
//# sourceMappingURL=uikitml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uikitml.js","sources":["../../src/ui/uikitml.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;AAKG;AAwCH;AACO,MAAM,mBAAmB,GAAe;AAE/C;AACM,SAAU,sBAAsB,CAAC,QAAuB,EAAA;AAC5D,IAAA,QAAQ,CAAC,kBAAkB,CAAC,wBAAwB,CAAC;AACrD,IAAA,QAAQ,CAAC,oBAAoB,GAAG,IAAI;AACtC;AAEA,SAAS,gBAAgB,CAAC,KAAmB,EAAA;;IAC3C,MAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,KAAK,CAAC,KAAK,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,KAAK;AACnC,IAAA,M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,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI;AACjD,IAAA,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC;AAC/C,IAAA,IAAI,GAAe;AACnB,IAAA,IAAI;QACF,GAAG,GAAG,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC;IACtD;IAAE,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,CAAA,wBAAA,EAA2B,SAAS,MAClC,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CACvD,CAAA,CAAE,CACH;IACH;;IAGA,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC;AAEzC,IAAA,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5B,aAAa;QACb,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;AACnD,KAAA,CAAC;AACF,IAAA,MAAM,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC;AAChC,IAAA,OAAO,IAAI;AACb;AAEA;AACO,eAAe,gBAAgB,CACpC,YAAoB,EACpB,UAA8B,EAAE,EAAA;IAEhC,MAAM,IAAI,GAAG,MAAM,oBAAoB,CAAC,YAAY,EAAE,OAAO,CAAC;IAC9D,OAAO,IAAI,YAAY,CAAC,YAAY,EAAE,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;AAChE;;;;"}
|
|
File without changes
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.5.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Types } from '../ecs/component.js';
|
|
8
|
+
export declare const Visibility: import("elics").Component<{
|
|
9
|
+
isVisible: {
|
|
10
|
+
type: Types.Boolean;
|
|
11
|
+
default: true;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=visibility-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility-component.d.ts","sourceRoot":"","sources":["../../src/visibility/visibility-component.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,KAAK,EAAmB,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,UAAU;;;;;EAStB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { setComponentEditorMetadata } from '../ecs/component-editor-metadata.js';
|
|
2
|
+
import { createComponent, Types } from 'elics';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
const Visibility = setComponentEditorMetadata(createComponent('Visibility', {
|
|
11
|
+
isVisible: { type: Types.Boolean, default: true },
|
|
12
|
+
}, 'Component to control if an entity object is visible'), { hidden: true, intrinsic: true });
|
|
13
|
+
|
|
14
|
+
export { Visibility };
|
|
15
|
+
//# sourceMappingURL=visibility-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility-component.js","sources":["../../src/visibility/visibility-component.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;AAKG;MAKU,UAAU,GAAG,0BAA0B,CAClD,eAAe,CACb,YAAY,EACZ;IACE,SAAS,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAClD,CAAA,EACD,qDAAqD,CACtD,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;;;;"}
|
|
@@ -4,18 +4,12 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
export declare const Visibility: import("elics").Component<{
|
|
9
|
-
isVisible: {
|
|
10
|
-
type: Types.Boolean;
|
|
11
|
-
default: true;
|
|
12
|
-
};
|
|
13
|
-
}>;
|
|
7
|
+
export { Visibility } from './visibility-component.js';
|
|
14
8
|
declare const VisibilitySystem_base: import("elics").SystemConstructor<import("elics").SystemSchema, {
|
|
15
9
|
visibility: {
|
|
16
10
|
required: import("elics").Component<{
|
|
17
11
|
isVisible: {
|
|
18
|
-
type: Types.Boolean;
|
|
12
|
+
type: import("elics").Types.Boolean;
|
|
19
13
|
default: true;
|
|
20
14
|
};
|
|
21
15
|
}>[];
|
|
@@ -24,7 +18,7 @@ declare const VisibilitySystem_base: import("elics").SystemConstructor<import("e
|
|
|
24
18
|
visibility: {
|
|
25
19
|
required: import("elics").Component<{
|
|
26
20
|
isVisible: {
|
|
27
|
-
type: Types.Boolean;
|
|
21
|
+
type: import("elics").Types.Boolean;
|
|
28
22
|
default: true;
|
|
29
23
|
};
|
|
30
24
|
}>[];
|
|
@@ -33,5 +27,4 @@ declare const VisibilitySystem_base: import("elics").SystemConstructor<import("e
|
|
|
33
27
|
export declare class VisibilitySystem extends VisibilitySystem_base {
|
|
34
28
|
init(): void;
|
|
35
29
|
}
|
|
36
|
-
export {};
|
|
37
30
|
//# sourceMappingURL=visibility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../src/visibility/visibility.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../src/visibility/visibility.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;;;;;;;;;;;;;;;;;;;;AAmCvD,qBAAa,gBAAiB,SAAQ,qBAEpC;IACA,IAAI,IAAI,IAAI;CAIb"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createComponent, Types } from 'elics';
|
|
2
1
|
import { createSystem } from '../ecs/system.js';
|
|
2
|
+
import { Visibility } from './visibility-component.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -7,20 +7,14 @@ import { createSystem } from '../ecs/system.js';
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
const Visibility = createComponent('Visibility', {
|
|
11
|
-
isVisible: { type: Types.Boolean, default: true },
|
|
12
|
-
}, 'Component to control if an entity object is visible',
|
|
13
|
-
// @ts-ignore - 4th argument is parsed by vite-plugin-metaspatial for XML generation
|
|
14
|
-
{ hideInEditor: true });
|
|
15
10
|
function attachToEntity(entity) {
|
|
16
11
|
const object3D = entity.object3D;
|
|
17
|
-
if (!object3D) {
|
|
12
|
+
if (!object3D || object3D.__visibilityAttached) {
|
|
18
13
|
return;
|
|
19
14
|
}
|
|
15
|
+
object3D.__visibilityAttached = true;
|
|
20
16
|
Object.defineProperty(object3D, 'visible', {
|
|
21
|
-
get: () =>
|
|
22
|
-
return entity.getValue(Visibility, 'isVisible');
|
|
23
|
-
},
|
|
17
|
+
get: () => Boolean(Visibility.data.isVisible[entity.index]),
|
|
24
18
|
set: (value) => {
|
|
25
19
|
entity.setValue(Visibility, 'isVisible', value);
|
|
26
20
|
},
|
|
@@ -30,14 +24,17 @@ function attachToEntity(entity) {
|
|
|
30
24
|
}
|
|
31
25
|
function detachFromEntity(entity) {
|
|
32
26
|
const object3D = entity.object3D;
|
|
33
|
-
if (!object3D) {
|
|
27
|
+
if (!object3D || !object3D.__visibilityAttached) {
|
|
34
28
|
return;
|
|
35
29
|
}
|
|
30
|
+
const visible = Boolean(Visibility.data.isVisible[entity.index]);
|
|
36
31
|
Object.defineProperty(object3D, 'visible', {
|
|
37
|
-
value:
|
|
32
|
+
value: visible,
|
|
33
|
+
writable: true,
|
|
38
34
|
enumerable: true,
|
|
39
35
|
configurable: true,
|
|
40
36
|
});
|
|
37
|
+
delete object3D.__visibilityAttached;
|
|
41
38
|
}
|
|
42
39
|
class VisibilitySystem extends createSystem({
|
|
43
40
|
visibility: { required: [Visibility] },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visibility.js","sources":["../../src/visibility/visibility.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;AAKG;
|
|
1
|
+
{"version":3,"file":"visibility.js","sources":["../../src/visibility/visibility.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;AAKG;AAQH,SAAS,cAAc,CAAC,MAAc,EAAA;AACpC,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ;AAChC,IAAA,IAAI,CAAC,QAAQ,IAAK,QAAgB,CAAC,oBAAoB,EAAE;QACvD;IACF;AACC,IAAA,QAAgB,CAAC,oBAAoB,GAAG,IAAI;AAE7C,IAAA,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE;AACzC,QAAA,GAAG,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3D,QAAA,GAAG,EAAE,CAAC,KAAc,KAAI;YACtB,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,CAAC;QACjD,CAAC;AACD,QAAA,UAAU,EAAE,IAAI;AAChB,QAAA,YAAY,EAAE,IAAI;AACnB,KAAA,CAAC;AACJ;AAEA,SAAS,gBAAgB,CAAC,MAAc,EAAA;AACtC,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ;IAChC,IAAI,CAAC,QAAQ,IAAI,CAAE,QAAgB,CAAC,oBAAoB,EAAE;QACxD;IACF;AACA,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAEhE,IAAA,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE;AACzC,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,QAAQ,EAAE,IAAI;AACd,QAAA,UAAU,EAAE,IAAI;AAChB,QAAA,YAAY,EAAE,IAAI;AACnB,KAAA,CAAC;IACF,OAAQ,QAAgB,CAAC,oBAAoB;AAC/C;AAEM,MAAO,gBAAiB,SAAQ,YAAY,CAAC;AACjD,IAAA,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,EAAE;CACvC,CAAC,CAAA;IACA,IAAI,GAAA;QACF,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,cAAc,CAAC;QAC5D,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACnE;AACD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iwsdk/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Javascript WebXR Runtime for Emulation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
"*": {
|
|
10
|
+
"lighting": [
|
|
11
|
+
"dist/lighting/index.d.ts"
|
|
12
|
+
],
|
|
13
|
+
"project": [
|
|
14
|
+
"dist/project/index.d.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./lighting": {
|
|
24
|
+
"types": "./dist/lighting/index.d.ts",
|
|
25
|
+
"import": "./dist/lighting/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./project": {
|
|
28
|
+
"types": "./dist/project/index.d.ts",
|
|
29
|
+
"import": "./dist/project/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
8
33
|
"files": [
|
|
9
34
|
"dist"
|
|
10
35
|
],
|
|
@@ -21,6 +46,7 @@
|
|
|
21
46
|
"dist/init/**",
|
|
22
47
|
"dist/input/**",
|
|
23
48
|
"dist/layers/**",
|
|
49
|
+
"dist/lighting/**",
|
|
24
50
|
"dist/level/**",
|
|
25
51
|
"dist/locomotion/**",
|
|
26
52
|
"dist/mcp/**",
|
|
@@ -31,6 +57,16 @@
|
|
|
31
57
|
"dist/vendor/**",
|
|
32
58
|
"dist/visibility/**"
|
|
33
59
|
],
|
|
60
|
+
"scripts": {
|
|
61
|
+
"prebuild": "node -p \"'export const VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
|
|
62
|
+
"build": "rollup -c",
|
|
63
|
+
"doc": "typedoc",
|
|
64
|
+
"format": "prettier --write ./src/**/*",
|
|
65
|
+
"prepublishOnly": "npm run build",
|
|
66
|
+
"test": "vitest run",
|
|
67
|
+
"test:watch": "vitest",
|
|
68
|
+
"test:coverage": "vitest run --coverage"
|
|
69
|
+
},
|
|
34
70
|
"repository": {
|
|
35
71
|
"type": "git",
|
|
36
72
|
"url": "git+https://github.com/facebook/immersive-web-sdk.git"
|
|
@@ -45,32 +81,25 @@
|
|
|
45
81
|
"homepage": "https://github.com/facebook/immersive-web-sdk#readme",
|
|
46
82
|
"dependencies": {
|
|
47
83
|
"@babylonjs/havok": "^1.3.10",
|
|
84
|
+
"@drawcall/uikitml": "0.1.8",
|
|
85
|
+
"@iwsdk/locomotor": "workspace:*",
|
|
86
|
+
"@iwsdk/scene-composition": "workspace:*",
|
|
87
|
+
"@iwsdk/xr-input": "workspace:*",
|
|
48
88
|
"@pmndrs/handle": "^6.6.16",
|
|
49
89
|
"@pmndrs/pointer-events": "^6.6.22",
|
|
50
|
-
"@pmndrs/uikit": "^1.0.
|
|
51
|
-
"@pmndrs/uikitml": "^0.1.12",
|
|
90
|
+
"@pmndrs/uikit": "^1.0.74",
|
|
52
91
|
"@preact/signals-core": "^1.11.0",
|
|
92
|
+
"@types/three": "^0.181.0",
|
|
93
|
+
"@types/webxr": "^0.5.0",
|
|
53
94
|
"elics": "^3.4.1",
|
|
54
95
|
"three": "*",
|
|
55
|
-
"three-mesh-bvh": "^0.9.1"
|
|
56
|
-
"@iwsdk/xr-input": "0.4.2",
|
|
57
|
-
"@iwsdk/glxf": "0.4.2",
|
|
58
|
-
"@iwsdk/locomotor": "0.4.2"
|
|
96
|
+
"three-mesh-bvh": "^0.9.1"
|
|
59
97
|
},
|
|
60
98
|
"engines": {
|
|
61
99
|
"node": ">=20.19.0 <21.0.0-0 || >=22.12.0 <23.0.0-0 || >=24.0.0"
|
|
62
100
|
},
|
|
63
101
|
"devDependencies": {
|
|
64
|
-
"vitest": "^4.
|
|
65
|
-
"@vitest/coverage-v8": "^4.
|
|
66
|
-
},
|
|
67
|
-
"scripts": {
|
|
68
|
-
"prebuild": "node -p \"'export const VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
|
|
69
|
-
"build": "rollup -c",
|
|
70
|
-
"doc": "typedoc",
|
|
71
|
-
"format": "prettier --write ./src/**/*",
|
|
72
|
-
"test": "vitest run",
|
|
73
|
-
"test:watch": "vitest",
|
|
74
|
-
"test:coverage": "vitest run --coverage"
|
|
102
|
+
"vitest": "^4.1.10",
|
|
103
|
+
"@vitest/coverage-v8": "^4.1.10"
|
|
75
104
|
}
|
|
76
|
-
}
|
|
105
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import type { Component } from 'elics';
|
|
8
|
-
import type { Entity } from './entity.js';
|
|
9
|
-
import { World } from './world.js';
|
|
10
|
-
/** Field shape for GLXF component metadata. @category ECS */
|
|
11
|
-
export interface GLXFComponentData {
|
|
12
|
-
[key: string]: {
|
|
13
|
-
keyString: string;
|
|
14
|
-
type: string;
|
|
15
|
-
value: any;
|
|
16
|
-
alias?: string;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
/** Mapping entry from GLXF name → component class and optional mapper. @category ECS */
|
|
20
|
-
export interface ComponentRegistryEntry {
|
|
21
|
-
componentClass: Component<any>;
|
|
22
|
-
description?: string;
|
|
23
|
-
mapper?: (glxfData: GLXFComponentData) => Record<string, any>;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Registry that maps GLXF component names to ECS component classes.
|
|
27
|
-
*
|
|
28
|
-
* @remarks
|
|
29
|
-
* - Separate from `elics`' built-in registry to avoid naming conflicts.
|
|
30
|
-
* - Supports custom field mappers to translate GLXF metadata to component props.
|
|
31
|
-
*
|
|
32
|
-
* @category ECS
|
|
33
|
-
*/
|
|
34
|
-
export declare class GLXFComponentRegistry {
|
|
35
|
-
private static registry;
|
|
36
|
-
private static componentToName;
|
|
37
|
-
/** Register an ECS component class under a GLXF component name. */
|
|
38
|
-
static register(glxfComponentName: string, componentClass: Component<any>, description?: string, mapper?: (glxfData: GLXFComponentData) => Record<string, any>): void;
|
|
39
|
-
/** Return the GLXF name for a given component class. */
|
|
40
|
-
static getComponentName(component: Component<any>): string | undefined;
|
|
41
|
-
/** Lookup a registered mapping entry by GLXF name. */
|
|
42
|
-
static getComponent(glxfComponentName: string): ComponentRegistryEntry | undefined;
|
|
43
|
-
/** Apply mapped components from GLXF metadata to an entity. */
|
|
44
|
-
static applyComponents(entity: Entity, world: World, glxfComponents: Record<string, GLXFComponentData>): void;
|
|
45
|
-
/** Default mapper converting GLXF `{ key: { value } }` shape to props. */
|
|
46
|
-
private static defaultMapper;
|
|
47
|
-
/** List all registered GLXF component names. */
|
|
48
|
-
static getRegisteredComponents(): string[];
|
|
49
|
-
/** Clear the registry (useful for tests). */
|
|
50
|
-
static clear(): void;
|
|
51
|
-
/** Placeholder to wire built‑in mappings from generated metadata. */
|
|
52
|
-
static setupBuiltinComponents(): void;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=component-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../../src/ecs/component-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,6DAA6D;AAC7D,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,GAAG,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAGD,wFAAwF;AACxF,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/D;AAED;;;;;;;;GAQG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA6C;IACpE,OAAO,CAAC,MAAM,CAAC,eAAe,CAAqC;IAEnE,mEAAmE;IACnE,MAAM,CAAC,QAAQ,CACb,iBAAiB,EAAE,MAAM,EACzB,cAAc,EAAE,SAAS,CAAC,GAAG,CAAC,EAC9B,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC5D,IAAI;IASP,wDAAwD;IACxD,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,SAAS;IAItE,sDAAsD;IACtD,MAAM,CAAC,YAAY,CACjB,iBAAiB,EAAE,MAAM,GACxB,sBAAsB,GAAG,SAAS;IAIrC,+DAA+D;IAC/D,MAAM,CAAC,eAAe,CACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAChD,IAAI;IA2BP,0EAA0E;IAC1E,OAAO,CAAC,MAAM,CAAC,aAAa;IAc5B,gDAAgD;IAChD,MAAM,CAAC,uBAAuB,IAAI,MAAM,EAAE;IAI1C,6CAA6C;IAC7C,MAAM,CAAC,KAAK,IAAI,IAAI;IAKpB,qEAAqE;IACrE,MAAM,CAAC,sBAAsB,IAAI,IAAI;CAOtC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Registry that maps GLXF component names to ECS component classes.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* - Separate from `elics`' built-in registry to avoid naming conflicts.
|
|
12
|
-
* - Supports custom field mappers to translate GLXF metadata to component props.
|
|
13
|
-
*
|
|
14
|
-
* @category ECS
|
|
15
|
-
*/
|
|
16
|
-
class GLXFComponentRegistry {
|
|
17
|
-
/** Register an ECS component class under a GLXF component name. */
|
|
18
|
-
static register(glxfComponentName, componentClass, description, mapper) {
|
|
19
|
-
this.registry.set(glxfComponentName, {
|
|
20
|
-
componentClass,
|
|
21
|
-
description,
|
|
22
|
-
mapper,
|
|
23
|
-
});
|
|
24
|
-
this.componentToName.set(componentClass, glxfComponentName);
|
|
25
|
-
}
|
|
26
|
-
/** Return the GLXF name for a given component class. */
|
|
27
|
-
static getComponentName(component) {
|
|
28
|
-
return this.componentToName.get(component);
|
|
29
|
-
}
|
|
30
|
-
/** Lookup a registered mapping entry by GLXF name. */
|
|
31
|
-
static getComponent(glxfComponentName) {
|
|
32
|
-
return this.registry.get(glxfComponentName);
|
|
33
|
-
}
|
|
34
|
-
/** Apply mapped components from GLXF metadata to an entity. */
|
|
35
|
-
static applyComponents(entity, world, glxfComponents) {
|
|
36
|
-
Object.entries(glxfComponents).forEach(([componentName, componentData]) => {
|
|
37
|
-
const entry = this.getComponent(componentName);
|
|
38
|
-
if (entry) {
|
|
39
|
-
// Use custom mapper if provided, otherwise use default mapping
|
|
40
|
-
const componentProps = entry.mapper
|
|
41
|
-
? entry.mapper(componentData)
|
|
42
|
-
: this.defaultMapper(componentData);
|
|
43
|
-
console.log(`Applying component "${componentName}" to entity with props:`, componentProps);
|
|
44
|
-
if (!entry.componentClass.bitmask) {
|
|
45
|
-
world.registerComponent(entry.componentClass);
|
|
46
|
-
}
|
|
47
|
-
entity.addComponent(entry.componentClass, componentProps);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
console.warn(`Component "${componentName}" not found in registry. Available components:`, Array.from(this.registry.keys()));
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
/** Default mapper converting GLXF `{ key: { value } }` shape to props. */
|
|
55
|
-
static defaultMapper(glxfData) {
|
|
56
|
-
const props = {};
|
|
57
|
-
Object.entries(glxfData).forEach(([key, fieldData]) => {
|
|
58
|
-
if (fieldData && typeof fieldData === 'object' && 'value' in fieldData) {
|
|
59
|
-
props[key] = fieldData.value;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
return props;
|
|
63
|
-
}
|
|
64
|
-
/** List all registered GLXF component names. */
|
|
65
|
-
static getRegisteredComponents() {
|
|
66
|
-
return Array.from(this.registry.keys());
|
|
67
|
-
}
|
|
68
|
-
/** Clear the registry (useful for tests). */
|
|
69
|
-
static clear() {
|
|
70
|
-
this.registry.clear();
|
|
71
|
-
this.componentToName.clear();
|
|
72
|
-
}
|
|
73
|
-
/** Placeholder to wire built‑in mappings from generated metadata. */
|
|
74
|
-
static setupBuiltinComponents() {
|
|
75
|
-
// This will be populated with the actual component imports
|
|
76
|
-
// For now, we'll register the components we know about
|
|
77
|
-
// Note: This is a temporary solution. In a real implementation,
|
|
78
|
-
// we would need to import the actual component objects and register them
|
|
79
|
-
// with their correct names from the components.json
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
GLXFComponentRegistry.registry = new Map();
|
|
83
|
-
GLXFComponentRegistry.componentToName = new Map();
|
|
84
|
-
|
|
85
|
-
export { GLXFComponentRegistry };
|
|
86
|
-
//# sourceMappingURL=component-registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-registry.js","sources":["../../src/ecs/component-registry.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;AAKG;AAyBH;;;;;;;;AAQG;MACU,qBAAqB,CAAA;;IAKhC,OAAO,QAAQ,CACb,iBAAyB,EACzB,cAA8B,EAC9B,WAAoB,EACpB,MAA6D,EAAA;AAE7D,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACnC,cAAc;YACd,WAAW;YACX,MAAM;AACP,SAAA,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,cAAc,EAAE,iBAAiB,CAAC;IAC7D;;IAGA,OAAO,gBAAgB,CAAC,SAAyB,EAAA;QAC/C,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC;IAC5C;;IAGA,OAAO,YAAY,CACjB,iBAAyB,EAAA;QAEzB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC7C;;AAGA,IAAA,OAAO,eAAe,CACpB,MAAc,EACd,KAAY,EACZ,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OAAO,uBAAuB,GAAA;QAC5B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzC;;AAGA,IAAA,OAAO,KAAK,GAAA;AACV,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;AACrB,QAAA,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE;IAC9B;;AAGA,IAAA,OAAO,sBAAsB,GAAA;;;;;;IAM7B;;AA/Fe,qBAAA,CAAA,QAAQ,GAAG,IAAI,GAAG,EAAkC;AACpD,qBAAA,CAAA,eAAe,GAAG,IAAI,GAAG,EAA0B;;;;"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import { Entity } from '../ecs/entity.js';
|
|
8
|
-
import type { World } from '../ecs/world.js';
|
|
9
|
-
import { Object3D } from '../runtime/index.js';
|
|
10
|
-
/**
|
|
11
|
-
* Creates ECS entities from Three.js Object3D graphs and applies IWSDK components
|
|
12
|
-
* found in GLXF `meta_spatial.components` extras.
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* - Only nodes present in the GLXF `nodes` array are converted to entities.
|
|
16
|
-
* - Component ids are matched against the registry by `com.iwsdk.components.<id>`.
|
|
17
|
-
* - Panel UI extras are mapped to {@link PanelUI} with JSON config paths.
|
|
18
|
-
*
|
|
19
|
-
* @category Scene
|
|
20
|
-
*/
|
|
21
|
-
export declare class EntityCreator {
|
|
22
|
-
static createEntitiesFromObject3D(object: Object3D, nodes: Object3D[], parentEntity: Entity, world: World): void;
|
|
23
|
-
private static applyComponents;
|
|
24
|
-
private static mapGLXFDataToProps;
|
|
25
|
-
private static handleMetaSpatialPanelComponents;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=level-entity-creator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"level-entity-creator.d.ts","sourceRoot":"","sources":["../../src/level/level-entity-creator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAM/C;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IACxB,MAAM,CAAC,0BAA0B,CAC/B,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,QAAQ,EAAE,EACjB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,KAAK,GACX,IAAI;IAsCP,OAAO,CAAC,MAAM,CAAC,eAAe;IAoC9B,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAiBjC,OAAO,CAAC,MAAM,CAAC,gCAAgC;CAuBhD"}
|