@braincrew-lab/langchain-canvas 0.1.6 → 0.1.7

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 (2) hide show
  1. package/dist/index.js +9 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1522,6 +1522,11 @@ var TEMPLATES = {
1522
1522
  }
1523
1523
  };
1524
1524
  var SLIDE_W = 1280;
1525
+ var SCROLL_FIX = "<style>html,body{overflow:auto!important;height:auto!important;min-height:100%!important}</style>";
1526
+ function withScrollableBody(html) {
1527
+ const i = html.lastIndexOf("</body>");
1528
+ return i === -1 ? html + SCROLL_FIX : html.slice(0, i) + SCROLL_FIX + html.slice(i);
1529
+ }
1525
1530
  function useSlideFit(ratio, boxRef) {
1526
1531
  const [scale, setScale] = useState(1);
1527
1532
  const [rw, rh] = (ratio ?? "16:9").split(/[:x/]/).map(Number);
@@ -1556,12 +1561,14 @@ function HtmlRenderer({ artifact: artifact2 }) {
1556
1561
  const [mode, setMode] = useState("design");
1557
1562
  const lastSelfHtml = useRef(null);
1558
1563
  const srcDocRef = useRef("");
1564
+ const isFixedSlide = Boolean(artifact2.meta?.ratio);
1559
1565
  const srcDoc = useMemo(() => {
1560
1566
  if (mode === "design" && artifact2.data.html === lastSelfHtml.current) return srcDocRef.current;
1561
- srcDocRef.current = withInspector(artifact2.data.html);
1567
+ const base = withInspector(artifact2.data.html);
1568
+ srcDocRef.current = isFixedSlide ? base : withScrollableBody(base);
1562
1569
  lastSelfHtml.current = null;
1563
1570
  return srcDocRef.current;
1564
- }, [artifact2.data.html, mode]);
1571
+ }, [artifact2.data.html, mode, isFixedSlide]);
1565
1572
  const selected = selections.filter((s) => s.artifactId === artifact2.id);
1566
1573
  const single = selected.length === 1 ? selected[0] : null;
1567
1574
  useEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braincrew-lab/langchain-canvas",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "A live canvas for LangChain agents — stream documents, charts, and rich artifacts into a React panel.",
5
5
  "license": "MIT",
6
6
  "type": "module",