@opengeni/react 7.1.0 → 7.1.2-canary.36199476632001

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 (78) hide show
  1. package/dist/artifacts-document.js +2 -2
  2. package/dist/artifacts-presentation.js +2 -2
  3. package/dist/artifacts-spreadsheet.js +2 -2
  4. package/dist/artifacts.js +4 -4
  5. package/dist/{browser-viewer-MN7MOYQT.js → browser-viewer-K2H3SLIW.js} +2 -2
  6. package/dist/{chunk-KCGXPP5V.js → chunk-6P7T4RPE.js} +7 -3
  7. package/dist/chunk-6P7T4RPE.js.map +1 -0
  8. package/dist/{chunk-SHRCATV6.js → chunk-7J4DUR3E.js} +12 -5
  9. package/dist/chunk-7J4DUR3E.js.map +1 -0
  10. package/dist/{chunk-UQS7BGNQ.js → chunk-ETA37UZ7.js} +82 -11
  11. package/dist/chunk-ETA37UZ7.js.map +1 -0
  12. package/dist/{chunk-VR4Z73EU.js → chunk-G2SCXNXW.js} +9 -2
  13. package/dist/chunk-G2SCXNXW.js.map +1 -0
  14. package/dist/{chunk-5UONOQ3Y.js → chunk-K3MQZO7R.js} +150 -67
  15. package/dist/chunk-K3MQZO7R.js.map +1 -0
  16. package/dist/{chunk-OWHPKAOV.js → chunk-L6MYP3QU.js} +4 -2
  17. package/dist/{chunk-OWHPKAOV.js.map → chunk-L6MYP3QU.js.map} +1 -1
  18. package/dist/{chunk-ZC2DK5SC.js → chunk-RSFCYKA7.js} +88 -7
  19. package/dist/chunk-RSFCYKA7.js.map +1 -0
  20. package/dist/{chunk-VI7HELBI.js → chunk-SJ5HE4ZA.js} +21 -2
  21. package/dist/chunk-SJ5HE4ZA.js.map +1 -0
  22. package/dist/{chunk-4ACTWOOW.js → chunk-VDSZ3AVO.js} +41 -18
  23. package/dist/chunk-VDSZ3AVO.js.map +1 -0
  24. package/dist/{chunk-XMXRI5JK.js → chunk-ZZ4744OZ.js} +128 -71
  25. package/dist/chunk-ZZ4744OZ.js.map +1 -0
  26. package/dist/components/artifacts/artifact-surface.d.ts +3 -1
  27. package/dist/components/artifacts/document-editor.d.ts +4 -2
  28. package/dist/components/artifacts/editable-document.d.ts +1 -1
  29. package/dist/components/artifacts/editable-presentation.d.ts +1 -1
  30. package/dist/components/artifacts/editable-spreadsheet.d.ts +2 -1
  31. package/dist/components/artifacts/presentation-editor.d.ts +4 -2
  32. package/dist/components/browser-viewer.d.ts +4 -1
  33. package/dist/components/markdown.d.ts +2 -0
  34. package/dist/components/session-capability-frame.d.ts +5 -1
  35. package/dist/composer.js +1 -1
  36. package/dist/connect.js +2 -2
  37. package/dist/hooks/use-browser-session.d.ts +3 -0
  38. package/dist/index.js +7 -6
  39. package/dist/index.js.map +1 -1
  40. package/dist/interaction.js +1 -1
  41. package/dist/session-ui.js +4 -4
  42. package/dist/session.js +1 -1
  43. package/dist/timeline/types.d.ts +2 -0
  44. package/package.json +5 -5
  45. package/src/components/artifacts/artifact-surface.tsx +39 -19
  46. package/src/components/artifacts/document-editor.tsx +77 -9
  47. package/src/components/artifacts/editable-document.tsx +3 -0
  48. package/src/components/artifacts/editable-presentation.tsx +3 -0
  49. package/src/components/artifacts/editable-spreadsheet.tsx +3 -0
  50. package/src/components/artifacts/presentation-editor.tsx +6 -0
  51. package/src/components/browser-viewer.tsx +11 -5
  52. package/src/components/composer-transcription-control.tsx +4 -2
  53. package/src/components/composer.tsx +45 -20
  54. package/src/components/markdown.tsx +9 -2
  55. package/src/components/sandbox-workspace.tsx +1 -0
  56. package/src/components/session-capability-frame.tsx +11 -3
  57. package/src/components/session-mcp-capability-card.tsx +174 -70
  58. package/src/hooks/use-browser-frame-stream.ts +3 -1
  59. package/src/hooks/use-browser-session.ts +107 -3
  60. package/src/hooks/use-voice-input.ts +12 -1
  61. package/src/timeline/compaction-copy.ts +2 -0
  62. package/src/timeline/parsers.ts +2 -2
  63. package/src/timeline/projection.ts +31 -5
  64. package/src/timeline/tool-renderers.tsx +105 -16
  65. package/src/timeline/turn-summary.tsx +10 -2
  66. package/src/timeline/types.ts +2 -0
  67. package/styles/compiled.css +6 -0
  68. package/styles/session-capability.css +2 -0
  69. package/dist/chunk-4ACTWOOW.js.map +0 -1
  70. package/dist/chunk-5UONOQ3Y.js.map +0 -1
  71. package/dist/chunk-KCGXPP5V.js.map +0 -1
  72. package/dist/chunk-SHRCATV6.js.map +0 -1
  73. package/dist/chunk-UQS7BGNQ.js.map +0 -1
  74. package/dist/chunk-VI7HELBI.js.map +0 -1
  75. package/dist/chunk-VR4Z73EU.js.map +0 -1
  76. package/dist/chunk-XMXRI5JK.js.map +0 -1
  77. package/dist/chunk-ZC2DK5SC.js.map +0 -1
  78. /package/dist/{browser-viewer-MN7MOYQT.js.map → browser-viewer-K2H3SLIW.js.map} +0 -0
@@ -6,7 +6,7 @@ import {
6
6
  editableArtifactProjectionKey,
7
7
  editableArtifactStatusLabel,
8
8
  useEditableArtifactView
9
- } from "./chunk-KCGXPP5V.js";
9
+ } from "./chunk-6P7T4RPE.js";
10
10
  import {
11
11
  cn
12
12
  } from "./chunk-22KP6LR5.js";
@@ -587,79 +587,100 @@ function DocumentEditorCore({
587
587
  children: "Start writing"
588
588
  }
589
589
  ) : null
590
- ] }) }) : /* @__PURE__ */ jsx("div", { className: "relative min-w-full", style: { height: axis.total }, children: mountedIndexes.map((pageIndex) => {
591
- const page = pages[pageIndex];
592
- const top = axis.offsets[pageIndex];
593
- return /* @__PURE__ */ jsx(
594
- "article",
595
- {
596
- "aria-label": `${layout === "paginated" ? "Page" : "Section"} ${pageIndex + 1} of ${pages.length}`,
597
- "aria-posinset": pageIndex + 1,
598
- "aria-setsize": pages.length,
599
- "data-og-document-page": pageIndex + 1,
600
- "data-og-page-width-pt": page.page.widthPt,
601
- "data-og-page-height-pt": page.page.heightPt,
602
- className: cn(
603
- "absolute overflow-hidden",
604
- layout === "paginated" ? "left-1/2 -translate-x-1/2 border shadow-og-sm" : "left-0 right-0 border-b border-og-border bg-og-surface-1 text-og-fg"
605
- ),
606
- style: {
607
- top,
608
- color: layout === "paginated" ? "#171717" : void 0,
609
- backgroundColor: layout === "paginated" ? "#fff" : void 0,
610
- borderColor: layout === "paginated" ? "#0000001a" : void 0,
611
- width: layout === "paginated" ? page.page.widthPt * POINT_TO_CSS_PIXEL * page.renderScale : void 0,
612
- height: page.height
613
- },
614
- children: /* @__PURE__ */ jsx(
615
- MeasuredPageBody,
590
+ ] }) }) : /* @__PURE__ */ jsx(
591
+ "div",
592
+ {
593
+ className: "relative min-w-full",
594
+ style: {
595
+ height: axis.total,
596
+ minWidth: layout === "paginated" ? pages.reduce(
597
+ (width, page) => Math.max(
598
+ width,
599
+ page.page.widthPt * POINT_TO_CSS_PIXEL * page.renderScale + 32
600
+ ),
601
+ 0
602
+ ) : void 0
603
+ },
604
+ children: mountedIndexes.map((pageIndex) => {
605
+ const page = pages[pageIndex];
606
+ const top = axis.offsets[pageIndex];
607
+ const pageWidth = page.page.widthPt * POINT_TO_CSS_PIXEL * page.renderScale;
608
+ return /* @__PURE__ */ jsx(
609
+ "article",
616
610
  {
617
- pageKey: page.key,
618
- measureToken: documentRevision,
619
- onHeight: recordPageHeight,
611
+ "aria-label": `${layout === "paginated" ? "Page" : "Section"} ${pageIndex + 1} of ${pages.length}`,
612
+ "aria-posinset": pageIndex + 1,
613
+ "aria-setsize": pages.length,
614
+ "data-og-document-page": pageIndex + 1,
615
+ "data-og-page-width-pt": page.page.widthPt,
616
+ "data-og-page-height-pt": page.page.heightPt,
620
617
  className: cn(
621
- layout === "paginated" ? "absolute left-0 top-0 overflow-hidden" : "mx-auto"
618
+ "absolute overflow-hidden",
619
+ layout === "paginated" ? "border shadow-og-sm" : "left-0 right-0 border-b border-og-border bg-og-surface-1 text-og-fg"
622
620
  ),
623
621
  style: {
624
- ...pageContentStyle(page.page, layout),
625
- maxWidth: layout === "continuous" ? "68rem" : void 0,
626
- ...layout === "paginated" ? {
627
- width: page.page.widthPt * POINT_TO_CSS_PIXEL,
628
- minHeight: page.naturalHeight,
629
- transform: `scale(${page.renderScale})`,
630
- transformOrigin: "top left"
631
- } : {}
622
+ top,
623
+ // Center against the visible viewport, not the shared width
624
+ // reserved for the widest section in this document.
625
+ left: layout === "paginated" ? Math.max(16, (measuredViewport.width - pageWidth) / 2) : void 0,
626
+ color: layout === "paginated" ? "#171717" : void 0,
627
+ backgroundColor: layout === "paginated" ? "#fff" : void 0,
628
+ borderColor: layout === "paginated" ? "#0000001a" : void 0,
629
+ width: layout === "paginated" ? pageWidth : void 0,
630
+ height: page.height,
631
+ containerType: layout === "continuous" ? "inline-size" : void 0
632
632
  },
633
- children: page.blocks.map(({ block, listOrdinal }) => /* @__PURE__ */ jsx(
634
- DocumentBlockView,
633
+ children: /* @__PURE__ */ jsx(
634
+ MeasuredPageBody,
635
635
  {
636
- block,
637
- viewBlockId: blockIdForView(block.id),
638
- comments: annotations.comments.get(block.id) ?? EMPTY_COMMENTS,
639
- changes: annotations.changes.get(block.id) ?? EMPTY_CHANGES,
640
- projectionRevision: localRevision,
641
- listOrdinal,
642
- readOnly,
643
- selected: selectedBlockId === block.id,
644
- openThreadId,
645
- registerEditor: (node) => {
646
- if (node) editorNodes.current.set(block.id, node);
647
- else editorNodes.current.delete(block.id);
636
+ pageKey: page.key,
637
+ measureToken: documentRevision,
638
+ onHeight: recordPageHeight,
639
+ className: cn(
640
+ layout === "paginated" ? "absolute left-0 top-0 overflow-hidden" : "mx-auto"
641
+ ),
642
+ style: {
643
+ ...pageContentStyle(page.page, layout),
644
+ maxWidth: layout === "continuous" ? "68rem" : void 0,
645
+ ...layout === "paginated" ? {
646
+ width: page.page.widthPt * POINT_TO_CSS_PIXEL,
647
+ minHeight: page.naturalHeight,
648
+ transform: `scale(${page.renderScale})`,
649
+ transformOrigin: "top left"
650
+ } : {}
648
651
  },
649
- onThreadToggle: (threadId) => setOpenThreadId((current) => current === threadId ? null : threadId),
650
- onInput: (paragraph, text) => commitText(paragraph, text),
651
- onBlur: () => setLocalRevision(document2.revision),
652
- onSelection: (paragraph) => readDomSelection(paragraph.id),
653
- onKeyDown: handleEditorKeyDown
654
- },
655
- block.id
656
- ))
657
- }
658
- )
659
- },
660
- page.key
661
- );
662
- }) })
652
+ children: page.blocks.map(({ block, listOrdinal }) => /* @__PURE__ */ jsx(
653
+ DocumentBlockView,
654
+ {
655
+ block,
656
+ viewBlockId: blockIdForView(block.id),
657
+ comments: annotations.comments.get(block.id) ?? EMPTY_COMMENTS,
658
+ changes: annotations.changes.get(block.id) ?? EMPTY_CHANGES,
659
+ projectionRevision: localRevision,
660
+ listOrdinal,
661
+ readOnly,
662
+ selected: selectedBlockId === block.id,
663
+ openThreadId,
664
+ registerEditor: (node) => {
665
+ if (node) editorNodes.current.set(block.id, node);
666
+ else editorNodes.current.delete(block.id);
667
+ },
668
+ onThreadToggle: (threadId) => setOpenThreadId((current) => current === threadId ? null : threadId),
669
+ onInput: (paragraph, text) => commitText(paragraph, text),
670
+ onBlur: () => setLocalRevision(document2.revision),
671
+ onSelection: (paragraph) => readDomSelection(paragraph.id),
672
+ onKeyDown: handleEditorKeyDown
673
+ },
674
+ block.id
675
+ ))
676
+ }
677
+ )
678
+ },
679
+ page.key
680
+ );
681
+ })
682
+ }
683
+ )
663
684
  ]
664
685
  }
665
686
  )
@@ -670,6 +691,7 @@ function DocumentEditorCore({
670
691
  function DocumentArtifactSurface({
671
692
  document: document2,
672
693
  title,
694
+ showHeader,
673
695
  subtitle,
674
696
  busy,
675
697
  className,
@@ -681,6 +703,7 @@ function DocumentArtifactSurface({
681
703
  {
682
704
  modality: "document",
683
705
  title,
706
+ showHeader,
684
707
  subtitle,
685
708
  busy,
686
709
  className,
@@ -699,6 +722,7 @@ function DocumentArtifactSurface({
699
722
  function DocumentProjectionArtifactSurface({
700
723
  projection,
701
724
  title,
725
+ showHeader,
702
726
  subtitle,
703
727
  busy,
704
728
  className,
@@ -710,6 +734,7 @@ function DocumentProjectionArtifactSurface({
710
734
  {
711
735
  modality: "document",
712
736
  title,
737
+ showHeader,
713
738
  subtitle,
714
739
  busy,
715
740
  className,
@@ -974,12 +999,13 @@ function DocumentTableView({
974
999
  viewBlockId
975
1000
  }) {
976
1001
  const columnWidths = table.style.columnWidthsPt;
1002
+ const headerColor = tableHeaderTextColor(table.style.headerFill);
977
1003
  return /* @__PURE__ */ jsx(
978
1004
  "div",
979
1005
  {
980
1006
  "data-og-document-block": viewBlockId,
981
1007
  "data-og-block-kind": "table",
982
- className: "overflow-x-auto py-2",
1008
+ className: "w-full max-w-full overflow-x-auto py-2",
983
1009
  children: /* @__PURE__ */ jsxs(
984
1010
  "table",
985
1011
  {
@@ -1008,6 +1034,8 @@ function DocumentTableView({
1008
1034
  style: {
1009
1035
  borderColor: table.style.borderColor ?? "#d1d5db",
1010
1036
  background: header ? table.style.headerFill ?? "#f3f4f6" : void 0,
1037
+ // An explicitly colored run still owns its authored text style.
1038
+ color: header ? headerColor : void 0,
1011
1039
  padding: `${table.style.cellPaddingPt ?? 6}pt`
1012
1040
  },
1013
1041
  children: cell.map((run, index) => (
@@ -1026,6 +1054,32 @@ function DocumentTableView({
1026
1054
  }
1027
1055
  );
1028
1056
  }
1057
+ function tableHeaderTextColor(fill) {
1058
+ if (!fill) return "#171717";
1059
+ const hex = /^#([\da-f]{3}|[\da-f]{6}|[\da-f]{8})$/i.exec(fill)?.[1];
1060
+ if (!hex) return void 0;
1061
+ const channels = hex.length === 3 ? [...hex].map((digit) => Number.parseInt(digit + digit, 16)) : [0, 2, 4].map((index) => Number.parseInt(hex.slice(index, index + 2), 16));
1062
+ const alpha = hex.length === 8 ? Number.parseInt(hex.slice(6), 16) / 255 : 1;
1063
+ const luminanceOn = (backdrop) => {
1064
+ const linear = channels.map((channel) => {
1065
+ const normalized = (channel * alpha + backdrop * (1 - alpha)) / 255;
1066
+ return normalized <= 0.04045 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
1067
+ });
1068
+ return linear[0] * 0.2126 + linear[1] * 0.7152 + linear[2] * 0.0722;
1069
+ };
1070
+ const backdrops = alpha < 1 ? [luminanceOn(0), luminanceOn(255)] : [luminanceOn(255)];
1071
+ const darkTextLuminance = ((23 / 255 + 0.055) / 1.055) ** 2.4;
1072
+ const whiteContrast = Math.min(...backdrops.map((value) => 1.05 / (value + 0.05)));
1073
+ const darkContrast = Math.min(
1074
+ ...backdrops.map(
1075
+ (value) => (Math.max(value, darkTextLuminance) + 0.05) / (Math.min(value, darkTextLuminance) + 0.05)
1076
+ )
1077
+ );
1078
+ if (Math.max(whiteContrast, darkContrast) < 4.5) {
1079
+ return alpha < 1 ? void 0 : "#000";
1080
+ }
1081
+ return whiteContrast > darkContrast ? "#fff" : "#171717";
1082
+ }
1029
1083
  function ToolbarButton({
1030
1084
  label,
1031
1085
  shortcut,
@@ -1173,12 +1227,12 @@ function visiblePageIndexes(axis, count, scrollTop, viewportHeight, overscan, re
1173
1227
  function responsiveDocumentPageScale(page, viewportWidth) {
1174
1228
  if (viewportWidth <= 0) return 1;
1175
1229
  const naturalWidth = page.widthPt * POINT_TO_CSS_PIXEL;
1176
- return Math.min(1, Math.max(0.1, (viewportWidth - 32) / naturalWidth));
1230
+ return Math.min(1, Math.max(0.75, (viewportWidth - 32) / naturalWidth));
1177
1231
  }
1178
1232
  function pageContentStyle(page, layout) {
1179
1233
  if (layout === "continuous") {
1180
1234
  return {
1181
- padding: "24px clamp(24px, 8vw, 96px)"
1235
+ padding: "24px clamp(12px, 4cqw, 72px)"
1182
1236
  };
1183
1237
  }
1184
1238
  return {
@@ -1713,6 +1767,7 @@ var DOCUMENT_COMPOSITION_ATTEMPTS = 3;
1713
1767
  function EditableDocumentArtifactSurface({
1714
1768
  session,
1715
1769
  title,
1770
+ showHeader,
1716
1771
  subtitle,
1717
1772
  readOnly = false,
1718
1773
  onCommit,
@@ -1880,6 +1935,7 @@ function EditableDocumentArtifactSurface({
1880
1935
  {
1881
1936
  ...surfaceProps,
1882
1937
  title,
1938
+ showHeader,
1883
1939
  subtitle: subtitle ?? `${projection.blocks.length} block${projection.blocks.length === 1 ? "" : "s"}${writable ? "" : " \xB7 Read only"}`,
1884
1940
  projection,
1885
1941
  commit: writable ? applyCommit : void 0,
@@ -1892,6 +1948,7 @@ function EditableDocumentArtifactSurface({
1892
1948
  {
1893
1949
  modality: "document",
1894
1950
  title,
1951
+ showHeader,
1895
1952
  subtitle: subtitle ?? status,
1896
1953
  busy: !accessRevoked && !state.error,
1897
1954
  className: surfaceProps.className,
@@ -2192,4 +2249,4 @@ export {
2192
2249
  DocumentProjectionArtifactSurface,
2193
2250
  EditableDocumentArtifactSurface
2194
2251
  };
2195
- //# sourceMappingURL=chunk-XMXRI5JK.js.map
2252
+ //# sourceMappingURL=chunk-ZZ4744OZ.js.map