@opengeni/react 7.1.2 → 7.2.0-canary.36239117573001

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 (34) hide show
  1. package/dist/{browser-viewer-TZ6T76E3.js → browser-viewer-GEYFZE2W.js} +2 -2
  2. package/dist/{chunk-CP6IFD2Z.js → chunk-6IUUN2AQ.js} +124 -58
  3. package/dist/chunk-6IUUN2AQ.js.map +1 -0
  4. package/dist/{chunk-VHEY4CB3.js → chunk-RSFCYKA7.js} +5 -3
  5. package/dist/{chunk-VHEY4CB3.js.map → chunk-RSFCYKA7.js.map} +1 -1
  6. package/dist/{chunk-VI7HELBI.js → chunk-SJ5HE4ZA.js} +21 -2
  7. package/dist/chunk-SJ5HE4ZA.js.map +1 -0
  8. package/dist/{chunk-4ACTWOOW.js → chunk-VDSZ3AVO.js} +41 -18
  9. package/dist/chunk-VDSZ3AVO.js.map +1 -0
  10. package/dist/{chunk-2O2HXRGP.js → chunk-Y6DMQTLA.js} +130 -58
  11. package/dist/chunk-Y6DMQTLA.js.map +1 -0
  12. package/dist/composer.js +1 -1
  13. package/dist/{computer-viewer-FX4WOZMX.js → computer-viewer-BNHZ4PYO.js} +2 -2
  14. package/dist/index.js +5 -5
  15. package/dist/interaction.js +2 -2
  16. package/dist/session-ui.js +3 -3
  17. package/dist/session.js +1 -1
  18. package/dist/timeline/types.d.ts +2 -0
  19. package/package.json +5 -5
  20. package/src/components/browser-viewer.tsx +146 -57
  21. package/src/components/composer-transcription-control.tsx +4 -2
  22. package/src/components/composer.tsx +45 -20
  23. package/src/components/computer-viewer.tsx +161 -57
  24. package/src/hooks/use-browser-frame-stream.ts +3 -1
  25. package/src/hooks/use-voice-input.ts +12 -1
  26. package/src/timeline/compaction-copy.ts +2 -0
  27. package/src/timeline/projection.ts +31 -5
  28. package/src/timeline/types.ts +2 -0
  29. package/dist/chunk-2O2HXRGP.js.map +0 -1
  30. package/dist/chunk-4ACTWOOW.js.map +0 -1
  31. package/dist/chunk-CP6IFD2Z.js.map +0 -1
  32. package/dist/chunk-VI7HELBI.js.map +0 -1
  33. /package/dist/{browser-viewer-TZ6T76E3.js.map → browser-viewer-GEYFZE2W.js.map} +0 -0
  34. /package/dist/{computer-viewer-FX4WOZMX.js.map → computer-viewer-BNHZ4PYO.js.map} +0 -0
@@ -856,9 +856,9 @@ function useChatComposerController({
856
856
  (event) => {
857
857
  if (!attachments || !dragCarriesFiles(event)) return;
858
858
  event.preventDefault();
859
- setDragging(true);
859
+ if (!disabled) setDragging(true);
860
860
  },
861
- [attachments]
861
+ [attachments, disabled]
862
862
  );
863
863
  const handleDragLeave = useCallback2(
864
864
  (event) => {
@@ -873,10 +873,14 @@ function useChatComposerController({
873
873
  if (!attachments || !dragCarriesFiles(event)) return;
874
874
  event.preventDefault();
875
875
  setDragging(false);
876
- if (event.dataTransfer.files.length > 0) attachments.addFiles(event.dataTransfer.files);
876
+ if (!disabled && event.dataTransfer.files.length > 0)
877
+ attachments.addFiles(event.dataTransfer.files);
877
878
  },
878
- [attachments]
879
+ [attachments, disabled]
879
880
  );
881
+ useEffect(() => {
882
+ if (disabled) setDragging(false);
883
+ }, [disabled]);
880
884
  const [notice, setNotice] = useState2(null);
881
885
  const [helpOpen, setHelpOpen] = useState2(false);
882
886
  const [confirmState, setConfirmState] = useState2(null);
@@ -998,17 +1002,18 @@ function useChatComposerController({
998
1002
  );
999
1003
  const handlePaste = useCallback2(
1000
1004
  (event) => {
1005
+ if (disabled) return;
1001
1006
  onPaste?.(event);
1002
1007
  attachments?.addFromPaste(event);
1003
1008
  },
1004
- [attachments, onPaste]
1009
+ [attachments, disabled, onPaste]
1005
1010
  );
1006
1011
  const handleFileChange = useCallback2(
1007
1012
  (event) => {
1008
- if (event.target.files) attachments?.addFiles(event.target.files);
1013
+ if (!disabled && event.target.files) attachments?.addFiles(event.target.files);
1009
1014
  event.target.value = "";
1010
1015
  },
1011
- [attachments]
1016
+ [attachments, disabled]
1012
1017
  );
1013
1018
  const helpCommands = useMemo3(
1014
1019
  () => commands.filter((command) => {
@@ -1267,6 +1272,7 @@ function Attachments() {
1267
1272
  {
1268
1273
  attachments: controller.attachments.attachments,
1269
1274
  messages: controller.messages,
1275
+ disabled: controller.disabled,
1270
1276
  onRemove: controller.attachments.remove,
1271
1277
  onRetry: controller.attachments.retry,
1272
1278
  onRetainPreview: controller.attachments.retainPreview,
@@ -1274,6 +1280,15 @@ function Attachments() {
1274
1280
  }
1275
1281
  );
1276
1282
  }
1283
+ var EDITING_FOCUS_SELECTOR = 'input, textarea, select, [contenteditable="true"], [role="textbox"]';
1284
+ var POPUP_FOCUS_SELECTOR = '[role="menu"], [role="menubar"], [role="listbox"], [role="dialog"], [role="alertdialog"]';
1285
+ function focusBelongsElsewhere(textarea) {
1286
+ const active = textarea.ownerDocument.activeElement;
1287
+ if (!active || active === textarea) return false;
1288
+ if (active.closest(EDITING_FOCUS_SELECTOR)) return true;
1289
+ const popup = active.closest(POPUP_FOCUS_SELECTOR);
1290
+ return popup !== null && !popup.contains(textarea);
1291
+ }
1277
1292
  var Input = forwardRef(function ComposerInput({ rows = 1, placeholder, className, "aria-label": ariaLabel, autoFocus = false, ...props }, forwardedRef) {
1278
1293
  const controller = useComposerController();
1279
1294
  const autoFocusedRef = useRef2(false);
@@ -1284,9 +1299,7 @@ var Input = forwardRef(function ComposerInput({ rows = 1, placeholder, className
1284
1299
  const textarea = controller.textareaRef.current;
1285
1300
  if (!textarea || textarea.disabled) return;
1286
1301
  autoFocusedRef.current = true;
1287
- const active = textarea.ownerDocument.activeElement;
1288
- if (active !== textarea && active?.closest('input, textarea, select, [contenteditable="true"], [role="textbox"]'))
1289
- return;
1302
+ if (focusBelongsElsewhere(textarea)) return;
1290
1303
  textarea.focus();
1291
1304
  });
1292
1305
  return () => window.cancelAnimationFrame(frame);
@@ -1303,7 +1316,6 @@ var Input = forwardRef(function ComposerInput({ rows = 1, placeholder, className
1303
1316
  onPaste: controller.handlePaste,
1304
1317
  placeholder: controller.paused && !controller.disabled ? controller.messages.pausedPlaceholder : placeholder ?? controller.messages.messagePlaceholder,
1305
1318
  disabled: controller.disabled,
1306
- autoFocus: autoFocus && !controller.disabled,
1307
1319
  "aria-label": ariaLabel ?? controller.messages.inputLabel,
1308
1320
  "aria-keyshortcuts": "Enter Meta+Enter Control+Enter Shift+Enter",
1309
1321
  "aria-autocomplete": controller.paletteEnabled && controller.paletteMounted ? "list" : void 0,
@@ -1790,6 +1802,7 @@ function ConfirmBar({
1790
1802
  function AttachmentChips({
1791
1803
  attachments,
1792
1804
  messages,
1805
+ disabled,
1793
1806
  onRemove,
1794
1807
  onRetry,
1795
1808
  onRetainPreview,
@@ -1898,7 +1911,8 @@ function AttachmentChips({
1898
1911
  {
1899
1912
  type: "button",
1900
1913
  onClick: () => onRetry(attachment.id),
1901
- className: "shrink-0 rounded-og-xs p-1 text-og-fg-muted hover:bg-og-surface-1 hover:text-og-fg pointer-coarse:size-10",
1914
+ disabled,
1915
+ className: "shrink-0 rounded-og-xs p-1 text-og-fg-muted hover:bg-og-surface-1 hover:text-og-fg disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:size-10",
1902
1916
  "aria-label": messages.retryAttachment(attachment.name),
1903
1917
  children: /* @__PURE__ */ jsx3(RotateCwIcon, { className: "size-3.5" })
1904
1918
  }
@@ -1908,7 +1922,8 @@ function AttachmentChips({
1908
1922
  {
1909
1923
  type: "button",
1910
1924
  onClick: () => onRemove(attachment.id),
1911
- className: "shrink-0 rounded-og-xs p-1 text-og-fg-muted hover:bg-og-surface-1 hover:text-og-fg pointer-coarse:size-10",
1925
+ disabled,
1926
+ className: "shrink-0 rounded-og-xs p-1 text-og-fg-muted hover:bg-og-surface-1 hover:text-og-fg disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:size-10",
1912
1927
  "aria-label": messages.removeAttachment(attachment.name),
1913
1928
  children: /* @__PURE__ */ jsx3(XIcon, { className: "size-3.5" })
1914
1929
  }
@@ -3123,6 +3138,7 @@ function useVoiceInput({
3123
3138
  const automaticRetryAttemptRef = useRef4(0);
3124
3139
  const ownerHeartbeatTimerRef = useRef4(null);
3125
3140
  const controllerRef = useRef4(null);
3141
+ const disabledRef = useRef4(disabled);
3126
3142
  const valueRef = useRef4(value);
3127
3143
  const storeRef = useRef4(null);
3128
3144
  const storePromiseRef = useRef4(null);
@@ -3136,6 +3152,7 @@ function useVoiceInput({
3136
3152
  const statusRef = useRef4(status);
3137
3153
  valueRef.current = value;
3138
3154
  statusRef.current = status;
3155
+ disabledRef.current = disabled;
3139
3156
  workspaceIdRef.current = workspaceId;
3140
3157
  const ensureOwnerId = useCallback4(async () => {
3141
3158
  if (ownerIdRef.current) return ownerIdRef.current;
@@ -3384,6 +3401,10 @@ function useVoiceInput({
3384
3401
  focusInput();
3385
3402
  return;
3386
3403
  }
3404
+ if (disabledRef.current) {
3405
+ setStatus("transcript-ready");
3406
+ return;
3407
+ }
3387
3408
  const next = appendFinalTranscript(valueRef.current, response.text);
3388
3409
  if (next !== valueRef.current) {
3389
3410
  valueRef.current = next;
@@ -3759,14 +3780,14 @@ function useVoiceInput({
3759
3780
  ]);
3760
3781
  const insertSavedTranscript = useCallback4(async () => {
3761
3782
  const manifest = manifestRef.current;
3762
- if (!manifest || manifest.workspaceId !== workspaceId || manifest.finalizationState !== "transcript-ready" || manifest.transcriptText === null) {
3783
+ if (disabledRef.current || !manifest || manifest.workspaceId !== workspaceId || manifest.finalizationState !== "transcript-ready" || manifest.transcriptText === null) {
3763
3784
  return;
3764
3785
  }
3765
3786
  const generation = ++generationRef.current;
3766
3787
  controllerRef.current?.abort();
3767
3788
  controllerRef.current = null;
3768
3789
  const store = await ensureStore();
3769
- if (generation !== generationRef.current) return;
3790
+ if (generation !== generationRef.current || disabledRef.current) return;
3770
3791
  const next = appendFinalTranscript(valueRef.current, manifest.transcriptText);
3771
3792
  if (next !== valueRef.current) {
3772
3793
  valueRef.current = next;
@@ -4360,12 +4381,13 @@ function ComposerTranscriptionControl({
4360
4381
  "button",
4361
4382
  {
4362
4383
  type: "button",
4384
+ disabled: composer.disabled && !retrying,
4363
4385
  onClick: () => savedTranscript ? void transcription.insertSavedTranscript() : retrying ? transcription.cancel() : transcription.retry(),
4364
4386
  "aria-label": savedTranscript ? messages.insertRecoveredTranscript : retrying ? messages.pauseRetrying : messages.retry,
4365
4387
  className: cn(
4366
4388
  "inline-flex size-7 shrink-0 items-center justify-center rounded-og-sm",
4367
4389
  "bg-og-fg text-og-bg transition-colors duration-150 motion-reduce:transition-none",
4368
- "hover:bg-og-fg-muted pointer-coarse:size-11"
4390
+ "hover:bg-og-fg-muted disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:size-11"
4369
4391
  ),
4370
4392
  children: savedTranscript ? /* @__PURE__ */ jsx4(ClipboardPasteIcon, { className: "size-3.5" }) : retrying ? /* @__PURE__ */ jsx4(SquareIcon, { className: "size-3.5" }) : /* @__PURE__ */ jsx4(RefreshCwIcon, { className: "size-3.5" })
4371
4393
  }
@@ -4376,12 +4398,13 @@ function ComposerTranscriptionControl({
4376
4398
  "button",
4377
4399
  {
4378
4400
  type: "button",
4401
+ disabled: composer.disabled,
4379
4402
  onClick: () => void transcription.discard(),
4380
4403
  "aria-label": messages.discardRecovered,
4381
4404
  className: cn(
4382
4405
  "inline-flex size-7 shrink-0 items-center justify-center rounded-og-sm",
4383
4406
  "text-og-fg-muted transition-colors duration-150 motion-reduce:transition-none",
4384
- "hover:bg-og-surface-3 hover:text-og-status-failed pointer-coarse:size-11"
4407
+ "hover:bg-og-surface-3 hover:text-og-status-failed disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:size-11"
4385
4408
  ),
4386
4409
  children: /* @__PURE__ */ jsx4(Trash2Icon, { className: "size-3.5" })
4387
4410
  }
@@ -4666,4 +4689,4 @@ export {
4666
4689
  useVoiceInput,
4667
4690
  ComposerTranscriptionControl
4668
4691
  };
4669
- //# sourceMappingURL=chunk-4ACTWOOW.js.map
4692
+ //# sourceMappingURL=chunk-VDSZ3AVO.js.map