@3dsource/angular-unreal-module 0.0.182 → 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,56 +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 digits, `NumpadDecimal` and `NumpadEnter` are the exception to the
320
- * rule above, and the reason it is worded as a rule. A numpad key reports the
321
- * same `code` in both NumLock states but a different virtual key — `Numpad4` is
322
- * 37/`VK_LEFT` with NumLock off and 100/`VK_NUMPAD4` with it on. Their entries
323
- * here hold the NumLock-*off* values, so an entry wins over the value the
324
- * browser resolved and pins that state: with NumLock on the engine is told
325
- * `VK_LEFT`. Read `event.keyCode` directly if you need the other state.
326
- * `NumpadAdd`/`Subtract`/`Multiply`/`Divide` carry no such caveat — they do not
327
- * 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.
328
316
  *
329
- * `SpecialKeyCodes` in `./buttons-codes` repeats seven of these entries with
330
- * the same values. The two are kept apart because both are public API; merging
331
- * 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.
332
326
  *
333
- * `InvertedKeyMap` is consequently lossy. `NumpadEnter` and `Numpad4/8/6/2`
334
- * share their values with `Enter` and `Arrow*`, and the derivation keeps the
335
- * last name written for a value, so those five cannot be reached through it —
336
- * which is what makes them unnameable through the numeric form of
337
- * `useKeyboardKeys()`. The `OSLeft`/`MetaLeft` and `OSRight`/`MetaRight` pairs
338
- * share a value on purpose: they are legacy and current names for the same
339
- * 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.
340
330
  */
341
- const KeyboardNumericCode = {
331
+ const UnrealKeyCode = {
342
332
  Backspace: 8,
343
333
  Tab: 9,
344
- // The NumLock-*off* virtual keys. Declared before `Enter` and the arrows on
345
- // purpose: those come later and so win the `InvertedKeyMap` derivation, which
346
- // keeps 13 resolving to `Enter` and 37-40 to `Arrow*`.
347
- Numpad5: 12,
348
- NumpadEnter: 13,
349
- Numpad9: 33,
350
- Numpad3: 34,
351
- Numpad1: 35,
352
- Numpad7: 36,
353
- Numpad4: 37,
354
- Numpad8: 38,
355
- Numpad6: 39,
356
- Numpad2: 40,
357
- Numpad0: 45,
358
- NumpadDecimal: 46,
359
334
  Enter: 13,
360
335
  ShiftLeft: 16,
361
336
  ControlLeft: 17,
362
337
  AltLeft: 18,
338
+ Pause: 19,
339
+ CapsLock: 20,
363
340
  Escape: 27,
364
341
  Space: 32,
342
+ PageUp: 33,
343
+ PageDown: 34,
344
+ End: 35,
345
+ Home: 36,
365
346
  ArrowLeft: 37,
366
347
  ArrowUp: 38,
367
348
  ArrowRight: 39,
368
349
  ArrowDown: 40,
350
+ Insert: 45,
351
+ Delete: 46,
369
352
  Digit0: 48,
370
353
  Digit1: 49,
371
354
  Digit2: 50,
@@ -471,14 +454,36 @@ const MODIFIER_KEY_CODES = new Set([
471
454
  'OSLeft',
472
455
  'OSRight',
473
456
  ]);
474
- const InvertedKeyMapValues = {};
475
- //For use for InvertedKeyMap[32] will return 'Space' and so on
476
- const InvertedKeyMap = InvertedKeyMapValues;
477
- Object.entries(KeyboardNumericCode).forEach(
478
- // @ts-expect-error @typescript-eslint/ban-ts-comment
479
- ([key, value]) => {
480
- InvertedKeyMapValues[value] = key;
481
- });
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
+ ];
482
487
 
483
488
  const ControlScheme = {
484
489
  // A mouse can lock inside the WebRTC player, so the user can simply move the
@@ -6096,15 +6101,12 @@ class InputService extends SubService {
6096
6101
  }
6097
6102
  /**
6098
6103
  * Replaces the forwarded-key allow-list. Takes physical key names
6099
- * (`KeyboardEvent.code`) such as `'KeyW'` or `'BracketLeft'`.
6100
- *
6101
- * Legacy numeric `keyCode` values are still accepted and converted, but they
6102
- * cannot express every key: `InvertedKeyMap` is many-to-one, so 37 resolves
6103
- * to `'ArrowLeft'` and 17 to `'ControlLeft'`, and `'Numpad4'`/`'ControlRight'`
6104
- * 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.
6105
6107
  */
6106
6108
  useKeyboardKeys(keys) {
6107
- this.availableKeys = new Set(keys.map((key) => (typeof key === 'number' ? InvertedKeyMap[key] : key)));
6109
+ this.availableKeys = new Set(keys);
6108
6110
  }
6109
6111
  get video() {
6110
6112
  return this.videoService.video;
@@ -6459,7 +6461,7 @@ class InputService extends SubService {
6459
6461
  * The key code Unreal expects — the Windows virtual-key code — or `null` when
6460
6462
  * the event carries no key worth forwarding.
6461
6463
  *
6462
- * `KeyboardNumericCode` covers only the keys whose `event.keyCode` cannot be
6464
+ * `UnrealKeyCode` covers only the keys whose `event.keyCode` cannot be
6463
6465
  * trusted; everything else, the numpad included, falls through to the value
6464
6466
  * the browser resolved.
6465
6467
  *
@@ -6471,8 +6473,7 @@ class InputService extends SubService {
6471
6473
  if (e.keyCode === IME_PROCESS_KEY) {
6472
6474
  return null;
6473
6475
  }
6474
- const keyCode = KeyboardNumericCode[e.code] ??
6475
- e.keyCode;
6476
+ const keyCode = UnrealKeyCode[e.code] ?? e.keyCode;
6476
6477
  return keyCode || null;
6477
6478
  }
6478
6479
  /**
@@ -6554,10 +6555,10 @@ class InputService extends SubService {
6554
6555
  this.heldKeys.add(keyCode);
6555
6556
  // Backspace isn't a keypress in JS, but UE4 text-entry fields need it
6556
6557
  // to delete characters.
6557
- if (keyCode === SpecialKeyCodes.BackSpace) {
6558
+ if (keyCode === UnrealKeyCode.Backspace) {
6558
6559
  const data = this.keyPressView;
6559
6560
  data.setUint8(0, MessageType.KeyPress);
6560
- data.setUint16(1, SpecialKeyCodes.BackSpace, true);
6561
+ data.setUint16(1, UnrealKeyCode.Backspace, true);
6561
6562
  this.sendInputData(data.buffer);
6562
6563
  }
6563
6564
  });
@@ -9056,5 +9057,5 @@ function provideUnrealModule() {
9056
9057
  * Generated bundle index. Do not edit.
9057
9058
  */
9058
9059
 
9059
- 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 };
9060
9061
  //# sourceMappingURL=3dsource-angular-unreal-module.mjs.map