@iwer/devui 0.1.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 (58) hide show
  1. package/build/iwe.min.js +180 -0
  2. package/build/iwer-devui.js +40068 -0
  3. package/build/iwer-devui.min.js +252 -0
  4. package/build/iwer-devui.module.js +40060 -0
  5. package/build/iwer-devui.module.min.js +252 -0
  6. package/lib/components/analog.d.ts +11 -0
  7. package/lib/components/analog.d.ts.map +1 -0
  8. package/lib/components/analog.js +103 -0
  9. package/lib/components/analog.js.map +1 -0
  10. package/lib/components/binary.d.ts +11 -0
  11. package/lib/components/binary.d.ts.map +1 -0
  12. package/lib/components/binary.js +69 -0
  13. package/lib/components/binary.js.map +1 -0
  14. package/lib/components/controls.d.ts +11 -0
  15. package/lib/components/controls.d.ts.map +1 -0
  16. package/lib/components/controls.js +58 -0
  17. package/lib/components/controls.js.map +1 -0
  18. package/lib/components/fov.d.ts +10 -0
  19. package/lib/components/fov.d.ts.map +1 -0
  20. package/lib/components/fov.js +25 -0
  21. package/lib/components/fov.js.map +1 -0
  22. package/lib/components/header.d.ts +14 -0
  23. package/lib/components/header.d.ts.map +1 -0
  24. package/lib/components/header.js +70 -0
  25. package/lib/components/header.js.map +1 -0
  26. package/lib/components/icons.d.ts +31 -0
  27. package/lib/components/icons.d.ts.map +1 -0
  28. package/lib/components/icons.js +254 -0
  29. package/lib/components/icons.js.map +1 -0
  30. package/lib/components/joystick.d.ts +15 -0
  31. package/lib/components/joystick.d.ts.map +1 -0
  32. package/lib/components/joystick.js +238 -0
  33. package/lib/components/joystick.js.map +1 -0
  34. package/lib/components/keys.d.ts +4 -0
  35. package/lib/components/keys.d.ts.map +1 -0
  36. package/lib/components/keys.js +68 -0
  37. package/lib/components/keys.js.map +1 -0
  38. package/lib/components/mapper.d.ts +12 -0
  39. package/lib/components/mapper.d.ts.map +1 -0
  40. package/lib/components/mapper.js +128 -0
  41. package/lib/components/mapper.js.map +1 -0
  42. package/lib/components/settings.d.ts +50 -0
  43. package/lib/components/settings.d.ts.map +1 -0
  44. package/lib/components/settings.js +103 -0
  45. package/lib/components/settings.js.map +1 -0
  46. package/lib/components/styled.d.ts +31 -0
  47. package/lib/components/styled.d.ts.map +1 -0
  48. package/lib/components/styled.js +153 -0
  49. package/lib/components/styled.js.map +1 -0
  50. package/lib/index.d.ts +12 -0
  51. package/lib/index.d.ts.map +1 -0
  52. package/lib/index.js +75 -0
  53. package/lib/index.js.map +1 -0
  54. package/lib/scene.d.ts +54 -0
  55. package/lib/scene.d.ts.map +1 -0
  56. package/lib/scene.js +271 -0
  57. package/lib/scene.js.map +1 -0
  58. package/package.json +51 -0
@@ -0,0 +1,68 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MouseLeft, MouseRight } from './icons.js';
3
+ import { faAngleUp, faArrowRightToBracket, faArrowTurnDown, faCaretDown, faCaretLeft, faCaretRight, faCaretUp, faDeleteLeft, } from '@fortawesome/free-solid-svg-icons';
4
+ import { FAIcon } from './styled.js';
5
+ export const MappedKeyDisplay = {
6
+ KeyA: 'A',
7
+ KeyB: 'B',
8
+ KeyC: 'C',
9
+ KeyD: 'D',
10
+ KeyE: 'E',
11
+ KeyF: 'F',
12
+ KeyG: 'G',
13
+ KeyH: 'H',
14
+ KeyI: 'I',
15
+ KeyJ: 'J',
16
+ KeyK: 'K',
17
+ KeyL: 'L',
18
+ KeyM: 'M',
19
+ KeyN: 'N',
20
+ KeyO: 'O',
21
+ KeyP: 'P',
22
+ KeyQ: 'Q',
23
+ KeyR: 'R',
24
+ KeyS: 'S',
25
+ KeyT: 'T',
26
+ KeyU: 'U',
27
+ KeyV: 'V',
28
+ KeyW: 'W',
29
+ KeyX: 'X',
30
+ KeyY: 'Y',
31
+ KeyZ: 'Z',
32
+ Digit0: '0',
33
+ Digit1: '1',
34
+ Digit2: '2',
35
+ Digit3: '3',
36
+ Digit4: '4',
37
+ Digit5: '5',
38
+ Digit6: '6',
39
+ Digit7: '7',
40
+ Digit8: '8',
41
+ Digit9: '9',
42
+ Tab: _jsx(FAIcon, { icon: faArrowRightToBracket }),
43
+ Backspace: _jsx(FAIcon, { icon: faDeleteLeft }),
44
+ Enter: (_jsx(FAIcon, { style: {
45
+ transform: 'rotate(90deg)',
46
+ }, icon: faArrowTurnDown })),
47
+ ShiftLeft: _jsx(FAIcon, { icon: faAngleUp }),
48
+ ShiftRight: _jsx(FAIcon, { icon: faAngleUp }),
49
+ Space: ' ',
50
+ ArrowUp: _jsx(FAIcon, { icon: faCaretUp }),
51
+ ArrowDown: _jsx(FAIcon, { icon: faCaretDown }),
52
+ ArrowLeft: _jsx(FAIcon, { icon: faCaretLeft }),
53
+ ArrowRight: _jsx(FAIcon, { icon: faCaretRight }),
54
+ Semicolon: ';',
55
+ Equal: '=',
56
+ Comma: ',',
57
+ Minus: '-',
58
+ Period: '.',
59
+ Slash: '/',
60
+ Backquote: '`',
61
+ BracketLeft: '[',
62
+ Backslash: '\\',
63
+ BracketRight: ']',
64
+ Quote: "'",
65
+ MouseLeft: _jsx(MouseLeft, {}),
66
+ MouseRight: _jsx(MouseRight, {}),
67
+ };
68
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/components/keys.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EACN,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,YAAY,GACZ,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,MAAM,gBAAgB,GAEzB;IACH,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAA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AAI,EAAE,WAAW,GAAI;IACxC,UAAU,EAAE,KAAC,MAAM,IAAC,IAAI,EAAE,YAAY,GAAI;IAC1C,SAAS,EAAE,GAAG;IACd,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,SAAS,EAAE,GAAG;IACd,WAAW,EAAE,GAAG;IAChB,SAAS,EAAE,IAAI;IACf,YAAY,EAAE,GAAG;IACjB,KAAK,EAAE,GAAG;IACV,SAAS,EAAE,KAAC,SAAS,KAAG;IACxB,UAAU,EAAE,KAAC,UAAU,KAAG;CAC1B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export type KeyMapType = Partial<Record<XRHandedness, {
3
+ [key: string]: string;
4
+ }>>;
5
+ export declare const DEFAULT_KEYMAP: KeyMapType;
6
+ interface KeyMapMenuProps {
7
+ keyMap: KeyMapType;
8
+ setKeyMap: React.Dispatch<React.SetStateAction<KeyMapType>>;
9
+ }
10
+ export declare const KeyMapMenu: React.FC<KeyMapMenuProps>;
11
+ export {};
12
+ //# sourceMappingURL=mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../src/components/mapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,MAAM,MAAM,UAAU,GAAG,OAAO,CAC/B,MAAM,CAAC,YAAY,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC,CAC/C,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,UAuB5B,CAAC;AAEF,UAAU,eAAe;IACxB,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;CAC5D;AA0BD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqJhD,CAAC"}
@@ -0,0 +1,128 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, ButtonGroup } from './styled.js';
3
+ import { useEffect, useState } from 'react';
4
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
+ import { GamepadIcon } from './icons.js';
6
+ import { MappedKeyDisplay } from './keys.js';
7
+ import { faBan } from '@fortawesome/free-solid-svg-icons';
8
+ import styled from 'styled-components';
9
+ export const DEFAULT_KEYMAP = {
10
+ left: {
11
+ 'thumbstick-up': 'KeyW',
12
+ 'thumbstick-down': 'KeyS',
13
+ 'thumbstick-left': 'KeyA',
14
+ 'thumbstick-right': 'KeyD',
15
+ thumbstick: 'KeyR',
16
+ 'x-button': 'KeyX',
17
+ 'y-button': 'KeyZ',
18
+ trigger: 'KeyQ',
19
+ squeeze: 'KeyE',
20
+ },
21
+ right: {
22
+ 'thumbstick-up': 'ArrowUp',
23
+ 'thumbstick-down': 'ArrowDown',
24
+ 'thumbstick-left': 'ArrowLeft',
25
+ 'thumbstick-right': 'ArrowRight',
26
+ thumbstick: 'Slash',
27
+ 'a-button': 'Enter',
28
+ 'b-button': 'ShiftRight',
29
+ trigger: 'MouseLeft',
30
+ squeeze: 'MouseRight',
31
+ },
32
+ };
33
+ const KeyMapContainer = styled.div `
34
+ display: flex;
35
+ justify-content: space-between;
36
+ pointer-events: all;
37
+ position: fixed;
38
+ display: flex;
39
+ top: 40px;
40
+ left: calc(50vw - 156px);
41
+ width: 312px;
42
+ `;
43
+ const Column = styled.div `
44
+ display: flex;
45
+ flex-direction: column;
46
+ width: 50%;
47
+ `;
48
+ const Row = styled.div `
49
+ display: flex;
50
+ height: 24px;
51
+ align-items: center;
52
+ margin-bottom: 2px;
53
+ `;
54
+ export const KeyMapMenu = ({ keyMap, setKeyMap, }) => {
55
+ const [currentMapping, setCurrentMapping] = useState(null);
56
+ const startMapping = (controller, action) => {
57
+ setCurrentMapping({ controller, action });
58
+ };
59
+ const unmapKey = (controller, action) => {
60
+ setKeyMap((prevKeyMap) => ({
61
+ ...prevKeyMap,
62
+ [controller]: {
63
+ ...prevKeyMap[controller],
64
+ [action]: 'Unmapped',
65
+ },
66
+ }));
67
+ };
68
+ useEffect(() => {
69
+ const handleKeyDown = (event) => {
70
+ if (currentMapping && MappedKeyDisplay[event.code]) {
71
+ setKeyMap((prevKeyMap) => ({
72
+ ...prevKeyMap,
73
+ [currentMapping.controller]: {
74
+ ...prevKeyMap[currentMapping.controller],
75
+ [currentMapping.action]: event.code,
76
+ },
77
+ }));
78
+ setCurrentMapping(null);
79
+ }
80
+ };
81
+ const handleMouseDown = (event) => {
82
+ if (currentMapping) {
83
+ const mouseButton = event.button === 0
84
+ ? 'MouseLeft'
85
+ : event.button === 2
86
+ ? 'MouseRight'
87
+ : null;
88
+ if (mouseButton && MappedKeyDisplay[mouseButton]) {
89
+ setKeyMap((prevKeyMap) => ({
90
+ ...prevKeyMap,
91
+ [currentMapping.controller]: {
92
+ ...prevKeyMap[currentMapping.controller],
93
+ [currentMapping.action]: mouseButton,
94
+ },
95
+ }));
96
+ setCurrentMapping(null);
97
+ }
98
+ }
99
+ };
100
+ const preventDefaultContextMenu = (event) => {
101
+ event.preventDefault();
102
+ };
103
+ window.addEventListener('keydown', handleKeyDown);
104
+ window.addEventListener('mousedown', handleMouseDown);
105
+ window.addEventListener('contextmenu', preventDefaultContextMenu);
106
+ return () => {
107
+ window.removeEventListener('keydown', handleKeyDown);
108
+ window.removeEventListener('mousedown', handleMouseDown);
109
+ window.removeEventListener('contextmenu', preventDefaultContextMenu);
110
+ };
111
+ }, [currentMapping, setKeyMap]);
112
+ return (_jsxs(KeyMapContainer, { children: [_jsx(Column, { children: Object.keys(keyMap.left).map((action) => (_jsxs(Row, { children: [_jsx(GamepadIcon, { buttonName: action === 'up' ? 'thumbstick' : action, handedness: "left" }), _jsxs(ButtonGroup, { "$reverse": false, children: [_jsx(Button, { "$reverse": false, style: {
113
+ width: '100px',
114
+ backgroundColor: currentMapping &&
115
+ currentMapping.controller === 'left' &&
116
+ currentMapping.action === action
117
+ ? 'rgba(255, 255, 255, 0.6)'
118
+ : 'rgba(255, 255, 255, 0.3)',
119
+ }, onClick: () => startMapping('left', action), onContextMenu: (e) => e.preventDefault(), children: keyMap.left[action] }), _jsx(Button, { style: { width: '24px' }, "$reverse": false, onClick: () => unmapKey('left', action), onContextMenu: (e) => e.preventDefault(), children: _jsx(FontAwesomeIcon, { icon: faBan }) })] })] }, action))) }), _jsx(Column, { children: Object.keys(keyMap.right).map((action) => (_jsxs(Row, { children: [_jsx(GamepadIcon, { buttonName: action === 'up' ? 'thumbstick' : action, handedness: "right" }), _jsxs(ButtonGroup, { "$reverse": false, children: [_jsx(Button, { "$reverse": false, style: {
120
+ width: '100px',
121
+ backgroundColor: currentMapping &&
122
+ currentMapping.controller === 'right' &&
123
+ currentMapping.action === action
124
+ ? 'rgba(255, 255, 255, 0.6)'
125
+ : 'rgba(255, 255, 255, 0.3)',
126
+ }, onClick: () => startMapping('right', action), onContextMenu: (e) => e.preventDefault(), children: keyMap.right[action] }), _jsx(Button, { "$reverse": false, style: { width: '24px' }, onClick: () => unmapKey('right', action), onContextMenu: (e) => e.preventDefault(), children: _jsx(FontAwesomeIcon, { icon: faBan }) })] })] }, action))) })] }));
127
+ };
128
+ //# sourceMappingURL=mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapper.js","sourceRoot":"","sources":["../../src/components/mapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClD,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7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C,MAAM,CAAC,GACzC,EACT,KAAC,MAAM,gBACI,KAAK,EACf,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EACxB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,EACxC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,YAExC,KAAC,eAAe,IAAC,IAAI,EAAE,KAAK,GAAI,GACxB,IACI,KA9BL,MAAM,CA+BV,CACN,CAAC,GACM,IACQ,CAClB,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ interface SettingsMenuProps {
3
+ keyMap: {
4
+ left: {
5
+ up: string;
6
+ down: string;
7
+ left: string;
8
+ right: string;
9
+ 'x-button': string;
10
+ 'y-button': string;
11
+ trigger: string;
12
+ squeeze: string;
13
+ };
14
+ right: {
15
+ up: string;
16
+ down: string;
17
+ left: string;
18
+ right: string;
19
+ 'a-button': string;
20
+ 'b-button': string;
21
+ trigger: string;
22
+ squeeze: string;
23
+ };
24
+ };
25
+ setKeyMap: React.Dispatch<React.SetStateAction<{
26
+ left: {
27
+ up: string;
28
+ down: string;
29
+ left: string;
30
+ right: string;
31
+ 'x-button': string;
32
+ 'y-button': string;
33
+ trigger: string;
34
+ squeeze: string;
35
+ };
36
+ right: {
37
+ up: string;
38
+ down: string;
39
+ left: string;
40
+ right: string;
41
+ 'a-button': string;
42
+ 'b-button': string;
43
+ trigger: string;
44
+ squeeze: string;
45
+ };
46
+ }>>;
47
+ }
48
+ export declare const SettingsMenu: React.FC<SettingsMenuProps>;
49
+ export {};
50
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/components/settings.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAOnD,UAAU,iBAAiB;IAC1B,MAAM,EAAE;QACP,IA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@@ -0,0 +1,103 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, ButtonGroup } from './styled.js';
3
+ import { useEffect, useState } from 'react';
4
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
+ import { GamepadIcon } from './icons.js';
6
+ import { faBan } from '@fortawesome/free-solid-svg-icons';
7
+ import styled from 'styled-components';
8
+ const SettingsContainer = styled.div `
9
+ display: flex;
10
+ justify-content: space-between;
11
+ pointer-events: all;
12
+ position: fixed;
13
+ display: flex;
14
+ top: 40px;
15
+ left: calc(50vw - 156px);
16
+ width: 312px;
17
+ `;
18
+ const Column = styled.div `
19
+ display: flex;
20
+ flex-direction: column;
21
+ width: 50%;
22
+ `;
23
+ const Row = styled.div `
24
+ display: flex;
25
+ height: 24px;
26
+ align-items: center;
27
+ margin-bottom: 2px;
28
+ `;
29
+ export const SettingsMenu = ({ keyMap, setKeyMap, }) => {
30
+ const [currentMapping, setCurrentMapping] = useState(null);
31
+ const startMapping = (controller, action) => {
32
+ setCurrentMapping({ controller, action });
33
+ };
34
+ const unmapKey = (controller, action) => {
35
+ setKeyMap((prevKeyMap) => ({
36
+ ...prevKeyMap,
37
+ [controller]: {
38
+ ...prevKeyMap[controller],
39
+ [action]: 'Unmapped',
40
+ },
41
+ }));
42
+ };
43
+ useEffect(() => {
44
+ const handleKeyDown = (event) => {
45
+ if (currentMapping) {
46
+ setKeyMap((prevKeyMap) => ({
47
+ ...prevKeyMap,
48
+ [currentMapping.controller]: {
49
+ ...prevKeyMap[currentMapping.controller],
50
+ [currentMapping.action]: event.code,
51
+ },
52
+ }));
53
+ setCurrentMapping(null);
54
+ }
55
+ };
56
+ const handleMouseDown = (event) => {
57
+ if (currentMapping) {
58
+ const mouseButton = event.button === 0
59
+ ? 'MouseLeft'
60
+ : event.button === 2
61
+ ? 'MouseRight'
62
+ : null;
63
+ if (mouseButton) {
64
+ setKeyMap((prevKeyMap) => ({
65
+ ...prevKeyMap,
66
+ [currentMapping.controller]: {
67
+ ...prevKeyMap[currentMapping.controller],
68
+ [currentMapping.action]: mouseButton,
69
+ },
70
+ }));
71
+ setCurrentMapping(null);
72
+ }
73
+ }
74
+ };
75
+ const preventDefaultContextMenu = (event) => {
76
+ event.preventDefault();
77
+ };
78
+ window.addEventListener('keydown', handleKeyDown);
79
+ window.addEventListener('mousedown', handleMouseDown);
80
+ window.addEventListener('contextmenu', preventDefaultContextMenu);
81
+ return () => {
82
+ window.removeEventListener('keydown', handleKeyDown);
83
+ window.removeEventListener('mousedown', handleMouseDown);
84
+ window.removeEventListener('contextmenu', preventDefaultContextMenu);
85
+ };
86
+ }, [currentMapping, setKeyMap]);
87
+ return (_jsxs(SettingsContainer, { children: [_jsx(Column, { children: Object.keys(keyMap.left).map((action) => (_jsxs(Row, { children: [_jsx(GamepadIcon, { buttonName: action === 'up' ? 'thumbstick' : action, handedness: "left" }), _jsxs(ButtonGroup, { "$reverse": false, children: [_jsx(Button, { "$reverse": false, style: {
88
+ width: '100px',
89
+ backgroundColor: currentMapping &&
90
+ currentMapping.controller === 'left' &&
91
+ currentMapping.action === action
92
+ ? 'rgba(255, 255, 255, 0.6)'
93
+ : 'rgba(255, 255, 255, 0.3)',
94
+ }, onClick: () => startMapping('left', action), onContextMenu: (e) => e.preventDefault(), children: keyMap.left[action] }), _jsx(Button, { style: { width: '24px' }, "$reverse": false, onClick: () => unmapKey('left', action), onContextMenu: (e) => e.preventDefault(), children: _jsx(FontAwesomeIcon, { icon: faBan }) })] })] }, action))) }), _jsx(Column, { children: Object.keys(keyMap.right).map((action) => (_jsxs(Row, { children: [_jsx(GamepadIcon, { buttonName: action === 'up' ? 'thumbstick' : action, handedness: "right" }), _jsxs(ButtonGroup, { "$reverse": false, children: [_jsx(Button, { "$reverse": false, style: {
95
+ width: '100px',
96
+ backgroundColor: currentMapping &&
97
+ currentMapping.controller === 'right' &&
98
+ currentMapping.action === action
99
+ ? 'rgba(255, 255, 255, 0.6)'
100
+ : 'rgba(255, 255, 255, 0.3)',
101
+ }, onClick: () => startMapping('right', action), onContextMenu: (e) => e.preventDefault(), children: keyMap.right[action] }), _jsx(Button, { "$reverse": false, style: { width: '24px' }, onClick: () => unmapKey('right', action), onContextMenu: (e) => e.preventDefault(), children: _jsx(FontAwesomeIcon, { icon: faBan }) })] })] }, action))) })] }));
102
+ };
103
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/components/settings.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClD,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAmDvC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;CASnC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIxB,CAAC;AAEF,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAKrB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EACzD,MAAM,EACN,SAAS,GACT,EAAE,EAAE;IACJ,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAG1C,IAAI,CAAC,CAAC;IAEhB,MAAM,YAAY,GAAG,CAAC,UAA4B,EAAE,MAAc,EAAE,EAAE;QACrE,iBAAiB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAG,CAAC,UAA4B,EAAE,MAAc,EAAE,EAAE;QACjE,SAAS,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K,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EACxB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,EACxC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,YAExC,KAAC,eAAe,IAAC,IAAI,EAAE,KAAK,GAAI,GACxB,IACI,KA9BL,MAAM,CA+BV,CACN,CAAC,GACM,IACU,CACpB,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2
+ export declare const Button: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
3
+ $reverse: boolean;
4
+ }>> & string;
5
+ export declare const MappedKeyBlock: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
6
+ $pressed: boolean;
7
+ }>> & string;
8
+ export declare const ButtonContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
9
+ $reverse: boolean;
10
+ }>> & string;
11
+ export declare const ButtonGroup: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
12
+ $reverse: boolean;
13
+ }>> & string;
14
+ export declare const JoystickButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
15
+ export declare const JoystickInner: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
16
+ export declare const RangeSelector: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
17
+ ref?: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLInputElement> | null | undefined;
18
+ }>, never>, {
19
+ $reverse: boolean;
20
+ }>> & string;
21
+ export declare const KeyBlockContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
22
+ $reverse: boolean;
23
+ }>> & string;
24
+ export declare const KeyRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
25
+ $reverse: boolean;
26
+ }>> & string;
27
+ export declare const ButtonGroupColumn: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
28
+ export declare const FAIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("@fortawesome/react-fontawesome").FontAwesomeIconProps, "ref"> & {
29
+ ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
30
+ }, never>> & string & Omit<typeof FontAwesomeIcon, keyof import("react").Component<any, {}, any>>;
31
+ //# sourceMappingURL=styled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../src/components/styled.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGjE,eAAO,MAAM,MAAM;cAA6B,OAAO;YAmCtD,CAAC;AAEF,eAAO,MAAM,cAAc;cAA0B,OAAO;YAc3D,CAAC;AAEF,eAAO,MAAM,eAAe;cAA0B,OAAO;YAO5D,CAAC;AAEF,eAAO,MAAM,WAAW;cAA0B,OAAO;YAMxD,CAAC;AAEF,eAAO,MAAM,cAAc,yOAe1B,CAAC;AAEF,eAAO,MAAM,aAAa,6NAQzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;cACf,OAAO;YAoCjB,CAAC;AAEF,eAAO,MAAM,iBAAiB;cAA0B,OAAO;YAM9D,CAAC;AAEF,eAAO,MAAM,MAAM;cAA0B,OAAO;YAKnD,CAAC;AAEF,eAAO,MAAM,iBAAiB,6NAK7B,CAAC;AAEF,eAAO,MAAM,MAAM;;iGAOlB,CAAC"}
@@ -0,0 +1,153 @@
1
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2
+ import styled from 'styled-components';
3
+ export const Button = styled.button `
4
+ background-color: rgba(255, 255, 255, 0.3);
5
+ border: none;
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ cursor: pointer;
10
+ color: white;
11
+ border-radius: 2px;
12
+ font-size: 14px;
13
+ height: 24px;
14
+ min-width: 24px;
15
+ transition: all 0.2s ease-in-out;
16
+ margin: 0 1px;
17
+ text-transform: none;
18
+ box-shadow: none;
19
+ font-family: Arial, sans-serif;
20
+
21
+ &:hover {
22
+ background-color: rgba(255, 255, 255, 0.5);
23
+ }
24
+
25
+ &:active {
26
+ background-color: rgba(255, 255, 255, 0.6);
27
+ }
28
+
29
+ &:first-child {
30
+ border-radius: ${({ $reverse }) => $reverse ? '2px 8px 8px 2px' : '8px 2px 2px 8px'};
31
+ }
32
+
33
+ &:last-child {
34
+ border-radius: ${({ $reverse }) => $reverse ? '8px 2px 2px 8px' : '2px 8px 8px 2px'};
35
+ }
36
+ `;
37
+ export const MappedKeyBlock = styled.div `
38
+ background-color: ${({ $pressed }) => $pressed ? 'rgba(255, 255, 255, 0.6)' : 'rgba(255, 255, 255, 0.3)'};
39
+ border: none;
40
+ display: flex;
41
+ align-items: center;
42
+ justify-content: center;
43
+ color: white;
44
+ border-radius: 5px;
45
+ font-size: 14px;
46
+ font-family: Arial, sans-serif;
47
+ height: 20px;
48
+ width: 20px;
49
+ transition: all 0.2s ease-in-out;
50
+ `;
51
+ export const ButtonContainer = styled.div `
52
+ display: flex;
53
+ align-items: center;
54
+ height: 24px;
55
+ margin-bottom: 2px;
56
+ justify-content: flex-start;
57
+ flex-direction: ${({ $reverse }) => ($reverse ? 'row-reverse' : 'row')};
58
+ `;
59
+ export const ButtonGroup = styled.div `
60
+ display: flex;
61
+ flex-direction: ${({ $reverse }) => ($reverse ? 'row-reverse' : 'row')};
62
+ height: 100%;
63
+ justify-content: space-between;
64
+ align-items: center;
65
+ `;
66
+ export const JoystickButton = styled.button `
67
+ background-color: rgba(255, 255, 255, 0.3);
68
+ border: none;
69
+ display: flex;
70
+ justify-content: center;
71
+ align-items: center;
72
+ padding: 0;
73
+ pointer-events: none;
74
+ width: 50px;
75
+ height: 50px;
76
+ border-radius: 50%;
77
+ position: relative;
78
+ margin: 0 5px;
79
+ backdrop-filter: blur(10px);
80
+ -webkit-backdrop-filter: blur(10px);
81
+ `;
82
+ export const JoystickInner = styled.div `
83
+ position: absolute;
84
+ background-color: white;
85
+ border-radius: 50%;
86
+ width: 36px;
87
+ height: 36px;
88
+ cursor: pointer;
89
+ pointer-events: auto;
90
+ `;
91
+ export const RangeSelector = styled.input.attrs({ type: 'range' }) `
92
+ -webkit-appearance: none;
93
+ appearance: none;
94
+ background-color: rgba(255, 255, 255, 0.3);
95
+ border: none;
96
+ height: 100%;
97
+ width: 49px;
98
+ cursor: pointer;
99
+ margin: 0 1px;
100
+ transition: all 0.2s ease-in-out;
101
+ border-radius: ${({ $reverse }) => $reverse ? '8px 2px 2px 8px' : '2px 8px 8px 2px'};
102
+
103
+ &::-webkit-slider-thumb {
104
+ -webkit-appearance: none;
105
+ appearance: none;
106
+ width: 8px;
107
+ height: 24px;
108
+ background-color: white;
109
+ border-radius: 3px;
110
+ }
111
+
112
+ &::-moz-range-thumb {
113
+ width: 8px;
114
+ height: 24px;
115
+ background-color: white;
116
+ border-radius: 3px;
117
+ }
118
+
119
+ &::-ms-thumb {
120
+ width: 8px;
121
+ height: 24px;
122
+ background-color: white;
123
+ border-radius: 3px;
124
+ }
125
+ `;
126
+ export const KeyBlockContainer = styled.div `
127
+ display: flex;
128
+ flex-direction: column;
129
+ align-items: ${({ $reverse }) => ($reverse ? 'flex-start' : 'flex-end')};
130
+ justify-content: center;
131
+ margin: ${({ $reverse }) => ($reverse ? '2px -26px 0 0' : '2px 0 0 -26px')};
132
+ `;
133
+ export const KeyRow = styled.div `
134
+ display: flex;
135
+ flex-direction: ${({ $reverse }) => ($reverse ? 'row-reverse' : 'row')};
136
+ align-items: center;
137
+ justify-content: center;
138
+ `;
139
+ export const ButtonGroupColumn = styled.div `
140
+ display: flex;
141
+ flex-direction: column;
142
+ height: 50px;
143
+ justify-content: space-between;
144
+ `;
145
+ export const FAIcon = styled(FontAwesomeIcon) `
146
+ height: 14px;
147
+ min-height: 14px;
148
+ max-height: 14px;
149
+ width: 14px;
150
+ min-width: 14px;
151
+ max-width: 14px;
152
+ `;
153
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styled.js","sourceRoot":"","sources":["../../src/components/styled.tsx"],"names":[],"mappings":"AAAA,OA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KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAEhE;;;;;;;;;;kBAUgB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CACjC,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;CAwBjD,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAuB;;;gBAGlD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;;WAE7D,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;CAC1E,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAuB;;mBAEpC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC;;;CAGtE,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAK1C,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,CAAA;;;;;;;CAO5C,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { InputLayer } from './scene.js';
2
+ import { XRDevice } from 'iwer';
3
+ declare const PRIVATE: unique symbol;
4
+ export declare class DevUI {
5
+ [PRIVATE]: {
6
+ xrDevice: XRDevice;
7
+ inputLayer: InputLayer;
8
+ };
9
+ constructor(xrDevice: XRDevice);
10
+ }
11
+ export {};
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAGhC,QAAA,MAAM,OAAO,eAA+B,CAAC;AAE7C,qBAAa,KAAK;IACjB,CAAC,OAAO,CAAC,EAAE;QACV,QAAQ,EAAE,QAAQ,CAAC;QACnB,UAAU,EAAE,UAAU,CAAC;KACvB,CAAC;gBAEU,QAAQ,EAAE,QAAQ;CAgC9B"}