@iwer/devui 0.2.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/build/iwer-devui.js +5190 -2892
  2. package/build/iwer-devui.min.js +268 -127
  3. package/build/iwer-devui.module.js +5190 -2892
  4. package/build/iwer-devui.module.min.js +268 -127
  5. package/lib/components/analog.d.ts.map +1 -1
  6. package/lib/components/analog.js +11 -13
  7. package/lib/components/analog.js.map +1 -1
  8. package/lib/components/binary.d.ts.map +1 -1
  9. package/lib/components/binary.js +15 -17
  10. package/lib/components/binary.js.map +1 -1
  11. package/lib/components/controls.d.ts +11 -2
  12. package/lib/components/controls.d.ts.map +1 -1
  13. package/lib/components/controls.js +61 -27
  14. package/lib/components/controls.js.map +1 -1
  15. package/lib/components/fov.d.ts.map +1 -1
  16. package/lib/components/fov.js +0 -1
  17. package/lib/components/fov.js.map +1 -1
  18. package/lib/components/header.d.ts +0 -4
  19. package/lib/components/header.d.ts.map +1 -1
  20. package/lib/components/header.js +75 -61
  21. package/lib/components/header.js.map +1 -1
  22. package/lib/components/headset.d.ts +17 -0
  23. package/lib/components/headset.d.ts.map +1 -0
  24. package/lib/components/headset.js +91 -0
  25. package/lib/components/headset.js.map +1 -0
  26. package/lib/components/icons.d.ts +8 -1
  27. package/lib/components/icons.d.ts.map +1 -1
  28. package/lib/components/icons.js +53 -27
  29. package/lib/components/icons.js.map +1 -1
  30. package/lib/components/joystick.d.ts.map +1 -1
  31. package/lib/components/joystick.js +56 -60
  32. package/lib/components/joystick.js.map +1 -1
  33. package/lib/components/mapper.d.ts +7 -3
  34. package/lib/components/mapper.d.ts.map +1 -1
  35. package/lib/components/mapper.js +34 -60
  36. package/lib/components/mapper.js.map +1 -1
  37. package/lib/components/styled.d.ts +48 -6
  38. package/lib/components/styled.d.ts.map +1 -1
  39. package/lib/components/styled.js +215 -36
  40. package/lib/components/styled.js.map +1 -1
  41. package/lib/components/vec3.d.ts +25 -0
  42. package/lib/components/vec3.d.ts.map +1 -0
  43. package/lib/components/vec3.js +90 -0
  44. package/lib/components/vec3.js.map +1 -0
  45. package/lib/index.d.ts +8 -12
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/index.js +71 -56
  48. package/lib/index.js.map +1 -1
  49. package/lib/package.json +55 -0
  50. package/lib/scene.d.ts +23 -40
  51. package/lib/scene.d.ts.map +1 -1
  52. package/lib/scene.js +160 -192
  53. package/lib/scene.js.map +1 -1
  54. package/lib/src/components/analog.d.ts +17 -0
  55. package/lib/src/components/analog.d.ts.map +1 -0
  56. package/lib/src/components/analog.js +111 -0
  57. package/lib/src/components/analog.js.map +1 -0
  58. package/lib/src/components/binary.d.ts +17 -0
  59. package/lib/src/components/binary.d.ts.map +1 -0
  60. package/lib/src/components/binary.js +77 -0
  61. package/lib/src/components/binary.js.map +1 -0
  62. package/lib/src/components/controls.d.ts +29 -0
  63. package/lib/src/components/controls.d.ts.map +1 -0
  64. package/lib/src/components/controls.js +139 -0
  65. package/lib/src/components/controls.js.map +1 -0
  66. package/lib/src/components/fov.d.ts +16 -0
  67. package/lib/src/components/fov.d.ts.map +1 -0
  68. package/lib/src/components/fov.js +30 -0
  69. package/lib/src/components/fov.js.map +1 -0
  70. package/lib/src/components/header.d.ts +20 -0
  71. package/lib/src/components/header.d.ts.map +1 -0
  72. package/lib/src/components/header.js +47 -0
  73. package/lib/src/components/header.js.map +1 -0
  74. package/lib/src/components/headset.d.ts +17 -0
  75. package/lib/src/components/headset.d.ts.map +1 -0
  76. package/lib/src/components/headset.js +29 -0
  77. package/lib/src/components/headset.js.map +1 -0
  78. package/lib/src/components/icons.d.ts +37 -0
  79. package/lib/src/components/icons.d.ts.map +1 -0
  80. package/lib/src/components/icons.js +265 -0
  81. package/lib/src/components/icons.js.map +1 -0
  82. package/lib/src/components/joystick.d.ts +21 -0
  83. package/lib/src/components/joystick.d.ts.map +1 -0
  84. package/lib/src/components/joystick.js +245 -0
  85. package/lib/src/components/joystick.js.map +1 -0
  86. package/lib/src/components/keys.d.ts +10 -0
  87. package/lib/src/components/keys.d.ts.map +1 -0
  88. package/lib/src/components/keys.js +74 -0
  89. package/lib/src/components/keys.js.map +1 -0
  90. package/lib/src/components/mapper.d.ts +22 -0
  91. package/lib/src/components/mapper.d.ts.map +1 -0
  92. package/lib/src/components/mapper.js +108 -0
  93. package/lib/src/components/mapper.js.map +1 -0
  94. package/lib/src/components/styled.d.ts +70 -0
  95. package/lib/src/components/styled.d.ts.map +1 -0
  96. package/lib/src/components/styled.js +272 -0
  97. package/lib/src/components/styled.js.map +1 -0
  98. package/lib/src/components/vec3.d.ts +22 -0
  99. package/lib/src/components/vec3.d.ts.map +1 -0
  100. package/lib/src/components/vec3.js +123 -0
  101. package/lib/src/components/vec3.js.map +1 -0
  102. package/lib/src/index.d.ts +22 -0
  103. package/lib/src/index.d.ts.map +1 -0
  104. package/lib/src/index.js +92 -0
  105. package/lib/src/index.js.map +1 -0
  106. package/lib/src/scene.d.ts +51 -0
  107. package/lib/src/scene.d.ts.map +1 -0
  108. package/lib/src/scene.js +250 -0
  109. package/lib/src/scene.js.map +1 -0
  110. package/lib/version.d.ts +2 -0
  111. package/lib/version.d.ts.map +1 -0
  112. package/lib/version.js +2 -0
  113. package/lib/version.js.map +1 -0
  114. package/package.json +6 -3
  115. package/build/iwe.min.js +0 -180
  116. package/lib/components/settings.d.ts +0 -50
  117. package/lib/components/settings.d.ts.map +0 -1
  118. package/lib/components/settings.js +0 -103
  119. package/lib/components/settings.js.map +0 -1
@@ -0,0 +1,17 @@
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 React from 'react';
8
+ import { XRController } from 'iwer/lib/device/XRController';
9
+ interface BinaryButtonProps {
10
+ xrController: XRController;
11
+ buttonId: string;
12
+ pointerLocked: boolean;
13
+ mappedKey: string;
14
+ }
15
+ export declare const BinaryButton: React.FC<BinaryButtonProps>;
16
+ export {};
17
+ //# sourceMappingURL=binary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../src/components/binary.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAI5D,UAAU,iBAAiB;IAC1B,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA4GpD,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Button, ButtonContainer, ButtonGroup, Colors, ControlButtonStyles, FAIcon, MappedKeyBlock, } from './styled.js';
9
+ import { useEffect, useState } from 'react';
10
+ import { GamepadIcon } from './icons.js';
11
+ import { MappedKeyDisplay } from './keys.js';
12
+ import { faFingerprint } from '@fortawesome/free-solid-svg-icons';
13
+ import { useDevUIConfig } from '../index.js';
14
+ export const BinaryButton = ({ xrController, buttonId, pointerLocked, mappedKey, }) => {
15
+ const devuiConfig = useDevUIConfig();
16
+ const [isTouched, setIsTouched] = useState(false);
17
+ const [isOnHold, setIsOnHold] = useState(false);
18
+ const [isPressed, setIsPressed] = useState(false);
19
+ const [isKeyPressed, setIsKeyPressed] = useState(false);
20
+ const handedness = xrController.inputSource.handedness;
21
+ useEffect(() => {
22
+ const handleKeyDown = (event) => {
23
+ if (event.code === mappedKey) {
24
+ xrController.updateButtonValue(buttonId, 1);
25
+ setIsKeyPressed(true);
26
+ }
27
+ };
28
+ const handleKeyUp = (event) => {
29
+ if (event.code === mappedKey) {
30
+ xrController.updateButtonValue(buttonId, 0);
31
+ setIsKeyPressed(false);
32
+ }
33
+ };
34
+ if (pointerLocked) {
35
+ window.addEventListener('keydown', handleKeyDown);
36
+ window.addEventListener('keyup', handleKeyUp);
37
+ }
38
+ else {
39
+ window.removeEventListener('keydown', handleKeyDown);
40
+ window.removeEventListener('keyup', handleKeyUp);
41
+ }
42
+ return () => {
43
+ window.removeEventListener('keydown', handleKeyDown);
44
+ window.removeEventListener('keyup', handleKeyUp);
45
+ };
46
+ }, [mappedKey, pointerLocked, buttonId, xrController]);
47
+ return (_jsxs(ButtonContainer, { "$reverse": handedness === 'right', children: [_jsx(GamepadIcon, { buttonName: buttonId, handedness: handedness }), _jsx(ButtonGroup, { "$reverse": handedness === 'right', children: pointerLocked ? (_jsx(MappedKeyBlock, { "$pressed": isKeyPressed, children: MappedKeyDisplay[mappedKey] })) : (_jsxs(_Fragment, { children: [_jsx(Button, { "$reverse": handedness === 'right', style: {
48
+ background: isPressed
49
+ ? Colors.gradientLightGreyTranslucent
50
+ : Colors.gradientGreyTranslucent,
51
+ width: ControlButtonStyles.widthLong,
52
+ }, onClick: () => {
53
+ setIsPressed(true);
54
+ xrController.updateButtonValue(buttonId, 1);
55
+ setTimeout(() => {
56
+ setIsPressed(false);
57
+ xrController.updateButtonValue(buttonId, 0);
58
+ }, devuiConfig.buttonPressDuration);
59
+ }, children: "Press" }), _jsx(Button, { "$reverse": handedness === 'right', style: {
60
+ background: isTouched
61
+ ? Colors.gradientLightGreyTranslucent
62
+ : Colors.gradientGreyTranslucent,
63
+ width: ControlButtonStyles.widthShort,
64
+ }, onClick: () => {
65
+ setIsTouched(!isTouched);
66
+ xrController.updateButtonTouch(buttonId, !isTouched);
67
+ }, children: _jsx(FAIcon, { icon: faFingerprint }) }), _jsx(Button, { "$reverse": handedness === 'right', style: {
68
+ background: isOnHold
69
+ ? Colors.gradientLightGreyTranslucent
70
+ : Colors.gradientGreyTranslucent,
71
+ width: ControlButtonStyles.widthLong,
72
+ }, onClick: () => {
73
+ setIsOnHold(!isOnHold);
74
+ xrController.updateButtonValue(buttonId, isOnHold ? 0 : 1);
75
+ }, children: "Hold" })] })) })] }));
76
+ };
77
+ //# sourceMappingURL=binary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.js","sourceRoot":"","sources":["../../../src/components/binary.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,EACN,MAAM,EACN,eAAe,EACf,WAAW,EACX,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,cAAc,GACd,MAAM,aAAa,CAAC;AACrB,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAS7C,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EACzD,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,SAAS,GACT,EAAE,EAAE;IACJ,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,MAAM,UAAU,GAAG,YAAY,CAAC,WAAW,CAAC,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AAC,4BAA4B;oCACrC,CAAC,CAAC,MAAM,CAAC,uBAAuB;gCACjC,KAAK,EAAE,mBAAmB,CAAC,SAAS;6BACpC,EACD,OAAO,EAAE,GAAG,EAAE;gCACb,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;gCACvB,YAAY,CAAC,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;4BAC5D,CAAC,qBAGO,IACP,CACH,GACY,IACG,CAClB,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,29 @@
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 { InputLayer } from '../scene.js';
8
+ import React from 'react';
9
+ import { TransformHandles } from '@pmndrs/handle';
10
+ import type { XRController } from 'iwer/lib/device/XRController.js';
11
+ import { XRDevice } from 'iwer';
12
+ export declare const HeaderButton: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Substitute<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
13
+ $isRed: boolean;
14
+ }>> & string;
15
+ interface ControlsProps {
16
+ xrDevice: XRDevice;
17
+ inputLayer: InputLayer;
18
+ pointerLocked: boolean;
19
+ }
20
+ export declare const ControlsUI: React.FC<ControlsProps>;
21
+ interface ControllerProps {
22
+ controller: XRController;
23
+ handle: TransformHandles;
24
+ handedness: string;
25
+ pointerLocked: boolean;
26
+ }
27
+ export declare const ControllerUI: React.FC<ControllerProps>;
28
+ export {};
29
+ //# sourceMappingURL=controls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../src/components/controls.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,EAAE,UAAU,EAAW,MAAM,aAAa,CAAC;AAYlD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AA0BhC,eAAO,MAAM,YAAY;YAA2B,OAAO;YAwB1D,CAAC;AAEF,UAAU,aAAa;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACvB;AAuCD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAsB9C,CAAC;AAEF,UAAU,eAAe;IACxB,UAAU,EAAE,YAAY,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAwJlD,CAAC"}
@@ -0,0 +1,139 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Colors, FAIcon } from './styled.js';
9
+ import { ControllerMapper, useKeyMapStore } from './mapper.js';
10
+ import { PRIVATE } from '../scene.js';
11
+ import { faCircleXmark, faGamepad, faGear, faPlug, } from '@fortawesome/free-solid-svg-icons';
12
+ import { AnalogButton } from './analog.js';
13
+ import { BinaryButton } from './binary.js';
14
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
15
+ import { Joystick } from './joystick.js';
16
+ import React from 'react';
17
+ import { Vector3Input } from './vec3.js';
18
+ import { styled } from 'styled-components';
19
+ const ControlsContainer = styled.div `
20
+ position: fixed;
21
+ bottom: 8px;
22
+ padding: 5px;
23
+ font-family: Arial, sans-serif;
24
+ color: ${Colors.textWhite};
25
+ pointer-events: all;
26
+ background-color: ${Colors.panelBackground};
27
+ border: 1px solid ${Colors.panelBorder};
28
+ backdrop-filter: blur(40px);
29
+ -webkit-backdrop-filter: blur(40px);
30
+ border-radius: 12px;
31
+ box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
32
+ overflow: hidden;
33
+ `;
34
+ const SectionBreak = styled.hr `
35
+ width: 100%;
36
+ height: 1px;
37
+ background-color: ${Colors.panelBorder};
38
+ border: none;
39
+ `;
40
+ export const HeaderButton = styled.button `
41
+ background-color: transparent;
42
+ border: none;
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ cursor: pointer;
47
+ color: ${({ $isRed }) => ($isRed ? Colors.dangerRed : Colors.textWhite)};
48
+ font-size: 12px;
49
+ padding: 3px;
50
+ text-transform: none;
51
+ box-shadow: none;
52
+
53
+ &:hover {
54
+ color: ${({ $isRed }) => ($isRed ? Colors.dangerRedPressed : '#ffffff')};
55
+ }
56
+
57
+ &:active {
58
+ color: ${({ $isRed }) => ($isRed ? Colors.dangerRedPressed : '#ffffff')};
59
+ }
60
+
61
+ &:focus {
62
+ outline: none;
63
+ }
64
+ `;
65
+ function transformGamepadConfig(gamepadConfig) {
66
+ const axesSet = new Set();
67
+ // Add all axis ids to the set
68
+ for (const axis of gamepadConfig.axes) {
69
+ if (axis && axis.id) {
70
+ axesSet.add(axis.id);
71
+ }
72
+ }
73
+ // Transform buttons to the desired format
74
+ const transformed = gamepadConfig.buttons
75
+ .filter((button) => button !== null) // Filter out null values
76
+ .map((button) => ({
77
+ id: button.id,
78
+ type: button.type,
79
+ hasAxes: axesSet.has(button.id),
80
+ }));
81
+ // Sort the array by hasAxes
82
+ transformed.sort((a, b) => {
83
+ if (a.hasAxes && !b.hasAxes)
84
+ return -1;
85
+ if (!a.hasAxes && b.hasAxes)
86
+ return 1;
87
+ return 0;
88
+ });
89
+ return transformed;
90
+ }
91
+ export const ControlsUI = ({ xrDevice, inputLayer, pointerLocked, }) => {
92
+ return (_jsx(_Fragment, { children: Object.entries(xrDevice.controllers).map(([handedness, controller]) => (_jsx(ControllerUI, { controller: controller, handle: inputLayer[PRIVATE].transformHandles.get(handedness), handedness: handedness, pointerLocked: pointerLocked }, `controller-${handedness}`))) }));
93
+ };
94
+ export const ControllerUI = ({ controller, handle, handedness, pointerLocked, }) => {
95
+ const { keyMap } = useKeyMapStore();
96
+ const [connected, setConnected] = React.useState(controller.connected);
97
+ const [settingsOpen, setSettingsOpen] = React.useState(false);
98
+ React.useEffect(() => {
99
+ if (pointerLocked) {
100
+ setSettingsOpen(false);
101
+ }
102
+ }, [pointerLocked]);
103
+ return (_jsxs(ControlsContainer, { style: handedness === 'left' ? { left: '8px' } : { right: '8px' }, children: [!pointerLocked && (_jsx(_Fragment, { children: _jsxs("div", { style: {
104
+ display: 'flex',
105
+ flexDirection: 'row',
106
+ justifyContent: 'space-between',
107
+ alignItems: 'center',
108
+ }, children: [_jsxs("div", { style: {
109
+ fontSize: '13px',
110
+ display: 'flex',
111
+ flexDirection: 'row',
112
+ alignItems: 'center',
113
+ }, children: [_jsx(FontAwesomeIcon, { icon: faGamepad, style: { marginRight: '5px' } }), "Controller\u00A0", _jsxs("span", { style: { fontWeight: 'bold' }, children: ["[", handedness === 'left' ? 'L' : 'R', "]"] })] }), _jsx("div", { style: {
114
+ display: 'flex',
115
+ flexDirection: 'row',
116
+ gap: '1px',
117
+ }, children: connected ? (_jsxs(_Fragment, { children: [_jsx(HeaderButton, { "$isRed": false, onClick: () => {
118
+ setSettingsOpen(!settingsOpen);
119
+ }, children: _jsx(FAIcon, { icon: faGear }) }), _jsx(HeaderButton, { "$isRed": true, onClick: () => {
120
+ controller.connected = false;
121
+ setConnected(false);
122
+ }, children: _jsx(FAIcon, { icon: faCircleXmark }) })] })) : (_jsx(HeaderButton, { "$isRed": false, onClick: () => {
123
+ controller.connected = true;
124
+ setConnected(true);
125
+ }, style: { marginLeft: '5px' }, children: _jsx(FAIcon, { icon: faPlug }) })) })] }) })), connected && !pointerLocked && (_jsxs(_Fragment, { children: [!settingsOpen && (_jsxs(_Fragment, { children: [_jsx(SectionBreak, {}), _jsx(Vector3Input, { vector: handle.position, label: "Position" }), _jsx(Vector3Input, { vector: handle.rotation, label: "Rotation" })] })), _jsx(SectionBreak, {})] })), connected &&
126
+ (settingsOpen ? (_jsx(ControllerMapper, { handedness: handedness })) : (transformGamepadConfig(controller.gamepadConfig).map((buttonConfig) => {
127
+ const mapping = keyMap[handedness];
128
+ if (buttonConfig.hasAxes) {
129
+ return (_jsx(Joystick, { xrController: controller, pointerLocked: pointerLocked, buttonId: buttonConfig.id, mappedKeyUp: keyMap[handedness][`${buttonConfig.id}-up`], mappedKeyDown: mapping[`${buttonConfig.id}-down`], mappedKeyLeft: mapping[`${buttonConfig.id}-left`], mappedKeyRight: mapping[`${buttonConfig.id}-right`], mappedKeyPressed: mapping[buttonConfig.id] }, buttonConfig.id));
130
+ }
131
+ else if (buttonConfig.type === 'analog') {
132
+ return (_jsx(AnalogButton, { xrController: controller, buttonId: buttonConfig.id, mappedKey: mapping[buttonConfig.id], pointerLocked: pointerLocked }, buttonConfig.id));
133
+ }
134
+ else {
135
+ return (_jsx(BinaryButton, { xrController: controller, buttonId: buttonConfig.id, mappedKey: mapping[buttonConfig.id], pointerLocked: pointerLocked }, buttonConfig.id));
136
+ }
137
+ })))] }, handedness));
138
+ };
139
+ //# sourceMappingURL=controls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controls.js","sourceRoot":"","sources":["../../../src/components/controls.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAK/D,OAAO,EAAc,OAAO,EAAE,MAAM,aAAa,CAAC;AAClD,OA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AE,YAAY,CAAC,EAAE,EACzB,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,EACnC,aAAa,EAAE,aAAa,IACvB,YAAY,CAAC,EAAE,CACnB,CACF,CAAC;oBACH,CAAC;gBACF,CAAC,CACD,CACD,CAAC,KArIE,UAAU,CAsII,CACpB,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,16 @@
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 React from 'react';
8
+ import { InputLayer } from '../scene.js';
9
+ import { XRDevice } from 'iwer';
10
+ interface FOVMenuProps {
11
+ xrDevice: XRDevice;
12
+ inputLayer: InputLayer;
13
+ }
14
+ export declare const FOVMenu: React.FC<FOVMenuProps>;
15
+ export {};
16
+ //# sourceMappingURL=fov.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fov.d.ts","sourceRoot":"","sources":["../../../src/components/fov.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAGhC,UAAU,YAAY;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;CACvB;AAaD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA4B1C,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Button, ButtonGroup, RangeSelector } from './styled.js';
9
+ import { useState } from 'react';
10
+ import { styled } from 'styled-components';
11
+ const FovSettingContainer = styled.div `
12
+ display: flex;
13
+ justify-content: center;
14
+ pointer-events: all;
15
+ position: fixed;
16
+ display: flex;
17
+ top: 40px;
18
+ left: calc(50vw - 156px);
19
+ width: 312px;
20
+ `;
21
+ export const FOVMenu = ({ xrDevice, inputLayer }) => {
22
+ const [fovy, setFovy] = useState(xrDevice.fovy);
23
+ return (_jsx(FovSettingContainer, { children: _jsxs(ButtonGroup, { "$reverse": false, children: [_jsx(Button, { "$reverse": false, disabled: true, children: "FOV-Y" }), _jsx(RangeSelector, { "$reverse": false, value: fovy, style: { width: '100px', borderRadius: '2px' }, onChange: (e) => {
24
+ const value = Number(e.target.value);
25
+ setFovy(value);
26
+ xrDevice.fovy = value;
27
+ inputLayer.syncFovy();
28
+ }, min: Math.PI / 6, max: Math.PI / 1.5, step: Math.PI / 48 }), _jsxs(Button, { "$reverse": false, disabled: true, children: [((fovy / Math.PI) * 180).toFixed(2), "\u00B0"] })] }) }));
29
+ };
30
+ //# sourceMappingURL=fov.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fov.js","sourceRoot":"","sources":["../../../src/components/fov.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAO3C,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;CASrC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAA2B,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;IAC3E,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChD,OAAO,CACN,KAAC,mBAAmB,cACnB,MAAC,WAAW,gBAAW,KAAK,aAC3B,KAAC,MAAM,gBAAW,KAAK,EAAE,QAAQ,EAAE,IAAI,sBAE9B,EACT,KAAC,aAAa,gBACH,KAAK,EACf,KAAK,EAAE,IAAI,EACX,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,EAC9C,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;wBACf,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;wBACrC,OAAO,CAAC,KAAK,CAAC,CAAC;wBACf,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC;wBACtB,UAAU,CAAC,QAAQ,EAAE,CAAC;oBACvB,CAAC,EACD,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,EAChB,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,EAClB,IAAI,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,GACjB,EACF,MAAC,MAAM,gBAAW,KAAK,EAAE,QAAQ,EAAE,IAAI,aACrC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAC5B,IACI,GACO,CACtB,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,20 @@
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 { InputLayer } from '../scene.js';
8
+ import React from 'react';
9
+ import { XRDevice } from 'iwer';
10
+ interface HeaderUIProps {
11
+ xrDevice: XRDevice;
12
+ inputLayer: InputLayer;
13
+ keyMapOpen: boolean;
14
+ setKeyMapOpen: React.Dispatch<React.SetStateAction<boolean>>;
15
+ fovSettingOpen: boolean;
16
+ setFovSettingOpen: React.Dispatch<React.SetStateAction<boolean>>;
17
+ }
18
+ export declare const HeaderUI: React.FC<HeaderUIProps>;
19
+ export {};
20
+ //# sourceMappingURL=header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/components/header.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AA6ChC,UAAU,aAAa;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7D,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CACjE;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAoG5C,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Colors, FAIcon, HeaderButton } from './styled.js';
9
+ import { faCirclePlay, faRightFromBracket, faRotateLeft, faVideo, } from '@fortawesome/free-solid-svg-icons';
10
+ import { styled } from 'styled-components';
11
+ const HeaderButtonsContainer = styled.div `
12
+ padding: 2px;
13
+ display: flex;
14
+ background-color: ${Colors.panelBackground};
15
+ border: 1px solid ${Colors.panelBorder};
16
+ backdrop-filter: blur(40px);
17
+ -webkit-backdrop-filter: blur(40px);
18
+ justify-content: center;
19
+ pointer-events: all;
20
+ border-radius: 14px;
21
+ align-items: center;
22
+ height: 24px;
23
+ `;
24
+ export const HeaderUI = ({ xrDevice, inputLayer, setKeyMapOpen, fovSettingOpen, setFovSettingOpen, }) => {
25
+ return (_jsx("div", { style: {
26
+ display: 'flex',
27
+ justifyContent: 'center',
28
+ padding: '8px',
29
+ }, children: _jsx(HeaderButtonsContainer, { children: _jsxs("div", { style: {
30
+ display: 'flex',
31
+ flexDirection: 'row',
32
+ gap: '1px',
33
+ }, children: [_jsx(HeaderButton, { onClick: () => {
34
+ inputLayer.resetDeviceTransforms();
35
+ }, children: _jsx(FAIcon, { icon: faRotateLeft }) }), _jsx(HeaderButton, { onClick: () => {
36
+ inputLayer.lockPointer();
37
+ setKeyMapOpen(false);
38
+ setFovSettingOpen(false);
39
+ }, children: _jsx(FAIcon, { icon: faCirclePlay }) }), _jsx(HeaderButton, { onClick: () => {
40
+ setFovSettingOpen(!fovSettingOpen);
41
+ setKeyMapOpen(false);
42
+ }, children: _jsx(FAIcon, { icon: faVideo }) }), _jsx(HeaderButton, { onClick: () => {
43
+ const xrSession = xrDevice.activeSession;
44
+ xrSession === null || xrSession === void 0 ? void 0 : xrSession.end();
45
+ }, children: _jsx(FAIcon, { icon: faRightFromBracket }) })] }) }) }));
46
+ };
47
+ //# sourceMappingURL=header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.js","sourceRoot":"","sources":["../../../src/components/header.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACN,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,OAAO,GACP,MAAM,mCAAmC,CAAC;AAK3C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA;;;qBAGpB,MAAM,CAAC,eAAe;qBACtB,MAAM,CAAC,WAAW;;;;;;;;CAQtC,CAAC;AAuCF,MAAM,CAAC,MA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ms, 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 { InputLayer } from '../scene.js';
8
+ import React from 'react';
9
+ import { XRDevice } from 'iwer';
10
+ interface HeadsetProps {
11
+ xrDevice: XRDevice;
12
+ inputLayer: InputLayer;
13
+ pointerLocked: boolean;
14
+ }
15
+ export declare const HeadsetUI: React.FC<HeadsetProps>;
16
+ export {};
17
+ //# sourceMappingURL=headset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headset.d.ts","sourceRoot":"","sources":["../../../src/components/headset.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAGhC,UAAU,YAAY;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAyC5C,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { ControlPanel } from './styled.js';
9
+ import { IWERIcon } from './icons.js';
10
+ import { version } from '../../package.json';
11
+ export const HeadsetUI = ({ xrDevice, inputLayer, pointerLocked, }) => {
12
+ console.log(xrDevice, inputLayer);
13
+ return (_jsx(ControlPanel, { style: { left: '8px', top: '8px' }, children: !pointerLocked && (_jsx(_Fragment, { children: _jsxs("div", { style: {
14
+ display: 'flex',
15
+ flexDirection: 'row',
16
+ justifyContent: 'space-between',
17
+ alignItems: 'center',
18
+ }, children: [_jsxs("div", { style: {
19
+ fontSize: '13px',
20
+ display: 'flex',
21
+ flexDirection: 'row',
22
+ alignItems: 'center',
23
+ }, children: [_jsx(IWERIcon, {}), "IWER v", version] }), _jsx("div", { style: {
24
+ display: 'flex',
25
+ flexDirection: 'row',
26
+ gap: '1px',
27
+ } })] }) })) }));
28
+ };
29
+ //# sourceMappingURL=headset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headset.js","sourceRoot":"","sources":["../../../src/components/headset.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAQ7C,MAAM,CAAC,MAAM,SAAS,GAA2B,CAAC,EACjD,QAAQ,EACR,UAAU,EACV,aAAa,GACb,EAAE,EAAE;IACJ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAClC,OAAO,CACN,KAAC,YAAY,IAAC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,YAC9C,CAAC,aAAa,IAAI,CAClB,4BACC,eACC,KAAK,EAAE;oBACN,OAAO,EAAE,MAAM;oBACf,aAAa,EAAE,KAAK;oBACpB,cAAc,EAAE,eAAe;oBAC/B,UAAU,EAAE,QAAQ;iBACpB,aAED,eACC,KAAK,EAAE;4BACN,QAAQ,EAAE,MAAM;4BAChB,OAAO,EAAE,MAAM;4BACf,aAAa,EAAE,KAAK;4BACpB,UAAU,EAAE,QAAQ;yBACpB,aAED,KAAC,QAAQ,KAAG,YACL,OAAO,IACT,EACN,cACC,KAAK,EAAE;4BACN,OAAO,EAAE,MAAM;4BACf,aAAa,EAAE,KAAK;4BACpB,GAAG,EAAE,KAAK;yBACV,GACK,IACF,GACJ,CACH,GACa,CACf,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,37 @@
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 React from 'react';
8
+ export declare const ButtonX: React.FC;
9
+ export declare const ButtonY: React.FC;
10
+ export declare const ButtonA: React.FC;
11
+ export declare const ButtonB: React.FC;
12
+ export declare const ThumbstickL: React.FC;
13
+ export declare const ThumbstickR: React.FC;
14
+ export declare const ThumbstickLUp: React.FC;
15
+ export declare const ThumbstickLDown: React.FC;
16
+ export declare const ThumbstickLLeft: React.FC;
17
+ export declare const ThumbstickLRight: React.FC;
18
+ export declare const ThumbstickRUp: React.FC;
19
+ export declare const ThumbstickRDown: React.FC;
20
+ export declare const ThumbstickRLeft: React.FC;
21
+ export declare const ThumbstickRRight: React.FC;
22
+ export declare const GripL: React.FC;
23
+ export declare const GripR: React.FC;
24
+ export declare const TriggerL: React.FC;
25
+ export declare const TriggerR: React.FC;
26
+ export declare const ThumbrestL: React.FC;
27
+ export declare const ThumbrestR: React.FC;
28
+ interface GamepadIconProps {
29
+ buttonName: string;
30
+ handedness: XRHandedness;
31
+ }
32
+ export declare const GamepadIcon: React.FC<GamepadIconProps>;
33
+ export declare const IWERIcon: React.FC;
34
+ export declare const MouseLeft: React.FC;
35
+ export declare const MouseRight: React.FC;
36
+ export {};
37
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/icons.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAoC3B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAoC3B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAoC3B,CAAC;AAE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