@opengeni/react 6.1.0-canary.3 → 6.1.0-canary.4
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.
- package/dist/{chunk-URNTAVGX.js → chunk-AWEBVNVX.js} +201 -59
- package/dist/chunk-AWEBVNVX.js.map +1 -0
- package/dist/{chunk-NYESIADM.js → chunk-B7TTSUEW.js} +3 -1
- package/dist/chunk-B7TTSUEW.js.map +1 -0
- package/dist/{chunk-EQEIQSRJ.js → chunk-BC7BFCMN.js} +2 -2
- package/dist/{chunk-LVHCZABQ.js → chunk-GHSSI2BK.js} +4 -4
- package/dist/components/preview-loading.d.ts +2 -0
- package/dist/composer.js +2 -2
- package/dist/connect-setup.d.ts +2 -0
- package/dist/connect.js +16 -6
- package/dist/connect.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/realtime.js +20 -20
- package/dist/realtime.js.map +1 -1
- package/dist/session-ui.js +4 -4
- package/dist/session.js +1 -1
- package/package.json +3 -3
- package/src/components/markdown.tsx +12 -7
- package/src/components/preview-loading.tsx +154 -0
- package/src/connect-setup.tsx +17 -5
- package/src/hooks/use-composer.ts +6 -0
- package/src/realtime/realtime-control.tsx +6 -8
- package/styles/compiled.css +48 -0
- package/styles/index.css +45 -0
- package/dist/chunk-NYESIADM.js.map +0 -1
- package/dist/chunk-URNTAVGX.js.map +0 -1
- /package/dist/{chunk-EQEIQSRJ.js.map → chunk-BC7BFCMN.js.map} +0 -0
- /package/dist/{chunk-LVHCZABQ.js.map → chunk-GHSSI2BK.js.map} +0 -0
|
@@ -483,10 +483,10 @@ import {
|
|
|
483
483
|
useContext as useContext3,
|
|
484
484
|
isValidElement,
|
|
485
485
|
memo,
|
|
486
|
-
useEffect as
|
|
486
|
+
useEffect as useEffect3,
|
|
487
487
|
useMemo,
|
|
488
488
|
useReducer,
|
|
489
|
-
useRef as
|
|
489
|
+
useRef as useRef3,
|
|
490
490
|
useState as useState3
|
|
491
491
|
} from "react";
|
|
492
492
|
import ReactMarkdown, {
|
|
@@ -508,6 +508,148 @@ function prefersReducedMotion() {
|
|
|
508
508
|
// src/lib/motion-inspect.ts
|
|
509
509
|
var MOTION_INSPECT_SCALE = 1;
|
|
510
510
|
|
|
511
|
+
// src/components/preview-loading.tsx
|
|
512
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
513
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
514
|
+
function PreviewLoading() {
|
|
515
|
+
const ref = useRef2(null);
|
|
516
|
+
useEffect2(() => {
|
|
517
|
+
const canvas = ref.current;
|
|
518
|
+
if (!canvas) return;
|
|
519
|
+
let ctx;
|
|
520
|
+
try {
|
|
521
|
+
ctx = canvas.getContext("2d");
|
|
522
|
+
} catch {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
if (!ctx) return;
|
|
526
|
+
const context = ctx;
|
|
527
|
+
const motion = window.matchMedia?.("(prefers-reduced-motion: reduce)");
|
|
528
|
+
let frame;
|
|
529
|
+
let time = 2;
|
|
530
|
+
let last;
|
|
531
|
+
let disposed = false;
|
|
532
|
+
let visible = false;
|
|
533
|
+
const canAnimate = () => !disposed && visible && !document.hidden && motion?.matches === false;
|
|
534
|
+
function draw() {
|
|
535
|
+
const w = canvas.clientWidth;
|
|
536
|
+
const h = canvas.clientHeight;
|
|
537
|
+
if (!w || !h || document.hidden || disposed) return;
|
|
538
|
+
const d = Math.min(window.devicePixelRatio || 1, 2);
|
|
539
|
+
if (canvas.width !== Math.round(w * d) || canvas.height !== Math.round(h * d)) {
|
|
540
|
+
canvas.width = Math.round(w * d);
|
|
541
|
+
canvas.height = Math.round(h * d);
|
|
542
|
+
}
|
|
543
|
+
const style = getComputedStyle(canvas);
|
|
544
|
+
const ink = style.getPropertyValue("--_og-preview-ink").trim() || "#bca3ef";
|
|
545
|
+
const glowColor = style.getPropertyValue("--_og-preview-glow").trim() || "#8f6ccc";
|
|
546
|
+
context.setTransform(d, 0, 0, d, 0, 0);
|
|
547
|
+
context.clearRect(0, 0, w, h);
|
|
548
|
+
const cx = w * (0.5 + 0.13 * Math.sin(time * 0.21));
|
|
549
|
+
const cy = h * (0.5 + 0.12 * Math.cos(time * 0.27));
|
|
550
|
+
const glow = context.createRadialGradient(cx, cy, 0, cx, cy, Math.max(w, h) * 0.65);
|
|
551
|
+
glow.addColorStop(0, glowColor);
|
|
552
|
+
glow.addColorStop(1, "transparent");
|
|
553
|
+
context.globalAlpha = 0.09;
|
|
554
|
+
context.fillStyle = glow;
|
|
555
|
+
context.fillRect(0, 0, w, h);
|
|
556
|
+
const rows = Math.ceil(h / 18) + 7;
|
|
557
|
+
const cols = Math.ceil(w / 18) + 7;
|
|
558
|
+
const points = Array.from(
|
|
559
|
+
{ length: rows },
|
|
560
|
+
(_row, r) => Array.from({ length: cols }, (_col, c) => {
|
|
561
|
+
const x = (c - 3) * 18;
|
|
562
|
+
const y = (r - 3) * 18;
|
|
563
|
+
const dist = Math.hypot((x - cx) * 0.8, y - cy);
|
|
564
|
+
const wave = Math.sin(dist * 0.032 - time * 0.95);
|
|
565
|
+
return {
|
|
566
|
+
x: x + (x - cx) / Math.max(dist, 1) * wave * 4,
|
|
567
|
+
y: y + (y - cy) / Math.max(dist, 1) * wave * 4,
|
|
568
|
+
l: Math.pow((wave + 1) / 2, 5)
|
|
569
|
+
};
|
|
570
|
+
})
|
|
571
|
+
);
|
|
572
|
+
context.strokeStyle = ink;
|
|
573
|
+
context.fillStyle = ink;
|
|
574
|
+
context.lineWidth = 0.65;
|
|
575
|
+
points.forEach(
|
|
576
|
+
(row, r) => row.forEach((p, c) => {
|
|
577
|
+
context.globalAlpha = 0.035 + p.l * 0.055;
|
|
578
|
+
context.beginPath();
|
|
579
|
+
if (c + 1 < cols) {
|
|
580
|
+
context.moveTo(p.x, p.y);
|
|
581
|
+
context.lineTo(row[c + 1].x, row[c + 1].y);
|
|
582
|
+
}
|
|
583
|
+
if (r + 1 < rows) {
|
|
584
|
+
context.moveTo(p.x, p.y);
|
|
585
|
+
context.lineTo(points[r + 1][c].x, points[r + 1][c].y);
|
|
586
|
+
}
|
|
587
|
+
context.stroke();
|
|
588
|
+
context.globalAlpha = 0.15 + p.l * 0.55;
|
|
589
|
+
context.beginPath();
|
|
590
|
+
context.arc(p.x, p.y, 0.85 + p.l * 0.65, 0, Math.PI * 2);
|
|
591
|
+
context.fill();
|
|
592
|
+
})
|
|
593
|
+
);
|
|
594
|
+
context.globalAlpha = 1;
|
|
595
|
+
canvas.dataset.painted = "true";
|
|
596
|
+
}
|
|
597
|
+
function stop() {
|
|
598
|
+
if (frame !== void 0) window.cancelAnimationFrame(frame);
|
|
599
|
+
frame = void 0;
|
|
600
|
+
last = void 0;
|
|
601
|
+
}
|
|
602
|
+
function tick(stamp) {
|
|
603
|
+
frame = void 0;
|
|
604
|
+
if (!canAnimate()) return;
|
|
605
|
+
if (last !== void 0) time += Math.min((stamp - last) / 1e3, 0.05);
|
|
606
|
+
last = stamp;
|
|
607
|
+
draw();
|
|
608
|
+
frame = window.requestAnimationFrame(tick);
|
|
609
|
+
}
|
|
610
|
+
function refresh() {
|
|
611
|
+
stop();
|
|
612
|
+
if (disposed || document.hidden || !visible && intersection) return;
|
|
613
|
+
draw();
|
|
614
|
+
if (canAnimate() && typeof window.requestAnimationFrame === "function") {
|
|
615
|
+
frame = window.requestAnimationFrame(tick);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
const intersection = typeof IntersectionObserver === "function" ? new IntersectionObserver(([entry]) => {
|
|
619
|
+
visible = entry?.isIntersecting === true;
|
|
620
|
+
refresh();
|
|
621
|
+
}) : void 0;
|
|
622
|
+
intersection?.observe(canvas);
|
|
623
|
+
const resize = typeof ResizeObserver === "function" ? new ResizeObserver(refresh) : void 0;
|
|
624
|
+
resize?.observe(canvas);
|
|
625
|
+
const theme = typeof MutationObserver === "function" ? new MutationObserver(refresh) : void 0;
|
|
626
|
+
for (let ancestor = canvas.parentElement; ancestor; ancestor = ancestor.parentElement) {
|
|
627
|
+
theme?.observe(ancestor, {
|
|
628
|
+
attributes: true,
|
|
629
|
+
attributeFilter: ["class", "style", "data-og-theme"]
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
motion?.addEventListener?.("change", refresh);
|
|
633
|
+
document.addEventListener("visibilitychange", refresh);
|
|
634
|
+
window.addEventListener("resize", refresh);
|
|
635
|
+
if (!intersection) draw();
|
|
636
|
+
return () => {
|
|
637
|
+
disposed = true;
|
|
638
|
+
stop();
|
|
639
|
+
intersection?.disconnect();
|
|
640
|
+
resize?.disconnect();
|
|
641
|
+
theme?.disconnect();
|
|
642
|
+
motion?.removeEventListener?.("change", refresh);
|
|
643
|
+
document.removeEventListener("visibilitychange", refresh);
|
|
644
|
+
window.removeEventListener("resize", refresh);
|
|
645
|
+
};
|
|
646
|
+
}, []);
|
|
647
|
+
return /* @__PURE__ */ jsxs3("div", { className: "og-preview-loading", children: [
|
|
648
|
+
/* @__PURE__ */ jsx4("canvas", { ref, "aria-hidden": "true" }),
|
|
649
|
+
/* @__PURE__ */ jsx4("span", { className: "og-preview-loading-label", children: "Preparing preview\u2026" })
|
|
650
|
+
] });
|
|
651
|
+
}
|
|
652
|
+
|
|
511
653
|
// src/components/soften-streaming-markdown.ts
|
|
512
654
|
function softenStreamingMarkdown(source) {
|
|
513
655
|
if (source.length === 0) {
|
|
@@ -775,10 +917,10 @@ function rehypeStreamReveal(options) {
|
|
|
775
917
|
}
|
|
776
918
|
|
|
777
919
|
// src/components/markdown.tsx
|
|
778
|
-
import { Fragment as Fragment2, jsx as
|
|
920
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
779
921
|
var InteractiveContext = createContext3({ source: "" });
|
|
780
922
|
var baseComponents = {
|
|
781
|
-
h1: ({ children, ...props }) => /* @__PURE__ */
|
|
923
|
+
h1: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
782
924
|
"h1",
|
|
783
925
|
{
|
|
784
926
|
className: "mt-5 mb-2.5 text-xl font-semibold tracking-tight text-og-fg first:mt-0",
|
|
@@ -786,8 +928,8 @@ var baseComponents = {
|
|
|
786
928
|
children
|
|
787
929
|
}
|
|
788
930
|
),
|
|
789
|
-
h2: ({ children, ...props }) => /* @__PURE__ */
|
|
790
|
-
h3: ({ children, ...props }) => /* @__PURE__ */
|
|
931
|
+
h2: ({ children, ...props }) => /* @__PURE__ */ jsx5("h2", { className: "mt-5 mb-2 text-lg font-semibold tracking-tight text-og-fg first:mt-0", ...props, children }),
|
|
932
|
+
h3: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
791
933
|
"h3",
|
|
792
934
|
{
|
|
793
935
|
className: "mt-4 mb-1.5 text-og-md font-semibold tracking-tight text-og-fg first:mt-0",
|
|
@@ -795,7 +937,7 @@ var baseComponents = {
|
|
|
795
937
|
children
|
|
796
938
|
}
|
|
797
939
|
),
|
|
798
|
-
h4: ({ children, ...props }) => /* @__PURE__ */
|
|
940
|
+
h4: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
799
941
|
"h4",
|
|
800
942
|
{
|
|
801
943
|
className: "mt-4 mb-1.5 text-og-sm font-semibold uppercase tracking-[0.04em] text-og-fg-muted first:mt-0",
|
|
@@ -803,10 +945,10 @@ var baseComponents = {
|
|
|
803
945
|
children
|
|
804
946
|
}
|
|
805
947
|
),
|
|
806
|
-
p: ({ children, ...props }) => /* @__PURE__ */
|
|
807
|
-
strong: ({ children, ...props }) => /* @__PURE__ */
|
|
808
|
-
em: ({ children, ...props }) => /* @__PURE__ */
|
|
809
|
-
ul: ({ children, ...props }) => /* @__PURE__ */
|
|
948
|
+
p: ({ children, ...props }) => /* @__PURE__ */ jsx5("p", { className: "my-2.5 leading-7 first:mt-0 last:mb-0", ...props, children }),
|
|
949
|
+
strong: ({ children, ...props }) => /* @__PURE__ */ jsx5("strong", { className: "font-semibold text-og-fg", ...props, children }),
|
|
950
|
+
em: ({ children, ...props }) => /* @__PURE__ */ jsx5("em", { className: "italic", ...props, children }),
|
|
951
|
+
ul: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
810
952
|
"ul",
|
|
811
953
|
{
|
|
812
954
|
className: "my-2.5 ml-5 flex list-disc flex-col gap-1 marker:text-og-fg-subtle first:mt-0 last:mb-0",
|
|
@@ -814,7 +956,7 @@ var baseComponents = {
|
|
|
814
956
|
children
|
|
815
957
|
}
|
|
816
958
|
),
|
|
817
|
-
ol: ({ children, ...props }) => /* @__PURE__ */
|
|
959
|
+
ol: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
818
960
|
"ol",
|
|
819
961
|
{
|
|
820
962
|
className: "my-2.5 ml-5 flex list-decimal flex-col gap-1 marker:text-og-fg-subtle first:mt-0 last:mb-0",
|
|
@@ -825,7 +967,7 @@ var baseComponents = {
|
|
|
825
967
|
// GFM task-list items carry a leading checkbox <input>; `list-none` + a
|
|
826
968
|
// negative margin pull the checkbox back to the bullet column so it aligns
|
|
827
969
|
// with the text.
|
|
828
|
-
li: ({ children, ...props }) => /* @__PURE__ */
|
|
970
|
+
li: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
829
971
|
"li",
|
|
830
972
|
{
|
|
831
973
|
className: "leading-7 marker:text-og-fg-subtle [&>ul]:my-1 [&>ol]:my-1 [&:has(>input)]:list-none [&:has(>input)]:-ml-5",
|
|
@@ -833,7 +975,7 @@ var baseComponents = {
|
|
|
833
975
|
children
|
|
834
976
|
}
|
|
835
977
|
),
|
|
836
|
-
input: ({ type, ...props }) => type === "checkbox" ? /* @__PURE__ */
|
|
978
|
+
input: ({ type, ...props }) => type === "checkbox" ? /* @__PURE__ */ jsx5(
|
|
837
979
|
"input",
|
|
838
980
|
{
|
|
839
981
|
...props,
|
|
@@ -841,8 +983,8 @@ var baseComponents = {
|
|
|
841
983
|
disabled: true,
|
|
842
984
|
className: "mr-2 size-3.5 translate-y-[2px] cursor-default accent-og-accent align-baseline"
|
|
843
985
|
}
|
|
844
|
-
) : /* @__PURE__ */
|
|
845
|
-
blockquote: ({ children, ...props }) => /* @__PURE__ */
|
|
986
|
+
) : /* @__PURE__ */ jsx5("input", { type, ...props }),
|
|
987
|
+
blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
846
988
|
"blockquote",
|
|
847
989
|
{
|
|
848
990
|
className: "my-3 border-l-2 border-og-border-strong pl-3.5 text-og-fg-muted [&>p]:my-1.5 first:mt-0 last:mb-0",
|
|
@@ -850,11 +992,11 @@ var baseComponents = {
|
|
|
850
992
|
children
|
|
851
993
|
}
|
|
852
994
|
),
|
|
853
|
-
hr: (props) => /* @__PURE__ */
|
|
995
|
+
hr: (props) => /* @__PURE__ */ jsx5("hr", { className: "my-4 border-0 border-t border-og-border", ...props }),
|
|
854
996
|
// Inline `code` vs fenced code blocks. react-markdown v10 no longer passes an
|
|
855
997
|
// `inline` flag; a fenced block is a <code> whose parent is <pre> (styled by
|
|
856
998
|
// the `pre` renderer), so a `code` reaching here is treated as inline.
|
|
857
|
-
code: ({ children, className: _className, ...props }) => /* @__PURE__ */
|
|
999
|
+
code: ({ children, className: _className, ...props }) => /* @__PURE__ */ jsx5(
|
|
858
1000
|
"code",
|
|
859
1001
|
{
|
|
860
1002
|
className: "rounded-og-xs bg-og-surface-1 px-1 py-0.5 font-og-mono text-og-sm text-og-fg",
|
|
@@ -865,9 +1007,9 @@ var baseComponents = {
|
|
|
865
1007
|
// Fenced code — quiet mono block (no card / no nested vertical scroll).
|
|
866
1008
|
pre: InteractiveCodeBlock,
|
|
867
1009
|
// Tables stay unboxed (hairline rules); hover reveals a TSV copy control.
|
|
868
|
-
table: ({ children, ...props }) => /* @__PURE__ */
|
|
869
|
-
thead: ({ children, ...props }) => /* @__PURE__ */
|
|
870
|
-
th: ({ children, ...props }) => /* @__PURE__ */
|
|
1010
|
+
table: ({ children, ...props }) => /* @__PURE__ */ jsx5(MarkdownTable, { ...props, children }),
|
|
1011
|
+
thead: ({ children, ...props }) => /* @__PURE__ */ jsx5("thead", { ...props, children }),
|
|
1012
|
+
th: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
871
1013
|
"th",
|
|
872
1014
|
{
|
|
873
1015
|
className: "border-b border-og-border px-0 py-1.5 pr-4 text-left font-medium text-og-fg first:pl-0",
|
|
@@ -875,7 +1017,7 @@ var baseComponents = {
|
|
|
875
1017
|
children
|
|
876
1018
|
}
|
|
877
1019
|
),
|
|
878
|
-
td: ({ children, ...props }) => /* @__PURE__ */
|
|
1020
|
+
td: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
879
1021
|
"td",
|
|
880
1022
|
{
|
|
881
1023
|
className: "border-b border-og-border/70 px-0 py-1.5 pr-4 align-top text-og-fg-muted [tr:last-child>&]:border-b-0",
|
|
@@ -892,10 +1034,10 @@ function markdownComponents(onSandboxFile) {
|
|
|
892
1034
|
a: ({ children, href, ...props }) => {
|
|
893
1035
|
const location = sandboxFileLocationFromHref(href);
|
|
894
1036
|
if (location !== null) {
|
|
895
|
-
return /* @__PURE__ */
|
|
1037
|
+
return /* @__PURE__ */ jsx5(SandboxMarkdownLink, { location, onSandboxFile, children });
|
|
896
1038
|
}
|
|
897
1039
|
if (isSandboxHref(href) || !href) {
|
|
898
|
-
return /* @__PURE__ */
|
|
1040
|
+
return /* @__PURE__ */ jsx5(
|
|
899
1041
|
"span",
|
|
900
1042
|
{
|
|
901
1043
|
className: "break-words font-medium text-og-fg-subtle underline decoration-dotted underline-offset-2",
|
|
@@ -905,7 +1047,7 @@ function markdownComponents(onSandboxFile) {
|
|
|
905
1047
|
}
|
|
906
1048
|
);
|
|
907
1049
|
}
|
|
908
|
-
return /* @__PURE__ */
|
|
1050
|
+
return /* @__PURE__ */ jsx5(
|
|
909
1051
|
"a",
|
|
910
1052
|
{
|
|
911
1053
|
className: MARKDOWN_LINK_CLASS,
|
|
@@ -927,7 +1069,7 @@ function SandboxMarkdownLink({
|
|
|
927
1069
|
const [state, setState] = useState3("idle");
|
|
928
1070
|
const { path, line } = location;
|
|
929
1071
|
if (!onSandboxFile) {
|
|
930
|
-
return /* @__PURE__ */
|
|
1072
|
+
return /* @__PURE__ */ jsx5(
|
|
931
1073
|
"span",
|
|
932
1074
|
{
|
|
933
1075
|
className: "break-words font-medium text-og-fg-subtle underline decoration-dotted underline-offset-2",
|
|
@@ -938,7 +1080,7 @@ function SandboxMarkdownLink({
|
|
|
938
1080
|
);
|
|
939
1081
|
}
|
|
940
1082
|
const idleTitle = line !== null ? `Open ${path} at line ${line}` : `Open ${path}`;
|
|
941
|
-
return /* @__PURE__ */
|
|
1083
|
+
return /* @__PURE__ */ jsxs4(
|
|
942
1084
|
"button",
|
|
943
1085
|
{
|
|
944
1086
|
type: "button",
|
|
@@ -998,13 +1140,13 @@ function retainedImageId(src) {
|
|
|
998
1140
|
}
|
|
999
1141
|
function MarkdownImage({ src, alt }) {
|
|
1000
1142
|
const { renderImage } = useContext3(InteractiveContext);
|
|
1001
|
-
if (!src) return /* @__PURE__ */
|
|
1143
|
+
if (!src) return /* @__PURE__ */ jsx5("span", { children: alt ?? "Image unavailable" });
|
|
1002
1144
|
if (retainedImageId(src))
|
|
1003
|
-
return renderImage ? /* @__PURE__ */
|
|
1145
|
+
return renderImage ? /* @__PURE__ */ jsx5(Fragment2, { children: renderImage({ src, alt: alt ?? "" }) }) : /* @__PURE__ */ jsxs4("span", { children: [
|
|
1004
1146
|
alt || "Image",
|
|
1005
1147
|
" (preview unavailable)"
|
|
1006
1148
|
] });
|
|
1007
|
-
return /* @__PURE__ */
|
|
1149
|
+
return /* @__PURE__ */ jsx5("img", { src, alt: alt ?? "", loading: "lazy", className: "my-3 max-w-full rounded-og-md" });
|
|
1008
1150
|
}
|
|
1009
1151
|
var markdownUrlTransform = (url, key, node) => key === "href" && node.tagName === "a" && isSandboxHref(url) || key === "src" && node.tagName === "img" && retainedImageId(url) ? url : defaultUrlTransform(url);
|
|
1010
1152
|
var REVEAL_LINGER_MS = 480 * MOTION_INSPECT_SCALE;
|
|
@@ -1049,33 +1191,33 @@ function InteractiveCodeBlock({ children, node }) {
|
|
|
1049
1191
|
const closing = lines.at(-1)?.replace(/^\s*(?:>\s*)+/, "").trim();
|
|
1050
1192
|
const complete = opening && lines.length > 1 && closing && closing.length >= opening[1].length && [...closing].every((c) => c === opening[1][0]);
|
|
1051
1193
|
if (!complete) {
|
|
1052
|
-
return /* @__PURE__ */
|
|
1194
|
+
return /* @__PURE__ */ jsx5("div", { role: "status", "aria-live": "polite", "aria-busy": streaming === true, className: "my-3", children: streaming ? /* @__PURE__ */ jsx5(PreviewLoading, {}) : /* @__PURE__ */ jsx5(
|
|
1053
1195
|
ActivityDisclosure,
|
|
1054
1196
|
{
|
|
1055
|
-
icon: /* @__PURE__ */
|
|
1056
|
-
title:
|
|
1057
|
-
running:
|
|
1197
|
+
icon: /* @__PURE__ */ jsx5(PanelsTopLeftIcon, { "aria-hidden": true, className: "size-3.5" }),
|
|
1198
|
+
title: "Preview incomplete",
|
|
1199
|
+
running: false,
|
|
1058
1200
|
expandable: false,
|
|
1059
|
-
preview:
|
|
1201
|
+
preview: "Generation stopped before the preview was ready."
|
|
1060
1202
|
}
|
|
1061
1203
|
) });
|
|
1062
1204
|
}
|
|
1063
|
-
return /* @__PURE__ */
|
|
1205
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: render({
|
|
1064
1206
|
kind: language === "opengeni-html" ? "html" : "site",
|
|
1065
1207
|
content: nodeText(children).replace(/\n$/, "")
|
|
1066
1208
|
}) });
|
|
1067
1209
|
}
|
|
1068
|
-
return /* @__PURE__ */
|
|
1210
|
+
return /* @__PURE__ */ jsx5(MarkdownCodeBlock, { children });
|
|
1069
1211
|
}
|
|
1070
1212
|
function MarkdownCodeBlock({ children }) {
|
|
1071
1213
|
const code = nodeText(children).replace(/\n$/, "");
|
|
1072
1214
|
const language = fenceLanguage(children);
|
|
1073
|
-
return /* @__PURE__ */
|
|
1074
|
-
/* @__PURE__ */
|
|
1075
|
-
language ? /* @__PURE__ */
|
|
1076
|
-
/* @__PURE__ */
|
|
1215
|
+
return /* @__PURE__ */ jsxs4("div", { className: "group/copy relative mt-3 first:mt-0", children: [
|
|
1216
|
+
/* @__PURE__ */ jsxs4("div", { className: "pointer-events-none absolute top-1.5 right-1.5 z-10 flex items-center gap-1", children: [
|
|
1217
|
+
language ? /* @__PURE__ */ jsx5("span", { className: "rounded px-1 py-0.5 font-og-mono text-[10px] uppercase tracking-wide text-og-fg-subtle/80 opacity-0 transition-opacity group-hover/copy:opacity-100 pointer-coarse:opacity-70", children: language }) : null,
|
|
1218
|
+
/* @__PURE__ */ jsx5("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx5(CopyButton, { text: code, label: "Copy code", reveal: "group-hover" }) })
|
|
1077
1219
|
] }),
|
|
1078
|
-
/* @__PURE__ */
|
|
1220
|
+
/* @__PURE__ */ jsx5(
|
|
1079
1221
|
"pre",
|
|
1080
1222
|
{
|
|
1081
1223
|
tabIndex: 0,
|
|
@@ -1086,10 +1228,10 @@ function MarkdownCodeBlock({ children }) {
|
|
|
1086
1228
|
] });
|
|
1087
1229
|
}
|
|
1088
1230
|
function MarkdownTable({ children, className, ...props }) {
|
|
1089
|
-
const wrapperRef =
|
|
1090
|
-
const tableRef =
|
|
1091
|
-
const layoutRef =
|
|
1092
|
-
|
|
1231
|
+
const wrapperRef = useRef3(null);
|
|
1232
|
+
const tableRef = useRef3(null);
|
|
1233
|
+
const layoutRef = useRef3(void 0);
|
|
1234
|
+
useEffect3(() => {
|
|
1093
1235
|
const wrapper = wrapperRef.current;
|
|
1094
1236
|
const table = tableRef.current;
|
|
1095
1237
|
if (!wrapper?.closest("[data-og-wide-table-message]") || !table) return;
|
|
@@ -1104,11 +1246,11 @@ function MarkdownTable({ children, className, ...props }) {
|
|
|
1104
1246
|
layoutRef.current = void 0;
|
|
1105
1247
|
};
|
|
1106
1248
|
}, []);
|
|
1107
|
-
|
|
1249
|
+
useEffect3(() => {
|
|
1108
1250
|
layoutRef.current?.measure();
|
|
1109
1251
|
}, [children]);
|
|
1110
|
-
return /* @__PURE__ */
|
|
1111
|
-
/* @__PURE__ */
|
|
1252
|
+
return /* @__PURE__ */ jsxs4("div", { ref: wrapperRef, className: "group/copy relative mt-3 max-w-full first:mt-0", children: [
|
|
1253
|
+
/* @__PURE__ */ jsx5("div", { className: "pointer-events-none absolute top-0 right-0 z-10", children: /* @__PURE__ */ jsx5("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx5(
|
|
1112
1254
|
CopyButton,
|
|
1113
1255
|
{
|
|
1114
1256
|
text: () => tableElementToTsv(tableRef.current),
|
|
@@ -1116,7 +1258,7 @@ function MarkdownTable({ children, className, ...props }) {
|
|
|
1116
1258
|
reveal: "group-hover"
|
|
1117
1259
|
}
|
|
1118
1260
|
) }) }),
|
|
1119
|
-
/* @__PURE__ */
|
|
1261
|
+
/* @__PURE__ */ jsx5("div", { className: "overflow-x-auto", tabIndex: 0, children: /* @__PURE__ */ jsx5(
|
|
1120
1262
|
"table",
|
|
1121
1263
|
{
|
|
1122
1264
|
ref: tableRef,
|
|
@@ -1135,11 +1277,11 @@ function MarkdownImpl({
|
|
|
1135
1277
|
renderInteractiveBlock,
|
|
1136
1278
|
renderImage
|
|
1137
1279
|
}) {
|
|
1138
|
-
const revealRef =
|
|
1139
|
-
const bodyRef =
|
|
1280
|
+
const revealRef = useRef3(null);
|
|
1281
|
+
const bodyRef = useRef3(null);
|
|
1140
1282
|
const [, bump] = useReducer((n) => n + 1, 0);
|
|
1141
1283
|
const [settling, setSettling] = useState3(false);
|
|
1142
|
-
const hadRevealRef =
|
|
1284
|
+
const hadRevealRef = useRef3(false);
|
|
1143
1285
|
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
1144
1286
|
const crystallize = (mutate) => {
|
|
1145
1287
|
mutate();
|
|
@@ -1159,7 +1301,7 @@ function MarkdownImpl({
|
|
|
1159
1301
|
}
|
|
1160
1302
|
const revealActive = reveal !== null && (streaming || reveal.hasActive(now));
|
|
1161
1303
|
const rehypePlugins = revealActive && reveal !== null ? [[rehypeStreamReveal, { reveal, now }]] : void 0;
|
|
1162
|
-
|
|
1304
|
+
useEffect3(() => {
|
|
1163
1305
|
if (streaming || revealRef.current === null) {
|
|
1164
1306
|
return;
|
|
1165
1307
|
}
|
|
@@ -1185,8 +1327,8 @@ function MarkdownImpl({
|
|
|
1185
1327
|
}
|
|
1186
1328
|
};
|
|
1187
1329
|
}, [streaming]);
|
|
1188
|
-
const wasStreamingRef =
|
|
1189
|
-
|
|
1330
|
+
const wasStreamingRef = useRef3(streaming);
|
|
1331
|
+
useEffect3(() => {
|
|
1190
1332
|
const ended = wasStreamingRef.current && !streaming;
|
|
1191
1333
|
wasStreamingRef.current = streaming;
|
|
1192
1334
|
if (!ended || revealRef.current !== null || prefersReducedMotion()) {
|
|
@@ -1207,7 +1349,7 @@ function MarkdownImpl({
|
|
|
1207
1349
|
}),
|
|
1208
1350
|
[children, streaming, renderInteractiveBlock, renderImage]
|
|
1209
1351
|
);
|
|
1210
|
-
return /* @__PURE__ */
|
|
1352
|
+
return /* @__PURE__ */ jsx5(InteractiveContext.Provider, { value: interactiveContext, children: /* @__PURE__ */ jsx5(TooltipProvider, { delayDuration: 400, children: /* @__PURE__ */ jsx5(
|
|
1211
1353
|
"div",
|
|
1212
1354
|
{
|
|
1213
1355
|
ref: bodyRef,
|
|
@@ -1216,7 +1358,7 @@ function MarkdownImpl({
|
|
|
1216
1358
|
settling && "og-markdown-settle",
|
|
1217
1359
|
className
|
|
1218
1360
|
),
|
|
1219
|
-
children: /* @__PURE__ */
|
|
1361
|
+
children: /* @__PURE__ */ jsx5(
|
|
1220
1362
|
ReactMarkdown,
|
|
1221
1363
|
{
|
|
1222
1364
|
remarkPlugins: [remarkGfm],
|
|
@@ -1253,4 +1395,4 @@ export {
|
|
|
1253
1395
|
retainedImageId,
|
|
1254
1396
|
Markdown
|
|
1255
1397
|
};
|
|
1256
|
-
//# sourceMappingURL=chunk-
|
|
1398
|
+
//# sourceMappingURL=chunk-AWEBVNVX.js.map
|