@fps-games/editor 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 (186) hide show
  1. package/dist/authoring-apply.d.ts +21 -0
  2. package/dist/authoring-apply.d.ts.map +1 -0
  3. package/dist/authoring-apply.js +45 -0
  4. package/dist/authoring-apply.js.map +1 -0
  5. package/dist/index.d.ts +85 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +539 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/local-editor-harness.d.ts +173 -0
  10. package/dist/local-editor-harness.d.ts.map +1 -0
  11. package/dist/local-editor-harness.js +969 -0
  12. package/dist/local-editor-harness.js.map +1 -0
  13. package/node_modules/@fps-games/editor-babylon/dist/camera-controller.d.ts +20 -0
  14. package/node_modules/@fps-games/editor-babylon/dist/camera-controller.d.ts.map +1 -0
  15. package/node_modules/@fps-games/editor-babylon/dist/camera-controller.js +239 -0
  16. package/node_modules/@fps-games/editor-babylon/dist/camera-controller.js.map +1 -0
  17. package/node_modules/@fps-games/editor-babylon/dist/edit-session.d.ts +30 -0
  18. package/node_modules/@fps-games/editor-babylon/dist/edit-session.d.ts.map +1 -0
  19. package/node_modules/@fps-games/editor-babylon/dist/edit-session.js +297 -0
  20. package/node_modules/@fps-games/editor-babylon/dist/edit-session.js.map +1 -0
  21. package/node_modules/@fps-games/editor-babylon/dist/editor-world.d.ts +30 -0
  22. package/node_modules/@fps-games/editor-babylon/dist/editor-world.d.ts.map +1 -0
  23. package/node_modules/@fps-games/editor-babylon/dist/editor-world.js +67 -0
  24. package/node_modules/@fps-games/editor-babylon/dist/editor-world.js.map +1 -0
  25. package/node_modules/@fps-games/editor-babylon/dist/event-guard.d.ts +13 -0
  26. package/node_modules/@fps-games/editor-babylon/dist/event-guard.d.ts.map +1 -0
  27. package/node_modules/@fps-games/editor-babylon/dist/event-guard.js +101 -0
  28. package/node_modules/@fps-games/editor-babylon/dist/event-guard.js.map +1 -0
  29. package/node_modules/@fps-games/editor-babylon/dist/index.d.ts +19 -0
  30. package/node_modules/@fps-games/editor-babylon/dist/index.d.ts.map +1 -0
  31. package/node_modules/@fps-games/editor-babylon/dist/index.js +18 -0
  32. package/node_modules/@fps-games/editor-babylon/dist/index.js.map +1 -0
  33. package/node_modules/@fps-games/editor-babylon/dist/input-controller.d.ts +3 -0
  34. package/node_modules/@fps-games/editor-babylon/dist/input-controller.d.ts.map +1 -0
  35. package/node_modules/@fps-games/editor-babylon/dist/input-controller.js +182 -0
  36. package/node_modules/@fps-games/editor-babylon/dist/input-controller.js.map +1 -0
  37. package/node_modules/@fps-games/editor-babylon/dist/inspector-adapter.d.ts +13 -0
  38. package/node_modules/@fps-games/editor-babylon/dist/inspector-adapter.d.ts.map +1 -0
  39. package/node_modules/@fps-games/editor-babylon/dist/inspector-adapter.js +94 -0
  40. package/node_modules/@fps-games/editor-babylon/dist/inspector-adapter.js.map +1 -0
  41. package/node_modules/@fps-games/editor-babylon/dist/inspector-host.d.ts +43 -0
  42. package/node_modules/@fps-games/editor-babylon/dist/inspector-host.d.ts.map +1 -0
  43. package/node_modules/@fps-games/editor-babylon/dist/inspector-host.js +510 -0
  44. package/node_modules/@fps-games/editor-babylon/dist/inspector-host.js.map +1 -0
  45. package/node_modules/@fps-games/editor-babylon/dist/legacy-runtime.d.ts +5 -0
  46. package/node_modules/@fps-games/editor-babylon/dist/legacy-runtime.d.ts.map +1 -0
  47. package/node_modules/@fps-games/editor-babylon/dist/legacy-runtime.js +5 -0
  48. package/node_modules/@fps-games/editor-babylon/dist/legacy-runtime.js.map +1 -0
  49. package/node_modules/@fps-games/editor-babylon/dist/material-property-adapter.d.ts +22 -0
  50. package/node_modules/@fps-games/editor-babylon/dist/material-property-adapter.d.ts.map +1 -0
  51. package/node_modules/@fps-games/editor-babylon/dist/material-property-adapter.js +408 -0
  52. package/node_modules/@fps-games/editor-babylon/dist/material-property-adapter.js.map +1 -0
  53. package/node_modules/@fps-games/editor-babylon/dist/monitor.d.ts +39 -0
  54. package/node_modules/@fps-games/editor-babylon/dist/monitor.d.ts.map +1 -0
  55. package/node_modules/@fps-games/editor-babylon/dist/monitor.js +780 -0
  56. package/node_modules/@fps-games/editor-babylon/dist/monitor.js.map +1 -0
  57. package/node_modules/@fps-games/editor-babylon/dist/outline-adapter.d.ts +37 -0
  58. package/node_modules/@fps-games/editor-babylon/dist/outline-adapter.d.ts.map +1 -0
  59. package/node_modules/@fps-games/editor-babylon/dist/outline-adapter.js +268 -0
  60. package/node_modules/@fps-games/editor-babylon/dist/outline-adapter.js.map +1 -0
  61. package/node_modules/@fps-games/editor-babylon/dist/projection-selection-controller.d.ts +34 -0
  62. package/node_modules/@fps-games/editor-babylon/dist/projection-selection-controller.d.ts.map +1 -0
  63. package/node_modules/@fps-games/editor-babylon/dist/projection-selection-controller.js +221 -0
  64. package/node_modules/@fps-games/editor-babylon/dist/projection-selection-controller.js.map +1 -0
  65. package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +90 -0
  66. package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -0
  67. package/node_modules/@fps-games/editor-babylon/dist/projection.js +479 -0
  68. package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -0
  69. package/node_modules/@fps-games/editor-babylon/dist/runtime-globals.d.ts +3 -0
  70. package/node_modules/@fps-games/editor-babylon/dist/runtime-globals.d.ts.map +1 -0
  71. package/node_modules/@fps-games/editor-babylon/dist/runtime-globals.js +7 -0
  72. package/node_modules/@fps-games/editor-babylon/dist/runtime-globals.js.map +1 -0
  73. package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.d.ts +18 -0
  74. package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.d.ts.map +1 -0
  75. package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.js +213 -0
  76. package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.js.map +1 -0
  77. package/node_modules/@fps-games/editor-babylon/dist/scene-view-input-controller.d.ts +36 -0
  78. package/node_modules/@fps-games/editor-babylon/dist/scene-view-input-controller.d.ts.map +1 -0
  79. package/node_modules/@fps-games/editor-babylon/dist/scene-view-input-controller.js +272 -0
  80. package/node_modules/@fps-games/editor-babylon/dist/scene-view-input-controller.js.map +1 -0
  81. package/node_modules/@fps-games/editor-babylon/dist/selection-controller.d.ts +27 -0
  82. package/node_modules/@fps-games/editor-babylon/dist/selection-controller.d.ts.map +1 -0
  83. package/node_modules/@fps-games/editor-babylon/dist/selection-controller.js +308 -0
  84. package/node_modules/@fps-games/editor-babylon/dist/selection-controller.js.map +1 -0
  85. package/node_modules/@fps-games/editor-babylon/dist/tool-controller.d.ts +17 -0
  86. package/node_modules/@fps-games/editor-babylon/dist/tool-controller.d.ts.map +1 -0
  87. package/node_modules/@fps-games/editor-babylon/dist/tool-controller.js +83 -0
  88. package/node_modules/@fps-games/editor-babylon/dist/tool-controller.js.map +1 -0
  89. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts +47 -0
  90. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts.map +1 -0
  91. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js +689 -0
  92. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js.map +1 -0
  93. package/node_modules/@fps-games/editor-babylon/dist/types.d.ts +111 -0
  94. package/node_modules/@fps-games/editor-babylon/dist/types.d.ts.map +1 -0
  95. package/node_modules/@fps-games/editor-babylon/dist/types.js +2 -0
  96. package/node_modules/@fps-games/editor-babylon/dist/types.js.map +1 -0
  97. package/node_modules/@fps-games/editor-babylon/package.json +25 -0
  98. package/node_modules/@fps-games/editor-browser/dist/index.d.ts +28 -0
  99. package/node_modules/@fps-games/editor-browser/dist/index.d.ts.map +1 -0
  100. package/node_modules/@fps-games/editor-browser/dist/index.js +54 -0
  101. package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -0
  102. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-input-router.d.ts +12 -0
  103. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-input-router.d.ts.map +1 -0
  104. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-input-router.js +80 -0
  105. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-input-router.js.map +1 -0
  106. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panel-registry.d.ts +11 -0
  107. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panel-registry.d.ts.map +1 -0
  108. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panel-registry.js +33 -0
  109. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panel-registry.js.map +1 -0
  110. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts +9 -0
  111. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts.map +1 -0
  112. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js +444 -0
  113. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js.map +1 -0
  114. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.d.ts +21 -0
  115. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.d.ts.map +1 -0
  116. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.js +103 -0
  117. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.js.map +1 -0
  118. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shared.d.ts +12 -0
  119. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shared.d.ts.map +1 -0
  120. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shared.js +123 -0
  121. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shared.js.map +1 -0
  122. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shortcuts.d.ts +2 -0
  123. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shortcuts.d.ts.map +1 -0
  124. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shortcuts.js +115 -0
  125. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shortcuts.js.map +1 -0
  126. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-theme.d.ts +3 -0
  127. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-theme.d.ts.map +1 -0
  128. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-theme.js +68 -0
  129. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-theme.js.map +1 -0
  130. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts +183 -0
  131. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts.map +1 -0
  132. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.js +2 -0
  133. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.js.map +1 -0
  134. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts +58 -0
  135. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts.map +1 -0
  136. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js +136 -0
  137. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js.map +1 -0
  138. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts +4 -0
  139. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts.map +1 -0
  140. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js +589 -0
  141. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -0
  142. package/node_modules/@fps-games/editor-browser/package.json +16 -0
  143. package/node_modules/@fps-games/editor-core/dist/authoring-source.d.ts +211 -0
  144. package/node_modules/@fps-games/editor-core/dist/authoring-source.d.ts.map +1 -0
  145. package/node_modules/@fps-games/editor-core/dist/authoring-source.js +511 -0
  146. package/node_modules/@fps-games/editor-core/dist/authoring-source.js.map +1 -0
  147. package/node_modules/@fps-games/editor-core/dist/editor-session.d.ts +132 -0
  148. package/node_modules/@fps-games/editor-core/dist/editor-session.d.ts.map +1 -0
  149. package/node_modules/@fps-games/editor-core/dist/editor-session.js +265 -0
  150. package/node_modules/@fps-games/editor-core/dist/editor-session.js.map +1 -0
  151. package/node_modules/@fps-games/editor-core/dist/host-services.d.ts +24 -0
  152. package/node_modules/@fps-games/editor-core/dist/host-services.d.ts.map +1 -0
  153. package/node_modules/@fps-games/editor-core/dist/host-services.js +2 -0
  154. package/node_modules/@fps-games/editor-core/dist/host-services.js.map +1 -0
  155. package/node_modules/@fps-games/editor-core/dist/index.d.ts +106 -0
  156. package/node_modules/@fps-games/editor-core/dist/index.d.ts.map +1 -0
  157. package/node_modules/@fps-games/editor-core/dist/index.js +217 -0
  158. package/node_modules/@fps-games/editor-core/dist/index.js.map +1 -0
  159. package/node_modules/@fps-games/editor-core/dist/scene-graph.d.ts +44 -0
  160. package/node_modules/@fps-games/editor-core/dist/scene-graph.d.ts.map +1 -0
  161. package/node_modules/@fps-games/editor-core/dist/scene-graph.js +86 -0
  162. package/node_modules/@fps-games/editor-core/dist/scene-graph.js.map +1 -0
  163. package/node_modules/@fps-games/editor-core/dist/scene-view-input.d.ts +41 -0
  164. package/node_modules/@fps-games/editor-core/dist/scene-view-input.d.ts.map +1 -0
  165. package/node_modules/@fps-games/editor-core/dist/scene-view-input.js +2 -0
  166. package/node_modules/@fps-games/editor-core/dist/scene-view-input.js.map +1 -0
  167. package/node_modules/@fps-games/editor-core/dist/serialized-object.d.ts +53 -0
  168. package/node_modules/@fps-games/editor-core/dist/serialized-object.d.ts.map +1 -0
  169. package/node_modules/@fps-games/editor-core/dist/serialized-object.js +32 -0
  170. package/node_modules/@fps-games/editor-core/dist/serialized-object.js.map +1 -0
  171. package/node_modules/@fps-games/editor-core/dist/transform-gizmo.d.ts +48 -0
  172. package/node_modules/@fps-games/editor-core/dist/transform-gizmo.d.ts.map +1 -0
  173. package/node_modules/@fps-games/editor-core/dist/transform-gizmo.js +2 -0
  174. package/node_modules/@fps-games/editor-core/dist/transform-gizmo.js.map +1 -0
  175. package/node_modules/@fps-games/editor-core/package.json +19 -0
  176. package/node_modules/@fps-games/editor-forge-play/dist/index.d.ts +46 -0
  177. package/node_modules/@fps-games/editor-forge-play/dist/index.d.ts.map +1 -0
  178. package/node_modules/@fps-games/editor-forge-play/dist/index.js +156 -0
  179. package/node_modules/@fps-games/editor-forge-play/dist/index.js.map +1 -0
  180. package/node_modules/@fps-games/editor-forge-play/package.json +19 -0
  181. package/node_modules/@fps-games/editor-protocol/dist/index.d.ts +239 -0
  182. package/node_modules/@fps-games/editor-protocol/dist/index.d.ts.map +1 -0
  183. package/node_modules/@fps-games/editor-protocol/dist/index.js +54 -0
  184. package/node_modules/@fps-games/editor-protocol/dist/index.js.map +1 -0
  185. package/node_modules/@fps-games/editor-protocol/package.json +16 -0
  186. package/package.json +40 -0
@@ -0,0 +1,182 @@
1
+ import { createBrowserHost } from '@fps-games/editor-browser';
2
+ const TOOL_KEYS = {
3
+ q: 'pick',
4
+ w: 'move',
5
+ e: 'rotate',
6
+ r: 'scale',
7
+ };
8
+ const VIEWPORT_MOVE_KEYS = new Set(['w', 'a', 's', 'd', 'q', 'e']);
9
+ const VIEWPORT_DRAG_THRESHOLD_PX = 4;
10
+ function isHostHTMLElement(target, win) {
11
+ const ElementCtor = win.HTMLElement ?? HTMLElement;
12
+ return typeof ElementCtor === 'function' && target instanceof ElementCtor;
13
+ }
14
+ function isTextEditingTarget(target, win) {
15
+ const el = isHostHTMLElement(target, win) ? target : null;
16
+ if (!el)
17
+ return false;
18
+ const tag = el.tagName;
19
+ return tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' || el.isContentEditable;
20
+ }
21
+ function navigationButtonFromPointer(button) {
22
+ if (button === 0)
23
+ return 'left';
24
+ if (button === 1)
25
+ return 'middle';
26
+ if (button === 2)
27
+ return 'right';
28
+ return null;
29
+ }
30
+ export function createEditorInputController() {
31
+ let options = null;
32
+ let initialized = false;
33
+ let viewportNavigationActive = false;
34
+ let viewportNavigationButton = null;
35
+ let viewportPointerStart = null;
36
+ let lastViewportPointer = null;
37
+ let viewportPointerDragActive = false;
38
+ const viewportPointerDelta = { dx: 0, dy: 0 };
39
+ const pressedViewportKeys = new Set();
40
+ const disposers = [];
41
+ function resetViewportNavigation() {
42
+ viewportNavigationActive = false;
43
+ viewportNavigationButton = null;
44
+ viewportPointerStart = null;
45
+ lastViewportPointer = null;
46
+ viewportPointerDragActive = false;
47
+ viewportPointerDelta.dx = 0;
48
+ viewportPointerDelta.dy = 0;
49
+ pressedViewportKeys.clear();
50
+ }
51
+ const api = {
52
+ init(nextOptions) {
53
+ api.dispose();
54
+ options = nextOptions;
55
+ const host = nextOptions.host ?? createBrowserHost();
56
+ const onKeyDown = (event) => {
57
+ if (!options?.isEditActive())
58
+ return;
59
+ if (isTextEditingTarget(event.target, host.window))
60
+ return;
61
+ const key = event.key.toLowerCase();
62
+ const primaryModifier = event.ctrlKey || event.metaKey;
63
+ if (primaryModifier && !event.altKey && key === 'z') {
64
+ event.preventDefault();
65
+ if (event.shiftKey)
66
+ options.onRedo?.();
67
+ else
68
+ options.onUndo?.();
69
+ return;
70
+ }
71
+ if (primaryModifier && !event.altKey && !event.shiftKey && key === 'd') {
72
+ event.preventDefault();
73
+ void options.onDuplicateSelected?.();
74
+ return;
75
+ }
76
+ if (!event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey && key === 'f') {
77
+ event.preventDefault();
78
+ options.onFocusSelected();
79
+ return;
80
+ }
81
+ if (viewportNavigationActive && VIEWPORT_MOVE_KEYS.has(key)) {
82
+ pressedViewportKeys.add(key);
83
+ event.preventDefault();
84
+ return;
85
+ }
86
+ if (viewportNavigationActive)
87
+ return;
88
+ if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey)
89
+ return;
90
+ const tool = TOOL_KEYS[key];
91
+ if (!tool)
92
+ return;
93
+ event.preventDefault();
94
+ options.onSetTool(tool);
95
+ };
96
+ const onKeyUp = (event) => {
97
+ if (!options?.isEditActive())
98
+ return;
99
+ pressedViewportKeys.delete(event.key.toLowerCase());
100
+ };
101
+ const onPointerDown = (event) => {
102
+ if (!options?.isEditActive())
103
+ return;
104
+ const canvas = options.getCanvas();
105
+ if (!canvas)
106
+ return;
107
+ const navButton = navigationButtonFromPointer(event.button);
108
+ if (event.target === canvas && navButton && navButton !== 'left') {
109
+ viewportNavigationActive = true;
110
+ viewportNavigationButton = navButton;
111
+ viewportPointerStart = { x: event.clientX, y: event.clientY };
112
+ lastViewportPointer = { x: event.clientX, y: event.clientY };
113
+ viewportPointerDragActive = false;
114
+ }
115
+ };
116
+ const onPointerMove = (event) => {
117
+ if (!options?.isEditActive())
118
+ return;
119
+ if (!viewportNavigationActive || !viewportNavigationButton)
120
+ return;
121
+ if (!lastViewportPointer) {
122
+ lastViewportPointer = { x: event.clientX, y: event.clientY };
123
+ return;
124
+ }
125
+ const dx = event.clientX - lastViewportPointer.x;
126
+ const dy = event.clientY - lastViewportPointer.y;
127
+ if ((viewportNavigationButton === 'left' || viewportNavigationButton === 'middle') && !viewportPointerDragActive) {
128
+ const start = viewportPointerStart || lastViewportPointer;
129
+ const totalDx = event.clientX - start.x;
130
+ const totalDy = event.clientY - start.y;
131
+ if (Math.hypot(totalDx, totalDy) < VIEWPORT_DRAG_THRESHOLD_PX) {
132
+ lastViewportPointer = { x: event.clientX, y: event.clientY };
133
+ return;
134
+ }
135
+ viewportPointerDragActive = true;
136
+ lastViewportPointer = { x: event.clientX, y: event.clientY };
137
+ return;
138
+ }
139
+ viewportPointerDelta.dx += dx;
140
+ viewportPointerDelta.dy += dy;
141
+ lastViewportPointer = { x: event.clientX, y: event.clientY };
142
+ };
143
+ const onPointerUp = (event) => {
144
+ if (!options?.isEditActive())
145
+ return;
146
+ const navButton = navigationButtonFromPointer(event.button);
147
+ if (!navButton || navButton !== viewportNavigationButton)
148
+ return;
149
+ resetViewportNavigation();
150
+ };
151
+ disposers.push(host.addWindowEvent('keydown', onKeyDown), host.addWindowEvent('keyup', onKeyUp), host.addWindowEvent('pointerdown', onPointerDown, true), host.addWindowEvent('pointermove', onPointerMove, true), host.addWindowEvent('pointerup', onPointerUp, true), host.addWindowEvent('blur', resetViewportNavigation));
152
+ initialized = true;
153
+ },
154
+ dispose() {
155
+ if (!initialized)
156
+ return;
157
+ while (disposers.length)
158
+ disposers.pop()?.();
159
+ initialized = false;
160
+ options = null;
161
+ resetViewportNavigation();
162
+ },
163
+ isViewportNavigationActive() {
164
+ return viewportNavigationActive;
165
+ },
166
+ activeViewportNavigationButton() {
167
+ return viewportNavigationButton;
168
+ },
169
+ consumeViewportPointerDelta() {
170
+ const delta = { ...viewportPointerDelta };
171
+ viewportPointerDelta.dx = 0;
172
+ viewportPointerDelta.dy = 0;
173
+ return delta;
174
+ },
175
+ pressedViewportMovementKeys() {
176
+ return pressedViewportKeys;
177
+ },
178
+ resetViewportNavigation,
179
+ };
180
+ return api;
181
+ }
182
+ //# sourceMappingURL=input-controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-controller.js","sourceRoot":"","sources":["../src/input-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAI9D,MAAM,SAAS,GAA+B;IAC5C,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,OAAO;CACX,CAAC;AAEF,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AACnE,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAErC,SAAS,iBAAiB,CAAC,MAA0B,EAAE,GAAW;IAChE,MAAM,WAAW,GAAI,GAAkC,CAAC,WAAW,IAAI,WAAW,CAAC;IACnF,OAAO,OAAO,WAAW,KAAK,UAAU,IAAI,MAAM,YAAY,WAAW,CAAC;AAC5E,CAAC;AAED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AW,EAAE,IAAI,CAAC,EACnD,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,uBAAuB,CAAC,CACrD,CAAC;YACF,WAAW,GAAG,IAAI,CAAC;QACrB,CAAC;QAED,OAAO;YACL,IAAI,CAAC,WAAW;gBAAE,OAAO;YACzB,OAAO,SAAS,CAAC,MAAM;gBAAE,SAAS,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC;YAC7C,WAAW,GAAG,KAAK,CAAC;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,uBAAuB,EAAE,CAAC;QAC5B,CAAC;QAED,0BAA0B;YACxB,OAAO,wBAAwB,CAAC;QAClC,CAAC;QAED,8BAA8B;YAC5B,OAAO,wBAAwB,CAAC;QAClC,CAAC;QAED,2BAA2B;YACzB,MAAM,KAAK,GAAG,EAAE,GAAG,oBAAoB,EAAE,CAAC;YAC1C,oBAAoB,CAAC,EAAE,GAAG,CAAC,CAAC;YAC5B,oBAAoB,CAAC,EAAE,GAAG,CAAC,CAAC;YAC5B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,2BAA2B;YACzB,OAAO,mBAAmB,CAAC;QAC7B,CAAC;QAED,uBAAuB;KACxB,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { BrowserHost } from '@fps-games/editor-browser';
2
+ import type { EditorTool } from '@fps-games/editor-protocol';
3
+ export type InspectorTransformTool = Exclude<EditorTool, 'pick'>;
4
+ export interface InspectorAdapterOptions {
5
+ host?: BrowserHost;
6
+ }
7
+ export declare function getInspectorContainer(host?: BrowserHost): HTMLElement | null;
8
+ export declare function readInspectorButtonLabel(button: HTMLButtonElement, host?: BrowserHost): string;
9
+ export declare function findInspectorTransformButtons(container?: HTMLElement | null, host?: BrowserHost): Map<InspectorTransformTool, HTMLButtonElement> | null;
10
+ export declare function setInspectorPicking(enabled: boolean, container?: HTMLElement | null): boolean;
11
+ export declare function isPickingToggleButton(button: HTMLButtonElement): 'enable' | 'disable' | null;
12
+ export declare function syncInspectorToolState(tool: EditorTool, container?: HTMLElement | null, host?: BrowserHost): boolean;
13
+ //# sourceMappingURL=inspector-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspector-adapter.d.ts","sourceRoot":"","sources":["../src/inspector-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAEjE,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAOD,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAK5E;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,CAsB9F;AAED,wBAAgB,6BAA6B,CAAC,SAAS,qBAA0B,EAAE,IAAI,CAAC,EAAE,WAAW,yDAapG;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,qBAA0B,GAAG,OAAO,CASlG;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAK5F;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,qBAA0B,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAkBzH"}
@@ -0,0 +1,94 @@
1
+ function getDocument(host) {
2
+ if (host)
3
+ return host.document;
4
+ return typeof document === 'undefined' ? null : document;
5
+ }
6
+ export function getInspectorContainer(host) {
7
+ const doc = getDocument(host);
8
+ if (!doc)
9
+ return null;
10
+ return doc.getElementById('babylon-inspector-container')
11
+ || doc.querySelector('#inspector-host, #babylon-inspector-container');
12
+ }
13
+ export function readInspectorButtonLabel(button, host) {
14
+ const doc = getDocument(host) ?? button.ownerDocument;
15
+ const describedById = button.getAttribute('aria-describedby');
16
+ const describedByText = describedById ? doc?.getElementById(describedById)?.textContent : null;
17
+ const container = button.closest('[title], [aria-label], [aria-description], [description]');
18
+ const values = [
19
+ button.getAttribute('title'),
20
+ button.getAttribute('aria-label'),
21
+ button.getAttribute('aria-description'),
22
+ button.getAttribute('description'),
23
+ describedByText,
24
+ button.textContent,
25
+ button.parentElement?.getAttribute('title'),
26
+ button.parentElement?.getAttribute('aria-label'),
27
+ button.parentElement?.getAttribute('aria-description'),
28
+ button.parentElement?.getAttribute('description'),
29
+ container?.getAttribute('title'),
30
+ container?.getAttribute('aria-label'),
31
+ container?.getAttribute('aria-description'),
32
+ container?.getAttribute('description'),
33
+ ];
34
+ return values.filter(Boolean).join(' ').toLowerCase();
35
+ }
36
+ export function findInspectorTransformButtons(container = getInspectorContainer(), host) {
37
+ if (!container)
38
+ return null;
39
+ const buttons = Array.from(container.querySelectorAll('button[aria-pressed], button'));
40
+ const map = new Map();
41
+ for (const button of buttons) {
42
+ const label = readInspectorButtonLabel(button, host);
43
+ if (!label)
44
+ continue;
45
+ if (!map.has('move') && label.includes('translate'))
46
+ map.set('move', button);
47
+ else if (!map.has('rotate') && label.includes('rotate'))
48
+ map.set('rotate', button);
49
+ else if (!map.has('scale') && label.includes('scale'))
50
+ map.set('scale', button);
51
+ if (map.size === 3)
52
+ break;
53
+ }
54
+ return map;
55
+ }
56
+ export function setInspectorPicking(enabled, container = getInspectorContainer()) {
57
+ if (!container)
58
+ return false;
59
+ const targetLabel = (enabled ? 'enable picking' : 'disable picking').toLowerCase();
60
+ const button = Array.from(container.querySelectorAll('button')).find((candidate) => readInspectorButtonLabel(candidate).includes(targetLabel));
61
+ if (!button)
62
+ return false;
63
+ button.click();
64
+ return true;
65
+ }
66
+ export function isPickingToggleButton(button) {
67
+ const label = readInspectorButtonLabel(button);
68
+ if (label.includes('enable picking'))
69
+ return 'enable';
70
+ if (label.includes('disable picking'))
71
+ return 'disable';
72
+ return null;
73
+ }
74
+ export function syncInspectorToolState(tool, container = getInspectorContainer(), host) {
75
+ const buttons = findInspectorTransformButtons(container, host);
76
+ if (!buttons)
77
+ return false;
78
+ if (tool === 'pick') {
79
+ for (const button of buttons.values()) {
80
+ if (button.getAttribute('aria-pressed') === 'true') {
81
+ button.click();
82
+ return true;
83
+ }
84
+ }
85
+ return true;
86
+ }
87
+ const targetButton = buttons.get(tool);
88
+ if (!targetButton)
89
+ return false;
90
+ if (targetButton.getAttribute('aria-pressed') !== 'true')
91
+ targetButton.click();
92
+ return true;
93
+ }
94
+ //# sourceMappingURL=inspector-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspector-adapter.js","sourceRoot":"","sources":["../src/inspector-adapter.ts"],"names":[],"mappings":"AASA,SAAS,WAAW,CAAC,IAAkB;IACrC,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC,QAAQ,CAAC;IAC/B,OAAO,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAkB;IACtD,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,OAAO,GAAG,CAAC,cAAc,CAAC,6BAA6B,CAAC;WACnD,GAAG,CAAC,aAAa,CAAC,+CAA+C,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,MAAyB,EAAE,IAAkB;IACpF,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,aAAa,CAAC;IACtD,MAAM,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAC9D,MAAM,eAAe,GAAG,a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IACf,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAyB;IAC7D,MAAM,KAAK,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAI,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAAE,OAAO,QAAQ,CAAC;IACtD,IAAI,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAAE,OAAO,SAAS,CAAC;IACxD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,IAAgB,EAAE,SAAS,GAAG,qBAAqB,EAAE,EAAE,IAAkB;IAC9G,MAAM,OAAO,GAAG,6BAA6B,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC/D,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAE3B,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YACtC,IAAI,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,MAAM,EAAE,CAAC;gBACnD,MAAM,CAAC,KAAK,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,IAA8B,CAAC,CAAC;IACjE,IAAI,CAAC,YAAY;QAAE,OAAO,KAAK,CAAC;IAChC,IAAI,YAAY,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,MAAM;QAAE,YAAY,CAAC,KAAK,EAAE,CAAC;IAC/E,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { type BrowserHost } from '@fps-games/editor-browser';
2
+ import type { EditorTool, SelectionController } from '@fps-games/editor-protocol';
3
+ import type { BabylonRuntimeGlobal, CanonicalMaterialChange, RuntimeScene } from './types';
4
+ type InspectorToken = {
5
+ dispose(): void;
6
+ isDisposed?: boolean;
7
+ } | null;
8
+ export type InspectorV2 = {
9
+ ShowInspector?: (scene: RuntimeScene, options?: Record<string, unknown>) => InspectorToken;
10
+ ConvertOptions?: (options: Record<string, unknown>) => Record<string, unknown>;
11
+ SelectionServiceIdentity?: unknown;
12
+ Inspector?: {
13
+ OnPropertyChangedObservable?: {
14
+ add?: (handler: (event: unknown) => void) => unknown;
15
+ remove?: (observer: unknown) => void;
16
+ };
17
+ };
18
+ };
19
+ export interface EditorInspectorHostOptions {
20
+ host?: BrowserHost;
21
+ babylon?: BabylonRuntimeGlobal | null;
22
+ inspectorUrl?: string;
23
+ getScene: () => RuntimeScene | null;
24
+ getSelectionController: () => SelectionController | null;
25
+ getSelectedEntity: () => unknown | null;
26
+ getCurrentTool?: () => EditorTool;
27
+ resolveBinding?: (node: unknown) => any | null;
28
+ onMaterialPropertyChanged?: (change: CanonicalMaterialChange) => void;
29
+ onContextSelection?: (payload: unknown) => void;
30
+ loadGizmoModules?: () => Promise<unknown[]>;
31
+ }
32
+ export interface EditorInspectorHost {
33
+ init(nextScene: RuntimeScene | null): void;
34
+ show(): Promise<void>;
35
+ hide(): void;
36
+ isVisible(): boolean;
37
+ syncTool(tool: EditorTool): void;
38
+ tuneOutlineLayer(): void;
39
+ }
40
+ export declare function createEditorInspectorHost(options: EditorInspectorHostOptions): EditorInspectorHost;
41
+ export declare function setInspectorPickingState(enabled: boolean, host?: BrowserHost): boolean;
42
+ export {};
43
+ //# sourceMappingURL=inspector-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspector-host.d.ts","sourceRoot":"","sources":["../src/inspector-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAKlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,uBAAuB,EAAE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