@3dsource/angular-unreal-module 0.0.181 → 0.0.183

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.
@@ -281,15 +281,6 @@ const OrchestrationMessageTypes = {
281
281
  interruptClientStream: 'interruptClientStream',
282
282
  };
283
283
 
284
- const SpecialKeyCodes = {
285
- BackSpace: 8,
286
- Shift: 16,
287
- Control: 17,
288
- Alt: 18,
289
- RightShift: 253,
290
- RightControl: 254,
291
- RightAlt: 255,
292
- };
293
284
  // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
294
285
  const MouseButton = {
295
286
  MainButton: 0, // Left button.
@@ -308,7 +299,8 @@ const MouseButtonsMask = {
308
299
  };
309
300
 
310
301
  /**
311
- * `KeyboardEvent.code` → the Windows virtual-key code Unreal expects.
302
+ * `KeyboardEvent.code` → the virtual-key code Unreal expects: Windows VK
303
+ * values, plus Pixel Streaming's own 253-255 for the right-hand modifiers.
312
304
  *
313
305
  * Only keys whose `event.keyCode` cannot be trusted belong here. The browser
314
306
  * already resolves `keyCode` correctly for everything else, so the table exists
@@ -316,34 +308,47 @@ const MouseButtonsMask = {
316
308
  * punctuation keys by ASCII — `;` as 59, `=` as 61, `-` as 173) and keys Unreal
317
309
  * numbers differently from the DOM (the right-hand modifiers, the Cmd/Win keys).
318
310
  *
319
- * The numpad is deliberately absent. A numpad key reports the same `code` in
320
- * both NumLock states but a different virtual key — `Numpad4` is 37/`VK_LEFT`
321
- * with NumLock off and 100/`VK_NUMPAD4` with it on — so any entry here would
322
- * have to commit to one state and be wrong in the other. Falling through to
323
- * `event.keyCode` is right in both. `NumpadAdd`/`Subtract`/`Multiply`/`Divide`
324
- * stay because they do not change with NumLock.
311
+ * `Pause`, `CapsLock` and the navigation block — `PageUp`, `PageDown`, `End`,
312
+ * `Home`, `Insert`, `Delete` — are the exception to that rule. The browser
313
+ * numbers them correctly, so their entries repeat the value `event.keyCode`
314
+ * already reports and change nothing at runtime; they are listed so `IKeyName`
315
+ * completes them in an editor.
325
316
  *
326
- * `SpecialKeyCodes` in `./buttons-codes` repeats seven of these entries with
327
- * the same values. The two are kept apart because both are public API; merging
328
- * them would be a breaking change.
317
+ * The NumLock-dependent numpad keys — `Numpad0`-`Numpad9`, `NumpadDecimal`,
318
+ * `NumpadEnter` — are deliberately absent. Such a key reports the same `code` in
319
+ * both NumLock states but a different virtual key: `Numpad4` is 37/`VK_LEFT`
320
+ * with NumLock off and 100/`VK_NUMPAD4` with it on. An entry here would have to
321
+ * commit to one state and be wrong in the other, and it would win over the value
322
+ * the browser resolved; falling through to `event.keyCode` is right in both.
323
+ * `NumpadAdd`/`Subtract`/`Multiply`/`Divide` stay because they do not change with
324
+ * NumLock. A key needs no entry here to be forwarded — the allow-list matches
325
+ * `event.code`, so `'Numpad4'` passed to `useKeyboardKeys()` works regardless.
329
326
  *
330
- * Values must stay unique so `InvertedKeyMap` is lossless. The `OSLeft`/
331
- * `MetaLeft` and `OSRight`/`MetaRight` pairs share a value on purpose: they are
332
- * legacy and current names for the same physical key.
327
+ * Two names may share a value — `OSLeft`/`MetaLeft` and `OSRight`/`MetaRight`
328
+ * are the legacy and current names for one physical key. Nothing reads this
329
+ * table backwards, so a shared value costs nothing.
333
330
  */
334
- const KeyboardNumericCode = {
331
+ const UnrealKeyCode = {
335
332
  Backspace: 8,
336
333
  Tab: 9,
337
334
  Enter: 13,
338
335
  ShiftLeft: 16,
339
336
  ControlLeft: 17,
340
337
  AltLeft: 18,
338
+ Pause: 19,
339
+ CapsLock: 20,
341
340
  Escape: 27,
342
341
  Space: 32,
342
+ PageUp: 33,
343
+ PageDown: 34,
344
+ End: 35,
345
+ Home: 36,
343
346
  ArrowLeft: 37,
344
347
  ArrowUp: 38,
345
348
  ArrowRight: 39,
346
349
  ArrowDown: 40,
350
+ Insert: 45,
351
+ Delete: 46,
347
352
  Digit0: 48,
348
353
  Digit1: 49,
349
354
  Digit2: 50,
@@ -449,14 +454,36 @@ const MODIFIER_KEY_CODES = new Set([
449
454
  'OSLeft',
450
455
  'OSRight',
451
456
  ]);
452
- const InvertedKeyMapValues = {};
453
- //For use for InvertedKeyMap[32] will return 'Space' and so on
454
- const InvertedKeyMap = InvertedKeyMapValues;
455
- Object.entries(KeyboardNumericCode).forEach(
456
- // @ts-expect-error @typescript-eslint/ban-ts-comment
457
- ([key, value]) => {
458
- InvertedKeyMapValues[value] = key;
459
- });
457
+ /**
458
+ * Every key this module can forward, for `InputService.useKeyboardKeys()`.
459
+ *
460
+ * The table's own names cover everything whose `code` it knows; the numpad
461
+ * digits, `NumpadDecimal` and `NumpadEnter` are left out of the table on purpose
462
+ * — a numpad key reports the same `code` in both NumLock states but a different
463
+ * virtual key — and so are reachable only by name. The allow-list is matched
464
+ * against `event.code`, which needs no entry, so naming them here is enough.
465
+ *
466
+ * Passing this list forwards the browser keys too — F1-F12, `Tab`, `Escape`,
467
+ * `Backspace`, the lock keys, `ContextMenu`, `Meta`/`OS`. With
468
+ * `suppressBrowserKeys` on, F1-F12 and `Tab` also stop reaching the browser, so
469
+ * F5 no longer reloads and F12 no longer opens devtools. Prefer a narrower list
470
+ * unless the scene really owns the whole keyboard.
471
+ */
472
+ const ALL_KEYBOARD_KEYS = [
473
+ ...Object.keys(UnrealKeyCode),
474
+ 'Numpad0',
475
+ 'Numpad1',
476
+ 'Numpad2',
477
+ 'Numpad3',
478
+ 'Numpad4',
479
+ 'Numpad5',
480
+ 'Numpad6',
481
+ 'Numpad7',
482
+ 'Numpad8',
483
+ 'Numpad9',
484
+ 'NumpadDecimal',
485
+ 'NumpadEnter',
486
+ ];
460
487
 
461
488
  const ControlScheme = {
462
489
  // A mouse can lock inside the WebRTC player, so the user can simply move the
@@ -6074,15 +6101,12 @@ class InputService extends SubService {
6074
6101
  }
6075
6102
  /**
6076
6103
  * Replaces the forwarded-key allow-list. Takes physical key names
6077
- * (`KeyboardEvent.code`) such as `'KeyW'` or `'BracketLeft'`.
6078
- *
6079
- * Legacy numeric `keyCode` values are still accepted and converted, but they
6080
- * cannot express every key: `InvertedKeyMap` is many-to-one, so 37 resolves
6081
- * to `'ArrowLeft'` and 17 to `'ControlLeft'`, and `'Numpad4'`/`'ControlRight'`
6082
- * are unreachable through the numeric form. Pass names.
6104
+ * (`KeyboardEvent.code`) such as `'KeyW'`, `'BracketLeft'` or `'Numpad4'` —
6105
+ * the same units `isKeyAllowed()` compares against, so no conversion happens
6106
+ * and a key needs no entry in `UnrealKeyCode` to be forwarded.
6083
6107
  */
6084
6108
  useKeyboardKeys(keys) {
6085
- this.availableKeys = new Set(keys.map((key) => (typeof key === 'number' ? InvertedKeyMap[key] : key)));
6109
+ this.availableKeys = new Set(keys);
6086
6110
  }
6087
6111
  get video() {
6088
6112
  return this.videoService.video;
@@ -6437,7 +6461,7 @@ class InputService extends SubService {
6437
6461
  * The key code Unreal expects — the Windows virtual-key code — or `null` when
6438
6462
  * the event carries no key worth forwarding.
6439
6463
  *
6440
- * `KeyboardNumericCode` covers only the keys whose `event.keyCode` cannot be
6464
+ * `UnrealKeyCode` covers only the keys whose `event.keyCode` cannot be
6441
6465
  * trusted; everything else, the numpad included, falls through to the value
6442
6466
  * the browser resolved.
6443
6467
  *
@@ -6449,8 +6473,7 @@ class InputService extends SubService {
6449
6473
  if (e.keyCode === IME_PROCESS_KEY) {
6450
6474
  return null;
6451
6475
  }
6452
- const keyCode = KeyboardNumericCode[e.code] ??
6453
- e.keyCode;
6476
+ const keyCode = UnrealKeyCode[e.code] ?? e.keyCode;
6454
6477
  return keyCode || null;
6455
6478
  }
6456
6479
  /**
@@ -6532,10 +6555,10 @@ class InputService extends SubService {
6532
6555
  this.heldKeys.add(keyCode);
6533
6556
  // Backspace isn't a keypress in JS, but UE4 text-entry fields need it
6534
6557
  // to delete characters.
6535
- if (keyCode === SpecialKeyCodes.BackSpace) {
6558
+ if (keyCode === UnrealKeyCode.Backspace) {
6536
6559
  const data = this.keyPressView;
6537
6560
  data.setUint8(0, MessageType.KeyPress);
6538
- data.setUint16(1, SpecialKeyCodes.BackSpace, true);
6561
+ data.setUint16(1, UnrealKeyCode.Backspace, true);
6539
6562
  this.sendInputData(data.buffer);
6540
6563
  }
6541
6564
  });
@@ -9034,5 +9057,5 @@ function provideUnrealModule() {
9034
9057
  * Generated bundle index. Do not edit.
9035
9058
  */
9036
9059
 
9037
- export { AFKService, AUTO_HIGH_RESOLUTION_IDLE_MS, AfkTimeoutModalComponent, AggregatorService, AnalyticsService, AnswerHandler, CommandTelemetryService, ConfigHandler, ConsoleExtensionsService, ControlScheme, DATA_CHANNEL_CONNECTION_TIMEOUT, DEBOUNCE_TO_MANY_RESIZE_CALLS, DEFAULT_AFK_TIMEOUT, DEFAULT_AFK_TIMEOUT_PERIOD, DESTROY_DISCONNECT_REASONS, DevModeService, DisconnectReason, FULL_HD_HEIGHT, FULL_HD_WIDTH, FileHandlerService, FileReceiverService, FpsMonitorService, FreezeFrameComponent, FreezeFrameService, IME_PROCESS_KEY, INNER_RETRY_LIMIT, INSTANCE_READY_TIMEOUT, IceCandidateHandler, ImageLoadingSrcComponent, InputOptions, InputService, InstanceReadyHandler, InstanceReservedHandler, IntroSrcComponent, InvertedKeyMap, KeyboardNumericCode, LatencyTimings, LoadingProgressService, MINIMAL_FPS, MIN_CONTAINER_SIZE, MODIFIER_KEY_CODES, MessageType, MouseButton, MouseButtonsMask, OUTER_RETRY_DELAY, OnCloseHandler, OnErrorHandler, OnMessageHandler, OnOpenHandler, OrchestrationMessageTypes, POLLING_TIME, PlayerCountHandler, RECONNECT_CONFIG, REGION_PING_ACCURATE_SAMPLES, REGION_PING_BACKGROUND_REFRESH_DELAY_MS, REGION_PING_CACHE_KEY, REGION_PING_CACHE_TTL_MS, REGION_PING_WARMUP_DEADLINE_MS, RegionsPingService, SAME_SIZE_THRESHOLD, SCREEN_LOCKER_CONTAINER_ID, SIGNALLING_PERCENT_VALUE, SSInfoHandler, STREAMING_AUDIO_ID, STREAMING_VIDEO_ID, SafePipe, SignallingService, SpecialKeyCodes, StatGraphComponent, StreamAdoptionService, StreamStatusTelemetryService, StreamStatusTelemetryService2, SubService, ToClientMessage, UnrealAfkSlotDirective, UnrealCallbackService, UnrealCommunicatorService, UnrealEffects, UnrealResumeSlotDirective, UnrealSceneComponent, UnrealStatusMessage, UnrealStatusSlotDirective, VideoService, VideoStatsComponent, WSCloseCode_CIRRUS_ABNORMAL_CLOSURE, WSCloseCode_CIRRUS_MAX_PLAYERS_ERROR, WSCloseCode_CIRRUS_PLAYER_DISCONNECTED, WSCloseCode_CIRRUS_STREAMER_KIKED_PLAYER, WSCloseCode_FORCE_CIRRUS_CLOSE, WSCloseCode_NORMAL_AFK_TIMEOUT, WSCloseCode_NORMAL_CLOSURE, WSCloseCode_NORMAL_MANUAL_DISCONNECT, WSCloseCode_UNKNOWN, WSCloseCodes, WS_OPEN_STATE, WS_RETRY_PER_INSTANCE, WS_TIMEOUT, WebRtcPlayerService, WebrtcErrorModalComponent, abortEstablishingConnection, answerSent, changeStatusMainVideoOnScene, changeStreamResolutionAction, commandCompleted, commandStarted, dataChannelConnected, dataChannelReady, decodeData, destroyRemoteConnections, destroyUnrealScene, disconnectStream, dispatchResize, dropConnection, dropDC, dropPC, floatToPercents, floatToSmoothPercents, forceResizeViewport, fromResizeObserver, getActiveUrl, getImageFromVideoStream, getResizeStudioValues, getResizeValuesUniversal, getRtcErrorMessage, iceConnectionFailed, initSignalling, instanceReady, isAppOwned, isMetaboxMode, keepMaxUntilReset, makeEven, pollingEnded, pollingStarted, provideUnrealModule, provideUnrealState, qpToQuality, reconnectPeer, reconnectPeerFailed, reconnectPeerSuccess, regionPingFetchEnd, regionPingFetchStart, regionResolved, resetAfk, resetConfig, resetDataChannelForReconnect, resetIntroSrc, resetUserInactivityTimeout, resetWarnTimeout, resolveSkin, saveAnalyticsEvent, selectCirrusConnectionId, selectClientAndViewIds, selectCommandProgress, selectFreezeFrameCombinedDataUrl, selectFreezeFrameDataUrl, selectFreezeFrameDataUrlFromVideo, selectFreezeFrameProgressMessageFromVideo, selectIsAutostart, selectIsExistMatchUrls, selectIsFreezeFrameLoading, selectIsFullyConnected, selectIsLoaderScreenVisible, selectIsVideoPlayingAndDataChannelConnected, selectShowLoader, selectShowReconnectPopup, selectSignalingParameters, selectStreamConfig, selectTotalProgress, selectUserInactivityDetected, selectWarnTimeout, setAfkTimerCountdown, setAfkTimerHide, setAfkTimerVisible, setAwsInstance, setCirrusConnected, setCirrusDisconnected, setConfig, setEstablishingConnection, setFreezeFrame, setFreezeFrameFromVideo, setIntroImageSrc, setIntroVideoSrc, setLoadingImageSrc, setLoopBackCommandIsCompleted, setMaxFps, setOrchestrationContext, setOrchestrationMessage, setOrchestrationParameters, setOrchestrationProgress, setSignalingName, setStatusMessage, setStatusPercentSignallingServer, setStreamClientCompanyId, setStreamViewId, setUnrealPlaywrightConfig, setUserInactivityTimeout, setViewportNotReady, setViewportReady, showLoadingProgress, showResumeStreamPopup, showUnrealErrorMessage, showUserInactivityTimeoutPopup, signalingRetryAttempted, startStream, streamAdopted, trackMixpanelEvent, trackTelemetryData, uint8ToBase64, unrealCommandCallback, unrealFeature, unrealReducer, updateCirrusInfo, videoAdaptedToContainer, videoStreamInitialized };
9060
+ export { AFKService, ALL_KEYBOARD_KEYS, AUTO_HIGH_RESOLUTION_IDLE_MS, AfkTimeoutModalComponent, AggregatorService, AnalyticsService, AnswerHandler, CommandTelemetryService, ConfigHandler, ConsoleExtensionsService, ControlScheme, DATA_CHANNEL_CONNECTION_TIMEOUT, DEBOUNCE_TO_MANY_RESIZE_CALLS, DEFAULT_AFK_TIMEOUT, DEFAULT_AFK_TIMEOUT_PERIOD, DESTROY_DISCONNECT_REASONS, DevModeService, DisconnectReason, FULL_HD_HEIGHT, FULL_HD_WIDTH, FileHandlerService, FileReceiverService, FpsMonitorService, FreezeFrameComponent, FreezeFrameService, IME_PROCESS_KEY, INNER_RETRY_LIMIT, INSTANCE_READY_TIMEOUT, IceCandidateHandler, ImageLoadingSrcComponent, InputOptions, InputService, InstanceReadyHandler, InstanceReservedHandler, IntroSrcComponent, LatencyTimings, LoadingProgressService, MINIMAL_FPS, MIN_CONTAINER_SIZE, MODIFIER_KEY_CODES, MessageType, MouseButton, MouseButtonsMask, OUTER_RETRY_DELAY, OnCloseHandler, OnErrorHandler, OnMessageHandler, OnOpenHandler, OrchestrationMessageTypes, POLLING_TIME, PlayerCountHandler, RECONNECT_CONFIG, REGION_PING_ACCURATE_SAMPLES, REGION_PING_BACKGROUND_REFRESH_DELAY_MS, REGION_PING_CACHE_KEY, REGION_PING_CACHE_TTL_MS, REGION_PING_WARMUP_DEADLINE_MS, RegionsPingService, SAME_SIZE_THRESHOLD, SCREEN_LOCKER_CONTAINER_ID, SIGNALLING_PERCENT_VALUE, SSInfoHandler, STREAMING_AUDIO_ID, STREAMING_VIDEO_ID, SafePipe, SignallingService, StatGraphComponent, StreamAdoptionService, StreamStatusTelemetryService, StreamStatusTelemetryService2, SubService, ToClientMessage, UnrealAfkSlotDirective, UnrealCallbackService, UnrealCommunicatorService, UnrealEffects, UnrealKeyCode, UnrealResumeSlotDirective, UnrealSceneComponent, UnrealStatusMessage, UnrealStatusSlotDirective, VideoService, VideoStatsComponent, WSCloseCode_CIRRUS_ABNORMAL_CLOSURE, WSCloseCode_CIRRUS_MAX_PLAYERS_ERROR, WSCloseCode_CIRRUS_PLAYER_DISCONNECTED, WSCloseCode_CIRRUS_STREAMER_KIKED_PLAYER, WSCloseCode_FORCE_CIRRUS_CLOSE, WSCloseCode_NORMAL_AFK_TIMEOUT, WSCloseCode_NORMAL_CLOSURE, WSCloseCode_NORMAL_MANUAL_DISCONNECT, WSCloseCode_UNKNOWN, WSCloseCodes, WS_OPEN_STATE, WS_RETRY_PER_INSTANCE, WS_TIMEOUT, WebRtcPlayerService, WebrtcErrorModalComponent, abortEstablishingConnection, answerSent, changeStatusMainVideoOnScene, changeStreamResolutionAction, commandCompleted, commandStarted, dataChannelConnected, dataChannelReady, decodeData, destroyRemoteConnections, destroyUnrealScene, disconnectStream, dispatchResize, dropConnection, dropDC, dropPC, floatToPercents, floatToSmoothPercents, forceResizeViewport, fromResizeObserver, getActiveUrl, getImageFromVideoStream, getResizeStudioValues, getResizeValuesUniversal, getRtcErrorMessage, iceConnectionFailed, initSignalling, instanceReady, isAppOwned, isMetaboxMode, keepMaxUntilReset, makeEven, pollingEnded, pollingStarted, provideUnrealModule, provideUnrealState, qpToQuality, reconnectPeer, reconnectPeerFailed, reconnectPeerSuccess, regionPingFetchEnd, regionPingFetchStart, regionResolved, resetAfk, resetConfig, resetDataChannelForReconnect, resetIntroSrc, resetUserInactivityTimeout, resetWarnTimeout, resolveSkin, saveAnalyticsEvent, selectCirrusConnectionId, selectClientAndViewIds, selectCommandProgress, selectFreezeFrameCombinedDataUrl, selectFreezeFrameDataUrl, selectFreezeFrameDataUrlFromVideo, selectFreezeFrameProgressMessageFromVideo, selectIsAutostart, selectIsExistMatchUrls, selectIsFreezeFrameLoading, selectIsFullyConnected, selectIsLoaderScreenVisible, selectIsVideoPlayingAndDataChannelConnected, selectShowLoader, selectShowReconnectPopup, selectSignalingParameters, selectStreamConfig, selectTotalProgress, selectUserInactivityDetected, selectWarnTimeout, setAfkTimerCountdown, setAfkTimerHide, setAfkTimerVisible, setAwsInstance, setCirrusConnected, setCirrusDisconnected, setConfig, setEstablishingConnection, setFreezeFrame, setFreezeFrameFromVideo, setIntroImageSrc, setIntroVideoSrc, setLoadingImageSrc, setLoopBackCommandIsCompleted, setMaxFps, setOrchestrationContext, setOrchestrationMessage, setOrchestrationParameters, setOrchestrationProgress, setSignalingName, setStatusMessage, setStatusPercentSignallingServer, setStreamClientCompanyId, setStreamViewId, setUnrealPlaywrightConfig, setUserInactivityTimeout, setViewportNotReady, setViewportReady, showLoadingProgress, showResumeStreamPopup, showUnrealErrorMessage, showUserInactivityTimeoutPopup, signalingRetryAttempted, startStream, streamAdopted, trackMixpanelEvent, trackTelemetryData, uint8ToBase64, unrealCommandCallback, unrealFeature, unrealReducer, updateCirrusInfo, videoAdaptedToContainer, videoStreamInitialized };
9038
9061
  //# sourceMappingURL=3dsource-angular-unreal-module.mjs.map