@shopware-ag/dive 1.19.1-beta.2 → 1.19.1-beta.4
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 +295 -362
- package/build/chunks/PerspectiveCamera-ACx6umAu.mjs +38 -0
- package/build/chunks/PerspectiveCamera-ACx6umAu.mjs.map +1 -0
- package/build/chunks/PerspectiveCamera-BXPNOM71.cjs +2 -0
- package/build/chunks/PerspectiveCamera-BXPNOM71.cjs.map +1 -0
- package/build/chunks/fflate.module-DHdJvhNh.cjs +7 -0
- package/build/chunks/fflate.module-DHdJvhNh.cjs.map +1 -0
- package/build/chunks/fflate.module-DkZg07PZ.mjs +603 -0
- package/build/chunks/fflate.module-DkZg07PZ.mjs.map +1 -0
- package/build/chunks/file-type-error-D6aWGgyc.mjs +15 -0
- package/build/chunks/file-type-error-D6aWGgyc.mjs.map +1 -0
- package/build/chunks/file-type-error-DtvBgs64.cjs +2 -0
- package/build/chunks/file-type-error-DtvBgs64.cjs.map +1 -0
- package/build/chunks/index-C7Wx_9uY.mjs +34 -0
- package/build/chunks/index-C7Wx_9uY.mjs.map +1 -0
- package/build/chunks/index-MNP0K5dt.cjs +2 -0
- package/build/chunks/index-MNP0K5dt.cjs.map +1 -0
- package/build/chunks/network-error-C2ZDC8qS.cjs +2 -0
- package/build/chunks/network-error-C2ZDC8qS.cjs.map +1 -0
- package/build/chunks/network-error-DgecatEk.mjs +27 -0
- package/build/chunks/network-error-DgecatEk.mjs.map +1 -0
- package/build/index.cjs +57 -0
- package/build/index.cjs.map +1 -0
- package/build/index.d.ts +6 -0
- package/build/index.mjs +6884 -0
- package/build/index.mjs.map +1 -0
- package/build/src/animation/AnimationSystem.d.ts +1 -1
- package/build/src/axiscamera/AxisCamera.d.ts +2 -2
- package/build/src/com/Communication.d.ts +5 -8
- package/build/src/com/actions/scene/exportscene.d.ts +1 -1
- package/build/src/com/actions/scene/launchar.d.ts +1 -1
- package/build/src/controls/OrbitControls.d.ts +2 -2
- package/build/src/dive.d.ts +12 -29
- package/build/src/engine/Engine.d.ts +32 -0
- package/build/src/{camera → engine/camera}/PerspectiveCamera.d.ts +1 -1
- package/build/src/{scene → engine/scene}/Scene.d.ts +4 -4
- package/build/src/{scene → engine/scene}/root/Root.d.ts +2 -3
- package/build/src/error/ar-compatibility/ar-compatibility-error.d.ts +12 -0
- package/build/src/error/file-type/file-type-error.d.ts +4 -0
- package/build/src/error/index.d.ts +4 -0
- package/build/src/error/network/network-error.d.ts +5 -0
- package/build/src/error/parse/parse-error.d.ts +4 -0
- package/build/src/helper/findSceneRecursive/findSceneRecursive.d.ts +1 -1
- package/build/src/helper/getFileTypeFromUri/getFileTypeFromUri.d.ts +6 -0
- package/build/src/helper/index.d.ts +7 -0
- package/build/src/helper/isFileTypeSupported/isFileTypeSupported.d.ts +7 -0
- package/build/src/index.d.ts +2 -0
- package/build/src/math/index.d.ts +1 -1
- package/build/src/modules/_system/Module.d.ts +13 -0
- package/build/src/modules/_system/ModuleRegistry.d.ts +29 -0
- package/build/src/modules/ar/ARSystem.cjs +2 -0
- package/build/src/modules/ar/ARSystem.cjs.map +1 -0
- package/build/src/{ar/AR.d.ts → modules/ar/ARSystem.d.ts} +26 -0
- package/build/src/modules/ar/ARSystem.mjs +164 -0
- package/build/src/modules/ar/ARSystem.mjs.map +1 -0
- package/build/src/{ar → modules/ar}/arquicklook/ARQuickLook.d.ts +2 -1
- package/build/src/{ar → modules/ar}/sceneviewer/SceneViewer.d.ts +1 -1
- package/build/src/{ar → modules/ar}/webxr/WebXR.d.ts +3 -3
- package/build/src/{ar → modules/ar}/webxr/controller/WebXRController.d.ts +2 -2
- package/build/src/{ar → modules/ar}/webxr/origin/WebXROrigin.d.ts +1 -1
- package/build/src/{ar → modules/ar}/webxr/raycaster/WebXRRaycaster.d.ts +3 -3
- package/build/src/{ar → modules/ar}/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +1 -1
- package/build/src/{ar → modules/ar}/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +2 -2
- package/build/src/{ar → modules/ar}/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +1 -1
- package/build/src/modules/asset/converter/AssetConverter.cjs +2 -0
- package/build/src/modules/asset/converter/AssetConverter.cjs.map +1 -0
- package/build/src/modules/asset/converter/AssetConverter.d.ts +29 -0
- package/build/src/modules/asset/converter/AssetConverter.mjs +22 -0
- package/build/src/modules/asset/converter/AssetConverter.mjs.map +1 -0
- package/build/src/modules/asset/exporter/AssetExporter.cjs +165 -0
- package/build/src/modules/asset/exporter/AssetExporter.cjs.map +1 -0
- package/build/src/{exporter/Exporter.d.ts → modules/asset/exporter/AssetExporter.d.ts} +7 -2
- package/build/src/modules/asset/exporter/AssetExporter.mjs +1622 -0
- package/build/src/modules/asset/exporter/AssetExporter.mjs.map +1 -0
- package/build/src/modules/asset/loader/AssetLoader.cjs +3 -0
- package/build/src/modules/asset/loader/AssetLoader.cjs.map +1 -0
- package/build/src/modules/asset/loader/AssetLoader.d.ts +33 -0
- package/build/src/modules/asset/loader/AssetLoader.mjs +1924 -0
- package/build/src/modules/asset/loader/AssetLoader.mjs.map +1 -0
- package/build/src/modules/index.d.ts +10 -0
- package/build/src/modules/mediacreator/MediaCreator.cjs +2 -0
- package/build/src/modules/mediacreator/MediaCreator.cjs.map +1 -0
- package/build/src/modules/mediacreator/MediaCreator.d.ts +40 -0
- package/build/src/modules/mediacreator/MediaCreator.mjs +28 -0
- package/build/src/modules/mediacreator/MediaCreator.mjs.map +1 -0
- package/build/src/modules/systeminfo/SystemInfo.cjs +2 -0
- package/build/src/modules/systeminfo/SystemInfo.cjs.map +1 -0
- package/build/src/{info/Info.d.ts → modules/systeminfo/SystemInfo.d.ts} +40 -7
- package/build/src/modules/systeminfo/SystemInfo.mjs +115 -0
- package/build/src/modules/systeminfo/SystemInfo.mjs.map +1 -0
- package/build/src/toolbox/BaseTool.d.ts +1 -1
- package/build/src/toolbox/Toolbox.d.ts +1 -1
- package/build/src/toolbox/select/SelectTool.d.ts +1 -1
- package/build/src/toolbox/transform/TransformTool.d.ts +1 -1
- package/build/src/types/file/FileTypes.d.ts +1 -2
- package/build/src/types/index.d.ts +1 -0
- package/package.json +17 -21
- package/build/dive.cjs +0 -4025
- package/build/dive.cjs.map +0 -1
- package/build/dive.d.ts +0 -6
- package/build/dive.js +0 -4025
- package/build/dive.js.map +0 -1
- package/build/dive.mjs +0 -28200
- package/build/dive.mjs.map +0 -1
- package/build/src/converter/Converter.d.ts +0 -12
- package/build/src/io/IO.d.ts +0 -10
- package/build/src/io/gltf/GLTFIO.d.ts +0 -12
- package/build/src/loader/Loader.d.ts +0 -7
- package/build/src/mediacreator/MediaCreator.d.ts +0 -17
- package/build/src/module/Module.d.ts +0 -8
- package/build/src/types/error/index.d.ts +0 -12
- /package/build/src/{renderer → engine/renderer}/Renderer.d.ts +0 -0
- /package/build/src/{scene → engine/scene}/xrroot/XRRoot.d.ts +0 -0
- /package/build/src/{scene → engine/scene}/xrroot/xrlightroot/XRLightRoot.d.ts +0 -0
- /package/build/src/{ar → modules/ar}/webxr/crosshair/WebXRCrosshair.d.ts +0 -0
- /package/build/src/{ar → modules/ar}/webxr/overlay/Overlay.d.ts +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { internalModuleRegistry as Modules } from './_system/ModuleRegistry';
|
|
2
|
+
export declare const MODULE_PATHS: {
|
|
3
|
+
AssetLoader: string;
|
|
4
|
+
AssetConverter: string;
|
|
5
|
+
AssetExporter: string;
|
|
6
|
+
ARSystem: string;
|
|
7
|
+
MediaCreator: string;
|
|
8
|
+
SystemInfo: string;
|
|
9
|
+
};
|
|
10
|
+
export { Modules };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty;var h=(t,e,r)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var n=(t,e,r)=>h(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../../chunks/PerspectiveCamera-BXPNOM71.cjs");class m{constructor(e,r,o){n(this,"renderer");n(this,"scene");n(this,"controller");this.renderer=e,this.scene=r,this.controller=o}GenerateMedia(e,r,o,s){const c=this.controller.object.position.clone(),l=this.controller.object.quaternion.clone();this.renderer.OnResize(o,s),this.controller.object.OnResize(o,s),this.controller.object.position.copy(e),this.controller.target.copy(r),this.controller.update();const a=this.DrawCanvas().toDataURL();return this.controller.object.position.copy(c),this.controller.object.quaternion.copy(l),a}DrawCanvas(e){const r=this.renderer.domElement;e&&(this.renderer.domElement=e),this.controller.object.layers.mask=i.DIVEPerspectiveCamera.LIVE_VIEW_LAYER_MASK,this.renderer.render(this.scene,this.controller.object),this.controller.object.layers.mask=i.DIVEPerspectiveCamera.EDITOR_VIEW_LAYER_MASK;const o=this.renderer.domElement;return e&&(this.renderer.domElement=r),o}}exports.MediaCreator=m;
|
|
2
|
+
//# sourceMappingURL=MediaCreator.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaCreator.cjs","sources":["../../../../src/modules/mediacreator/MediaCreator.ts"],"sourcesContent":["import { DIVEPerspectiveCamera } from '../../engine/camera/PerspectiveCamera';\nimport { type DIVEScene } from '../../engine/scene/Scene';\nimport { type DIVERenderer } from '../../engine/renderer/Renderer';\nimport type DIVEOrbitControls from '../../controls/OrbitControls';\nimport { type Vector3Like } from 'three';\n\ndeclare global {\n interface ModuleClasses {\n MediaCreator: MediaCreator;\n }\n}\n\n/**\n * @module MediaCreator\n *\n * Provides tools for creating media content from the 3D scene:\n *\n * ```ts\n * import { MediaCreator } from '@shopware-ag/dive/modules/mediacreator';\n * const mediaCreator = new MediaCreator();\n *\n * // Generate a screenshot\n * const screenshot = await mediaCreator.GenerateMedia(\n * { x: 0, y: 0, z: 0 }, // camera position\n * { x: 0, y: 0, z: 0 }, // camera target\n * 1920, // width\n * 1080 // height\n * );\n * ```\n *\n * Features:\n * - High-quality screenshot generation\n * - Customizable camera position and target\n * - Configurable output resolution\n */\n\nexport class MediaCreator {\n private renderer: DIVERenderer;\n private scene: DIVEScene;\n private controller: DIVEOrbitControls;\n\n constructor(\n renderer: DIVERenderer,\n scene: DIVEScene,\n controller: DIVEOrbitControls,\n ) {\n this.renderer = renderer;\n this.scene = scene;\n this.controller = controller;\n }\n\n public GenerateMedia(\n position: Vector3Like,\n target: Vector3Like,\n width: number,\n height: number,\n ): string {\n const resetPosition = this.controller.object.position.clone();\n const resetRotation = this.controller.object.quaternion.clone();\n\n this.renderer.OnResize(width, height);\n this.controller.object.OnResize(width, height);\n\n this.controller.object.position.copy(position);\n this.controller.target.copy(target);\n this.controller.update();\n\n const dataUri = this.DrawCanvas().toDataURL();\n\n this.controller.object.position.copy(resetPosition);\n this.controller.object.quaternion.copy(resetRotation);\n\n return dataUri;\n }\n\n public DrawCanvas(canvasElement?: HTMLCanvasElement): HTMLCanvasElement {\n // save current canvas\n const restore = this.renderer.domElement;\n if (canvasElement) {\n this.renderer.domElement = canvasElement;\n }\n\n // draw canvas\n this.controller.object.layers.mask =\n DIVEPerspectiveCamera.LIVE_VIEW_LAYER_MASK;\n this.renderer.render(this.scene, this.controller.object);\n this.controller.object.layers.mask =\n DIVEPerspectiveCamera.EDITOR_VIEW_LAYER_MASK;\n\n const returnCanvas = this.renderer.domElement;\n\n // restore canvas\n if (canvasElement) {\n this.renderer.domElement = restore;\n }\n\n return returnCanvas;\n }\n}\n"],"names":["MediaCreator","renderer","scene","controller","__publicField","position","target","width","height","resetPosition","resetRotation","dataUri","canvasElement","restore","DIVEPerspectiveCamera","returnCanvas"],"mappings":"sTAoCO,MAAMA,CAAa,CAKtB,YACIC,EACAC,EACAC,EACF,CARMC,EAAA,iBACAA,EAAA,cACAA,EAAA,mBAOJ,KAAK,SAAWH,EAChB,KAAK,MAAQC,EACb,KAAK,WAAaC,CAAA,CAGf,cACHE,EACAC,EACAC,EACAC,EACM,CACN,MAAMC,EAAgB,KAAK,WAAW,OAAO,SAAS,MAAM,EACtDC,EAAgB,KAAK,WAAW,OAAO,WAAW,MAAM,EAEzD,KAAA,SAAS,SAASH,EAAOC,CAAM,EACpC,KAAK,WAAW,OAAO,SAASD,EAAOC,CAAM,EAE7C,KAAK,WAAW,OAAO,SAAS,KAAKH,CAAQ,EACxC,KAAA,WAAW,OAAO,KAAKC,CAAM,EAClC,KAAK,WAAW,OAAO,EAEvB,MAAMK,EAAU,KAAK,WAAW,EAAE,UAAU,EAE5C,YAAK,WAAW,OAAO,SAAS,KAAKF,CAAa,EAClD,KAAK,WAAW,OAAO,WAAW,KAAKC,CAAa,EAE7CC,CAAA,CAGJ,WAAWC,EAAsD,CAE9D,MAAAC,EAAU,KAAK,SAAS,WAC1BD,IACA,KAAK,SAAS,WAAaA,GAI/B,KAAK,WAAW,OAAO,OAAO,KAC1BE,EAAsB,sBAAA,qBAC1B,KAAK,SAAS,OAAO,KAAK,MAAO,KAAK,WAAW,MAAM,EACvD,KAAK,WAAW,OAAO,OAAO,KAC1BA,EAAsB,sBAAA,uBAEpB,MAAAC,EAAe,KAAK,SAAS,WAGnC,OAAIH,IACA,KAAK,SAAS,WAAaC,GAGxBE,CAAA,CAEf"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DIVEScene } from '../../engine/scene/Scene';
|
|
2
|
+
import { DIVERenderer } from '../../engine/renderer/Renderer';
|
|
3
|
+
import { default as DIVEOrbitControls } from '../../controls/OrbitControls';
|
|
4
|
+
import { Vector3Like } from 'three';
|
|
5
|
+
declare global {
|
|
6
|
+
interface ModuleClasses {
|
|
7
|
+
MediaCreator: MediaCreator;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @module MediaCreator
|
|
12
|
+
*
|
|
13
|
+
* Provides tools for creating media content from the 3D scene:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { MediaCreator } from '@shopware-ag/dive/modules/mediacreator';
|
|
17
|
+
* const mediaCreator = new MediaCreator();
|
|
18
|
+
*
|
|
19
|
+
* // Generate a screenshot
|
|
20
|
+
* const screenshot = await mediaCreator.GenerateMedia(
|
|
21
|
+
* { x: 0, y: 0, z: 0 }, // camera position
|
|
22
|
+
* { x: 0, y: 0, z: 0 }, // camera target
|
|
23
|
+
* 1920, // width
|
|
24
|
+
* 1080 // height
|
|
25
|
+
* );
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Features:
|
|
29
|
+
* - High-quality screenshot generation
|
|
30
|
+
* - Customizable camera position and target
|
|
31
|
+
* - Configurable output resolution
|
|
32
|
+
*/
|
|
33
|
+
export declare class MediaCreator {
|
|
34
|
+
private renderer;
|
|
35
|
+
private scene;
|
|
36
|
+
private controller;
|
|
37
|
+
constructor(renderer: DIVERenderer, scene: DIVEScene, controller: DIVEOrbitControls);
|
|
38
|
+
GenerateMedia(position: Vector3Like, target: Vector3Like, width: number, height: number): string;
|
|
39
|
+
DrawCanvas(canvasElement?: HTMLCanvasElement): HTMLCanvasElement;
|
|
40
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var d = (t, e, r) => e in t ? h(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var n = (t, e, r) => d(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { a as i } from "../../../chunks/PerspectiveCamera-ACx6umAu.mjs";
|
|
5
|
+
class b {
|
|
6
|
+
constructor(e, r, o) {
|
|
7
|
+
n(this, "renderer");
|
|
8
|
+
n(this, "scene");
|
|
9
|
+
n(this, "controller");
|
|
10
|
+
this.renderer = e, this.scene = r, this.controller = o;
|
|
11
|
+
}
|
|
12
|
+
GenerateMedia(e, r, o, s) {
|
|
13
|
+
const c = this.controller.object.position.clone(), l = this.controller.object.quaternion.clone();
|
|
14
|
+
this.renderer.OnResize(o, s), this.controller.object.OnResize(o, s), this.controller.object.position.copy(e), this.controller.target.copy(r), this.controller.update();
|
|
15
|
+
const a = this.DrawCanvas().toDataURL();
|
|
16
|
+
return this.controller.object.position.copy(c), this.controller.object.quaternion.copy(l), a;
|
|
17
|
+
}
|
|
18
|
+
DrawCanvas(e) {
|
|
19
|
+
const r = this.renderer.domElement;
|
|
20
|
+
e && (this.renderer.domElement = e), this.controller.object.layers.mask = i.LIVE_VIEW_LAYER_MASK, this.renderer.render(this.scene, this.controller.object), this.controller.object.layers.mask = i.EDITOR_VIEW_LAYER_MASK;
|
|
21
|
+
const o = this.renderer.domElement;
|
|
22
|
+
return e && (this.renderer.domElement = r), o;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
b as MediaCreator
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=MediaCreator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaCreator.mjs","sources":["../../../../src/modules/mediacreator/MediaCreator.ts"],"sourcesContent":["import { DIVEPerspectiveCamera } from '../../engine/camera/PerspectiveCamera';\nimport { type DIVEScene } from '../../engine/scene/Scene';\nimport { type DIVERenderer } from '../../engine/renderer/Renderer';\nimport type DIVEOrbitControls from '../../controls/OrbitControls';\nimport { type Vector3Like } from 'three';\n\ndeclare global {\n interface ModuleClasses {\n MediaCreator: MediaCreator;\n }\n}\n\n/**\n * @module MediaCreator\n *\n * Provides tools for creating media content from the 3D scene:\n *\n * ```ts\n * import { MediaCreator } from '@shopware-ag/dive/modules/mediacreator';\n * const mediaCreator = new MediaCreator();\n *\n * // Generate a screenshot\n * const screenshot = await mediaCreator.GenerateMedia(\n * { x: 0, y: 0, z: 0 }, // camera position\n * { x: 0, y: 0, z: 0 }, // camera target\n * 1920, // width\n * 1080 // height\n * );\n * ```\n *\n * Features:\n * - High-quality screenshot generation\n * - Customizable camera position and target\n * - Configurable output resolution\n */\n\nexport class MediaCreator {\n private renderer: DIVERenderer;\n private scene: DIVEScene;\n private controller: DIVEOrbitControls;\n\n constructor(\n renderer: DIVERenderer,\n scene: DIVEScene,\n controller: DIVEOrbitControls,\n ) {\n this.renderer = renderer;\n this.scene = scene;\n this.controller = controller;\n }\n\n public GenerateMedia(\n position: Vector3Like,\n target: Vector3Like,\n width: number,\n height: number,\n ): string {\n const resetPosition = this.controller.object.position.clone();\n const resetRotation = this.controller.object.quaternion.clone();\n\n this.renderer.OnResize(width, height);\n this.controller.object.OnResize(width, height);\n\n this.controller.object.position.copy(position);\n this.controller.target.copy(target);\n this.controller.update();\n\n const dataUri = this.DrawCanvas().toDataURL();\n\n this.controller.object.position.copy(resetPosition);\n this.controller.object.quaternion.copy(resetRotation);\n\n return dataUri;\n }\n\n public DrawCanvas(canvasElement?: HTMLCanvasElement): HTMLCanvasElement {\n // save current canvas\n const restore = this.renderer.domElement;\n if (canvasElement) {\n this.renderer.domElement = canvasElement;\n }\n\n // draw canvas\n this.controller.object.layers.mask =\n DIVEPerspectiveCamera.LIVE_VIEW_LAYER_MASK;\n this.renderer.render(this.scene, this.controller.object);\n this.controller.object.layers.mask =\n DIVEPerspectiveCamera.EDITOR_VIEW_LAYER_MASK;\n\n const returnCanvas = this.renderer.domElement;\n\n // restore canvas\n if (canvasElement) {\n this.renderer.domElement = restore;\n }\n\n return returnCanvas;\n }\n}\n"],"names":["MediaCreator","renderer","scene","controller","__publicField","position","target","width","height","resetPosition","resetRotation","dataUri","canvasElement","restore","DIVEPerspectiveCamera","returnCanvas"],"mappings":";;;;AAoCO,MAAMA,EAAa;AAAA,EAKtB,YACIC,GACAC,GACAC,GACF;AARM,IAAAC,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAOJ,SAAK,WAAWH,GAChB,KAAK,QAAQC,GACb,KAAK,aAAaC;AAAA,EAAA;AAAA,EAGf,cACHE,GACAC,GACAC,GACAC,GACM;AACN,UAAMC,IAAgB,KAAK,WAAW,OAAO,SAAS,MAAM,GACtDC,IAAgB,KAAK,WAAW,OAAO,WAAW,MAAM;AAEzD,SAAA,SAAS,SAASH,GAAOC,CAAM,GACpC,KAAK,WAAW,OAAO,SAASD,GAAOC,CAAM,GAE7C,KAAK,WAAW,OAAO,SAAS,KAAKH,CAAQ,GACxC,KAAA,WAAW,OAAO,KAAKC,CAAM,GAClC,KAAK,WAAW,OAAO;AAEvB,UAAMK,IAAU,KAAK,WAAW,EAAE,UAAU;AAE5C,gBAAK,WAAW,OAAO,SAAS,KAAKF,CAAa,GAClD,KAAK,WAAW,OAAO,WAAW,KAAKC,CAAa,GAE7CC;AAAA,EAAA;AAAA,EAGJ,WAAWC,GAAsD;AAE9D,UAAAC,IAAU,KAAK,SAAS;AAC9B,IAAID,MACA,KAAK,SAAS,aAAaA,IAI/B,KAAK,WAAW,OAAO,OAAO,OAC1BE,EAAsB,sBAC1B,KAAK,SAAS,OAAO,KAAK,OAAO,KAAK,WAAW,MAAM,GACvD,KAAK,WAAW,OAAO,OAAO,OAC1BA,EAAsB;AAEpB,UAAAC,IAAe,KAAK,SAAS;AAGnC,WAAIH,MACA,KAAK,SAAS,aAAaC,IAGxBE;AAAA,EAAA;AAEf;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var d=(r,e,s)=>e in r?a(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s;var o=(r,e,s)=>d(r,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../chunks/index-MNP0K5dt.cjs");class n{static getSystem(){if(typeof window>"u"||!window.navigator)return t.ESystem.UNKNOWN;const e=window.navigator.userAgent.toLowerCase();return e.includes("iphone")||e.includes("ipad")?t.ESystem.IOS:e.includes("android")?t.ESystem.ANDROID:e.includes("windows")?t.ESystem.WINDOWS:e.includes("macintosh")?t.ESystem.MACOS:e.includes("linux")?t.ESystem.LINUX:t.ESystem.UNKNOWN}static async getSupportsWebXR(){if(this._supportsWebXR!==!1)return this._supportsWebXR;if(!window.isSecureContext)return this._supportsWebXR=!1,this._webXRUnsupportedReason=t.EWebXRUnsupportedReason.NO_HTTPS,this._supportsWebXR;if(!navigator.xr)return this._supportsWebXR=!1,this._webXRUnsupportedReason=t.EWebXRUnsupportedReason.NO_WEBXR_API,this._supportsWebXR;try{const e=await navigator.xr.isSessionSupported("immersive-ar");this._supportsWebXR=e,this._supportsWebXR||(this._webXRUnsupportedReason=t.EWebXRUnsupportedReason.IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE)}catch{this._supportsWebXR=!1,this._webXRUnsupportedReason=t.EWebXRUnsupportedReason.AR_PERMISSION_DENIED}return this._supportsWebXR}static getWebXRUnsupportedReason(){return this._supportsWebXR?(console.log("WebXR is supported."),null):this._webXRUnsupportedReason}static getSupportsARQuickLook(){if(document.createElement("a").relList.supports("ar"))return!0;const s=window.navigator.userAgent,i=window.navigator.platform,u=window.navigator.vendor,p="ARQuickLook is not supported";throw new t.ARCompatibilityError(p,s,i,u)}static getSupportsSceneViewer(){if(typeof window>"u"||!window.navigator)return!1;const e=window.navigator.userAgent.toLowerCase();if(!e.includes("android")||!e.includes("chrome"))return!1;const s=e.match(/chrome\/(\d+)/);return!(!s||parseInt(s[1])<89)}static get isMobile(){return this.getSystem()===t.ESystem.ANDROID||this.getSystem()===t.ESystem.IOS}static get isDesktop(){return!this.isMobile}static getSupportsAR(){return this.getSupportsARQuickLook()||this.getSupportsSceneViewer()}}o(n,"_supportsWebXR",!1),o(n,"_webXRUnsupportedReason",null);exports.SystemInfo=n;
|
|
2
|
+
//# sourceMappingURL=SystemInfo.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SystemInfo.cjs","sources":["../../../../src/modules/systeminfo/SystemInfo.ts"],"sourcesContent":["import { ESystem, EWebXRUnsupportedReason } from '../../types/info';\nimport { ARCompatibilityError } from '../../error';\n\ndeclare global {\n interface ModuleClasses {\n SystemInfo: SystemInfo;\n }\n}\n\n/**\n * @module SystemInfo\n *\n * Provides information about the system's capabilities and performance:\n *\n * ```ts\n * import { SystemInfo } from '@shopware-ag/dive/modules/systeminfo';\n * const systemInfo = new SystemInfo();\n *\n * // Get system information\n * const system = systemInfo.getSystem(); // Returns ESystem enum (IOS, ANDROID, etc.)\n *\n * // Check AR capabilities\n * const supportsAR = systemInfo.getSupportsAR();\n *\n * // Check device type\n * const isMobile = systemInfo.isMobile;\n * const isDesktop = systemInfo.isDesktop;\n * ```\n *\n * Features:\n * - System detection (iOS, Android, Windows, etc.)\n * - WebXR support detection\n * - AR capability checking\n * - Device type detection\n * - SceneViewer support detection\n */\n\nexport class SystemInfo {\n private static _supportsWebXR: boolean = false;\n private static _webXRUnsupportedReason: EWebXRUnsupportedReason | null =\n null;\n\n /**\n * Gets the current system (iOS, Android, Windows, etc.)\n * @returns DIVESystem The current system\n */\n public static getSystem(): ESystem {\n if (typeof window === 'undefined' || !window.navigator) {\n return ESystem.UNKNOWN;\n }\n\n const userAgent = window.navigator.userAgent.toLowerCase();\n if (userAgent.includes('iphone') || userAgent.includes('ipad')) {\n return ESystem.IOS;\n }\n if (userAgent.includes('android')) {\n return ESystem.ANDROID;\n }\n if (userAgent.includes('windows')) {\n return ESystem.WINDOWS;\n }\n if (userAgent.includes('macintosh')) {\n return ESystem.MACOS;\n }\n if (userAgent.includes('linux')) {\n return ESystem.LINUX;\n }\n return ESystem.UNKNOWN;\n }\n\n /**\n * @returns A promise that resolves to a boolean indicating whether the user's device supports WebXR.\n */\n public static async getSupportsWebXR(): Promise<boolean> {\n if (this._supportsWebXR !== false) {\n return this._supportsWebXR;\n }\n\n // Check if we're in a secure context (HTTPS)\n if (!window.isSecureContext) {\n this._supportsWebXR = false;\n this._webXRUnsupportedReason = EWebXRUnsupportedReason.NO_HTTPS;\n return this._supportsWebXR;\n }\n\n // Check if XRSystem is available\n if (!navigator.xr) {\n this._supportsWebXR = false;\n this._webXRUnsupportedReason = EWebXRUnsupportedReason.NO_WEBXR_API;\n return this._supportsWebXR;\n }\n\n try {\n // Check specifically for immersive-ar support\n const arSupported =\n await navigator.xr.isSessionSupported('immersive-ar');\n this._supportsWebXR = arSupported;\n\n if (!this._supportsWebXR) {\n this._webXRUnsupportedReason =\n EWebXRUnsupportedReason.IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE;\n }\n } catch (error) {\n this._supportsWebXR = false;\n this._webXRUnsupportedReason =\n EWebXRUnsupportedReason.AR_PERMISSION_DENIED;\n }\n\n return this._supportsWebXR;\n }\n\n /**\n * @returns The reason why WebXR is not supported on the user's device. Returns null if WebXR is supported.\n */\n public static getWebXRUnsupportedReason(): EWebXRUnsupportedReason | null {\n if (this._supportsWebXR) {\n console.log('WebXR is supported.');\n return null;\n }\n return this._webXRUnsupportedReason;\n }\n\n /**\n * Checks if ARQuickLook is supported on the current device\n * This checks for:\n * 1. AR support via relList\n *\n * Requirements:\n * - iOS 13.0 or later\n * - Safari browser (ARQuickLook is only supported in Safari)\n * - Device with AR capabilities (iPhone/iPad with LiDAR scanner or ARKit support)\n *\n * Note: ARQuickLook is only available in Safari on iOS. Other browsers\n * (Chrome, Firefox, etc.) do not support ARQuickLook, even on iOS.\n *\n * @returns boolean indicating if ARQuickLook is supported\n * @throws ARCompatibilityError if ARQuickLook is not supported, with detailed browser information\n */\n public static getSupportsARQuickLook(): boolean {\n const a = document.createElement('a');\n if (a.relList.supports('ar')) {\n return true;\n }\n\n const userAgent = window.navigator.userAgent;\n const platform = window.navigator.platform;\n const vendor = window.navigator.vendor;\n\n // The base error message - the ARCompatibilityError constructor will add more details\n const errorMessage = 'ARQuickLook is not supported';\n\n throw new ARCompatibilityError(\n errorMessage,\n userAgent,\n platform,\n vendor,\n );\n }\n\n /**\n * Checks if SceneViewer is supported on the current device\n * This checks for:\n * 1. Android device\n * 2. Chrome browser (version 89 or later)\n *\n * Requirements:\n * - Android 7.0 (API level 24) or later\n * - Chrome for Android 89 or later\n *\n * Note: According to Google's documentation, if these requirements are met,\n * SceneViewer will be available. If ARCore is not installed, SceneViewer will\n * fall back to showing the model in 3D.\n *\n * @returns boolean indicating if SceneViewer is supported\n */\n public static getSupportsSceneViewer(): boolean {\n // Check if we're in a browser environment\n if (typeof window === 'undefined' || !window.navigator) {\n return false;\n }\n\n const userAgent = window.navigator.userAgent.toLowerCase();\n\n // Check if we're on Android\n if (!userAgent.includes('android')) {\n return false;\n }\n\n // Check if we're using Chrome\n if (!userAgent.includes('chrome')) {\n return false;\n }\n\n // Check Chrome version (89 or later)\n const chromeVersion = userAgent.match(/chrome\\/(\\d+)/);\n if (!chromeVersion || parseInt(chromeVersion[1]) < 89) {\n return false;\n }\n\n return true;\n }\n\n /**\n * @returns A boolean indicating whether the user's device is a mobile device.\n */\n public static get isMobile(): boolean {\n return (\n this.getSystem() === ESystem.ANDROID ||\n this.getSystem() === ESystem.IOS\n );\n }\n\n /**\n * @returns A boolean indicating whether the user's device is a desktop device.\n */\n public static get isDesktop(): boolean {\n return !this.isMobile;\n }\n\n /**\n * @returns A promise that resolves to a boolean indicating whether the user's device is capable of AR.\n */\n public static getSupportsAR(): boolean {\n return this.getSupportsARQuickLook() || this.getSupportsSceneViewer();\n }\n}\n"],"names":["SystemInfo","ESystem","userAgent","EWebXRUnsupportedReason","arSupported","platform","vendor","errorMessage","ARCompatibilityError","chromeVersion","__publicField"],"mappings":"0SAqCO,MAAMA,CAAW,CASpB,OAAc,WAAqB,CAC/B,GAAI,OAAO,OAAW,KAAe,CAAC,OAAO,UACzC,OAAOC,EAAQ,QAAA,QAGnB,MAAMC,EAAY,OAAO,UAAU,UAAU,YAAY,EACzD,OAAIA,EAAU,SAAS,QAAQ,GAAKA,EAAU,SAAS,MAAM,EAClDD,EAAQ,QAAA,IAEfC,EAAU,SAAS,SAAS,EACrBD,EAAQ,QAAA,QAEfC,EAAU,SAAS,SAAS,EACrBD,EAAQ,QAAA,QAEfC,EAAU,SAAS,WAAW,EACvBD,EAAQ,QAAA,MAEfC,EAAU,SAAS,OAAO,EACnBD,EAAQ,QAAA,MAEZA,EAAQ,QAAA,OAAA,CAMnB,aAAoB,kBAAqC,CACjD,GAAA,KAAK,iBAAmB,GACxB,OAAO,KAAK,eAIZ,GAAA,CAAC,OAAO,gBACR,YAAK,eAAiB,GACtB,KAAK,wBAA0BE,EAAAA,wBAAwB,SAChD,KAAK,eAIZ,GAAA,CAAC,UAAU,GACX,YAAK,eAAiB,GACtB,KAAK,wBAA0BA,EAAAA,wBAAwB,aAChD,KAAK,eAGZ,GAAA,CAEA,MAAMC,EACF,MAAM,UAAU,GAAG,mBAAmB,cAAc,EACxD,KAAK,eAAiBA,EAEjB,KAAK,iBACN,KAAK,wBACDD,EAAAA,wBAAwB,2CAEpB,CACZ,KAAK,eAAiB,GACtB,KAAK,wBACDA,EAAAA,wBAAwB,oBAAA,CAGhC,OAAO,KAAK,cAAA,CAMhB,OAAc,2BAA4D,CACtE,OAAI,KAAK,gBACL,QAAQ,IAAI,qBAAqB,EAC1B,MAEJ,KAAK,uBAAA,CAmBhB,OAAc,wBAAkC,CAE5C,GADU,SAAS,cAAc,GAAG,EAC9B,QAAQ,SAAS,IAAI,EAChB,MAAA,GAGL,MAAAD,EAAY,OAAO,UAAU,UAC7BG,EAAW,OAAO,UAAU,SAC5BC,EAAS,OAAO,UAAU,OAG1BC,EAAe,+BAErB,MAAM,IAAIC,EAAA,qBACND,EACAL,EACAG,EACAC,CACJ,CAAA,CAmBJ,OAAc,wBAAkC,CAE5C,GAAI,OAAO,OAAW,KAAe,CAAC,OAAO,UAClC,MAAA,GAGX,MAAMJ,EAAY,OAAO,UAAU,UAAU,YAAY,EAQzD,GALI,CAACA,EAAU,SAAS,SAAS,GAK7B,CAACA,EAAU,SAAS,QAAQ,EACrB,MAAA,GAIL,MAAAO,EAAgBP,EAAU,MAAM,eAAe,EACrD,MAAI,GAACO,GAAiB,SAASA,EAAc,CAAC,CAAC,EAAI,GAI5C,CAMX,WAAkB,UAAoB,CAE9B,OAAA,KAAK,cAAgBR,EAAA,QAAQ,SAC7B,KAAK,cAAgBA,EAAAA,QAAQ,GAAA,CAOrC,WAAkB,WAAqB,CACnC,MAAO,CAAC,KAAK,QAAA,CAMjB,OAAc,eAAyB,CACnC,OAAO,KAAK,0BAA4B,KAAK,uBAAuB,CAAA,CAE5E,CA3LIS,EADSV,EACM,iBAA0B,IACzCU,EAFSV,EAEM,0BACX"}
|
|
@@ -1,4 +1,36 @@
|
|
|
1
|
-
import { ESystem, EWebXRUnsupportedReason } from '
|
|
1
|
+
import { ESystem, EWebXRUnsupportedReason } from '../../types/info';
|
|
2
|
+
declare global {
|
|
3
|
+
interface ModuleClasses {
|
|
4
|
+
SystemInfo: SystemInfo;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @module SystemInfo
|
|
9
|
+
*
|
|
10
|
+
* Provides information about the system's capabilities and performance:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { SystemInfo } from '@shopware-ag/dive/modules/systeminfo';
|
|
14
|
+
* const systemInfo = new SystemInfo();
|
|
15
|
+
*
|
|
16
|
+
* // Get system information
|
|
17
|
+
* const system = systemInfo.getSystem(); // Returns ESystem enum (IOS, ANDROID, etc.)
|
|
18
|
+
*
|
|
19
|
+
* // Check AR capabilities
|
|
20
|
+
* const supportsAR = systemInfo.getSupportsAR();
|
|
21
|
+
*
|
|
22
|
+
* // Check device type
|
|
23
|
+
* const isMobile = systemInfo.isMobile;
|
|
24
|
+
* const isDesktop = systemInfo.isDesktop;
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Features:
|
|
28
|
+
* - System detection (iOS, Android, Windows, etc.)
|
|
29
|
+
* - WebXR support detection
|
|
30
|
+
* - AR capability checking
|
|
31
|
+
* - Device type detection
|
|
32
|
+
* - SceneViewer support detection
|
|
33
|
+
*/
|
|
2
34
|
export declare class SystemInfo {
|
|
3
35
|
private static _supportsWebXR;
|
|
4
36
|
private static _webXRUnsupportedReason;
|
|
@@ -6,15 +38,15 @@ export declare class SystemInfo {
|
|
|
6
38
|
* Gets the current system (iOS, Android, Windows, etc.)
|
|
7
39
|
* @returns DIVESystem The current system
|
|
8
40
|
*/
|
|
9
|
-
static
|
|
41
|
+
static getSystem(): ESystem;
|
|
10
42
|
/**
|
|
11
43
|
* @returns A promise that resolves to a boolean indicating whether the user's device supports WebXR.
|
|
12
44
|
*/
|
|
13
|
-
static
|
|
45
|
+
static getSupportsWebXR(): Promise<boolean>;
|
|
14
46
|
/**
|
|
15
47
|
* @returns The reason why WebXR is not supported on the user's device. Returns null if WebXR is supported.
|
|
16
48
|
*/
|
|
17
|
-
static
|
|
49
|
+
static getWebXRUnsupportedReason(): EWebXRUnsupportedReason | null;
|
|
18
50
|
/**
|
|
19
51
|
* Checks if ARQuickLook is supported on the current device
|
|
20
52
|
* This checks for:
|
|
@@ -29,8 +61,9 @@ export declare class SystemInfo {
|
|
|
29
61
|
* (Chrome, Firefox, etc.) do not support ARQuickLook, even on iOS.
|
|
30
62
|
*
|
|
31
63
|
* @returns boolean indicating if ARQuickLook is supported
|
|
64
|
+
* @throws ARCompatibilityError if ARQuickLook is not supported, with detailed browser information
|
|
32
65
|
*/
|
|
33
|
-
static
|
|
66
|
+
static getSupportsARQuickLook(): boolean;
|
|
34
67
|
/**
|
|
35
68
|
* Checks if SceneViewer is supported on the current device
|
|
36
69
|
* This checks for:
|
|
@@ -47,7 +80,7 @@ export declare class SystemInfo {
|
|
|
47
80
|
*
|
|
48
81
|
* @returns boolean indicating if SceneViewer is supported
|
|
49
82
|
*/
|
|
50
|
-
static
|
|
83
|
+
static getSupportsSceneViewer(): boolean;
|
|
51
84
|
/**
|
|
52
85
|
* @returns A boolean indicating whether the user's device is a mobile device.
|
|
53
86
|
*/
|
|
@@ -59,5 +92,5 @@ export declare class SystemInfo {
|
|
|
59
92
|
/**
|
|
60
93
|
* @returns A promise that resolves to a boolean indicating whether the user's device is capable of AR.
|
|
61
94
|
*/
|
|
62
|
-
static
|
|
95
|
+
static getSupportsAR(): boolean;
|
|
63
96
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var d = (r, t, e) => t in r ? c(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var i = (r, t, e) => d(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { E as s, a as o, A as R } from "../../../chunks/index-C7Wx_9uY.mjs";
|
|
5
|
+
class n {
|
|
6
|
+
/**
|
|
7
|
+
* Gets the current system (iOS, Android, Windows, etc.)
|
|
8
|
+
* @returns DIVESystem The current system
|
|
9
|
+
*/
|
|
10
|
+
static getSystem() {
|
|
11
|
+
if (typeof window > "u" || !window.navigator)
|
|
12
|
+
return s.UNKNOWN;
|
|
13
|
+
const t = window.navigator.userAgent.toLowerCase();
|
|
14
|
+
return t.includes("iphone") || t.includes("ipad") ? s.IOS : t.includes("android") ? s.ANDROID : t.includes("windows") ? s.WINDOWS : t.includes("macintosh") ? s.MACOS : t.includes("linux") ? s.LINUX : s.UNKNOWN;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device supports WebXR.
|
|
18
|
+
*/
|
|
19
|
+
static async getSupportsWebXR() {
|
|
20
|
+
if (this._supportsWebXR !== !1)
|
|
21
|
+
return this._supportsWebXR;
|
|
22
|
+
if (!window.isSecureContext)
|
|
23
|
+
return this._supportsWebXR = !1, this._webXRUnsupportedReason = o.NO_HTTPS, this._supportsWebXR;
|
|
24
|
+
if (!navigator.xr)
|
|
25
|
+
return this._supportsWebXR = !1, this._webXRUnsupportedReason = o.NO_WEBXR_API, this._supportsWebXR;
|
|
26
|
+
try {
|
|
27
|
+
const t = await navigator.xr.isSessionSupported("immersive-ar");
|
|
28
|
+
this._supportsWebXR = t, this._supportsWebXR || (this._webXRUnsupportedReason = o.IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE);
|
|
29
|
+
} catch {
|
|
30
|
+
this._supportsWebXR = !1, this._webXRUnsupportedReason = o.AR_PERMISSION_DENIED;
|
|
31
|
+
}
|
|
32
|
+
return this._supportsWebXR;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @returns The reason why WebXR is not supported on the user's device. Returns null if WebXR is supported.
|
|
36
|
+
*/
|
|
37
|
+
static getWebXRUnsupportedReason() {
|
|
38
|
+
return this._supportsWebXR ? (console.log("WebXR is supported."), null) : this._webXRUnsupportedReason;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Checks if ARQuickLook is supported on the current device
|
|
42
|
+
* This checks for:
|
|
43
|
+
* 1. AR support via relList
|
|
44
|
+
*
|
|
45
|
+
* Requirements:
|
|
46
|
+
* - iOS 13.0 or later
|
|
47
|
+
* - Safari browser (ARQuickLook is only supported in Safari)
|
|
48
|
+
* - Device with AR capabilities (iPhone/iPad with LiDAR scanner or ARKit support)
|
|
49
|
+
*
|
|
50
|
+
* Note: ARQuickLook is only available in Safari on iOS. Other browsers
|
|
51
|
+
* (Chrome, Firefox, etc.) do not support ARQuickLook, even on iOS.
|
|
52
|
+
*
|
|
53
|
+
* @returns boolean indicating if ARQuickLook is supported
|
|
54
|
+
* @throws ARCompatibilityError if ARQuickLook is not supported, with detailed browser information
|
|
55
|
+
*/
|
|
56
|
+
static getSupportsARQuickLook() {
|
|
57
|
+
if (document.createElement("a").relList.supports("ar"))
|
|
58
|
+
return !0;
|
|
59
|
+
const e = window.navigator.userAgent, u = window.navigator.platform, a = window.navigator.vendor, p = "ARQuickLook is not supported";
|
|
60
|
+
throw new R(
|
|
61
|
+
p,
|
|
62
|
+
e,
|
|
63
|
+
u,
|
|
64
|
+
a
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Checks if SceneViewer is supported on the current device
|
|
69
|
+
* This checks for:
|
|
70
|
+
* 1. Android device
|
|
71
|
+
* 2. Chrome browser (version 89 or later)
|
|
72
|
+
*
|
|
73
|
+
* Requirements:
|
|
74
|
+
* - Android 7.0 (API level 24) or later
|
|
75
|
+
* - Chrome for Android 89 or later
|
|
76
|
+
*
|
|
77
|
+
* Note: According to Google's documentation, if these requirements are met,
|
|
78
|
+
* SceneViewer will be available. If ARCore is not installed, SceneViewer will
|
|
79
|
+
* fall back to showing the model in 3D.
|
|
80
|
+
*
|
|
81
|
+
* @returns boolean indicating if SceneViewer is supported
|
|
82
|
+
*/
|
|
83
|
+
static getSupportsSceneViewer() {
|
|
84
|
+
if (typeof window > "u" || !window.navigator)
|
|
85
|
+
return !1;
|
|
86
|
+
const t = window.navigator.userAgent.toLowerCase();
|
|
87
|
+
if (!t.includes("android") || !t.includes("chrome"))
|
|
88
|
+
return !1;
|
|
89
|
+
const e = t.match(/chrome\/(\d+)/);
|
|
90
|
+
return !(!e || parseInt(e[1]) < 89);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @returns A boolean indicating whether the user's device is a mobile device.
|
|
94
|
+
*/
|
|
95
|
+
static get isMobile() {
|
|
96
|
+
return this.getSystem() === s.ANDROID || this.getSystem() === s.IOS;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @returns A boolean indicating whether the user's device is a desktop device.
|
|
100
|
+
*/
|
|
101
|
+
static get isDesktop() {
|
|
102
|
+
return !this.isMobile;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device is capable of AR.
|
|
106
|
+
*/
|
|
107
|
+
static getSupportsAR() {
|
|
108
|
+
return this.getSupportsARQuickLook() || this.getSupportsSceneViewer();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
i(n, "_supportsWebXR", !1), i(n, "_webXRUnsupportedReason", null);
|
|
112
|
+
export {
|
|
113
|
+
n as SystemInfo
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=SystemInfo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SystemInfo.mjs","sources":["../../../../src/modules/systeminfo/SystemInfo.ts"],"sourcesContent":["import { ESystem, EWebXRUnsupportedReason } from '../../types/info';\nimport { ARCompatibilityError } from '../../error';\n\ndeclare global {\n interface ModuleClasses {\n SystemInfo: SystemInfo;\n }\n}\n\n/**\n * @module SystemInfo\n *\n * Provides information about the system's capabilities and performance:\n *\n * ```ts\n * import { SystemInfo } from '@shopware-ag/dive/modules/systeminfo';\n * const systemInfo = new SystemInfo();\n *\n * // Get system information\n * const system = systemInfo.getSystem(); // Returns ESystem enum (IOS, ANDROID, etc.)\n *\n * // Check AR capabilities\n * const supportsAR = systemInfo.getSupportsAR();\n *\n * // Check device type\n * const isMobile = systemInfo.isMobile;\n * const isDesktop = systemInfo.isDesktop;\n * ```\n *\n * Features:\n * - System detection (iOS, Android, Windows, etc.)\n * - WebXR support detection\n * - AR capability checking\n * - Device type detection\n * - SceneViewer support detection\n */\n\nexport class SystemInfo {\n private static _supportsWebXR: boolean = false;\n private static _webXRUnsupportedReason: EWebXRUnsupportedReason | null =\n null;\n\n /**\n * Gets the current system (iOS, Android, Windows, etc.)\n * @returns DIVESystem The current system\n */\n public static getSystem(): ESystem {\n if (typeof window === 'undefined' || !window.navigator) {\n return ESystem.UNKNOWN;\n }\n\n const userAgent = window.navigator.userAgent.toLowerCase();\n if (userAgent.includes('iphone') || userAgent.includes('ipad')) {\n return ESystem.IOS;\n }\n if (userAgent.includes('android')) {\n return ESystem.ANDROID;\n }\n if (userAgent.includes('windows')) {\n return ESystem.WINDOWS;\n }\n if (userAgent.includes('macintosh')) {\n return ESystem.MACOS;\n }\n if (userAgent.includes('linux')) {\n return ESystem.LINUX;\n }\n return ESystem.UNKNOWN;\n }\n\n /**\n * @returns A promise that resolves to a boolean indicating whether the user's device supports WebXR.\n */\n public static async getSupportsWebXR(): Promise<boolean> {\n if (this._supportsWebXR !== false) {\n return this._supportsWebXR;\n }\n\n // Check if we're in a secure context (HTTPS)\n if (!window.isSecureContext) {\n this._supportsWebXR = false;\n this._webXRUnsupportedReason = EWebXRUnsupportedReason.NO_HTTPS;\n return this._supportsWebXR;\n }\n\n // Check if XRSystem is available\n if (!navigator.xr) {\n this._supportsWebXR = false;\n this._webXRUnsupportedReason = EWebXRUnsupportedReason.NO_WEBXR_API;\n return this._supportsWebXR;\n }\n\n try {\n // Check specifically for immersive-ar support\n const arSupported =\n await navigator.xr.isSessionSupported('immersive-ar');\n this._supportsWebXR = arSupported;\n\n if (!this._supportsWebXR) {\n this._webXRUnsupportedReason =\n EWebXRUnsupportedReason.IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE;\n }\n } catch (error) {\n this._supportsWebXR = false;\n this._webXRUnsupportedReason =\n EWebXRUnsupportedReason.AR_PERMISSION_DENIED;\n }\n\n return this._supportsWebXR;\n }\n\n /**\n * @returns The reason why WebXR is not supported on the user's device. Returns null if WebXR is supported.\n */\n public static getWebXRUnsupportedReason(): EWebXRUnsupportedReason | null {\n if (this._supportsWebXR) {\n console.log('WebXR is supported.');\n return null;\n }\n return this._webXRUnsupportedReason;\n }\n\n /**\n * Checks if ARQuickLook is supported on the current device\n * This checks for:\n * 1. AR support via relList\n *\n * Requirements:\n * - iOS 13.0 or later\n * - Safari browser (ARQuickLook is only supported in Safari)\n * - Device with AR capabilities (iPhone/iPad with LiDAR scanner or ARKit support)\n *\n * Note: ARQuickLook is only available in Safari on iOS. Other browsers\n * (Chrome, Firefox, etc.) do not support ARQuickLook, even on iOS.\n *\n * @returns boolean indicating if ARQuickLook is supported\n * @throws ARCompatibilityError if ARQuickLook is not supported, with detailed browser information\n */\n public static getSupportsARQuickLook(): boolean {\n const a = document.createElement('a');\n if (a.relList.supports('ar')) {\n return true;\n }\n\n const userAgent = window.navigator.userAgent;\n const platform = window.navigator.platform;\n const vendor = window.navigator.vendor;\n\n // The base error message - the ARCompatibilityError constructor will add more details\n const errorMessage = 'ARQuickLook is not supported';\n\n throw new ARCompatibilityError(\n errorMessage,\n userAgent,\n platform,\n vendor,\n );\n }\n\n /**\n * Checks if SceneViewer is supported on the current device\n * This checks for:\n * 1. Android device\n * 2. Chrome browser (version 89 or later)\n *\n * Requirements:\n * - Android 7.0 (API level 24) or later\n * - Chrome for Android 89 or later\n *\n * Note: According to Google's documentation, if these requirements are met,\n * SceneViewer will be available. If ARCore is not installed, SceneViewer will\n * fall back to showing the model in 3D.\n *\n * @returns boolean indicating if SceneViewer is supported\n */\n public static getSupportsSceneViewer(): boolean {\n // Check if we're in a browser environment\n if (typeof window === 'undefined' || !window.navigator) {\n return false;\n }\n\n const userAgent = window.navigator.userAgent.toLowerCase();\n\n // Check if we're on Android\n if (!userAgent.includes('android')) {\n return false;\n }\n\n // Check if we're using Chrome\n if (!userAgent.includes('chrome')) {\n return false;\n }\n\n // Check Chrome version (89 or later)\n const chromeVersion = userAgent.match(/chrome\\/(\\d+)/);\n if (!chromeVersion || parseInt(chromeVersion[1]) < 89) {\n return false;\n }\n\n return true;\n }\n\n /**\n * @returns A boolean indicating whether the user's device is a mobile device.\n */\n public static get isMobile(): boolean {\n return (\n this.getSystem() === ESystem.ANDROID ||\n this.getSystem() === ESystem.IOS\n );\n }\n\n /**\n * @returns A boolean indicating whether the user's device is a desktop device.\n */\n public static get isDesktop(): boolean {\n return !this.isMobile;\n }\n\n /**\n * @returns A promise that resolves to a boolean indicating whether the user's device is capable of AR.\n */\n public static getSupportsAR(): boolean {\n return this.getSupportsARQuickLook() || this.getSupportsSceneViewer();\n }\n}\n"],"names":["SystemInfo","ESystem","userAgent","EWebXRUnsupportedReason","arSupported","platform","vendor","errorMessage","ARCompatibilityError","chromeVersion","__publicField"],"mappings":";;;;AAqCO,MAAMA,EAAW;AAAA;AAAA;AAAA;AAAA;AAAA,EASpB,OAAc,YAAqB;AAC/B,QAAI,OAAO,SAAW,OAAe,CAAC,OAAO;AACzC,aAAOC,EAAQ;AAGnB,UAAMC,IAAY,OAAO,UAAU,UAAU,YAAY;AACzD,WAAIA,EAAU,SAAS,QAAQ,KAAKA,EAAU,SAAS,MAAM,IAClDD,EAAQ,MAEfC,EAAU,SAAS,SAAS,IACrBD,EAAQ,UAEfC,EAAU,SAAS,SAAS,IACrBD,EAAQ,UAEfC,EAAU,SAAS,WAAW,IACvBD,EAAQ,QAEfC,EAAU,SAAS,OAAO,IACnBD,EAAQ,QAEZA,EAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAMnB,aAAoB,mBAAqC;AACjD,QAAA,KAAK,mBAAmB;AACxB,aAAO,KAAK;AAIZ,QAAA,CAAC,OAAO;AACR,kBAAK,iBAAiB,IACtB,KAAK,0BAA0BE,EAAwB,UAChD,KAAK;AAIZ,QAAA,CAAC,UAAU;AACX,kBAAK,iBAAiB,IACtB,KAAK,0BAA0BA,EAAwB,cAChD,KAAK;AAGZ,QAAA;AAEA,YAAMC,IACF,MAAM,UAAU,GAAG,mBAAmB,cAAc;AACxD,WAAK,iBAAiBA,GAEjB,KAAK,mBACN,KAAK,0BACDD,EAAwB;AAAA,YAEpB;AACZ,WAAK,iBAAiB,IACtB,KAAK,0BACDA,EAAwB;AAAA,IAAA;AAGhC,WAAO,KAAK;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAMhB,OAAc,4BAA4D;AACtE,WAAI,KAAK,kBACL,QAAQ,IAAI,qBAAqB,GAC1B,QAEJ,KAAK;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBhB,OAAc,yBAAkC;AAE5C,QADU,SAAS,cAAc,GAAG,EAC9B,QAAQ,SAAS,IAAI;AAChB,aAAA;AAGL,UAAAD,IAAY,OAAO,UAAU,WAC7BG,IAAW,OAAO,UAAU,UAC5BC,IAAS,OAAO,UAAU,QAG1BC,IAAe;AAErB,UAAM,IAAIC;AAAA,MACND;AAAA,MACAL;AAAA,MACAG;AAAA,MACAC;AAAA,IACJ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBJ,OAAc,yBAAkC;AAE5C,QAAI,OAAO,SAAW,OAAe,CAAC,OAAO;AAClC,aAAA;AAGX,UAAMJ,IAAY,OAAO,UAAU,UAAU,YAAY;AAQzD,QALI,CAACA,EAAU,SAAS,SAAS,KAK7B,CAACA,EAAU,SAAS,QAAQ;AACrB,aAAA;AAIL,UAAAO,IAAgBP,EAAU,MAAM,eAAe;AACrD,WAAI,GAACO,KAAiB,SAASA,EAAc,CAAC,CAAC,IAAI;AAAA,EAI5C;AAAA;AAAA;AAAA;AAAA,EAMX,WAAkB,WAAoB;AAE9B,WAAA,KAAK,gBAAgBR,EAAQ,WAC7B,KAAK,gBAAgBA,EAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAOrC,WAAkB,YAAqB;AACnC,WAAO,CAAC,KAAK;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAMjB,OAAc,gBAAyB;AACnC,WAAO,KAAK,4BAA4B,KAAK,uBAAuB;AAAA,EAAA;AAE5E;AA3LIS,EADSV,GACM,kBAA0B,KACzCU,EAFSV,GAEM,2BACX;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Intersection, Object3D, Raycaster, Vector2, Vector3 } from 'three';
|
|
2
|
-
import { DIVEScene } from '../scene/Scene';
|
|
2
|
+
import { DIVEScene } from '../engine/scene/Scene';
|
|
3
3
|
import { default as DIVEOrbitControls } from '../controls/OrbitControls';
|
|
4
4
|
import { DIVEDraggable } from '../interface/Draggable';
|
|
5
5
|
import { DIVEHoverable } from '../interface/Hoverable';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as DIVEOrbitControls } from '../controls/OrbitControls.ts';
|
|
2
|
-
import { DIVEScene } from '../scene/Scene.ts';
|
|
2
|
+
import { DIVEScene } from '../engine/scene/Scene.ts';
|
|
3
3
|
import { DIVEBaseTool } from './BaseTool.ts';
|
|
4
4
|
import { DIVESelectTool } from './select/SelectTool.ts';
|
|
5
5
|
export type ToolType = 'select' | 'none';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DIVEScene } from '../../scene/Scene.ts';
|
|
1
|
+
import { DIVEScene } from '../../engine/scene/Scene.ts';
|
|
2
2
|
import { default as DIVETransformTool } from '../transform/TransformTool.ts';
|
|
3
3
|
import { default as DIVEOrbitControls } from '../../controls/OrbitControls.ts';
|
|
4
4
|
import { DIVESelectable } from '../../interface/Selectable.ts';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DIVEBaseTool } from '../BaseTool.ts';
|
|
2
|
-
import { DIVEScene } from '../../scene/Scene.ts';
|
|
2
|
+
import { DIVEScene } from '../../engine/scene/Scene.ts';
|
|
3
3
|
import { default as DIVEOrbitControls } from '../../controls/OrbitControls.ts';
|
|
4
4
|
import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
|
|
5
5
|
import { DIVEGizmo } from '../../gizmo/Gizmo.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const FILE_TYPES: {
|
|
1
|
+
export declare const FILE_TYPES: {
|
|
2
2
|
readonly glb: {
|
|
3
3
|
readonly key: "glb";
|
|
4
4
|
readonly extension: "glb";
|
|
@@ -14,4 +14,3 @@ declare const FILE_TYPES: {
|
|
|
14
14
|
};
|
|
15
15
|
export type FileType = keyof typeof FILE_TYPES;
|
|
16
16
|
export declare const SUPPORTED_FILE_TYPES: readonly string[];
|
|
17
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopware-ag/dive",
|
|
3
|
-
"version": "1.19.1-beta.
|
|
3
|
+
"version": "1.19.1-beta.4",
|
|
4
4
|
"description": "Shopware Spatial Framework",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "build/
|
|
7
|
-
"module": "build/
|
|
8
|
-
"types": "build/
|
|
6
|
+
"main": "build/index.cjs",
|
|
7
|
+
"module": "build/index.mjs",
|
|
8
|
+
"types": "build/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"types": "./build/
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
"import": "./build/dive.mjs",
|
|
21
|
-
"require": "./build/dive.cjs"
|
|
11
|
+
"types": "./build/index.d.ts",
|
|
12
|
+
"import": "./build/index.mjs",
|
|
13
|
+
"require": "./build/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./modules/*": {
|
|
16
|
+
"types": "./build/src/modules/*.d.ts",
|
|
17
|
+
"import": "./build/src/modules/*.mjs",
|
|
18
|
+
"require": "./build/src/modules/*.cjs"
|
|
22
19
|
}
|
|
23
20
|
},
|
|
24
21
|
"files": [
|
|
@@ -55,6 +52,7 @@
|
|
|
55
52
|
"@types/node": "^20.12.7",
|
|
56
53
|
"@types/three": "^0.163.0",
|
|
57
54
|
"eslint": "^9.1.1",
|
|
55
|
+
"glob": "^11.0.1",
|
|
58
56
|
"globals": "^15.0.0",
|
|
59
57
|
"jest": "^29.7.0",
|
|
60
58
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -74,7 +72,7 @@
|
|
|
74
72
|
"build": "vite build",
|
|
75
73
|
"dev": "vite build --watch",
|
|
76
74
|
"lint": "eslint",
|
|
77
|
-
"lint:actions": "
|
|
75
|
+
"lint:actions": "bash ci/lint/lint-actions.sh",
|
|
78
76
|
"lint:actions:transpile": "yarn tsc --resolveJsonModule --esModuleInterop ci/lint/lint-actions.ts && mv ci/lint/lint-actions.js ci/lint/lint-actions.cjs",
|
|
79
77
|
"lint:actions:check": "yarn node ci/lint/lint-actions.cjs",
|
|
80
78
|
"lint:actions:cleanup": "node -e \"require('fs').unlinkSync('ci/lint/lint-actions.cjs')\"",
|
|
@@ -82,10 +80,8 @@
|
|
|
82
80
|
"prettier:fix": "prettier --write .",
|
|
83
81
|
"unit": "jest",
|
|
84
82
|
"coverage": "jest --coverage",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"generate-readme:cleanup": "node -e \"require('fs').unlinkSync('ci/readme/generate-readme.cjs')\"",
|
|
89
|
-
"ci": "yarn lint && yarn coverage && yarn prettier:check && yarn build && bash ci/lint/lint-actions.sh"
|
|
83
|
+
"docs": "yarn tsc --resolveJsonModule --esModuleInterop --module ES2020 --moduleResolution node ci/readme/generate-readme.ts && mv ci/readme/generate-readme.js ci/readme/generate-readme.mjs && node ci/readme/generate-readme.mjs && cd ci/readme/generators && npm run generate",
|
|
84
|
+
"postdocs": "node -e \"const fs = require('fs'); const path = require('path'); const baseDir = 'ci/readme'; ['generate-readme.mjs', 'generate-readme.js', 'generators/actions-table.js', 'generators/module-docs.js'].forEach(file => { const fullPath = path.join(baseDir, file); if (fs.existsSync(fullPath)) fs.unlinkSync(fullPath); });\"",
|
|
85
|
+
"ci": "yarn lint && yarn lint:actions && yarn prettier:check && yarn docs && yarn coverage && yarn build"
|
|
90
86
|
}
|
|
91
87
|
}
|